www.elektor.com Cardiac o onitor ralXlelUDel p . M From known andunknown sources More solar powered circuits January 2011 AUS$ 14.50 - NZ$17.50 - SAR 102.95 £4.80 + Energy Saving Tips 9 77 D268 45 1 66 Integrate Touch Sensing Quickly and Easily With Microchip's Range of Low Power, Low Cost Solutions Microchip Microchip's mTouch™ Sensing Solutions allow designers to integrate touch sensing with application code in a single microcontroller, reducing total system cost. Microchip offers a broad portfolio of low power, low cost & flexible solutions for keys/sliders and touch screen controllers. Get to market faster using our easy GUI-based tools, free source code and low-cost development tools. GET STARTED IN 3 EASY STEPS - Learn moreatwww.microchip.com/mtouch - Download App Notes & royalty-free source code - Order a development tool Capacitive Touch Keys and Sliders • Extend battery life with extreme Low Power MCUs - Proximity sensing in less than 1 pA • High noise immunity and low emissions • Broad portfolio of MCUs lowers system cost - 8, 16 & 32-bit PIC® MCUs for Capacitive Touch - Integrated USB, Graphics, LCD, IrDA, CAN - No external components • With Metal Over Cap technology you can: - Use polished or brushed metal surfaces including stainless steel and aluminium - Sense through gloves - Create waterproof designs - Deploy Braille-friendly interfaces Touch Screen Controllers • Fully processed touch coordinates • Projected Capacitive technology - Multi-touch enabling gestures - Low cost MCU implementation - Wide operating voltage: 1.8-5.5V - Low operating current 1.5 mA at 5V typical • Analog Resistive technology - Lowest system cost, easy integration - Universal 4, 5 & 8-wire solution with on-chip calibration - I 2 C™, SPI, UART or USB interfaces - Low power "touch to wake-up" feature Analog Resistive Touch Screen Development Kit - DV102011 Intelligent Electronics start with Microchip microchip DanECT WWW.microchipclirect.com www.microchip.com/mtouch & Microchip The Microchip name and logo, the Microchip logo and PIC are registered trademarks and mTouch is a trademark of Microchip Technology Incorporated in the U.S.A. and other countries. All other trademarks mentioned herein are property of their respective companies. © 2010, MicrochipTechnology Incorporated, All Rights Reserved. ME259BEng/08.10 Microcontrollers Digital Signal Analog Memory Controllers 5aOB "0o„6oa^ - ^ on boartf .^HaMS PIC 32 compilers coming In FEBRUARY! p, C32Mjf7 p 'C 32MX460FS12 l on board °n board TFT 320 X 240 *FT32OX2d0 iFTsaoKSiO MRFfJ* 0 MA IlfiStE module TOUCHSCHESN support eg 3 1 , \_pb5 w- ^ - " — Jp L j •. ITTt^MRr^ 1 Ptt?*" r* ■ ■•] - if -CtCi ItRiH ill ,11 3pPC __ . u wu MikroElektronika A J DEVELOPMENTTOOLS ! COMPILERS I BOOKS (S'V-, hHA ■Si ;V v pi GET IT NOW « 1 www.mKroe.com www.visLaltft.com An energetic edition If I may offer something to ponder or muse over during the winter holiday period, try “how much energy is wasted trying to devise and publish ways to save energy, or get it from sustainable sources and/or free sources”. I’m sure this conun- drum will keep you busy, amused, frus- trated, curious, excited or even hyperac- tive for quite a few days. Let’s hope it does not cause anxiety; if so, “there’s solace in the pages to follow”. Whatever direction yourthinking, pencilling, calculating and head scratching veers off, it’s a comforting thought that you are not alone. When in doubt, write to the editor. In this edition, in line with our cel- ebrated 2011 Publishing Plan (it’s on our website!), we have a focus on all-things- energy — to which I should add ‘ener- getic’. In this edition we cover green energy, energy harvesting (page 14), tips to save energy (page 34, some for a good laugh too), and best of all, free energy (page 52). A lot of energy also went into producing the other articles in this edition, which should present a nice mix of traditional electronics, microcontrollers and design ideas. The Nixie Tube Thermometer on page 24 bridges 50 years in a single project, happily marrying a 21st century microcontroller and associated program- ming techniques with tube technology from the 1950s. The result is a project that’s sure to draw attention when placed on your desk or mantelpiece. Although I do not recommend bypassing your local physician if you’re curious to know your heart condition or other ail- ments, why not draw your personal elec- trocardiogram (ECG) with our Zigbee’d cardiac monitor (page 56) and send him your personal ECG graphs by email. If you suspect you’re too FAT — go to page 18. Myopic in the dark? — page 62. In closing I congratulate my colleagues in Elektor’s Dutch department on the 50th Anniversary of their edition. Believe it or not, ‘Elektuur’ as it was called at the time started out in 1961 and was the mother of all international versions of the magazine, including this the English one born 14 years later. No ‘Double Dutch’ mockery but a laurel on the front cover of all Elektor editions. Goed gedaan jochiesl Jan Buiting, Editor 6 Colophon Who’s who at Elektor magazine. 8 The PCB Prototyper Spreads its Wings 9 News & New Products A monthly roundup of all the latest in electronics land. 12 mbed Has Landed! Simon Ford’s monthly column on the Elektor/NXP mbed challenge 14 Economical Energy Harvesting Presenting several designs that enable circuits to be powered from solar energy. 18 Thin FAT An overview of open source FAT file system libraries for embedded applications. 24 Nixie Tube Thermometer This is what you get from combining a modern microcontroller with a truly classic display. 28 Flight Data Recorder A speed and velocity recorder for model airplanes, based on our ATM18 microcontroller module. 34 Energy Saving Tips Seventeen ways, some tongue in cheek, to reduce your energy bill and decrease your personal carbon footprint. 38 All-Soft-555 Two new software utilities allow an ATtiny microcontroller to act like the celebrated 555 timer, with a few features added! 43 E-Labs Inside: Under Scrutiny: TheXmega Board A look at Mikroelektronika’s latest development system for the Xmega processor. 44 E-Labs Inside: Spotted at Electronica 2010 Some remarkable products seen last November at the world’s leading exhibition on state of the art electronics. 4 12-2010 elektor CONTENTS Volume 37 January 2011 no. 409 24 Nixie Tube Thermometer Nixie tubes have a special charm all of their own. The author’s Sputnik-style digital clock using the tubes appeared earlier in Elektor, and many variations on the theme have appeared on the Internet. This digital thermometer, which uses just two tubes, is, well, a little bit different. 48 Low-cost Headphone Amplifier There have of course been numerous designs for headphone amplifiers before this one, either more or less successful and simpler or more elaborate. The de- sign presented in this article is straightforward, sounds guite good and can be built using well-established components. J23 52 Free Energy Pursuits to make devices move perpetually or to generate energy from nothing still occupy the attention of many people. Is it truly possible to generate free energy, or are we simply deceiving ourselves and others? Here we describe a selection of interesting ideas and projects. J V J v 56 Wireless ECC Many devices are available for recording or visualising electrocardiogram (ECG) signals. The circuit proposed here uses a wireless link as an elegant solution to the problem of galvanic isolation, completely eliminating any hazard to the subject. 45 E-Labs Inside: Here Comes the Bus! We call on our readers to assist with the development of the Elektor Bus. 48 Low-cost Headphone Amplifier Guess what, it’s straightforward, sounds good and consists of dead standard parts only. 52 Free Energy Is it truly possible to generate free energy, or are we deceiving ourselves and others? 56 Wireless ECG In this project Zigbee modules are used to build a system for wireless monitoring of cardiac signals. 62 Groping in the Dark Here we try to find out if a webcam is any good for converting into a night vision camera. 64 Design Tips: Opamp versus Comparator These devices look very similar with their + and - labels at certain pins, but .... 66 Support Board for Arduino Nano In this article, we’re proposing a motherboard that was originally designed for a robotics application, but which can very well be used for other jobs too. 68 Three out of Two Ain’t Bad Adding a tacho signal to a two-wire fan as used in PCs. 72 Notch Filters for Intermediate Fre- quencies Two simple filters, one RC and one LC, for suppressing noise in communication receivers. 75 Hexadoku Our monthly puzzle with an electronics touch. 76 Retronics: Tandberg Model 5 & Stereo Record Amplifier (ca. 1959) Regular feature on electronics ‘odd & ancient’. Series Editor: Jan Buiting 84 Coming Attractions Next month in Elektor magazine. elektor 12-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. Analogue and digital; practical and theoretical; software and hardware. w m mm > m ANALOGUE • DIGITAL MICROCONTROLLERS & EMBEDDED^ AUDIO • TEST & MEASUREMENT^ * nt tt r Volume 37, Number 409, January 2011 ISSN 1757-0875 Elektor aims at inspiring people to master electronics at any personal level by presenting construction projects and spotting developments in electronics and information technology. Publishers: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+ 44 ) 208 261 4509, fax: (+44) 208 261 4447 www.elektor.com The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor is published 11 times a year with a double issue for July & August. Elektor is also published in French, Spanish, American English, German and Dutch. Together with franchised editions the magazine is on circulation in more than 50 countries. International Editor: Wisse Hettinga (w.hettinga@elektor.nl) Editor: Jan Buiting (editor@elektor.com) International editorial staff Harry Baggen, Thijs Beckers, Eduardo Corral, Ernst Krempelsauer, Jens Nickel, Clemens Valens. Design staff Christian Vossen (Head), Ton Ciesberts, Luc Lemmens.Jan Visser. Editorial secretariat: Hedwig Hennekens (secretariaat@elektor.nl) Graphic design / DTP: Ciel Dols, Mart Schroijen Managing Director / Publisher: Paul Snakkers Marketing: Carlo van Nistelrooy Subscriptions: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 Internet: www.elektor.com/subs 6 01-2011 elektor Elektor PCB Prototyper W^ > A professional PCB router with optional extensions! This compact, professional PCB router can produce complete PCBs quickly and very accurately. This makes the PCB Prototyper an ideal tool for independent developers, electronics labs and educational institutions that need to produce prototype circuits quickly. The PCB Prototyper puts an end to waiting for boards from a PCB fabricator - you can make your own PCB the same day and get on with the job. In addition, the PCB Proto- typer is able to do much more than just making PCBs. A variety of extension options are available for other tasks, and a range of accessories is already available. Specifications • Dimensions: 440 x 350 x 350 mm (WxDxH) • Workspace: 220x1 50x40 mm (XxYxZ) • Weight: approx. 35 kg (78 lbs) • Supply voltage: 1 1 0-240 VAC, 50/60 Hz • Integrated high-speed spindle motor; maximum 40,000 rpm (adjustable) • Integrated dust extraction (vacuum system not included) • USB port for connection to PC • Includes user-friendly Windows-based software with integrated PCB software module Ordering The complete machine (including software) is priced at € 3,500 / £3,1 00 / US $4,900 plus VAT. The shipping charges for UK delivery are £70. Customers in other countries, please enquire at sales@elektor.com. Further information and ordering at www.elektor.comlpcbprototyper Email: subscriptions@elektor.com Rates and terms are given on the Subscription Order Form. Head Office: Elektor International Media b.v. P.O.Box ii NL-6114-ZC Susteren The Netherlands Telephone: (+31) 46 4389444, Fax: (+31) 46 4370161 Distribution: Seymour, 2 East Poultry Street, London ECiA, England Telephone:+44 207 429 4073 UK Advertising: Huson International Media, Cambridge House, Cogmore Lane, Chertsey, Surrey KT16 9AP, England. Telephone: +44 1932 564999, Fax: +44 1932 564998 Email: r.elgar@husonmedia.com Internet: www.husonmedia.com 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 transmit- ted in any form or by any means, including photocopying, scan- ning an recording, in whole or in part without prior written per- mission 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 guaran- tee to return any material submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2010 Printed in the Netherlands elektor 01-2011 7 ELEKTOR PCB PROTOTYPER The PCB Prototyper Spreads Its Wings By Harry Baggen (Elektor Netherlands Editorial) Last month we published the first article on the new PCB Proto- typer, a general-purpose PCB router whose relatively low price compared to similar machines makes it suitable for users outside the normal target group of schools and companies. Visitors to the recent Elektor Live! event had an opportunity to see a prototype of the machine and several PCBs produced by the machine. They were all impressed by the quality of the routed PCBs, and more than few hobbyists are probably already thinking about other ways to use the machine for their own purposes (and how to explain this to their spouse). The PCB Prototyper is more than just a PCB router. As mentioned in the previous article, it is designed to be easily adapted to other tasks. This is reflected in the modular architecture of the mechani- cal construction and the software. Our first article prompted a variety of responses from readers who saw a lot of potential applications in addition to those originally envisaged by Colinbus and Elektor. However, some of these appli- cations ran into problems due to the dimensions of the machine. This had more to do with the space available under the Plexiglas cover than with the size of the working area. As we explained last month, the aim is to develop a machine that can do much more than just produce high-quality routed PCBs. Users must be able to adapt the machine and the software as desired in order to achieve what is effectively a machine tailored to their specific needs. To avoid unduly restricting the scope of future extensions, the enclosure has been modified to be somewhat larger than originally planned. The new outside dimensions are now 455 x 385 x 360 mm (1 8 x 1 5.2 x 1 4.2 inch) (B x D x H). Along with the enlarged enclosure, the Y axis has been extended slightly. This does not relate to the area avail- able for PCB routing or the size of the work table, but instead to the space that may be occupied by future accessories. For instance, a camera mounted on the multifunctional head must be able to view the area acces- sible to the multifunctional head itself (in other words, the working area of the engraving module). Originally this was only possible with a very small camera, but now the PCB Prototyper can also be used with larger cameras, such as those used for scientific pur- poses. Now there is also more room for fitting a laser or a scanner. Thanks to input from our readers, the PCB Prototyper is now ready for more than just numerous alternative applications. Several new accessories have also been developed or are presently being devel- oped. They will be described in more detail in a future issue of in Elektor. Readers with interesting ideas or wishes are invited to con- tact Colinbus or Elektor to make them known. The more we hear from you, the better we can adapt the software and accessories to the wishes of all users. ( 100869 -I) For more information on the PCB Prototyper, visit www.elektor.com/pcbprototyper 8 01-2011 elektor NEWS & NEW PRODUCTS Step-up DC-DC converter features highest efficiency austriamicrosystems has introduced the AS1310, an ultra low quiescent current hysteretic step-up DC-DC converter opti- mized for light loads (60 mA) and the high- est efficiency — up to 92 %. With 1 pA the AS1 31 0 step-up converter also features the industry’s lowest quiescent current, oper- ates over a wide 0.7 V to 3.6 V battery sup- ply, and provides output voltages between 1.8 V and 3.3 V. Even at loads as light as 1 00 pA, efficiency still reaches 85%, signifi- AS 1 310 DC-DC Boost Consuming Only IgA cantly increasing battery life. Since the supply voltage of many battery powered applications is moving from 3 V to 1 .8 V, the AS1 31 0 boost DC-DC converter was designed to be able to generate both; many competitive DC-DC converters are not able to do so. If the input voltage exceeds the output voltage the device goes into a feed-through mode and the input is directly connected to the output voltage. The fea- tures and performance oftheASI 310 boost DC-DC converter make it very well suited for single- and dual-cell powered devices, including blood glucose meters, remote controls, hearing aids, wireless mouse or any light-load application. The AS1310 DC-DC converter is an especially good fit for applications in which a lot of time is spent in an idle mode and therefore draws only a small current. In order to save power the AS1 310 also fea- tures a shutdown mode in which it draws less than 100 nA. During shutdown, the battery is disconnected from the output. In addition, the AS1 31 0 step-up DC-DC con- verter allows adjustable low battery detec- tion. If the battery voltage decreases below the threshold defined by two external resis- tors, the output is pulled to logic low. This signal is used to indicate ‘low battery’, so no separate supervisory ICs are needed. The AS1 31 0 boost DC-DC converter is avail- able in a TDFN 8-pin 2x2 mm package and operates over a temperature range of -40°C to +85 9 C with a wide power supply range of 0.7 to 3.6 V. www.austriamicrosystems.com (100820-I) More applications for Hameg HMP2000 series Hameg’s HMP2000 series High Power Sup- plies were improved by adding an impor- tant feature: Channel 2, till now an aux- iliary channel with 0-5. 5V output, was upgraded to a full-grown 0-32 V channel. This improves the universal applicabil- ity significantly, also with regard to future applications. The HMP2020 now features two identical channels with 0-32V out- put voltage, one delivering 1 0 A, the other 5 A. The HMP2030 now has three identical channels with 0-32 V, 0-5 A outputs. Also new are the LabView, CVI, and PLUG&PLAY drivers for all types of the HMP series which also includes the HMP4030 with three, and the HMP4040 with four, identical 0-32 V / i imi la !i ii — ■ - , , m ... * 16,800 V 5,800 fl .- 5500 V 6.830 A 32 mv imn - 0-1 0 A channels. Hence all programming systems and interfaces (USB, LAN, IEEE, and RS-232) popular in the ATE world are now being supported. The drivers are available at no cost for downloading from the web page below. www.hameg.com/HMP 2030 (100820-I) QuickUSB® Module offers 20 megabytes/sec transfer rates Bitwise Systems, designers and manufac- turers of custom embedded systems and PC interface products, has announced the availability of their QuickUSB Module that makes adding Hi-speed USB 2.0 to new or existing products fast and easy. Under ordinary circumstances, imple- menting a USB peripheral requires a func- tional understanding of the USB protocol as well as a considerable amount of firmware and software development and stringent compliance testing. The Bitwise Systems QuickUSB Module provides a very-desirable alternative for adding hi-speed USB 2.0 for speeds as much as 40x faster than USB 1.1. The QuickUSB® QUSB2 module makes adding Hi-Speed USB 2.0 to new or existing products fast and easy by integrating all the hardware, firmware, and software needed to implement a general-purpose USB end- point into a simple plug-in module and development library. The module may sim- ply be used as a development station when combined with the QuickUSB Adapter Board or QuickUSB Evaluation Board. It may also be designed as a plug-in module for new products, or designed directly into new products and licensed using the QuickUSB iChipPack or QuickUSB EEPROMs. The QuickUSB module contains parallel and serial hardware ports that are connected to circuits within the peripheral. The QuickUSB library included with the module provides user-callable software functions that trans- fer data to and from the hardware ports over the USB. The designer then obtains multiple ports of flexible, high-speed USB connectivity without requiring a prior in- depth knowledge of USB. QuickUSB differs from other USB modules in that it performs high-speed data transfers of 20 megabytes/sec or more via its high- speed parallel port. This makes QuickUSB the idea interface for high-performance USB peripherals such as FPGA, DSP or microcon- troller based data acquisition systems. The QuickUSB QUSB2 Module is a 2” x 1 . 5 ” (50 x 38 mm) circuit board that implements a bus-powered Hi-speed USB 2.0 endpoint terminating in a single 80-pin target inter- elektor 01-2011 9 NEWS & NEW PRODUCTS face connector. The target interface con- sists of: One 8- or 1 6-bit high-speed parallel port Up to five general-purpose 8-bit parallel I/O ports Two RS-232 ports One I2C master port One SPI master port One FPGA configuration port (Altera PS or XilinxSS) 2 KB of user-available, non-volatile memory Software, libraries and drivers for Windows 32/64, Linux and Mac OS X The QuickUSB Module, QUSB2 is priced at $149.00 ea. It is available immediately in small quantities. www.quickusb.com (100820-MI) DC/DC LED driver with 48 watts output power in DIP24 package With the release of AMLD-Z, Aimtec launches via MSC Vertriebs GmbH the third series in its line of DC/DC LED Drivers. Offered in a DIP24 packages, the AMLD-Z are feature rich LED drivers and meet the rigorous demands for environment friendly LED lighting solutions. From a wide (8:1) input range of 7-60 VDC, the AMLD-Z series of LED drivers provide constant output cur- rents ranging from 1 50 to 1 000 mA, gener- ating from 6 to 48 watts of power to main- tain the constant colour and brightness that is required by today’s most demanding LED applications. The new AMLD-Z series provides remote ON/OFF control function in addition to both PWM and analog voltage dimming control ( 0 - 100 %). Open and short circuit protec- tion works con- tinuously until the short circuit condi- tion is resolved, pro- tecting the converter, the LED lights, and the converter’s input cir- cuit from extremely high currents a short to ground causes. Boasting efficiencies as high as 97 %, Aimtec’s LED drivers are designed to be as reliable as the LEDs they drive, allowing Parallax: Spinneret Web Server and Propeller Platform USB The new Spinneret Web Server from Paral- lax may be small — at less than 1 V 2 by 4 inches — but it is a feature packed development plat- form. The built-in MicroSD card socket and real-time clock allow ample room for time- stamped file and data storage, and the over- sized EEPROM can store non-volatile data for use when there is no MicroSD card present. As an open-source hardware design, all design including layout, schematics, and firmware — are available under licenses that allow free dis- tribution and reuse. This means that the Spin- neret Web Server’s design can be incorporated into new applications royalty free and without a non-disclosure agreement. The Spinneret Web Server is an Ethernet based development board for the Propeller microcontroller. Web page content, files, and logs can be stored on a MicroSD card. The serial EEPROM has 32 KB for storing a Propeller program and 32 KB for non-volatile data storage, independent of the MicroSD card. There is a real-time clock controller for time stamping files and events and a backup capacitorthat will keep the clock running through extended power outages. There is a serial programming header and two auxiliary I/O connections, one for level-shifted open collector communications over a three-pin data/power/ground cable, and a the second is a 1 2-pin socket for direct 3.3 volt I/O connections. There are eight status LEDs on the PCB, plus two that are repeated on the Ethernet jack. One of the status LEDs is user controllable and shares a line with a button that can be read under user control. A second button resets the Propel- ler to reload the firmware from the EEPROM. Spinneret retails at $49.99. Combining a 64 KB EEPROM, 5 MHz removable crystal, 1 .5 A power regulation, USB, and a microSD card slot on a compact, bread- board and protoboard friendly module, the Propeller Platform USB is an easy-to-use development tool for the multicore Propeller microcontroller. All 32 Propeller I/O are available via pin sockets, along with 5 V and 3.3 V regulated power. Features include: 80 MHz 8-Core Parallax Propeller P8X32A with removable 5 MHz crystal 64 KB EEPROM for long-term program and data storage 5 V and 3.3 V 1 .5A ultra LDO voltage regulators accept 5.5 V minimum power input USB-to-serial interface for loading and communication 2.1 mm center-positive barrel jack and screw terminal power connections 2.8” x 2.5” footprint with pin sockets to add additional Platform modules or connect to a breadboard. microSD card slot connected to P0-P3. The new Propeller Platform USB retails at $49.99. At www.Parallax.com, search “Propeller Platform.” www.Parallax.com/go/spinneret (100820-V) 10 01-2011 elektor them to be used at an operating temperature of -40 to +85 degrees Celsius at full load for compatible with a wide range of LEDs applica- tions from variety of manufacturers without the need for any exter- nal components. www.msc-ge.com (100821— IV) Pololu: simple motor controllers Pololu announces the release of its Simple Motor Controllers, a line of motor drivers with enhanced capabilities that make basic control of DC motors easy. With four sup- ported high-level interfaces — USB for direct connection to a com- puter, TTL serial for use with embedded sys- tems, RC hobby servo pulses for use as an RC- controlled electronic speed control (ESC), and analogue voltages for use with a poten- tiometer or analogue joystick- -and a wide array of configurable settings, these devices simplify con- trolling motors in a variety of projects. Units can be paired to enable mixed RC or analogue control of differential-drive robots, and they can be daisy-chained with additional Pololu servo and motor controllers on a single serial line. A free configuration program, available for Windows and Linux, allows for quick controller configuration over USB (no more dip switches or jumpers) and simplifies initial testing. Con- troller features include: acceleration and deceleration limits to decrease mechanical stress on the system, optional safety con- trols to avoid unexpectedly powering the motor, a wizard for automatic RC and analogue input calibration, and support for limit switches. The controller versions offer a wide operating voltage range up to 5.5-40 V and continuous current ratings from 1 2 A up to 25 A, which means they can deliver up to several hundred watts in a small form factor. The unit prices are $39.95, $43.95, $54.95, and $59.95 for the Simple Motor Controller 1 8v1 5 (item #1 377), 24v1 2 (item #1 379), 1 8v25 (item #1 381 ), and 24v23 (item #1 383), respectively. www.pololu.com/smc (100820-VI) IP67 wall mounted enclosures for harsh environments The new 1 555F range from Hammond Electronics is a family of rug- ged IP67 sealed enclosures designed for wall mounting PCB-based or DIN rail based equipment such as security components, control equipment and radio repeaters used in harsh industrial environ- ments or outdoor applications. Available in RAL 7035 light gray and moulded in either general purpose ABS or flameproof polycarbon- ate, the units have a number of innovative features that provide excellent functionality. In use, the lid is secured to the wall or other surface using the slots moulded into the integral flanges. The screws securing the lid to the base are then inaccessible as they are against the surface, giving security against unau- thorised tampering. For maxi- mum security, the units can be attached to the wall with tam- per-resistant screws. Standoffs are moulded into both the lid and the base and, apart from in the two smallest sizes, DIN rail mounting tabs are also pro- vided. The bottom of the base features a moulded recess for a membrane keyboard or label. The initial six sizes range from 1 20 x 66 x 42mm to 1 59 x 91 x 62mm; all lids are fitted with captive M4 stainless steel screws that engage with stainless steel inserts in the base, allowing repeti- tive assembly and disassembly. Environmental sealing is achieved through a tongue and groove design and a moulded silicon rubber gasket; all fixings are outside the gasket seal. www.hammondmfg.com (100820-VII) Advertisement V-mCDLLl? * o /Trjr- mi * r V-Mcdule Maktr the design much easier VMP320X series DC- DC Module Compact size* fully integrated package Vim MV-24.0V Vout: 1.0V-9.0V Efficiency up to 95% No heatsink required Cost effecitve High reliability, Low EMI VMP32CH S 1,3A VMP3203; 3, DA VMP3303; 3,0 A Dealer Wanted URL; http; www.v-nnodule.com Email; sales&v -module , com Tel ; -ES1Q 6E56 £708 Fox . *8810 3256 2707 elektor 01-2011 11 NXP MBED DESIGN CHALLENGE mbed Has Landed! Question: What do you get when you land 75 engineers and boxes of all sorts of electronic components together in a concrete UFO? Answer: You get the biggest mbed hands-on workshop we’ve ever attempted! mbed DESIGN CHALLENGE m By Simon Ford (UK) I just arrived back from a trip to Elektor Live!, a daylong Elektor event in Eindhoven, The Netherlands. This was an excellent outing for anyone interested in electronics, and it had the added attraction of being held in the ‘Evoluon’ conference centre, which is an impressive saucer-shaped building that was actually built as a Science Museum by the Philips company in the 1 960s. It was certainly the first time I’d ever been able to ask a taxi driver to “take us to the UFO.” Our mission was to run a hands-on mbed workshop in the morning. Whilst I had originally guessed 1 5 to 20 people might sign up, the email I had received the week before confirmed Elektor had closed applications on reaching 75 people. Yes, 75! That beats any of our previous workshops by a large margin, and as a result we spent much of the night before collecting together as many electronics kits as we could get our hands on. We arrived with all sorts of SparkFun Electronics breakout boards (accelerometers, gyros, screens, sensors, trackballs, RFID readers, etc.), mbed baseboards, and even some of the robots we used in a recent ‘mbed Robot Racing’ event. We figured it was certainly enough to keep people busy. The workshop was a great success. We had an impressive assortment of attendees, ranging from total novices to experts, working with microcontrollers and electronics — all day, every day! This was a great testament to our focus on tackling the requirements of prototyping itself rather than catering to designers with particular skill sets. We want mbed to be a useful tool for novices and experts alike. Given the success, we’ll be looking to run these events elsewhere. Tell us if one should be run near you! While we were there, we bumped in to lots of people who were already mbed users, and it turns out some of them have been working on ideas for the NXP mbed Design Challenge 2010. I managed to get a few of them to reveal what they were up to. If their ideas are anything to go by, we should see a very interesting and diverse range of entries for this competition. I’m really looking forward to seeing people posting their results as these projects come together. For those of you who haven’t seen it yet, note that NXP Semiconductors, Circuit Cellar , and Elektor launched the NXP mbed Design Challenge in September 201 0. The challenge puts up prizes for designers who share reference designs and building blocks that can help other mbed users prototype even faster. After all, the goal of fast innovation and invention is the real motivation behind mbed. We asked ourselves: What can be done to get out of the way and let innovators experiment quickly to invent future applications for microcontrollers? We want all sorts of entries. Examples include innovative ideas, whacky applications, impressive engineering feats, and simple solutions to real problems. These projects will demonstrate new ideas and techniques. They’ll inspire other designers and influence the development of future products, so everyone can do their bit to help move the industry forward. And, if being part of this mission isn’t motivation enough, take a look at the Circuit Cellar website to see the prizes up for grabs! The submission deadline is 1 pm EST on February 28, 201 1 . If you have an mbed, be sure to obtain a Registration Number on the Circuit Cellar a nd then get prototyping. With the rapid way in which the mbed community is growing, there will be lots of people to help you out along the way, so we hope the process will be good fun too. Good luck! (100873) Simon Ford, co-creator of mbed, is a lifelong electronics and comput- er engineer. He works at ARM, and before starting mbed was techni- cal lead for the ARMv7/NEON architecture now found in most new smartphones. To enter the NXP mbed Design Challenge 2010, go to: www.circuitcellar.com/nxpmbeddesignchallenge/ 12 01-2011 elektor V mbed DESIGN CHALLENGE Start prototyping the mbed way! Redefine the way people build prototypes! NXP and ARM/mbed are challenging you to use the mbed NXP LPC1768 prototyping board and mbed online "Cloud" compiler to develop an innovative hardware- or software-based application. Succeed, and you could walk away with part of a prize pool worth $10,000! Deadline for entries is February 28, 201 1 Register for the challenge at www.circuitcellar.com/nxpmbeddesignchallenge NXP mbed Design Challenge empowered by: mbed ENERGY HARVESTING Economical Energy Harvesting Every little bit helps By Rolf Blijleven (Netherlands) Alternative energy is a hot topic. In this article we describe several options for powering circuits from solar energy. As you can see, significant results can be achieved with a modest investment and a bit of sunlight. What’s more, once it works the power is free. In this article we show you several ways to power your circuits from an alternative energy source instead of batteries or the AC power grid. Here we focus on solar energy, but the methods described here can certainly be used with other energy sources as well. As you can see, quite respectable results can be obtained at a modest cost with a clever combination of modern and less modern components. Virtually all alternative energy sources have three practical shortcomings: they are not continuously available, or if they are they do not supply a constant amount of power, and the available power is often too low for direct use. The engineering discipline that deals with these problems (and finds solutions for them) is called energy harvesting, which is the art of collecting energy whenever a source provides some energy and storing the collected energy until enough is available to be used for a practical purpose. Energy harvesting is receiving more and more attention in recent years, and rightly so. The block diagram of an energy harvesting system is shown in Figure 1 . A transducer is necessary to convert a particular form of energy into electricity. The voltage must be raised to a usable level, and the energy must be stored in a buffer. The energy level in the buffer must be monitored to determine when enough is available. At this point, it can be provided to the load - a circuit that does something with the energy. This continues until the stored energy is used up, after which the cycle begins again. If you want to put this idea into practice immediately, a ready-to-use kit is available from Texas Instruments (EZ-2500-SEH PI). It is based on the Cymbet EnerChip EH solar energy harvesting module I 2 1 and provides a complete platform for an autonomous domestic wireless sensor system. This kit is primarily intended for rapid prototyping. If you’d rather put something together yourself, read on... Eternal energy As already mentioned, we focus on solar energy here, so the transducer is a solar cell. We looked for solar cells available in the price range of 30 pounds/ euros. All manufacturers specify the dimensions and the maximum voltage and current. If you calculate the corresponding power figures (voltage times current divided by the area in square centimetres), you will see that there is a large spread — from slightly more than 2 W/cm 2 for a cell with an area of just under 25 cm 2 to a hefty 1 2 W/cm 2 for a cell with nearly the same size. If you also check the prices, you can see that the higher-priced models are by no means always better. Accordingly, it’s certainly worthwhile to shop around on the Web and do a bit of maths. The yield per unit of incident light (watt/lux) is only rarely specified, which is a pity because this is an important parameter. From measurements on a cell with a price of 4 euros we saw that the significant results with a modest investment 14 01-2011 elektor ENERGY HARVESTING figure of 200 mA at 1 V promised on the package was achieved only with perpendicular illumination on a cloudless day. With subdued artificial light or rainy weather, it amounted to no more than around 0.02 mA at 0.2 V. Mind the gap Most electronic components need at least 3 V to do anything useful, and small motors typically need at least 5 V. The gap between what a solar cell can deliver and what we need for practical use is thus approximately 3 V or more. Of course, you can bridge this gap by using a relatively large solar panel or connecting several cells in series or parallel, which amounts to the same thing. However, other solutions are also possible, which brings us to the second block in the block diagram. Two options are described below. The first is based on the Maxim MAXI 044 switched-capacitor voltage converter 1C I 3 !. As illustrated in Figure 2a and 2b, it connects an external capacitor C e alternately in parallel with the input voltage V\ n and in reverse series with storage capacitor C s . The operating current of the 1C is approximately 30 pA, which is 50 jiA less than its predecessor, the ICL7660, with which it is fully pin compatible. The circuit shown in Figure 3 doubles the voltage from the solar cell, and with several MAXI 055s operating in cascade you can multiply the input voltage even more (Figure 4). Here C e has a value of 1 0 pF and C s is the storage device in the block diagram, which can be as large as you wish. We have more to say about this shortly. Retro technology We weren’t satisfied with a minimum input voltage level of 1 .5 V. It should actually be possible to harvest voltages lower than 1 V, and preferably even lower than the transistor base-emitter threshold voltage of 0.6 V. After a bit of detective work, we found the solution shown in Figure 5. The principle is not new. It’s based on the work of Cockroft and Walton in the 1 930s, with further refinements by Dickson in the 1 970s, after whom this technique is named. The Dickson charge pump is enjoying renewed interested in recent years because it can be used (in a further improved form) as a separate unit in an 1C to boost the supply voltage for the rest of the 1C to the desired level Kl. However, it can also be implemented quite well with discrete components. Briefly, it works as follows (see Figure 4): X and X are anti-phase clock signals. When X is low, the voltage at the first node is U in - V d , where V d is the forward voltage drop over the diode. When X goes high, the voltage rises to \/ x + (V m - \/ d ), where \/ x is the amplitude of the clock signal. This causes D2 to conduct until the voltage at node 2 is \Z in + (V x - V d ) - V d . If you connect enough of these stages in series, you can raise a low input voltage to any desired level. We used an astable multivibrator (AMV) built from bipolar transistors as the clock source. The result is shown in Figure 5. The necessary component values can be calculated from the formula for the output voltage: f Vout —Vin+N- in V x - c \ V c + c, -Vd- out {C + C s )-f c -Vd OSC J Figure 1. Basic block diagram of an energy harvesting system. Figure 2. Operating principle of voltage multiplication with a switched capacitor. C e is connected to the supply voltage in phase ‘a’ and in series with C s in phase ‘b’. The resulting output voltage is -V { , so the total voltage between the input and the output is doubled. Figure 3. A MAXI 044 configured as a voltage doubler (a) and as a voltage elektor 01-2011 15 ENERGY HARVESTING Figure 5. Voltage multiplication with an AMV and a Dickson charge pump. Voltages as low as 200 mV can be harvested if the AMV is built with germanium transistors. In addition to \/ x , V d and V m , the terms of this formula are N (the number of stages), C (the value of capacitors Cl , C2, etc.), C p (the parasitic capacitance), / out (the output current), and f osc (the clock frequency). For the enthusiasts, the derivation of this formula can be found in reference Kl with a bit of searching. v+ Figure 6. This circuit monitors the voltage of the storage buffer (V+) and switches on the MOSFET when enough stored energy is available. Applied math The formula clearly shows several things. Firstly, normal diodes with a forward voltage drop (\/ d ) of 0.6 V have a highly detrimental effect on the result, but this problem can mitigated by using Schottky diodes, which have a forward voltage drop of only 0.2 V (or as little as 75 mV at low current levels). Secondly, the parasitic capacitance (C p ) of several dozen picofarads is hardly negligible. If the value of Cis kept small, it takes less time for the pump to start filling up the storage capacitor, but this also reduces the contribution of V x . As V x is equal to the input voltage, it must be used economically. It is therefore better to make C much larger than C p (for example, 1 00 pF or 220 pF), so the ratio of C to C+ C p is nearly 1 . Thirdly, the effect of the load current / out can be minimised by choosing a clock frequency that is as high as possible. With an AMV constructed using BC550C transistors, useful energy can be harvested at voltages of around 0.6 V or more. Can we do even better? On eBay we found type AC1 75 germanium transistors, and with them the circuit starts working at around 200 mV (with thanks to an idea from Vladimir Mitrovic published in the December 2009 edition of Elektor). And once the AMV starts working, it continues to operate until the input voltage drops to approximately 80% of the level necessary to start working. Storage space wanted Encouraged by this result, we encountered the next challenge: energy storage. To but it briefly, electrolytic capacitors need several hours to charge, batteries need several days, and both lose most of their charge overnight. An electrolytic capacitor is therefore better, and the question is how big it should be. The answer may be calculated from: / = Cxd\//dt C = /xdt/dV For example, if C s must supply a current of 1 mAand the voltage on C s may drop from 5 V to 2.5 V in the process, we need an electrolytic capacitor with a value of 0.8 mF (1 mA x 2 s x 2.5 V), so two 4700 jllF capacitors connected in parallel are more than enough. Two seconds may seem like a short time, but bear in mind that an ATtiny (for example) can operate with as little as 200 pA and can certainly do something useful in two seconds, such as reporting a reading in a ZigBee network. Supercaps and other heavy-duty devices can be used for more demanding tasks. Expensive? Not at all. We picked up a 0.1 5-F device for about 6 pounds, at a recent electronics car boot sale. Economical watchdog The final stages of the block diagram are the voltage monitor and the switch that supplies power to the load. The difficulty here is that C s must be monitored constantly to see whether it has accumulated enough energy, but at the same time no current should be drawn from it. We regarded a separate battery supply for the monitor as unacceptable. Once again we found the solution in a Maxim device: the MAX931 is an ultra low power, low cost comparator with 2% 16 01-2011 elektor ENERGY HARVESTING reference, and it draws almost no current as long as \/ cc is less than 2.5 V. Above that point this user-friendly 1C draws only 2.5 pA. Furthermore, the input leakage current is only around 0.03 nA. This means that high-value resistors can be used to set the trigger thresholds, so the current consumption remains in the microampere range. Figure 6 shows the schematic diagram. The selected resistor values yield an upper trigger threshold of approximately 5 V and a lower trigger threshold of approximately 2 V. This broad hysteresis is necessary to ensure that the comparator output level is always either high or low. The calculation of the resistor values is explained in the data sheet I 5 !. The resistor and capacitor at the output are optional; they keep the MOSFET in the on state as long as possible. The MOSFET must have a low gate-source on voltage (Ic-son) and the lowest possible on resistance (Ro-son)- We found the ZVN4424A suitable for currents up to 260 mA, and the IRF3708 can be used for higher-current tasks. Both devices are readily available (from Farnell and other sources). Conclusion In this article we have examined several ideas that you can use according to your own wishes. Germanium transistors are still available in relatively small quantities as ‘new old stock’, but they are no longer being made (unless someone rediscovers this market niche). All of the circuits can easily be built on prototyping board, so there are no PCB layouts in this article. Of course, you are probably wondering what these circuits can actually do in practice. The answer depends largely on the position of the solar cell relative to the sun, the weather, and the required voltage. With a panel costing around 1 0 pounds, we were able to charge our 0.1 5 F capacitor to approximately 9 V and use it to power a small 1 2 -V pump. The cycle time for this was 5 minutes in full sun and approximately 30 minutes in rainy weather, which is not a problem for a small pump that supplies water to a few garden plants. We also placed a chime arrangement with a small 5-V motor on the window sill. On very cloudy days it played a couple of times a day, but in sunny weather we heard it every hour. Solar energy is free, but especially in the winter it’s scarce. Bear in mind that large organisms, such as broad-leafed trees, spend the entire winter waiting for better times. In a certain sense, these circuits are comparable to such organisms. (100533) Internet Links and References 1 . http://focus.ti.com/docs/toolsw/folders/print/ ez430-rf2500-seh.html 2. www.cymbet.com/content/products-energy-harvesting.asp 3. www.maxim-ic.com/datasheet/index.mvp/id/1 01 7 4. Louie Pylarinos et al., Charge Pumps: An Overview, Department of Electrical and Computer Engineering, University of Toronto (www.scribd.com/doc/21 06051 6/Charge-Pumps) 5. www.maxim-ic.com/datasheet/index.mvp/id/1 21 9 Figure 7. The circuit of Figure 6 implemented with an IRF3708 and a 0.1 5-MF electrolytic capacitor drives the small pump at the rear. The connector is for the solar panel. Figure 8. The arrangement of Figure 7 in an experimental waterproof setup. Figure 9. A solar cell supplies 0.2 to 1 V to a Dickson charge pump with 17 stages constructed on a piece of prototyping board. The motor starts running at approximately 5 V. elektor 01-2011 17 PROGRAMMING Thin FAT Open source FAT file system libraries for embedded applications By Stephen Bernhoeft (UK) The FAT file system has become the de facto universally readable file system. A number of architecture-neutral, open-source implementations exist. Before using a solution, it behoves the developer to understand something about how the File Allocation Table system actually works. Before choosing a solution, read this! ' pr r Jr am, ** 4 /*»*?*. /fee fs** ** p fmsr 'wof St* _ i jj, Jg"*»m*.d4 C The core idea A File Allocation Table (FAT) holds a collection of linked lists. There is one list associated with each file and each successive list element describes where to find the next part of a file and where to find the next list element. The lists are the simplest conceivable. Each element consists only of a pointer to the next element — there is no explicit data in the FAT. Given that there is no explicit data in the FAT then how can it be useful? The answer is that the data is implicit. Each non-reserved value in a FAT chain has two meanings: one is that of pointer to next list element, the other is pointer to file data. A FAT can be considered as an array (Figure 1). Given the value of FAT[x] we can find the next item. For example, if the FAT chain for a given file begins at FAT[3] and this holds ‘14’ (OxE), the next item in the list is FAT[14]. Now FAT[ 1 4] may hold the value ‘4’ so the next item is FAT[4]. If FAT[x] holds the reserved value ‘EOC’ (End Of Cluster) then that is the end of that chain. The first two FAT entries ( FAT [ 0 ] , FAT [ 1 ] ) are reserved. No FAT entry can ever point to these first two entries. The first, FAT [ 0 ] holds a legacy field, the ‘media byte’. The second, FAT[1 ], is used by the operating system to record a ‘clean’ or ‘dirty’ shutdown. An important corollary is this: when interpreted as a cluster number, a FAT entry must first have 2 subtracted from it. If a FAT entry is 14, then the cluster number is (14-2) = 1 2 (OxC). So in figure 1 FAT[1 4] also points at cluster 14-2 = 12 which holds the first part of the actual file data, and FAT[1 1 ] points at cluster 11 -2 = 9 which holds the final part of the actual file data. This can be considered the basis of the FAT system, however much extra detail must be added to describe a real implementation. FAT entry point How is FAT navigated? The idea is that we begin at the root directory. A directory is a single file, which holds a series of 32-byte entries (this is true for FAT1 6 as well as FAT32). Each 32-byte entry holds a structure describing another file or directory. The entry includes create time, file attributes and a ‘pointer into the FAT’. The way we initially locate the root directory differs from FAT1 6 to FAT32. With FAT1 6 we calculate the location and size of the root directory using the Volume Boot Record (VBR). In FAT32, the VBR gives the FAT chain start-index of the root directory file — a FAT32 root directory file can grow without bound. In both cases we can also work out where the FAT itself begins using information in the VBR. The first FAT element in a FAT chain is not found in the FAT itself, it is found in a directory entry. The single exception to this rule is the FAT32 VBR field BPB_ RootClus, which contains the first FAT element in the FAT chain for the root directory. Disk space is allocated in clusters of contiguous hardware sectors. Because the cluster size is known and clusters are composed of contiguous sectors, FAT needs only the starting sector of a given cluster. Sector size is usually 51 2 bytes although FAT supports sector sizes of 51 2, 1 024, 2048 and 4096 bytes. What is the purpose of clusters? It is to keep the number of FAT- FAT uses little endian format 18 01-2011 elektor PROGRAMMING Media nzr \ y ———————— [ [Optional MBR] FAT32 FAT chain MyFile txt 20 0003 SubO 10 modbus c 20 Root Directory File r Typical FAT chain for one file FAT A X 0 X 1 0000 2 000E 3 . 000B 4 0000 5 0000 6 0000 7 0000 8 0000 9 0000 A FFFF B 0000 c 0000° , 0004 E 0000 F 0003-2 = 0001 — f — I l l l 1 1 1 1 1 j 000E-2 = 000C 1 1 ! 0004-2 = 0002 i [000B-2 = 0009 l 1 Last file cluster Cluster of sectors (First sector @0009) Cluster of sectors (First sector @0002) Cluster of sectors (First sector @000C) First file cluster Cluster of sectors (First sector @0001) 100569 - 11 Figure 1 . Overview of FAT file system and media organisation. (OxFFFF is the end of the example FAT chain). Partitioned media hold a Master Boot Record (MBR), not located in a partition, which contains the primary partition table. Each entry in this table tells us the partition type (FAT, OS/2, Linux, etc.), starting sector and count of sectors in the partition. addressable regions at a sensible value: with a cluster size of 1 , a large file would have a very long FAT chain; one element for each logical sector occupied by the file. With a cluster size of 64, we only need a single FAT entry for every 64 logical sectors, with the disadvantage that a file using 65 logical sectors (blocks) wastes 63 logical sectors. Open source FAT libraries Many FAT implementations are available on the net, commercial and free, and sometimes they are part of a larger project. It was decided to concentrate on open-source, platform-independent FAT libraries. The minimum requirements for the tests were: • Access to root directory files; • Create/Open/Read/Write/Truncate; • FAT32 support (for maximum media compatibility); • ANSI C (C90 preferred). We also have an additional preference: • There is no obligation to publish user code. In other words, ideally we should be free to use the code as we like. Is this inconsistent with the spirit of open source? Not necessarily: I may be happy to share the source to a module (such as a FAT library), but it may be commercially suicidal to share the code to a complete application, such as a novel piece of test gear. To aid testing, a ‘library test suite’ was developed. This is a DOS-like interface (Figure 2) allowing the user to interactively test the library elektor 01-2011 19 PROGRAMMING Formattin As embedded programmers we typically do not require a format function. If you do need to format flash media, be aware that it is usually a mistake to use one of the standard PC utilities. The reason is that the various file system structures (partitions, clusters, etc.) should be aligned to so-called erase blocks. It is not possible to erase one byte. Instead, an entire erase block (perhaps 64 sectors) must be erased. Careful positioning of FAT structures done by the SD card manufacturer assists the card’s internal logic in performing its main tasks: • Wear levelling — ensuring long life of the card. • Fast read and write access If the format program is not ‘SD-Card aware’, performance and card life will suffer. Only two of the surveyed libraries actually support a format function: • EFSL - Maybe! The function mkfs_makevfat is undocumented by the authors, and the few references found on the web are not encouraging. Perhaps the default volume label, ‘DISCOSMASH!’ is a warning... • FatFs - Flash media aware. using DOS-like commands via a terminal emulator such as Realterm. The test suite is available on the web page for this article PI. When customising a generic library one typically has to define: • A media-initialise function; • A sector write function; • A sector read function. There will usually be a library configuration file where the amount of file buffering can be adjusted (more RAM means faster file I/O) and the types of file operation required can be specified (more ROM means greater functionality). The example target was Microchip’s PIC18F Starter Kit 1 (DM1 80021 ), running code generated by the Cl 8 compiler, with all optimisations enabled. Compilation was also done for the PIC24FJ256GB1 1 0 using the C30 compiler. This compiler allows a code size/speed trade-off: the smallest possible code size option was chosen. No hardware was available to test the results, however. EFSL The ‘state of play’ with EFSL is a little hard to judge. The obvious download at sourceforge.net/projects/efsl/ is efsl-0.3.6. The SD cards and licensin I SanDisk ' Many microcontroller development boards nowadays have an SD card connector. In most of these systems the SD card connector is simply hooked up to the SPI bus of the microcontroller, without the use of a dedicated host controller. The SD card standard is controlled by the SD Card Association, “an industry-wide organization setting industry standards to promote SD product acceptance in a variety of applications”. The SD Card Association requires that all companies planning to or manufacturing SD host products (e.g. cell phones, cameras or computers) or SD ancillary products (e.g. adapters or SD I/O cards) join the SD Card Association and enter into a Host/Ancillary Product License Agreement (HALA) with the SD Card Association and the SD-3C, LLC. This is regardless of how the card may be used, in SPI mode only or not. It will be very likely that your system will not comply with the host controller specification and so your board can not qualify as an SD host product. But please don’t take our word for it; this is what we make of it. If in doubt, ask the SD Card Association. Elektor cannot accept any responsibility for any loss or problems caused by improper interpretation of the SD Card Association’s rules. www.sdcard.org/developers SDCard So, if you design or build such a board, do you need to pay a license fee? Even if the SD Card Association would like you to, the answer is probably No. According to the document SD Host Controller Simplified Specification Version 2.00 February 8, 2007 an SD host product is a system containing a host controller that complies with this specification. According to the SD Card Association the host controller is situated between the SD host connector and the SD bus driver. 20 01-2011 elektor PROGRAMMING accompanying manual warns “This version is currently not really usable”. The current stable version is 0.2.8. The source tree comes with some example targets and good documentation. To use EFSL first modify the example header files to suit your target. For the PIC, the following files/modifications apply: config-sample-avr . h / /#define HW_ENDP0INT_ATMEGA12 8_SD #define HW_ENDPOINT_P IC_SD / /#define DEBUG interface . h #elif defined (HW_ENDPOINT_P IC_SD ) #include "pic_efsl.h" types . h Confirm euintl 6 etc are correct. Configuration options exist to trade-off performance for RAM usage. However, there are no configuration options available to trade functionality off against code-size. For example, file write is always available. The core user contribution is to define one structure and four functions (see examples atmegal 28. h, atmegal 28. c). Equivalent PIC files (pic_efsl.h, sd.c) were written for this article. In config.h, we chose “#define ioman_numbuffer l”. The manual recommends one buffer per File-System object, two buffers per file, an extra buffer for seek/rewrite operations, and an extra three buffers to “smoothen” file list operations. For our test program (one file open with seek and list), this is already sect , 1000 txt read: FAT test FatFs Mir 22 TEE1.TXI SUB0UI"! SUBS 3 iten FatFs>o|ren test.txt pAtFs>P4&d 1000 Hello <2> Goodbye Requested: 1009. read: ; FatFs >seek 4 Fptr = 4 FatFs >L7idte hi-lio 5 bvftRfi vritfcftn, fp: 9^ FatFs >c lose 1*0=0 FR_OK FtiLFs>ui)i;n t oat .txt FatFs ad 1003 <±> hi-hn <2> Goodbye Faquested; 1000,, read: ! FatFE>opei> new-01»tsct FatFs 1234567 7 bytes written. fp= 7. FatFs >u lose rc =0 Ffl_OK FatFs>i'eari 1000 fil* file sise 7x512 = 3584 bytes. We could not afford that on the example target, and so we used just one buffer. Licence “...you are allowed to statically link against the library without having to license your own code as GPL as we//.” Conclusion Figure 2. Screenshot of a library test session. EFSL is quite widely used — for example NXP’s AN1 091 6 and ST’s AN3102. It does not appear to be as widely used as FatFs however. It is worrying that the new version, 0.3.6, seems to have been abandoned. On the other hand, the actual source code and documentation are of a high standard, and the fact that major chip vendors have used in their application notes is reassuring. Internet sourceforge.net/projects/efsl/files/ FatFs FatFs has an impressive collection of sample projects. Along with code, there are schematics showing interfaces to MMC/ SD, IDE Hard Disk and Compact Flash media. Platforms covered are ATMega, H8, LPC2368, PIC24, pPD70F3706, and Win32 (PC-based). There are extensive statistics showing code footprints and performance benchmarks for these platforms with various library configurations on the FatFs website. There is fair scope for trading code size against functionality, although some functions are grouped. Thus (f_truncate, f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, and f_rename) cannot be individually enabled. Adapting FatFs to your needs is similar to the EFSL process. The core user contribution is to define six functions — declared in diskio.h. elektor 01-2011 21 PROGRAMMING Microsoft applied for, and was granted, a series of patents for key parts of the FAT file system in the mid-1 990s. On December 3, 2003 Microsoft announced that it would be offering licenses for use of its FAT specification and “associated intellectual property” at the cost of a $ 0.25 royalty per unit sold, with a $250,000 maximum royalty per license agreement. To this end, Microsoft cited four patents on the FAT file system as the basis of its intellectual property claims. All four pertain to long-filename extensions to FAT first seen in Windows 95. Many technical commentators have concluded that these patents only cover FAT implementations that include support for long filenames, and that removable solid state media and consumer devices only using short names would be unaffected, (source: Wikipedia) Four of these functions are essentially identical to those needed by EFSL. When testing FatFs with the Cl 8 compiler it was necessary to amend the code in ff.c to avoid run-time errors: int chk_chr (const char* str, int chr) must be re-declared as int chk_chr (static char rom *str, int chr) This is a compiler-specific issue. Licence No restriction on use. Conclusion FatFs is very widely used, and is being actively maintained. It appears to be the most popular library, and thus should be relatively bug-free. The range of sample targets and statistics makes this library stand out. The source code is not easy to follow, and is very cramped in style. Documentation is reasonable, but not as clear as it could be. The user forum is useful but primitive. Internet elm-chan.org/fsw/ff/00index_e.html Petit FatFs This is a minimal version of FatFs targeted at 8-bit microcontrollers. It offers very limited write functionality: 1. You may only overwrite an existing file; 2. You cannot create a file; 3. You cannot extend the file. In short, it does not satisfy our minimum requirements. Licence No restriction on use. Conclusion Petit FatFs is useful on (sma systems that only need read capability like MP3 players and digital picture frames. Internet elm-chan.org/fsw/ff/00index_p.html SD-Reader The web site gives a good impression. This library differs from others in at least three important ways: 1. Source requires C99 compiler. Thus, for example, the Cl 8 compiler is unsuitable. 2. It is specifically targeted at SD cards. 3. The user interface is very different from the other FAT libraries. It is not sector-based; rather it is byte-offset based, where the byte offset is not aligned to a 51 2-byte boundary. However, the supplied file, sd_raw.c, provides most of the code required to use the library. One issue is that there seems to be no way for user code to access the file position, because the ‘field pos’ is defined in a C file rather than an H file. (There is no ftell function either). Another aspect is that file open does not use the familiar ‘a+’ etc file mode parameters. In the tests, custom code had to be written to replicate the *a+* mode 22 01-2011 elektor PROGRAMMING Table 1. A comparison of several open source FAT libraries Library Compiler Target Code Data Comments EFSLO.2.8 Cl 8 v3.35 PIC46J50 34292 1258 C30 v3.23 PIC24FJ256GB1 1 0 15516 1266 ARMCC STM32F1 07xx 8338 — FatFs R0.08 Cl 8 v3.35 PIC46J50 21572 658 Read & Write, _FS_MINIMIZE= 1. C30 v3.23 PIC24FJ256GB1 1 0 9099 826 WinAVR AVR 8386/ 12700 ~600 Read & Write, _FS_MINIMIZE = 3/0 CH38 H8 6980/ 10686 C30 PIC24 7395/ 11376 V850ES CA850 4930/ 7730 SHC SH-2A 5600/ 8592 WinARM ARM7TDMI 6636/ 10520 VC6 x86 4923/ 7545 sd-reader C30 v3.23 PIC24FJ256GB1 1 0 5616 204 The code footprint appears remarkably small. Flowever, this is probably because a lot of the work is done in the interface code which does the media-specific access. File sd_raw.c uses 4341 bytes. For comparison, EFSL’s interface code was 2649 bytes, and that for FatFs was 1071 bytes. File i/o library Cl 8 v3.35 PIC46J50 24648 2256 Large data space footprint C30 v3.23 PIC24FJ256GB1 1 0 35958 2258 (append if file exists, else create). Licence GPLv2 or LGPLv2.1 . Conclusion An interesting project, but currently lacks the functionality of the other examples and is sd/mmc specific, rather than media-generic. Data/variable requirements are the smallest of all the reviewed solutions. Internet www.roland-riegel.de/sd-reader/index.html FAT File 10 Library As happens too often with open source projects, this library has gone missing since the article was written. We decided to publish our findings anyway in case it pops up again. The version we used is included in the download on the web page for this article PL Using and configuring this library is particularly straightforward. The only user-code demands made by this library are sector read / write routines (it is up to you to call your own initialisation code). In fat_opts.h, one may choose whether to support long file names, the number of buffers, and number of simultaneously open files. It was not possible to test the code on the sample PIC1 8 target due to lack of RAM (PIC variable space). The library required 2256 bytes of RAM out of a total on-chip of 3.8 KB. By ‘inventing’ extra RAM via the Cl 8 linker script however, some Cl 8 estimated statistics were derived. Licence GPL. If you include GPL software in your project, you must release the source code of that project too. If you would like a version with a more permissive license for use in closed source commercial applications please contact the author for details. Conclusion An easy-to-use library, but fairly high code space and data space requirements. Internet The FAT File I/O library used to be here: www.robs-projects.com/ filelib.html (100569) Internet Links [1 ] www.elektor.com/ 1 00569 elektor 01-2011 23 THERMOMETER Nixie Tube Thermometer Retro temperature display By Dieter Laues (Germany) In this article we describe the union of a modern microcontroller with a classic display technology to create a novel temperature indicator. In its transparent enclosure the device will set off any mantelpiece to advantage and what’s more, the unit even doubles up as a night light. An external sensor allows the temperature at any desired location to be displayed. Nixie tubes have a special charm all of their own. The author’s Sputnik-style digital clock using the tubes appeared in Elektor in January 2007, and many variations on the theme have appeared on the inter- net. This digital thermometer, which uses just two tubes, is a little bit different. The temperature measurement itself is done by a DS1820 one-wire sensor, while an AT89C2051 microcontroller processes the temperature information and drives the Nixie tubes. Hardware Special attention was paid when designing this circuit to make construction as straight- forward as possible. There are only a few components, no SMDs, and no adjustments to be made. The circuit is shown in Figure 1 and is arranged as follows. An external mains power supply provides between 1 2 V and 1 5 V DC to the circuit. From this voltage IC6 generates the 5 V operating voltage for microcontroller IC1 and nixie drivers IC2 and IC3. The high voltage supply required for the tubes is generated using a step-up con- verter based around IC5. The MC34063 device used is a tried-and-tested PWM controller that is easy to find, inexpensive, and available in a leaded package. External MOSFET switching transistorTI , coil LI and Schottky diode D6 generate and smooth the high-voltage output. The output volt- age of the regulator is given by \/ 0 = y re f x R9/R10 and with the values given in the circuit dia- gram, we have V 0 = 1 .25 V x 820k / 5.6k = 1 83 V. This relatively high voltage has the advan- tage that the display will be bright. In his prototype the author used a value of 680 k£l for R9 in the interests of reducing power dis- sipation: in this case the voltage across C4 is about 1 52 V. Using values between 680 l<£2 and 820 k£l for R9 you can adjust the volt- age and hence the display brightness to taste. R4 and R5 take the high voltage supply to the anodes of the IN-16 tubes, giving an operating voltage of around 143 V (with 1 80 V across C4), and an anode current of about 1.72 mA. This is a suitable operat- ing point for Nixie tubes of Russian manu- facture, which are inexpensive and easy to obtain. Also, the Russian Nixie driver 1C type K1 55ID1 can be substituted for the 741 41 , which is now hard to obtain. In the interests of maximising brightness, it was decided not to multiplex the displays. The tiny MCS-51 -compatible microcon- troller fits all the software required to read temperature values and convert them to BCD format for output in its 2 KB of program memory. The 12 MHz clock is produced using XI , which is a resonator with built-in load capacitors. The RC network compris- ing R6 and Cl provides a power-on reset function, and IC4 (a Maxim-Dallas DS1 820) is the temperature sensor itself. The device comes factory-calibrated and delivers tem- perature readings serially over its one-wire bus to pin PI. 3 on the microcontroller. If jumper JP1 (on P3.4) is fitted, the tempera- ture is shown in Fahrenheit. Options LEDs D1 to D4 and their series resistors R2, R3 and R7 are optional and can be dis- pensed with if desired. D1 and D2 show the temperature trend, while D3 and D4 pro- vide a little additional effect lighting to the tubes. D1 and D2 indicate whether it is getting warmer or colder. Red LED D2 lights when the temperature is rising, while blue LED D1 lights when the temperature is falling. If the temperature is steady from one reading to the next, neither LED lights. A temperature reading is taken more than once a second, and so it can happen that the display alternates fairly rapidly between two adjacent values. To make the display less distracting it would be possible to aver- age readings over a longer period: readers are welcome to experiment in this direction as there are a few bytes of program mem- ory to spare, and commented source code can be downloaded at PI free of charge. LEDs D3 and D4 illuminate the Nixie tubes from below, one LED for each tube. Holes are provided at suitable points on the printed circuit board to allow the light through, with the LEDs soldered to the underside of the board, pointing upwards. The brightness of the LEDs can be adjusted by changing the value of R7, and of course 24 01-2011 elektor THERMOMETER Features Display range: Temperature sensor: Power supply: Current consumption: Tubes: Microcontroller: Firmware: Options: 0 to 99 (Celsius or Fahrenheit) Maxim-Dallas DS1 820, accuracy 0.5 l< AC power adaptor, 1 2 V to 1 5 V DC 170 mA at 12 V Russian IN-16, 13-way solder connections Atmel AT89C2051 (available ready-programmed) BASCOM (source and hex files available for free download) Choice of Celsius or Fahrenheit display Tube illumination LED trend (warmer/colder) indicators +180V* _2_ vi Nixie IN16 V2 Nixie IN16 +5V O TCT R1 © DQ DS1820 o CM 12 13 14 15 _9 11 (? 0 1 2 3 4 5 6 7 8 9 IC1 P1.4 AIN1/P1.1 P1.5 P1.2 P1.6 P1.3 P1.7 AT89C2051 P3.4/T0 P3.0/RXD P3.5/T1 P3.1/TXD P3.7 P3.2/INT0 P3.3/INT1 CNJ 0 2 X X O un XI iDi CM O) CO CO CO 1 CM O LT> CO CM a> CO OO CO CM O 1 1 H f— 1 H H H +5V l r> CO O 0 CO LT) CO H O 1 OO o> 1 H H H CM H H CO CD H rH H H H CM O OOOOOOOOOO VCC GND IC3-X 74141 o < CM < CO < 12M H z D5 1N4004 rM CIO lOOu 25V IC6 7805 C9 lOOu 25V +5V o C8 lOOn 8 o SC ^ Cl IC5 IS SE MC34063 C7 100n +180V* O C4 lOu 250 V 090784 - 11 Figure 1 . Simplicity is the watchword: only a few components, no SMDs, and no adjustments. elektor 01-2011 25 THERMOMETER COMPONENT LIST Resistors R1 =4.7ka R2,R3 = 220£1 R4,R5 = 22kft R 6 = 10l<^ R7 = 1 ka R 8 = 1 50£1 R9 = 820 1<^ R10 = 5.6k£l Capacitors Cl = 1 0jiF 63V, radial, 0.1 in. lead pitch C2,C3,C5,C7,C8 = lOOnF ceramic, 0.2. in. lead pitch C4 = 1 0juF 250V, radial, 0.2 in. lead pitch C 6 = 470pF, 0.2 in. lead pitch C9,C1 0 = 1 0OpF 25V, radial, 0.1 in. lead pitch Inductor LI = 330pH, 1 A, axial, DxL = 1 1x32.5 mm max., e.g. Epcos B82500CA8 or Fastron 77 A-331 M-00 Semiconductors D1 ,D3,D4 = LED, 3mm, blue D2 = LED, 3 mm, red D5 = 1 N4004 Figure 2. The easy-to-populate printed circuit board is available from the Elektor Shop. D 6 = BYV26 (e.g. Vishay) T1 = IRF820 (Vishay, International Rectifier IRF820PBF) IC1 = AT89C2051-24PU, programmed, Elek- tor# 090784-41* IC2,IC3 = 74141 or K1 55ID1 (Russian: K155MA1) IC4 = DS1 8S20 (Maxim/Dallas) IC5 = MC34063 IC 6 = 7805 (TO220) Miscellaneous XI = 1 2MFIz resonator, 3-pin, e.g. AEL Crystals type Cl 2M000000L003 JP1 = 2-pin pinheader, 0.1 in. lead pitch (optional jumper, see text) K1 = 2-way PCB screw terminal, lead pitch 5mm VI ,V2 = Nixie tube type IN-1 6 (e.g. Sovtek l/IH-16) PCB # 090784-1 * (artwork free download at [1]) * seewww.elektor.com/090784 or Elektor Shop page. you can select the size and colour of the LEDs as you wish. In the author’s prototype he used blue LEDs, which were particularly effective in the dark in conjunction with the orange glow of the tubes. Unfortunately, the IN-1 6 tubes bought for the Elektor lab prototype came with an opaque grey plastic base, and so it was not possible to recreate the LED illumination effect. Software The software running in the microcontroller was written using the BASCOM 8051 com- piler from MCS Electronics, which includes commands to support the one-wire bus interface. After initialisation of all variables and of the sensor the software runs in an infinite loop fetching a new temperature reading roughly every 750 ms. The value is con- verted to Fahrenheit if required, the frac- tional part is discarded, and the result con- verted to tens and units digits in BCD format to be passed to the Nixie drivers. The read- ing is also stored and used in the next itera- tion of the loop to drive the trend indicators D1 and D2. Despite the simplicity of the software structure, it turned out to be harder than expected to get the timing of communica- tions with the DS1 820 right. The bus must be reset between requests, and the chip must not be disturbed by a request while it is carrying out a measurement. Sometimes a mistimed request can make the chip get into a state where it stops responding alto- gether and must be reset. However, none of this need concern the constructor, who can just use the software downloaded from I 1 ] or a ready-programmed microcontroller from the Elektor Shop. If the temperature should go negative the display will simply show ‘00’ (the minimum reading) and temperatures above 100 °C are displayed as ‘99’ (the maximum read- ing). The display also flashes ‘99’ if the tem- perature sensor is not connected or is faulty. Construction and operation All components apart from the Nixie tubes are fitted to the printed circuit board (Fig- ure 2), which is available from the Elektor Shop. At first, just solder in sockets for IC1 , IC2 and IC3. Take care to check the polarity of the electrolytic capacitors, and in particu- lar of C4, before applying power! Now plug in the mains adaptor, and check that a volt- age of approximately 1 80 V appears across C4 (if R9 is 820 k£l). Take care here with the high voltages, and do not touch the printed circuit board while power is applied. Now allow C4 to discharge and fit the tubes. On the back of each tube, exactly in the cen- tre behind the glass there is a light stripe that indicates pin 1 (see also the datasheet). It can be quite fiddly to thread thirteen wires of identical length through the holes in the board, so it is a good idea to trim the wires to different lengths so that each one is a little shorter than the next, like organ pipes. It is then easy to thread the wires one at a time, starting with the longest. Finally make sure the tube is vertical and solder the connections. Now fit the Nixie driver ICs and the pro- grammed microcontroller in their sockets. When power is reapplied the temperature should appear on the displays. Enclosure The prototype was mounted in a clear acrylic pipe of diameter 80 mm cut to 75 mm in length. This type of pipe is hard 26 01-2011 elektor THERMOMETER f "T* ^ \ H - % to come by in the DIY sheds, but a wide selection of sizes and wall thicknesses is available from online emporia. It is impor- tant to cut the pipe exactly perpendicular to its axis as any unevenness in the end faces will look unsightly, although it is relatively easy to work acrylic by hand using a file or sandpaper. A circular saw is the best way to cut the pipe, but if necessary it can be done by hand, for example using a hacksaw with a fine-toothed metal blade. A U-shaped mitre block of the type intended to help with cut- ting skirting boards makes a good guide for a clean square cut. The side cheeks were made from solid wooden wheels bought from a DIY shop with a diameter of 1 00 mm. A single cut created a flat on the wheel on which the unit stands. It would be possible to paint the side cheeks, or to make them from acrylic sheet with a thickness of around 4 mm. Two holes were made in the pipe, one for a jack socket for the temperature sensor and the other for the power socket. The side cheeks were each drilled for two M3 screws at exactly the right height for the fixing bracket, which must be threaded on at least one side. Figure 3. The prototype board populated and tested in the Elektor labs. Of course, the thermometer can be used for other purposes too, such as measuring the temperature inside another device (perhaps that tube amplifier you have alongside it?). Internet Link [1 ] www.elektor.com/090784 (web pages for this project) Next the sockets were wired to the appro- priate points on the printed circuit board for the sensor and power supply, and the assembly slid into the pipe. The side cheeks were screwed to the interior brackets from outside using M3 screws. The board is now suspended between the two side cheeks, which in turn are fixed to the acrylic pipe. With a little judicious twisting of the assem- bly things can be arranged so that the board is inclined upwards, making it easier to see the Nixie tubes from slightly above. Because of the heat generated by the tubes and the voltage regulator it is not practical to mount the temperature sensor on the board or inside the enclosure. To measure the ambient temperature, place the sensor away from the device on the end of a cable. Conclusion The circuit generates high voltages inter- nally, and so it is important to use an insu- lating enclosure with no exposed metal parts. Nylon screws and insulating sockets should also be used, or alternatively the mains adaptor and the temperature sen- sor can be connected permanently using well-insulated wires with suitable strain relief and grommets for the holes in the enclosure. The connections to the DS1 820 should also be insulated, or the whole sen- sor assembly can be enclosed in heatshrink tubing. The reward for all this effort is the pleasure of seeing warm orange, occasion- ally flickering digits lighting up your living room! (090784) Design Resources www.atmel.com/atmel/acrobat/doc0368.pdf (AT89C2051 datasheet) http://datasheets.maxim-ic.com/en/ds/ DS1 8S20.pdf (DS1 820 datasheet) http://www.tube-tester.com/sites/nixie/data/ in16.htm (information on the IN-1 6 tube) http://gadget.mda.or.jp/pdf/K155ID1 (K1 55ID1 datasheet) www.onsemi.com/pub_link/Collateral/ MC34063A-D.PDF (MC34063 datasheet) www.die-wuestens.de/ (Nixie tubes and drivers) elektor 01-2011 27 ATMi8 Flight Data Recorder For hikes and rides too Your Captain: Gregory Ester (France) No need for a piggy-back board any more — the ATM18 module takes to the air to give you a whole heap of very useful information recorded during your flight in a radio- controlled plane. Are you ready? Well, fasten your seatbelts, we’re about to take off. Welcome aboard flight ATM18 in the company of Elektor! So you haven’t actually got your pilot’s licence yet, even though you know how to fly a Cessna or a Big Lama? When a curious passer-by shyly enquired: “What speed does your little plane fly at?” my off-the-top-of- my-head answer was received with a certain degree of scepticism. In this sort of situa- tion, the project described here may be of interest to you. Measuring the speed The MPR-AIR-V3 detector consists of a Pitot- static tube and allows us to measure the speed of any craft moving in the air, as long as the plane doesn’t go over 563 km/h... Version 3 of this module also lets us display the result directly on the PCB via a 7-seg- ment display. The electronics PCB weighs 4 g and the Pitot tube 3 g, and the resolution (step size) is 1 .6 km/h (1 mph). The supply voltage must be at least 3 V and must not exceed 1 6 V. The whole thing is factory-calibrated and temperature-compensated. The two silicone tubes connect the probe to the electronics board, as is clearly shown in Figure 1 . The holes on the Pitot probe must be positioned at least 13 mm clear of the leading edge of the wing, so as to avoid any disturbance to the measurement. Of course, the nose of the aircraft would be the ideal place for the probe, but as you’ll already have realized, it’s not a jet we’re flying here, and so we need a propeller to push the air behind our nice plane. Once all the elements have been positioned, it’s a very good idea to glue or firmly fix the silicone tubes and the probe in place in order to immunize them against any vibration. Measuring the altitude The MPR-ALT-V3 detector is an altimeter (weighing in at just 4 g!) that uses atmos- pheric pressure to measure the altitude. It too is factory-calibrated and tempera- ture-compensated. The maximum altitude reached can be directly read on the PCB via a 7-segment display. That’s certainly handy, but it’s not what we’re really interested in here. The maximum altitude that can be meas- ured is 1 0,000 ft... No, you’re not dream- ing: there really are four noughts after the ‘1 ’ — equivalent to 3,048 m! So which of us is going to fly their plane the highest in the sky? The competition is open! The PCB can be installed wherever you like in the plane. The hole for detecting the air pressure must be perpendicular to the direction of flight. If the detector is enclosed, a small silicone tube can be used, brought out flush with the fuselage. The resolution (step size) is 4 ft (1 .2 m), and the supply voltage must be a minimum of 3 V but must not exceed 1 6 V. Just a word about the single-digit display when used stand-alone (i.e. without the project described here); an example may help. The circuit is powered up, and the plane flies off. Our Wizz plane (Figure 4) has reached an altitude of 328 ft (around 100 m). When it returns to the ground, all you have to do is look at the lone digit, which will display, for example (in feet) 3 then 2 then 8 then blank, then once again 3-2-8, and so on. The maximum value reached and stored will be reset when the module is powered down. In this mode, you can select either the imperial system (feet) or the metric system (metres) by wire- strapping or jumpering the brown and yel- low pins. At start-up, if the figure that blinks is a ‘O’, the reading will be in imperial units; 28 01-2011 elektor ATMi8 Figure 1 . The MPR-AIR-V3 module with its Pitot-static tube. Figure 2. The flight data recorder PCB with connector references. if it’s a ‘1’, in metric. It’s worth pointing out that the Eagle Tree data sheets are extremely clearly and thor- oughly written. This is an important > factor, as the technical documen- tation, closely followed by the appli- cation notes, is the sole link between the product and the end user! What’s more, it’s best to go directly to the manufactur- er’s website I 1 ] so you can download the lat- est version. Watch out: there’s an l 2 C about! We’re going to be using both Eagle Tree modules in l 2 C mode, but to do this we need to ‘unblock’ them using the eLogger 8.63 application in association with the eLog- ger V3 module. But don’t worry, ^ you won’t have to fork out for this module, all you need do is to state clearly in a note with your order that you want the “l 2 C mode unblocked detector” and Alexandre at Studiosport, France I 2 ] will prepare your order accordingly. The flight data recorder board... ...is based on the use of the EM-406A GPS receiver, the VDRIVE1 or 2 from Vinculum, and our two Eagle Tree detectors (Fig- ure 2). In the centre is the ATM1 8 module without its mother board. The data recorder circuit diagram (Figure 3) comprises above all connectors, so you’ll need to identify these before you can make the intercon- nections with the peripherals: • K1 : 5 V DC V| N . FI and D1 together pro- tect our recorder against power-supply reversal. The ratings for the diode and the fast-blow fuse should be chosen according to the power supply being used. • l<2: ISP connector. • All the pins of the ATM1 8 module are brought out to l<3, l<4, l<5, and l<6. So this featherweight board (just 53 grams) can also be used as a universal develop- ment board! • K7:VDRIVE module. • l<8: EM-406A GPS module. Pin 6 is brought out to l<9. • K12: 1 (GND-Eagle), 2 (VCC-Eagle), 3 (PB1 -SDA_Eagle), 4 (PC2-SCL_Eagle). Pins 5-1 0 are not used. All K1 2’s con- tacts are brought out on K1 0 and K1 1 . Jumpers JP3 and JP4 enable use of the LEDs D2 (orange, 0) driven from PC4 and D3 (yellow, Y) driven from PC5, respectively. These are useful for displaying informa- tion about our system; the orange LED indicates power-on reset (file set-up and marker writing) and the yellow LED lights during recording. So it’s best not to remove the USB key while these LEDs are lit. Note too that it’s best to plug in the key before powering up the circuit. Jumper JP2 offers an optional reference volt- age for the ADC and JP1 allows the micro- controller to be restarted (reset). The microcontroller’s PB2 port lets us choose the mode for the data recorder. If the port is left floating, the circuit operates as a flight data recorder. If PB2 is connected to 0 V, it goes into RDR mode (see below). For flight data recorder mode operation: 1 . Connect up the four wires from our two Eagle detectors: ground to K1 2(1 ), 5 V to K1 2(2), SDA to K1 2(3) and SCL to l<1 2(4) 2. Apply power 3. Program the microcontroller using the 70_WIZZ_RIDE_DATA_RECORDER soft- ware I 5 ! elektor 01-2011 29 ATMi8 Vcc Vqc Vcc Figure 3. The circuit diagram consists almost entirely of connectors. Recording format The “WDR.TXT” file created at start-up is going to contain all the data collected from the detectors. Below is an example of the file contents: WDR — > 'k'k'k-k'k'k-k-k'k'k-k-k'k'k-k-k'k'k-k-k'k'k'k UTC : 15hl6m04 .000s LAT : 4 6Deg2 1 ' 3 9.4' 'N LON: 0 0 6Deg2 8 ' 45 . 5' ' E SAT: 06 SIGNAL: 1 ALT : 495 . 5M 0 . kmh 0 . m 'k'k'k'k'k'k-k'k'k'k'k'k'k'k'k'k'k'k'k'k'k'k'k UTC: 15hl 6m20 .000s LAT : 4 6Deg2 1 ' 39.6' ' N LON: 006Deg28' 45 . 4' 'E SAT: 09 SIGNAL: 1 ALT : 476 . 5M 0 . kmh 0 . m The first line tells us that the system is configured in flight recorder mode (WDR = Wizz Data Recorder), the marker “WDR->” is written into the file each time the system is powered up afresh. The universal time (UTC), the latitude, longitude, and the number of satellites used to calculate the values are collect- ed, along with the altitude, by means of the EM-406A GPS receiver. The last line corresponds to the plane’s speed and altitude. At power-up, these values are 0. 4. Power down 5. Plug in the USB key, then power the whole thing up again. The microcontroller’s PC0 port lets you select the units. If the port is left floating, the speed will be in km/h and the altitude in metres, while if PC0 is connected to 0 V, the speed will be in mph and the altitude in feet. GPS The GPS module incorporates GlobalSat’s EM406-A device with built-in antenna. Of course, there’s nothing to stop you using another GPS receiver, or even your own GPS/EIA-232 module using bipolar NRZ (non return to zero) coding, interfaced using the well-known MAX232 device or an equivalent. Pins 1 and 5 of our EM406-A module are connected to ground, while pin 2 is con- nected to the 5 V rail. Pin 4 is connected to the input of an inverter, which is in turn connected to another inverter and thence to PD0. This is necessary, as the high level output from the EM406 (2.85 V) is lower than the minimum high threshold of the PD0 input (V,H = 0.6 x V cc with V cc = 5 V, i.e. 3 V minimum for the PD0 input to be regarded as ‘High’). So without the pres- ence of 74LS04, the UART would never receive anything at all. The use of six satellites for the data calcu- lation ensures very acceptable accuracy. Recording of this data will only begin once this condition has been verified; the data from the Eagle detectors, on the other 30 01-2011 elektor ATMi8 Carry out testina before aona airborne! In order to test the modules before making the final connections to the flight data recorder, we’re going to use the Minimodi 8. Minimodi 8 is the big sister of ATM 18, let’s recall its specifications: • Ideal size, at 8o x 25 mm, and weighing 27 g. Do not take photos while flying! its ATmega328P-AU controller. • An elephant’s memory: 32 l’. Print #2 , "OPW WDR.txt" + Chr (13) ; Print #2 , "WRF " ; "8" + Chr (13); Print #2 , "WDR — >"; Print #2 , Chr (13) ; Chr (10); Print #2 , "CLF" + Chr (13); To be able to control our module by send- ing it ASCII commands, the first operation involves modifying the file named “firm- ware” — and I did say just “the file”. To do this, we’re going to use the Vinculum Firm- ware Customiser VI. 1 b software plus the file VNC 1 L firmware V 3 . 68 ! 3 ]. In the options, you’ll need to be careful to select IPA Mode ASCII a nd Ext Command Set Mode and check LEDs Flash at Power-on. After giving the file containing the new configuration a new, customized name, click Write then Finish to conclude the procedure. You will be asked for a firmware code (you can just enter “ 123 ”, for example). At this stage, all you now need to do is load the file containing the new configuration, i.e. your new firmware that you have just customized. For this action, we’ve con- nected the VDRIVE module directly to a USB on the PC using FTDI’s USB/TTL- 223 R serial converter, having first fitted the jumper CN4 or J4 as shown in Figure 5. Once the firmware has been loaded using the VPROG VNC 1 L- 1 A Flash Programmer software and the jumpers have been put back into their original positions, the VDRIVE t 7 l module is ready to be incorporated into our project. Ride/ hike data recorder By now you might be wondering about the purpose of the RDR mode. If you like hiking, and like the author never quite know which way to fold your map up, the following may be useful. elektor 01-2011 3 i ATMi8 Figure 4. The flight data recorder has been tailor-made for the Wizz Kl. After each hike, you carefully note down your impressions of the walk on a note that you put away more or less carefully in the right drawer with the reference of the cor- rect large-scale map, onto which you have Figure 5. VDRIVE2 & VDRIVE1 . more or less approximately pencilled the route taken. Ideally, of course. Now, the Ride Data Recorder (RDR) is the state of the art, paperless equivalent of it all. A battery + a 5 V switch-mode Battery Elimi- Figure 6. A nice little walk. nator weighing 1 2 g + the RDR + some choc- olate or a few muesli bars + a bottle of water in the backpack and we’re off! Don’t forget your walking shoes! Given that the circuit in this configura- tion draws an average current of around 200 mA, you’ll be able to do a quick calcu- lation to choose a battery capacity to suit the duration of your hike. All you have to do to enable the RDR mode is connect the DR_MODE pin (PB2) to ground. For as long as the USB key is plugged into the VDRIVE, a RDR.TXT file receives only the RMC frames sent from the GPS module. In order to be able to plot the route corre- sponding to these frames, all you have to do is unplug the USB key and convert the RDR.TXT file into the KML format using the NMEA2KML software I 6 !. With Google Earth already installed, you can then run the file in KML format. The result is then displayed graphically (Figure 6). Create a folder bearing the name of your hike, for example “Mont Blanc 2010”, and copy/paste the KML file there. All that then remains is to use a word-processor to write down your impressions. All stored in the same place, in the same directory. You’re now a thoroughly modern hiker! And it works for railroad journeys too! (100653) Internet Links [1] www.eagletreesystems.com [2] www.studiosport.fr (Eagle Tree modules, contact Alexandre) [3] www.ftdichip.com/Firmware/ Precompiled.htm [4] www.model2a.com [5] www.elektor.com/ 1 00653 [6] thomaspfeifer.net/ g ps_ro ute_co n verter. h tm [7] www.ebconnections.com (supplier for VDRIVE) 32 01-2011 elektor DESIGNSPARKPCB LET YOUR CREATIVITY FLOW The World’s Most Powerful Free Schematic and PCB Layout Tool is yours to download now Free from practical design limitations on board area, layers and pin counts, DesignSpark PCB generates industry standard manufacturing files. Key features such as the New Component Creation Wizard, the ability to import designs and libraries from Eagle, import dxf files for complex board shapes and interfaces with 3D CAD tools speed up design cycles. With a modern and intuitive user-interface the software is easy to learn and easy to use. WIRED BY Download your free copy at www.designspark.com/pcb ENERGY SAVING TIPS Energy Saving Tips (some less serious) Wind it up The best energy saving device 1 can think of has been on the window sill in our kitchen for many years now: the Freeplay radio. It has a large, transpar- ent blue enclosure with a crank on the back (twenty turns of the crank gives it enough energy for a cooking session) and a solar cell. This device is based on an original design by Trevor Baylis, which is now available in many different forms. He intended it to be used in regions and countries where electrical power and information are scarce. Sadly enough, the situation has not changed significantly since then. The nicest thing about this radio is the surprises. It always stops by itself when the energy from the winding crank is exhausted or there isn’t any sunlight, and of course it also starts playing by itself, often when you least expect it. For many years this radio was the first her- ald of spring; it spontaneously started playing a cheerful tune when the sun rose higher and peeked around the corner of the window. My tip: instead of using batteries, try using a wind-up or motion-powered device. / ^ U> ^ause ^ ' /StJV,n 9 resources The ‘LED OFF’ tip Almost every circuit has a power-on LED. This LED is always on, even if we don’t care. The charger of my electric toothbrush for instance has such an LED; it is always on, but I only look at it when I replace my toothbrush (three times a day of course). My router/modem and Wi-Fi access point both have several LEDs shining brightly 24 hours a day without anyone around to look at them. Each of these LEDs consumes probably 1 0 mA, the default current that most designers force out of habit through an LED. There are two ways to save energy here. First of all, stop passing 10 mA through an LED, often 2 mA or even less is more than enough. How often do you need to look at it in bright sunlight? That’s right, hardly ever. The second way to save energy is simply to stop using LEDs everywhere. Or, if you really want one, put a pushbutton in series with it so that it will only light up when you press the button. Another way would be to use LEDs to indicate fault conditions only. Indicator on demand, that’s all you need. 4 •if 1 'k IT Energy awareness How about marking each switch with a sticker showing the estimated annual electricity consumption and cost? And of course, this sort of sticker should be mandatory for all AC power adapters. 34 01-2011 elektor ENERGY SAVING TIPS Just do it The laws of physics tell us that every action causes an immediate reaction. This also ap- plies to energy costs: it’s easy to start reducing your electricity consumption. For example, systematically de-energising (unplugging) all devices with a standby operat- ing mode can save the average household more than 50 pounds per year. Kill standby power consumption Make a list of all the devices powered from the various distribution circuits in your house. When you leave home for an extended peri- od, use this list to switch off the circuits that power devices that don’t need to be left on. Naturally, you should leave the alarm system, the refrigerator and the freezer on, but you can prevent ‘hidden’ energy consumption for standby power by sim- ply flipping the switch for the other de- vices. This can yield significant savings, especially with long journeys. Convert your car to run on hydrogen A conversion kit for cars so they can run on hydrogen generated in an environmentally friendly manner (such as from solar energy or wind energy). If you think this is all wish- ful thinking, you should have a look at the website listed below (using your energy-effi- cient computer, of course), http://www.switch2hydrogen.com/ Digital photo frame with motion sensor Digital photo frames are becoming more and more popular. Prices have dropped dra- matically in the last while; now you can pick up a nice digital photo frame now for just a few dozen pounds. It also looks quite attractive in your living room or bedroom. The photo frame displays the pictures you have stored in its memory, periodically changing to a new picture. That’s a lot nicer than an old-fashioned photo frame with an unchang- ing paper print. However, a digital photo frame requires a constant source of electricity - usually from the AC power grid. A relatively large model consumes a good deal of power, mainly for the background light. Who switches it off when nobody is in the room? Most likely no- body; you might think to do this before going to bed. Accordingly, it wouldn’t be a bad idea to link a motion sensor to a digital photo frame so it doesn’t go on unless someone comes near it. An ordinary motion detector, such as the types sold by electrical shops or DIY home improvement centres, could be used for this. Plug the AC adapter of the photo frame into the motion detector and you’re all set. You should adjust the sensor time setting so the photo frame does not constantly go on and off, and you need a photo frame that can be configured to start showing photos right after it is switched on, instead of ending up in some menu state. There is also a manufacturer that recently introduced a digital photo frame with a built-in motion sensor: http://www.nix-digital.com/ elektor 01-2011 35 ENERGY SAVING TIPS Mind your maintenance Postponed maintenance (or worse yet, no maintenance) of equipment causes lower efficiency or degraded performance. This leads to higher electricity consumption, and therefore to higher energy expenses. For this reason, you should defrost your freezer periodically. When you buy a new freezer, select a model with automatic defrosting. Even coffee machines, electric kettles and washing ma- chines need maintenance when the heating element becomes covered with lime or scale deposits. This significantly increases how long it takes to heat the water, so the devices use much more energy. This can easily be corrected with a simple descaling product. The ‘Pull the plug on DECT phone’ tip The AC power plug, that is. Most DECT phones, both base and ex- tension, are in their charger cradle which is wasting energy big time through the standby current of the wallwart adapter and the continu- ous trickle charging of the phone’s batteries. Both are unnecessary. In especially bad cases, the AC power adapter block is a traditional linear power supply that’ll easily waste 2 watts of power all the time, just touch it if you’re not convinced. Make sure the phone’s battery is fully charged, then unplug the adapter. From time to time, in- spect the battery symbol on the phone, if it’s any good it will tell you when charging is due — again. My own Philips Kala DECT base phone easily lasts four days on a single charge and an average of two 1 0-minute calls a day and one short battery test by briefly ringing an extension and watching the BATT symbol. It’s got two dead standard 650-mAh NiCd batteries fitted. Work out your personal average for the week and allow headroom to make sure there’s always enough battery capacity when the CEO phones late at night with good news. Apply stochastically distributed charging between DECT stations, that way a phone will always ring and the worst that can happen really is a short climb up the stairs to answer a call. Your health as well as that of the batteries will benefit, not forgetting the advantage of having an AC outlet free for, say, an electric kettle. The ‘Make your cellphone charge last longer’ tip It’s a little known fact that the transmitter in your mobile phone employs stepped RF output power to save battery energy. In essence, the stronger the signal received from the cellphone mast, the lower the radiated energy required on the phone to set up two-way communication. A fine sys- tem ignored by but most people who will phone away till the battery goes flat. By contrast, those with the keenest sense of energy savings and wishing to make a call, will first sight the nearest cellphone mast (if necessary, using optics) and walk or drive to it to effectively reduce the dis- 36 01-2011 elektor ENERGY SAVING TIPS tance and so enable the call to be made at the lowest battery load. The savings are enormous, and the reward is increased peace of mind on the environment. I may be overlooking something but just can’t put my finger on it, must be I’m not using my mobile too often. Advertisement THE ORIGINAL SINCE 1994 PCB-PniL Servicing Your complete PCB prototype needs. 8 hour prototype service * 5 SFm 1 mm material now available Free Laser SMT Stencil with all PCB prototype orders Email: 5ale$@pcb-pool.com Free Phone UK: 0800 389 8560 1 1 REFLOWJUI www.pcb-pool.com Now available: Tools and accessories for prototype PCB assei www.reflow-kit.com Supported File Formats P‘Ci:\?OOS I jtf-ni Ora J i L» 1 1 J l-~ Cjiiy.PG; PULSQNIK N— elektor 01-2011 37 MICROCONTROLLERS All-Soft-555 ATtiny plays 555 MMV and AMV By Dr. Thomas Scherer (Germany) The chip with three fives in its type code sure is among the biggest selling ICs of all times but from today’s perspective the internal block diagram certainly looks a little dated with its multitude of analogue signal paths. Can you imagine, we’re even expected to calculate the value of external components and solder real resistors and capacitors to make the thing work! What’s more, it isn’t really that flexible. We give the design a 21 st Century makeover to produce a much more versatile ‘virtual 555’ using an 8-pin microcontroller. While modifying the motor controller of my electric bike I came to the conclusion that the design would benefit from an additional monostable multivibrator (MMV, mono- flop). I knew I had a good supply of all the various incarnations of the 555 timer chip in my workshop. The monostable however needed to be retriggerable and the 555 can only manage that with the help of some extra circuitry. One good feature of the 555 is how little board space it occupies. With space at a premium the extra cir- cuitry was making the 555 solution look a little less appealing. Maybe a CD4098 monostable from the digital CMOS 4000 series would be an alternative but this is a 1 6-pin device making it twice as big as the 555 even before you start adding the exter- nal components. After a fruitless search for a CD4098 and much head scratching I came up with this solution called the All- Soft(ware)-555’. This would be a digital equivalent of the generic 555 timer chip built into an 8-pin microcontroller. All of its operational characteristics are programmed in software and no additional external com- ponents are necessary. Pick a controller There are now any number of small pow- erful microcontrollers on the market from several different manufacturers. The author found some ATtiny25 PI, ATtiny45 and ATtiny85 AVR microcontrollers in a drawer and thought they might just be up to the job. In addition to having the correct num- ber of pins (in the DIL versions) they also contain a hardware timer and an A/D con- verter, what more could he possibly need? The only difference between the three con- trollers is the 2, 4 or 8 KByte flash (and RAM / EEPROM) capacity. BASCOM_AVR from MCS-Elektronik is a simple but effective BASIC compiler for software development for these microcon- trollers. The author experimented using both machine code and compiled routines to generate the time intervals and found that there was no discernable disadvan- tage using the compiled code. What’s more there is a download link on the page of the Elektor website for this article I 2 1 where the free demo version of BASCOM-AVR can be downloaded. The only restriction on its use is the size of the finished code cannot be greater than 4 KBytes. This is ample for the project’s firmware, including any foresee- able system expansion. Better than the original The conventional 555 I 3 ] can in principle be configured as either a monostable or asta- ble multivibrator. The pulse timing is both stable and relatively unaffected by changes of the supply voltage. As a monostable it can generate pulses from a few microsec- onds long up to hundreds of seconds. As an astable it can go from a few hundred kilo- hertz down to a few millihertz. Any digital implementation of a 555 should also be able to at least match this performance. Despite its popularity the conventional 555 has always had a number of disadvantages: • it requires external components. • the monoflop isn’t retriggerable. • the trigger input only responds to nega- tive-going pulse edges. • calculating the multivibrator duty cycle is not straightforward. It isn’t necessary of course to incorporate all the 555’s shortcomings in our ‘micro- 38 01-2011 elektor MICROCONTROLLERS controller’ 555 variant. The function of the multivibrator is now configurable under software control. The active trigger edge and other finer points of operation can be changed in the firmware (see ‘Features’). Memory capacity would be a problem if all the multivibrator functions were incor- porated into one program particularly for the smallest variant microcontroller. In any application the All-Soft-555 will be used as either a monostable or astable multivibra- tor so it is sensible to divide the firmware along these lines also. The two programs are called iMono and iMulti, accepting that the latter name sounds good rather than striving for technical accuracy (both pro- grams emulate a multivibrator). Physical pin to pin compatibility with the original 555 is however not possible: The ATtiny uses pin 4 as ground while the 555 uses pin 1 , and for other reasons we have not kept to the original pinouts. MMV program iMono The pinouts for the monoflop shown in Fig- ure 1 are fairly conventional. When the All- Soft-555 is used in an application requir- ing precise and/or narrow pulses a crystal can be fitted between pins 2 and 3. Inher- ent parasitic capacitance of the crystal usu- ally means that the (1 0 pF to 1 5 pF) load- ing capacitors at either end of the crystal to earth can usually be omitted thereby cutting down on the external component count. For the majority of applications the 8 MHz and 1 28 kHz internal oscillator will suffice. Tests by the author indicate that you can expect the uncalibrated frequency to be within 1 0 %. Pin 7 is the trigger input while Pins 5 and 6 are the normal and inverted outputs respectively. Comments in the iMono source code indicate exactly which values need to be changed to tailor the behaviour of the pro- gram to your requirements. The firmware will not accept any invalid parameters. The user can choose anyone of three operating modes: • - not retriggerable • - retriggerable • - extended Features MMV (iMono) features • Digital, configurable monostable multivibrator • Three modes: non retriggerable, retriggerable and extended pulse • Programmable trigger edge: falling or rising • Non inverting and inverting outputs • Pulse width from o.8 ps to 524 s • Documented source code in BASIC iMono E RESET VCC 3 [I XTALl TRIGGER E XTAL2 OUT- 11 E GND OUT+ a ATtiny25 Figure 1 . Pin assignments of an ATtiny25 used and programmed as a monostable. In the last mode the trigger input extends the selected monostable pulse width. The following characteristics can be pro- grammed in software: • trigger edge: rising or falling. • ticks: 2 to 255 or 1 to 256 timer ticks • clock prescaler: 1/2/4/8/16/32/64/256 • timer prescaler: 8/64/256/1024 • oscillator type: internal/external The ATtiny25 has only an 8-bit timer so it can count from 1 to 256 timer ticks. An extra prescaler divides down the oscillator to produce the effective clock frequency (f ef f). The timer has a prescaler which in turn is driven by the effective clock. The output pulse length is therefore given by: Pulse length = ticks x clock prescaler x timer prescaler / clock Using the 8 MHz oscillator and a clock prescaler of 8 we get an f eff of 1 MHz. The AMV (iMulti) features • Digital, configurable astable multivibrator • Four modes: Fast, Fixed value, VCO and VCDC • Gate input defined in software either active High or Low • Waveform true or inverted • Frequency adjustable by software or control voltage • Duty-Cycle adjustable by software or control voltage • Frequency range 10 MHz to 1.91 MHz • Documented source code in BASIC iMulti E RESET VCC a E XTALl cv E XTAL2 OUT a E GND GATE a ATtiny25 Figure 2. Pin assignments of an ATtiny25 used an programmed as an astable. timer prescaler is set to 1024, counting 98 ticks to give a pulse length of: t = 98 x 1 024 x 8 / 8 MHz = 1 00.352 ms This produces a reasonably accurate 1 00 ms MMV pulse although the accuracy of the internal oscillator cannot be guar- anteed. Table 1 indicates the achievable pulse lengths using combinations of the four parameters. The first column in ital- ics using a timer prescaler of 8 does not produce precise results and because of its limited processing power can only count a minimum of two ticks ratherthan one as in the other cases. AMV program iMulti Pinouts on the iMulti astable mode are shown in Figure 2. They are not the same as the monostable version and reflect the different roles the two versions perform. An external crystal can again be connected to pins XTAL1 and XTAL2 when a higher elektor 01-2011 39 MICROCONTROLLERS Table 1 . All-Soft-555, MMV mode Select the desired pulse width for the MMV program. The values in italics with a prescale of 8 have limited accuracy. 20 MHz external Ticks: 2 256 1 256 1 256 1 256 Clockdiv feff(Hz) Delay Prescale: 8 Prescale: 64 Prescale: 256 Presc.: 1024 1 20 M 0.5 (is 0.8 (is 102 (is 3.2 (is 81 9 (is 1 2.8 (is 3.28 ms 51 .2 (is 13.1 ms 2 1 0 M 1 (IS 1 .6 (is 205 (is 6.4 (is 1 .64 ms 25.6 (is 6.56 ms 102 (is 26.2 ms 4 5 M 2 JLLS 3.2 JLLS 410 (is 1 2.8 (is 3.28 ms 51.2 (is 13.1 ms 205 |LLS 52.4 ms 8 2.5 M 4 (is 6.4 (is 81 9 (is 25.6 (is 6.56 ms 102 (is 26.2 ms 410 (is 105 ms 16 1 .25 k 8 (is 1 2.8 (is 1 .64 ms 51.2 (as 13.1 ms 205 (is 52.4 ms 819 (is 210ms 32 625l< 16 (is 25.6 (is 3.28 ms 102 (is 26.2 ms 410 (is 105 ms 1 .64 ms 419 ms 64 312.5I< 32 (is 51.2 (is 6.56 ms 205 (is 52.4 ms 819 (is 210ms 3.28 ms 839 ms 128 156.25 k 64 (is 102 (is 13.1 ms 410 (is 105 ms 1 .64 ms 419 ms 6.56 ms 1.68 s 256 78.125l< 1 25 (is 205 (is 26.2 ms 819 (is 210ms 3.28 ms 839 ms 13.1 ms 3.36 s 8 MHz internal Ticks: 2 256 1 256 1 256 1 256 Clockdiv feff(Hz) Delay Prescale: 8 Prescale: 64 Prescale: 256 Presc.: 1024 1 8 M 1 .2 (is 2 (is 256 (is 8 (is 2.05 ms 32 ILLS 8.19 ms 128 ILLS 32.8 ms 2 4 M 2.3 jits 4 (is 51 2 (is 16 (is 4.10 ms 64 (is 1 6.4 ms 256 ills 65.6 ms 4 2 M 4.5 (is 8 JLLS 1 .02 ms 32 (is 8.19ms 128 (is 32.8 ms 512 (is 131 ms 8 1 M 9 (is 1 6 (is 2.05 ms 64 (is 1 6.4 ms 256 (is 65.6 ms 1 .02 ms 262 ms 16 500l< 1 9 (LIS 32 (is 4.10 ms 1 28 JLLS 32.8 ms 512 (is 131 ms 2.05 ms 524 ms 32 250 k 38 jus 64 (is 8.19 ms 256 (is 65.6 ms 1 .02 ms 262 ms 4.10 ms 1.05 s 64 125k 75 (Lis 128 (is 1 6.4 ms 512 (is 131 ms 2.05 ms 524 ms 8.1 9 ms 2.10s 128 62.5 k 1 50 (is 256 (is 32.8 ms 1 .02 ms 262 ms 4.10 ms 1.05 s 16.4 ms 4.19 s 256 31.25l< 300 (is 51 2 (is 65.6 ms 2.05 ms 524 ms 8.20 ms 2.10s 32.8 ms 8.39 s 128 kHz internal Ticks: 2 256 1 256 1 256 1 256 Clockdiv feff(Hz) Delay Prescale: 8 Prescale: 64 Prescale: 256 Presc.: 1024 1 128l< 80 (is 1 25 (is 1 6 ms 500 (is 128 ms 2 ms 512 ms 8 ms 2.05 s 2 64l< 160 (is 250 (is 32 ms 1 ms 256 ms 4 ms 1.02 s 16 ms 4.10 s 4 32l< 320 (is 500 (is 64 ms 2 ms 512 ms 8 ms 2.05 s 32 ms 8.19s 8 16l< 640 (is 1 ms 128 ms 4 ms 1.02 s 16 ms 4.10 s 64 ms 16.4 s 16 8I< 1 .25 ms 2 ms 256 ms 8 ms 2.05 s 32 ms 8.19s 128 ms 32.8 s 32 4I< 2.5 ms 4 ms 512 ms 16 ms 4.10 s 64 ms 16.4 s 256 ms 65.5 s 64 2I< 5 ms 8 ms 1.02 s 32 ms 8.19s 128 ms 32.8 s 51 2 ms 131 s 128 1 k 10 ms 16 ms 2.05 s 64 ms 16.4 s 256 ms 65.5 s 1.02 s 262 s 256 500 20 ms 32 ms 4.10 s 128 ms 32.8 s 51 2 ms 131 s 2.05 s 524 s or more exact output frequency is called for. The two internal oscillators producing 8 MHz and 1 28 kHz should be suitable for the majority of applications. These alone allow operation up to 4 MHz which a conventional 555 can only dream of. Pin 5 is a gate input, used to turn the output signal on and off. The square wave output signal is produced from pin 6. The CV input on pin 7 should be a DC voltage in the range of 0 V to Vcc. It can be used to either control the output signal frequency by more than one octave or vary the mark/space ratio of the output signal in the range from 1 to 99 % (frequency modulation and PWM). Altogether the AMV program (iMulti) has four operating modes: • fast: high frequency with a 50:50 square wave output. • fix: Frequency and duty cycle adjustable in software. • VCO: Frequency via CV (1 :2.56) with the duty cycle adjustable in software. • PWM: Duty cycle via CV (1 to 99%) with the frequency adjustable in software. 40 01-2011 elektor MICROCONTROLLERS Table 2. All-Soft-555, AMV mode Output frequency selection of the AMV program. Ticks of less than 100 can only be used if it is running in fast mode. 20MHz Ticks: 2 100 256 2 100 256 2 100 256 2 100 256 2 100 256 Cl.div f eff (Hz) Prescale: 1 (Hz) Prescale: 8 (Hz) Prescale: 64 (Hz) Prescale: 256 (Hz) Presc.:i024 (Hz) 1 20 M 1 0 M 200l< 78.1 k 1 .25 M 25l< 9.77 l< 156l< 3.13l< 1.22l< 39.1 k 781 305 9.77 l< 195 76.3 2 1 0 M 5 M 100l< 39.1 k 625l< 1 2.5 k 4.88 k 78.1 k 1.56l< 610 19.5I< 391 153 4.88 k 97.7 38.1 4 5 M 2.5 M 50l< 19.5I< 313l< 6.25 k 2.44 k 39.1 k 781 305 9.77 k 195 76.3 2.44 k 48.8 19.1 8 2.5 M 1.25 M 25l< 9.77 k 156l< 3.13l< 1 .22 k 19.5I< 391 153 4.88 k 97.7 38.1 1.22l< 24.4 9.54 16 1 .25 l< 625l< 12.5I< 4.88 k 78.1 k 1 .56 k 610 9.77 k 195 76.3 2.44l< 48.8 19.1 610 12.2 4.77 32 625l< 313l< 6.25 k 2.44l< 39.1 k 781 305 4.88 k 97.7 38.1 1 .22 k 24.4 9.54 305 6.1 2.38 64 312.5I< 156l< 3.13l< 1 .22 k 19.5I< 391 153 2.44 k 48.8 19.1 610 12.2 4.77 153 3.05 1.19 128 156.25 k 78.1 k 1.56l< 610l< 9.77 k 195 76.3 1.22l< 24.4 9.54 305 6.1 2.38 76.3 1.53 596 m 256 78.125l< 39.1 k 781 305l< 4.88 k 97.7 38.1 610 12.2 4.77 153 3.05 1.19 38.1 763 m 298 m 8MHz Ticks: 2 100 256 2 100 256 2 100 256 2 100 256 2 100 256 Cl.div f eff (Hz) Prescale: 1 (Hz) Prescale: 8 (Hz) Prescale: 64 (Hz) Prescale: 256 (Hz) Presc.:i024 (Hz) 1 8 M 4 M 80 k 31.3 k 500 k 10l< 3.91 k 62.5 k 1 .25 k 488 1 5.6 k 313 122 3.91 k 78.1 30.5 2 4 M 2 M 40 k 1 5.6 k 250 k 5k 1 .95 k 31.3 k 625 244 7.81 k 156 61 1.95 k 39.1 15.3 4 2 M 1 M 20 k 7.81 k 125 k 2.5I< 977 15.6 k 313 122 3.91 k 78.1 30.5 977 19.5 7.63 8 1 M 500 k 10 k 3.91 k 62.5 k 1.25l< 488 7.81 k 156 61 1.95 k 39.1 15.3 488 9.77 2.81 16 500 k 250 k 5I< 1 .95 k 31.3 k 625 244 3.91 k 78.1 30.5 977 19.5 7.63 244 4.88 1.91 32 250 k 125 k 2.5I< 977 1 5.6 k 313 122 1.95 k 39.1 15.3 488 9.77 2.81 122 2.44 954 m 64 125 k 62.5 k 1.25 k 488 7.81 k 156 61 977 19.5 7.63 244 4.88 1.91 61 1.22 477 m 128 62.5 k 31.3I< 625 244 3.91 k 78.1 30.5 488 9.77 2.81 122 2.44 954 m 30.5 610 m 238 m 256 31.25k 1 5.6 k 313 122 1 .95 k 39.1 15.3 244 4.88 1.91 61 1.22 477 m 15.3 305 m 119m 128kHz Ticks: 2 100 256 2 100 256 2 100 256 2 100 256 2 100 256 Cl.div f eff (Hz) Prescale: 1 (Hz) Prescale: 8 (Hz) Prescale: 64 (Hz) Prescale: 256 (Hz) Presc.:i024 (Hz) 1 128l< 64l< 1.28l< 500 8I< 160 62.5 1 k 20 7.81 250 5 1.95 62.5 1.25 488 m 2 64l< 32l< 640 250 4I< 80 31.3 500 10 3.91 125 2.5 977 m 31.3 625 m 244 m 4 32l< 16 k 320 125 2 k 40 15.6 250 5 1.95 62.5 1.25 488 m 15.6 313m 122m 8 16 k 8I< 160 62.5 1 k 20 7.81 125 2.5 977 m 31.3 625 m 244 m 7.81 1 56 m 61 m 16 8I< 4I< 80 31.3 500 10 3.91 62.5 1.25 488 m 15.6 313m 122 m 3.91 78.1 m 30.5 m 32 4I< 2I< 40 15.6 250 5 1.95 31.3 625 m 244 m 7.81 1 56 m 61 m 1.95 39.1 m 1 5.3 m 64 2I< 1 k 20 7.81 125 2.5 977 m 15.6 313m 122m 3.91 78.1 m 30.5 m 977 m 1 9.5 m 7.63 m 128 1 k 500 10 3.91 62.5 1.25 488 m 7.81 1 56 m 61 m 1.95 39.1 m 1 5.3 m 488 m 9.77 m 2.81 m 256 500 250 5 1.95 31.3 625 m 244 m 3.91 78.1 m 30.5 m 977 m 19.5 m 7.63 m 244 m 4.88 m 1.91 m Also: • gate: gates the o/p signal (High or Low) • period length: 2 to 256 or 1 00 to 256 Timer-Ticks • duty cycle: 1 to 99 % • clock prescaler: 1/2/4/8/16/32/64/256 • timer prescaler: 1/8/64/256/1024 • oscillator type: internal/external The full range of ticks from 2 to 256 is only valid for operation in fast-Mode. Modes producing a variable duty cycle must have a minimum number of 1 00 ticks in a period. The ATtiny’s 8-bit timer is used in fast-PWM mode. The frequency f eff is derived from the oscil- lator and the clock prescaler from which the timer and timer prescaler are clocked. The output frequency is given by: Frequency = clock / (ticks x clock-prescaler x timer prescaler) For example using an 8 MHz clock and a clock prescaler of 8 we get f eff = 1 MHz. Choosing a timer prescaler of 64 and 1 56 elektor 01-2011 4i MICROCONTROLLERS Figure 3. Under test using a prototyping board. ticks therefore gives an output frequency of: f= 8 MHz / (8 x 64 x 1 56) = 1 00.1 602564 Hz This generates a 100 Hz signal assuming the internal oscillator is reasonably accu- rate. Table 2 indicates the frequency range of the AMV firmware based on the selection of four variables. Code & Chips The source code of both the iMono (MMV) and iMulti (AMV) firmware together with two hex files implementing a 1 00 ms mono- stable and a 1 00 Hz multivibrator with a 25 % duty cycle are available to download freely from the Elektor webpage for this arti- cle [2], The iMono firmware is 694 bytes. This gives plenty of space even on the ATtiny25 for any additional code you may wish to add to expand the system. The situation is dif- ferent for the iMulti firmware which takes up 2022 bytes leaving only 24 bytes free in an ATtiny25 memory. The reason for this is largely due to the additional code needed for the A/D converter. A close look at the iMulti source code reveals that the procedure for configur- ing the timerO registers including the start and stop commands are coded ‘by hand’. The reason is that fast PWM modes are not directly supported in the current version (1.12.0.0) of BASCOM. The iMono firm- ware however uses the standard options for TimerO which are much simpler. Any pin not defined as an output will by default be an input and (with the exception of the CV input in the iMulti) with an inter- nal pull-up resistor to guard against the pos- sibility of undefined input levels if an input is left floating. This is also the case for the reset input. The definition ‘Const lnt_osc = False’ disconnects internal pull-ups on the crystal connector pins XTAL1 and XTAL2 so that an external crystal can be connected. Clock selection is made by burning the appropriate fuses. The 8 prescaler which is normally set by a fuse will have no effect because the prescaler is set by the firmware. One point to be aware of is with very low frequency outputs or long pulses it is nec- essary to use the internal 128 kHz oscil- lator. The serial ISP programming inter- face expects a minimal serial frequency of 1.2 kHz and the effective clock speed of the processor must be a minimum of four times the serial clock speed. The practical limit for ISP programming is therefore with the clock prescaler set to 1 6 which gives an f e ff = 8 kHz. With a prescaler setting of 32 and upwards you will find on programming the device you have made a totally differ- ent type of ‘one shot’ i.e. it will only be pos- sible to program the chip once over the ISP interface. There are tips on the Internet indicating how a chip which has been locked in this way can be recovered. The simplest method is to use so-called ‘high voltage serial pro- gramming’ (e.g. the STK500 programmer from Atmel) which is clock independent. General points To get the best from the All-Soft-555 it is worth bearing the following points in mind when selecting a particular pulse width or frequency from the table: • The higher the value of timer prescaler the more precise the timing will be i.e. with a prescale of 256 the timer is very accurate. • When the iMono uses a prescale value of 8 and a low value of Ticks (<16) the tim- ing is not particularly precise. • Current consumption by the ATtiny is proportional to its clock frequency. A controller running at 5 V with an f e ff = 8 MHz draws a supply current of approximately 8 mA, but at 3.3 V and 1 MHz it falls to 0.7 mA. At 1 28 kHz and 2.5 V it is happy with just 0.1 mA which is almost as low as the CMOS version of a real 555. We hope you find this virtual timer chip use- ful. If this example has inspired you to try your hand at producing a virtual version of some other standard 1C the author and the editors at Elektor would be interested to hear from you. ( 100691 ) Internet Links [1] ATtiny25 data sheet: www.atmel.com/dyn/resources/prod documents/doc2586.pdf [2] Visit the web site for this article: www.elektor.com/ 1 00691 [3] Download the BASCOM-AVR demo version: www.mcselec.com/index. php?option=com_docman&task=cat view&gid=99<emid=54 [4] Wikipedia 555 info: http://en.wikipedia.org/ wiki/555_timer_IC 42 01-2011 elektor Under Scrutiny: the Xmega Board by Jens Nickel (Germany) It’s not only here at Elektor Labs that the ATtiny and ATmega AVR controllers top the polls for favourite processor. Many of you in Elektor land think the same too, judging by your many e-mails. No wonder then the community reacted with enthu- siasm when Atmel announced in spring 2008 that it was plan- ning to expand its 8-bit range with the ATxmega controller. Outstanding new features PI included significantly improved processing performance of up to 32 MIPS at 32 MHz as well as an Event System (enabling peripheral events to trigger external circuitry functions without involving the CPU). Now an increasing number of manufacturers are following up this opportunity to produce development boards and tools designed specially for the Xmega. One of these is the Serbian firm Mikroelektronika based in Belgrade, who sent us a sample of their ‘Xmega Ready Board’ forevaluation in our lab. The board is pictured here. It’s immediately obvious that the PCB (unlike other AVR boards from the same firm) is not over- provided with options. You’ll search in vain for any user inter- face involving LEDs, press-buttons or even any kind of display. The only off-board connectivity is a single USB connector and a pair of screw terminals for the power supply. This minimal inter- face imposes two restrictions that you’ll just have to live with. First, power to the board cannot fed over the USB connection. Second, you cannot install hex files through the bus (at least on an unmodified controller), simply because the board does not include an integrated USB programmer. Our first investigation into the Xmega Ready Board came to a fairly rapid conclusion, simply because we couldn’t lay our hands on either an AVR ISP-compatible or a JTAG programmer (evidently Mikroelektronika could not either!). When we asked them how they managed without these, they told us they were working on a solution. Sure enough, two weeks later they sent us another package containing exactly the same board, only this time the ATxmegal 28A1 they supplied was now equipped with a bootloader. And this was not a one-off solution for us, as you can read on their website PI. Click on the Download section of the site and you find not only demo versions of the respected Mikroelektronika compiler but also sample programs (for C, BASIC and Pascal) plus a PC program for transferring hex files over the USB connections to the bootloader. We immediately tested out the whole package (see screen shot) and it all worked very smoothly. A minor shortcoming is the fact that the corresponding function is not integrated in the IDE. Instead you must first produce a hex file with the compiler (lim- ited to a code length of 4 KB in the free downloadable version) and then use the auxiliary program to transfer it to the Xmega. For our first trial we tested the ‘LED Blinking’ routine. After flashing this successfully we were puzzled; there was no sign of any LED blinking at us. This was pure and simply because the board is not equipped with any LEDs (other than a green ^ mikroXMEGA and XMEGA -Ready Bootloader i^JI X mikroBootloader Select MCU AVR XMEGA Setup COM Port: COM22 port Baud Rate: 1 15200 Change Settings Tfi Conn in Rx Tx 9 Connect with MCU Choose HEX file Start bootloader Disconnect t . Browse for HEX Begin uploading History Window Msg: Waiting MCU response Disconnected — Setup: Port COM2 2 Msg: Waiting MCU response Connected Bootloading progress bar Show Activity ' No files opened, elektor 01-2011 43 power-on indicator)! But if you can wield a soldering iron you will not find this a major hurdle, because every pin of the Xmega controller is taken to its own solder terminal on this board. In addition the board contains a special prototyping area where users can install circuitry of their own. A multimeter reassured us that our experiment had been blessed with success and the accessibly written source code explained that the specified port pins should alternate between High and Low level to make an LED flash. The second sample program we tried out was called ‘Flash_Test’ (see screen shot) and sent a test sequence of bytes across the USB interface to the PC. We were able to control this process using Hyperterminal. Four other code samples are provided, for working with timers, the internal EEPROM and other functions. According to Mikroelektronika other sample programs are in preparation (for ADC, PWM, UART, LCD/GLCD/TFT controllers and more). These will include demo code that will work with corresponding compiler-specific commands ratherthan provide fully developed applications. This should not be taken to mean you should not look to other sources for software. Users are free to flash other hex files (developed with WinAVR) into the controller using the bootloader. A major plus-point of this board is undoubtedly the low price of 29 US dollars (the distributor Tigal is currently offering it for 24 euros I 3 !). If your development turns out successful you can even build the board permanently into your application without leav- ing yourself vastly out of pocket. At this stage it’s worth men- tioning that the manufacturer also offers an even more com- pact version of the board. This is admittedly somewhat pared- down (as you’ll see on the right-hand side of the photo); it lacks the screw terminals for the power supply and the prototyping area for example). But with a price of just $24 the mikroXmega board is even better value for money than the Xmega Ready Board l 4 L Shortly before we went to press the news reached us that the guys at Mikroelektronika were working on a lavishly equipped ‘Multimedia Xmega Board’. This is planned to include a TFT dis- play, an accelerometer, an MMC/SD-card socket, an audio inter- face and much more on board. This PCB will also be available in a more compact micro version. (100716) [1] www.atmel.com/products/AVR/default_xmega.asp [2] www.mikroe.com/eng/products/view/579/ xmega-ready-board/ [3] www.tigal.com/product.asp?pid=2039&lang=en [4] www.mikroe.com/eng/products/view/580/ mikroxmega-board / Spotted at electronica 201 0 Between the 9 th and 1 2 of November this year we found ourselves at electronica 201 0 billed as the world’s leading trade fair for electronic components, systems and applications. Held in the massive Munich trade fair centre it was packed to the rafters with so many products and exhibitors that it’s impossible to give a fair overview so we just picked a few products here which caught our eye. Elektor were of course also there and this year we were pleased to be sharing a booth with our US sister publication ‘Circuit Cellar’. It was a good opportunity for Elektor editors and engineers including Ernst Krempelsauer, Antoine Authier and jens Nickel to press the flesh and chat with readers about our projects and publications. With so many exhibitors under the same roof it was a good opportunity for them to spot the latest products and trends. With an area this big we couldn’t help thinking that visitors would have benefited from their very own Elektor Wheelie! (100843) LTl 00 The Stellaris Robotic Evaluation platform (Evalbot) from Texas Instruments is based on a Stellaris LM3S9B92 microcontroller supporting a small real-time kernel. It uses many of the manu- facturer’s analogue components for motor drive, communi- cations and power supply. The kit is available from a number of distributors and just needs a few minutes assembly time before its ready to go. It retails at $1 50.00 according to the Tl website. www.ti.com/litv/pdf/spmu166 44 01-2011 elektor On the Glyn stand we found this powerful new development board incorporating the FTDI Vinculum II featuring a snap-off debugger and Flash tool. This board is supplied as part of a one-day Vinculum II workshop costing 60 euros. A nice appli- cation shows it interfaced to a USB Logitech webcam, display- ing the image on a Seiko TFT display. Apart from the Vinculum no other controller is needed. www.glyn.de Aaronia were showcasing their impressive range of innova- tive hand-held spectrum analysers. These devices have excel- lent sensitivity and are a world first in portable real-time spec- trum analysis (real time bandwidth up to 200 MHz). Together with a (powerful) computer they can stream received data to a hard disk. The system can log the entire radio traffic passing through a mobile phone mast. The basic 6 GHz version retails at around 3000 euros and includes the antenna, LiPo battery, mains adapter, carry case, analysis software and accessories. www.aaronia.co.uk Prema semiconductors produce analogue and mixed signal ASICs. On show was a ‘Speaten Filter’ audio chip developed by Dedekind R&D. This filter boosts bass and treble frequencies without affecting the mid range. This produces improved live- liness especially in the reproduction of instrumental sounds. Tiny loudspeakers at their stand were reproducing unbeliev- ably rich sounds, really quite impressive. www.prema.com www.dedekind.jp/pdf/mz01_e.pdf These high-tech, dimmable AC powered LED lamps incorpo- rate a small active heatsink from Nuventix to keep the LED running cool. Power for the LED comes from a highly efficient mains interface designed by Fairchild. The LED modules are from Everlight (10 W) and Hueyjann (20 W). www.fairchildsemi.com OUT LEir our RIGHT PREF.U Gtfttleonduetar GrnbH elektor 01-2011 45 Here comes the Bus! By Jens Nickel The best things in life may or may not be free (in the Elektor labs we know a song about that), but sometimes there just isn’t time to get round to them. Lots of good ideas come out of our edito- rial planning meetings, but many just end up languishing in the bottom of a drawer never to see the light of day. ‘E-Labs Inside’ to the rescue! As the chief lab correspondent, I often find myself looking around at what my colleagues are doing. Sometimes this can be a source of ideas, and on this occasion I was inspired to dust off an old project that had never come to fruition, and use it as an example to show how a concept is developed from scribbles on the back of an enve- lope to reality. A few details were nailed down at the first brainstorming session with Clemens and Chris. We wanted to keep things as simple as we could, and so for the lowest protocol layer (the purely electrical specification) we decided to use an established standard and readily-available components. Clemens sug- gested using Ethernet, and I proposed a bus based on the RS-485 standard. Either would be able to work with cable runs of tens of metres, enough for wiring up the elegant castle that is the Elektor nerve centre. There are fairly cheap microcontrollers avail- able with a built-in 1 0Base-T Ethernet trans- ceiver, giving a data rate of up to 1 0 Mbit/s (see for example the ‘NetWorker’ project in the last edition I 1 !; circuit diagram snippet in Figure 1). RS-485 buses can in principle achieve similar data rates. With a 1 0 Mbit/s link we have plenty of bandwidth: even enough to send high-quality sampled audio data in real time. It was clear, however, that not every network node would need to be capable of top-speed performance. To make the project interesting to as many readers as possible, we decided that the components for a minimal node, perhaps for connecting up a simple sensor, shouldn’t come to more than fifteen euros. That seemed feasible, as RS-485 transceivers (such as the LTC1 535, or the SN65HVD08P, which Clemens had used in the InterScep- tre project i 2 i) are available for about five pounds. And, if we make the simple bus node run at ordinary UART data rates up to say 1 15.2 kbit/s, we can use an ordinary AVR microcontroller for its brains. LO QO After a bit of thinking I narrowed the choice down to two large- scale project ideas, and went to consult a couple of colleagues: Luc and Chris from the lab and Clemens from the international editorial team, who has already seen several large projects through to print debut. The first idea was a general-purpose microcontroller base board, into which a variety of processor boards could be plugged. Per- haps we could include AVRs, PICs and 8051 -series processors? The second idea was to develop our own bus system for inter- connecting sensors, actuators, instruments and anything else we could think of. We soon came to the conclusion that ‘ElektorBus’ would be the better choice for illustrating the development process in the ‘E-Labs Inside’ series, and so the ‘Elektor Controller Platform’ went back in the drawer until next time. The ElektorBus should, we decided, be able to carry rapidly- sampled sensor measurements as well as control signals, and be suitable for use in a small home automation system. We would be able to add new types of nodes gradually, the whole thing would be easy to build and, of course, the software would be open source down to its last bit. O/LEDA/ANO 1/LEDB/AN1 /AN2/VREF- /AN3/VREF+ RA4/T0CKL RA5/AN4 S0/T13CKI /ECCP2/P2A ECCP1/P1A SCK1/SCL1 /SDI1/SDA1 RC5/SD01 C6/TX1/CK1 C7/RX1/DT1 46 01-2011 elektor RS-485 thus looked like the ideal option, and, as many readers will know, is the electrical standard on which many diverse bus systems are based. But still Ethernet, with its highly-developed and sophisticated protocol stack and, significantly, enormous open-source code base, seemed too attractive to discard. Clemens had an idea: why not use both? Previously we described a USB-to-RS-485 adaptor that uses a standard Ether- net cable with four twisted pairs and RJ45 plugs at each end to carry RS-485 signals (Figure 2) l 3 L RS-485 needs just two data wires, and 1 0Base-T Ethernet uses just two of the four pairs in the cable. Can we carry RS-485 and Ethernet in the same cable? Could we even use the last remaining pair to supply power to the nodes? There is always a catch, and in this case it was the fact that mod- ern Ethernet networks are arranged in a star topology. This means that if we want to wire up a few sensors and actuators in a single room, we end up with a spaghetti of cables. Many home automation networks have a hierarchical structure where Ethernet is used between the individual rooms of the house, but the wiring between the nodes within each room uses a two- wire bus. Furthermore, as Chris pointed out, our combi-cable would be incompatible with existing (mostly 1 0OBase-T) Ethernet equip- ment. Often in modern devices the spare pairs in the Ethernet cable are grounded (see for example Figure 3) t 4 ’ 5 l Clemens started thinking about how to make best use of ready-made cables in practice. For example, it is not possible to thread them through a cable gland, so it is not easy to see how to make a waterproof node for use outside or in the bathroom. This prob- lem hadn’t even occurred to me, so it was a good thing that there were three heads brainstorming rather than one! We decided to leave out of our first specification any details that we had not settled on. We would definitely use standard Ether- net cable with four twisted pairs, with one pair for our bus and one pair for 1 2 V and ground. (Clemens thought 1 2 V was the best choice for most applications, as it gives some headroom when powering 9 V or 5 V equipment.) The remaining pairs we would reserve for future expansion, or perhaps an enterprising reader might come up with a clever use for them. Of course anyone making such ‘unauthorised’ modifications would have to forfeit the right to use our neat ElektorBus logo on their devices... What bit rate should the RS-485 bus operate at? If we are using just one twisted pair then it is simplest if all communications happen at the same speed. We decided to take things gently and first define an ‘ElektorBus low speed profile’ with a standard bit rate of 9600 bit/s. This will allow us to use standard crystals and probably also experimental hardware and software that we already have. When that is working we will then venture on to define ‘standard speed’ (1 1 5.2 kbit/s) and perhaps also ‘high speed’ (around 5 Mbit/s) profiles. To keep communications at different speeds separate we could later make use of the spare pairs in the cable. Clemens was also considering how he might arrange for different speed com- munications to run on a single conductor pair. The transmit- ter could transmit away, and the receiving node would have to determine from a preamble sequence whether the mes- sage was being sent at a speed it could read. Would the higher bit rates have to be multiples of the slowest, he wondered? It wasn’t long before we were deep in grisly protocol details... What do you think? You can help inspire the design: the ElektorBus team welcomes your ideas, improvements and thoughts. Send them by email to editor@elektor.com. (100817) [1] www.elektor.com/ 1 00552 [2] www.elektor.com/ 1 001 74 [3] www.elektor.com/ 1 00372 [4] www.elektor.com/090607 [5] http://en.wikipedia.org/wiki/Ethernet_over_twisted_pair VCCusb VCCl GND1 26 __ — 27 DE RE 25 2 Dl ST1 28 3 — R0 |C2 ST2 — LTC1535 VCC2 GND2 14 11 © V VCC AIS 78253/55C SLEW RATE LINKJ-ED RX_LED TX_LED FDX_LED COL_LED SPD_LED TEST_MODE_3 TEST_M0DE_2 TEST_M0DE_1 TEST MODE 0 U4 = 74LVC2G14 elektor 01-2011 47 Headphone Amp Music to your ears By Stefan Dellemann (Germany) There have of course been numerous designs for headphone amplifiers before this one, either more or less successful and simpler or more elaborate. The design presented in this article is straightforward, sounds quite good and can be built using well-established components. Specifications (output load: 33 £1, supply voltage: ±9 V) • Input impedance (without Pi) • Bandwidth • THD + Noise (i kHz, i mW/33 £ 1 ) • THD + Noise (20 Hz - 20 kHz, 1 mW/33 £ 1 ) • Signal to noise ratio (ref. 1 mW/33 £ 1 ) • Max. voltage (into 33 £ 2 ) • Max. input voltage • Current consumption 10 k£l 3.4 Hz - 2.4 MHz 0.005 % (B = 22 kHz) 0.01 % (B = 80 kHz) 89 dB (B = 22 kHz) 92 dBA 3.3 V (THD+N = 0.1 %) 0.57 V (with Pi set to maximum volume) 19 mA These days it’s not that easy to find a sepa- rate headphone amplifier in the shops. They do exist, especially in the hi-fi world, but they come with a matching price tag. The design presented here comes in a bit below these high-end circuits, but can be built using eas- ily obtainable components and still manages to have quite a good sound quality. The circuit The circuit could be described as a type of power-amp, built with discrete components (see Figure 1 ). At the input we find a vol- ume control (PI , which is connected via a header) and a coupling capacitor (Cl ), fol- lowed by a differential amplifier (T 1 , T 2 ) with a constant current source (T 3 ) in the emitter branch. The preset between T 1 and T 2 (P 2 ) is used to set the symmetry, or in other words, the output voltage is set to 0 volt DC compared to ground. For the best sound quality we should have the same col- lector current flowing through both transis- tors. This can be seen from voltages at test points F and G in the circuit diagram, which are nearly equal. The input offset across R 1 is caused by the base current flowing into T 1 . This causes the voltage at point A (V^) to be slightly negative. A quick measure- ment of the prototype showed that the base current into T 1 was about 3 jiA. Without the offset compensation provided by trim- pot P 2 the output offset voltage V 0 would exceed 0.2 V: \^o = (1 + R 6 /R 5 ) x V (A) V 0 = (1 + 1 0 / 1 . 5 ) x 0.028 = 0.21 5 V The offset can therefore be removed by set- ting the differential amplifier to operate 48 01-2011 elektor MINI PROJECT slightly asymmetrically. Although this isn’t the best method as far as the sound quality is con- cerned, it does keep the circuit much simpler. Constant current settings The current source in the emitter branch (T3) is set to about 3 mA with diodes D1 , D2 and resistor R4, which results in T4 being driven as linearly as possible. The audio signal then makes its way to the driver stage, T4, which drives the more powerful output transistors (T6 and T7). C4 has been added to provide a greater internal gain. The quiescent current in the output stage is set to about 5 mA with T5 and R9. Assuming a gain (/? FE ) of 50 in the output transistors, this 5 mA could theo- retically provide a linear 0.005 Ax50x32 £1 = 8 V peak into 32 £1. However, some limita- tions are introduced by constant current source T5 and the voltage drop across the base-emitter junction of T7 (about 1 .5 V). We should also take account of the voltage divider around R1 1 and R1 2 (R1 0 and R1 2) in the calculations. The maximum voltage Umax across the load (R L ) then becomes V max = R l |(R l +R^^+RU)x(9-^.5) Wnax = 4.6 V peak This corresponds to about 3.26 V rms , which is what we measured, as you can see in the specifications. This means that the circuit can deliver (3.26 2 /32) = 330 mW into 32 £1, which should be enough to keep most pop and rock fans happy. Resistor R12, which follows the output stage, limits the output current and keeps the circuit stable when a capacitive load is connected, such as a long shielded cable to the headphones. This prevents the output transistors from overheating when there is a short circuit. R1 0 and R1 1 keep things symmetric. Despite the value of C2 in the feedback circuit, the bandwidth is still much greater than the audio bandwidth (see the specifications). To obtain a low corner fre- quency at the input we used 4.7 pF for Cl . A capacitor of 2.2 pF (which is easier to obtain) still results in an acceptable corner frequency of 7 Hz (-0.6 dB at 20 Hz). The measurements from one of our pro- totypes are shown in the circuit diagram. These should be seen as guideline values T1,T2,T3,T5 = BC550C T4 = BC560C T6 = BD139 T7 = BD140 © 6..10V A = - 28mV B = - 33mV C = 0.73V D = 0.71V E = 1.37V F = 1.31V G = 1.37V H = 0.71V I = 1.4V J = 83.5mV K = 80.5mV ♦ 2x 1N4148 100701 - 11 © 6..10V Figure 1 . The circuit forthe simple headphone amplifier uses easy to get components (one channel shown). Figure 2. The completed circuit is still compact despite the lack of SMDs. elektor 01-2011 49 MINI PROJECT COMPONENT LIST Resistors R1,R6 = 10kn R2,R3 = 1l<£2 R4 = 270£1 R5 = 1.5kn R7 = 4.7kn R8,R9 = 150£1 R10,R11,R12 = 10£1 PI = 10kft P2 = 100£2 trimpot Capacitors Cl = 4.7jiF, lead pitch 5mm or 7.5mm C2 = 6.8pF, lead pitch 5mm C3 = 1 0pF, lead pitch 5mm C4,C5,C6 = 1 0OpF 1 6V radial Semiconductors D1 ,D2,D3,D4 = 1 N4148 T1 ,T2,T3,T5 = BC550C T4 = BC560C T6 = BD139 T7 = BD140 Miscellaneous Connection for PI = 3-pin pinheader, lead pitch 0.1” Connection for PI = 3-way socket strip, lead pitch 0.1 ” 7 pcs 1 .3mm diam. solder pin PCB# 100701, see [1]. Figure 3. The component layout for the no-frills headphone amplifier. rather than as exact requirements. The PN junctions and the gain of the transistors can of course vary depending on the manufac- turer (this also applies to the current con- sumption given in the specifications). Experimenting For those of you who don’t mind a little bit more noise (although it will still be inau- dible with most headphones), you can increase the impedance of the feedback loop to about 1 0 k£l. This can be achieved by increasing R5 and R6 in the parallel cir- Figure 4. The circuit has a distinctive appearance when it’s built into a ProjectCase. cuit to 1 0 k£l. In this case the base currents of T1 and T2 will compensate each other. If you like experimenting you can replace R5 with a resistor of 1 2 l and R6 with a resistor of 68 k£l (perfectionists should use 1 1 .5 k£l and 76.8 k£l from the E96 series). It is unlikely that this offers an audible improvement, but there may be a smaller offset this way. Construction A small printed circuit board has been designed for this circuit (see Figure 2), which can be ordered via PL From here you can also download the board layout in PDF format. The component layout is shown in Figure 3. As usual, construction is easiest if you start soldering the lowest compo- nents (resistors, diodes) and then continue mounting increasingly higher components (capacitors, transistors, connection pins). You will need two boards for a stereo ver- sion, in which case PI has to be replaced with a stereo potentiometer, so that the volume can be controlled on both channels simultaneously. If your audio source already includes a volume control, you can leave out PI (put a jumper on the header or solder a wire link on the board from pin 1 and pin 2 of the header instead of the actual header). The input impedance of our suggested cir- cuit (which includes PI ) has a minimum of 5 l (PI set to maximum volume). This shouldn’t be a problem for most modern audio sources. Take note of the pin spac- ing of decoupling capacitor Cl ; the board accommodates 5 mm and 7.5 mm versions. For the power supply you could use two 9V batteries. Alternatively, a 2x6 V, 5 VA transformer with a 1.5 A bridge rectifier and 8200 pF/1 6 V per supply rail is another option. This could optionally be supple- mented with a pair of voltage regulators. The output transistors (T6 en T7) probably don’t need heatsinks in practice, although a small heatsink will make sure that they will be short circuit proof. We decided to build this circuit into an Elektor ProjectCase I 2 ]. This is very easy to do and it gives it a distinctive look and a good view of the electronics (see Figure 4). (100701) Internet Links [1 ] www.elektor.com/ 1 00701 [2] www.elektor.com/ 1 00500 50 01-2011 elektor V/SA Quasar Electronics Limited PO Box 6935, Bishops StortFord CM23 4WP, United Kingdom Tel: 01279 4^7799 Fax: 01279 267799 E-mail: sales@quasarelecl:ronics.com Web: www.quasarelectronics.com All prices INCLUDE 17.5% VAT. Postage & Packing Options (Up to IKg gross weight): UK Standard 3-7 Day Delivery - £4.95; UK Mainland Next Day Delivery - £1 1 .95; Europe (EU) - £10.95; Rest of World - £12.95 (up to 0.5Kg). lOrder online for reduced price UK Postage! Payment: We accept all major credit/debit cards. Make cheques/PO’s payable to Quasar Electronics. Please visit our online shop now for full details of over 500 kits, projects, modules and publications. Discounts for bulk quantities. EUBOCARD SWITCH MasterCard Electron QUASAR electronics Credit Card ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ Ho! Up! Ho! Q|ristma$ §g01 0 is Qgjjt's wayj§yt : fc ave some fantastic gift ideas for young (and old) enquiring miri ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ 30 in ONE -£19.95 Order Code EPL030KT 130 in ONE -£49.95 Order Code EPL130KT 300 in ONE -£89.95 Order Code EPL300KT 500 in ONE -£199.95 Order Code EPL500KT Robot Sensor - £21 .95 Order Code EPLR20KT Digital Recording Laboratory - £34.95 Order Code EPLDRKT AM /FM Radio Kit -£11.95 Order Code ERKAFKT Shortwave Kit -£11.95 Order Code ERKSWKT Crystal Radio Kit - £8.95 Order Code ERKCKT Electronic Bell - £8.95 Order Code EAKEBKT Electronic Motor - £8.95 Order Code EAKEMKT Generator - £8.95 Order Code EAKEGKT Room Alarm - £4.95 Order Code EAKRAKT Hand Held Metal Detector - £9.95 Order Code ELMDX7 Metal Detector - £9.95 Order Code ELMDKT Hyper Peppy - £23.95 Order Code MR969E Robotic Arm - £49.95 Order Code C9895 Air Shooter - £39.95 Order Code 4025KT Running Microbug -£12.95 Order Code MK127KT Trainmech — £13.95 Order Code C21-606KT Tyrannomech -£12.95 Order Code C21-601KT Musical LED Jingle Bells -£17.95 Order Code 1176KT Flashing LED Christ- mas Tree - £7.95 Order Code MK100KT See our website for even more great gift ideas! \ m 1 1 1 1 i In a TJ Miiid Ft WW w. Qi uasarElectronics ‘.corn Secure Online ( Drdering Facil ities • Full Prc >duct Listing, 1 Descriptions l k Photos • Kit Documentatic >n & Software Downloads ALTERNATIVE ENERGY Free Energy By Harry Baggen (Elektor Netherlands Editorial) For centuries, savants have searched for ways to make devices move perpetually or to generate energy from nothing. These pursuits still occupy the attention of many people, as can be seen from the massive interest in this topic on the Web, along with innumerable projects. Is it truly possible to generate free energy, or are we simply deceiving ourselves and others? Here we describe a selection of interesting ideas and projects. In the past, before the discovery of electricity, many savants spent their time trying to develop a perpetual motion machine — a device that would keep moving forever after it had been put in motion, effectively drawing energy from the void. In the last two centuries electrical energy has become increasingly important in our soci- ety, and during this time the focus of people who invent devices of this sort has shifted towards generating ‘free energy’, usually in the form of electricity. However, the laws of thermodynamics say that this is not possible. Despite the fact that these laws have been known for more than a century, each year countless patent applica- tions are submitted for devices of this sort. Highly ingenious lines of thought and instructions appear in these patent applications, but detailed examination of these devices ultimately reveals that they do not work or that there is actually some source of energy present, either concealed or perhaps unknown to the inventor. History It is known that self-powered machines were developed in ancient India, starting as early as the seventh century. One of the best known designs from that time is a wheel with a number of mer- cury-filled cylinders attached to it. People in the western world also attempted to develop similar types of self-powered devices. One example is a device that uses falling hammers. Naturally, the free energy devices designed by Leonardo Da Vinci are very well known, but it is questionable whether he expected that they would actu- ally work, since he said that according to his understanding they could not possibly work. Many other inventors of perpetual motion devices appeared after him. The first such device that ‘actually’ worked is ascribed to the inventor John Joseph Merlin, originally from Belgium, who designed a self-powered clock in 1760. How- ever, its operation was found to be based on natural changes in ambient temperature and air pressure, which means that it cannot be regarded as a true self-powered perpetual motion device. Despite the progress of scientific knowledge, the dream of a perpet- ual motion device continued to inspire many people. Especially from the middle of the twentieth century onward, many inventors have concentrated on the concept of ‘free energy’ (also known as zero point energy), which involves devising a construction that delivers more energy than what is supplied to it. Of course, there are vari- ous ways to do this - a device that supplies electricity from sunlight 52 01-2011 elektor ALTERNATIVE ENERGY or water power effectively delivers energy for free without requir- ing any sort of mysterious events. However, there are people who go much further and try to extract energy from magnetic fields or from an extra spatial dimension that has not yet been discovered by anyone else. With many of these inventions, it is very difficult to determine whether they actually work. Although the inventors are convinced that they work, in many cases they are unable to provide a reason- able scientific explanation of how they work or demonstrate their inventions. Overviews of the history of perpetual motion devices, some with background information and names of well-known persons may be found at various websites including PI. Figure 1 . Structure of a ‘Simple Magnetic Overunity Toy’ (SMOT). (photo source: I 11 )) Electricity from nothing In the remainder of this article we focus on electrical free energy devices, whose objective is to generate more electrical energy than they consume. Here we are mainly interested in devices with the least possible number of mechanical parts, and especially in devices employing a lot of electronics. Most of the devices we found on the Web utilise magnetic fields in some way or the other, primarily with the aid of permanent mag- nets and coils. The explanations of how these devices operate are highly varied. To demonstrate that it is possible to use magnets to cause an object to move without supplying external energy, there is a very simple experiment that can be performed using two bar magnets, a length of aluminium U channel and a steel ball. This miniature perpetual motion device (shown in Figure 1) is called the ‘Simple Magnetic Overunity Toy’, or SMOT for short. The magnetic field between the two magnets, which are positioned at a slight angle to each other, causes the ball to roll uphill ‘by itself when it is placed at the low end of the slightly inclined U channel. This idea dates from 1922, and in 1 997 Greg Watson produced an updated version. A detailed description of a practical implementation and test results are avail- able on the website of French experimenter J.L. Naudin l 2 L It’s fun to try this for yourself. Incidentally, a variety of explanations of how the SMOT works can be found l 3 l. Most energy generators use a rotating wheel fitted with several magnets. The magnets rotate beneath coils that act alternately as drive coils and detection coils with the aid of electronic control circuitry. This objective of this arrangement is to generate more energy than the drive energy supplied to the coils to keep the wheel turning. Many systems of this sort have rather complicated mechan- ical constructions, but there are a few very simple generator designs that are quite suitable for experimentation by people who are not expert machinists. For instance, at Kl there is a description of howto convert an ordinary PC fan into an energy generator. There is also a YouTube video t 5 ] that shows you how to make the conversion. Fig- ure 2 shows the simple schematic diagram of the full circuit. John Bedini has developed several projects that are very popular with everyone interested in free energy generators. He has sev- eral decades of experience in this area, and a large number of gen- erators of various types are described on his website I 6 !. To show Figure 2. A simple circuit is all you need to convert a PC fan into a free energy generator, (source: P 2 1) Figure 3. This free energy generator from Ron Pugh has a reasonably simple mechanical design, (source: P 2 1) elektor 01-2011 53 ALTERNATIVE ENERGY Figure 4. The MEG is a generator with no moving parts. This is the original schematic diagram from US patent 6.363.71 8 B1 . (source: l 7 l) The MEG v3.0 build and tested by JL Naudin - Nov 22th, 2000 Motionless Electromagnetic Generator from Tom Bearden Email: Jnaudin509@aol.com - http://go.to/jlnlabsy Figure 5. A practical MEG transformer implementation designed by J.L. Naudin. (source: I 7 !) how easy it is to build your own version of a Bedini generator, he describes a special design that he claims can be built by a ten-year- old schoolgirl. A design by Ron Pugh based on Bedini’s ideas (which is also described clearly and extensively at HI) is illustrated in Figure 3. The mechanical construction of this design is reasonably simple. It has a homemade rotor with six pairs of magnets glued into slots in the rotor. Three coils used to drive the rotor and generate energy are mounted around the perimeter of the rotor. The control elec- tronics essentially consists of a number of power transistors and a few passive components. An experienced electronics enthusiast can probably design a tidier version of the electronics (with a PCB), but what ultimately matters is the overall concept. The ‘Motionless Electromagnetic Generator’ (MEG) is an invention of Tom Bearden etal. I 7 ] based on a special transformer with a per- manent magnet fitted in the middle (see Figure 4). Two large wind- ings for energy output are fitted on the outer ends of the trans- former core, while two smaller windings for energy input are fitted near the middle. This device is claimed to be able to extract electro- magnetic energy from the vacuum, thereby supplying more energy than it consumes. Here again the Frenchman J.L. Naudin has devel- oped a very nice prototype (Figure 5) with a number of improve- ments compared to the original design I 8 !. He has also generated a simulation of the magnetic field for this design. Finally, we wish to draw your attention to the ‘Tesla Switch’ I 9 ], since it can be built using only electronic components with no need for a special transformer. The circuit is based on Tesla’s ideas, as imple- mented by Ronald Brand and John Bedini in the form of a circuit with three rechargeable batteries that are repeatedly connected in series in different configurations in which one of the batteries is charged by the other two. The ultimate result is three fully charged batter- ies, which means that energy has been extracted from an unknown source in some way or the other. The circuitry of the Tesla Switch is fairly simple. An especially interesting version of this idea can be obtained by replacing two of the batteries with electrolytic capaci- tors, so that only one battery is necessary (Figure 6). Unfortunately, few detailed circuits based on this principle can be found on the Web. As you can see, the ‘free energy’ area is a hotbed of experimen- tal activity. The question is whether it ultimately delivers anything useful. In this regard, we wish to conclude this article with the fre- quently given advice ‘don’t try this at home’, accompanied by a request to subject a number of the designs described to detailed examination and even try to develop your own design for a sim- ilar sort of energy generator. We are very interested in hearing about your experience, results and conclusions, both positive and negative. Internet Links and References [1] www.theorderoftime.com/ned/wetenschap/nieuweenergie/4. html, www.hp-gramatke.net/perpetuum/index.htm [2] http://jnaudin.free.fr/html/smotidx.htm [3] www.mathematik.tu-darmstadt.de/~bruhn/SMOT.HTM www.lhup.edu/~dsimanek/museum/smot.htm [4] www.free-energy-info.co.uk/Chapt6.html [5] www.youtube.com/watch?gl=US&feature=related&hl=uk&v=e DS9qk-Nw4M [6] http://johnbedini.net/ [7] http://cheniere.nii.net/megstatus.htm [8] http://jnaudin.free.fr/meg/meg.htm [9] www.icehouse.net/john1 /tesla. html [10] www.lhup.edu/ ~dsimanek/museum/unwork.htm#top [11 ] www.hcrs.at [12] www.free-energy-info.co.uk 54 01-2011 elektor ALTERNATIVE ENERGY SCALAR WAVE CONTROLLER THE SCALAR BATTERY CHARGER Figure 6. A yield of more than 1 00% is possible with the Tesla Switch’, which alternately charges and discharges two electrolytic capacitors. Figure 6a shows the basic concept according to Bedini, while Figure 6b shows a detailed circuit designed by Naudin. (sources: and t 9 l) If you find the entire subject of free energy preposterous, we sug- After visiting this website, you will doubtless find yourself reinforced gest you have a look at the ‘Museum of Unworkable Devices’ I 10 ). in your convictions. (100672-I) Advertisement Prototype & small series PCB specialists EURO CIRCUITS PCB proto STANDARD pool TECH pool IMS pool On demand dedicated prototype service widest choice 1-8 layers 100 pm technology metal-backed PCBs all options up to 16 layers Call us: +44 (0) 20 8816 8180 Email: euro@eurodrcuits.com Merry Christmas and a prosperous New ALL SERVICES - Instant online pricing - Instant online ordering - Low pooling prices - Deliveries from 2 days - No tooling charges - Stencil service www.eurocircuits.com PROTO-PIC UK based suppliers of . . . sparkfun FEZ ARDUINO mbed LilyPad XBee GHI o Assc adafruit industries To claim your free shipping (UK mainland only) use voucher code 'elektor' at checkout +44 ( 0 ) 1592 572092 elektor 01-2011 55 WIRELESS ECG Wireless ECG Monitoring cardiac signals with ZigBee By M. Denoual, 0. Clouard, M. Sligard, B. Hu, N. Bessot and S. Moussay (France) The combination of electronics and biology always yields interesting projects. The system describe here is easy to build and enables the wireless monitoring of cardiac signals. ZigBee modules are used for the wireless link. Kev features • ECG resolution 10 bits • ZigBee wireless data transmission • Range 100 m (outdoors) • Based on XBee modules • No programming necessary • Serial computer interface • Identical PCBs for acquisition and receiver boards Many devices are available for recording or visualising electrocardiogram (ECG) sig- nals. Protection of the subject (patient) is a paramount requirement with all of these devices, which is why circuits of this sort are typically powered by batteries. This circuit is also battery powered, but it uses a wireless link as an elegant solution to the problem of galvanic isolation, completely eliminat- ing any hazard to the subject. The wireless link also gives the subject more freedom of movement. This special approach forms the basis for this project, which was originally developed for monitoring athletes while they are exer- cising or performing. Why ZigBee? ZigBee technology is an ideal choice for this application in terms of cost, ease of use and low power consumption. The data transmis- sion rate of 250 kbit/s is sufficient for appli- cations such as transmitting ECG signals, which have a narrow bandwidth. The range of 1 00 m (300 ft.) outdoors or 30 m (1 00 ft.) indoors with the selected XBee modules i 3 l is sufficient for monitoring in a gym or sta- dium, and the range could be extended to 1 km for monitoring outdoor sporting events by using higher-power modules and relay modules. Finally, ZigBee modules (in partic- ular the XBee modules from Digi) have inte- grated A/D converters, which simplifies over- all circuit design and construction. Hardware The system consists of two parts: a data acquisition board that senses the ECG sig- nal and a receiver board that is connected to a PC for displaying the ECG signal. In this article we also describe a third module that can be used to adjust the data acquisition board and test the wireless data link. It is a sort of signal generator that produces an artificial ECG signal. Acquisition and receiver boards The block diagram and schematic diagram of the acquisition board are shown in Fig- ure 1 and Figure 2, respectively. The board is designed to be used with three electrodes (two sense electrodes and one reference electrode; see the ‘ECG Measurement’ inset). It has an analogue stage that ampli- fies and filters the input signal before it goes to the 1 0-bit A/D converter integrated into the XBee module. The board is designed to allow all components to operate from a single 3.3-V supply voltage, which matches the operating voltage of the XBee module. A compact 3.3-V lithium-ion button cell would be a good choice for powering the board. However, during development it was more convenient to use a regular 9-V bat- 56 01-2011 elektor WIRELESS ECG Figure 1 . Block diagram of the acquisition circuit. tery together with a 3.3-V regulator on the board to power the circuit. The 3.3-V supply voltage restricts the choice of components for the analogue functions. The economical AD623 instrumentation amplifier is able to operate from a single supply voltage, and so are the OPA237 opa- mps used in the filter stages. The reference level for the circuitry is provided by a 1 .2 -V potential generated by a MAX6120. This potential is applied to the subject’s body by a reference electrode, and it determines the common-mode level of the signals picked up by the sense electrodes. A reference potential of 1 .5 V can also be used if a suit- able reference voltage 1C in an SMD package is available. The first-order high-pass filter built around IC5 and the low-pass filter built around IC3 limit the effective frequency band of the signal and amplify the signal. The low-pass filter also acts as an anti-aliasing filter for the A/D converter. A passive twin-T filter is placed ahead of the converter input (pin 20 of the XBee module) to suppress any 50-Hz mains hum that may be present. If desired, it can be bypassed when the board is used in an environment free from mains interfer- ence. The 3.3-V supply voltage is connected to pin 1 4 to serve as the reference voltage for the A/D converter. IC6 LM317/CYL BAV99 high-pass filter A=lf c = 0.15 Hz 3.3V O low-pass filter A = 142 f c = 102 Hz 3.3V O double-T filter f c = 50 Hz JE □Lj CO CO CO CO br — 1 » mnn 1 — 080805 - 17 Figure 2. Schematic diagram of the acquisition circuit. elektor 01-2011 57 WIRELESS ECG ECG Measurement This circuit uses three electrodes to sense the electrical acti- vity of the subject’s heart. Two of the electrodes are placed on the subject’s wrists, and the third is placed on the left leg. The electrodes on the wrists pick up the electrical signal, while the electrode on the leg provides a reference level for the other electrodes. The adjoining figure shows the electrical signal generated by a beating heart and the phases of the cardiac cycle: • P wave: contraction of the auricles. Blood from the veins is pumped into the ventricles. • QRS complex: contraction of the ventricles. Blood flows out of the heart and is pumped into the arteries. The combination of P and QRS waves generates the characteristic lub-dub’ sound of a heartbeat. • T wave: repolarisation of the ventricles. The heart muscle returns to the relaxed state. See reference [2] for more information on ECGs. Relationship between the electrical activity of the heart and the phases of the heartbeat cycle. Pulse R has an amplitude of only a few millivolts. The bandwidth of the pulses in the ECG signal is 0.1 to 1 00 Hz. Electrodes In order to make good ECG measurements, it is essential to use good electrodes and to attach and connect them properly. We recommend using shielded cables to reduce interference from external sources. In theory, shielded audio cables are quite suitable for this purpose, but the ends of these cables are fairly fragile. We therefore recommend using small connectors in combination with heat-shrink tub- ing to virtually eliminate the risk of breakage (see Figures a and b). You may have already noticed the shields are connected only at the acquisition board end pf the cables and are carefully insulated at the elec- trode ends to prevent any contact with the skin. If you terminate the cables in 4-mm plugs, you can use commercial electrodes (Figure c), but the prices of these electrodes may put you off (more than 1 0 pounds each, and you need three of them). However, you can also make your own electrodes from coins containing nickel to make the electrodes (some research required to find suitable coins; “Google is your friend”). Solder a length of 4-mm metal tubing onto each coin to receive a 4-mm plug, and you’re ready to go. Use elastic straps (one for each electrode) to hold the electrodes securely in place on the subject’s wrists and lower calf. You can make your own straps by cutting suspenders straps into suitable lengths and sewing or gluing Velcro table to the ends. Straps cut from a bicycle or scoot- er inner tube are also serviceable. 58 01-2011 elektor WIRELESS ECG The wireless signal is received by a board holding only an XBee module only. All you actually need to receive the data and transfer it to your PC is an XBee module and a USB to TTL adapter cable (avail- able from the Elektor Shop; item num- ber 080213-72 for the 3.3-V version). To power the module from the USB bus, install wire link A on the board. Actually, the combination of an XBbee module and a USB-TTL cable (caution: 3.3 V version required, Elektor order code 080213-72,) is sufficient to receive data and convey it to the computer You can also use this cable for configuring the XBee modules. For this purpose, be sure to connect the supply voltage lead of the cable (on the TTL connector) to the XBee module. For data reception, the XBee module only needs to be configured for a serial data interface. Configuring the XBee modules The XBee modules can be configured using a 3.3-V USB to TTL adapter cable and the free program X-CTU I 4 !. The default serial data transmission rate of the XBee mod- ule is 9600 baud. To configure a module, connect it to the PC via the serial interface adapter cable, connect a power source to the module, and launch the X-CTU program (Figure 3). You can use the ‘Modem Configuration’ tab to read and modify the configuration regis- ters of the XBee module. After selecting this tab, click ‘Read’ to read the current register settings. You can modify them directly by selecting values from a drop-down menu, or you can enter new values from the key- board. After changing the settings, select ‘Write’ to save the new register contents. The first time you use X-CTU, you may be asked to download a new version of the modem firmware for the connected XBee module. Click ‘Download new versions...’ to do this automatically, after which you can use the ‘Function Set’ and ‘Version’ menus to select the new modem versions for your modules. Before you configure the modules, it’s a good idea to assign them ID codes so you can tell them apart. After this you must give Figure 3. User interface of the X-CTU program for configuring XBee modules. Figure 4. Block diagram of the ECG simulator. +5V Figure 5. Schematic diagram of the ECG simulator. elektor 01-2011 59 WIRELESS ECG COMPONENT LIST Resistors (SMD 0805 ) R1 ,R19,R20 = 10k£2 R2,R11,R14= 1MO R3=470I<£1 R4 = 240Q R5,R9 = 27k£l R6,R7,R12,R13,R16 = 33I<£1 R8 = 360^ R10 = 8.2I<£2 R15,R17,R18 = 47kn Capacitors (SMD 0805, ceramic, except C1,C7) Cl ,C7 = 47|iF 1 0V, SMD, Kemet B451 96E2476K409 C2,C4,C8,C9,C1 1 ,C1 2 = 1 0OnF C3,C6,C13 = 10nF C5 = 3,3nF Cl 0 = 1 jllF Semiconductors D1 = 1N4148SMDMinimelf D2,D3,D4 = dual diode BAV99 (SOT23) IC1 ,IC3,IC5 = OPA237NA/250 (SOT23-5) IC2 = MAX61 20EUR+T (SOT-23) IC4 = AD623ARZ (SOIC-8) IC6 = LM31 7LM (SOIC-8) Miscellaneous K1 ,l<2 = 2-pin pinheader, lead pitch 0.1 ” (2.54mm) l<3 = 5-pin pinheader, lead pitch 0.1 ” (2.54mm) l<4 = 6-pin pinheader, lead pitch 0.1 ” (2.54mm) SI = pushbutton, make contact, PCB mount, 6mm, e.g Multicomp type MC32830 XB1 = XBee module, ZB ZigBee with chip an- tenna, Digi type XB24-Z7CIT-004 A = no wire link PCB #080805-1, see [1] Receiver only XBee-module, Digi type XB24-Z7CIT-004 USB-to-TTL cable, 3.3V version, Elektor # 080213-72 R19.R20 = 10l<£2 l<4 = 6-pin pinheader, lead pitch 0.1 ” (2.54mm) SI = pushbutton, make contact, PCB mount, 6mm A = wire link PCB #080805-1, see [1] Component layout of the acquisition board. each module a unique address. Every XBee module actually has two addresses. The first is a long unique address (64 bits) in the form of a serial number assigned by the manufac- turer, which is divided into two parts: ‘Serial Number High’ (SH) and ‘Serial Number Low’ (SL). The second is a short address (16 bits) assigned by the user. The short address is used in this system. Configure the short addresses of the modules by setting the ‘Destination Address High’ (DH) register to ‘0’ and the ‘Destination Address Low’ (DL) to a value less than ‘OxFFFE’. Configuring the module on the acquisition board • ‘Networking & Security’ menu: Con- figure the module as an end station by setting ‘Coordinator Enable’ (CE) to ‘O’. Then set the destination address (DL) to ‘0x1 234’ and the source address (MY) to ‘0x5678’. • ‘I/O Settings’ menu: Set ‘DO’ to ‘2’ to enable the A/D converter connected to pin 20 (ADC 2). The XBee module has six ADC inputs (ADO to AD5) on pins 11,15, and 1 7-20. Set ‘IR’ to ‘3’ to configure the sample rate interval to 3 ms. This interval is sufficient for digitising the ECG signal applied to pin 20 of the mod- ule after amplification and filtering. IR will subsequently be set to ‘1 ’ for trans- mitting the sampled data sequence. Configuring the module on the receiver board • ‘Networking & Security’ menu: Set ‘CE’ to ‘1 ’, since this module controls the transmission process. Set the addresses to DL= ‘0x567’ and MY = ‘0x1 234’. • ‘I/O Settings’ menu: Enable the I/O enable command (I/O Output Enable) by setting III to ‘1 ’ (Enabled). • ‘I/O Line Passing’ menu: Set ‘I/O Input Address’ (IA) to ‘0x5678’, which is the same as the address of the module on the acquisition board. If you set ‘PWMO Configuration’ (PO) to ‘2’ (PWM Out- put), you can view the transmitted ECG signal on the receiver board with an oscilloscope after connecting a 200-Hz passive filter to the PWMO output on pin 6. ECG signal simulator We designed this circuit (see Figures 4 and 5) to allow tests and measurements One of the first ECG diagrams taken with the system. The three electrodes are vessels filled with saline water. 60 01-2011 elektor WIRELESS ECG E T ] Figure 6. Simulated ECG signal at the output of a low-pass filter connected to the PWM output of the receiver module (trace 1 ) and the signal from the ECG simulator after attenuation (trace 2). on the entire system to be made safely dur- ing the design phase. It generates a signal that resembles a real ECG signal in terms of period, pulse width and amplitude. This arti- ficial ECG signal is generated by an NE555 configured as an astable multivibrator. The outputs are referenced to a level of approximately 1 .2 V by R7/R8 and R9/R1 0, so they can be connected directly to the inputs of the acquisition card. Capacitor C6 connected to the output of the NE555 shapes the pulse waveform. The diode clamps the negative pulses, and the ampli- tude of the resulting signal is reduced to a few millivolts by voltage divider R5/R6. Assembly Assembling the acquisition and receiver cards is relatively straightforward. Note that the XBee modules have an unusual lead pitch of 2 mm and the leads are square. However, special matching connecters are available. Nine leads of the module on the acquisition card are used, while only five leads of the module on the receiver card are used. Individual socket posts cut from an 1C socket can be used for the connections to the module leads. To allow the modules to be programmed, reprogrammed or used later for other pur- poses, they should not be soldered directly to the PCB. You can use stimulation electrodes for the body electrodes, or you can make your own as described in the ‘Electrodes’ inset. Viewing the ECG signal For safety reasons, you should never con- nect an oscilloscope directly to the acquisi- tion board in order to view the ECG signal. However, you can view the signal on the receiver card if you connect a filter to the PWM output. An example is shown in Fig- ure 6. Another option is to view the signal on the PC monitor by using a program that displays the data received from the inter- face cable in graphic form. Figure 7 shows an example of an ECG plotted with the aid of an interface developed with LabVIEW. It is available as an executable file on the Elektor web page for this article Pi and on the pro- ject website t 5 l. This simple program allows the ECG signal to be visualised quickly. (080805-I) Internet Links [1] www.elektor.com/080805 [2] ‘GBECG’, Elektor October 2006, www.elektor.com/050280 [3] ‘ZigBee Transceiver’, Elektor March 2007, www.elektor.com/060348 [4] www.digi.com/support [5] www.enseignement.ensicaen.fr/claro- line/course/index.php?cid=PRJECGXBEE (in French) VlSArtftMtti (MdhlrftCf ^11. fietj : Site fcJSi \'Vt M»[ QQJI a| a= WSjsJrtis RSI Kfi SS Figure 7. An actual ECG signal on the PC monitor, visualised using a LabVIEW interface. elektor 01-2011 61 IR CAMERA Groping in the Dark Webcam conversion to night-vision camera? By Thijs Beckers (Elektor Netherlands Editorial) Cameras with night-vision capability are not all that cheap. Webcams are. Can you modify such a webcam so that it becomes suitable as a night-vision camera? Several Internet sites claim that this can be done. We will put some these claims to the test. There is a nearly limitless supply of these on the Internet: tutorials for converting all kinds of (electronic) devices. This time our eyes were drawn to converting a cheap webcam into a camera with night- vision capability, that is, a camera which is still able to see in com- plete darkness. The phrase ‘in complete darkness’ is however a little deceptive in this case. To illuminate the field of view of these cam- eras an infra-red floodlight is used, which operates at a wavelength that is not visible to the human eye (all electromagnetic radiation above 780 nm). Anyhow, we were very curious whether this would be possible with any arbitrary webcam. According to the tutorials, you have to remove the IR filter that is in the camera, so that infra-red light will now also register on the CCD of the camera. So, time to get cracking. Not too expensive For our ‘test’ we ‘borrowed’ two webcams from our colleagues. Preferably as cheap as possible. We had a Sweex WC002 and a Konig Computer CMP-Webcam75 at our disposal, neither more expensive than 30 pounds. As a consequence, the quality of the images is not that great, but that was to be expected. The CMP-Webcam75 had the biggest CCD and also the highest resolution: the camera can supply up to 1 290 x 960 pixels. Displaying the image with the same resolution on the laptop screen resulted in the ‘best’ picture. By the way, the webcam is offered on several web sites as a ‘webcam with night-vision’. But don’t be fooled: the four built-in white LEDs are barely sufficient to illuminate your face when you’re directly in front of the cam- era, while chatting and the like. Anything further away than about 1 metre remains practically invisible to the unmodified camera. Results before... After installing the accompanying drivers for these webcams, we decided to test the cameras before making any modifications, so that we could clearly establish any differences brought about by the modifications. In the basement we found a place were we could work that was practically completely dark, which was therefore per- fect for our test location. First we looked at the images with the lights still on (Figure 1 ). On the left is the picture from the CMP-Webcam75, which is set to 640x480 and on the right the picture from the WC002, set to a resolution of 352x288. For clarity we stretched the latter picture to the same size as the Konig webcam. Although the Sweex claims that 640x480 is possible, this is not the case at 30 frames per second... Both drivers are at their default settings. To be able to see something in the dark with these cameras we used Figure 1 . With the lights on both cameras show a (not all that high a quality) image. Figure 2. Without lights the image of both cameras remains black. 62 01-2011 elektor IR CAMERA a few individual IR-LEDs and a — somewhat older, but nevertheless still very well functional — IR-floodlight with 28 IR LEDs from Con- rad Electronics. Neither of these webcams were able to see anything in complete darkness, despite the fact that the infra-red LEDs were turned on (Figure 2). Some image noise and the odd lost red, blue or green pixel were the only things visible on the laptop screen. Only when we pointed the IR LEDs directly into the lens could we see that they were actually turned on. It was not possible to recognise any objects at all in the dark. From this it appears that both cameras have a built-in IR filter. So, open them up, because that has to come out. ...and after modification The lenses are relatively easily removed from the cameras. The Sweex camera is simply snapped together and with the Konig the lens can be unscrewed easily. At certain angles it was possibly to see a red gleam on both lenses: the IR filter. With the Sweex lens we suspected that this could be a coating on the outside of the lens. Attempts to remove the coating, even with a strong cleaning solu- tion, proved to be unsuccessful (the plastic of the lens was melted by the solvent, but unfortunately not the coating). The other lens was different. Here it appeared that on the inside there was a real glass filter. After some careful fiddling (it still had to look nice for the camera) we were able to remove the glass and had the IR filter in our hand (see Figure 3). And now the proof is in the pudding: was the camera with the modified lens more sensitive to IR-light, and if yes, was it actually able to see anything in complete darkness? Figure 4 shows the picture after modification, on the left the Konig and on the right the (unmodified) Sweex. We were quite impressed with the difference! Even with only three IR LEDs it already became clear what objects there were in the dark room. And not only the outlines! It was even possible to read the text on the removal box at a distance of about 5 meters. The result with the IR floodlight was even better (Figure 5). Movement detection is easily possible. We would even dare to suggest that it would be suitable for a security camera at home. We do however have to make a marginal note: we noticed that the focus for the modified lens with IR illumination was different from the focus for normal lighting. When we switched the lights on after we had focussed the Konig lens with IR light, we obtained the pic- ture of Figure 6 on our screen. It was hard to find the correct focus for the Konig webcam. This ‘trick’ is therefore not all that suitable if you want to be able to use the camera both at night and during the day. But because the webcams are so cheap, even the purchase of a pair — one for during the day and one for at night - is still con- siderably cheaper than a real night-vision camera. The conclusion is therefore that if the IR filter can be removed, then the webcam is perfectly suitable as night-vision camera, but the IR filter is not easily removed with all cameras. ( 100537 -I) Figure 3. With the Konig lens the removal of the IR filter was quite easy to do. Figure 4. Using only 3 IR-LEDs a nice picture already begins to form with the modified camera. The camera with IR-filter is still groping in the dark. Figure 5. The IR-floodlight from Conrad makes everything clearer still. People are easily recognisable in complete darkness. Figure 6 . Using the modified camera during both the day and night is unfortunately not very practical: the focussing has to be redone every evening and morning, and by hand. elektor 01-2011 63 DESIGN TIPPS Opamp versus Comparator Superficially similar yet decidedly different By Michael Holzl (Germany) Practically every lecture course or textbook on electronics describes how to use an operational amplifier as a comparator. Here we look at the possibility in more detail, and see how it can often be a very poor idea. The idea behind the comparator configuration is simple. An opamp has a very high open-loop DC gain which means that even a tiny differential input voltage will drive the output to one extreme or the other. If the voltage at the non-inverting (*+’) input is greater than that at the inverting (*-’) input the output goes high; oth- erwise the output goes low. In other words the two voltages are compared and the output is a binary indication of which of the two is the greater. So the opamp looks like the perfect device to provide digital logic levels at their outputs while accepting sym- metrical analogue input signals. What do these differences mean in practice? Comparators can react very quickly to changes in their input voltages with short propa- gation delays and output rise- and fall-times all specified by the manufacturer. In contrast, because opamps are not expected to be used in this mode, manufacturers tend not to give explicit speci- fications for propagation delay and rise- and fall-times (although they do normally specify slew rate), and these characteristics can be considerably poorer for opamps than for comparators. To take an extreme example, a low-power opamp might have a propaga- tion delay measured in milliseconds, whereas a comparator might react in nanoseconds: a million times faster. U1 1 1 / / r~ 1 f r J L \ f Jr 1 1 I J i ii / 1 \ SPICE simulation results: an LT1 028 opamp pressed into service as a comparator versus a real comparator type LT1 720. use as a comparator. But why then do there exist special-purpose comparator devices? Looked at from the outside, opamps and comparators appear indis- tinguishable. Besides power connections, they both have *+* and inputs and a single output. Taking a look at the internal circuit dia- gram, again the two devices appear broadly very similar (although a comparator device with an open-collector or open-drain output does look more obviously different from an opamp). The big dif- ference, which is not apparent without looking at the circuit more closely, is that the output stages of operational amplifiers are designed for linear operation, with the general aim of amplifying the input signal with as little distortion as possible (assuming that some negative feedback is provided), but in the case of a compara- tor the output circuit is designed to operate in saturation, that is, to switch between the upper and lower output voltage limits without the provision of external feedback. Comparators often also offer a ground connection in addition to the usual power connections, and There is a further problem with opamps. Many devices exhibit sig- nificantly increased power consumption when the output is in satu- ration, the resulting power dissipation on occasion being enough to destroy the device. Also, many opamps (those not advertised as having ‘rail-to-rail outputs’) are not capable of driving their out- puts close to the supply rails, for example having a maximum out- put voltage of 3 V with a 5 V supply. There can also be restrictions on the inputs. Some opamps are equipped with antiparallel diodes across their input terminals, which prevent differential input volt- ages of more than about 0.6 V whereas comparators’ inputs are often allowed to vary over the whole supply range. Of course, there are many non-critical applications where an opamp will work perfectly acceptably as a comparator, but it is not a prac- tice to be recommended. The sceptic should lash up a quick test with a comparator and an opamp side-by-side, each fed with a squarewave signal with rapid edges. Some of the potential pitfalls 64 01-2011 elektor are shown up more easily in simulation, such as the possibility of an I opamp being so slow that it entirely misses a narrow pulse. It is hard f to guarantee circuit performance, current consumption, and even I the survival of the device. The illustrations show a SPICE simulation of a relatively nimble opamp (an LT1 028 with a minimum slew rate of 1 1 V/ps) and a type LT1 720 comparator. It is clear that the comparator responds sooner and with a much shorter rise-time. Its output swings all the way to +5 V rather than the 3 V managed by the opamp. The situation is similar when the output swings low: the opamp is much slower and only reaches an output voltage of -3 V rather than -5 V. The original squarewave is hardly recognisable at the opamp’s output. Although the LT1 028 cannot achieve its maximum specified gain with a ±5 V supply, it is still a factor of at least 20 faster than an LM324 (with a slew rate of 0.5 V/ps); what the latter would make of our square- wave would not be a pretty sight. The opamp fails to cope at all with shorter pulses, which are then effectively ‘swallowed’, while the comparator continues to handle them without difficulty. Worthwhile further reading on this subject is Texas Instruments Application Note SLOA067 by Bruce Carter, entitled Op Amps and Comparators - Don’t Confuse Them!. (100050) WWW. elektor. com nurve neTUJoncs lug AVR S-Bit Main PCB Boar#. XGS Gamepad Controller. ^,325 + Page Printed Manual. f^Atmel AVR ISP MKII Programmer, ,9V Power Supply & A/V Cable. ^ PC Serial Port to XGS Converter. |P PC DVD-ROM. < 1GB Micro SD Card + Adapter: Bonus: eBooks on Hardware, * Game Console Design, and More! 3 P5 Technology AFFORDABLE EXPERTISE THE PC OSCILLOSCOPE RANGE FROM PICO TECHNOLOGY BANDWIDTH 20 MHz to 12 GHz SAMPLING RATES 50 MS/s to 5 GS/s MEMORY 8 kS to 1 GS RESOLUTION 8 to 16 bits PRICES £125 to £6995 Latest Software Updates: l 2 C & CAN bus decoding, mask limit testing, advanced triggers, digital low pass filtering, rapid triggering www.picotech.com/scope2030 elektor 01-2011 65 MICROCONTROLLERS Support Board for Arduino Nano By Philippe Fretaud & Francois Auger (Saint-Nazaire Institute of Technology, France) Arduino boards exist in several formats. The standard board (which itself also exists in several versions like the Diecimila, the Duemilanove, the Uno, etc.) is the one that measures around 5x7cm and to which can be added a ‘shield’ — an Arduino extension board. The LilyPad board is a circular Arduino for clothing applications, and the Nano is a small Arduino module (18 x 43 mm) spe- cially designed for use with prototyping boards and breadboards. As these two outputs can’t supply much current, an additional 5 V linear regulator has been incorporated into the support board. The 9 V input rail is also wired to l<6 and l<7. In place of the standard Arduino’s female connectors, the Nano has two rows of 1 5 solder pins on a 2.54 mm (0.1 ”) pitch. So it looks quite a bit like the boards for older microcontrollers like the Basic Stamp 2 or the CUBLOC CB320, with an additional USB link that is ideal for current computers. Unlike a standard Arduino module, the Nano needs a support board if we want to use it in an application. In this article, we’re proposing a motherboard that was origi- nally designed for a robotics application, but which can very well be used for other jobs too. The robotic aspect of this board can be seen in the 6 V supply and connec- tors l<4 and l<5, to which a servomotor can be connected. If you’re not using servos, you can dispense with the 6 V supply. For the rest, the board is very simple: All the Nano’s inputs/outputs are quite simply brought out to two 25-pin sub-D connec- tors (l<6 and l<7). The boards are powered by 9 V. The Nano has an on-board 5 V linear regulator, and also makes available the 3.3 V rail produced by the USB interface chip. By means of JP1 , one of these two voltages can be connected to K6and l<7, by fitting a jumper to contacts 1 and 2 (5 V) or 2 and 3 (3.3 V). These rails are also available when the Nano is powered via its USB port. (100396) 66 01-2011 elektor The Entire Circuit Cellar Archive Choose the Style that Fits You Best CC Gold A Stylish, Durable, Portable, Gold-Plated USB Drive CC Slim The USB Archive that Fits in Your Wallet The Key to Your Success Is Always Handy / The complete Circuit Cellar issue archive and article code stored on a USB flash drive. You can easily keep your CC Gold archive up to date by purchasing subsequent issues from our webshop or by downloading issues with a Circuit Cellar Digital 2.0 Subscription. Issues appear in searchable PDF format. Complete archive includes PDFs of all issues in print through date of purchase. Visit www.cc-webshop.com to purchase Circuit Cellar Archive Index COMPUTERS Three Out of Two Ain’t Bad Add a tachometer output to 2-wire fans By Volker Schmidt (Germany) If you replace a broken three- wire fan in a PC or other device with a more readily-available two-wire fan, the missing tachometer (‘tacho’), signal will cause the system to report a fault and possibly even refuse to function at all. The problem is solved with the circuit shown here, which analyses the fan current to generate a signal that corresponds to its rotation speed. Three-wire fans have an internal tachome- ter which produces a signal on the third wire (the other two being the supply voltage and ground) whose frequency depends on the rotation speed. This output can be used by the device being cooled by the fan to check that the fan is running. If such a fan is replaced by one of the two- wire variety, it is possible to simulate the tacho signal with an astable multivibra- tor circuit, for example using a 555 timer. However, this has the disadvantage that the operation of the fan can no longer be properly monitored by the device. One way to generate a meaningful tacho signal is to analyse the current draw of the fan. The simple circuit shown here uses a read- ily-available TL074 quad op-amp and just a handful of other ordinary components. How it works The circuit does not look at the absolute level of current draw of the fan: rather, it analyses the regular variations in current which are synchronised with the rotation of the fan. The oscilloscope trace in Figure 1 shows the characteristic regular interrup- tions to the current flow from which our cir- cuit derives the tacho signal. We use a low- value resistor as a current sensor, coupled to a differential amplifier to extract the signal. The resulting signal is then cleaned up and used to trigger a monostable circuit. The details The circuit of the tacho signal generator (Figure 2) is centred around a type TL074 quad op-amp. A few passive components, three diodes, one Zener diode and two tran- sistors complete the circuit. R1 is the current sensor, with a value of 1 Q. The low value means that the voltage to We tested the circuit in the Elektor labs with a two-wire fan made by Canon (type number CF80-T21 1 N1 D). We compared the tacho signal output by the circuit with that of a three-wire fan, a Sunon KDE1 208PTB1 -6A, which provides its ta- cho signal on a yellow wire. With a 1 2 V supply the circuit worked well. the fan will not be reduced to a significant extent. Differential amplifier IC1 .A ampli- fies the voltage drop across R1 by a factor of about 21 and inverts the signal. Interrup- tions to the fan current therefore appear as positive-going spikes at its output. Capaci- tor Cl couples these to the input of compar- ator IC1 .B. If the spike peak should exceed the threshold set by the voltage divider comprising R6 and R7 the output of IC1 .B will swing high, almost to the positive sup- ply rail. The spikes are thus converted into a rectangular wave signal (see Figure 3). The third op-amp (IC1.C) forms a mono- stable triggered by positive-going edges The duty cycle is not 50 % and falls at reduced supply voltage and fan rotation rate: the pulse width remains the same, but the interval be- tween pulses increases as rotation slows. Our test fan gave a duty cycle of 50 % with a 1 2 V supply using a value of 56 nF for C2. Since the virtual ground generated by Zener diode D4 and T1 is fixed relative to the system ground, the supply becomes asymmetric at 68 01-2011 elektor COMPUTERS of this rectangular wave. The period of the monostable is given by the formula t= R9xC2xln (1 + R1 1/R10) and with the suggested component values the output pulses are a little over one mil- lisecond wide. The output stage, consist- ing of IC1 .D and T2, provides this signal as an open-collector output. As T2 inverts the signal, IC1.D is also wired in an inverting buffer configuration (gain of -1 ). JP1 gives the choice of this open-collector output or a direct output from IC1 .C. The circuit takes its power from the +1 2 V supply to the fan, which is normally pro- vided by the device being cooled. D3 and C3 smooth the supply and the circuit around T1 provides a virtual ground at around half the supply voltage. In effect this provides a symmetric ±6 V supply to the op-amps in the TL074, referenced to the virtual ground. In practice When building the circuit, be aware that the ground symbol that appears at vari- ous points in the circuit diagram is not system ground, but the virtual ground at around half the supply voltage. These vir- tual ground points should be connected to one another, but not, of course, to system ground! System ground is connected only to the GND pin of K1 and thence to other points in the circuit marked in the diagram with an inverted triangle. The circuit can be built on a piece of proto- typing board (Figure 4) with the following external connections: supply voltages of less than 1 2 V. Soon the TL074 will be operating outside of its rated common-mode range, and the supply voltage will also soon be below the device’s specifica- tion. If the speed of the fan is to be controlled by adjusting its supply voltage it is a good idea to improve the symmetry of the supply, for example by replacing Zener diode D4 by a 2 l<^ resistor (1 .8 to or 2.2 to will do). The circuit will now operate from a supply of be- Figure 1 . Oscilloscope trace showing regular interruptions in the fan current, from which the tacho signal is derived. Figure 3. The signal at the output of the differential amplifier (upper trace) and the tacho signal at the output of the circuit (lower trace). K1 IC1 = TL074 JPl R13 Opamp C /■ ? 1 22k 1 Open Collector V c 7 ) 100257 - 11 % Figure 2. The circuit uses a resistor as a current sensor, with the signal being amplified by a differential amplifier before being cleaned and fed to a monostable stage. tween 6 V and 1 2 V, with the virtual ground being at slightly above half the supply volt- age (which does not impair performance). If the supply voltage falls to 5.5 V or below the circuit will start to oscillate: the TL074 is not designed to work at such low voltages. The suggested component values worked well with the Canon fan. The period of the output varied from 4.1 5 ms (at 1 2 V) to 8.4 ms (at 6 V). The ‘real’ tacho pulse gen- erator on the three-wire Sunon fan was in reasonably good agreement, with periods of 5.9 ms at 1 2 V and 1 0.8 ms at 6 V. The current consumption of the circuit it- self was measured at 1 8.7 mA at 1 2 V and 9.4 mA at 6 V. Ton Giesberts (Elektor Llabs) elektor 01-2011 69 COMPUTERS Figure 4. The Elektor lab prototype, assembled on a piece of prototyping board. connector in the PC or other device; the tacho signal from the pin marked ‘sen- sor’ on K1 , taken to the tacho pin on the fan supply connector; system ground to the ‘GND’ pin on l<1, taken from the ground pin on the fan sup- ply connector; the two wires to the replacement fan, its +12 V positive supply being connected to the point marked *+’ on the circuit diagram (at the junction of R1 and R2)and its ground to the GND pin of K1 (system ground). marked ‘sensor’ in the diagram is labelled ‘rotation’ by the manufacturer. Operation of the circuit has been tested with Mag Lev-series fans made by Sunon as well as other types. The circuit may need to be adapted to suit certain types of fan. For proper operation the circuit needs a sig- nal amplitude of around 200 mVpp across current sense resistor R1. If this level is not achieved, make suitable adjustments either to R1 itself or to the gain of differen- tial amplifier IC1 .A by changing the ratio of R5 to R3 and of R4 to R2. + 12 V to the pin marked ‘+ 1 2 V’ on l<1, taken from the +1 2 V pin on the fan supply The pin arrangement for K1 shown in the circuit diagram is compatible with the con- nector for three-wire fans usually found on PC motherboards. Sometimes the pin For slow fans the monostable period of 1 ms may be too short. Increase it if necessary by increasing the value of C2 and/or R9. (100257) Advertisement Fundamental Amplifier Techniques with Electron Tubes <=> The ultimate tube amplifier reference book! The aim of this book is to give the reader useful knowledge about electron tube technology in the application of audio amplifiers, including their power supplies, for the design and DIY construction of these electron tube amplifiers. This is much more than just building an electron tube amplifier from a schematic made from the design from someone else: not only academic theory for scientific evidence, but also a theoretical explanation of how the practice works. No modern simulations, but because you first understand the circuit calculations, then you can work with your hands to build the circuit and last, but not least, if you have a multimeter, a signal generator and an oscilloscope, you can measure the circuit parameters yourself to see that theory and practice are very close. That is the aim, and makes this book a unique reference source. Elektor Further information and ordering atwww.elektor.com/shop w 70 01-2011 elektor * I (only 130 |jA / MHz) ■ganging the MCU landscape for low power 8-bit and 16-bit applications The LPC1 100L microcontroller offers a seamless entry point for any 8-/1 6-bit designer looking for scalable architecture for their entire product range. ► ARM Cortex-MO ► Superior code density than 8-/1 6-bit ► Higher performance than 8-/1 6-bit ► Lowest active power consumption ► Supported by NXP's LPCXpresso tool platform www.nxp.com/lpd 1 001 RADIO Notch Filters for Intermediate Frequencies Effective and selective By Michael A. Shustov (Russia) In radios designed for long distance communication, a notch filter is used to suppress or hopefully wipe out noise, whistles, buzzes, static, chirps, woodpeckers and what have you that persistently degrade the wanted signal. In this article we cover simple LC and RC notch filters for use in the radio’s intermediate frequency (IF) section. Notch filters — sometimes called or band reject filters or just notches — need to be extremely selective for the obvious reason that you do not want them to start affecting the wanted signal, although in most cases that can’t be ruled out entirely. Rephrasing for tech- nospeak, great attention must be paid to the notch filter’s tuning, bandwidth and steepness of the frequency response. Notch fil- ters occur, and may be applied at, RF (antenna), IF (intermediate frequency; typically 1 0.7 MHz, 9 MHz, 500 kHz or 455 kHz) or AF 2N3686 TO-72 Cl 2n2 R1 X T1 T2 LI 470uH C2 2x © 2N3686 T R2 2n2 In L2 __rwY^_ 220uH ll C5 5p...25p C6 II R3 X In C7 HI R5 2n2 C3 l +12V -© O* 090686 - 11 Figure 1 . A peaking LC filter designed for an IF of 500 kHz. Tweak R4 to adjust the effectiveness. SI is the ‘defeat’ switch and C4 acts as a fine tuning control. 2N3686 TO-72 ci 2n2 R1 X R3 T1 T2 R5 R6 C2 II 2n2 C3 II I I 660p C5 2x 2N3686 © R4 -| 30k \ 330p SI PI II 330p / ft R2 100R R7 X +12V -© R8 C6 II 2n2 R9 090686 - 12 Figure 2. This filter with an RC network in the positive feedback path offers a true notch (frequency reject) response. 72 01-2011 elektor RADIO ► f [kHz] 090686 - 14 Figure 3. Frequency response of the LC filter (curve 1 : SI open; curve 2: SI closed). Figure 4. Frequency response of the RC filter (curve 1 : SI open; curve 2: S closed). (audio; now the accepted realm of DSPs). A well trained radio opera- tor is able to juggle his notches at RF, IF and AF (if available), ward- ing off all types of interference that mess up the signal he wants to hear, decode or process. Lots of skill is required, as well as a trained ear, to continually tune notches in the fight against rapidly chang- ing noise patterns, interfering traffic on a channel or breakthrough from local stations. Although technically speaking not a ‘notch’, a very steep bandpass filter has similar effects to a notch on weak telegraphic (CW) or sin- gle-sideband (SSB) signals — zooming in, as it were, on the wanted signal heavily affected by noise either side, instead of suppressing individual noise components. L, C, R and FET to combat noise The notch filters described here are of the LC and RC type, and intended for application in the intermediate frequency (IF) section of a radio receiver. Their principle of operation is identical, though the circuit in Figure 1 is a sharp filter tuned to the signal, and the one shown in Figure 2, a notch suppressing selected noise compo- nents. Both have an on/off control and a ‘depth’ (or ‘peak’) control included. They are designed for operation at 502.7 kHz (basically 500 kHz IF + 2.7 kHz sideband) in terms of the frequency-deter- mining components. The filters consist of a source fol lower T1 at the input and an ampli- fier stage T2 with a degree of positive feedback. The operating fre- quency of the filters is defined by the LC (Figure 1) or RC parts (Fig- ure 2) in the positive feedback path. The amount of positive feedback and with it the effectiveness of the filters is adjusted by selection (or fine tuning) of resistor R4 in the LC circuit (Figure 1 ), or adjustment of PI in the RC circuit (Figure 2). The operating frequency (rejection frequency) of the LC filter can be fine tuned by trimmer C4. Alternatively, a varicap (variable capaci- tance diode) with a 25 pF range may be used in this position. Switch SI is the On/Defeat control for both filters. Performance As shown in Figure 3, the LC filter achieves a steep ‘inverted notch’ response with a peak at 37 dB. By closing switch SI the IF signal is passed with no filter action and minimal attenuation. Compared to the LC filter, the RC variant allows effective and selec- tive suppression of interfering signals within the IF passband, see Figure 4. At a rejection frequency of 504.0 kHz, depending on filter adjustment, the noise suppression can reach 83-90 dB with an over- all attenuation of about 40 dB for all other signals. When switch SI is closed, the filter is disabled you’re looking at an overall attenuation of about 22 dB. Remembering that we are dealing with a 500 kHz IF signal, this should be relatively easy to restore back to its original level by adding an extra gain stage. (090686) elektor 01-2011 73 Electronics at all the right levels 3 subscription! OSD2 Simulator Advantages to subscribers OIYRFID Extension Board JnterSceptre w ■dO-C'l-l H f"*' 1 ,of ycU Acct V°° r ° llbs criP«» n , e \cktor- co “Elektor? Prescribed reading for our R&D staff because that’s where we need professional guidance for microcontroller technology.” Frank Hawkes, 39, development engineer doud Altimeter Secure a head start in electronics with Cheaper than 1 1 issues from the newsstand With every issue subscribers get up to 40% discount on selected Elektor products Free welcome gift of your choice with an annual subscription No queues, travelling, parking fees or ‘sold out’; Elektor is supplied to your doorstep every month Always up to date - read your copy before everyone else www.elektor.com/subs - Tel. +44 (0) 20 8261 4509 Or use the subscription order form near the end of the magazine. INFOTAINMENT Hexadoku Puzzle with an electronics touch A new year brings new opportunities, hopefully also for our monthly Hexadoku competition. This month we present a puzzle that’s slightly more difficult than usual, but feel free to disagree and find it a walk in the park. Enter the right numbers in the puzzle, send the ones in the grey boxes to us and you automatically enter the prize draw for four Elektor Shop vouchers. Have fun! The instructions for this puzzle are straightforward. Fully geared to electronics fans and programmers, the Hexadoku puzzle employs the hexadecimal range 0 through F. In the diagram composed of 16x16 boxes, enter numbers such that all hexadecimal numbers 0 through F (that’s 0-9 and A-F) occur once only in each row, once Correct solutions received from the entire Elektor readership automati- cally enter a prize draw for one Elektor Shop voucher worth £ 80.00 and three Elektor Shop Vouchers worth £ 40.00 each, which should encourage all Elektor readers to participate. Prize winners The solution of the November 201 0 Hexadoku is: 3F642. The £80.00 voucher has been awarded to: Luciano Poretti (Italy). The £40.00 vouchers have been awarded to: Marc Moulin (France), David Meiklejohn (Australia) and Christian Klems (The Netherlands). Congratulations everyone! Solve Hexadoku and win! 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 and these determine the start situation. Correct entries received enter a draw for a main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. Participate! Before February 1 , 201 1 , send your solution (the numbers in the grey boxes) by email, fax or post to Elektor Hexadoku - 1000, Great West Road - Brentford TW8 9HH United Kingdom. Fax (+44) 208 2614447 Email: hexadoku@elektor.com F 9 3 5 6 1 4 2 D 7 E A 8 B 0 C 6 8 C B D 9 7 5 1 4 0 3 A F 2 E D 1 A 2 E C 0 3 F 8 9 B 5 6 4 7 4 E 0 7 B A 8 F 6 2 5 C 9 D 3 1 7 4 B E 2 F 3 0 C A D 9 6 5 1 8 0 D 5 F 7 B 1 4 E 6 2 8 C A 9 3 A 6 2 C 5 D 9 8 3 1 7 F B 0 E 4 9 3 8 1 C 6 A E 4 0 B 5 D 7 F 2 5 0 4 D F 8 2 9 B E A 7 1 3 C 6 B 2 1 3 A E C D 9 F 6 0 7 4 8 5 C 7 9 8 4 0 6 B 2 5 3 1 F E A D E F 6 A 1 3 5 7 8 C 4 D 2 9 B 0 3 C D 4 9 5 E A 7 B 8 2 0 1 6 F 1 B E 9 8 7 D C 0 3 F 6 4 2 5 A 8 5 F 0 3 2 B 6 A D 1 4 E C 7 9 2 A 7 6 0 4 F 1 5 9 C E 3 8 D B F 6 0 5 1 9 D E D 4 9 3 2 D 8 6 3 7 9 5 6 8 F 3 A 0 1 c 2 D F A 7 c 6 1 2 0 5 8 1 A 7 4 E 9 6 7 D 3 F B 0 B 6 c D 7 1 5 4 8 6 3 9 D 6 4 E 5 4 0 9 D 5 7 F A A F c 5 B E 4 8 8 3 5 D 6 B E c 4 1 7 2 E 5 7 4 8 D 1 9 A 6 7 4 1 D 5 2 6 B The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. elektor 01-2011 75 RETRONICS Tandberg Model 5 & Stereo Record Amplifier (ca. 1959) By Ricard Wanderlof (Sweden) In the late 1 950’s, stereo was in its infancy as far as Joe Bloggs was concerned — what little equip- ment there was being firmly aimed at the rich & wealthy. While mainstream stereo radio was still a long way off, probably due to the investment in infra- structure that was required (i.e. not only radio receivers but also studios and transmitters would have needed to be upgraded), record players and tape players were starting to become available in stereo versions. Record players and tape recorders Meanwhile manufacturers offered mono record players and reel- to-reel tape recorders with stereo upgrade capa- bilities. In the case of record players, many devices were fitted with stereo pickup cartridges, with the channels wired in parallel for mono use, but eas- ily upgraded to stereo by a simple rewiring operation. When it came to tape record- ers, things weren’t so simple. As opposed to a vinyl record, where both channels are in principle recorded on adjacent sides of a single groove, magnetic tape requires two separate tracks for stereo operation. This gives the user the obvious option of ste- reo recording, or mono record- ing with twice the recording time. With hindsight, this capa- bility completely escaped the compact cassette format, but resurfaced in the Minidisc system many years later. From mono to stereo With not a lot of stereo material to record and FM stereo radio broadcasts few and far between or experimental only, many tape recorder manufacturers offered mono machines with some form of stereo playback capability using some form of external amplifier. Some manufacturers like the Norwegian Tandberg released several variations on the theme. One such machine, the Tandberg Model 5, launched at the end of the 1950s (Figure 1), was one of the first four track tape record- ers in the world. Basi- cally, it allows for record- ing four tracks on the ta pe- as the name implies — i.e. two in each direction of the tape. The Model 5 is a rather unusual machine in that it has two complete amplifiers, for complete stereo playback, but only one of them can be put in recording mode. It also has just one internal speaker, but that is not too unusual; even with two speakers the ste- reo effect is rather limited in such a relatively small device, so many manufacturers opted to have one speaker external for stereo repro- duction. In many cases the external speaker would be contained in the removable lid of the tape recorder, such as in a few Philips stereo machines from the same period. An add-on stereo recording amplifier The Stereo Record Ampli- fier pictured in Figure 2 was supplied by Tandberg as an accessory to their Model 5 tape recorder. This add-on device plugs into the rather unusual DIN con- nector on the rear head cover of the tape recorder (Figure 3), supplying the lower half of the tape head (right hand chan- nel) with a recording signal. The unit gets its power from the tape recorder via a connec- tor with a four-pin socket emanat- ing from the AC power cable stor- age compartment on the back of the machine (Figure 4). The Stereo Record Amplifier contains a For some time in the early 1 960’s it seemed that audio equipment manu- facturers expected stereo to completely take over from mono, but that was not destined to happen for another ten years. 76 01-2011 elektor RETRONICS complete recording amplifier for the right hand channel, with line and microphone inputs, a volume control, a ‘magic eye’ recording level indicator, and a speed selec- tor switch which would have to be set to the same setting as the one on the tape recorder to get proper recording equalization. The Model 5 is the only Tandberg to employ an external amplifier in this way, and indeed I’ve never come across any other machine from another manufacturer with a similar setup. . - .v Why Tandberg opted for the exter- nal amplifier like this is a bit of a mystery to me. Indeed, as noted above, few people would have anything to record in stereo, but given that the Model 5 already had two amplifiers, having built-in stereo recording capabilities would be mostly a question of a few additional connectors and a bit of signal switching. This machine was already the top-of-the line model at its time, so it must have been rather expensive — hence I don’t think the additional cost would have made much of a differ- ence. Perhaps the stereo recording capability was added as an after- thought, late in the development phase of the machine. and after it... A further variation came soon (that’s right, after the Model 5) with the Model 4, which offered another variation on the same theme. In contrast to the Models 3 and 5, it did not have two complete playback amplifiers, and did not support recording in stereo at all; instead it had a preamp for the right-hand chan- nel and required an external amplifier such as a tabletop radio for playing back in stereo. This layout was not too uncommon in those days, the rationale being that if someone wanted to play back in stereo they could provide their own amplifier for the right hand channel without the cost of the machine going up as a result of something that most people would never use. The rationale for that was that two- track mono was the norm in those days (flipping over the tape at each end to record on both ‘sides’), but stereo was around the corner, and the natural step would be to use both channels for stereo. It was probably assumed that few people would record in stereo, the fea- ture being intended primarily for the playback of pre-recorded tapes. Going further, at the beginning of the 1 960s, Tandberg launched the Model 7 which had a complete ste- reo recording and playback sys- tem including two loudspeakers. The EM71 indicator tube had been replaced by the smaller EAM86 so that there was space for two indi- cators side by side for the left and right channels, and thus oddball machines like the Model 5 with its add-on Stereo Record Amplifier became history. (100733) Special thanks are due to Jan Didden for supplying the mint Tandberg stereo recording amplifier pictured here. lowed by the four-track Model 5. With four-track capability came the option of recording either in stereo or getting twice the play- ing time by recording on the left and right tracks separately. The Model 5 could thus record either on the right or left tracks, or play back either in stereo, or in mono from either track, and of course, record in stereo together with the external record amplifier. MP3 generation R U still there? Before the Model 5... Putting it all in perspective, the first stereo Tandberg was the Model 3 Stereo, introduced a cou- ple of years before the Model 5. The ‘3’ could play back two track stereo (it had two complete ampli- fiers but only one speaker like the Model 5), but recording on one channel only (left). Shortly afterwards, four track recording was introduced, which I believe was deemed to be the future, and the Model 3 was fol- 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 elektor 01-2011 77 ELEKTOR SHOWCASE To book your showcase space contact Huson International Media Tel. 0044 (0) 1932 564999 Fax 0044 (0) 1 932 564998 ASTROBE V3.0 www.astrobe.com Windows Development System for LPC2000 microcontrollers. • Develop high-and low-level software without C or assembler • Generate fast 32-bit native ARM code • No special programming hardware required • Personal, Standard and Professional Editions ATOMIC PROGRAMMING LTD www.atomicprogramming.com • AP-114 ISP/JTAG Programming System • JTAG Programming and Testing • Boundary Scan Testing • Universal In-System Programming • EEPROM and SPI Flash Out-of-Circuit Programming • Generic GDB Proxy Server • Jennie JN5148 ZigBee Development Applications • Training Platform available 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. From £10.00. BETA LAYOUT www.pcb-pool.com Beta layout Ltd Award- winning site in both English and German offers prototype PCBs at a fraction of the cost of the usual manufacturer’s prices. 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 CEDA www.ceda.in ceda@vsnl.com V 1 | 1 ) /\ JTi, 1 JiJ | OrCAD | -learning PCB layout^ ■GRO $5 Hourly • PCB Layout & library service @$5 Hourly • PCB Reverse Engg, MCU Code/ckt. Extraction service • Learn Signal Integrity with Hyperlynx, PCB Design with PADS & Allegro. Support by email & web meeting DESIGNER SYSTEMS http://www.designersystems.co.uk Professional product development services. • Marine (Security, Tracking, Monitoring & control) • Automotive (AV, Tracking, Gadget, Monitoring & control) • Industrial (Safety systems, Monitoring over Ethernet) • Telecoms (PSTN handsets, GSM/GPRS) • Audiovisual ((HD)DVD accessories & controllers) Tel: +44 (0) 845 5192306 EASYSYNC http://www.easysync.co.uk EasySync Ltd sells a wide range of single and multi- port USB to RS232/RS422 and RS485 converters at competitive prices. ELNEC www.elnec.com Europe’s leading device programmers manufacturer: • reliable HW: 3 years warranty for \ * most programmers • support over 58.000 devices • free SW updates • SW release: few times a week • excellent technical support: Algorithms On Request, On Demand SW • all products at stock / fast delivery www. elektor. com EMBEDDED ADVENTURES www.embeddedadventures.com From news and tutorials to modules, components and kits, we have everything for your next microcontroller based project. Your embedded adventure starts here. .embedded adventures ^ FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk • Training and Consulting First for IT, Embedded and Technofogy Real Time Systems Tran ^ r • Assembler, C, C++ (all levels) • 8, 16 and 32 bit microcontrollers • Microchip, ARM, Renesas,TI, Freescale • CMX, uCOSII, FreeRTOS, Linux operating systems • Ethernet, CAN, USB, TCP/IP, Zigbee, Bluetooth programming FLEXIPANEL LTD www.flexipanel.com TEAclippers - the smallest PIC programmers in the world, from £20 each: • Per-copy firmware sales • Firmware programming & archiving • In-the-field firmware updates • Protection from design theft by subcontractors FUTURE TECHNOLOGY DEVICES http://www.ftdichip.com FTDI designs and sells USB-UART and USB-FIFO interface i.e.’s. Complete with PC drivers, these devices simplify the task of designing or upgrading peripherals to USB Instruments A Rohde & Schwarz Company 0 Oscilloscopes 0 Power Supplies 0 Spectrum Analyzers 0 RF Instruments 0 Programmable Measuring Instruments Great Value in Test & Measurement www.hameg.com 78 01-2011 elektor products and services directory HEXWAX LTD www.hexwax.com World leaders in Driver-Free USB ICs: • USB-UART/SPI/I2C bridges • TEAleaf-USB authentication dongles • expandlO-USB I/O USB expander • USB-FileSys flash drive with SPI interface • USB-DAQ data logging flash drive — = = = Z T 60 pages of tech audio articles Linear Audio Self ' Linkwitz ' Cordell, Pass a.o. your tech audio resource www.linearaudio.net MQP ELECTRONICS www.mqp.com • Low cost USB Bus Analysers • High, Full or Low speed captures • Graphical analysis and filtering • Automatic speed detection • Bus powered from high speed PC • Capture buttons and feature connector • Optional analysis classes www. elektor. com ROBOT ELECTRONICS http://www.robot-electronics.co.uk Advanced Sensors and Electronics for Robotics • Ultrasonic Range Finders • Compass modules • Infra-Red Thermal sensors STEORN SKDB LITE Join the SKDB Lite, the place to understand, discuss and experiment with magnetics. • Learn more about magnetics and electromagnetics • Participate in developer forums and discussion surrounding magnetics and related topics. For FREE access to SKDB Lite: https://kdb.steorn.com/ref25 • Motor Controllers • Vision Systems • Wireless Telemetry Links • Embedded Controllers ROBOTIQ http://www.robotiq.co.uk Build your own Robot! Fun for the whole family! Now, available in time for X-mas • Arduino Starter Kits *NEW!!* • Lego NXT Mindstorms • Affordable Embedded Linux Boards • Vex Robotics (kits and components) • POB Robots (kits and components) email: sales@robotiq.co.uk Tel: 020 8669 0769 USB INSTRUMENTS http://www.usb-instruments.com USB Instruments specialises in PC based instrumentation / products and software such as Oscilloscopes, Data Loggers, Logic Analaysers which interface to your PC via USB VIRTINS TECHNOLOGY www.virtins.com PC and Pocket PC based virtual instrument such as sound card real time oscilloscope, spectrum analyzer, signal generator, multimeter, sound meter, distortion analyzer, LCR meter. Free to download and try. 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 £242 + VAT (£22 per issue for eleven issues) Elektor will publish your company name, website address and a 30- word description For £363 + VAT for the year (£33 per issue for eleven issues) we will publish the above plus run a 3 cm 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 £242 + VAT • Text and photo for £363 + VAT NAME: ORGANISATION: JOB TITLE: ADDRESS: TEL: PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 00-44-(0)1932 564998 COMPANY NAME WEB ADDRESS 30- WORD DESCRIPTION elektor 01-2011 79 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES Going Strong A world of electronics from a single shop! Experiments with Digital Electronics An introduction to digital control electronics Experiments with Digital Electronics This book presents fundamental circuits using gates, flip-flops and counters from the CMOS 4000 Series. Learning these fundamentals is best done using practical experiments. Each of the 50 experiments presented in this book has a circuit dia- gram as well as a detailed illustration of the circuit’s construction on solderless bread- board. Building these digital circuits will improve your knowledge and will be fun to boot. Many of the circuits have practical real-life applications. 176 pages • ISBN 978-0-905705-97-2 £26.50 • US $42.80 Get started quickly and proceed rapidly Python Programming and GUIs This is the perfect bookfor people who want to learn C and who want to use an mbed ARM micro- controller in an easy and fun way. The mbed NXP LPC1 768 uses cloud technology, a revolutionary concept in software development. This means you do not need to install software on your PC in order to program the mbed! The only thing you need is a browser such as Microsoft Internet Ex- plorer, and a USB port on your PC. No previous experience or knowledge required. You can get ac- cess to your project from any PC anywhere in the world and continue working on it. When you are done a few simple mouse clicks transfer the program to your mbed hardware. Examples of the projects in this book: flashing light, timer, light activated switch, digital thermometer, people de- tector, USB communication, talking microcontroller, debugging, sound switch, and much more. Also order the associated starter kit (Art.# 1 09022-71 ) and get started straight away with the projects described in the book! 256 pages • ISBN 978-0-905705-94-1 • £29.50 • US $47.60 This book is aimed at people who want to interface PCs with hardware projects using graphic user interfaces. The programming language used is Python, an object-orient- ed scripting language. The book guides you through starting with Linux byway of a free downloadable, live bootable distri- bution that can be ported around different computers without requiring hard drive installation. 224 pages • ISBN 978-0-905705-87-3 £29.50 • US $47.60 8o Prices and item descriptions subject to change. E. & O.E 01-2011 elektor A Use only free or open source software ARM Microcontroller Interfacing Learn to interface and program hardware devices in a wide range of useful applica- tions, using ARM7 microcontrollers and the C programming language. Examples covered in full detail include a simple LED to a multi-megabyte SD card running the FAT file system. Interface to LEDs, transis- tors, optocouplers, relays, solenoids, switches, keypads, LCD displays, seven segment displays, DC motors, stepper mo- tors, external analogue signals using the ADC, RS-232, RS-485, TWI, USB, SPI and SD memory cards. 250 pages • ISBN 978-0-905705-91-0 £29.50 • US $47.60 Power Electronics Principles, Application and Design Power Electronics in Motor Drives This book is aimed at people who want to understand how AC inverter drives work and how they are used in industry. The book is much more about the practical design and application of drives than about the mathematical principles behind them. The detailed electronics of DC and AC drive are explained, together with the theore- tical background and the practical design issues such as cooling and protection. 240 pages • ISBN 978-0-905705-89-7 £29.50 • US $47.60 ViHMlSlildlQ C# 201 0 Programming •t*— B' M — ¥— -a ii^ ■■ ■ ■■»■ ii • rkjHH Al L hVIJWH ^ f p^tseiieri) Visual Studio C# 201 0 Programming and PC interfacing This book is aimed at anyone who wants to learn about C# programming and interfac- ing to a PC. It covers programming con- cepts from the basics to object oriented programming, displaying graphs, thread- ing and databases. The book is complete with many full program examples, self as- sessment exercises and links to supporting videos. All code examples used are availa- ble -free of charge- from a special support website. Professional quality software tools are downloadable -also free of charge- from Microsoft. The Microsoft Visual Studio 201 0 environment is extensively covered with user controls and their properties, methods and events. Detailed guidance is provided for those wishing to control hard- ware from a PC with PC interfacing chapters which explain the legacy serial and parallel ports, analogue interfacing using the sound card and use of Microsoft DirectX drivers. Interfacing to the ubiquitous USB port is ex- plained in-depth with a detailed hardware and software design for a USB connected PIC-based hardware target included. 306 pages • ISBN 978-0-905705-95-8 £29.50 • US$47.60 ' More information on the Elektor Website: www.elektor.com Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 Email: sales@elektor.com A A must-have for audiophiles dvd Masterclass High- End Valve Amplifiers In this Masterclass Menno van der Veen will examine the predictability and perceptibi- lity of the specifications of valve amplifiers. The DVD represents 3.5 hours of video ma- terial. Bonus elements on the DVD include the complete PowerPoint presentation (74 slides), scanned overhead sheets (22 pcs), AES Publications mentioned during the Masterclass. Not forgetting the bombshell: 25 Elektor publications about valves. ISBN 978-0-905705-86-6 £24.90 • US $40.20 75 Audio designs for home construction dvd The Audio Collection 3 This DVD contains more than 75 different audio circuits from the volumes 2002- 2008 of Elektor. The articles on the DVD- ROM cover Amplifiers, Digital Audio, Loudspeakers, PC Audio, Test & Measure- ment and Valves. Highlights include the ClariTy 2x300 W Class-T amplifier, High- End Power Amp, Digital VU Meter, Valve Sound Converter, paX Power Amplifier, MP3 preamp and much more. Using the included Adobe Reader you are able to browse the articles on your computer, as well as print texts, circuit diagrams and PCB layouts. ISBN 978-90-5381 -263-1 £17.90 • US$28.90 elektor 01-2011 81 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES 110 issues, more than 2,1 00 articles dvd Elektor 1990 through 1999 This DVD-ROM contains the full range of 1 990-1 999 volumes (all 1 1 0 issues) of Elektor Electronics magazine (PDF). The more than 2,1 00 separate articles have been classified chronologically by their dates of publication (month/year), but are also listed alphabetically by topic. A comprehensive index enables you to search the entire DVD. ISBN 978-0-905705-76-7 £69.00 • US$100.00 (December 2010) An Internet connection would beavalua- ble addition to many projects, but often designers are put off by the complexities involved. The ‘NetWorker’, which consists of a small printed circuit board, a free soft- ware library and a ready-to-use microcon- troller-based web server, solves these problems and allows beginners to add In- ternet connectivity to their projects. More experienced users will benefit from featu- res such as SPI communications, power over Ethernet (PoE) and more. Module , ready assembled and tested Art.# 100552-91 • £53.00 • US$85.50 More than 75 power supply designs cd The Power Supply Collection 1 This CD-ROM contains more than 75 dif- ferent power supply circuits from the volumes 2001-2005 of Elektor. High- lights include the Cuk Converter, Auto- matic Battery Switchover, Battery Voltage LED, Digital Benchtop Power Supply, Lithium-Ion Charger, Electronic Fuse, High Voltage Regulator, Power Supply for USB Devices, Step-up Conver- ter for White LEDs, Vehicle Adapter for Notebook PCs and much more. Using the included Adobe Reader you are able to browse the articles on your computer, as well as print texts, circuit diagrams and PCB layouts. ISBN 978-90-5381 -265-5 £17.90 • US$28.90 Digital Multi-Effects Unit (September 2010) It’s a simple fact: every recording sounds better with the right sound effects. Here we prove that it’s possible to generate a variety of effects digitally, including hall, chorus and flanger effects, without having to workyourself to the bone with DSP pro- gramming. The circuit is built around a highly integrated effects chip and featu- res an intelligent user interface with an LCD. The result is a treat for the eye and the ear. Kit of parts including PCBs , programmed controllers and EEPROM Art.# 090835-71 • £165.00 • US$266.20 The Elektor DSP radio (July/August 2010) Many radio amateurs in practice use two receivers, one portable and the other a fixed receiver with a PC control facility. The Elektor DSP radio can operate in ei- ther capacity, with a USB interface giving the option of PC control. An additional feature of the USB interface is that it can be used as the source of power for the re- ceiver, the audio output being connected to the PC’s powered speakers. To allow portable 6 V battery operation the circuit also provides foran audio amplifierwith one ortwo loudspeakers. PCB, assembled and tested Art.# 100126-91 • £149.00 • US$240.40 Reign with the Sceptre (March 2010) This open-source & open-hardware pro- ject aims to be more than just a little board with a big microcontroller and a few use- ful peripherals — it seeks to be a fast pro- totyping system. To justify this title, in addition to a very useful little board, we also need user-friendly development tools and libraries that allow fast implementa- tion of the board’s peripherals. Ambitio- us? Maybe, but nothing should deter you from becoming Master of Embedded Sys- tems Universe with the help of the Elektor Sceptre. PCB, populated and tested , test software loaded (excluding Bluetooth module) Art.# 090559-91 • £89.00 • US$143.60 82 Prices and item descriptions subject to change. E.&O.E 01-2011 elektor January 2011 (No. 409) £ US$ + + + Product Shortlist January: See www.elektor.com + + + December 201 0 (No. 408) NetWorker 100552-91 .... Module, ready assembled and tested ....53.00 ..85.50 Heating System Monitor 090328-41 .... ATmega328-20AU (TQFP32-08), programmed ....11.00 ..17.80 Stroboscopic PC Fan 100127-1 Printed circuit board 4.50 ....7.30 1 001 27-41 .... ATtiny 231 3, programmed ....14.20 ....8.75 ARM Freephone Control 080632-91 .... ECRM40 module, ready assembled and tested ....32.00 ..51.70 Modular LED Message Board 1 00664-41 .... MC9S08SH32CWL, programmed 8.75 ..14.20 Speed Controller for Small DC Motors 100571-41 .... ATtiny44-20PU, programmed 8.75 ..14.20 November 201 0 (Nr. 407) Micro Fuel Cell Measures Oxygen Concentration 090773-91 .. ... PCB, populated and tested with programmed bootloader 56.00..., ....90.40 The 5532 OpAmplifier (2) 100124-1 .... ... Amplifier board (one channel) 23.00..., ....37.10 100124-2.... ... Power supply board 17.95..., ....29.00 Camera Interval Timer 081184-41 .. ... PIC1 6F886-I/SP, SPDIP28, programmed 8.00..., ....12.90 October 201 0 (No. 406) CL-3 Digital Rotary Combination Lock 100026-41 ....AtmelATTINY2313-20PU, programmed 8.00 12.90 WheelieGT 1 00479-7 1 .... Kit of parts upgrade kit controller board + 2x Hall sensor board 105.00 169.40 September 201 0 (No. 405) Elektor Project Case 100500-71 .... Predrilled Lexan sheets with standoffs 14.90 24.10 Digital Multi-Effects Unit 090835-31 .... EEPROM 24LC32 4.00 6.50 090835-41 .... ATmega8-16PU 8.30 13.40 090835-42 .... ATtiny2313-20PU 8.30 13.40 090835-71 .... Kit of parts including PCBs, programmed controllers and EEPROM 165.00 266.20 Dual Voltage/Current Display 100166-71 .... Kit of parts incl. PCB, item -41, LCD 62.00 100.00 Vision System for Small Microcontrollers 090334-1 PCB 19.90 32.10 090334-41 .... PIC1 6F690-I/P, programmed 8.00 1 2.90 V July/August 201 0 (No. 403/404) The Elektor DSP radio 1 001 26-41 .... ATmegal 68 PU 1 2.50 20.20 100126-91 .... PCB, assembled and tested 149.00 240.40 Daggerboard Position Detector 080307-41 .... PIC1 6F628A-DIL-1 8, programmed 8.00 1 2.90 PIC RJ-45 Cable Tester 090643-41 .... PIC16F72, programmed 8.00 12.90 3D LED Pyramid 090940-41 .... ATtiny2313-20SU, programmed 8.00 12.90 Digital Thumbwheel Switch 090538-41 .... ATtiny231 3 dip20, programmed 8.00 12.90 Whistler: Electronic Trainer/Coach 1 00203-41 .... PIC1 6F88 DIP1 8, programmed 8.00 1 2.90 Solar Cell Battery Charger/Monitor 090544-41 ....PIC16F877A, programmed 16.50 26.70 Bestsellers ^ A I n y- • r A O o GO O O' I O > Q Q U o3 {/) W 1 2 3 5 2 C# 201 0 Programming and PC interfacing ISBN 978-0-905705-95-8.... £29.50 US $47.60 Experiments with Digital Electronics ISBN 978-0-905705-97-2.... £26.50 US $42.80 Fundamental Amplifier Techniques with Electron Tubes ISBN 978-0-905705-93-4.... £65.00 ...US $104.90 RM Microcontroller Interfacing ISBN 978-0-905705-91-0.... £29.50 US $47.60 Power Electronics in Motor Drives ISBN 978-0-905705-89-7 .... £29.50 US $47.60 he Power Supply Collection 1 ISBN 978-90-5381 -265-5 .... £1 7.90 US $28.90 DVD The Audio Collection 3 ISBN 978-90-5381 -263-1 .... £1 7.90 US $28.90 B DVD Elektor 1 990 through 1 999 ISBN 978-0-905705-76-7 .... £69.00 ...US $1 00.00 Masterclass A DVD High-End Valve Amplifiers ISBN 978-0-905705-86-6.... £24.90 .... US $40.20 1 2 3 4 5 DVD LED Toolbox ISBN 978-90-5381 -245-7 .... £28.50 US $46.00 NetWorker Art. # 1 00552-91 £53.00 US $85.50 Digital Multi-Effects Unit Art. #090835-71 £1 65.00 US $266.20 Elektor DSP radio Art. #1001 26-91 £149.00 US$240.40 Reign with the Sceptre Art. # 090559-91 £89.00 ...US $1 43.60 Wheelie GT Art. #100479-71 £105.00 US$169.40/ Order quickly and securely through www.elektor.com/shop or use the Order Form near the end of the magazine! Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH • United Kingdom Tel. +44 20 8261 4509 Fax +44 20 8261 4447 Email: sales@elektor.com elektor 01-2011 83 COMING ATTRACTIONS NEXT MONTH IN ELEKTOR Telephone Interface for VoIP Next month we describe a so-called Foreign Exchange System Adapter with a USB inter- face. This enables an ordinary analogue telephone set to be linked to a Voice over IP (VoIP) system. For the associated Linux software we’re using the Asterisk IP PBX software that’s well known among insiders. With this small board so you can start using your trusted land- line phone for VoIP communication. Automatic Morse Generator There are still many radio amateurs who enjoy morse. Those who are proficient in it like to use paddles enabling the dots and dashes to be generated via separate controls (paddles) using thumb and finger. The circuit was developed specially for this type of key. It looks after a lot of time related issues such as the pauses between dots, lines, spaces, etc., and also provides a standard mode as well as an Ultimatic mode. A small monitor amplifier is also accommodated on the PCB. Light Alarm You’ve probably seen them, alarm clocks with built-in lighting that wake you up gracefully and gently. Such lights should not be too difficult to make yourself, with the added advan- tage of being able to adapt the software to your preferences. This circuit contains all basic functions of a so-called light alarm clock, but thanks to the availability of the source code you can make changes to your heart’s content. Article titles and magazine contents subject to change; please check the Magazine tab on www.elektor.com Elektor UK/European February 2011 edition: on sale January 20, 2010. Elektor USA February 2011 edition: published January 73, 2070. w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektor.com w\ Elektor on the web Also on the Elektor website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Time limited offers • FAQ, Author Guidelines and Contact All magazine articles back to volume 2000 are available online in pdf format. The article summary and parts list (if applicable) 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, DVDs, kits, modules, equipment, tools and books. A powerful search function allows you to search for items and references across the entire website. "H HU 1 E Sill SHl - r " rvi u jr. rv : -li" ■ | U itr*— uir.p * -ttf m avpvn.ni 0 *& u Kft & MttMki yi - ■ 1 ij Conim ■ n J ■ Tj M - c» In U*Mi hf --i rV|( ■ioffrpw utrprrc cimJli Thf piatepi ¥ rw, 1 E-srE. p clia I l t opmi* Pram p HAaMMUi u'riy Hlffi WtIliT W MW gf | n Mm vm In EHMfir DjvlHiHr L-ram'-'y Ptew wfl 4 EM y fiTCi y C 5D DESC&UhT ‘n-IR -— J L fiTiT«pf_ r -j I fkr.-H OJtf 1 prXiiO ” llMto Hvpidnv ElcfUvr PCD A DftifcntvnM rirAcr wrtS zjfjt jvu I I *.■**»■. vn» hftBdfic' new Hr Dw qiwtnl itwg*ra n LTn TkM c«kE ram isamm Enter fw ' «Brrn: Pn>Ciriimrnin[j ErrcbeditaJ Pit FrllcrocontiD^rrs ■■ O The >Ji|rwdf I.L> prDfffnriiniJ ■fed 1 tKliSdla|> CTTia OH fUM air-H 2 * jpri Pvi r. rtvi T«l iivi j srrty Hit part* ElektorWh 84 01-2011 elektor Description Price each Qty. Total Order Code CD The Power Supply Collection 1 C \ £17.90 p Fundamental Amplifier Techniques with Electron Tubes C A £65.00 ARM Microcontrollers 1 ^ A £29.50 Experiments with Digital Electronics ^ A £26.50 C# 2010 Programming and PC interfacing Elektor Per sonal Organizer 2011 LEDs 1 (Special Project) 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. £29.50 £24.90 £9.90 Sub-total P&P Total paid Name Address + Post code Tel. Email Date Signature EL01 Yes, I am taking out an annual subscription to Elektor and receive the E-book Microcontroller Basics totally free!* (Please fill in your emailaddress below) I would like: □ Standard Subscription (1 1 issues) Subscription-Plus (1 1 issues plus the Elektor Volume 201 0 DVD-ROM + exclusive access to www.elektor-plus.com ) * Offer available to Subscribers who have not held a subscription to Elektor during the last 12 months. Offer subject to availability. See reverse for rates and conditions. Name Address + Post code Tel. Email Date Signature EL01 METHOD OF PAYMENT (see reverse before ticking as appropriate) □ Bank transfer | Cheque (UK-resident customers ONLY) □ VISA EUROCARD MasterCard Expiry date: Verification code: Please send this order form to* (see reverse for conditions) Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www. elektor. com sales@elektor.com *USA and Canada residents should use $ prices, and send the order form to: Elektor US PO Box 1 80 Vernon CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: sales@elektor.com METHOD OF PAYMENT (see reverse before ticking as appropriate) □ Bank transfer | Cheque (UK-resident customers ONLY) □ VISA □ EUROCARO MasterCard Expiry date: Verification code: Please send this order form to Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com subscriptions@elektor.com ORDERING INSTRUCTIONS, P&P CHARGES All orders, except for subscriptions (for which see below), must be sent BY POST or FAX to our Brentford address using the Order Form overleaf. Online ordering: www.elektor.com/shop Readers in the USA and Canada should send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Elektor US for applicable P&P charges. Please allow 4-6 weeks for delivery. Orders placed on our Brentford office must include P&P charges (Priority or Standard) as follows: Europe: £6.00 (Standard) or £7.00 (Priority) Outside Europe: £9.00 (Standard) or £1 1 .00 (Priority) HOW TO PAY All orders must be accompanied by the full payment, including postage and packing charges as stated above or advised by Customer Services staff. Bank transfer into account no. 4027021 1 held by Elektor International Media BV with The Royal Bank of Scotland, London. IBAN: CB96 ABNA4050 3040 2702 1 1 . BIC: ABNACB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. GCredit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in this magazine. If difficulties in the supply of components are envisaged, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not guaran- tee this time scale for all orders. Returns Faulty goods or goods sent in error may be returned for replacement or refund, but not before obtaining our consent. All goods returned should be packed securely in a padded bag or box, enclosing a covering letter stating the dispatch note number. If the goods are returned because of a mistake on our part, we will refund the return postage. Damaged goods Claims for damaged goods must be received at our Brentford office within 1 0-days (UK); 1 4-days (Europe) or 21 -days (all other countries). Cancelled orders All cancelled orders will be subject to a 1 0% handling charge with a minimum charge of £5.00. Patents Patent protection may exist in respect of circuits, devices, components, and so on, described in our books and magazines. Elektor does not accept responsi- bility or liability for failing to identify such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, diskettes and software carriers published in our books and m agazines (other than in third-party adver- tisements) are copyright and may not be reproduced or transmitted in any form or by any means, including photocopying and recording, in whole or in part, without the prior permission of Elektor in writing. Such written permission must also be obtained before any part of these publications is stored in a retrieval system of any nature. Notwithstanding the above, 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 connexion 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 in respect of the goods. Law Any question relating to the supply of goods and services by Elektor shall be determined in all respects by the laws of England. January 201 1 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION United Kingdom & Ireland Standard £51.00 Plus £63.50 Surface Mail Rest of the World £65.00 £77.50 Airmail Rest of the World £82.00 £94.50 USA & Canada | Seewww.elektor.com/usaforspecialoffers | HOW TO PAY Bank transfer into account no. 4027021 1 held by Elektor International Media BV with The Royal Bank of Scotland, London. IBAN: GB96 ABNA4050 3040 2702 1 1 . BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident cus- tomers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. SUBSCRIPTION CONDITIONS The standard subscription order period is twelve months. If a permanent change of address during the subscription period means that copies have to be despatched by a more expensive service, no extra charge will be made. Conversely, no refund will be made, nor expiry date extended, if a change of address allows the use of a cheaper service. Student applications, which qualify for a 20% (twenty per cent) reduction in current rates, must be supported by evidence of studentship signed by the head of the college, school or university faculty. A standard Student Subscription costs £40.80, a Student Subscription-Plus costs £53.30 (UK only). Please note that new subscriptions take about four weeks from receipt of order to become effective. Cancelled subscriptions will be subject to a charge of 25% (twenty-five percent) of the full subscription price or £7.50, whichever is the higher, plus the cost of any issues already dispatched. Subsciptions cannot be cancelled afterthey have run for six months or more. January 201 1 Create complex electronic systems in minutes using Flowcode 4 Design - Simulate - Download Flowcode is one of the World’s most advanced graphical programming languages for micro- controllers (PIC, AVR, ARM and, brandnew, dsPIC/PIC24). The great advantage of Flowcode is that it allows those with little experience to create complex electronic systems in minutes. Flowcode’s graphical development interface allows users to construct a complete electronic system on-screen, develop a program based on standard flow charts, simulate the system and then produce hex code for PIC, AVR and ARM microcontrollers. Convince yourself. Demo version, further information and ordering at www.elektor.com/flowcode Index of Advertisers Astrobe, Showcase www.astrobe.com 78 Atomic Programming Ltd, Showcase . . . .www.atomicprogramming.com 78 Avit Research, Showcase www.avitresearch.co.uk 78 Beta Layout, Showcase www.pcb-pool.com 37, 78 Black Robotics, Showcase www.biackrobotics.com 78 CEDA, Showcase www.ceda.in 78 Designer Systems, Showcase www.designersystems.co.uk 78 Easysync, Showcase www.easysync.co.uk 78 Elnec, Showcase www.elnec.com . 78 Embedded Adventures, Showcase www.embeddedadventures.com 78 E u ro c i rc u its www. euro circuits, com 55 EzPCB/Beijing Draco Electronics Ltd www.v-moduie.com 11 First Technology Transfer Ltd, Showcase .www.ftt.co.uk 78 FlexiPanel Ltd, Showcase www.flexipanel.com 78 Future Technology Devices, Showcase. . .www.ftdichip.com 78 Flameg, Showcase www.hameg.com. 78 FlexWax Ltd, Showcase www.hexwax.com 79 Labcenter www.labcenter.com 88 Linear Audio, Showcase www.linearaudio.net 79 Microchip www.microchip.com/mtouch 2 MikroElektronika MQP Electronics, Showcase. . Nurve Networks NXP Contest NXP Product Pico Quasar Electronics Relchron Robot Electronics, Showcase. Robotiq, Showcase RS Components Showcase Steorn SKDB Lite, Showcase . USB Instruments, Showcase . Virtins Technology, Showcase . www. mikroe. com 3 .www.mgp.com 79 .www.xgamestation.com 65 . www. circuitcellar. com/nxpmbeddesignchallenge 1 3 . . . www. nxp. com /I pc 11011 71 . . .www.picotech.com/ scope2030 65 . . .www.guasarelectronics.com 51 . . .www.proto-pic.co.uk 55 . . .www.robot-electronics.co.uk 79 . . .www.robotiq.co.uk 79 . . .www.designspark.com/pcb 33 78, 79 . . .www.kdb.steorn.com/ref25 79 . . .www.usb-instruments.com 79 . . .www.virtins.com 79 Advertising space for the issue 15 February 2011 may be reserved not later than 18 January 2011 with Huson International Media - Cambridge House - Gogmore Lane - Chertsey, Surrey KT16 9AP - England - Telephone 01932 564 999 - Fax 01 932 564 998 - e-mail: lauren.palmer@husonmedia.com to whom all correspondence, copy instructions and artwork should be addressed. elektor 01-2011 87 t PRE-PRODUCTION CHECK . Board Edge Defined - All Components Placed - All Connections Routed - Power Planes Generated - l\lo Design Rule Violations - Design with Confidence: The latest version of the Proteus PCB Design Software provides a multi- stage Pre-Production Check which will detect and prevent a variety of common mistakes prior to your boards being sent for manufacture. PROTEUS DESIGN SUITE Features: ■ Hardware Accelerated Performance. ■ ■ Unique Thru-View™ Board Transparency. ■ ■ Over 35k Schematic & PCB library parts. ■ ■ Integrated Shape Based Auto-router. ■ ■ Flexible Design Rule Management. ■ ■ Polygonal and Split Power Plane Support. ■ Board Autoplacement & Gateswap Optimiser. Direct CADCAM, ODB++, IDF & PDF Output. Integrated 3D Viewer with 3DS and DXF export. Mixed Mode SPICE Simulation Engine. Co-Simulation of PIC, AVR, 8051 and ARM7. Direct Technical Support at no additional cost. All levels of the Proteus Design 5uite include a world class, fully integrated shape-based autorouter at no additional cost - prices start from just £150 exc. VAT & delivery www.labcBnter.cum Electronics Labcenter Electronics Ltd. 53-55 Main Street, Grassington, North Yorks. BD23 5AA. Registered in England 4692454 Tel: +44 (0)1756 753440, Email: info@labcenter.com Visit our website or phone 01756 753440 for more details