There’s More to Life than just USB! USB Magic Eye Put a Stop to Throwawayism! Buses beyond USB and PC ATM 18 Logic Analyzer Fourier Analysis using LTspice & Excel Dimmer wit My First AVR-USB QUOTE G ORPiH PGE5 QNLI !\l£ AT VVWW. SUN STD (NIE.COM OR CALL 1-000-220-8 1 BB NO MATTER YOUR RGB PROTOTYPES SHOULD BE THE EASY PART CIRCUITS THE EASIEST PCB COMPANY TO DO BUSINESS WITH Sunstone Circuits® pioneered the online ordering of printed circuit boards and is the leading PCB solutions provider with more than 35 years of experience in delivering quality prototypes and engineering software. With this knowledge and experience, Sunstone is dedicated to improving the PCB prototyping process from quote to delivery (Q2D®). Did You Know? Sunstone Offers: • Controlled impedance testing • Free 25-point design review • Fine lines and spacing [.003] • Free shipping & no NRE’s • RoHS compliant finishes • Flex / Rigid Flex Boards • Online Quote & Order • PCB123® design software • RF / Exotic Materials • Over 99% on-time or early delivery • Best PCBs in the industry • Live customer support 24/7/365 TRANSMITTERS * RECEIVERS * TRANSCEIVERS IMA HID * CONTROL KEYLESS ENTRY „ R p r.vi id RF MODULES LOW COST • I ONS RjaniSE GPS MADE SIMPLE w flF MODULE RXU 4 TB-IR-S LOT 1D0OO Hij^h Sensitivity Easy Serial Intertiice low Power Consumption High Performance Low Coit ultra Compact These easily applied GPS modules blend high perform a nce> tow power and cost cffe ctivencss into 3 single compact, SIVIO package. The SiRFstar 111 low-power chipset minimizes power consumption and provides exceptional sensitivity. The receivers feature an on-board LNA and SAW filter with a choice of an integrated or external antenna. Mo other fiF components are needed and the modules standard nmea data output makes integration easy. ThJE FAST TRACK TO WIRELESS SUCCESS bn* development systems contain everything needed to evaluate the linx product of your choice and implement it in record time. 90 1 SB Url Line TErffttnuIGIES Merlin, OR 97532 Mill ] j ;j IiIlI i i 1 £:| 1 1 ■] r ^ p r |j i 1 1 ■ p | 1 ??iT E ■ 1 1 1 L " j! __3 Big Deal Elektor & Circuit Cellar In 2011 it will 50 years ago when a Dutch- man called Bob van der Horst launched his magazine Electronica wereld (Electron- ics world). A bit later the use of the title started to present problems and Bob’s periodical continued under the name Elektuur in 1964. Bob did not fail to see the cross-border potential of the publica- tion, especially for Germany. Before long, Elektor — as all non-Dutch editions were called — also appeared in English and French, followed by numerous licensed editions for lesser language areas like Ital- ian and Spanish, and the publication as a whole grew massively. Now, 50 years on, Elektor is poised to cross the Atlan- tic and enter the US market. Keen read- ers will object that a localized edition of Elektor has been on publication the US and Canada since January 2009, so what’s the big deal? The answer is: we’ve added US publication Circuit Cellar to the Elektor portfolio. Circuit Cellar equates to Steve Ciarcia, the resident author of the famous ‘Circuit Cel- lar’ section in (equally famous) Byte Maga- zine. While Byte drowned in the tidal wave called online publishing, Steve strength- ened and expanded Circuit Cellar. Over the years ‘CC’ became a leading periodical on embedded electronics, graced by readers in all corners of the globe. CircuitCellara nd Elel■«■ 4 01-2010 elektor CONTENTS Volume 2 January 2010 no. 13 20 My First AVR-USB Sure, countless microcontroller boards featuring a USB connection have made it to the Projects and News pages of Elektor. However, the AVR-USB hardware stack wasn’t covered till now. A30-dollar board and free software utilities to play with are going to change that as you meet the USB-AVR family. 46 Linux Symposium If only to confirm that Linux for embedded applications is hot. 48 ATM18 Logic Analyzer This month the Elektor ATM18 is used for test & measurement. 52 Fourier Analysis using LTspice and Excel A straightforward guide to frequency and time domain analysis. 32 USB Magic Eye A green glowing indicator tube as a CPU activity meter? Sure, with power and control both provided by the USB port. A simpler variant on the circuit, using a moving-coil meter, is also described. 56 All-Analog Design Tips LEDs double as photosensors Incandescent lamp flasher Communication with a laser How low can it go? Low voltage indicator 60 Vacuum Pump A tool to improve the quality of your homebrew PCBs. 48 ATM18 Logic Analyzer If it is logic levels rather than pulse shapes that matter, a software- based logic analyzer like the one described here can offer a very power- ful alternative solution. 68 Dimmer with a Micro The idea for this design came about because the author wanted to re- place a double switch with a switch/dimmer combination that wasn’t available off the shelf. The existing double switch was retained and the dimmer circuit described in this article was built into the light fitting in the ceiling. 64 MIAC for Home Automation The CAN bus is not just for vehicles! 68 Dimmer with a Micro For incandescent and halogen lamps up to 300 watts. 72 Gerard’s Columns DBA 74 Hexadoku Our monthly puzzle with an electronics touch. 75 Retronics: Put a Stop to Throwawayism! Regular feature on electronics ‘odd & ancient’. 84 Coming Attractions Next month in Elektor magazine. elektor 01-2010 5 e ektor international media bv Elektor International Media provides a multimedia and interactive platform for everyone interested in electronics. From professionals passionate about their work to enthusiasts with professional ambitions. From beginner to diehard, from student to lecturer. Information, education, inspiration and entertainment. Analog and digital; practical and theoretical; software and hardware. There’s More to Life than just USB! UHllMjKjk Eye PM 4 S-ieji tn ThravAWjylfml Buses beyond USB and l-'C f Hurler AriJEysli uiinqi ATM IS L¥ipfc**BMtl Log k A na lyzcr it DlmsrntT withxiiiljLro My First AuR'USB [3 ektor [3 ektor ANALOG • DIGITAL MICROCONTROLLERS & EMBEDDED AUDIO • TEST & MEASUREMENT tf'i No. i, JANUARY 2010 ISSN 1947-3753 Elektor aims at inspiring people to master electronics at any personal level by presenting construction projects and spotting developments in electronics and information technology. Elektor (ISSN 1947-3753) is published monthly (except for one issue in July/August) at $39.95 per year, Canada add $11.00 per year; by Elektor International Media LLC, 4 Park Street, Vernon, CT 06066, USA. Phone: 860-875-2199, Fax: 860-871-0411. www.elektor-usa.com Elektor is also published in French, Spanish, German and Dutch. Together with franchised editions the magazine is on circulation in more than 50 countries. International Editor: Wisse Hettinga (w.hettinga@elektor.com) Editor: Jan Buiting (editor@elektor-usa.com) International editorial staff: Harry Baggen, Thijs Beckers, Eduardo Corral, Ernst Krempelsauer, Jens Nickel, Clemens Valens Design staf Antoine Authier (Head), Ton Giesberts, Luc Lemmens, Daniel Rodrigues, Jan Visser, Christian Vossen Graphic design / DTP Giel Dols, Mart Schroijen Publisher: Hugo Van haecke (h.vanhaecke@elektor.com) Marketing Carlo van Nistelrooy Customer Services: sales@elektor-usa.com Subscriptions: Elektor US, 4 Park Street, Vernon, CT 06066, USA. Phone: 860-875-2199, Fax: 860-871-0411 Internet: www.elektor-usa.com E-mail: custservus@elektor.com 6 01-2010 elektor Elektor Personal Organizer 2010 Complete with a free pen and SMD-tool The Elektor Personal Organizer 201 0 makes planning your appointments a real pleasure, and you always have ready access to have handy information that everyone who works with electronics needs to know. / \ In addition to the usual features such as an appointments calendar, address book and notes pages, this organizer has around 40 pages packed with useful information foryou as an elec- tronics specialist, both professionally and in your leisure time. For example, there is an extensive collection of formulas and tables for calculating current and voltage, component descriptions, physical constants, connector pin assignments, and much more. The Organizer at a glance: • 2010 calendar (two pages per week) • Appointments calendar (with corner perforations) in six languages • 40 pages of technical information on electronics • Seven sections, separated by tab sheets • Alphabetic address and telephone book • Handy monthly planner • Lined pages for your notes • Five credit-card pockets and a pocket for business cards • Push-button closure • Six-ring binder mechanism (diameter 25 mm) • Luxurious grey imitation-leather binding ISBN 978-90-5381 -247-1 • $40.20 Further information and ordering at www.elektor.com/prganizer Head Office: Elektor International Media b.v. POBoxn NL-6114-ZG Susteren The Netherlands Telephone: (+31) 46 4389444, Fax: (+31) 46 4370161 US Advertising: Strategic Media Marketing, Peter Wostrel, 1187 Washington St., Gloucester MA 01930 USA. Phone: 978-281-7708, Fax: 978-281-7706 E-mail: peter@smmarketing.us Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photographs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software carriers and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopying, scanning an recording, in whole or in part without prior written permission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may exist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publisher to alter the text and design, and to use the contents in other Elektor International Media publications and activities. The Publisher cannot guarantee to return any material submitted. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2010 Printed in the USA elektor 01-2010 7 NEWS & NEW PRODUCTS Real-time operating system cohabits with Windows on PC platforms The TenAsys INtime real-time operating sys- tem allows embedded system developers to run multiple instances of the OS alongside Windows on the same multi-core processor platform. Release 4.0 allows supports this advanced functionality. INtime® Application Win32 Processes Real-time Processes Windows Virtual: Machine INtime Virtual Machine Pentium*-class Processor INtime software combines deterministic, hard real-time control with standard Win- dows operating systems, including Win- dows Vista, Windows XP, Windows XP Embedded, Windows 2000 and Windows Server 2003, without requiring additional hardware. INtime is specifically designed to take advantage of the powerful capabili- ties of the x86 processor architecture, so that real-time and non-real-time applica- tions can run in separate virtual machines on a single computer to provide cost-effec- tive, reliable control that is easy to develop and maintain. Previously, embedded systems requiring mul- tiple real-time OSs and Windows needed to employ multiple independent processor plat- forms. By consolidating multiple operating environments into one platform, embedded system suppliers can save cost and increase the scalability of processing power. With INtime 4.0, developers don’t have to worry about mutual interference between several high-priority real-time processes. Time-critical processes can be configured to run on dedicated cores of a multi-core proc- essor, fostering modular design of real-time systems without the burden of resolving pri- orities between deterministic processes. If processes running on separate cores need to signal one another, INtime 4.0 provides a reliable, deterministic way to do this with shared memory. Back-illuminated CCD sensor targets low-light applications In conventional back-illuminated CCD imaging sensors, the silicon substrate thickness is reduced to just a few dozen microns. As a result, infrared light is more likely to pass through the substrate, decreasing the quantum efficiency of the sensor in the infrared region. A thicker silicon substrate increases the quan- tum efficiency in the near-IR region, but it reduces the resolution due to charge spreading. Hamamatsu Photonics has now developed fully depleted CCD sen- sors using a unique thick silicon substrate that has no neutral region when a bias volt- age is applied, which enables them to deliver relatively high quantum efficiency in the near-IR region while avoiding any significant loss of spatial resolution. This improved near-IR sensitivity makes these back illuminated CCD devices well suited to astronomy applications. The new Hamamatsu S10747-0909 fully depleted CCD imaging sensor is specifically designed for operation at low light levels and is available with a resolution of 512 by 512 pixels at a pixel size of 24 x 24 pm. It has an outstanding spectral response range from 300 to 1200 nm, with a peak quantum efficiency greater than 90%. Typical CCD sensors have very low sensitivity at 1000 nm, but the new S10747-0909 exhibits a quantum effi- ciency of 70% at this wavelength. In fact, the quantum efficiency is significantly improved over the entire range from 400 nm to 1200 nm in comparison with a typical back-thinned CCD image sensors. This makes the S10747-0909 suitable for a wide range of applica- tions, in particular as a detector for near-IR imaging of astronomical objects. Hamamatsu can also produce devices in this technology that can be butted on all four edges to create 100-megapixel imaging sensors with areas of 288 cm 2 or larger by tiling individual devices in an array. www.sales.hamamatsu.com (090951-I) INtime 4.0 is a free upgrade for all INtime for Windows customers that are covered by an active TenAsys support contract. Requests fora fully functional evaluation copy of the INtime RTOS for Windows can be submitted on the TenAsys website. www.tenasys.com/intime (090951-II) Development environment brings wireless networking to sports watches Texas Instruments has announced eZ430- Chronos, which it claims to be first custom- izable development environment for sports watches. It enhances the popular line of eZ430 development tools to help develop- ers utilize the integration, ultra-low power and wireless features of the Tl’s CC430 microcontroller (MCU). Chronos is designed to give users all the hardware and software they need to start developing wireless networking applica- tions, regardless of their programming expertise. It has sensors for measurement and motion-based control and can serve as 8 01-2010 elektor a central hub for nearby wireless sensors to give users remote access to real-time data from devices such as pedometers and heart rate monitors. Chronos also includes a USB RF access point for wireless set-up and PC connectivity, as well as several production-ready open source projects to foster evaluation, design and community collaboration. The key benefits of eZ430-Chronos include a wearable form factor to support develop- ment in remote locations, support for three frequency bands (915, 868 and 433 MHz) to enable worldwide use, and an integrated three-axis accelerometer for motion sensi- tive control, along with sensors for measur- ing parameters such as altitude, tempera- ture and battery voltage. Other features include an eZ430 emulator for simplified programming and debug- ging on a base software framework and RF functions, internal CC430 memory for data storage, a large 96 segment LCD dis- play driven directly by the CC430, and a USB RF access point for PC communication and automation. http://focus.ti.com/docs/toolsw/folders/ print/ez430-chronos.html (090951-111) Chameleon AVR 8-bit and Chameleon PIC 16-bit development boards Chameleon™ from Nurve Networks is an evolutionary step in high performance, small footprint application development boards. Similar in concept to the BASIC Stamp™ and Arduino™, Chameleon takes these products to the next level with sub- stantial increased processing power and I/O capability. Simply put, Chameleon is a com- puter with a credit-card form factor that features two processors, nine processing cores, 1 MB of on-board flash, 64 KB of EEP- ROM, and more than 180 MIPS of process- ing power. The Chameleon’s numerous 1 / 0 interfaces include composite video for NTSC/PAL generation, VGA, audio out, and PS/2 for a keyboard and mouse. The Chame- leon also has several digital I/O ports and analog inputs, making it ideal for industrial controllers, experimentation, education, wearable computing, and hobbyist use. The Chameleon comes in two flavors: AVR 8- bit and PIC 16-bit. The AVR version uses the Atmel AVR328P 8-bit microcontroller, while 01 02 03 DOWNLOAD our free CAD software DESIGN your two or four layer PC board SEND us your design with just a click e^Dresspcbpom j the PIC version uses the Microchip PIC24 16- bit microcontroller as the main master proc- essor (client), along with the Parallax multi- core Propeller chip as the media processor (server). Instead of tasking a single proces- sor system with everything, the Chame- leon offloads the heavy lifting to the mul- ticore Propeller chip, which has 8 process- ing cores to perform tasks such as video and audio output, keyboards and mouse input, and so on. The AVR or PIC MCU sim- ply sends commands to the Propeller chip over a high speed SPI interface to have the Propeller execute various operations, using a simple API that usually consists of a just few lines of code for any task. This makes AVR or PIC programming very easy, and with simple APIs you can develop very com- plex, rich media applications that leverage the powerful Propeller chip’s media render- ing capabilities and huge software library. It takes only a few lines of code to generate TV and VGA signals and read inputs from a keyboard and mouse. The AVR and PIC versions are both designed to have Arduino I/O header compatibility as much as possible, but the AVR version is also fully software compatible, so the Arduino elektor 01-2010 9 NEWS & NEW PRODUCTS environment (as well as AVRStudio) can be used to develop software forthe AVR version. The PIC version works with MPLab as well as a stand-alone ‘Arduino-like’ tool chain devel- oped by Nurve Networks that uses a boot loader. Both versions thus have a boot loader hosted development environment where all you need is a text editor and a USB port - no programming tools are necessary. The Chameleon is a complete AVR/PIC application development board as well as a Propeller development board. Both processors can be programmed and used independently. Additionally, the AVR/PIC and Propeller have their own digital I/O ports, so in principle you can run two dif- ferent applications on the Chameleon or use the processors together via the SPI link. In addition, the Propeller subsystem is compatible with most Propeller devel- opment boards and the HYDRA™ system, which means that the Chameleon can run most of these applications with little or no modification. www.xgamestation.com/browse_products. php?category=g (090951-IV) NXP launches low-cost 32-bit MCU family With unit prices starting at just 65 cents, the LPC1100 flash-based microcontroller family has the potential to displace 8-bit and 16- bit MCUs. Designers can now get 32-bit per- formance at power levels and prices usually associated with devices offering much lower performance. Initially announced with 15 members, the LPC1100 family is based on the ARM Cortex- Mo IP core. It offers a seamless entry point for designers currently using 8-bit and 16-bit MCUs who want to introduce the scalable ARM architecture across their entire prod- uct development range. With this family, designers can take advantage of modern ARM-based design tools and techniques for low-power devices. According to NXP, the 50-MHz LPC1100 offers more than 45 DMIPS of perform- ance, considerably more than what can be achieved by 8-bit MCUs (typically under 1 DMIPS) or 16-bit MCUs (typically 3 to 5 DMIPS). In addition to executing basic control tasks, the LPC1100 can han- dle sophisticated algorithms. Reduced task execution time also translates into lower power consumption. With extensive power optimization features, the MCU can operate at less than 10 mA. The key features of the NXP LPC1100 fam- ily of microcontrollers include 32 vectored interrupts, four priority levels, and dedi- cated interrupts from up to 13 GPIOs; a UART, two 16-bit and two 32-bit timers; power-on- reset and multi-level brown-out-detection; and an eight-channel, 10-bit ADC. The LPC1100 family is supported by devel- opment tools from IAR, Keil, Hitex, and Code Red. NXP plans to offer an easy to use, comprehensive development tool platform at less than $30. Pricing (in 10,000-piece quantities) for family members in the 33- pin package ranges from $0.65 to $0.95, with flash memory capacities of 8 to 32 KB. For socketed applications, 48-pin LPQFP and PLCC44 packages will also be available. All the devices are scheduled to be available in early December. www.standardics.nxp. com/products/lpciooo/lpcnxx/ (090951-VII) Silicon-air batteries boast unlimited shelf life Researchers atTechnion (Israel Institute of Technology) have developed an environ- mentally friendly silicon-air battery that can supply non-stop power for thousands of hours without needing to be replaced. Utilizing oxygen and silicon - the second most plentiful element in the earth’s crust - this battery technology has the advantages of light weight, unlimited shelf life, and high tolerance to both humid and extremely dry conditions. Potential uses include medi- cal applications such as powering diabetic pumps or hearing aids, sensors, and micro- electronics devices. According to lead researcher Yair Ein-Eli in the Materials Engineering department, sili- con-air batteries can be used in the same way as existing batteries, but as a safe, non- toxic, stable and readily available material, silicon enables the development of very lightweight batteries with infinite shelf life and high energy capacity. Silicon-air batteries could provide signifi- cant savings in cost and weight because they eliminate the need for the cathode structure of conventional batteries. The cathode of a silicon-air or metal-air battery is formed by the oxygen taken from the air through a membrane. Ein-Eli estimates that in three to four years, silicon-air batteries could be made more powerful as well as rechargeable. In ten years, he says, it may be possible to pro- duce silicon-based electric car batteries that can would turn back into sand that could be recycled to make new batteries. According to Ein-Eli, lightweight, long-last- ing metal-air batteries are already used in hearing aids. There have also been some attempts to upgrade this battery technol- ogy for use in electric cars and portable electronic devices, with increased interest in this topic sparked recently when Toyota and Panasonic began joint efforts to adapt zinc-air battery technology for use in future electric cars. http://pard.technion.ac.iI/press/PressrelE.asp# (o9°95i-VIII) Tiny isolated voltage/ current detectors come in stretched SO-8 package Avago Technologies has announced two new miniature voltage/current threshold detection optocouplers for use in a wide 10 01-2010 elektor NEWS & NEW PRODUCTS range of industrial control applications. The ACPL-K370 and K376 optocouplers are designed to detect AC/DC voltages and convert the voltage to a logic signal across an optical coupling barrier that provides safe isolation in the electronically noisy environments found in industrial applica- tions. Applications include limit switch sen- sors, low voltage detectors, relay contact monitors, relay coil voltage monitors, and current sensors. The ACPL-K370/K376 series uses thresh- old sensing input buffer ICs that allow the threshold level to be set over a wide range of input voltages up to 1140 V p|< using a sin- gle external resistor. The key features of the optocoupler series include a small stretched SO-8 (SSO-8) package that meets 8-mm clearance and creepage requirements and needs thirty percent less PCB space than a dual inline package (DIP-8). In addition, the optocou- pler input buffer provides several features that enhance thresh- old sensing, such as hysteresis for extra noise and switching immunity, a diode bridge for easy use with AC input signals, and inter- nal clamp- ing diodes to protect the buffer and LED against overvolt- age and over- current transients. With the ACPL-K370/K376 series, Avago now offers an SSO-8 package option in addi- tion to existing DIP packages for optocou- pler devices used in high voltage industrial applications. The ACPL-K376 is a low-cur- rent version of the ACPL-K370. To reduce the operating current, the ACPL-K376 has a high-efficiency aluminum gallium arsenide LED that provides more light output with less drive current. Additional features include ±5% voltage detection accuracy, user configurable sin- gle/dual detection levels, built-in hystere- sis, 1.32 mA threshold current (ACPL-K376), logic-compatible output, 2 V to 18 V supply voltage range, and an operating tempera- ture range of -40 to +i05°C. www.avagotech.com (090951-X) JOULE™ LED lighting systems shine with Evonik Cyro ACRYLITE® SuPure® acrylic polymer When OSRAM Sylvania unveiled its JOULE™ LED lighting system in 2003, its goal was to provide OEM designers with a reliable, industry-standard LED light source that simplifies the design process. They pioneered LED standardization with the JOULE system, allowing OEMs to offer customers a high quality, standardized automotive LED system without the com- plexity or cost of a custom assembly. The JOULE system was first installed in the 2006 Mercury Mountaineer and the 2008 Chevrolet Malibu LTZ. Five years after product inception, OSRAM wanted to revamp their product to better serve the market they created and stay ahead of their competitors. In essence, they needed to keep their innovative product innovative. During the redesign process, one aspect of the JOULE LED lighting system that needed an overhaul was the light pipe. The job of the light pipe is to transfer light from the LED source to the output without losing any luminosity in the process. This requires pinpoint accuracy in the light pipe design and high optical clarity in a dimensionally stable clear acrylic polymer - properties that are gener- ally difficult and expensive to achieve together. OSRAM called on DTI Molding Technologies (Illinois) to assist in part design and selection for the newest generation of the JOULE system. The new design required some very com- plicated molds, and they needed to find an acrylic material that could achieve a high level of optical clarity but not damage the mold cores during processing. After evaluating five acrylic poly- mers they selected Evonik Cyro’s ACRYLITE® SuPure acrylic polymer, which is ideal for light pipes and light engines. It is designed to deliver extreme clarity for product applications in which no defects can be detected by the naked eye under varying light conditions. This enables maximum light transmission efficiency with minimal loss. Another improvement achieved with the new acrylic polymer was green design. The auto- motive industry sees a growing demand for environmentally friendly manufacturing. More and more cars are attaining higher fuel efficiency with lower overall emissions, but other areas can be also be improved. Lighting is one of them, specifically in terms of optical material selection for LED-based applications. ACRYLITE SuPure’s clarity provides high light transmission at 92%, complementing the brilliant LED source used in the OSRAM JOULE system. The result is a high efficiency sys- tem that delivers bright illumination while consuming less power. ACRYLITE SuPure acrylic also provides other environmental benefits. It’s lighter than glass optics, which helps reduce the overall vehicle weight to improve fuel efficiency. It also eliminates the need for coatings and lasts longer than glass alternatives, thereby reducing waste. www.cyro.com/methacrylates/us/products/ molding_compounds/products/acrylitesupurepolymers/ www.osram.com/osram_com/Professionals/Automotive_Lighting/Products/JOULE_LED_Systems/index.html (090951-V) elektor 01-2010 11 NEWS And the Winners are... Elektor Foundation Award 2009 prizes for people with a passion E L E K T 0 R F 0 U N D A T 1 0 N Elektor Foundation As part of the Elektor Live! event staged on November 21, H; 2009 in Eindhoven, The Neth- lr >grid | lujj^ ^ lldlrf ^ erlands, prizes were awarded for man ’ Elektor Foundation the first edition of the Elektor Foundation Award. Over the past months, members of Elektor’s international editorial team exam- ined their local markets and nominated people and companies for the Award. The selec- tion was based not just on erudition in the field, but also on the candidates’ very own ways of using electronics, now and in the past, to make a contribution to society that matters. This criterion was found back in all winners: K • Mr Hossfeld from Holland for rigging irv m ft J up an emergency 80m transmitter F during the great flood of 1953; ..Im Akkermans Elektor Interna itional Media Don Managing Director, ^ • the DigitalSTROM organization __ j^such a nice job” . from Switzerland for applying “this prize avvar wisse Hettinga chip technology to rigorously Ingrid iv n reduce the power consump- tion of household appliances; • Mrs Fatma Zeynep Koksal from Turkey for her network and activities to pro- mote electronics and other technologies in her country; • Bart Huyskens from Belgium for his tireless effort in working with robots I pie, and now awarded with rising stu- I dent numbers for his school. j The registered aim of the Elektor 1^1 Foundation V ^ “to generate, on a global scale, ■bW ij ^ free publicity and goodwill for y projects and people who have accomplished extraordinary ^ >q|l« achievements towards technol- ogy and electronics”. Hossfeld rded for his efforts Further information: www.elektorfoundation.org Bart Huyskens e spouses, sure! - .. V“ ■■ J 1 * * * V . M, » nh £^?bI vli ; ^ r m f 1 r i a ju m * 12 01-2010 elektor REPORT Burning Amp Festival 2009 The third edition of the Burning Amplifier Festival started off on a crisp October 18, 2009 morning at the Sausalito Yacht Club at San Francisco Bay. Jan Didden reports. The BAF event is organized by the Editor of www.diyaudio.com. With generous sup- port by Audio Amateur Inc., Elektor USA and NHT, BAFog had a full smorgasbord of listening sessions, presentations and great ad-hoc discussions. But first things first... breakfast was served by Natasja, compli- ments of Elektor (photo 1 ). fessional looking units by Ti Kan (AMB audio) and the wood retro looking stuff by Carpenter, to ‘steam-punk’ designs (Photo 4). Audio equipment engineer- ing as an art form, a synthesis between the music flowing from DACs and amps and speakers as well as the visually stimulating look of the realizations. stages (metal can of course) to the LME49811 power amp Vas and driver BAFog breakfast sponsored by Elektor and served by Natasja from Denmark; she’s in the US on a one- year sponsored PhD program in Medical Biology. Jack Hidley of Audio Consulting Services (Photo 2) gave a presentation on the design considerations at the lower xover point in 3-way speaker systems. That point is typi- cally between 80-150 Hz which can be problematic as driver impedances can vary wildly in this frequency range and passive xovers don’t work well with varying load impedances. Jack showed that if you care- fully match the xover to the driver and the enclosure mechanical roll off you can get a satisfactory solution. Nelson Pass (Photo 3) showed an extremely simple power amplifier that ‘even a lawyer could build’ as someone remarked: just one depletion mode power MOSFET (an IXYS IXTH20N50), see http://www.diyaudio. com/forums/pass-labs/153832-pass-delite- amp-baf.html. Linear Integrated Systems (LS) presented very low noise JFET devices replacing those popular Toshiba devices from way back (N- channel LSK170, P-channel LSJ74 dual N- channel LSK389). They also demoed an all- FET power amplifier with all LinearSystems devices right up to the output which used vintage 2SJ60 V-FETs. The bulk of the show was of course designs and projects by diy-ers; from the very pro- Jack Hidley previously with NHT, now with Audio Consulting services talked about xover issues. The range of technologies used was diverse: Mark Brasfield (audioman54) demoed a system almost entirely built with National analog products, from LME4g6oo’s and 49710’s in the DAC power supply regulators, via the LME497i3’s in the amplifier input ‘Steam punk’ by the ocean. Nelson Pass explaining the one-FET amp ‘that even lawyers can build’... stages. At the other end of the spectrum were Jack (Electraprint) Elliano’s creation with type 211 transmitting tubes in SE class A2 mode, outputting 45 watts in (gasp!) grid current mode. In the Technical Creativity department, David Gravereaux (‘davygrvy’) dismantled a radar speed gun and pointed the beam at his speaker’s cone. Connecting the demod- ulated output of the radar unit to a scope showed him a wave form representing the cone excursion. A sort of poor man’s Klippel system that can help you operate your driv- ers in their linear region. The participation of accomplished design- ers like Nelson Pass from Pass Labs, John Curl of Parasound fame and Siegfried Link- witz of Linkwitz Lab made it clear that even amateurs can contribute to the state of the art. Audio amateurs and DIY-ers spend lots of money and time to realize their vision with great enthusiasm and persistence, and the reward is a great sounding and great looking piece of equipment or speaker. I am looking forward to next year’s edition. Be there and be counted at www.burningamp.com! All photos by Dana Brock. (090959-I) elektor 01-2010 13 MICROCONTROLLERS There’s More to Life than just USB! how to connect your own project to a PC By Clemens Valens (Elektor France Editorial) Lots of projects use the office computer or a laptop as the ‘brain’ - for example, for saving data, as a powerful controller, or for accessing the Internet. The serial or parallel ports that once used to provide this link have been replaced by USB connections. So, now what do we do? There are a number of solutions for connecting a peripheral to a computer - you only have to take a look round the computer to see that. For example, the laptop on which I’m writing this article has an S/PDIF output, two audio inputs (microphone and line), four USB ports, an Ethernet port, and a modem socket. This model doesn’t have FireWire. The computer also supports Wifi and Bluetooth, but not IrDA. On older computers, we find other ports like PS/2, RS-232 (COM ports), and the parallel port. All these ports are readily acces- sible, without needing to open up the computer. Each port has its advantages and disadvantages, and you need to choose the one that suits the project concerned. The choice M 01-2010 elektor MICROCONTROLLERS of the computer’s expansion or communications port not only affects the hardware complexity of the interface to be created between the computer and the project, but also has a bearing on the complexity of the software. These two dimensions are proportional to the amount of data to be transferred and the transmission speed you want. This article is not going to tackle computer expansion cards, as these days it really isn’t easy to build your own expansion cards. It’s much easier just to buy this sort of card ready made, complete with drivers. Asynchronous serial ports... ...are probably the easiest ports to use when you want to drive a project. Serial ports (let’s leave off the ‘asynchronous’ to keep it short) are well integrated into operating systems and usually only need three wires. There are lots of software tools, free or paying, for serial ports, there is plenty of documentation, and the commu- nication protocol is easy to understand. What’s more, many micro- controllers have one or more compatible asynchronous serial inter- faces (UARTs), and even if there isn’t one, it’s easy enough to create in software. The older serial ports are virtually nonexistent on computers these days, but there are alternatives. First of all, the serial/USB port. This is a little circuit that converts a USB port into a serial port. To the operating system (OS), the USB serial port appears like a conven- tional port that can be used in the way we are used to. This solution is simple to use: all you have to do is add a serial/USB chip to your project. The commonest ones are the PL2303 from Pro- lific [1] , the CP2 1 0x family from Silicon Labs [2] and the FTDI devices [3] (Figure 1 ). The OS drivers are supplied by the chip manufacturers. For the user, it’s almost like a conventional serial port, though it is sometimes a bit slow. Remember to set the driver latency (whatev- er’s that?) to minimum if possible. Another possibility is to use an Ethernet serial link. There are lots of commercially-available serial/Ethernet convertors (also called serial servers). Using the driver from the convertor manufacturer, you can add one or more virtual serial ports to the computer’s operating sys- tem. These ports can be accessed just like conventional ports. Serial/ Ethernet ports (Figure 2) are more expensive than serial/USB ports, but they do offer electrical isolation, the possibility of having several in the same package, different interface standards (RS-232, RS-485, etc.), wireless (WiFi), long distances, and a user-friendly configura- tion interface via the Internet browser, which sometimes also lets you drive a number of non-serial inputs/outputs. A third solution is the Bluetooth serial port. Here, we go up a notch in complexity, as you also have the Bluetooth link to deal with. Like the serial/USB convertors, Bluetooth chips often include a serial port to make it easy to produce a wireless link. The advantage of this type of connection is the wireless system’s inherent signal isola- tion. If the computer doesn’t have built-in Bluetooth, for a few dol- Figure 1 . The UM232R module from FTDI is a serial/USB interface that’s easy to incorporate into an existing project. Figure 2. Here’s the NE-41 1 0, a bridge between serial port (RS- 485/RS-422) and Ethernet, sold by Moxa. Figure 3. The BTM222 module from Rayson measures 28x15 mm and offers a wireless Bluetooth serial link. elektor 01-2010 15 MICROCONTROLLERS mMiMimmuiiniiii Crystal LAN 1 CS8900A-CQ3Z Figure 4. Still being sold, now in the A version, the Crystal LAN CS8900A Ethernet controller. lars you can add a Bluetooth USB key. So in this case, you have a serial/Bluetooth/USB convertor. On the project, you just add a small Bluetooth module to the microcontroller’s serial port (Figure 3). On the software side of things, it’s a bit more complicated, as the Blue- tooth connection, with its PIN codes and other commands, requires extra programming. So serial ports are still easy to use, even if you have to do so via a USB or other port. The big drawback of serial ports is their ‘slowness’. If all you need to do is now and again send a command or read some data, this port is very suitable, but when the transfer rate goes up, you’d best look for another way. Figure 5. The WIZ 830MJ module comprises not only an Ethernet controller, but also a hardware TCP/IP stack. Figure 6. The RCM3700 module from Rabbit makes it easy to add an Ethernet port with processor to a home-built project. The parallel port? No, not the parallel port, since just like serial ports, parallel ports don’t exist any more. But, unlike the serial port ones, parallel port / USB convertors have never become very popular. Laptop computer port extensions do exist that allow you to add a Centronics printer, but it’s not the same as the old bidirectional parallel port with its EPP/ECP options. What’s more, it’s tricky to communicate with this type of interface, as there’s not a lot of documentation around. When there’s a lot of data to be transferred, it’s better to use a USB, Ethernet, or FireWire port, or even the sound card. If there are no other solutions, you can always add a PCI or other expansion card. The advantage of going via a FireWire or USB port is that operat- ing systems already include the drivers for defined types of data. For example, USB uses classes that allow the OS to load the appro- priate driver. In this way, the application can access the port in a standard way, which simplifies programming, since everything is documented and examples are readily available on the Internet. All the same, you do need to choose the class for USB peripheral care- fully, as this determines the bandwidth the OS must allocate to the peripheral (e.g. 64 Kb/s for a ‘full speed’ HID peripheral) — though that idea is now becoming rather theoretical thanks to the ‘super speed’ USB. As for the peripheral, that too is more complicated, as the USB class must be respected. So now it’s not enough to just add a serial/USB chip to the board, you’ll need to go for a microcon- troller with built-in USB port. There’ll also be more programming to be done. FireWire is even more complicated, as there don’t seem to be any devices around that let you easily add a FireWire port to a home- built project. Besides, isn’t the word out the FireWire is finished? To be continued... A good alternative to FireWire or USB is Ethernet. We can’t repeat it often enough: it’s not hard to fit an Ethernet port to a home-built project. There are a number of integrated Ethernet controllers that are fairly simple to implement (e.g. from Realtel< [4] or National Semiconductor [5] , or the well-known CS8900A from Cirrus Logic [6] (Figure 4), or the ENC28J60 from Microchip [7] ). It’s even possible to ‘do Ethernet’ without a dedicated controller, if the processor is fast enough [8] . 16 01-2010 elektor MICROCONTROLLERS True, Ethernet does require a microcontroller with quite a lot of resources, especially RAM, and programming is more complicated - but on the Internet you can find masses of libraries that can limit the amount of work you’ll have to do. For many people, Ethernet and Internet are synonymous, but there’s really no need to go via a TCP/IP stack in order to use an Ethernet network. Particularly when a direct connection between the com- puter and the peripheral is involved, it can be very advantageous to not use a TCP/IP stack at all. Figure 7. Difficult to believe, but this simple module contains a small computer capable of running Linux. Of course, a TCP/IP stack offers huge advantages (all routers and other Ethernet peripherals operate primarily with TCP/IP), but it increases loading forthe user application For this, ‘founding father’ WIZnet [9] offers chips that include not only an Ethernet controller, but also a hardware TCP/IP stack (Figure 5) Their latest offering, the W71 00, also includes an 8051 -compatible processor. These chips can be driven via an SPI bus or, if you need to go faster, via a parallel bus. There are also small modules that let you add an Ethernet port to any application (e.g. Rabbit [10] , Figure 6). They usually include a processor, which can be used by the application, avoiding the need to add another processor. There are even small modules that are really powerful, capable of running Linux (Lantronix [11] , Digi 11 2] , Figure 7). The Ethernet network is very well integrated into modern operating systems and it’s easy to send or receive data at high speed. There is no issue with peripheral class or other complications - all you have to do is open the port to be able to use it. Figure 8. An IrDA USB key of unknown make (source Wikipedia) Sound card Everyone knows that the sound card can be used to turn a computer into an oscilloscope or function generator. SDR (Software Defined Radio) also makes use of the sound card. But this interface is capa- ble of doing a great deal more. Not only does it allow full-duplex communication, it also has several channels: 2 (stereo) or 6 (5+1 ), if not more. The big advantage of the sound card compared with the other ports lies in its analogue outputs, which make it possible to drive circuits by voltage. The sound card can drive a small circuit that doesn’t include a microcontroller. It’s actually very easy to send it a sound file containing control voltages. For a little more flexibility, you’ll need to embark on programming the sound card. This subject is well covered by a great many websites. The sound card can also emulate serial protocols. Using a 96 kHz sampling frequency, you can achieve acceptable communication speeds. The sound card inputs let you read voltages, even quite small ones if you use the microphone input. One disadvantage with the sound card is the low level of the output signals, typically 1 V pp — you’ll probably need amplifiers in order to be able to make use of the signals. Figure 9. The FOX LX832 card by Acme Systems; This card measuring 66 x 72 mm has an Ethernet port, two USB 1.1 ports, digital I/Os, an l 2 C port, serial and parallel ports, operates under Linux and costs around $200. elektor 01-2010 17 MICROCONTROLLERS While you’re using a TCP/IP stack, you might as well give your project a graphical interface via your computer’s web browser. By adding a (small) HTTP server to the microcontroller’s software, the project becomes capable of generating HTML files that the browser can display. In this way, the project can be controlled using the computer mouse. Note that a TCP/IP stack works just as well via an RS-232-style serial link as over Ethernet - it’s only a communication protocol. Note, too, that sound cards are not usually able to handle DC volt- ages, because of the series capacitors on their inputs and outputs. It’s also a good idea to find out about the minimum and maximum frequencies the sound card can handle. The PS/2 port... ...is a synchronous serial port. PS/2 ports are bidirectional, so they can be used to drive something, as well as to receive data. Normally, these ports are used to connect a keyboard and a mouse to the computer. The communication protocol is very simple and consists of a data line and a clock line for synchronization. The levels are between 0 and +5 V. Every microcontroller with an SPI port can do it, but it’s entirely feasible to implement it purely in software using bit banging. By default, the computer’s operating system treats the data received on its PS/2 ports as keyboard and mouse data. Hence by getting your project to send the right information, you can write directly into a file or move the mouse cursor. Using keyboard shortcuts, you can execute all sorts of commands. Perhaps more interesting is to divert certain well-defined data so as to then recover them in a personal application. This requires a bit more programming on the computer side — but it’s not rocket science! IrDA This infrared port, fairly popular in the late 90s, allows a laptop com- puter to communicate with a cell phone, for example, but has now been replaced by Bluetooth or wireless USB. Despite this, there are still plenty of ‘old’ laptops around with an IrDA port. What’s more, IrDA is coming back into the fray with the new IrSimple protocol that allows markedly higher transfer rates, up to 4 Mb/s. Faster still is the Giga-IR for rates of 1 Gb/s! For computers without an IrDA port, there are of course IrDA USB keys (Figure 8). The IrDA (Infrared Data Association) port is not a basic serial port, but in fact uses quite sophisticated communication protocols, Internet links [1] www.prolific.com.tw [ 2 ] www .silobs.com [3] www.ftdichip.com [4] www. rea I te k. co m . t w [5] www.national.com/analog/interface/ethernet [ 6 ] www.cirrus.com/en/products/pro/detail/P46.html [7] www.microchip.com [ 8 ] www.cesko.host.sk/lgorPlugUDP/ lgorPlug-UDP%20%28AVR%29_eng.htm 18 precluding its use with small microcontrollers. The proof: Micro- chip, the manufacturer of small (and large) microcontrollers gives away (yes, it’s free) an IrDA communication stack for its 1 6-bit (and above) controllers. The advantages of IrDA are the reliability of the communication and the signal isolation; the disadvantage is the need for a line-of- sight between the computer and the peripheral. Moreover, an IrDA link is only half-duplex, as the receiver is blinded by the transmitter housed in the same package. To implement IrDA, all you have to do is fit your project with a fast enough infrared transmitter/receiver (like the TFDU6301 from Vishay [13] — a purely random choice) and produce the communication stack. And finally... In this article, I have mainly spoken about ways of connecting a home-built project to a computer. But there is another solution, mentioned briefly when we were talking about Ethernet: to make the project itself powerful enough that it doesn’t need a computer. There are in fact hundreds of small processor cards around capable of running Linux or Windows CE, which have been made solely for driving something. The I/Os are integrated, as are the serial, Eth- ernet, and USB ports They can be found under the acronym SBC (Single Board Computer), and are usually compatible with computer based on Intel or AMD processors, but also some boards with MIPS, ARM, or Coldfire processors with plenty of RAM and Flash memory (Figure 9). Why spend hours struggling to cram a TCP/IP stack into the memory of a small 8-bit microcontroller instead of doing the same thing in five minutes under Linux on a 32-bit card that’s hardly any more expensive? Think of that next time you start a microcontroller project! ( 090772 -I) [9] www.wiznet.co.kr [ 10 ] www.rabbit.com ini www.lantronix.com/device-networking/embedded-device-ser- vers/xport-pro.html [ 12 ] www.digi.com/products/embeddedsolutions/digiconnect- me921 0.jsp#overview [13] www.vishay.com/ir-transceivers/list/product-84668/ [14] www.elektor.com/090772 01-2010 elektor NEW TOOL REQU RES LESS T ME RND MONEY Complete PIC development solution Speed up your prototype development with the BIGPIC6 Development System. The BIGPIC6 comes packed with examples that makes your PIC development fast and easy. BIGPIC6 is a development system for 64-pin and 80-pin PIC microcontroller applications development and testing. The mikrolCD (Hardware In-circuit Debugger) enables very efficient step by step debugging. Examples in C, BASIC and Pascal are provided with the board. BIGPIC6 MCU Cards support PIC microcontrollers in 64-pin and 80-pin package. Cards can be easily switched, so you can continue working in the same development environment but with a different MCU. Also, these cards can be easily used as part of your prototype device. Each microcontroller pin is connected via double-sided contact which insures proper connnection with the development system. MCU card contains 2.54mm pitch pads which can be used for easier connection with external circuits. —I "\ 99.3% of customers plan to purchase development tools from mikroElektronika again. Hardware In-Circuit Debugger for step by step debugging at hardware level Port Expander provides easy I/O expansion (2 additional ports) using serial interface Full-featured and user- friendly development board for PIC microcontrollers On-Board RTC - DS1307 TOUCH On-board Touch Screen controller with connector High-Performance USB 2.0 On-Board Programmer Get your new BIGPIC6 Development System right now and enjoy creating your electronic devices immediately! MikroElektronika DEVELOPMENT TOOLS I COMPILERS I BOOKS . . . L/Vn C\\a. \ C\ vV ^ V W BIGPIC6 DEVELOPMENT SYSTEM For more information, visit our Web site at www.mikroe.com MICROPROCESSORS My First AVR-USB Low cost and step by step By Antoine Authier (Elektor Labs) This article is a quick guide to building firmware that will unleash the capabilities of Atmel’s advanced AVR-USB chip and especially its USB features, which are fairly easy to deploy. Join the fun if you have a basic knowledge of USB and 30 dollars to invest. Figure 1 . The AT90USBI8] . Sure, the board can be powered over the USB connector when acting in Device mode. Within the scope and intent of this article you should not plug anything ontoJ8. 6. Two tactile-feedback switches (one is the Reset button). 7. A red power indicator LED, and two bi-color LEDs under control 20 01-2010 elektor MICROPROCESSORS of the MCU. 8. A four-direction joystick with a central switch, i.e. five pushbuttons. 9. 1 6 MBytes of serial (SPI 66 MHz) data-flash memory [6] . 1 0. An NTC (negative temperature coefficient) thermistor [9] as a temperature sensor, connected to analog channel 0. 1 1 . JTAG connector (not used right now). The board comes with a piece of Atmel firmware loaded that enacts a USB Composite Device comprising mouse emulation and a Mass Stor- age device. Before doing anything ‘really educational’, make a backup of the complete Key contents. All singing & dancing you can already play with the mini joystick on the board, see the mouse cursor move on your computer screen and use it to browse the serial dataflash con- tent using any explorer(-like) software... all within the AVR-USB envi- ronment Atmel has created for you. However you’re reading Elektor so there’s more to discover, learn and chuckle over. Source code, firmware, software There are different firmware-based approaches to program this application and some other classes of the USB specification and sure, all the main USB profiles can be demonstrated using this board. You can of course take a look at the source code from Atmel and a small army of application notes on the AT90USBKey web page that will prove instructive in many ways. For this article, in good Elektor tradition we will use other freely available solutions. There are quite a few around and it was decided to focus on the two most impres- sive: the LUFA (Lightweight USB Framework for AVRs) [3] from Dean Camera and the HID implementation of the Teensy project [4] . Here it’s also worth mentioning the work of Dr. Stefan Salewski available at [5] — now that’s what we call compact and straightforward. Toolchains Before getting started you need to know about the software tools that will help you develop code without too much pain. All tests were done using WinAVR version 20090313 featuring the C compiler avr-gcc v4.3.2, the binary manipulation tools binutils v2.1 9, and the lightweight IDE “Programmer Notepad v2.0.8”. AVR Studio is not required but can be used too; you can also use the com- mand line tool if you like. All software tinkering was tested under Linux too, running Ubuntu release 9.04 and the AVR GCC v4.4.1 cross compiler with binutils V2.19.1. Programming the device with FLIP Although the AT90USB1 287 comes with a JTAG interface that will enable you to debug and program the MCU with an appropriate JTAG tool, we would rather use a much simpler method: by way of the bootloader. Note that you can also use the standard ISP. The bootloader can be activated by pushing the RST and HWB but- tons while the board is connected and then releasing the RST button first. A new device will be enumerated called “AT90USB1 28 DFU”. The first time you plug it in under Microsoft Windows you will have to install the driver; it comes with Atmel’s own utility called FLIP [11] Features • Low-cost ($30) Atmel ATgoUSBKey demo board fwith on-board mini joystick • MCU: AT90USB1287 with DFU bootloader • Easy introduction to USB for AVR embedded technology, including USB hardware controller • Introduction to designing USB HIDs and Composite Devices • Lots of freeware utilities around (FLIP, LUFA) • Largely Linux compatible • Easily accepts software ported from other projects (e.g. Teensy) in the usb subfolder of the installed files. FLIP is the utility used to program the AT90USB1 287 by way of the bootloader — but you have to install it first. We suggest download- ing the version that includes Java, if you are not sure if you have it already or not. Note that prior to writing the program to the flash memory you have to erase it. If not, the MCU is locked in a protected mode. When using FLIP you can simply set up the sequence in the ‘opera- tion flow’ frame by selecting Erase, Program and Verify. Then load the hex file with CTRL+L and click on “Run” to flash the program. One last thing: to exit the bootloader mode click on “Start Applica- tion” (the yellow button) and press the RST button on the board. A screendump of FLIP in use is shown in Figure 2. Under Linux, [dfu-programmer] [10] is required to program the device. We used vO.5.1 ... and here are the three main command lines used: # dfu-programmer at90usbl287 erase # dfu-programmer at90usbl287 flash example. hex # dfu-programmer at90usbl287 start LUFA Now it’s time to get your hands dirty! Download the latest LUFA source code from [3] . At the time of writing LUFA was at version #090924 and that’s not an Elektor production number. Unzip it and fix this section: . /Demos/Host/ClassDriver/KeyboardHostWithParser/ KeyboardHostWithParser . c line 264 . /Demos /Host /Cl as sDriver /MouseHostWithParser/ MouseHostWithParser . c line 264 . /Demos /Host/LowLevel /MouseHostWithParser/ HIDReport . c line 89 by adding *;’ at the end of each line — doing so will save a few errors popping up if you compile the whole thing. Open the project file [LUFA.pnproj] at the root of the source code and then take a look at how it’s structured. The LUFA library and demonstration program are (by default) tuned to work on the USB- AVR board, but in case you are not sure simply check the makefile. These variables should be configured as: MCU = at90usbl287 BOARD = USBKEY F CPU = 8000000 elektor 01-2010 21 MICROPROCESSORS The AVR-USB hardware The USB hardware controller and USB device operations are not for the faint hearted in spite of their ex- tensive coverage in the AT90USB1 287 datasheet (463 pages; doc7593.pdf). Basically, the USB controller provides a hardware gateway that allows a USB link to carry a data flow stored in an on-chip double-ported memory (DPRAM). This is done under the control of constants stored in certain of the AT90’s one hundred- odd registers. An important point to note is that the USB is provided with a dedicated clock domain. This clock is gener- ated with an on-chip PLL running at 48 MHz. The PLL always multiplies its input frequency by 24. Thus the PLL clock register should be programmed by software to generate a 2MHz clock on the PLL input, see the exam- ple on the code conversion to suit 1 6 MHz clock on the Teensy board. For your own experiments with other boards you need to know the detailed structure of the PLLSCR register, hence it’s also listed below. I 090767-12 Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit i Bit o (OxDA) USBINT — — — — — — IDTI VBUSTI — — — — — — — 0x29 (0x49) PLLCSR — — — PLLP2 PLLP1 PLLPO PLLE PLOCK The C language is convenient to set up your required constants in these registers, like #define LABEL() ([registername] = 4hexvalues) just as is being done in the examples in this articles to port code to hardware other than the AT90USBI A Industry guru Forrest M. Mims III has created yet another stumper. The Ultra Simple Sensors Company assigned its engineering staff to design a circuit that would trigger an LED when a few millimeters of water is present in a basement or boat. What is the water sensor behind the puzzle piece? Go to www.Jameco.com/unwrap to see if you are correct and while you are there, sign-up for our free full AMECO ELECTRONICS 1 - 800 - 831-4242 PCB PRODUCTION PCB-DIY AM the Way It all started with color-banded resistors and those quaint codes printed on capacitors — then SMD components arrived and suddenly our eyes were too weak and our fingers chubby. Worse, the trusted solder iron suddenly turned out unwieldy and too powerful to achieve a decent soldering job. Stencil a b The PCB stencil machine is composed of: bottom frame (b) and top frame (a), PCB fine adjustment knobs (c), tension knob (d), vertical knobs (e), clips (f), magnetic supports (g) and a sliding base (h). Machine Secure the PCB on the magnetic standoff supports and place the top frame over the bottom one. Position the stencil on the rails striving to align it with the PCB to the best of your ability. To stiffen the stencil, tighten the 6 screws using a hexagonal key. Now, close the lateral clips. Rotate the tension knob clockwise to apply tension to the springs, then tighten the vertical knobs and release the tension knob. At this point the stencil should be completely flat over the PCB. Although the stencil is over the PCB and you did your best to match it with the PCB’s pads earlier, it will be necessary in most cases to adjust the knobs ‘c’ for fine tuning the alignment. Apply solder paste on the stencil’s side and spread it homogeneously using the squeegee (i). Make sure there’s no excess paste across the surface. 26 01-2010 elektor Does this mean PCB production and SMD component stuffing is now beyond the reach of the home worker? Hardly, but it’s clear a good set of tools is reguired for the job. The Elektor SMT Oven was an initial step to enable DIY component populating of circuit boards. Based on the success of the '°'s^ 'V oven we thought we’d collect a number of add-ons that allow the skilled enthusiast to produce small series of stuffed boards. Assuming your favorite PCB su| doing the actual board manufacturing now offer these tools: a stencil machine to get the solder paste accurately positioned, and a pick & place device to gingerly land 3 / 7 , o w **<>>>* those tiny SMT parts on their ° r Sf, [•jnwW*rT«l P1V1PJPJI1M And now, step by step ... Pick&Place Tool The pick & place tool is composed of: component tray (a), Use the magnetic board supports to secure the PCB. The standoff magnetic board supports (b), arm rest (c), vacuum pump (d), posts can be used underneath larger PCBs. pickup holder (e) and pickup needles (f). The pickup needles have different diameters to suit the size of the components handled. Connect a pickup needle to the pickup holder’s nozzle and turn the pump on. To pick and hold a component, just attach the pickup needle to the component’s surface and turn on vacuum by putting your finger top on the pickup holder’s side hole. Use the arm rest (c) for your comfort and optimum accuracy of component placement. Carefully place each component on its PCB pads. To release the component, turn off the vacuum by removing your finger from the side hole. elektor 01-2010 27 TECHNOLOGY On the Buses Alternatives to USB and l 2 C By Rolf Blijleven (The Netherlands) If you want to have an intelligent circuit communicate with its companions, the standard approach is to use the omnipresent USB port or an l 2 C link. But is this the ideal solution? A survey of various industrial areas shows that there are other alternatives, ranging from the well known to the obscure. Here we provide a capsule summary for your information and inspiration. Photo: Siemens Communication between individual circuits is more than just a special discipline - it’s a science in its own right. The simplest solution at the lowest cost is usually the best option, and price-conscious electron- ics enthusiasts usually end up with USB, l 2 C or RS-232. The underlying rationale is the same in industry, but the magnitude of the problems encountered there puts them in a different league and makes other solutions necessary. Although most of our readers do not have access to the hefty budgets of industrial projects, it seems worthwhile to us to examine how things are done there. This stirs the creative juices, and it’s always nice to take a look over the fence. Here we present a brief overview of the category ‘industrial buses’. A full summary would fill several books, so we have restricted our selection to ‘out of the box’ solutions — this is not the place to look for an explanation of how your video card communications with the motherboard. We start off in the automotive industry, pass through the realm of process engineering, and finish up with wireless tech- nology. On the way we provide references to websites where you can find more information. Why use a bus? The answer to this question is short and succinct: because cable harnesses cause too many problems. In a circuit with only a hand- ful of functions, it is silly to use a bus, but if you have a sensor or an actuator in a more or less intelligent module, the situation is differ- ent. If you have dozens of such modules demanding attention, a bus is the appropriate solution. For several decades already, buses have conformed to the OSI model. Put briefly, this means that communication between mod- ules is divided into layers, and each layer has its own task (Figure 1 ). The OSI model is not a standard, but instead a reference model. A key aspect of the OSI model is that the receiving layer always reports back to the sending layer whether a message was received correctly or incorrectly CAN and kin Modern cars are jam-packed with electronics. A car can have up to 70 or so engine control units (ECUs), which can collectively generate around 2500 different signals [9> 13] . In this situation, a bus is indis- pensable. The basis for the industrial bus with the highest world- wide usage was fashioned in the 1 980s by Robert Bosch GmbH in the form of the Controller Area Network (CAN). CAN is proven tech- nology: there are hundreds of millions of CAN nodes in the world, and CAN is now specified by ISO standards (1 1 898 and 11519) that have been made mandatory for the diagnosis of petrol and die- sel vehicles manufactured after 2004. The CAN documentation is unusually good and readily accessible, and just about every self- respecting 1C vendor can supply ICsforthe CAN bus. If you want to know more after reading the following description, a good starting point is interfacebus.com [2] . The CAN bus uses a differential signal line, which means it has two signal leads in the form of a shielded or unshielded twisted pair with a maximum length of 1 000 metres (3,000 ft), terminated in 1 20 ohms at each end (Figure 2). CAN supports diverse data rates, but every device must be able to handle 20 kbit/s. Relatively low data rates are used for tasks such as window and seat operation, while relatively high data rates are used for engine and brake control. In practice, the maximum number of nodes on a bus is around 1 1 0, but there are variants such as J1 939 that support 253 bus addresses. CAN is inherently vendor independent; modules from any vendor can communicate with modules from any other vendor. It’s clearly evident that CAN has become the head of a large family, with branches extending far beyond the automotive sector. This has led 28 01-2010 elektor TECHNOLOGY At the lower end of the transmission rate scale we find LIN (Local Interconnect Network). LIN is cheaper and simpler than CAN. It operates over a single-wire link with a maximum length of 40 metres at a maximum data rate of 92,600 baud, with a single bus master and several slaves. Congestion does not occur because only one message at a time is allowed on the bus. There are good dozen man- ufacturers of ICs for LIN, including NXP and Infineon (formerly the semiconductor divisions of Philips and Siemens, respectively). Moving up the data rate scale, we see variations on a theme, many of which represent the response of one manufacturer to an innova- tion by another manufacturer. Here we can mention Time-Triggered CAN (TTCAN), which is also based on an ISO standard, as well as its faster brother FlexRay and finally, at the top of the scale, MOST. Although CAN probably won’t be your first choice for your next design, it’s nice to learn something about its operating principles. Traditional CAN is essentially event triggered, which means that a specific event initiates a sequence of bus traffic. For example, a par- ticular sensor may indicate ‘collision’ at exactly the same time as another sensor indicates ‘petrol tank nearly empty’. With an event- triggered system, in this situation it’s necessary to determine which sensor has priority for access to the bus. This is called bus arbitra- tion, and it takes time. In addition, the designer must have a good idea in advance of which priority a particular event may have. After all, you don’t want to have airbag inflation wait until the ‘petrol low’ indicator has lit up. In a time-triggered system, each device is polled at least once per cycle. The total duration of the cycle is known, so you know the maximum elapsed time before an event is followed up. TTCAN is actually a mixed form of event-triggered and time-triggered, based on the idea that there are always enough devices that do not need to be handled so urgently. With TTCAN and FlexRay, we are clearly in a domain with lots of money. FlexRay operates at 1 0 MB/s, which opens up futuristic per- spectives such as steer- by-wi re, where the steering wheel is simply a control device that could just as easily be replaced by a joystick, perhaps with better results (see Figure 3). The fastest progeny of CAN is MOST, which was developed by BMW. The acronym stands for ‘Media Oriented Systems Transport’, and as the name suggests, it is intended to be used for tasks such as integrating the navigation system, mobile telephone, radio, and DVD player (with passenger viewing screens front and rear). Figure 4 shows a complete example of how these three systems can be used in a car. Figure 3. FlexRay: why not use a joystick to drive a car? After all, it’s good enough for fighter pilots, (photo: Mercedes Benz) elektor 01-2010 29 TECHNOLOGY Figure 4. LIN, CAN and MOST together in a car (illustration: Xilinx [3]) Fieldbus and Profibus A tour of industrial buses is not complete without a glimpse into the world of process and factory automation, which covers a wide range of industries from petrochemical to sauce makers and much more. The sums involved are also considerable. The first modules in this area appeared in the 1980s, with microprocessors, intelligent controllers, valves, encoders, analysers and the like — all of which are called ‘field devices’. Where there’s a lot of money to be made, fierce competition arises, and although the need for standardisation was recognised quite early on, compatible products were few and far between and even the ISA and IEC standardisation organisations could not reach an agreement. Still, cooperation is better than cutthroat competition. Groups of manufacturers, customers and scientists gradually got together, and they eventually merged to form the two largest camps at pres- ent: the Fieldbus Foundation in the USA and Japan, and PROFIBUS in Europe. It’s a rather complicated story. For example, Siemens col- laborated with Yokogawa on Fieldbus for a while, but they also col- laborated with Robert Bosch GmbH on Profibus, which in addition has French ingredients [10 ’ 12] . Profibus was later handed over a users organisation called the Profi- bus Nutzer (User) Organization. This organisation now has more than 1 300 members worldwide, with more than 30 million nodes in use. Its customers include Shell and CERN, of particle accelerator fame. Fieldbus and Profibus both define only layers 1 , 2 and 7 of the OSI model. There is at least worldwide agreement on at one thing: the three versions of the physical layer, which are specified in IEC 61 1 58 and IEC 61 784. In a nutshell, they are: -glass fibre for distances up to 100 km, with date rates of 9.6 kbit/s to 12 Mbit/s; - RS-485 or EIA-485 over differential UTP or STP with a data rate of 35 Mbit/s up to 1 0 m or 1 00 kbit/s up to 1 200 m. CAN and several other protocols, such as DMX51 2 for theatre lighting and the like, fall in this category; - MBP-IS (Manchester Bus Powered Intrinsically Safe) is used in areas subject to explosion hazard, such as in refineries above liquid stor- age tanks containing gas. A low current flows through the wiring at all times, so no sparks can occur when something is connected or disconnected. The data rate is limited to 32.25 kbit/s over STP, with 1 0 to 32 stations per segment at distances up to 1 900 m (approx. 6,000 ft). If you want to learn more about these topics, we can recommend the websites of PROFIBUS International [7] and the Fieldbus Founda- tion [8] , but you would do well to have a large company look after the costs of training and the necessary material. What about wireless? Let’s return to our original problem: the cable harness. Why not sim- ply replace it with wireless technology? This was the task that the Swedish company Ericsson set itself in 1 994. The aim was to develop an open, vendor-independent, affordable and international stan- dard, and they succeeded. Bluetooth operates in the 2.45-GHz band and uses little power, so it can easily be employed in battery-pow- ered equipment: 30 jiA in hold mode or 8 to 30 mA with an active link. There are three range classes: 1,10, and 1 00 metres. A single device can serve several companion devices (point-to-many opera- tion). A link between two devices is called a piconet. Each piconet can support up to 1 27 devices, with up to eight of them active at the same time. Bluetooth is a developing technology —version 3, which appeared only recently in April 2009, utilizes the WiFi protocol to 30 01-2010 elektor TECHNOLOGY enable data rates up to 24 Mbit/s. Bluetooth is an open standard, and documentation is readily available via the Internet [4] . Like CAN, the Bluetooth system has already more than proven its merits. Originally conceived for linking personal devices together, it has also made its way into industrial applications, in particular in areas where wireless communication is simply much more conve- nient, such as automated warehouses and robotic systems. Along the development trend is toward higher and higher data rates, a need has also developed for a trend in the opposite direction, since there are a multitude of less demanding applications. The counterpart of LIN for CAN is ZigBee for Bluetooth. The Zig- Bee Alliance was founded by a number of major players including Motorola and Samsung, and the standard has since been adopted by more than 1 50 manufacturers. ZigBee is a developing technol- ogy. It already supports automation and energy management for office and factory buildings as well as residential buildings. Efforts are currently underway to develop support for telecommunication and health care applications. ZigBee consumes even less power than Bluetooth, which makes it possible to develop equipment that can be worn in the same way as a wristwatch or a brooch. Incidentally, you should take the term ‘simple’ with more than a pinch of salt here. The ZigBee physi- cal layer consists of two frequency bands: 869 MHz (Europe) or 91 5 MHz (USA and Australia) and 2.4 GHz (worldwide), which sup- port data rates up to 20, 40 and 250 kbit/s (respectively). The range is 1 0 to 70 metres (30 to 200 ft), and each ZigBee client has a unique 1 6-bit address, which means that a maximum of 65,535 (2 16 ) nodes are possible in a single personal area network (PAN). There are three types of ZigBee devices in a network: a coordinator (ZC), one or more routers (ZRs), and end devices (ZEDs). The coordinator is the bus master. It determines the name of the network, holds the encryption keys, and can link to other networks (bridging). Routers serve specific applications, but they can also forward data from other devices. A ZigBee end device can only communicate with its parent node. ZigBee has several very clever properties. Devices can switch from sleep mode to active mode within 1 5 ms. This is intentional, since ZEDs sleep most of the time to enable very long battery life (the Figure 5. ZigBee grid topology with end devices, routers and a coordinator. standard specifies two years). Routers and coordinators usually draw considerably more power. For example, a lighting fixture is always connected to the AC mains, so it can serve as a router or a coordinator. The light switch is a ZED. If you press its button, it wakes up, sends a command, waits until it receives an acknowledge- ment, and then goes back to sleep. Routers are another clever idea. They extend the range of the net- work without consuming extra power, but what’s more important is that make it possible to implement a grid topology similar to that of the Internet. Routers know which notes are heavily loaded and route traffic over paths with lighter loading (see Figure 5). ZigBee is an open standard [5] . If you want to use it for a personal proj- ect, you can obtain the specifications free of charge but you have to pay for the hardware and the development tools, although there are also initiatives for implementing the ZigBee stack in open-source soft- ware [6] . If you want to market a commercial ZigBee product, you are required to join the ZigBee Alliance and pay a membership fee. Conclusion As already mentioned, we have limited ourselves to a small selec- tion of the hundreds of communication standards that have been developed in the electronics world. If you think we have overlooked something essential, you are cordially invited to let us know. (090771-1) Internet Links [1 ] http://en.wikipedia.org/wiki/OSI_model [2] www.interfacebus.com/Design_Connector_CAN.html [3] www.xilinx.com/bvdocs/ipcenter/product_brief/ Auto_ECU_sellsheet.pdf [4] www.bluetooth.com/Bluetooth/Technology/ [5] www.zigbee.org [6] http://freaklabs.org/ [7] www.profibus.com [8] www.fieldbus.org [9] www.semiconductors.bosch.de/pdf/ embedded_world_04_albert.pdf [10] www.imc.org.nz/fieldbus.html Other sources: [1 1 ] OSI Reference Model - The ISO Model of Architecture for Open Systems Interconnection, H. Zimmermann, IEEE Transactions on Communications, Vol. COM-28, No. 4, April 1 980 [12] Overview and Geographic Impact of Current Process Fieldbus Technologies, Larry O’Brien, Institute of Measurement & Con- trol NZ [1 0] [13] Comparison of Event-Triggered and Time-Triggered Concepts with Regard to Distributed Control Systems, A. Albert, Robert Bosch GmbH, Embedded World, 2004, Nurnberg [9] elektor 01-2010 31 COMPUTERS AND TUBES By Martin Ossmann (Germany) USB Tube Magic Eye indicates CPU load The author’s son is a keen PC modder. Having constructed a number of USB-controlled LED displays, he decided it would be a good idea to have an indicator of CPU load. The author himself is a fan of retro electronics, and so the idea emerged of using a green glowing tube as a CPU meter. Power and control are both provided by the USB port. A simpler variant on the circuit, using a moving-coil meter, is also described. In fact it was the idea for the moving-coil meter that came first: the prototype is shown in Figure 1. With the aim of using off-the-shelf components as far as possible, a USB interface implemented in software in an Atmel microcontroller was chosen. There are several alternative stacks avail- able, including AVR309 [1] , V-USB [2] and avrcdc [3] . For the CPU meter we chose the USB stack described in application note AVR309 by Igor Cesko. First circuit As Figure 2 shows, the resulting circuit is very simple and can easily be constructed on a small piece of perforated prototyp- ing board. The red LED drops the 5 V USB supply to the 3 V level required by the AVR microcontroller. A 12 MHz crystal is used to ensure that the USB clock frequency is closely matched. The microcontroller can be programmed using any of the multitudinous AVR pro- gramming adaptors available. The software running in the ATtiny2313, described in a separate section, is available for free down- load from the Elektor website [4] . The analog value that drives the meter itself is created using pulsewidth modulation (PWM). Software running on the PC sends out the CPU load as a percentage (i.e., as an integer from 0 to 1 00). The AVR multiplies this number by 2 and writes the result to the PWM control register. The PWM signal is output on pin OCOB (PD5). At 1 00 % CPU load the average voltage on the PWM out- put is thus 2x1 00/255x3.3 V = 2.6 V. Potentiometer PI allows the circuit to be adapted to use different types of moving- coil instrument. Any instrument with a full- scale deflection of at most 1 0 mA or 2 V is suitable. Before first connecting the circuit to the PC it is worth checking that the USB connections are correct, as otherwise dam- age may be caused to the PC by a short or reversal of polarity. Magic Eye Hardened retro fans will be much happier having their CPU load indicated by a ‘magic eye’ tube. Back in the day (until the mid- 1 960s, in fact), ‘magic eye’ tubes were used as tuning indicators on radio receivers and as signal level indicators on tape recorders. For the magic eye CPU meter we use a type EM84 (6FG6) tube (Figure 3). Unused stock is still available from some suppliers, and a new 32 01-2010 elektor COMPUTERS AND VALVES version is in production in China, priced from about 20 dollars. The Chinese part number is 6E2P. Sources are suggested at [5] . Second circuit The tube requires a heater voltage of 6.3 V and an anode voltage of around 200 V. A small, unregulated, push-pull converter is used to generate these voltages from the 5 V supply provided by the USB port. The output voltages of the converter are deter- mined by the turns ratio of the transformer in the circuit (Figure 4). In this case 1 0 turns are driven on the primary side at 5 V, giving 0.5 V per turn. The heater voltage is taken from taps on the primary winding twelve turns apart, giving 6 V. The winding of the transformer is described in the text box. With a heater current of 0.21 A we have a total heater power of 1 .3 W. The anode supply requires 2 mA at 200 V for a power of 0.4 W. The total current consumption at 5 Vis thus / = (1 .3 W + 0.4 W) / 5 V = 0.34 A which is more than the 1 00 mA that a stan- dard USB socket can supply directly. A fur- ther difficulty is that the heater has a low resistance when cold, and if it is suddenly switched on, a sharp spike of current will be drawn from the USB supply. These problems are solved as follows. When power is applied the push-pull converter is first run at a low duty cycle. This means that the current supplied (and hence the current drawn) will be low while the heater gradu- ally warms up. Then, under control of the PC, the heater power and the anode voltage are gradually raised. The current consump- tion is kept below 500 mA, which tests show is in practice within the capability of most USB ports. Driving the push-pull transistor arrange- ment requires a second PWM generator, producing two non-overlapping pulses to the gates of the FETs. The anode volt- age is produced with the help of a voltage doubler circuit in the interests of reducing the number of turns required on the trans- former. The output of the transformer is 220x0.5 V = 1 1 0 V which, after doubling, gives the required voltage. Transistor T3, Features • display of CPU load as a percentage (0 to 1 00) • power and control over USB • ATtiny microcontroller with software USB interface • two variants with the same firmware • display using moving-coil meter or EM84 ‘magic eye’ tube • very low component count • low-cost, readily-available indicator valve • current consumption (moving-coil version): less than 1 00 mA • current consumption (magic eye version): less than 500 mA • freely downloadable PC software and microcontroller firmware, with source code Figure 1 . Moving-coil version of the CPU meter. +5V +3V3 Figure 2. Circuit diagram of the moving-coil CPU meter. elektor 01-2010 33 COMPUTERS AND VALVES Figure 3. German (RFT) and Chinese versions of the EM84. along with resistors R3 and R4 and capaci- tor C5, generate a high voltage PWM signal which controls the indicator itself. A square- wave is present at the collector of T3, and this is filtered by R4 and C5. As far as the USB connection and clock circuitry are con- cerned, the circuit is identical to our first version. Printed circuit board A printed circuit board has been designed in the Elektor labs for the magic eye version of the circuit (Figure 5). All components, including the tube base, are fitted to the board. All the components are leaded and of course care must be taken to fit polarized devices the right way around: this applies to all diodes and transistors, the microcon- troller (in a DIL package), the transformer, and electrolytic capacitor C2. Our assem- bled prototype is shown in Figure 6. Firmware The original software given in the Atmel AVR309 application note allows an 8-bit port to be controlled over USB. With a small modification, instead of transferring the value to a port we can use it to control the PWM generators. The same software is used in the two circuit variants (Figure 2 and Figure 4). Note that we have two PWM gen- erators to control: we decide which genera- tor is addressed using bit 7 (the most sig- nificant bit) of the data value. If the bit is a ‘1 ’, the data value is directed to the meter PWM generator (Timer 0); if the bit is ‘O’, it is directed to the power supply PWM gen- erator (Timer 1). The PC software delivers the CPU load as a percentage value from 0 to 1 00. The soft- ware in the AVR multiplies this by 2 before delivering it to the Timer 0 PWM generator, which is configured with a period value of 255. If the most significant bit of the con- trol byte is ‘0’ the value is used to control the duty cycle of the pulses that drive the switching voltage converter. The modifications to the original software to implement these new features are shown in Listing 1. The only other modification needed to the original software is to add code to initialize the PWM timer. When programming the ATtiny231 3 it is essential to ensure that the correct fuse settings are used (see the text box ‘Software notes’). PC USB driver To allow the PC to communicate with the circuit the driver files that accompany appli- cation note AVR309 have to be installed. The files are AVR309.inf, AVR309.sys (the driver itself) and AVR309.dll (the library). It is best to put these files into a directory Figure 4. Circuit diagram of the magic eye CPU meter. 34 01-2010 elektor COMPUTERS AND TUBES Windinq the transformer Winding transformer LI should present no great difficulty. First make the secondary winding. This consists of 220 turns of 0.1 mm (AWG #38) enam- elled copper wire, running between pins 4 and 5 of the former. Pin 1 of the former can be identified by the chamfered corner, and the other pins can be identified using the datasheet (for example, from EPCOS). If 0.1 mm (AWG #38) diameter wire is not available, 0.1 5 mm (AWG #34) diameter wire can be used instead for the secondary. A layer of insulating tape is used over the secondary winding to isolate the primary side from the high voltage present on it. Next make the primary windings in two parts, each with a tap. Enameled copper wire with a diam- eter of 0.3 mm (AWG #28) or 0.4 mm (AWG #26) should be used for the pri- mary winding. Each of the four parts of the primary winding should be Former with secondary winding wound in the same direction on the former (see the dots marked on the circuit diagram). Start at pin 1 and wind four turns; then make a tap at pin 2. Then wind six more turns in the same direction to pin 3, where this winding ends. Start a new winding at pin 6, again with six turns and again in the same direction, before the tap at pin 7. From there wind four more turns in the same direction to end at pin 8. The final step is to fit the two halves of the core (without an air gap) and fix them with the clips provided. Alternatively, insulating tape or glue can be used. If using glue, take care to ensure that it does not flow between the halves of the core and create an air gap. and then use that directory for manual USB installation. A tool such as USBview can be used to check whether the PC can ‘see’ the CPU meter: simply look down the list of rec- ognized devices and see if the CPU meter (with ID AVR30USB) is present. CPUload : PC software A C program was written (using Visual C ver- sion 6) to send the CPU load information to the AVR. The load is determined using the SMPSpwm : technique described in [6], and routines in the AVR309 library are used to carry out communication with the AVR. The program can be used with either ver- sion of the CPU meter circuit. If the pro- gram is run without any parameters, it first gradually increases the switching supply duty cycle. Then, every tenth of a second, it mov tempo , ACC / fetch USB value andi tempo , 0x80 / check MSB breq SMPSpwm / if = 0 we have a SMPS set mov tempo , ACC r fetch USB value again lsl tempo F multiply *2, range now 0. out OCROB , tempo F control instrument PWM ret F and done mov tempo , ACC F fetch USB value again, F must be <50 out OCR1AL, tempO F set SMPS -PWM output A ldi tempo ,100 F compute 100 -value sub tempO , ACC out OCR1BL , tempO F and set SMPS -PWM output B ret elektor 01-2010 35 COMPUTERS AND TUBES COMPONENT LIST Resistors R1 = 1.5kft R5,R6 = 15k£l R2 = 22I<£1 R4,R7 = 47kft R3 = 330kft Capacitors Cl ,C3,C4,C5 = 1 0OnF 250V C2 = IOOjiF 25V C6,C7 = 22pF Inductor LI = transformer; coil former# B6641 8WL008D1 with clip # B6641 8B2000 and core # EFD20 B6641 7GX1 87 Figure 5. Printed circuit board for the EM84-based CPU meter, designed in the Elektor labs. IC1 =ATTiny2313-20PU, programmed, socket Elektor Shop # 090788-41 PCB, Elektor Shop # 090788-1 Semiconductors D1 = LED, red, 20mA D2,D3 = BY448 T1 ,T2 = IRLU014 T3 = MPSA42 Miscellaneous XI = 12MHz quartz crystal K1 = USB socket Type B VI = EM84 (6FG6) and 9-way (noval) tube determines the CPU load value and sends it to the AVR as a percentage. The PWM duty cycle needs to be controlled over a certain range for use with the magic eye version of the circuit, and this range can be specified by passing two parameters to the program. If just one parameter is given a fixed duty cycle is output. This allows for test and cali- bration: for example, to calibrate the 1 00 % point, run the program as CPUshow 100 and then adjust potentiometer PI to obtain Figure 6. The assembled prototype, a full-scale deflection on the meter. The circuit we have described illustrates what is possible today using relatively modest means. The quick-eyed reader will have noticed that all the ideas we needed in designing the circuit were available on the world wide web, and that by simply combin- ing these ideas in a new way we can make an interesting and novel project. (090788) Software notes Microcontroller software Compiler: WINAVR Source code: CPUshow.asm Hex file: CPUshow.hex Programming of ATtiny23i3: ; fuses: ; brownout at 1 .8 V ; external crystal 65 ms startup CKSEL=1 111 SUT=1 1 USB driver AVR309.zip from the Atmel website AVR309.dll AVR309.inf AVR309.sys Use these files when installing the USB driver. PC Software Compiler: Microsoft Visual C version 6 CPUshow.cpp CPUshow.exe Files are included in the Elektor download [4]. Sources and Internet Links [1] www.cesko.host.sk/lgorPlugUSB/ lgorPlug-USB%20(AVR)_eng.htm [2] www.obdev.at/products/avrusb/ index.html [3] www.recursion.jp/avrcdc [4] www.elektor.com/090788 [5] www.btb-elektronik.de/en/index.html, ww.die-wuestens.de/eindex.htm, www.conrad.com [6] http://en.literateprograms.org/ CPU_usage_(C,_Windows_XP) 36 01-2010 elektor 310 Circuits Creative solutions for all areas of electronics The 30x series of Summer Circuit compilation books have been bestsellers for many years. The 1 1th volume is available now! 310 circuits, tips and design ideas in one book form a treasure trove for every area of electronics: audio and video, hobby and modelling, RF techniques, home and garden, test and measurement, microcontrollers, computer hardware and software, power supplies and chargers - plus of course everything else that does not seem to belong in any of these categories. 310 Circuits forthe first time has a section exclusively on robots and robotics. This book contains many complete solutions as well as useful starting points for your own projects. Both categories and anything in between represent a veritable fountain of inspiration for cultivating your own ideas and learning about electronics. 544 pages • ISBN 978-0-905705-78-1 $48.30 Elektor US 4 Park Street Vernon CT 06066 USA Phone: Fax: E-mail: 860-875-2199 860-871-0411 sales@elektor.com "\ Further information and ordering at www.elektor.com/shop wwwiaell^toin iSEI‘7SflELi6 Info I 1 * aeHg.com 60/1 00/200/300MHz 2 ch, 2GS/s DSO 2000 wfm/s refresh rate. High quality, ultra Compact Design with small footprint. Totally new price. DS1052E _grrT > • • thru • • DS1302A $4395“ 50/100MHz 2-ch/16 logic scope and analyzer. 2000 wfm/s refresh rate. See wfms and logic data simultaneously. Trigger on data or signal edge. DS1052D .fcHSS’ DS1102D $+995* Mixed -Signal PC Oscilloscope 100 MHz Scope and Logic Analyzer lets you do complex triggering to find hard-to- get-at glitches, spikes, etc. Huge 4 or 8 MS buffer for deep data drilling and zooming. Optional built-in swept signal generator. 2 Analog channels x 1 0, 12, 14 bit with more than 60 dB dynamic range. 8 digital inputs for mixed signal display/trigger. CS328A-4 (4MS Buffer) $1259 CS328A-8 (8MS Buffer) $1474 CS700A (signal generator) $299 LCD Scopes s * — y Owon - 25 or 60MHz color LCD 2-ch bench scope OR 20MHz handheld scope/meter. USB interface for printouts. Includes scope probes! Battery versions available. PDS5022S / 6062T $31 5 / $499 HDS1022MN / 2062MN $593/ $699 USB Bus Analyzers 7 in 1 USB Scope EMC Spectrum Analyzer Packet-Master™ - best value USB1 .1/2.0 USB analyzers and generators. Identify USB problems fast, fine-tune performance, easily view Host commands, emulate host/device sequences, etc. USB12 (USB1.1) $699 USB480+ (USB1. 1/2.0) $1199 USB500AG(USB1. 1/2.0/Gen) $1399 2-ch 10-bit 2MHz scope/spectrum- analyzer, 3MHz 8-bit wfm gen; 1 6 x I/O; Network Analyzer; Noise Generator; PWM. Windows/Linux/Mac compatible! USB-powered, great for toolbox, education, etc. CGR-101™ $180 EMC RF & EMF Spectrum - Analyzer 1Hz to 7GHz for measuring transmissions from radar, radio/tv towers, WLAN, WiFi, WiMAX, Bluetooth, microwave ovens, etc. from $299/ $1990 microCAM Sound Module Compact compressed-serial output camera module for any host system. JPEG OmniVision™ CMOS VGA color camera for embedded imaging. uCAM TTL or 232 $58 14-pin Tiny Audio-Sound Module plays back pre-stored audio files (voice and music) from micro-SD card - ideal for embedded audio output. SOMO-14D $25 RF Modules Wireless Data Loggers ii H RF TX/RX Modules - simultaneously transmit composite video and stereo audio signals. 2.4 GHz ISM band. 4-ch RF, 5V operation. AWM630TX $16 AWM634RX $27 Log and display temperature, humidity, voltage, event-time or pulse-counting data up to 100 meters away from base station. RTR-50 modules from $170 RTR-57U base $401 USB Logger u EL-USB-1 - Standalone USB temp data logger (-25°C to +80°C). $49 EL-USB-2 (+ humidity) $79 EL-USB-3 (voltage) $69 EL-USB-4 (current loop) $69 EL-USB-CO (Carbon Monoxide) $89 RF Testing/EMI Tents *Br[C Economical, portable RF test enclosures, for initial compliance testing. from $1295 Shielding Tents with external frame, instant up/down for emissions-free room. from $3500 I started Saelig as an engineer - for engineers! Saelig is an olde English word means ‘happy, prosperous, blessed’ Check our website for lots of neat stuff! Alan Lowne • Saelig CEO elektor 1-2010 37 MODDING & TWEAKING Router + Wireless Doorbell = Alarm system! Inspired electronic recycling truly rings the bell ISDN circuit section 5V voltage regulator classic processor section with pP, ROM and RAM processor board with ISDN part removed Figure 1 . Neat and tidy: each functional block of the Router is completely compartmentalized. By Enrico Muller (Germany) Once again our workshop project is a true blue recycling project — turning an old telephone router and a wireless front door bell into a wirefree alarm system. Apart from a handful of cent components, an LCD readout and a scrap of breadboard no additional parts are necessary. Figure 2. Practise your surgical skills on the doorbell corpse. Figure 3. This is where we dig in, between the signal output and the sounder. Have you noticed how short the lifespan of consumer electronics gadgets is becoming? The fabulous gizmo that you carried home with pride last year is already out of date and you find yourself the owner of a growing pile of ‘electronic scrap’ that you nevertheless feel reluctant to dump. All the same, recycling this stuff for reusable components is often tricky, as either you need special tools or else the custom chips are too specialized or mysterious to do anything useful with. The introduction of multilayer PCBs and unhelpful label- ing of components make identification of circuitry and individual parts extremely difficult. It’s a rare pleasure when you discover an opportunity to breathe new life into an outdated appliance that had been condemned to oblivion. Conception For more than two years a Least Cost Router (LCR) for a multi-line ISDN telephone installation had been kicking around in my loft. Every time I went up there it annoyed me to seethe box of this ‘use- less’ device. Finally in mid-2006 I opened the cardboard box to see if there was anything useful I could do with the contents. At first glance I found a ‘wall wart’ AC power unit, an ISDN cable, a case and a circuit board that was almost entirely covered in surface-mount devices. Disenchanted I put it to one side. A few weeks later I examined the PCB (see Figure 1 ) a second time more closely. Rapidly it became clear that I hadn’t wasted good beer money after all. It was very apparent that the designers at Teles (the manufacturer) had separated each functional block of the circuitry both conceptually and physically on the board. On one side lay the ISDN functionality and on the other the processor section, next to the voltage stabilizer. The second pleasant surprise was the ‘classi- cally’ laid out data section: an 8051 derivative operated in textbook fashion! An 80C32 microprocessor, 32 KB of scratchpad memory (RAM), 64 KB program memory (ROM) and even a serial EEPROM were all provided. After studying the data sheets [1 ] [2] there was more good news. The ROM module used was made up from a sort 38 01-2010 elektor MODDING & TWEAKING Figure 4. The audio chip is removed, as you can make our own noise! of hybrid of Flash and OTP EPROM. An MTP-EPROM (multi-time pro- grammable EPROM) can be reprogrammed afresh up to 1 00 times. With this at the back of my mind, albeit without any firm ideas, I bundled away everything for further thought. As 2006 closed a ‘golden moment’ finally gave me the opportunity to have a proper play with the board. Dismantling the ISDN circuitry turned out taking longer than expected. This involved equipping myself with a junior hacksaw, after which I took some measure- ments and sawed out the complete ISDN section without major dif- ficulty (see Figure 1 ). On the PCB I found four LEDs that begged me to power them up. A simple multimeter was all I needed to identify the relevant Portpins on the 80C32 that illuminated them. With a small program written in machine code I was finally able to fulfil the wish of these little lamplings. Troubled birth In the early summer of 2007 our neighborhood was suffering a series of domestic break-ins. I had a brainwave. How about a sim- ple alarm system? The idea of installing cables that would snake all over the property was an unattractive proposition, so a wirefree solution came under consideration. Leafing through some catalogs soon made it clear that systems of this kind cost a three-figure sum! My researches were interrupted by the ringing of the telephone. An acquaintance wanted to let me know that an electronic doorbell that I had ordered for him had stopped working. It was then that it hit me: this was the moment of conception for ‘Project Wirefree Alarm System’! Things moved rapidly now. Repeating what I did with the LCR box, I split the doorbell system into its component parts (see Figure 2) and once more I was pleasantly surprised. Despite the low purchase price of $ 7.50 or so the product employed a proper coding system, albeit a simple one. I isolated the signal output of the decoder cir- cuit. This output was connected direct to a small audio signal gen- erator, meaning I had only to cut the circuit track in question and attach a piece of wire about 1 5 cm (6 inches) long to the track on either side (Figure 3). These two wires were now hooked up to the processor board of the router at the very same locations where two LEDs were located previously. A small ‘bell push detection’ program was now writ- ten, enabling the first practical test to be take place. After fitting batteries into the bell push I pressed the button full of expecta- tion. A red LED lit up on the bell push itself but that was all; the Figure 7. This is where you make the ten connections of the user interface. Figure 5. A cable leads from a reed contact to the transmitter board. The wireless sensor unit is now complete! Figure 6. An LCD display and three pushbuttons form the user interface. elektor 01-2010 39 MODDING & TWEAKING PI. 3 PI. 2 TO o P1.1 P1.0 V. o TO P3.3 TO PI. 4 Q> O P3.0 8 a P3.5 o P3.4 4*1 P3.1 doorbell board +5V © LSI K1 10 T 4k7 Tn BC337-16 — O K2 T ! +5V © SI H cancel Jj O 1 1 1 R2 £ D | R3 o S2 H S3 H | no yes I +5V © 18 16 14 12 Q1 11 IC1.A Q2 12 Q3 13 Q4 14 EN IC1 = 74LS241 11 13 15 17 19 11 Q1 IC1.B 12 Q2 13 Q3 14 Q4 EN R4 10k R5 )-f-| 470H h H LCD1 7 _8_ _9_ 10 11 12 13 14 OV +5V VO RS R/W E D4 D5 D6 D7 S>- -J a. c n Q i 8 -j LCD16x1 (2x8) +5V © ( 20 ) IC1 (To) 070555 - 13 Figure 8. Thanks to the logic unit we need just four port pins for the display and buttons. Components At the heart of this project is a product from the firm Teles sold under the title ‘Teles. iLCR Box’ as a Least Cost Router (LCR) device for multi- line ISDN installations. If you look around you can find it cheaply — we entered “Teles.iLCR Box” into Google and found one for 1 0 bucks at http://www.oppermann-electronic.de/html/body_mai_2006.html. The dealer http://www.telefonino.de/isdn.htm has them currently for 1 0 euro and there was also one on offer for 1 0 euro on the German auction site http://www.hood.de/ Check out electronics swapmeets too, as the product may appear under different brand names but do not confuse it with the SO-Box, 2S0-Boxetc. from Teles. If you get re- ally stuck e-mail the author (u881 emr@habmalnefrage.de). The second ingredient is the wireless doorbell setup. This consists of a transmitter (bell push) and a combined receiver and sounder. Of course you can substitute any similar product for the one used here. As these are so cheap now (under $ 1 0) you are best off buying this new at a DIY shop or from an electronics surplus dealer. Beyond a handful of simple components (see parts list), an LCD display and a piece of breadboard (Vector Board, perf board) no ad- ditional parts are needed. The whole lot should not cost more than about $40 in material costs. The printed circuit board is single-sided and can be made at home to save money. Details and measure- ments are in the Zip file that you can download gratis from the project page (070555) on the Elektor website. No special workshop tools are required but you will need access to an EPROM burner with the ability to erase and write MTP-EPROMs. At a stretch simpler models will handle this task if they can write to a 27C51 2. In this case as well as two 27C51 2 EPROMs you will need a UV eraser too. COMPONENT LIST Resistors R1-R4=10kn(0.25W) R5= 470 Ohm (0.25 W) R6 =4k^7 (0.25 W) Semiconductors IC1 =74LS241 T1 = included Miscellaneous SI ,S2,S3 = low-profile pushbuttons (6x 4 mm, 9 mm tall) LCD1 = LCD display 1 xl 6 (8x8) Breadboard 20-pin socket for 1C various support pillars 5 mm various screws (1 5 mm long) and nuts M3-M3.5 40 01-2010 elektor MODDING & TWEAKING tips and testin To separate the processor board you are best off using a junior hacksaw equipped with a steel blade. Having sawn it out, smooth off all the edges with fine sandpaper and check with a magnifying glass for any unwanted contact between individual tracks or the +5 V and Ground lines. After this, remove SMD resistors 1 and 6 (yellow) illustrated in Figure 7. In the down- load file [1 ] is a simple diagnostic program by the name of TEST1 .HEX, with which you can check out the function of the circuit board (the way this works is shown in the flow diagram). Connection 5 should permanently indicate a level of around +2.5 V. Further details can be found in the source text TEST1 .ASM. If everything works prop- erly you can now remove all the LEDs (white connections 1 -4) and substitute wire bridges for SMD resistors 2-5 (yellow). On the doorbell receiver board (see Figure 2) the existing power feeds should be swapped for pieces of wire about 1 5 cm long and the board then offered up and mounted in an unoccupied area of the lower half of the router casing (see illustration in panel). Fixing is by means of a screw through a 5-mm standoff spacer direct to the case. When doing this make sure the projections of the upper half of the case still mate properly with the openings in lower half. A hot glue gun is a convenient way of fixing the small loudspeaker between the board and the lower half of the case. To ensure no glue LED1 (green, pin 1) lights +5V present for 500ms on pin 7 LED 2 (green, pin 2) lights +5V present for 500ms on pin 8 LED 3 (green, pin 3) lights +5V present for 500ms on pin 9 LED 4 (green, pin 4) lights +5V present for 500ms on pin 10 T all LEDs (pins 1-4) light +5V present for 500ms on pin 6 drips out you can fix a small piece of paper or tape temporarily on the outside of the case in the appropriate position. Now remove the processor block from the lower half of the housing. Connect the data lines of the display and control panel (you will need eight data lines and two power feeds of around 20 to 30 cm length) and also the receiver board to the proces- sor board. To find out which wire con- nect to which examine the table (for numbering see Figure 7). The power supply wires are not included in the list. It is well worth twist- ing the power supply cables with one another (+5 V to +5 V, Ground to Ground) and soldering them direct to the wires from the voltage regulator. Take care to avoid short circuits. The download file contains a further diagnostic program called TEST2.HEX that can check out your hook-up wiring. If everything tests correct the display will read “Warten auf Taste” (Waiting for key press). After any press button is pressed (SI -S3) the message “Taste Xgedriickt” (Key X pressed) is displayed. If the sounder has been silenced you need to reset it for “Alarm-Signal EIN” (Alarm signal ON). In the latter case a tone signal is also heard on the loud- speaker. Each of the press buttons plus the alarm can be operated in any order you wish and as often as desired. If all this functions cor- rectly it’s time to convert the project into a working wirefree alarm system by programming it with FUA51 .HEX (see download file). Very lastly you need to label the press buttons from left to right as follows: ‘Cancel’, ‘No’ and ‘Yes’ (see header illustration). — Connection Port Function 01 PI. 3 D7 02 PI .2 D6 03 P1.1 D5 04 P1.0 D4 05 P3.3 Sounder 06 PI. 4 Signal input 07 P3.0 R/W 08 P3.5 RS 09 P3.4 Control input/output 10 P3.1 E trial did absolutely nothing otherwise. I put my trusty multimeter to work once more to monitor the output level of the decoder when the bell push was pressed. This looked perfectly adequate. What’s more the signal was reaching the processor. It was then that I accidentally dislodged the test probes and short-circuited two adjacent Portpins. Immediately the sounder did its business and the red LED on the processor board began to blink. The connection in question mea- sured 0 volts. Very strange: surely the alarm would be canceled with a logic 1 signal? Then it occurred to me that when I connected the meter I had forgotten to adjust the ‘set zero’ function. After correct- ing my error the circuit functioned as expected. The first prototype of my system was now fully functional. elektor 01-2010 4i MODDING & TWEAKING Figure 9. The case requires a bit of ‘surgery’ too. First in-service test Over the next few days I added a reset button to the test set-up. The audio sounder board needed a bit of tickling as well. The con- trol chip was chopped out completely and the driver transistor for the loudspeaker provided with a 4.7k base resistor to its base con- nection (see Figure 4). Now it could sound an alarm. I removed the receiver board and the loudspeaker from the case of the doorbell unit at last and fixed them in space that had become free inside the LCR unit case. At the same time I connected the power supply direct onto the processor board. So as not to shorten the lifespan of the components by over-voltage, the receiver board supply was reduced by inserting two series-connected diodes. After adapting the control program I treated the bell push to a cable with a built-in reed contact (see Figure 5). For test purposes I fixed this contact with a magnet and the transmitter to my letter box. Now the system alerted me whenever the postman raised the flap to deliver mail. Figure 1 0. The firmware has been kept as simple as possible. Let’s get started... Although my first proper trial worked well, something was annoying me. The alarm LED mounted up on the wall was either hard to see or totally out of sight. For this reason I decided to enhance the project with an LCD read-out and a small operating panel. Conveniently I was able to find an elderly 1 xl 6 LCD display in my junk box (Fig- ure 6). To simplify operation as far as possible I decided to restrict the number of press buttons to just three. All functions could now be catered for by Yes, No and Cancel decisions. The ‘wish list’ was now finalized. Operating an HD44780-compatible LCD module calls for a minimum of seven Portpins (in 4-bit mode). Three are needed for the press buttons and one each for signal acquisition and output. Altogether this chalks up a requirement for 1 2 unassigned connections on the processor board. Nevertheless we can mange with just ten Portpins (see Figure 7). This is achieved by utilizing connections twice over. I decided to transfer the four data bits of the LCD module (D7-D4) and the three input press buttons by corresponding logic to the four Portpins of the processor (see Figure 8). This is how the need arises for a total often wires, including the connections to transfer the four Portpins used together from input and output and vice versa. The operating panel has components on both sides. All press but- tons, resistors and bridge loops are on the ‘top’ or ‘component’ side, with a 74LS241 (fitted in a socket) and the ‘wiring’ fitted to the ‘bottom’ or track side. ...and finish the job! All that’s left now is to drill the upper half of the case and make the necessary openings (Figure 9). All sizes and locations were simply measured off the LCD display and the already populated PCB of the operational unit. I deliberately kept the firmware very simple. As you can see in Fig- ure 10 , the system has a start-up delay, set at 60 seconds, and an alarm delay, preset at 30 seconds. The sounder is silenced after two minutes. To replicate my design you will find a layout plan of the components on the board, a PCB layout and software in ASM and HEX files ready to download on [4]. The components needed and conversion details are set out in panels included with this article. Naturally everybody is free to make alterations to meet their indi- vidual needs. There is plenty of unused RAM and EEPROM capacity to spare on the processor board of the LCR! ( 070555 -I) Web links [1 ] www.alldatasheet.com/view.jsp?Searchword=80C32 [2] www.alldatasheet.com/view.jsp?Searchword=MX26C51 2A [3] http://www.oppermann-electronic.de/assets/applets/installation teles_router (Teles iLCR Box technical manual) [4] www.elektor.com/070555 42 01-2010 elektor USB is cool/sucks* cross out as applicable By Jerry Jacobs and Chris Vossen (Elektor Labs) and Jens Nickel (Elektor Germany Editorial) USB is ‘state of the art’ when it comes to connecting electronics to a computer — and in some cases it’s the only option, too. It goes without saying that many of the recent Elektor circuits that require an interface to download, upload or store data on a PC, also have a USB Interface. After all, USB is fast, flexible and has this nice hot-plug-and-play-feature (sorely missed if you didn’t have it, believe u us!). But when it comes to making things easy for end users, it’s getting increasingly difficult for developers. Some of our readers may have come across non-recognized USB Devices, USB timing problems and some other time-consuming quirk or nastiness of the ‘universal serial bus’. For those — and all other readers — we compiled this USB FAQ! 1 . I really like building Elektor circuits from time to time. But with the good old RS232 port the whole thing seemed so much easier. Will you stick to USB to connect your circuits with a PC in the future? One of the first Elektor articles dealing with this bus was the USB interface in September 2000 (www.elektor.com/000079) using an 1C from Cypress. This was a great success! Meanwhile, we have gained a lot of experience with this interface. solder). For circuits where such a chip is too expensive, a simple TTL pinout is an option. On this connectoryou can find the data lines, handshake lines and power-supply — as you may remem- ber it from the old times. To connect with a PC, you can use a TTL-USB Cable (see www.elektor.com/08021 3), which is quite easy to handle. 2. For some older circuits, I can use existing RS232- USB converters. But there are timing problems occasionally. Where can I get information about this problem? Our resident author Burkhard Kainka wrote an article in Elektor about such problems, see www.elektor.com/050071 . You can also find good information about RS232-USB conversion on the Internet, for example at www.lammertbies.nl/comm/info/RS- 232-usb.html. 3. Where do I get started when I want to make my own USB project? There are various manufacturers of microcontrollers that have built-in USB, for example Atmel’s AT90USB series. The ARM cored Philips LPC(1 /2/3)000 devices also have USB. A third example is the PIC1 8 and PIC24 series from Microchip. 4. If I want to use an AVR micro with USB, can you point me in the right direction? Here are three recommendations from Jerry Jacobs, who is trainee in our lab: The Teensy project (http://pjrc.com/teensy) has lightweight examples that should help you understand the actual bit manip- ulations governing USB on an AVR controller. As far as possible, we won’t use the good old MAX232 in the Onthewebsiteswww.ssalewski.de/AT90USB_firmware.html.en Elektor circuits any more, but a USB chip like the FT232R(L)from and www.fourwalledcubicle.com/LUFA.phpyou can find more FTDI (the L version is a QFN package and a little more difficult to advanced examples. elektor - 01/2010 43 E-LABS INSIDE E-LABS INSIDE 5. USB is cool, but one often has problems with non- recognized devices. Is there a bag of tricks to avoid such problems? Always make sure you have the driver that belongs to the prod- uct and software you’re using. For example: Atmel’s avrispml<2 ISP programmer needs the Atmel driver if you use AVR Studio for in-circuit programming. If you want to use avrdude then you need to install the correct libusb driver. AVR Studio won’t recog- nize your programmer if the libusb driver is installed. Furthermore, it’s useful to have a good understanding how the so-called enumeration works and what it does. This is the most important part of device recognition. It enables the computer to ask which device it is, in which class it belongs, how much current it draws and how many endpoints it has. You can find a lot of information on the Internet, for example at www.lvr. com/usbcenum.htm. 6. When nothing seems to work, are there software tools around I can use to check or solve the problem? Under Linux you can just fetch the kernel messages by run- ning dmesg in the console. Unfortunately, you can’t see ker- nel messages under Windows (there are some utilities from Intel but you should use it only with an English Windows XP SP2 installed!). Here are some handy utilities for Windows that may prove helpful www.usb.org/developers/tools www.ftdichip.com/Resources/Utilities/usbview.zip www.nirsoft.net/utils/usb_devices_view.html http://sourceforge.net/projects/usbsnoop Under Linux you can use the tools called usbview (www. kroah.com/linux-usb) and Isusb (http://sourceforge. net/projects/linux-usb). Furthermore, there’s a good commercial program by SYSnu- cleus (www.sysnucleus.com). USBtrace is a software spy for USB that also features a protocol analyzer. 7. I heard devices can draw up to 500 mA over USB, but some people say it’s just 1 00 mA. What’s the secret behind it? There’s theory and there’s real life. The specification says that you can only draw 1 00 mA by default. If you need more, the device should ‘order’ the excess amount from the Host (the con- figuration can be set in steps of 2 mA) at the time of enumera- tion. Maximum is 500 mA. In practice, almost all PC USB ports are designed and built to supply 500 mA by default. 8. What happens if my circuit draws too many milliamps? Most of the computer’s USB hubs are overcurrent-protected and will disconnect offending devices automatically, sending a mes- sage back to the operating system that can pop-up a message box in the user (space) interface. If you are unlucky, the USB port is not protected. Instead of a fuse, in some cases only a resistor is integrated, and when you see smoke, it’s too late. So we strongly recommend to make sure that your circuit won’t draw too much current. If you work with high voltage on the target device, there’s an interesting chip from Analog devices, called ‘ICoupler USB Port isolator’, see http://www.analog.com/en/interface/digital-iso- Iators/adum4160/products/product.html. 9. Do you have any experience with the mechanical sturdiness of USB connectors? If everything is soldered correctly, there shouldn’t be any prob- lems. In the Elektor lab, we haven’t had any broken connectors so far. Especially the micro connectors are very robust. The designers of the connectors did a good job. The construc- tion of the connector ensures that the metallic sheath (which is connected to ground) first makes contact, then the pins follow. This prevents damage from electrostatic charges. 1 0. What do you think about USB 3.0? We already had an article in Elektor about USB 3.0 (www. elektor.com/080880). You can rest assured there will be Elektor circuits using that interface in the future! Such an interface is downwards compatible, so you can use it with USB-2.0 cables and a PC-USB 2.0 Port, too. (090768-1) 44 elektor -01/2010 Elektor CO Meter Mk. 2 by Jens Nickel (Elektor Germany Editorial) Too much carbon dioxide (C0 2 ) is harmful not only for the environ- ment but also for our own health. But as Michael Caine would say, not a lot of people know that. In just two hours of a meeting or classroom presentation the normal concentration of this gas can rise tenfold. The build-up of C0 2 in the blood prevents the unfortu- nate participants from absorbing enough oxygen, with giddiness, nausea and even breathlessness a worst-case outcome. This was reason enough for Elektor to make a C0 2 meter its cover project in January 2008 HI. The core of this design was a C0 2 mea- surement module from the Japanese manufacturer Figaro combin- ing not just a built-in sensor but also the control system and even a microcontroller. The latter looked after evaluation of the sensor signals: one pin of the module’s interface produced a DC voltage directly proportional to the concentration of C0 2 . Also included was a switching output that went high when a user-settable threshold was reached. This intelligent module — remarkably compact in the surface-mount version CDM41 1 6A — made the schematic of our C0 2 meter delight- fully simple to follow. An ISP-programmable ATtiny was used for A/D conversion of the signal measured and for driving the alpha- numeric LCD display. Throw in the power supply plus a switching output using a transistor and a relay and they you have the essential elements in their entirety. The simplicity of the circuitry and the ready availability of a kit from Elektor comprising a PCB, a pre-programmed microcon- troller and the sensor module encouraged many readers to build their own C0 2 meter and almost 200 of these kits were ordered (now all sold — sorry!). We received feedback too: readers all over the world got in touch by letter and e-mail, as did the Dutch Asth- ma Foundation, for a very good reason. Asthma sufferers are particularly susceptible to the harmful effect of excessive concentrations of carbon dioxide. Because the lungs and bronchial passages of asthmatics are damaged these people are inclined to hyperventilate, in other words they have to breathe rapidly, in fact too rapidly. As a result the lung tissues of severe asth- matics can become so damaged that the C0 2 in the blood can no longer be eliminated easily by respiration. Elektor was delighted to make a modest contribution to the relief of this problem. Chris Vossen from Elektor Labs was assigned the task of improving the design of the C0 2 meter, with the goal of creating for sufferers a handy portable device with simple 3-button opera- tion and a convenient readout using a graphical LCD display. Bonus nice-to-have features included a USB connection for transfer- ring measurements to a computer for storing long-term measure- ments. Of course a temperature and humidity sensor would be use- ful too, as sufferers’ woes increase in excessively dry atmospheres (to compensate for dry air, lungs increase mucus production that then blocks the airways). After some deliberation Chris decided to make an entirely fresh start. Satisfactory experience with the R8C from Renesas on vari- ous projects inclined him to employ this handy little 1 6-bit machine in the new C0 2 meter. The E8a debugger used in the labs made an elektor - 01/2010 45 E-LABS INSIDE E-LABS INSIDE excellent development tool, so provision was included on the board for a suitable connector for this. Since the R 8 C has no USB interface Chris enhanced the little controller with an FT232 chip from FTDI. The combination of this UART and the R 8 C would now take care of all USB connectivity. Another convenient touch included is auto- matic switching to take volts either from a USB connection or from an external plug-in power supply; we can hardly expect end users to fiddle around changing jumper plugs! So far the printed circuit board has developed to the stage that you can see in the photo. There is still some way to go, as the connection to the surface-mount humidity sensor from Sensirion (this must be familiar to many Elektor readers) is still a bit ‘provisional’. When it came to the packaging the final choice was for a design made of cardboard that when opened can be laid on a table. In its flat (unopened) form the device can also be hung on a wall, en- abling users to keep a constant eye on the readings for C0 2 and hu- midity. On the cardboard case it would be easy to print all manner of instructive information on the subject of C0 2 . In this connection our meter will prove handy not just for taking measurements but also for educational purposes, for instance in schools. Here it is a positive advantage to have all the electronics and the sensor visible on display, rather than hidden inside a plastic case. A feature that’s both useful and attractive is the RGB-LED background illumination of the readout display. Using the colors green, orange or red we can alert users at a glance whether the C0 2 concentration is acceptable, becoming significantly elevated or has already reached a critical value. Red means it’s vital to let some fresh air in! Some way off in the future are plans for a transportable C0 2 sensor to use inside cars. Since the Figaro sensor requires start-up calibra- tion with unstressed air for about two hours, by its nature it would not look a good choice. But there’s nothing engineers enjoy more than a challenge and so Chris ordered from one of the large elec- tronic suppliers a portable C0 2 sensor that made a plus point of having a short initialisation time. Some ‘reverse engineering’ re- vealed a completely different looking sensor module. Instead of the so-called Nernst Cell used in the Figaro device, this alternative de- vice makes use of an infrared spectroscopic technique, which also enforces a somewhat larger form factor. This sensor provides an SPI interface delivering the C0 2 concentration in digital format. It was handy that Chris already had the small Minimodi 8 on the bench, the Minimodi 8 being a new processor board for the CC2 project, which conveniently has not only an SPI interface but also a display already... A small program for the ATmega used with this project was soon written, meaning there’s nothing to stop testing the new C0 2 sensor now (see photo)! (090603-1) [1 ] www.elektor.com/070802 Linux Symposium Around 80 engineers and project managers were attracted to a Linux symposium organised by the German distributor GLYN 0] together with Toshiba who were showcasing their latest 32-bit microcontrol- ler. The two-day event took place in the middle of November in Dus- seldorf. With a total of around 12 presentations we were introduced to the nuts and bolts of an (Embedded) Linux system and also to a mi- crocontroller that would be an ideal platform for it. Toshiba’s new 32- bit microcontroller type TMPA900 was the star of the show featuring an ARM9 compatible core with MMU, instruction pipeline, cache and integrated LCD graphics controller (including LCD accelerator) USB host/device interface plus a few other useful features. This is clearly a capable beast with enough power on tap to comfortably run a ma- ture operating system such as Linux in an embedded environment. It could form the basis of a compact mobile device with a sophisticated graphical user interface without too much additional hardware. On the second day it was described how embedded graphics run under Linux. From the software engineers point of view the frame buffer looks like a file in the / dev folder (true to the Linux motto: ‘every- thing is a file’). Linux uses the single instruction mmap to map the whole of the hardware video frame buffer therefore the application gets an array pointer to the frame buffer memory so that changes made to the memory area are then immediately represented on the display. The controller MMU simplifies the developer’s job. The file system used by Linux is quite innovative and deserved a special slot in the two day timetable. Also interesting for software developers were the compiler and debugger demonstration in the Linux Tool Chain (running on a virtual machine but which can also be installed on a Windows platform). A collection of all the necessary software was distributed to all participants by bplan GmbH t 2 L Many participants raised the question of the licence rights of Linux. The Linux operating system is an Open Source program so that the n source code is available for anyone to read and the program is free to download and use. In contrast to Public Domain Software (which has no copyright protection and can be used by anyone for any purpose) the use of Open Source software is controlled by the conditions of a licence. The best known Open Source licence is GPL (General Public License). A GPL ensures that any new program derived as a result of modifying or adding-to the original program must also have a GPL (also known as Copyleft, so named to distance it from the age-old concept of Copyright). GPL states also that any program which uses static linking to a GPL li- brary is also derivative and must therefore have GPL rights. At the time of writing there is some dispute amongst the experts whether dynamic linking also produces derivative software. Less strict licens- es are LGPL (Lesser GPL) and BSD (Berkeley Software Distribution). LPGL allows the use of open-source libraries in closed-source soft- ware with the proviso that any modifications must be documented in the library. BSD licences have very few restrictions allowing un- limited redistribution for any purpose providing certain copyright acknowledgements are maintained in the source code. Chris Vossen from Elektor took part in this event in Dusseldorf and came back full of ideas and suggestions; he is in no doubt that in the coming year we will see more of these high performance ARM controllers running embedded Linux in all sorts of applications. (090770-1) [1] www.glyn.de [ 2 ] www. bpla n-g mbh. de/output. php?PAGE_ID-209 46 elektor - 01/2010 • Cost-effective prototypes and production runs • Wide range of materials or customization of provided material • Automatic price calculation • Fabrication in 1 , 3 or 7 days f rrrr r: : Sample price: $43.78 plus S&H 'FRONT PANEL EXPRESS 1 www.frontpanelexpress.com (206) 768-0602 FatMan 1 1 Analog MIDI Synth Mijs^TlitoNiiIs/Kiis A nalog Synthesizers Guitar Effect? Tube Electronic^ Studig Gear Makers since 1959 wwur.p ala. camWiktii r c PIC Cookbook for Virtual Instrumentation |VS Several case studies included The software simulation of gauges, control-knobs, meters and indicators which behave just like real hardware components on a PC’s screen is known as virtual instrumentation. In this book, the Delphi program is used to create these mimics and PIC based external sensors are connected via a USB/RS232 converter communication link to a PC. Several case studies of virtual instruments are Approx. 264 pages • ISBN 978-0-905705-84-2 A detailed including a compass, an oscilloscope, a digital and analogue thermome- ter, a FFT-based Frequency analyser, a joystick, mouse-control panels and virtual displays for cars and aircraft. Full source code examples are provided both for several different PIC’s, both in assembler and C, together with the Pascal code for the Delphi programs which use different 3rd party Delphi virtual components. $46.00 Elektor US 4 Park Street Vernon CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: sales@elektor.com Further information and ordering at www.elektor.com/shop ; >li elektor 1-2010 47 TEST & MEASUREMENT P4 04R8Rie»U012fli3 JL ill • */ i*. l*[ 1 j lHi, ‘i, WWMp ATM18 Logic Analyzer for deft data acquisition By Wolfgang Rudolph and Burkhard Kainka (Germany) (ClflPT' ■- IMIll^i A-J]un !m> *] V W i* CZ > a ' L2 t" — : 1 JL UXOrt r n d 1 “L — 1 4 _L_ 1 __J 1 C ^ e £ ~ Wf«| O>C0^ S I 11111111 = PB6 0 5*^= =| r: ‘|s ,j . 1 iiiffiTi ; =■> ■■' ~ — ■ ' I* *• n 1 K6 pncffl \ mritli* 1 Is ! 3)KS s 5 gt* Iff L ftj K9 iQgfiic. L^f PQ4 £>' » *'• **» * ’ K 1 1 - - « — ■TD K .' h- If n-'-te, Ira'iti ' Jrv.#.- “ bltIi P5^3 PD6® N H»n«>ii -30 Then For Adr = 0 To 501 D = Pine Ram (adr) = D Next Adr Else Timerl = Timebase Portb .0=1 D = Pine If Saveram = 1 Then Ram (adr) = D Adr = Adr + 1 Else Put #1 , D End If End If If Adr > 501 Then For Adr = 1 To 501 D = Ram (adr) Put #1 , D Next Adr Adr = 1 If Oneshot = 1 Then Stop Timerl End If End If Portb .0=0 Return elektor 01-2010 49 TEST & MEASUREMENT Figure 3. A four-channel acquisition. clock signal and outputs the data to be programmed one byte at a time on MOSI. A'rwi hi ?eic |(& X Figure 4. An acquisition lasting 200 ms. After a delay of exactly eight clocks the data values reappear on MISO, giving an indica- tion of whether they have been correctly received by the target processor. This example demonstrates the benefit of having multiple digital channels avail- able, but also a weakness of the software: it would be highly desirable to have a longer data buffer to allow acquisition over a lon- ger time period, but retaining the ability to zoom in to details of the signal behavior. If we slow the timebase down to, for exam- ple, 20 ms per division (Figure 4) then it is Listing 2 Display of six bits (Visual Basic program ATMi8Logici.vbp) For n = 1 To 498 XI = n X2 = n + 1 Y1 = 240 - 32 Y2 = 240 - 32 Picturel . Line Picturel . Line Y1 = 200 - 16 Y2 = 200 - 16 Picturel . Line Picturel . Line Y1 = 160 - 8 * Y2 = 160 - 8 * * (Chi (n) And 1) * (Chi (n + 1) And 1) (XI, Yl) - (X2 , Yl) , &H0& (X2 , Yl) - (X2 , Y2 ) , &H0& * (Chi (n) And 2) * (Chi (n + 1) And 2) (XI, Yl) - (X2 , Yl) , &H0& (X2 , Yl) - (X2 , Y2 ) , &H0& (Chi (n) And 4) (Chi (n + 1 ) And 4 ) Picturel . Line (XI, Yl) - (X2 , Yl) , &H 0 Sc Picturel . Line (X2, Yl) - (X2 , Y2) , &H 0 Sc Yl = 120 - 4 * (Chi (n) And 8) Y2 = 120 - 4 * (Chi (n + 1) And 8 ) Picturel . Line (XI, CM X 1 I — 1 Yl) , &H 0 Sc Picturel . Line (X2, Yl) - (X2 , Y2 ) , &H 0 Sc * CM i o 00 II \ — 1 (Chi (n) And 16) Y2 = 80 - 2 * (Chi ( n + 1 ) And 1 6 ) Picturel . Line (XI, CM X l i — 1 Yl) , Sell 0 Sc Picturel . Line (X2, Yl) - (X2 , Y2 ) , &H 0 Sc * i — i i o ii \ — i (Chi (n) And 32) * \ — 1 1 o II CM (Chi ( n + 1 ) And 3 2 ) Picturel . Line (XI, CM X 1 \ — 1 Yl) , &H 0 Sc Picturel . Line (X2 , CM X i \ — 1 Y2 ) , &H 0 Sc Next n Listing 3 Use of timestamps (BASCOM program Logic 2 .bas) Sub Logger Timerl = 0 Adr = 1 Dold = 255 Do Timestamp = Timerl D = Pine Portb .0=1 If D <> Dold Then Ram (adr) = D Adr = Adr + 1 A = High (timestamp) Ram (adr) = A Adr = Adr + 1 A = Timestamp Ram (adr) = A Adr = Adr + 1 Dold = D End If If Timestamp > 60000 Then Do Ram (adr) = D Adr = Adr + 1 A = High (timestamp) Ram (adr) = A Adr = Adr + 1 A = Timestamp Ram (adr) = A Adr = Adr + 1 Loop Until Adr > 500 End If Portb .0=0 Loop Until Adr > 500 For Adr = 1 To 501 D = Ram (adr) Put #1 , D Next Adr End Sub 50 01-2010 elektor TEST & MEASUREMENT possible to see a longer record covering the programming of around ten bytes, but the details of the clock signal and its time rela- tionship to the data signal are lost. A record length of 500 samples is not enough to give a full overview of the process. Figure 5. Signals on an l 2 C bus. Figure 6. 1 2 C bus signals underthe magnifying glass. Timestamps The underlying problem is that digital sig- nals can include both very brief and very long pulses. We would like to have a much larger memory buffer (and, ideally, a correspond- ingly larger monitor on which to view the results). Both, unfortunately, are expensive. There is, however, a solution. In the exam- ples we have looked at there have been long periods where the state of a signal does not change, which is rather wasteful of memory. If, instead of storing values at regular inter- vals of time, we store values only when they change, we can save on memory. The cost is that each sample now needs to be accompa- nied by a timestamp. The timestamp might take the form of a 1 6-bit quantity, mea- sured to a resolution of 4 ps using Timer 1 (see Listing 3). A total of three bytes are now required for each sample, and we can fit 1 67 state changes in the memory buffer. This is fewer than before, but we can now mix short and long pulses at will. Listing 4 shows how the timestamps are converted into x-coordinates in the Visual Basic pro- gram running on the PC. The implementation includes a further compromise, in that if 60000 time units (240 ms) pass and the buffer has not been filled, the last state will be repeated until the buffer is full. This gets around the prob- lem that if fewer than 1 67 state changes occur the system would wait for ever with- out displaying any results to the user, the timeout ensuring that even constant sig- nals are displayed. The total acquisition time now depends on the signal being observed: with constant or very slowly changing input the total time will reach its maximum of 240 ms, while the shortest possible total acquisition time is just 2 ms, a ratio of 1 20 to 1 . The maximum sample rate is approximately 200 kHz. The decisive advantage of this technique is that it is possible to display the results from a single acquisition and analyse them at various timebases at your leisure. You can scroll through the data to look for signifi- cant events. For example, you can set the timebase to 1 0 ms per division to get an overview of the situation and then zoom in for a closer look. Figure 5 shows some activity on an l 2 C bus: you can see that there is a gap of around 30 ms between the individual data packets. Figure 6 shows a close-up displaying a part of the transac- tion in greater detail. In conclusion This project has again demonstrated the potential of modern microcontrollers and the versatility of the ATM1 8 board, which has been turned into a logic analyzer with very little effort. By converting the soft- ware [2] into C or assembler it would be pos- sible to achieve higher time resolution, and the PC program that displays the results also has plenty of scope for expansion. One possibility would be to automatically anal- yse the bit patterns that have been acquired from a serial port and convert them into ASCII characters to be displayed alongside the waveforms. Although our little logic analyzer lacks the performance and some of the features of its professional cousins, the basic principles are much the same: we have learned a lot more and spent a lot less! (080949-I) Internet Links [1] www. e I e kto r. co m / 0 8 0 944 [2] www.elektor.com/080949 Listing 4 Converting timestamps into x-coordinates (Visual Basic program ATMi8Logic2.vbp) XI = 0 For n = 0 To 497 Step 3 X2 = (Chi (n + 5) + 256 * Chi (n + 4)) X2 = X2 - Pos * 80 X2 = X2 / zoom If X2 < 0 Then X2 = 0 If X2 > 500 Then Pos2 = 500 Y1 = 240 - 32 * (Chi (n) And 1) Y2 = 240 - 32 Picturel . Line Picturel . Line Y1 = 200 - 16 Y2 = 200 - 16 Picturel . Line Picturel . Line * (Chi (n + 3) And 1) (XI, Yl) - (X2, Yl) , &H0 & (X2, Yl) - (X2, Y2) , &H0 & * (Chi (n) And 2) * (Chi (n + 3) And 2) (XI, Yl) - (X2, Yl) , &H0 & (X2 , Yl) - (X2, Y2 ) , &H0 & XI = X2 Next n End Sub elektor 01-2010 5 i CIRCUIT ANALYSIS Fourier Analysis Using LTspice & Excel Frequency & time domain analysis made easy By Jeremy Clark, VE 3 PKC (Canada) LTspice is a circuit analysis program with many powerful functions, including a spectral analysis tool. It is freely downloadable and has an active user group. Together with Microsoft’s well-known Excel tool and three free spreadsheets from the Elektor website, Fourier analysis can be performed on many common waveforms found in electronics. Let’s start with the analysis of the rectangular pulse train. This wave- form as depicted in Figure 1 can be used to represent many basic signals such as a timing sequence, a trigger signal or a data signal. The Fourier series for a rectangular pulse train as shown is: fit) = a 0 / 2 + / \ a n cos{ncot) n=\ = 2 Ad sin (njrd) (rurd) This represents a DC value plus an infinite series of harmonic cosine waves. The components can be calculated using the Excel spread- sheet called fourier.xls supplied free of charge at [1] . If you run it, you’ll see that the component values are shown in dBm as would be seen on a spectrum analyzer (Figure 2). Note for the example shown, the parameters are: - Pulse Amplitude - Duty Cycle - Impedance - Fundamental - Second Harmonic -Third Harmonic - Fourth Harmonic - Fifth Harmonic = 1 volt = Pulse Duration/Period = t/T = 0.2 = 50 ohms = +1 .5 dBm = -0.4 dBm = - 3.9 dBm = -10.6 dBm = -00 dBm; spectral null Now use LTspice We can now verify these harmonic components using LTspice, a free program from Linear Technology [2] . The circuit in Figure 3 can be used to generate a rectangular pulse train. We will start off with the following settings: -Amplitude = 1 volt -Impedance =50 ohms VoltsJ Amplitude = A Duration = T Period = T Time ► Rectangular Pullfr Tr „i n tn=Wd[5ln|npid^'|n;p!dJ] Bill fir lllfi r.avel'iM ui p2j> amplitude = A vdllS Emertfie waveform sJwty cycle = cHdecimfll) Euler (he clrcuft Impedance = E ohm j ft* 1 d" 0.2 50 n 2’A‘d rTpi'd s mn'pl'di (nlnfo'prd^'prd Cfl volts Cn vails rrr.B Cn wans Cn millwatts Cn dBm 1 040 0-53 S 30501 9355*01 3 74E-01 2 665.0* 1 405.03 1.405*fl0 15 2 040 1 2£ S.SiE-01 7£76-0i 3036-01 2 14|-0i 9 175-04 9176-01 -0 4 9 040 1 E3 9 51E-01 E.05E-O1 202E-O1 1 43E-D1 4 07E-04 4C7E-01 43.9 4 0 4* 2 51 5 305-01 2 34E*01 9 255. 02 6 625-32 0 76E.05 B75E-02 ■10.6 S 0.40 3.14 2 6£E-00 6.44E-07 3 336-07 2 391-07 1 145-1& 1 U 6-12 -1194 8 0 40 3.77 -5.SBE-Q1 -1.56E-01 -6 24E-02 -441E-02 3.S9E-05 3090-02 -14 1 7 040 4.40 -0 £ 1 5-01 .2.105*01 *3 655-02 *6t2E*02 7 46E4J5 740E.Q2 .11.0 t 0.40 £.0 3 -9 51E-01 -1.6&E-01 -7.47 6-02 -£34602 £ 73E-0£ £ 736-02 -12.4 9 0 40 5.E5 -5.86E-Q1 -1.Q4E-01 -4.1 EE-02 -294E02 1.73E-D5 1 73E-02 47.6 10 040 6 20 -0315-00 -6 455*07 *3 305*07 -2 39E-07 1 14E-15 1 14E-12 .119 4 11 040 4 336-01 t soe-02 3406-02 2 41E-02 1 1 GE-OS- 1 106-02 - 1®4 12 0.40 7.54 9.51E-01 1 26E-01 E 05E-O2 9.S7E -32 2 SEE-05 2 E5E-02 ■15.9 Mol*: The log a* a very small numbs: is-rEramngiy nagalive colha lDg{0>i* ■in&iily For sractcal pjrposee -1 a i ’/*r/ *mir tigr*l Figure 1 . Definitions of a rectangular pulse train. Figure 2. The “fourier.xls” spreadsheet program used to calculate Fourier components. 52 01-2010 elektor CIRCUIT ANALYSIS Rectangular Pulse Train PULSE(0.0 1 0.0 InS InS 200nS luS 10) .tran 5uS Cdit £i*iukj!krfi Commdnd 5il TihiuwJ fKflntitX UUWiMp Plate L'L U'L. 1 ‘elun a nenfera tnre-dOTur* otuMoi WTto* 5uS Figure 3. The ‘schematic’ of the pulse generator as drawn in LTspice. Note the Stop time setting under the ‘Transient’ tab -Duty Cycle =0.2 - Period = 1 psec -Pulsed =200 ns Figure 4 will help you get LTspice to do what you want. Figures depicts the waveform as you would see it on an oscilloscope. The spectrum of the waveform can be seen by using the FFT func- tion, see Figure 6. Note the decreasing power of the harmonics with spectral nulls at the fifth, tenth, etc. harmonics. The spectrum has the so-called sin x/ x shape. Figure 4. LTspice settings for voltage VI . We can compare the spectral powers as measured in LTspice vs. the theoretical values given by the Excel spreadsheet. First however we must calibrate the FFT display. Enterdbm.xls In LTspice it can be shown that a cosine wave of amplitude = 1 .41 4 volts gives 0 dB on the FFT display. This means that 0 dB in LTspice = +13 dBm. The calculation goes like this: Power(W) = Vrms 2 / R Power(mW) = Power(W) * WOO dBm = Wlog 10 (mW) Table 1 . LTspice and theoretical results compared. Component LTspice level [dB] LTspice [dB] (0 dB = +13 dBm) Theory (Excel) [dBm] FI = 1 MFIz -11.2 + 1.8 + 1.5 F2 = 2MHz -13.2 -0.2 -0.4 F3 = 3MHz -16.8 -3.8 -3.9 F4 = 4MHz -23.7 -10.7 -10.6 F5 = 5MHz -56.8 -43.8 -Infinity Figure 5. Rectangular pulse train with Period = 1 ps and Pulse Figure 6. Rectangular pulse train spectrum. Fundamental at 1 MFIz, Duration = 200 ns. 1st null at 5 MFIz. elektor 01-2010 53 CIRCUIT ANALYSIS □ Microsoft Excel dBm.xls Atm H * 1C * b / u mm mm $ % , 'Ji ft * 3] FQfmat £oo "O < Low voltage indicator By Lars Nas (Sweden) This circuit is a very simple low voltage monitoring device for +5 V V cc supply lines. It can be used to monitor battery voltage by indicat- ing when the supply level drops below a predefined value. The out- put of the circuit can interface directly to digital logic (for example, TTL), reset a microcontroller or turn off your application before it goes haywire (CEO-speak: “into an undefined state”) owing to a too low supply voltage. IC1 = LM393D PI R2 \ Ik Vcc <±> R1 The circuit uses only one comparator from the LM393D package. Alternatively, feel free to use the LM339. The LM393D compares two voltages, VI at the inverting (-) input and V2 at the inverting (+) input. When V2V1 , the out- put is driven High, i.e. to (nearly) the positive supply voltage. A 3.3 V zener diode, D1 , and a 220 Q resistor, R3, form a shunt volt- age regulator used to set up a reference voltage (VI ) of 3.3V at the inverting input. R3 limits the current through zener diode D1 to at least 6 mA, causing the diode to remain reverse biased and conduct even when battery voltage drops to 4.65V. Preset potentiometer R2 enables V2 at the non inverting input to be set above the 3.3 V threshold when the supply voltage V cc is above 4.65 V. The output of the comparator will then be driven High since the output transistor is off. Consequently the LED is turned off also. When V cc drops below 4.65 V, V2 goes below the level of VI . This causes the comparator output to be driven to the negative sup- ply voltage (GND). The current flow through R1 causes the LED to light up. R1 is calculated to limit the current through the LED to about 15 mA. (080381-I) mPoIoIu Robotics & Electronics Robot Kits Line followers Mini-sumos Robot arms Save 10% fith coupon cod< ELEKTOR3PI9^ 3pi Robot Item # 975 : $99.95 High-performance, C-programmable, ATmega328P- based robot (with Arduino support). Mechanical Components Motors, servos, wheels, ball casters, chassis, & more! Controllers and Sensors QTR reflectance sensors $3. $49.95 Solder Paste Stencils & Laser Cutting Both starting at $25! Use our low-cost plastic solder paste stencils to quickly assemble your surface-mount designs. Laser-cut your own custom chassis, front panels, and more! 1 -877-7-POLOLU www.pololu.com 3095 E. Patrick Ln. #12, Las Vegas, NV, 89120 elektor i2-20og 59 WORKSHOP Vacuum L_ Figure 1 . negative. improve the By Yves Masquelier (France) If like me you have been confronted with mediocre results when making certain PCBs, and if you’re not put off by a little bit of DIY, then this is certainly going to be the solution for you. quality of your homebrew PCBs I have sometimes ended up with poor PCBs, for reasons which I didn’t really under- stand, since the photoresist was of good quality, from a reliable source, and wasn’t out of date, and the photo-sensitive coat- ing appeared evenly spread. The exposure equipment was a standard PVC case type fit- ted with four 8 W actinic tubes, with a sheet of plastic foam to exert pressure over the whole of the area. Even though this pressure was only light, and the foam somewhat fol- lowed the slight curvature of the lid, I did check that it held a document the thickness of a PCB negative properly, and so should be even better with the thickness of the board itself added. Larger-size boards were sometimes spoiled in the middle, where the tracks were thin- ner than they should have been, so much so that sometimes they broke up altogether — and this, regardless of where I positioned my board to be exposed on the illuminated surface. So it wasn’t being caused by the curvature of the cover. Smaller boards were always OK when exposed singly, but some- times exhibited the same defects on the middle ones when I tried grouping together several small negatives to expose one board to be cut up after etching. To give you an idea, Figures 1 and 2 show a negative and a central section of a board exposed in the tra- ditional way. I tried doing a bit of retouching by hand, before deciding to start again with a fresh exposure. I ended up having some doubts about the mechanical characteristics of the boards themselves, rather confirmed by a number of problems I encountered when trying to mill boards, where here too the middle sec- tions of the boards had problems, with mill- ing that was less deep than near the edges. A simple check using an engineer’s rule, which is pretty perfectly straight, showed me that the boards were sometimes signifi- cantly curved, with a central hollow on the copper side — probably due to the different dimensional variations between the differ- ent materials the boards are made of. When the negative is not in perfect con- tact with the photo-sensitive coating, ‘semi-shadow areas’ are formed around the tracks, because of the light rays com- ing from the tubes further away. A quick calculation shows that this area can under- mine the tracks by as much as 2 mm if the space between the negative and the board is just 0.5 mm. Even though the exposure is less than that from the closest actinic tube, it’s enough to severely compromise the final quality. A point source would not have produced this effect, but the UV tubes give off a dif- fuse light, and of course, there is more than one source. Since an epoxy board is quite stiff, the pressure of the plastic foam wasn’t enough to flatten it out. I couldn’t quite see myself ironing my boards to flatten them out, so all that was left for me to do was to make the negative press firmly against the photo-sensitive surface. I had seen a few experiments where the board and negative were in a hermetically- sealed plastic bag and a vacuum was cre- ated in it using a vacuum-cleaner [1] . The idea seemed like a good one, but I didn’t think my wife would appreciate my hijack- ing domestic appliances for experimen- tal use (maybe there were already some unpleasant memories...?), and above all, I felt the degree of suction was excessive — not to mention the power consumption, in these energy-conscious days. So I started out by working on the part that would keep the negative in contact with the photo-resist, thinking that by the time I’d finished this stage, I would have found an idea for replacing the vacuum-cleaner — otherwise I’d have to open diplomatic negotiations! I started off using a zip-up freezer bag, in a way quite similar to that described on the ’Net, until I noticed that an open bag stays sealed closed anyway as soon as the suction brings the two walls tightly together. 6 o 01-2010 elektor WORKSHOP A \ C Figure 3. Everything is in place, but suction hasn’t started yet. Note the adhesive tape (A) and the hot-melt glue or sealant (B). The pocket cam remain unsealed (C) once the board has been inserted. My own system I abstemiously removed just two of the cen- tral ‘pockets’ from a plastic-leaved docu- ment binder that was not full. They come in sizes of 20, 40 leaves etc., but you can prob- ably scrounge one off your kids. As the welding was only ‘dotted’, I made the pockets’ welded seams airtight by folding some adhesive tape over the edges. I cut off one corner of the pocket so as to be able to slip in a length of tubing as used in aquaria ( Eureka , I’ve just found the solution for my vacuum pump! But we’ll see about that later...) and also for our PCB etcher. I used a length of tubing long enough to thread one end out through the hole from inside the pocket, and still keep the other end outside the pocket (even if you have to thread a metre through, you want to avoid creating cut-off pieces that you’ll only have to re-do later). I applied some hot-melt glue at about 1 -2 cm from this end, then threaded it out carefully, to avoid leaving traces of glue on the walls of the pocket, till the ring of glue reached the hole. I doubled up with some more glue on the outside, to make sure it was airtight. It’s still easier doing it this way round — I think I’d have had some trouble trying to use a glue-gun inside the pocket! If like me you use hot-melt glue, be careful: it can give you a nasty burn! I prefer to give you detailed instructions, to save you time and make things more accurate — and to avoid your calling me all the names under the sun! But of course you can use other methods (seal- ant, another type of glue, etc.) The final result is shown in Figure 3. In use, all you have to do is position the board close to the end of the tube, so that the walls of the pocket don’t collapse onto one another between the suction hole and the board, and turn on the suction. If the Figure 4. With suction on, the negatives are held perfectly against the board. There’s no longer any risk of the width of the tracks being reduced by the light diffusing between the negative and the board because it isn’t flat enough. tube opening is in an area where there is not exposure, you’ll need to create an ‘air channel’ from the suction hole to the board using a length of sleeving or 2-3 mm diam- eter wire. In this way, a natural airway is formed around the board, allowing it to take full advantage of the vacuum (see Fig- ure 4). The airway doesn’t necessarily need to be hollow, as the air will pass between this cylinder and the walls of the pocket. Vacuum pump You noticed that the solution came to me when I mentioned the tubing used for aquaria and PCB etching. I thought of the air supply pump, since for it to be able to blow, it inevitably must also suck, QED. Figure 5 shows how a pump currently used to oxygenate the air in an aquarium, or in electronics to agitate the ferric chloride in a PCB etching bath. It can be seen that it per- forms two functions — sucking and blowing — but only the latter is used. The pumps on the market don’t have a suction tube, just a simple opening to the air, usually via a filter underneath the casing. My suggestion is to make use of all the pos- sibilities of this tool, and so, besides using it to agitate the etching fluid, I’m going to call upon it to act as a vacuum pump to improve the graphical quality of my boards. I used an ordinary pump that’s easy to find in any self-respecting electronics shop and, for those hermits who live a long way from this type of shop and don’t want to pay postage (probably as much as the cost of the pump itself), it’s also readily available in pet shops, which are a bit more wide- spread than our own favourite shops. Ide- ally, choose one where the base can be unscrewed rather than one that can’t be taken apart — although the casing can be ‘vandalized’ without affecting the success- Flexible membrane, fitted to vibrating arm Figure 5. Operation of a pump commonly used for aquaria. ful outcome of the project. Take care, the pump is AC powered, so I always make sure I unplug it before working on it! I removed the bottom of the casing, held in place by four screws (anyone unlucky enough to have picked one that doesn’t come apart will just have to get by). Once the bottom has been removed, I ended up with what you can see in Figure 6. You can make out the electromagnet, the arm that vibrates at the mains frequency, and the pump body with the ‘bellows’, consisting of a rubber membrane with its top attached to the vibrating arm. The modification involves the pump body, which you’ll now need to remove from the case. To do this, I detached the ‘bellows’ from the pump body (it just slips on and is held in place by a groove that stops it slipping off with the vibrations), and then I removed the screw that holds the pump body into the case. There’s a rubber gasket between the case and the pump body, it will stay on the inside wall of the case and make it airtight once everything is refit- ted. If there isn’t a gasket, it’s easy enough to make one from a piece of inner-tube or some other material of the same type. You can make out the two opposite parts of the pump body with the exchange sec- tion on the flexible membrane side and the two inlet and outlet chambers on the other side. Figures 7 and 8 respectively show the two sides after the modification (sorry, I didn’t take the time to photograph it beforehand). I used hot-melt glue to block up the original air inlet, which is just an opening adjacent to the junction with the bottom gasket. After it had set, I filed the edge flat to make sure it would be properly airtight. I drilled a hole in the pump body in the wall of the inlet chamber to suit the diameter of elektor 01-2010 61 WORKSHOP Figure 6. The interior of the aquarium pump: electromagnet (A), pump body (B), flexible membrane (C), vibrating arm (D), and flexible pivot (E). the suction nozzle to be ‘grafted on’. This should have an outside diameter of 4 mm so that it is a ‘force fit’ into the plastic tub- ing. If the original air inlet was already a hole, you can re-use it just by correcting its diameter. My graft was cut from a suitably- sized piece of a discarded telescopic aerial. You’ll need to work out the correct length so that you can fit it from the inside of the inlet chamber. This will make future opera- tions easier. I applied some hot-melt glue to this suc- tion nozzle and, using a small pair of pliers, inserted it into the previously-drilled hole, from the inside towards the outside. To make it airtight, I applied some more glue to the outer part of the tube, where it comes out of the pump. It’s easierto get to the outer part than the inner part once the tube is in place, this is why I used the same trick above that I used for the vacuum bag. Then I made a hole in the outer wall of the pump case, threaded through a piece of flex- ible tubing (the same as used for the plastic pocket), and connected this tube up to the newly-created suction nozzle I led it round a circuitous route to reduce the mechanical strain (see Figure 9). After testing and refitting the bottom of the Figure 9. Pump with suction tube fitted. Figure 7. The modified pump body, seen from the membrane side. Outlet pipe (A), blower valve (B), suction valve (C), suction inlet nozzle (D), and original air inlet (E), blocked off using hot-melt glue. case, I connected this suction/blower pump to the vacuum bag using another piece of 4 mm diameter tube (from the same source) and the result is perfect. Summary of materials used Pocket • adhesive tape • i m of plastic tubing for aquarium aerator (you’ll need at least 20 cm, but it’s often sold by the metre only) • 1 plastic document protector • 2-component resin or hot-melt glue and gun. Pump and connections • the remainder of the aquarium tubing (you’ll need about 50 cm to leave you a degree of freedom of movement) • 2 pieces of tubing with an external diameter to suit the internal diameter of the flexible tubing (in theory, 4 mm) • hot-melt glue and gun. I measured the suction with the pump in the working set-up. It came out at 1 20 g / cm 2 . Not a lot, you say! Well, extrapolating Figure 1 0. The exposure unit with the pump in operating position. Figure 8. The modified pump body, seen from the inlet/outlet chamber side. Outlet pipe (A), blower valve (B), suction valve (C), suction inlet nozzle (D), and original air inlet (E), blocked off using hot-melt glue. that to a 1 60 x 1 00 mm ‘Euro’ format board will show us that the negative is pressed against the board with the equivalent of a weight of over 1 9 kg. The other advantage with this system is that the force is evenly distributed. The blower output can still be used, either by removing the suction pipe, or by fit- ting a 3-way valve where the unused func- tion is vented to the open air. I’ll develop that another time, for those who have the opportunity to have a permanent labora- tory set-up. If you have any doubts about whether it’s worth bothering, take a look at my website [2] and the comparisons of results obtained underthe same exposure conditions, where the only variable is the way the negative was held against the board. (081073-I) Internet Links [1 ] www.abcelectronique.com/acquier /Insoleuse.html [2] www.ymasquelier.net Figure 1 1 . Detail of the way the suction tube is led out. 62 01-2010 elektor Take out a free subscription to E-weekly now Do you want to stay up to date with electronics and computer technology? Always looking for useful hints, tips and interesting offers? Subscribe now to E-weekly, the free Elektor Newsletter. Your benefits: * The latest news on electronics in your own mailbox each Friday * Free access to the News Archive on the Elektor website * You’re authorized to post replies and new topics in our forum ^weekly * ■ WJ m ■ I mi LaBaJUi UB | Register today on www.elektor.com/newsletter r ^ ■ ■ ^ Q Add USB to your next project. w O D It's easier than you might think! DLP-USB1232H: USB 2.0 U ART/FIFO HIGH-SPEED 480Mb/s o Multipurpose: 7 interfaces o Royalty-free, robust USB drivers o No in-depth knowledge of USB required o Standard 18-pin DIP interface; 0.6x1 .26-inch footprint DLP-I08-G 8-Channel Data Acquisition Only $ 29 . 95 / 8 I/Os: Digital I/O Analog In Temperature USB Port Powered Single-Byte Commands DLP-IOR4 4-Channel Relay Cable DLP-THIb Temp/Humidity Cable DLP-RFID1 HF RFID Readei/W riter DLP-FPGA USB-to-Xilinx FPGA Module Design www.dlpdesign.com ElektorWheelie Elektor’s DIY self-balancing vehicle Everyone agrees that the internal combustion engine is coming to the end of its life cycle. However, you don’t need to go to the expense of a Prius or Tesla to experience the future of transportation devices. If you would prefer something more personal (and don’t mind turning a few heads), why not build the astonishing ElektorWheelie? First take two electric motors, two rechargeable batteries and two sensors, then add two micro- controllers, and the ElektorWheelie is ready to transport you in style to your destination. Demo video on w ww.elektor.com|wheelie N Elektor h. Characteristics • Two 500 W DC drive motors • Two 1 2 V lead-acid AGM batteries, 9 Ah • Two sixteen-inch wheels with pneumatic tyres • H-bridge PWM motor control up to 25 A • Automatic power off on dismount • Maximum speed approx. 1 1 mph (1 8 km/h) • Range approx. 5 miles (8 km) • Weight approx. 35 kg The kit comprises two 500-watt DC drive motors, two 1 2 -V lead-acid AGM batteries, two 1 6-inch ABS wheels, casing, control lever and assembled and tested control board with sensor board fitted on top. Art.# 090248-71 • $2275.00* • Prices include tax, exclude shipping and handling. Elektor US 4 Park Street Vernon CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: sales@elektor.com Further information and ordering at www.elektor.com/wheelie elektor 1-2010 63 E-BLOCKS & FLOWCODE MIAC for Home Automation The CAN bus at home By Bert van Dam (The Netherlands) The MIAC is a PLC which is easy to use with Flowcode and can be used to design and build an electronic control system. In this article we use three MIACs for the implementation of a simple home automation system with an alarm. A MIAC (Matrix Industrial Automotive Controller) is an industrial programmable logic controller (PLC) that can be used in a wide vari- ety of electronic systems. Internally it has a powerful 1 8F4455 PIC microcontroller which is connected directly to a USB port. As a result it can be easily programmed using either Flowcode, C or assembly. An LCD, push buttons, four relay outputs, four transistor outputs, eight inputs - selectable analog or digital — and a CAN connection complete the system. Because the main purpose for the MIAC is industrial applications, its power supply is 1 2 V instead of the PIC’s more usual 5 V. In this project we design a basic home automation system using three MIACs, where the MIACs are connected to each other via the CAN bus. This makes the home automation system very flexible and easily expandable. Installation To be able to use the MIAC you need to use the latest version of Flowcode V3 (3.6.1 1 .53 or higher) or V4. These versions have the MIAC component integrated so that a whole range of macros are available to control the inputs, LCD and outputs. To use the CAN bus you need to add the CAN bus component. This must be set up with the parameters as shown in Figure 1 . The CAN bus, chip select and the interrupt are not on the same port, even though you just entered that. It actually works because the CAN bus component recognizes that you are using a MIAC and therefore controls the correct ports anyway. Note: you can therefore not use the MIAC CAN bus unless you also include the MIAC compo- nent in your program. A CAN bus system The CAN bus (Controller Area Network) was designed in 1986 by Bosch as a solution to the ever increasing number of wires in cars and the large number of different protocols. CAN is extraordinarily robust and relatively insensitive to noise, so as a consequence it was also quickly adopted by industry. In our system we send messages over the CAN bus. Every message comprises a unique 1 1-bit ID number and a maximum of eight data bytes. CAN operates with ‘broadcast’ messages: messages are not sent to a particular receiver but are just transmitted on the bus. Every device on the bus can therefore receive every message. This makes the system very flexible. If one of the receivers fails or is removed then this does not affect the operation of the bus. On the downside, the sender has no idea whether the message has been received by anyone. A CAN bus is built with a twisted-pair connection. At the beginning and end of the series of CAN bus devices is a termination resistor. For the MIACs this means that all the H and L terminals of all the devices need to be connected together. The termination resistor is built in and can be activated with a wire link from TA to TB (Figure 2). We position the units as follows: Unit 1 which functions as the alarm on/off and TV timer in the master bedroom; Unit 2 which operates the garden lighting and functions as alarm downstairs and near the rear of the house; Unit 3 which functions as the door bell with night mode and alarm on/off (with code lock) downstairs near the front door (Figures 3, 4 and 5). Three different messages are used. Each unit can send one message, see Table 1 . Unit 2, for example, sends a message with ID 20. The contents of this message consists of eight bytes of which only two are used, bytes 0 and 1 . There is, therefore, the option of future expan- sion. For the values of these bytes we use 0, 1 and 2, where 1 and 2 are an actual instruction. Value 0 stands for ‘no action’. In this way Unit 2 can, for example, send a message to display text on the LCD, without mentioning anything about the security of the backyard. In the Flowcode CAN component, buffer 0 is associated with the ID of the CAN message. As a consequence, making and sending a mes- sage comprises only two steps: place the appropriate information in buffer 0 and send the buffer. The message will then automatically be given the correct ID number. 64 01-2010 elektor E-BLOCKS & FLOWCODE In the CAN component we indicate that the received messages must end up in buffer 1 . We therefore only have to look at the contents of buffer 1 . However, we still have to check whether the message has the desired ID. The ID has 11 bits, which unfortunately are rather awkwardly spread across two bytes (see Figure 6). The two bytes are received separately and have to be combined into one integer using the formula: MessagelD = (HighByte * 0x08) + (LowByte / 0x20). The challenges of the CAN bus When programming applications for the MIAC we always have to keep in mind that CAN bus messages can arrive at anytime and that new messages can overwrite older ones. There is, after all, space for only one message in the buffer. We solve this by checking very fre- quently whether there is a message in the buffer. We may also not send messages one after the other too quickly. In this way MIACs can be added and removed and any individual MIACs can have their software changed without having to redesign everything. ‘Checking very frequently’ means that the software checks every 1 0 ms whether there is a CAN bus message. This does, however, cause other problems. No part of the program may delay the wait loop too much. We solve this by using counters. In the source code you will find the Flowcode flow diagrams that make this clear. Example applications The following circuits are intended as examples of the capabilities of the MIAC. It would be too much to explain these circuits in detail, so only the most important aspects are discussed. For further details you can read the source code, which is available as a free download [1] . Alarm circuit This circuit is used to turn the alarm function on and off. Once it is turned on, all units will energise relay Q1 and the corresponding LED turns on. Q1 is intended, for example, to turn on indicator lamps or spe- Figure 1 . CAN bus settings for the CAN bus component. Figure 2. A simple CAN bus network using MIACs. cial sensors. The circuit comprises three parts. On Unit 1 (bedroom) the alarm can be turned on and off with the red and green pushbuttons. The second part of this circuit is in Unit 3 (front door). Turning the alarm on is the same as for Unit 1 , this is, using the green button, but for disarming a four digit code is required. A remarkable feature of this part of the program is that the LCD only shows the number CAN bus I I H L TA TB MIAC unit 1 CN CN csi ^ Si a a a a alarm TV bell set . nT ©AC © CAN bus CAN bus Figure 3. The MIAC in the bedroom (Unit 1 ) has to be connected according to this schematic, ... Figure 4. ... this is how the MIAC nearthe back of the house (Unit 2) needs to be wired up... Figure 5. ... and this connection diagram belongs with the MIAC at the front of the house (Unit 3). elektor 01-2010 65 E-BLOCKS & FLOWCODE of the button that has just been pressed. The num- ber of digits in the correct code and whether enough digits have been entered already or whether too many digits have been entered, is not indicated. This makes it much more difficult for an unauthorized person to find the correct code. The program continually checks the last four digits entered. When these are all correct the alarm is turned off. In addition every units checks whether there is a message from Unit 1 , which indicates that the alarm is turned on. TV timer Finally a project with a long delay loop. When the alarm is off, the yellow and blue pushbuttons of Unit 1 are used to turn the TV on and off. However, when the alarm is on the TV will be turned off after about 20 minutes. This is the only example that can actually trigger the alarm. This uses byte 1 in message ID 20. By look- ing at the source code for Unit 2 (the sender) and Unit 1 (the receiver) you can easily create other situations that can trigger the alarm as well. Night bell This parts runs on Unit 3 and its function is that at night only acquaintances can ring the bell. When the alarm is off, the signal from the bell push button goes via the MIAC to the bell. When the alarm is turned on, this connection is interrupted. The only way to ring the bell is to push the button in a special way: short-short-long- short. When the MIAC recognizes this code it will ring the door bell briefly. Software The software discussed in the article (including the firmware for the alarm with code, the night bell, the garden lighting with alarm and the TV timer) can be download free as source code and HEX files from the Elektor website [1] . The MIAC is available through the Elektor Shop as item # 090278-91 . (090278-I) Garden lighting and alarm This circuit too has a dual function. When the alarm is off, the gar- den lights turn on as soon as it becomes dark at night and turn off when it becomes light again in the morning. However, when the alarm is on, you are either in bed or you are not at home and therefore the garden lights can be turned off. If in this situation the amount of light on the sensor changes suddenly, then this light is from a torch or from a person who blocks the incoming light from, for example, the moon. In both cases this is sufficient reason to trig- ger the alarm. Low byte of CAN ID Figure 6. the CAN bus ID is spread across two bytes. Internet Link [i] www.elektor.com/090278 Table i. Contents of the messages Unit Byte Values Description 1 - ID 10 0 0,1,2 0 = no action 1 = relay Q1 on 2 = relay Q1 off 1-7 spare 2 -ID 20 0 0,1,2 0 = no action 1 = clear LCD 2 = “Hello” on LCD 1 0,1,2 0 = no action 1 = burglar in backyard 2 = no alerts 2-7 spare 3 -ID 30 0 0,1,2 0 = no action 1 = alarm on 2 = alarm off 1-7 spare 66 01-2010 elektor E? B P0 Elektor is now & tomorrow ti a Btfatpiw .-*■ ■ U M H ifS TJtei — Secure a head start in electronics with a subscription! Advantages to subscribers ■(1 l »»— , M hie ,oC “r dooW® W w Cheaper than 1 1 issues from the newsstand: Save 57% off the cover price of $92.45 With every issue subscribers get up to 40% discount on selected Elektor products No lines, traveling, parking fees or ‘sold out’; Elektor is mailed to you every month Always up to date - read your copy before everyone else * Offer available in US and Canada only. Canada add $1 1 per year. www.elektor.com/subs Or use the subscription order form near the end of the magazine. HOME AUTOMATION Dimmer with a Micro For incandescent and halogen lamps up to 300 watts By Coswin Visschers (The Netherlands) Dimmers come in many varieties — you’d think. Still, the author did not find what he wanted. So it was back to the drawing board to design a dimmer circuit with the exact personal requirements. The result is a project that’s easy to add to the existing electrical installation as well as simple to operated using existing light switches. The design is for 230 V, 50 Hz AC power lines and our US and Canadian readers are expressly invited to rework it to 1 10/1 15 VAC, 60 Hz. The idea forthis design came about because the author wanted to replace a double switch with a switch/dimmer combination that wasn’t available of the shelf. The exist- ing double switch was retained and the dimmer circuit described in this article was built into the light fitting in the ceiling. This is now used to control four 50-watt halogen lamps. The circuit is also suitable to allow the lights to be dimmed when connected to a two-way switch circuit (staircase con- figuration), using either switch. The schematic The microcontroller controlled dimmer dims the lights using phase control. It is therefore no surprise that triac TRI1 has to do all the heavy work. But before the triac ‘knows’ when to turn on, a few things have to be measured first. Starting at the beginning: the AC power line voltage (see Figure 1). Coil LI and capaci- tor C2 form a classic dimmer filter which prevents the noise that is generated by the phase control circuit from creating interfer- ence on the AC power lines. Fuse FI is a min- iature fuse rated 1 .6 A (slow blow). Components R1, R2, Cl, B1 and D1 convert the 230 VAC power line voltage into a suitable power supply voltage for IC1 , a 78L05 voltage regulator. To prevent electrical breakdown across the resistors, two 470 £1 resistors are used, instead of a single 1 k Q resistor. By con- necting the two resistors of 470 £2 (R1 and R2) in series the risk of electrical breakdown is much smaller because the voltage dropped across each resistor is halved. 68 01-2010 elektor HOME AUTOMATION The power supply voltage of about 1 6 volts is normally a bit high for a 78L05. However, in order to have a buffer that stores as much charge in C3 and C4 as possible we chose the highest possible voltage. The energy stored in C3 and C4 has to power the microcon- troller during the time required to activate the ‘setting mode’ of the microcontroller. This mode is activated by briefly switching the lamp (and the circuit) off using the AC power switch and then turning it back on again (see further down for the complete operating instructions for the circuit). Space constraints Because the author had to build the cir- cuit board into a housing which was only 2 centimetres high it was decided not to mount Cl and C2 vertically as is the norm, but to fit them horizontally by laying them on their side (see photo). For the same rea- son the buffer of the power supply voltage uses two smaller electrolytic capacitors (C3 and C4) instead of using one big capacitor. If you have more than two centimeters of height available then all this is not really necessary, although there is only very little room for the vertical mounting of Cl and C2 because of LI . A disadvantage of the type of power sup- ply used here is that the microcontroller is directly connected to the potentially lethal AC power line voltage. Detecting the zero- crossing of the AC power line voltage can- not be done using only the low voltage part of the circuit either. A transformer, however, Main Features • Dimmer function using phase angle control • Simple to set (can also be permanently set) • Suitable for two-way switch circuits (staircase circuit) • Very low profile construction (20 mm) • Transformerless would have been too big to fit in the enclo- sure and that is why this type of power sup- ply was chosen. Incidentally, the prototype in the photo uses a coil from DigiKey. To reduce the height requirement it is better if you use the coil from Conrad Electronics, which is also speci- fied in the component list. This is made with a toroid and is considerably lower. Heart of the circuit The core of the circuit is formed by a PIC12F629 microcontroller. A zero-cross- ing detector is built around IC3. At the zero- F1 L1 R1 R2 Cl Figure 1 . From the schematic we can see that the circuit is not electrically isolated from the AC power lines. To prevent a shock hazard when using a metal enclosure it is possible to earth this using K1 and two of the mounting holes that have earth pads. elektor 01-2010 69 HOME AUTOMATION crossing the voltage across the output of IC3 is higher than 2.5 volts for a duration of about 2 ms. D2 and D3 limit the voltage across the LEDs in IC3. Using the voltage pulse from IC3, the microcontroller knows when the AC voltage sine wave passes through zero and therefore when the triac should be turned on to slice a predeter- mined amount— corresponding to the dim- mer position — from the sine wave. Resistor R3 acts as a pull-up. We could have used the internal pull-up resistors that are inside the PIC microcontroller, but to reduce the current consumption these are not acti- vated. That is because the pull-up resistors in the microcontroller cannot be activated individually. By using a single external pull- up resistor the amount of time that the circuit continues to operate can be lon- ger (important when setting the dimmer position). D4 turns on when the setting mode is acti- vated. It is not actually necessary to fit this LED, together with R5. By omitting both D4 and R5 the amount of time that the circuit continues to work without AC power line voltage is extended even further. This is because electrolytic capacitors C3 and C4 are discharged at a slower rate: no charge disappears into D4. Heat R8 and R6 would be quite hot, if they had to deal with the full AC power line voltage. That is why, with the aid of IC4, R7 and R9, current is only allowed to flow through R8 and R6just before the zero-crossing. In this way the exact zero-crossing can still be determined accurately while at the same time the current through R6 and R8 is mini- mized. If there had been enough space in the enclosure to cope with the heat dissipa- tion of R6 and R8 then IC4, R7 and R9 could have been left out (pin 2 of IC2 directly con- nected to the node between R6 and R8). R6 and R8 would however dissipate 0.9 W each, which is below their 1 W rating. But because of the small enclosure they would become so hot as to be a fire hazard. With the help of IC4 this heat generation is kept nicely within limits. After IC2 has detected the first zero-cross- ing, the controller turns the current through R6 to R8 off via IC4 until the next zero cross- ing is nearly reached. Just before the new zero-crossing is expected, the triac in IC4 is turned on again. As a result of this solu- tion resistors R6 and R8 stay nice and cool as already mentioned. R7 ensures that the triac IC4 turns off after the zero-crossing. Finally, IC5 takes care of the interface between the microcontroller and triac TR1 1 . The design for this circuit board does not use a standard TO-220 footprint for TRI1 . The reason for this is the small distance between the pads of a normal footprint. Here, the pads of the legs are 1 .25 mm fur- ther apart, in order to prevent electrical breakdown. Printed circuit board This schematic was used to design a double- sided printed circuit board, the artwork of which can be downloaded from the Elektor website [1] . The construction is not at all dif- ficult; no SMD parts are used. As usual, start by fitting the smallest (lowest) parts such as resistors and diodes followed by the larger (taller) components. When connecting the board, extra atten- tion needs to be paid to the wires connect- ing to K1 . For Cl and C2 use capacitors with an X2 rating, these are safer to use at high voltages. If a metal enclosure is used then this can be earthed with the aid of the two earthed mounting holes in the board. The software The program is divided into three parts. The first part contains the main dimmer pro- gram, the second (middle) part contains the code which is necessary for the setting mode and the last part contains routines for reading and writing of the EEPROM. After turning the AC power on, the registers are reset and the dimmer value is read from the EEPROM. The microcontroller waits for two zero-crossings (step 4) so that it is not affected by any contact bounce of the switch or switches. The steps shown below correspond with the numbers shown in the sine wave of Figure 2 and the routines in the code: 1. Switching the AC power on; the PIC microcontroller starts up. 2. PretestO; the PIC waits for the zero-crossing. 3. Pretestl ; the PIC waits for the zero- crossing to pass, pin 5 is low again. 4. Main; wait for the next zero-crossing or until the AC power is turned off. 5. MainWaitToSwitchTriacOnSetup; Reset the internal timer. 6. MainWaitToSwitchTriacOn; Wait until the timer has reach the desired value to trigger the triac. 70 01-2010 elektor HOME AUTOMATION COMPONENT LIST Resistors R1,R2 = 470niW R3, R13 = 1 5I<£1 R4=10kn R5 = i k a R6,R8 = 15kft1W R7 = 220k£l R9,R1 0 = 820^ R11,R12 = 470n Capacitors Cl ,C2 = 220nF 250V, polypropylene, X2 class C3,C4 = 220pF 35V, radial, lead pitch 3.5mm C5,C6,C7 = lOOnF, ceramic, lead pitch 5mm Semiconductors B1 = W06M, bridge rectifier, 1 .5A, 600Vpiv, (e.g.Farnell# 1621776) D1 = 1 6V 0.5W zener diode D2,D3 = 6.2V 0.5W zener diode D4 = LED, low-current, green, 3mm IC1 = 78L05 (TO-92 case) IC2 = PIC1 2F629A (Microchip), DIL8 case, pro- grammed, Elektor Shop # 090315-41 IC3 = SFFI620A-3 optocoupler (e.g. Farnell # 1469594) IC4JC5 = MOC3022 optocoupler (e.g. Farnell #1021366) TRI1 = BTA08-600BRG, triac, 8A, 600V, TO- 220AB case (e.g. Farnell # 1 057269) Miscellaneous FI = 1 .6 A (slow blow) subminiature, (e.g. DigiKey# 507-1 178-ND) K1 = AK1 1 0/6wp, 6-way terminal block, lead pitch 7.5mm l<2 = 3-pin SIL header lead pitch 2.54mm, with jumper LI = 2.2mFI suppressor coil, (e.g. DigiKey # M8383-ND or Conrad Electronics # 534358-89) 2 pcs DIL6 1C socket PCB # 09031 5-1 , ordering information at [1 ] 7. Triac is triggered, pin 6 of the PIC goes briefly high. 8. MainWaitToSwitchOnZCrossDetect; the zero-crossing detector is activated because pin 2 goes briefly high. The program now jumps back to step 4. 9. Program; the PIC enters setting mode and checks the position of the jumper. Depending on the position of the jumper the PIC either continues or jumps back to step 1. 1 0. ShowProgramMode; the LED lights up and the triac turns on. 1 1 . Based on the previous description you can easily determine the operation of the program while in the setting mode. The reading and writing of the EEPROM is taken directly from the datasheet from Microchip. Operation The microcontroller-driven dimmer can be ‘operated’ in the setting mode. This mode is activated by turning the lamp on and then briefly turning it off and then on again (within 1 second, while the LED is still on). The lamp will initially turn on at full bright- ness for about 1 second and subsequently the brightness is adjusted in steps from 0 to 100%. After 100% is reached the cycle repeats again starting from 0%. As soon as the desired brightness has been reached you need to turn the switch off for more than two seconds (or until the LED turns off) to store this brightness setting. When the switch is turned on again the lamp will turn on at the brightness just selected. With header l<2 the setting mode can be disabled, so that the dimmer will remain at the last brightness set. To do this, connect pin 3 of the microcontroller with the jumper to +5 V. The setting mode is enabled when pin 3 is connected to ground. If you find the on-off-on periods too long then you can reduce the values of C3 and C4 down to 1 00 pF. On the other hand, if the times are too short then C3 and C4 can be replaced with higher capacitance types. (090315-1) Internet Link [1 ] www.elektor.com/09031 5 elektor 01-2010 71 GERARD’S COLUMNS DBA (doing business as) By Gerard Fonte(USA) Starting your own business, or ‘Doing Business As’ (DBA) has a num- ber of benefits for hobbyists which are generally overlooked. Writing a letter on your company letterhead (very easy with today’s ink-jet and laser printers) immediately confers credibility. Bob from Dyno- Dyne is much more likely to betaken seriously than Joe from Idaho. Many hard-copy technical magazines are available free with a busi- ness address ( Electronic Engineering Times , EDN, Electronic Products and lots of others). And once you get on the list they often offer other free journals. Some shipping companies charge slightly less for deliveries to a business address, even if it’s a home business. And one of the best perks is that you can often get free sam- ples directly from the manufacturer. Sometimes they even pay for shipping. What’s in a Name Fundamentally, a DBA is a legal alias. It connects a real person with a company name. This means that the company has the ability set up bank accounts, own property and so forth. Note that this is not a requirement for the company, rather it is permission. You are not required to have separate bank accounts. But if you want to have a check with Dyno-Dyne on it, or deposit checks made out to Dyno- Dyne, the bank will require a ‘business account’ and a copy of your DBA. In most cases, setting up a DBA is very simple. It usually requires a trip to the County Hall to fill out a short form (there may be an age requirement). You choose a name you want and look through their listings to be sure no one else is using that name. There is generally a small processing fee. Then you’re in business! A note on names. The county only cares about local companies and their names. They do not list every company in the state, USA or the world. It is doubtful that they register Microsoft or General Elec- tric. So, unless you like spending quality time with angry corporate lawyers, a quick Google of your name of choice can keep you out of trouble. You next have to decide what position within your company you want to have. Many call themselves owner or president. I prefer a more descriptive title, like Principal Engineer. In that way, people immediately know your job and area of expertise. Additionally, there is the subtle implication that there are more people in the company besides yourself. Obviously, a company that is perceived to be bigger than one person is a plus. Taxman One of the options you have as a business is to be ‘Tax Exempt’. This means that you do not have to pay tax on things you buy for sale to others. Obviously this initially seems very appealing. No tax! Of course, it’s not that simple. If you go tax exempt, you get a tax ID number that you use for your purchases. Naturally, these purchases are recorded and sent to the proper authorities. So if you don’t re- sell these items, you must still pay tax on them. And if you do sell them, you must collect the taxes and pass them on. Worst of all, you have to file tax reports every three months (usually). The govern- ment is very protective of its revenue stream. TANSTAAFL! (“There ain’t no such thing as a free lunch,” Robert Heinlein.) For the hob- byist/entrepreneur, there is no real up-side to being tax-exempt. I have found that the less I am involved with the government, the better off I am. If you have a home business you are allowed to write off a percent- age of household expenses on your yearly income tax. This includes things like house payment/rent, electricity, cable, etc. Again, this initially sounds great. But the fine print is that your business must make money in the long run or else the govern- ment will declare it a ‘hobby’ and disallow the deductions. Business or Pleasure This brings us to an important point. Are you in business as a hobbyist or as a busi- nessperson? It’s fairly obvious that if you want to make money, you will need to set up a real company and do a lot of work. Starting a new business from the ground up is not a project for the faint of heart. You can expect 60 to 80 hour work weeks. And for the first year or so, eating will be a milestone and sleep will be an indulgence. How- ever building something new provides a great satisfaction. Seeing all your effort grow into something substantial is a success that few others will know. You might even get rich! However, a real business isn’t necessary. The trappings of commerce are helpful in themselves. Using company letterhead is like wear- ing a suit and tie. It tends to make you more aware of profession- alism. It certainly makes you look better to others. Learning how companies operate, at any scale, is useful practical knowledge. And even though it takes little time and effort to obtain a DBA, you will become a member of a different group. This makes it likely that you will become more conscious of things related to business. This is also very useful. So setting up a virtual company as ‘practice’ can provide a funda- mental education that you can’t get anywhere else. Furthermore, if you later choose to make it real, you already have the infrastructure in place. This makes the transition easy. Making Money Most small businesses fail within a year. About 80% of these fail- ures are because of poor management. They fail to manage money properly. They fail to market the product well. They fail to put in the needed effort. Basically, it is a failure of understanding business. Only rarely is the failure because of a bad product or idea. So, if you think that some day you will want to have your own company, start now. Get a DBA and learn what business is all about. Give yourself an edge that others won’t have. You don’t actually have to do busi- ness to Do Business As. (090995) 72 12-2009 elektor www.elektor.com/newsletter The latest on electronics for free in your mailbox each Friday! [Sektor INFOTAINMENT Hexadoku Puzzle with an electronics touch And here’s your first puzzle for the new year 2010 . We sincerely hope you’ll enjoy Hexadoku as much as you did last year. Fine prizes are available for which you can qualify by solving the puzzle. Send hexadecimal numbers in the grey boxes to Elektor and you may win an E-blocks Starter Kit Professional or an Elektor Shop vouchers. Have fun! The instructions for this puzzle are straightforward. In the diagram composed of 1 6 x 1 6 boxes, enter numbers such that all hexadeci- mal numbers 0 through F (that’s 0-9 and A-F) occur once only in each row, once in each column and in each of the 4x4 boxes (marked by the thicker black lines). A number of clues are given in the puzzle Solve Hexadoku and win! Correct solutions received from the entire Elektor readership automati- cally enter a prize draw for an E-blocks Starter Kit Professional worth US$425.00 and three Elektor Electronics SHOP Vouchers worth US$55.00. each We believe these prizes should encourage all our readers to participate! and these determine the start situation. All correct entries received for each month’s puzzle go into a draw for a main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. The puzzle is also available as a free download from the Elektor website. Participate! Please send your solution (the numbers in the grey boxes) by email to hexadoku@elektor.com - Subject: hexadoku 01-2010 (please copy exactly). Include with your solution: full name and street address. Alternatively, by fax or post to: Elektor Hexadoku, 4 Park Street, Vernon, CT 06066, USA. Fax 860-871 -0411. The closing date is 1 February 201 0. Prize winners The solution of the November 2009 Hexadoku is: A5F32. The E-blocks Starter Kit Professional goes to: Eduard Kalinowski (Germany). An Elektor SHOP voucher goes to: Tatjana Bulgak (Germany), Rene Niel (France), Olli Hakala (Finland). Congratulations everybody! 9 F D C 1 2 5 E 4 A 0 6 3 7 B 8 6 B 2 1 0 A 4 D 3 C 7 8 5 E 9 F E A 8 4 C 7 3 B 5 1 F 9 0 D 6 2 0 5 7 3 9 8 F 6 2 D B E 4 1 A C 1 0 E 9 4 F 7 3 6 2 5 D C A 8 B 7 8 F A 6 5 E 1 9 B C 3 D 2 4 0 4 6 3 B A C D 2 E 8 1 0 7 5 F 9 2 D C 5 8 0 B 9 A 7 4 F E 3 1 6 D 3 9 E 2 6 8 C B 0 A 4 1 F 7 5 A 2 5 F B 4 9 7 C E 8 1 6 0 D 3 B 4 6 0 D 1 A 5 F 3 2 7 8 9 C E 8 C 1 7 E 3 0 F D 9 6 5 A B 2 4 F 7 0 2 5 E 1 4 8 6 9 A B C 3 D C E 4 8 7 D 2 0 1 F 3 B 9 6 5 A 5 1 B 6 3 9 C A 0 4 D 2 F 8 E 7 3 9 A D F B 6 8 7 5 E C 2 4 0 1 4 E 2 5 B 6 1 5 9 4 A F E 3 6 0 3 1 7 C 9 8 A 8 B F D 2 6 9 4 C F 6 3 E D 5 8 A 2 1 B 8 A C D 7 8 5 A E F C 4 B 9 7 B 4 9 8 0 F 5 0 4 C F 8 E D 3 9 1 8 3 7 E 0 A E F 1 7 D 8 C 0 3 9 6 0 C D 3 2 1 5 8 9 2 A B 7 5 8 4 3 3 E 2 1 5 F 4 B 4 9 0 B 2 (c) PZZL.com Notice: the competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. 74 01-2010 elektor RETRONICS XL Put a Stop to Throwawayism! A visit to Helmut Singer Elektronik By Jan Didden (The Netherlands) and Jan Buiting (Elektor UK & US Editorial) When we talk about vintage radios, amplifiers, transmitters etc, we often forget the test equipment that was necessary to develop and maintain that equipment. Technology advances have changed test equipment into high performance, computer-driven analysis systems, but what happens with the old gear? We asked Helmut Singer, an authority in Europe when it comes to used and refurbished test equipment for electronics pro’s and enthusiasts alike to drool over. After the Second World War massive amounts of military surplus goods and gear came to the market. In a weak economic cli- mate many electronics enthusiasts did not have the money to buy new gear, so this was really a market waiting to be opened up. Roughly a decade later, when the Cold War again prompted large investments in weapon systems and associated equipment, a steady stream of ex-military equipment was established. Companies and institutes too tried to keep up with the latest and greatest and got rid of their test equipment long before it became technically obsolete. After the turn of the century, the decline in military spending and increasing restructur- ing and outsourcing in companies resulted in increasing volumes of ex-government and ex-high-end-company equipment coming on the market. Helmut Singer started his business in the mid 1970’s and has been expanding his Aachen (Germany) warehouse steadily [1] . As the pictures show, anybody interested in test equipment would find himself in Para- dise! Although there is still a sizeable num- ber of quite old, tube-equipped gear, lots of relatively modern, automated oscilloscopes, spectrum analyzers and network analyzers, switch-mode supplies, signal generators and multimeters line the shelves. In a ware- house this size, it is not uncommon to find sections of 20 or more identical high-perfor- mance oscilloscopes from HP or Tektronix side by side. Helmut Singer’s customers span a wide range of interested parties. There are fewer enthusiasts nowadays who buy an old scope to take it apart or modify it, but anyone interested in electronics can now afford and buy very high-performance equipment that wasn’t even available to laboratories 30 years ago. Also, many companies that have a development project that (CEO sez) “runs out of budget” come to Singer Electronic for refurbished test gear for a fraction of the original price. When you are in this trade, you have to add Seriously, you don’t have to get on 164.8500 MHz VHF simplex to talk to Helmut Singer in his warehouse. Equipment from a time when it was bulky and even daily operation required skills and knowledge. Three decades of office automation “junked” and the value now expressed in gold weight. elektor 01-2010 75 RETRONICS XL A whole family of Tektronix oscilloscope plug-in units. Found them (1 ) ... a variety of AVO multimeters. Rare and ultra-vintage, this DC milliammeterfrom The Sensitive Research instrument Corporation (La Rochelle, NY). Last calibration signed October 11,1 960. value to what you sell. Singer has a staff of experienced technicians who test each and every piece and repair or recalibrate it before it reaches the customer. Repair does not just mean replacement of failed parts, but if necessary also replace bits inside hybrid circuits and replace the bond wires (!). In-house curve tracers are used to find replacements for obsolete transis- tors and diodes. Even for proprietary chips it is often possible to find replacements, second sourced or commercial alterna- tives. Many companies have a habit of rebranding ICs with their own ‘xyz/smk- scrn’ part number when in fact it’s just a standard chip. Singer’s technicians have accumulated a lot of experience and they always find a solution! Sometimes they are asked to repair vintage test equipment not because a replacement is not avail- able, but because it is part of a large test suite designed around equipment avail- able at the time. But, as Herr Singer told us, that repair gets more and more difficult because the more recent equipment sim- ply is no longer designed to be repaired but for replacement of modules, and these are often difficult to find or unavailable. Also, with the decline of interest in this equip- ment, it’s getting difficult to find techni- cians that have the expertise and interest to locate and study a schematic diagram of a failed piece of equipment and do fault- finding and repair. Mr. Singer currently has a job opportunity for someone with good fault-finding, repair and calibration skills. So far he’s been unable find a suitable can- didate. One young applicant, a student from the local Technical University, insisted that a faulty linear power supply placed in front of him could be repaired by writing a DLL for it on his laptop PC and then debug- ging the “thing” under Linux using the lat- est simulation software and of course a blog site — totally unaware of the burnt out transformer (and the awful smell). How about service manuals for the equip- ment? Mr. Singer provides manuals or cop- ies with his equipment, helped by the lat- est trend to digitize service manuals. Many companies have produced pdf versions of their manuals, also for older and obsolete equipment, and these are made available for free or a small fee through online out- fits [2>3] . But for newer equipment, designed for repair-by-replacement, component-level manuals are simply no longer produced. Also, after 9/1 1 some technical information that previously was freely available suddenly became classified which makes repair more difficult. There is also tons of equipment that’s beyond economical repair of course, and this is scrapped locally, if possible, or sold to specialized scrapping companies. Some- times equipment is deliberately damaged: in one part of the warehouse we saw a stack of 12 mil-spec HP8640B RF signal genera- tors. These came from a support unit for a decommissioned weapon system. Instruc- tions from UpThere stated that all weapon system components be ‘permanently dis- abled’ before they could be sold as scrap. Checkout with lots of ‘period elements’ carefully preserved strictly without Government funding. The inevitable military radio equipment which has its staunch supporters. Vertical storage to suit shelf space: test equipment spanning roughly 40 years of electronics. 76 01-2010 elektor RETRONICS XL Jan Buiting is always more than comfortable with HP test gear around. Jan Didden has rescued a gem from one of the electronics-allsorts boxes at the shop entrance. Never ask Mr. Singer about the weirdest piece of gear in his shop - this is it, basically! You have to come over to the shop in Aachen; seeing is believing. Somebody must have taken that very lit- erally because all HP8640B’s that arrived at Singer’s had their faceplate smashed by blows with a Mil-Std. #xyz hammer, no doubt about that! Speaking of scrap, Singer took us to a newly acquired industrial yard opposite his shop and showed us huge crates brimful with parts and PCBs (mostly ex-networking) ready for recycling, i.e. recovery of pre- cious metals and valuable minerals. Gold, platinum and palladium of course, but also metals like rhodium, which is used in relays and switches and is recycled into parts for reuse in catalytic converters for cars — full marks to Mr. Singer for saving the environ- ment while preserving our electronics heri- tage. Gold plating in modern equipment is often very thin, wearing from the connec- tors after just a few insertions and extrac- tions. Older (mil-spec) PC boards however have massive gold plating on edge con- nectors and even gold plated solder posts and 1C sockets. Despite the cost of shipping these boards by the containerload halfway around the world, recycling by specialized companies is lucrative. Despite equipment there’s a good dose of engineers’ and electronics humor wait- ing to be discovered in Mr. Singer’s ware- house, some very selective and for the ini- tiated only. One example is an enormous coil selector unit at least 50x50x50 cms in size dangling from the ceiling. It is made from ceramic materials and silver-plated solid tubing at least 1 0 mm thick. It is drily labeled “wave range switch from 1 00 mW QRP transceiver”. If you do not get the joke, you are not RF savvy. Indeed Helmut himself is the kind of person you can rely on to keep you amused for an hour or so but still in a technically informed way while your fam- ily is out shopping and eating ‘printen’ in the Aachen city centre. Most Saturdays are ‘cash & carry’ days at Singer’s — see [1] for opening hours. Today the serious electronics enthusiasts can afford equipment that was state-of-the- art yesterday with almost the same capabili- ties as the latest units, albeit with less auto- mation, which in many cases is nothing to be sad about. Companies strapped for cash in today’s economic downturn can save considerably on test equipment by buy- ing refurbished gear. And Mother Earth will thank you for recycling! [1] http://www.helmut-singer.de/ [2] www.artekmedia.com [3] http://bama.sbc.edu/ (090287-I) Retronics is a monthly column covering vintage electronics including legendary Elektor designs. Contributions, suggestions and reguests are welcomed; please send an email to editor@elektor.com Haifa mile of drawers filled with obsolete and hard to find components. Found them (2) ... a variety of RF wattmeter adjuncts from Bird, the established market leader. New times, new opportunities: thousands of PC cards crated for shipping to a materials recycling company. elektor 01-2010 77 ELEKTOR SHOWCASE To book your showcase space contact Strategic Media Marketing Inc. Tel. 1-978-281-7708 Email ElektorUSA@smmarketing.us HHliEG Instruments A Rohde & Schwarz Company 0 Oscilloscopes 0 Power Supplies 0 Radio Frequency Measuring Instruments 0 Programmable Measuring Instruments Great Value in Test & Measurement www.hameg.com MICROENGINEERING LABS, INC. www.melabs.com PICBASIC PRO™ Compiler for PIC® MCUs Development tools for PIC®microcontrollers, including Software, Device Programmers, Prototyping Boards, Experimenter Boards, Serial Displays, and Books. MICROENGINEERING LABS, INC. www.melabs.com Serial Displays Software and hardware products for embedded development, including BASIC Compilers for PIC® MCUs, Experimenter Boards, Device Programmers, Books, and other resources. mm Robotics & Electronics Electronics Controllers & sensors Cables & batteries Discrete components Jrk 21v3 USB Motor Controller with Feedback, item #1392: $44 item #1059: $49.95 www.pololu.com Motors & servos Robot chassis Tracked Chassis Yellow 7 ill I Sty;;*; I CircuitGear CGR-101 TM is a unique new, low-cost PC-based instrument which provides the features of seven devices in one USB-powered compact box: 2-ch 10-bit 20MS/sec 2MHz oscilloscope, 2-ch spectrum- analyzer, 3MHz 8-bit arbitrary-waveform/standard- function generator with 8 digital I/O lines. It also functions as a Network Analyzer, a Noise Generator and a PWM Output source. What’s more - its open-source software runs with Windows, Linux and Mac OS’s! Only $180 1-888-7SAELIG info@saelig.com www.saelig.com BOARD™ www.schmartboard.com $15 PIC Development Board basic overlay board for NTSC & PAL Automatic text scroll & crawl • TfL-232' & SPI control ports Any size for custom fonts • Vector & bitmap graphics B 1 I Decade Engineering www.decadenet.com PCB PROTOTYPES BYSUNSTONE CIRCUITS® www.sunstone.com Sunstone Circuits is dedicated to improving the PCB prototyping process from quote to delivery (Q2D®) and provides “live” customer support every day of the year (24/7/365). For more information or to quote and order PCBs online, visit www.sunstone.com PCBexpress®, PCB123™, ValueProto™, Sunstone ECOsystem(SM), and Q2D® are trademarked by Sunstone Circuits. AVIT RESEARCH www.avitresearch.co.uk USB has never been so simple... with our USB to Microcontroller Interface cable. Appears just like a serial port to both PC and Microcontroller, for really easy USB connection to your projects, or replacement of existing RS232 interfaces. See our webpage for more details. BLACK ROBOTICS www.blackrobotics.com Robot platforms and brains for research, hobby and education. • Make your robot talk! • TalkBotBrain is open-source • Free robot speech software • Robot humanisation technology • Mandibot Gripper Robot ByVac www.byvac.com • PIC32 With BASIC • ARM With Forth • USB to I2C • Serial Devices • VT100 LCD Displays DECIBIT CO.LTD, www.decibit.com • Development Kit 2.4 GHz • Transceiver nRF24L01 • AVR MCU ATmega168 78 1-2010 elektor products and services directory SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business, Showcase - a permanent feature of the magazine where you will be able to showcase your products and services. • For just $385.00 + VAT ($35.00 per issue for eleven issues) Elektor will publish your company name, website address and a 30-word description • For $550.00 + VAT for the year ($50.00 per issue for eleven issues) we will publish the above plus run a 3cm deep full colour image - e.g. a product shot, a screen shot from your site, a company logo - your choice Places are limited and spaces will go on a strictly first come, first served basis. So-please fax back your order today! I wish to promote my company, please book my space: • Text insertion only for $385.00 + VAT • Text and photo for $550.00 + VAT NAME: ORGANISATION: JOB TITLE: ADDRESS: TEL: PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 1-978-281-7706 COMPANY NAME WEB ADDRESS 30- WORD DESCRIPTION Index of Advertisers Avit Research, Showcase www.avitresearch.co.uk 78 Beta Layout www.pcb-pool.com. 87 Black Robotics, Showcase www.blackrobotics.com 78 ByVac, Showcase www.byvac.com 78 Decade Engineering, Showcase www.decadenet.com 78 Decibit Co. Ltd, Showcase www.decibit.com 78 DLP Design www.dlpdesign.com 63 ExpressPCB www.expresspcb.com . Front Panel Express www.frontpanelexpress.com 47 Flameg Instruments, Showcase www.hameg.com 78 Jameco www.jameco.com/unwrap . 25 Linx Technologies www.linxtechnologies.com 3 Microengineering Labs, Inc., Showcase . . . www.melabs.com 78 MikroElektronika Paia Electronics, Showcase Parallax Pololu Corporation, Showcase Saelig, Showcase Schmartboard, Showcase SparkFun Electronics Sunstone Circuits, Showcase Showcase www.mikroe.com 19 www.paia.com 47, 78 www. parallax, com 23 www.pololu.com 59, 78 www.saelig.com 37, 78 www. schmartboard. com 78 www.sparkfun.com 88 www.sunstone.com 2, 78 78, 79 Advertising space for the issue of 11 February 2010 may be reserved not later than 19 January 2010 with Strategic Media Marketing, Inc. - 2 Main Street - Gloucester, MA 01 930 - USA - Telephone 1 .978.281 .7708 - Fax 1 .978.281 .7706 - e-mail: ElektorUSA@smmarketing.us to whom all correspondence, copy instructions and artwork should be addressed. elektor 1-2010 79 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES Going Strong A world of electronics from a single shop! Circuit design and programming in C# and Visual Basic Complete practical measurement systems using a PC This is a highly-practical guide for Hobbyists, Engineers and Scientists wishing to build measurement and control systems to be used in conjunction with a local or even remote Personal Computer. The book covers both hardware and software aspects of designing typical embedded systems based on personal computers running the Windows operating system. It’s use of modern techniques in detailed, numerous examples has been designed to show clearly how straightforward it can be to create the interfaces between digital and analog electronics, programming and Web-design. Hardware developers will discover how use of latest high-level language constructs overcomes the need for specialist programming skills. Software developers will appreciate how a better understanding of circuits will enable them to optimize related programs, in- cluding drivers. There is no need to buy special equipment or expensive software tools in order to create embedded projects covered in this book C programming Learn by doing C Programming for Embedded Micro- controllers If you would like to learn the C Program- ming language to program microcon- trollers, then this book is for you. No pro- gramming experience is necessary! You’ll start learning to program from the very first chapter with simple programs and slowly build from there. Initially, you program on the PC only, so no need for dedicated hard- ware. This book uses only free or open source software and sample programs and exercises can be downloaded from the Internet. 324 pages • ISBN 978-0-905705-80-4 • $52.50 .NET r— =» ...■ !■■ £ Learn more about C# programming and .NET C# 2008 and .NET programming This book is aimed at Engineers and Scien- tists who want to learn about the .NET en- vironment and C# programming or who have an interest in interfacing hardware to a PC. The book covers the Visual Studio 2008 development environment, the .NET frameworkand C# programming language from data types and program flowto more advanced concepts including object ori- ented programming. 292 pages • ISBN 978-0-905705-79-8* $46.00 240 pages • ISBN 978-0-905705-81-1 • $47.60 8 o Prices and item descriptions subject to change. E. & O.E 01-2010 elektor IMewi Home electric power Your own Eco-Electrical Home Power System This book provides the semi-technical, power-conscious homeowner a place to be- gin in the quest for home electric power. Both the essential principles and detailed information on howto build or maintain a home electric system off the utility grid are presented in an easy-going style. This book- let will help you to safeguard or develop your own home electricity supply. It con- tains step-by-step calculations, practical details, examples, electric system problems with emedies and much more. 96 pages • ISBN 978-0-905705-82-8 • $26.70 Silent alarm, poetry box, night buzzer and more PIC Microcontrollers This hands-on book covers a series of ex- citing and fun projects with PIC micro- controllers. You can built more than 50 projects for your own use. The clear ex- planations, schematics, and pictures of each project on a breadboard make this a fun activity. The technical background information in each project explains why the project is set up the way it is, includ- ing the use of datasheets. Even after you’ve built all the projects it will still be a valuable reference guide to keep next to your PC. 446 pages • ISBN 978-0-905705-70-5 • $45.10 Look into the electronics of eco-power Practical Eco-Electrical Home Power Electronics This book is a sequel to Your own Eco-Elec- trical Home Power System and goes deeper into the electronics of photovoltaic and thermal solar technologies, wind power conversion, inverter circuits, and loads such as electronic lighting. Power electronics circuit theory is presented while analy- zing commercial circuits, including little- known converters and subtleties such as snubbers and leakage inductance. The book also offers in-depth coverage of power sys- tem strategizing for optimal efficiency and utility, including a 1 70 V DC bus, commer- cial solar charger design with detailed circuit explanations, wind generator electric machine electromechanical theory, wind converter design requirements and the series-L zero-current-switching converter and power supplies found inside loads con- nected to home power systems and their potential problems and consequences for inverters. 192 pages • ISBN 978-0-905705-83-5 • $40.20 J T ^ More information on the Elektor Website: www.elektor.com Elektor US 4 Park Street Vernon CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: sales@elektor.com L u 1 1 0 issues, more than 2,1 00 articles DVD Elektor 1 990 through 1999 This DVD-ROM contains the full range of 1 990-1 999 volumes (all 1 1 0 issues) of Elek- tor Electronics magazine (PDF). The more than 2,1 00 separate articles have been clas- sified chronologically by their dates of pub- lication (month/year), but are also listed alphabetically by topic. A comprehensive index enables you to search the entire DVD. The DVD also contains (free of charge) the entire ‘The Elektor Datasheet Collection 1 ...5’ CD-ROM series, with the original full datasheets of semiconductors, memory ICs, microcontrollers, and much more. ISBN 978-0-905705-76-7 • $111.30 See the light on Solid State Lighting DVD LED Toolbox This DVD-ROM contains carefully-sorted comprehensive technical documentation about and around LEDs. For standard mo- dels, and fora selection of LED modules, this Toolbox gathers together data sheets from all the manufacturers, application notes, de- sign guides, white papers and so on. It offers several hundred drivers for powering and controlling LEDs in different configurations, along with ready-to-use modules (power supply units, DMX controllers, dimmers, etc.). In addition to optical systems, light de- tectors, hardware, etc., this DVD also ad- dresses the main shortcoming of power LEDs: heating. Of course, this DVD contains several Elektor articles (more than 1 00) on the subject of LEDs. ISBN 978-90-5381-245-7 • $46.00 elektor 01-2010 81 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES Embedded USB Know How USB Toolbox This CD-ROM contains all the essential infor- mation a designer needs to start working with the USB interface. It includes a large collection of data sheets for specific USB components from a wide range of manufac- turers. USB Toolbox provides information on all ICs suitable for different applications. A subdivision has been made in controllers, hubs, microcontrollers and others. What is perhaps more interesting for many design- ers however, is the extremely extensive soft- ware collection which contains drivers, tools and components for Windows, Delphi and various microcontrollerfamilies. Of course, none of the Elektor articles on the subject of USB are missing on this CD-ROM. ISBN 978-90-5381-212-9 • $32.10 Completely updated Elektor’s Components Database 5 The program package consists of eight data- banks covering ICs, germanium and silicon transistors, FETs, diodes, thyristors, triacs and optocouplers. A further eleven applica- tions cover the calculation of, for example, LED series droppers, zener diode series resistors, voltage regulators and AMVs. A colour band decoder is included for deter- mining resistor and inductor values. ECD 5 gives instant access to data on more than 69,000 components. All databank applica- tions are fully interactive, allowing the user to add, edit and complete component data. This CD-ROM is a must-have for all electro- nics enthusiasts. ISBN 978-90-5381-159-7 • $40.20 Preselector for Elektor SDR Elektor’s Software Defined Radio (SDR) is deservedly popular. The performance of a receiver depends to a large extent on its input filters. A selective input circuit im- proves antenna matching and immunity to interference from other strong signals. This preselector allows the use of up to four filters, tuned under software control using varicap diodes. A tuned loop antenna is also described that lets you use our SDR withoutanoutdoorantenna. Kit of parts, contains portly populated board , coil formers , ferrite rod with coils Art.# 09061 5-71 • $75.90 R32CWeb Server The R32C microcontroller goes Internet! Asmall add-on module for the application board from our September 2009 issue combines a TCP/IP chip plus Ethernet inter- face, a network connection with built-in transformer and status LEDs. This handy combination makes it child’s play to imple- ment a web server and many other Internet applications without getting involved in complexities such as TCP/IP protocols. Free downloads of an Open Source driver, a short web server program and other sample software complete this attractive proposition. PCB, populated and tested WIZ8 1 2MJ module with W5 1 00 chip Art.# 090607-91 • $29.10 OBD2 Analyser NG The compact OBD2 Analyzer in the June 2007 issue was an enormous success — not surprising for an affordable handheld on- board diagnostics device with automatic protocol recognition and error codes explained in plain language. Now enhan- ced with a graphical display, Cortex M3 processor and an Open Source user inter- face, the next generation of Elektor’s stan- dalone analyser sets new standards for a DIY OBD2 project. The key advantage of the OBD2 Analyser NG is that it’s self- contained and can plug into any OBD diag- nostic port. Kit of parts including DXM Module , PCB SMD-prefitted , case , mounting materials and cable Art.# 090451 -71 • $135.50 Bestseller 1 . LIU • ; bfcj ■'ll . R32C Application Board This R32C Application Board sports pushbu- ttons, LEDs, an I2C interface, an OLED panel, an SD card interface and a socket for an Ether- net module. There is plenty of space on the board for further expansion. Kit of parts inch application board with SMD parts prefitted , plus all other components Art.# 080082-710 • $200.90 82 Prices and item descriptions subject to change. E. & O.E 01-2010 elektor \ January 2010(No. 13) $ + + + Product Shortlist January: See www.elektor.com + + + December 2009 (No. 1 2) Preselector for Elektor SDR 09061 5-71 ...Kit of parts, contains partly populated board, coil formers, ferrite rod with coils 75.90 Top-of-the-Bill Lights Sequencer 090125-1 PCB, bare (master module) 1 7.50 090125-2 PCB, bare (lamp module) 3.80 090125-41 ...Controller (PIC1 8F2550) for main PCB, programmed 23.40 090125-42 ...Controller (PIC1 2F508-I/SN) for lamp unit, programmed 3.80 The Vikings Are Coming! 080948-71 ...Kit of parts: bare PCB and bluetooth module BTM222 38.30 MinimalisticTime Switch 090823-41 ...PIC1 2F683-I/SN, programmed 1 0.50 November 2009 (No. 1 1 ) Solder Station ‘Plus’ 090022-41 ...PIC18F4520, programmed 18.60 AVR-Max Chess Computer 081101 -1 ....Printed circuit board 20.90 081101-41 ...Programmed controller ATmega88 18.60 081101-71 ...Kit of partsincl. PCB, programmed controller and components 48.30 R32C Web Server 080082-71 ...Application Board with SMD parts prefitted, plus all other components 200.90 080928-91 ...R32C Starter Kit: processor board populated and tested, Toolchain on CD 43.60 090607-91 ...PCB, populated and tested WIZ81 2MJ module with W51 00 chip 29.1 0 October 2009 (No. 1 0) Pocket Preamp 080278-71 ...Kit of parts 104.90 Digital Barometric Altimeter 080444-41 ...PIC18F2423, programmed 24.20 September 2009 (No. 9) R32C Application Board 080082-71 ...Kit of parts Application Board with SMD parts prefitted, plus all other components 200.90 080928-91 ...R32C Starterkit: Processor board populated and tested, Toolchain on CD 43.60 OBD Analyser NG 090451-71 ...Kit of parts including DXM Module, PCBSMD-prefitted, case, mounting materials and cable 1 35.50 Battery Monitor 030451-72 ...LC display 17.80 080824-1 Printed circuit board 20.90 080824-41 ...Programmed controller LPC21 03 26.70 July/August 2009 (No. 7/8) Luxeon Logic 081159-41 ...Programmed controller ATtiny25 10.40 Programmable Nokia RTTTL Player 090243-41 ...Programmed Attinyl 3 1 0.40 Breadboard/Perfboard Combo 080937-1 Printed circuit board 41 .20 Annoy-a-Tron 090084-41 ...Programmed controller ATtinyl 3 10.40 Fan Speed Controller 070579-41 ...Programmed controller ATtinyl 3 12.50 V J Elektor Personal Organizer 201 0 ISBN 978-90-5381 -247-1 $40.20 Your own Eco-Electrical Home Power System ISBN 978-0-905705-82-8 $26.70 C#2008 and .NET programming ISBN 978-0-905705-81 -1 $47.60 310 Circuits ISBN 978-0-905705-78-1 $48.30 DVD LED Toolbox ISBN 978-90-5381 -245-7 $46.00 DVD Elektor 1990 through 1999 ISBN 978-0-905705-76-7 $1 1 1 .30 USB Toolbox ISBN 978-90-5381 -21 2-9 $32.10 ecd 5 ISBN 978-90-5381 -159-7 $40.20 Home Automation ISBN 978-90-5381 -195-5 $22.50 R32C Application Board Art. # 080082-71 $200.90 R32C/III Starterkit Art. #080928-91 $43.60 OBD2 Analyser NG Art. #090451 -71 $135.50 R32C Webserver Art. #080082-71 $29.10 Software Defined Radio Art. # 070039-91 $ 1 39.60 Order quickly and securely through www.elektor.com/shop or use the Order Form near the end of the magazine! Elektor US 4 Park Street Vernon CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: sales@elektor.com elektor 01-2010 83 COMING ATTRACTIONS NEXT MONTH IN ELEKTOR Portable 2.4 GHz WiFi Scanner Lots of consumer electronics gear employs the 2.4 GHz ISM band, like WiFi LAN, Bluetooth and cordless peripherals for the computer. Unfortunately, noise sources like microwave ovens work on adjacent frequencies. Our portable 2.4-GHz RF scanner allows you to view frequency occupancy in your area. An ATMega microcontroller scours the entire 2.4-GFIz band and displays activity on a graphic LCD. Battery Check Every battery pack is only as strong as the weakest link, which translates into the worst cell inside. No exceptions and no matter if you’re dealing with an RC model battery pack or one for flash photography. Our intelligent battery tester allows the capacity of individual cells to be measured to identify the ones best suited to building a pack. The circuit not only measures capacity, but also internal resistance to enable cells to be matched accurately. Mini Public Address For lecturing or addressing a small gathering it’s often useful to have some electronic amplification available on the spot, if only to prevent a sore throat. For the recently held ElektorLive! event our lab designed a compact portable public address (PA) box for use by those doing demos, workshops and lectures. The box has a built-in feedback suppressor, a digital power stage and a loudspeaker. The unit is battery powered and weighs less than 1,000 grams. Very handy to stretch your voice by a few yards! Article titles and magazine contents subject to change, please check ‘Magazine’ on www.elektor.com The February 2010 issue ofElektor USA is published on Thursday, January 14, 2010. Elektor is available on subscription or from selected Borders and Barnes & Noble bookshops in the USA and Canada. ilektor.com www.elektor.com www.elektor.com www.elektor.com www.elektor.com www.i Elektor on the web All magazine articles back to volume 2000 (UK edition) are available online in pdf format. The article summary and parts list (if applica- ble) can be instantly viewed to help you positively identify an article. Article related items are also shown, including software downloads, circuit boards, programmed ICs and corrections and updates if applicable. Complete magazine issues may also be downloaded. In the Elektor Shop you’ll find all other products sold by the publishers, like CD-ROMs, kits and books. A powerful search function allows you to search for items and references across the entire website. Glektor fcSjJ^SCRIBEjfo eivfcfc Ha*** Wtwi 'j-J 1 5*tDp 5.temt!E non FDrvn*lMiK£ Str/K* Also on the Elektor website: • Electronics news and Elektor announcements ■ ■ i" ; FECIAL CHRISTMAST OFFER V ilcnct 4 fcU'hre npc’ifeii iyi:i win 1 an pc LAME* fue vnlcd'cii min ,ci me iron rrtur Mrut Spec '* 1 !>-■§* Etaktar aroducu Icr «ci ...» JimiT 1- e-Mh4 efttaKI Ini 41 rony Readers Forum PCB, software and e-magazine downloads Surveys and polls FAQ, Author Guidelines and Contact ► Pwl+ h C&.'ev&hdrM- h it-'j a HMlW* hL'HMni t Kii I ti-'K’n hMlpc-Vtt ► CHtlv C'«W| ( «kiaril<;A hnnw K4» [IfiUl't PfCfiTlbf r Ieiub iAn b# ^■ J ikij>drd> 3> a per 1 P.cducfci ro-j |uui ffiQ.D-3 Predion M r hboul ftpn ■ Csva^n 1# ic f 97.DQ * CHlpr Un£#d M wpdfUi eu*k: t"ltr S4L' t-mi-1 asd'411 PCD- prn-1"Til-y pnf 2 In & day* Are you an Elektor subscriber? Then send us your email address (and subscription number) and secure a subscription to Elektor Weekly, the free online newsletter published by the makers of Elektor magazine, sales@elektor.com 84 01-2010 elektor Description Price each Qty. Total Order Code PIC Cookbook for Virtual Instrumentation Complete practical measurement systems using a PC CS 321 e ms ESS 3 $ 46.00 $ 46.00 Practical Eco-Electrical Home Power Electronics $ 40.20 Your own Eco-Electrical Home Power System $ 26.70 Elektor Personal Organizer 201 0 $ 40.20 Prices and item descriptions subject to change. The publishers reserve the right to change prices without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Sub-total Shipping & Handling $ 20.00 (Airmail from Europe) Total paid METHOD OF PAYMENT Remit in US $ drawn on a US bank. Please see next page for ordering information. | Check or Money Order □ Mastercard Q VISA □ Discover | American Express Expiry date: Verification code: Send order form to: Elektor US 4 Park Street Vernon CT 06066 Name/Company USA Street & No. City/State/Zip Country E-mail * Offer available in US & Canada only. Canada please add $11.00 per year for postage. Name/Company Street & No. Date Signature Yes, I want to subscribe to Elektor US for 1 year I would like: | Standard Subscription for $39.95 (1 1 issues) Plus Subscription for $54.95 (1 1 issues plus the Elektor Volume 2009 DVD-ROM) As a special limited period offer I also receive the Volume 2008 on DVD-ROM. Free of charge! City/State/Zip Tel EL01 Date Country E-mail Signature Phone: 860-875-2199 Fax: 860-871-0411 E-mail: sales@elektor.com www.elektor.com METHOD OF PAYMENT Remit in US $ drawn on a US bank. Please see next page for ordering information. | Check or Money Order □ Mastercard □ VISA □ Discover American Express Expiry date: Verification code: Send order form to: Elektor US 4 Park Street Vernon CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: sales@elektor.com www.elektor.com ORDERING INFORMATION To order contact customer service: Phone: 860-875-2199 Fax: 860-871-0411 Mail: ElektorUS 4 Park Street Vernon CT 06066 USA E-mail: sales@elektor.com On-line at www.elektor.com Customer service hours: 8:00 AM-4:30 PM Monday-Thursday. Voice mail available at other times. When leaving a message please be sure to leave a daytime telephone number where we can return your call. PLEASE NOTE : While we strive to provide the best possible information in this issue, pricing and availability are subject to change without notice. To find out about current pricing and stock, please call or email customer service. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in the magazine. If difficulties in obtaining components are suspected, a source will normally be identified in the article. Please note, however, that the source(s) given is (are) not exclusive. PAYMENT Orders must be prepaid. We accept checks or money orders (in US $ drawn on a US bank only), VISA, Mastercard, Discover, and American Express credit cards. We do not accept C.O.D. orders. We also accept wire transfers. Add $20 to cover fees charged for these transfers. TERMS OF BUSINESS Shipping Note: All orders will be shipped from Europe. Please allow 3-4 weeks for delivery. Shipping and handling via airmail: US $20.00 per order. Returns Damaged or miss-shipped goods may be returned for replacement or refund. All returns must have an RA #. Call or email customer service to receive an RA# before returning the merchandise and be sure to put the RA# on the outside of the package. Please save shipping materials for possible carrier inspection. Requests for RA# must be received 30 days from invoice. Patents Patent protection may exist with respect to circuits, devices, components, and items described in our books and magazines. Elektor accepts no responsibility or liability for failing to identify such patent or other protection. Copyright All drawing, photo- graphs, articles, printed circuit boards, programmed integrated circuits, diskettes, and software carriers published in our books and magazines (other than in third-party advertisements) are copyrighted and may not be reproduced (or stored in any sort of retrieval system) without written permission from Elektor. Notwithstanding, printed circuit boards may be produced for private and personal use without prior permission. Limitation of liability Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in connection with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser any money paid with respect to the goods. SUBSCRIPTIONS (US & CANADA ONLY) Subscription rates (1 Yr.) Standard Subscription: $39.95 Plus Subscription: $54.95 Canada add $11 per year for postage All subscriptions begin with the current issue. Expect 3-4 weeks for receipt of the first issue. Subscriptions, renewals, and change of address should be sent to: Elektor US 4 Park Street Vernon CT 06066 USA E-mail: sales@elektor.com Order subscriptions on-line at www.elektor.com/subs Subscriptions may be paid for by check or money order (in US $ drawn on a US bank only). We accept Mastercard, VISA, Discover and American Express credit cards. For gift subscriptions, please include gift recipient’s name and address as well as your own, with remittance. A gift card will be sent on request. Subscriptions may be cancelled at any time for a refund of all unmailed issues. Does your subscription expire soon? Renew it online at www.elektor.com/renew Low Cost - PCS Prototypes High Quality • Full DRC included Lead-times from 8hrs 1mm Prototyping service Chemical Tin finish no extra cost Em oil. soles^pcb-pooLcom Toll Free USA: 1877 390851 www, pcb ■ pool, co m i}HV I V .DHL-: Beta LAYOUT Simply send your files & order ONUME Let your geek shine Meet Steven Kennedy, SparkFun customer and high school teacher. In one of his classes, Steven helps his students discover the world of physical computing by encouraging them to explore all the facets of engineering - whether it is electrical mechanical, or aeronautical. Using SparkFun products, Steven’s class has created projects ranging from a homemade pick-and-place machine to a robotic arm. Whether you’re looking for tutorials to get started in electronics, or a way to inspire your students, the tools are out there. Create an environment of invention, and let your geek shine too. Sharing Ingenuity WWW. SPAR KFUN.COM ©2010 SparkFun Electronics, Inc. All rights reserved. All other trademarks contained herein are the property of their respective owners. For more information about Steven’s class and projects, please visit www.youtube.com/user/OPHSTech or www.opschools.org. ■j J 1 * W u v J I