FREE POSTER (V< I N II N I' (a DfflOIMIl DIMMJTia m ? Jk PHONE LCD W — ^ -ir 1 - 11 II SOLAR CELLS, BODY HEAT AND THE QUEST Fotf 4 FREE E N EmtM KNOCKOUT TEST NEW LI-ION BATTERIES REVEAL THRUST *} DIY SOLAR CELL FROM HOUSEHOLD INGREDIENTS FREE POSTER 9 770268 45112 8 blocK to 9* expan ded rvW' N -' a ^ c POST AND PACKING CHARGES: Order Value Cost Order Value Cos £20 - £49.99 £5 £200 - £499.99 £30 £50 - £99.99 £10 £500+ £40 £100 - £199.99 £20 Max weight 121b (5kg). Heavier parcels POA. Minimum order £20. Note: Products are dispatched from Australia, local customs duty and taxes may apply. Magnetic Cartridge Pre-amp KC-5433 £11.75 + post & packing This kit is used to amplify the 3-4mV signals from a phono cartridge to line level, so you can use your turntable with the CD or tuner inputs on your Hi-Fi amplifier - most modern amps don't include a phono input any more. Dust off the old LP collection or use it to record your LPs on to CD. The design is suitable for 12" LPs, and also allows for RIAA equalisation of all the really old 78s. Please note that the input sensitivity of this design means it's only ^ suitable for moving-magnet, not moving-coil Tl I 1 * cartridges. Kit j. j l if l| I includes PCB hj . with overlay and V all electronic components. m w* • Requires 12VAC power *•'' Programmable High Energy Ignition System KC-5442 £26.25 + post & packing This advanced and versatile ignition system can be used on both two & four stroke engines. The system can be used to modify the factory ignition timing or as the basis for a stand-alone ignition system with variable ignition timing, electronic coil control and anti-knock sensing. Features: • Timing retard & advance over a wide range • Suitable for single coil systems • Dwell adjustment • Single or dual mapping ranges -= — j • Max & min RPM adjustment A. ^ |/| • Optional knock sensing AUflrf i • Optional coil driver ” • Kit supplied with PCB, and all electronic components Car Air Conditioner Controller Kit KC-5437 £11.75 + post & packing This kits stops the air conditioner in your car from taking engine power under acceleration. It will allow the compressor to run with low throttle even when the cabin temperature setting has been reached and will automatically switch the compressor off at ** Q '^le. ^ a * so f eatures an override switch, J sp an LED function indicator. Kit 0 ^supplied with PCB IF ■ A' i with overlay and all electronic JU « components with dear English ^ ^ instructions. Recommended box UB3 HB-6013 £1.05 DC Relay Switch KC-5434 £4.50 + post & packing An extremely useful and versatile kit that enables you to use a tiny trigger current - as low as 400pA at 12V to switch up to 30A at 50VDC. It has an isolated input, and is suitable for a variety of triggering options. The kit If includes PCB with overlay and all ^ 1 electronic components \ with clear English * I ,, instructions. Fuel Cut Defeater Kit KC-5439 £6.00 + post & packing This simple kit enables you to defeat the factory fuel cut signal from your car's ECU and allows your turbo charger to go beyond the typical 15-17psi factory boost limit. Note: Care should be taken to ensure the boost levels and fuel mixture don't reach an unsafe level. • Kit supplied with PCB, and all f ^ electronic | t components. Ignition Coil Driver KC-5443 £13.00 + post & packing Add this ignition coil driver to the KC-5442 Programmable Ignition System and you have a complete stand-alone ignition system that will trigger from a range of sources including points. Hall Effect sensors, optical sensors, or the 5 volt signal from the car's ECU. Kit includes PCB with overlay and all specified components. • Kit supplied with PCB, and all i 7 electronic components. nue 11 E Short Circuits 1 Learning System KJ-8502 £11.95 + post & packing Short Circuits 1 uses a learning system designed around a baseboard and template where all components are mounted and connected using our exclusive spring system. The templates show exactly where each component goes and almost guarantees success. The 20+ projects are fun & simple to build and all components are included. • 96 pages in full colour • 275 x 205mm High Range Adjustable Temperature Switch for Cars KC-5376 £22.75 + post & packing This temperature switch can be set anywhere up to 2192°F, so it is extremely versatile. The relay can be used to trigger an extra thermo fan on an intercooler, a sensor near your turbo manifold to trigger water spray cooling, or a simple buzzer to indicate high temperature. The LCD displays the temperature constantly and can easily be dash __ ffc - mounted. Kit included 00 PCB with overlay and V J all electronic w -■ J " components with clear T I English instructions. |\v v ’ ■ Knock Sensor KC-5444 Projects include: Short circuit tester Magic eye alarm Police siren Electronic organ and many more. £5.00 + post & packing Add this option to your KC-5442 Programmable High Energy Ignition system and the unit will automatically retard the ignition timing if knocking is detected. Ideal for high performance cars running high octane fuel. Requires a knock sensor interface which is cheaply available from most auto recyclers. • Kit supplied with PCB, and all electronic components. All prices in £ Stg 1 Free 430+ page Catalogue. Log on to www.jaycarelectronics.co.uk/elektor for your FREE catalogue! 0800 032 7241 M (Monday - Friday 09.00 to 17.30 GMT + 10 hours only). For those who want to write: 100 Silverwater Rd Silverwater NSW 2128 Sydney AUSTRALIA www.jaycarelectronics.co.uk i ■ i ^“wa^ i * I j V % r? 1 r 1 1 J 1 si" ' i, §■ tm i-t' Jjd 1, 4J l ... -.6, BitScope PC Oscilloscopes <& Analyzers Digital Storage Oscilloscope Up to 4 analog channels using industry standard probes or POD connected analog inputs. Mixed Signal Oscilloscope Capture and display up to 4 analog and 8 logic channels with sophisticated cross-triggers. Spectrum Analyzer Integrated real-time spectrum analyzer for each analog channel with concurrent waveform display. Logic Analyzer 8 logic, External Trigger and special purpose inputs to capture digital signals down to 25nS. Data Recorder Record anything DSO can capture. Supports live data replay and display export. Networking Flexible network connectivity supporting multi-scope operation, remote monitoring and data acquisition. Data Export Export data with DSO using portable CSV files or use libraries to build custom BitScope solutions. www, bitscope .com DSO Test Instrument Software for BitScope v. VI., Mixed Signal Oscilloscopes jj:!' 2 Channel BitScope Pocket Analyzer BitScope DSO Software for Windows and Linux BitScope DSO is fast and intuitive multi-channel test and measurement software for your PC or notebook. Whether it's a digital scope, spectrum analyzer, mixed signal scope, logic analyzer, waveform generator or data recorder, BitScope DSO supports them all. Capture deep buffer one-shots or display waveforms live just like an analog scope. Comprehensive test instrument integration means you can view the same data in different ways simultaneously at the click of a button. DSO may even be used stand-alone to share data with colleagues, students or customers. Waveforms may be exported as portable image files or live captures replayed on other PCs as if a BitScope was locally connected. BitScope DSO supports all current BitScope models, auto-configures when it connects and can manage multiple BitScopes concurrently. No manual setup is normally required. Data export is available for use with third party software tools and BitScope's networked data acquisition capabilities are fully supported. —5 4 Channel BitScope Busy times - lead times! Gone are the days when an Elektor editor or designer could hand in copy on paper to the typesetters 'downstairs' and then patiently wait for the results of the publication in terms of PCB or microcontroller sales. A lot had to be done before the first board or micro actually reached the customer, and a lot of time it took! After all, there was the page layout to wait for, followed by two or more correction rounds, ap- proval for printing, pagination, printing and magazine distribution - all in due order with lots of red tape in between. Then followed a dead silent period during which readers apparently made up their mind whether or not to jump the bandwagon and order the relevant item through Readers Services. By post, of course. Until about 1 0 years ago, the 'time-to- market' lag was such that we had no useable feedback on how specific projects were doing until about six months after publication, to which another two to three months should be added on account of the production by Elektor's design labs and editorial. These days we have the Internet to en- able very fast communication with our readers and suppliers, as well as rapid spreadsheet-ish reporting systems that will tell us what's a hit or a dud. How- ever, neither will forecast the response you, our readers, will give to a pub- lished project. It's a sure cause not just for a lot of excitement and guesstimates on our part but also frustration oc- casionally. For example, no one on the small teams normally formed by Elektor staff and supplier representatives could have foreseen the overwhelming inter- est in the Profiler milling machine, the Explorer- 1 6 Value Pack and the FPGA board, just to mention three hits from recent issues. Of these, Profiler is caus- ing the most concern as the supplier is looking at an order volume ten times larger than his most optimistic forecast. I am happy to think that we get it right, too, on occasions, as in the case of the Freescale SpYder Discovery where a massive number of kits was available in time and could be supplied to our readers with a minimum of delay after publishing the March 2007 issue. This versatile circuit is used to charge, discharge and evaluate the capacity of battery packs composed of one up to eight NiMH or NiCd cells, or LiPo (Lithium Polymer) or Li-Ion (Lithium-Ion) batteries composed of two elements (serial charge). Model hobbyists, other rechargeable battery users and generally all soldering iron fans will find in it a low cost, simple solution that's also easily integrated into equipment. FREE CENiKEtOLD KbfEk i A * Solar Cells from Fruit Tea 1 6 Message in a Bottle Somehow, we just can't seem to find efficient and sustainable ways to warm our buildings, light our surroundings, and transport ourselves and our goods. Does Elektor Electronics see a ray of hope here? Jan Buiting, Editor CONTENTS Volume 33 April 2007 364 We tested some of the first examples of the latest Li-ion batteries, with results varying from the merely respectable to the sensational! 34 Tough and Powerful hands-on Solar Power for Dummies 24 Battery Charge-'n-Check 32 Simple Solar Charger 40 E-blocks Light Chaser Squared 46 jfForce on LEDs 52 Prog rammer for Freescale 68HC(9)08 58 Explorer- 1 6 (4) 62 Electronic Badge 66 Very Simple Clock 70 AS imple Mains Inverter 74 Mi niature Rotating Magnetic Field Generator technology The Human Body as an Energy Source 34 Tough and Powerful info & market g-Force on LEDs We continue from last month's Attack of the SpYder article and get to grips with the basics of migrating an MC9S08 micro from thinkware to hardware, all along an extremely low-cost route with free items thrown in exclusively for Elektor readers. 6 Colophon 6 Winners of the September 2006 RFID Card Quest 8 Mailbox News & New Products 8 ' Elektor SHOP Sneak Preview infotainment 16 Message in a Bottle 76 Adjustable high-voltage supply (1961) 77 Hexadoku lektor lectronics Volume 33, Number 364, April 2007 ISSN 0268/45 1 9 Elektor Electronics 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 Electronics (Publishing), Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 www.elektor-electronics.co.uk The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor Electronics is published I I times a year with a double issue for July & August. Under the name Elektor and Elektuur, the magazine is also published in French, Spanish, German and Dutch. Together with franchised editions the magazine is on circulation in more than 50 countries. International Editors: Mat Fdeffels (m.heffels@segment.nl), Wisse Fdettinga (w.hettinga@segment.nl) Editor: Jan Buiting (editor@elektor-electronics.co.uk) International editorial staff: Fdarry Baggen, Thijs Beckers, Ernst Krempelsauer, Jens Nickel, Guy Raedersdorf. Design staff: Ton Giesberts, Paul Goossens, Luc Lemmens, Christian Vossen Editorial secretariat: Fdedwig FHennekens (secretariaat@segment.nl) Graphic design / DTP: Giel Dols Managing Director / Publisher: Paul Snakkers Marketing: Carlo van Nistelrooy Customer Services: Margriet Debeij (m.debeij@segment.nl) Subscriptions: Elektor Electronics (Publishing), Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 26 1 4509, fax: (+44) 208 26 1 4447 Internet: www.elektor-electronics.co.uk Email: subscriptions@elektor-electronics.co.uk Rates and terms are given on the Subscription Order Form Head Office: Segment b.v. PO. Box 75 NL-6 1 90-AB Beek The Netherlands Telephone: (+31)46 4389444, Fax: (+31)46 4370161 Distribution: Seymour, 2 East Poultry Street, London EC I A, England Telephone: +44 207 429 4073 UK Advertising: Fduson International Media, Cambridge Fdouse, Gogmore Lane, Chertsey, Surrey KTI 6 9AR England. Telephone: +44 1932 564999, Fax: +44 1932 564998 Email: p.brady@husonmedia.com Internet: www.husonmedia.com Advertising rates and terms available on request. International Advertising: Frank van de Raadt, address as FHead Office Email: advertenties@elektuur.nl 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 Segment, b.v. and may not be reproduced or transmitted in any form or by any means, including photocopying, scanning an recording, in whole or in part without prior written permission from the Publishers. 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 permis- sion to the Publishers to alter the text and design, and to use the contents in other Segment publica- tions and activities. The Publishers cannot guarantee to return any material submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Segment b.v. 2007 Printed in the Netherlands Winners of the September 2006 Elektor RFID Card Quest During January of this year, our international websites announced Round #2 of the Elektor RFID Card Quest originally launched with the publication of the September 2006 issue with its free RFID card. Statistics indicate that around 3,000 RFID cards were actually read. To check the number stored on the free card, some of our readers used their own Elektor RFID Reader, while others borrowed a reader unit for the occasion. Thanks are due to all those who helped fellow Elektor readers by allowing them to access a functional RFID Reader unit for the purpose of the Card Quest. As announced, special prizes consisting of £75 Elektor Vouchers and one a city trip were available to Elektor readers ready to lend a hand to others. We kept our promise and awarded the city trip to Maastricht, The Netherlands, to Wulfram Kurz. The vouchers were sent to Andreas Mayr, Hans Schneider and Marcel Smeets. Because only four hex digits on the RFID card had to match numbers instead of 14, Round #2 of the RFID Quest was 'easier' than the September 2006 publication. Fortunately this resulted in typically two to ten people reporting the winning number for each prize so lucky winners could be drawn at random. The complete list of winners is given below. The prizes are described in the September 2006 issue on pages 20 - 21 . 1 st Prize: Philips 42-inch Plasma TV (sponsored by DHL Global Mail) awarded to Matthias Wurzer from Austria. 2 nd Prize: Mio Cl 70 Navigation System (sponsored by Conrad Electronics) awarded to Carl Declercq from Belgium. 3 rd Prize: Liteon LVW 5045 GDL DVD Recorder (sponsored by Conrad Electronics) awarded to Wolf-Dieter Kaczerowski from Germany. 4 th to 7 th Prize: E-Blocks Starter Kits Professional (sponsored by Matrix Multimedia) awarded to Thierry Favreau (France), Peter Eggleston (UK), Annika Ganzel (Germany) and Hans Michielsen (Netherlands). 8 th and 9 th Prize: VMD HD Players (sponsored by New Medium Enerprizes) awarded to Jan Ten Dam (Netherlands) and Thorsten Rink (Germany). 10 fh to 13 th Prize: E-Blocks Starter Kits Professional (sponsored by Matrix Multimedia) awarded to Erik van der Veek (Netherlands), E. Fontrier (Australia), John W. Finlayson (Norway) and Frank Jessen (Germany). 14 th and 15 fh Prize: Parallax RFID Starter kits awarded to Peter Braunschmid (Germany) and Thomas Kuberczyk (Germany). 6 elektor electronics - 4/2007 mikroElektronika DEVELOPMENT TOOLS | COMPILERS | BOOKS CAN-1 Board - Interface CAN via MCP2551 $18.00 USD CAN-2 Board - Make CAN network with SPI interface $21.00 USD RS485 Board - Connect devices into RS-485 network $17.00 USD Serial Ethernet - Make ethernet network with SPI Interface (ENC28J60) $28.00 USD EasyPIC4 Development Board with on-board USB 2.0 programmer and mikrolCD 3 ini DEVELOPMENT SYSTEM HARDWARE ICD ON-BOARD USB 2.0 ON-BOARD PROGRAMMER HIGH DEVELOPMENT performance DEVELOPMENT BOARD trailers (it comes with a PIC16F877A). EasyPIC4 development board: Following in the tradition of the EasyPIC3 as one of the best PIC development systems on the market, the EasyPIC4 has more new features for the same price. The system supports 8, 14, 18, 20, 28 and 40 pin PIC microcon- CF Board - Easy way to use Compact flash in your design $18.00 USD MMC/SD Board - Easy way to use MMC and SD cards in your design $18.00 USD EEPROM Board - Serial EEPROM board via I2C interface $9.00 USD RTC Board - PCF8583 RTC with battery backup $16.00 USD ADC Board - 12-bit analog- to-digital converter(ADC) with 4 inputs $22.00 USD DAC Board - 12-bit digital- to-analog converter(DAC) with SPI $18.00 USD Keypad 4x4 Board - Add keypad to your application $9.00 USD Accel. Board - Accel, is an electronic device that will measure acceleration forces $16.00 USD PICFIash with mikrolCD support PICFIash programmer - an ultra fast USB 2.0 programmer for PIC microcontrollers. Continuing its tradition as one of the fastest PIC programmer on the market, the new PICFIash with mikrolCD now supports more PIC MCUs giv- ing the developer a wider choice of PIC MCU for further prototype development. mikrolCD debugger enables you to execute mikroC / mikroPascal / mikroBasic pro- grams on a host PIC micro- controller and view variable values, Special Function Regi- sters (SFR), memory and EEPROM as the program is running $89.00 USD mikrolCD is a highly effective tool for Real-Time debugging on a hardware level. The ICD debugger enables you to execute a mikroC/mikroPascal/mikroBasic program on a host PIC microcon- troller and view variable values, Special Function Registers (SFR), memory and EEPROM as the program is running. On-board USB 2.0 PICFIash programmer - an ultra fast USB 2.0 programmer for fast MCU programming. Continuing its tradition as the fastest PIC programmer on the market, the new PICFIash with mikrolCD now supports more PIC MCUs giving the developer a wider choice of PIC MCU for further prototype development. Package contains: EasyPIC4 development system, USB cable, Serial cable, User’s manual, MikrolCD manual, CD with software, drivers and examples in C, BASIC and Pascal language. Note: LCD, DS1820 temp sensor and GLCD are optional. EasyPIC4 Development System $119.00 USD Optional: 2x16 LCD and DS1820 temperature sensor $15.00 USD Graphic LCD 128x64 dots $17.00 USD mikroElektronika Compilers Pascal, Basic and C Compilers for various microcontrollers Supporting an impre- ssive range of micro- controllers, an easy- to-use IDE, hundreds of ready-to-use func- tions and many inte- grated tools makes MikroElektronika co- mpilers one of the best choices on the market today. Besides mikrolCD, mikroElektro- nika compilers offer a statistical module, simulator, bitmap generator for graphic displays, 7-segment display conversion tool, ASCII table, HTML code export, communications tools for SD/MMC, UDP (Ethernet) and USB , EEPROM editor, programming mode manage- ment, etc. Each compiler has many routines and examples such as EEPROM, FLASH and MMC, SD and CF card reading/writing, writing to charac- ter and graphic LCDs, manipulation of push-buttons, 4x4 keyboard and PS/2 keyboard input, generation of signals and sounds, character string manipulation, mathematical calculations, I2C, SPI, RS232, CAN, USB, RS485 and OneWire communications, Manchester coding management, logical and numerical conversion, PWM signals, inter- rupts, etc. The CD-ROM contains many ready-written and tested pro- grams for use with our development boards. Regular price: mikroBasic(PIC) mikroPascal(PIC) mikroC(PIC) Price with discount: $149.00 USD mikroBasic(PIC) (-30%) $149.00 USD mikroPascal(PIC) (-30%) $249.00 USD mikroC(PIC) (-30%) $99.00 USD $99.00 USD $175.00 USD - All of our products are shipped in special protective boxes. -On-line secure ordering provides a fast and safe way to buy our products. mikroBasic(AVR) $149.00 USD mikroPascal(AVR) $149.00 USD mikroBasic(dsPIC) $149.00 USD mikroPascal(dsPIC) $249.00 USD mikroC(dsPIC) $249.00 USD mikroBasic(AVR) (-30%) $99.00 USD mikroPascal(AVR) (-30%) $99.00 USD mikroBasic(dsPIC) (-30%) $99.00 USD mikroPascal(dsPIC) (-20%)$1 99.00 USD mikroC(dsPIC) (-30%) $175.00 USD Find your distributor: http://www.mikroe.com/en/distributors/ LV24-33 Development Board The Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD System supports 64, 80 and 100 pin PIC24F/24H/dsPIC33F microcontrollers (it comes with PIC24FJ96GA010 - PIC24 16-bit Microcontroller, 96 KB Flash Memory, 8 KB RAM in 100 Pin Package). Examples in BASIC, PASCAL and C are included with the system. You can choose between USB or External Power supply. LV 24-33 has many features that makes your development easy. Explore new PIC24F/24H/dsPIC33F PIC MCU's with LV 24-33 and experience all advantages of this microcontrollers. LV24-33 Development System $149.00 USD Uni-DS 3 Development Board with on-board USB 2.0 programmer System supports PIC, AVR, 8051, ARM and PSoC microcontrollers with a large number of peripherals. It is enough to switch a card and continue work- ing in the same development environment but with a different chip. UNI-DS3 has many features that makes your development easy. You can choose between USB or External Power supply. Each MCU card has own USB 2.0 programmer on it ! Uni-DS 3 Development System [with one MCU card] $199.00 USD dsPICPR02 Development Board with on-board USB 2.0 programmer System supports dsPIC microcontrollers in 64 and 80 pin packages. It is delivered with dsPIC30F6014A microcontroller. The dsPICPR02 develop- ment system is a full-featured development board for Microchip dsPIC MCU. dsPICPR02 board allows microcontroller to be interfaced with external cir- cuits and a broad range of peripheral devices. This development board has an on-board USB 2.0 programmer and integrated connectors for SD/CF memory cards, 2 x RS232 port, RS485, CAN, DAC etc.. dsPICPR02 Development System $239.00 USD EasyARM Development Board with on-board USB 2.0 programmer EasyARM board comes with Philips LPC2214 microcontroller. Each jumper, element and pin is clearly marked on the board. It is possible to test most of the industrial needs on the system: temperature controllers, counters, timers etc. EasyARM has many feature to make your development easy. One of them is on-board USB 2.0 programmer with automatic switch between ‘run’ and ‘programming’ mode. Examples in C language are provided with the board. EasyARM Development System $149.00 USD Easy8051A Development Board with on-board USB 2.0 programmer System is compatible with 14, 16, 20 and 40 pin microcontrollers (it comes with AT89S8252). USB 2.0 programmer is built in and programming can be done without removing the microcontroller. Many industrial applications can be tested on the system : temperature controllers, counters.. Easy8051A development system is a full-featured development board for 8051 microcon- trollers. It was designed to allow students or engineers to easily exercise and explore the capabilities of the 8051 microcontrollers. Easy8051A Development System $114.00 USD BIGPIC4 Development Board with on-board USB 2.0 programmer and mikrolCD Following in the tradition of its predecessor, the BIGPIC3 as one of the best 80-pin PIC development systems on the market, BIGPIC4 continues tradition with more new features for same price. System supports the latest 64 and 80- pin PIC microcontrollers (it is delivered with PIC18F8520). Many ready made examples guarantee successful use of the system. Ultra fast on-board pro- grammer and mikrolCD (In-circuit Debugger) enables very efficient debug- ging and faster prototype developing. Examples in C, BASIC and Pascal lan- guage are provided with the board. BIGPIC4 Development System $132.00 USD EasyAVR4 Development Board with on-board USB 2.0 programmer System supports 8, 20, 28 and 40 pin microcontrollers (it comes with ATMEGA16). Each jumper, element and pin is clearly marked on the board. It is possible to test most of the industrial needs on the system: temperature controllers, counters, timers etc. EasyAVR4 is an easy to use Atmel AVR development system. On-board USB 2.0 programmer makes your develop- ment easy. Examples in BASIC and Pascal language are provided with the board. EasyAVR4 Development System $114.00 USD EasyPSoC3 Development Board with on-board USB 2.0 programmer System supports 8, 20, 28 and 48 pin microcontrollers (it comes with CY8C27843). Each jumper, element and pin is clearly marked on the board. EasyPSoC3 is an easy to use PSoC development system. On-board USB 2.0 programmer provides fast and easy in system programming. EasyPSoC3 Development System $169.00 USD EasydsPIC3 Development Board with on-board USB 2.0 programmer System supports 18, 28 and 40 pin microcontrollers (it comes with dsPIC30F4013 general purpose microcontroller with internal 12 bit ADC). EasydsPIC3 has many features that make your development easy. Many ready made examples in C, BASIC and PASCAL language guarantee suc- cessful use of the system. On-board USB 2.0 programmer allows for faster prototype development. EasydsPIC3 Development System $119.00 USD Please visit our web page for more info http://www.mikroe.com SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD INFO & MARKT MAILBOX Working with the dsPIC family I am very pleased with your series of articles regarding the dsPIC-family of microcontrollers from Microchip, (articles are about PIC24F, not dsPIC30, Ed.) It would be a pity however, if the enthusiasm of readers was tempered by a few (known) problems for which solutions are known. That is why I would like to bring the following to your attention. The dsPIC-family of microcontrollers from Microchip is very approachable and is therefore eminently suitable for beco- ming familiar with this type of product and the accompanying development environment. I've been working for a year with the dsPIC-30F601 4A. A member of a sub-family which unfortunately has not been covered in your articles. This is unfortunate: Firstly the dsPIC30F-family operates from 5 volts, which usually makes the integration with other electronics easier for the hobbyist. Furthermore, the dsPIC30F-family can be programmed much more often (re-flashed). For the dsPIC30F family the nominal number of re-programming cycles is specified as 100,000, compared to 'only' 1000 for the products that you cover in your article. In addition there is a very important aspect that may not go unmentioned. For these products to be accepted it is important that the tools that are offered function reasonably reliably. Now this is unfor- tunately not always the case. Two items are of interest and I hope that you will be able to pay attention to these. Firstly, the MPLAB version that you supply, version 7.50. This one turns out to be somewhat unstable in practice because a large number of new features were incorporated in it. I actively take part in the Microchip forum and this instability has been confirmed by many other participants. This manifests itself as crashes and the not always proper functioning of breakpoints while debugging. The following is very important: Instability is often observed when the software is used on a dual core PC. This has also been confirmed by Microchip in the relevant newsgroup. The good news is that there is a solution to both problems. Version 7.50 of MPLAB has now been replaced by version 7.51 , in which a number of problems have been fixed. The dual core problem can also be solved by using a utility from Microsoft. After the installation of MPLAB, this utility can assign the software to one of the cores of the dual core processor, which in my experience pretty much solves all the instability. The utility has to be executed again if a new version of MPLAB is installed or after a re-installation. The utility can be found at http://www.robpol86.com/Pages/ imagecfg.php. That the dsPIC-family is a 'mature' family may be illustrated by the fact that I myself am busy with the development of a pre-emptive real time kernel for this family, called AVIX. Because of the speed and the relatively large amount of memory of these controllers, such an 'operating system' is very suitable, which can simplify the programming of certain functions (and complicate others, but I won't dwell on that). Leon van Snippenberg (Netherlands) Many thanks for your detailed comments Leon , we hereby pass them on to other readers via the Mailbox column. Optical encoder Dear Editor — in the article about the 'Capture' short-wave receiver (December 2006, Ed.), you mention the use of an optical encoder. This is to obtain 100-Hzfine tuning. Unfortunately it is not reported who the manufacturer or what the part number is. Can you please advise me what these are? F. Hardcastle (UK) what this port should be. It is the some enco- der that was already used in the Shortwave Receiver from 1999: Bourns ECW1J-B24- AC0024 (available from Farnell, among others) The type of encoder is indeed not mentioned in the schematic or the parts list , this has unfortu- nately slipped past us. We have in the meantime checked for you Audio equipment Dear Jan — As a lover of music and of building my own audio equipment, Elektor Electronics is certainly an interesting magazine. I presently still make use of my home built, Crescendo power amplifiers, which was publis- hed in the December 1982 issue of Elektor Electronics. The amplifiers are still working well without any problems and provide a nice tightly defined sound. No trouble with distortion or clipping and with 1 80 W into 4 Ohms, plenty of power. Just to give an impression of my installation: a stereo 2.1 system, three times Crescendo, one for the subwoofer, two for the stereo channels. For the subwoofer I use a large self-built Karlson loudspeaker enclosure with a 15 inch Electrovoice speaker, a combination with high ef- ficiency and very good charac- teristics in the region below 75 Hz. Unfortunately it does have an erratic frequency charac- teristic, but that's no problem for the Crescendo. For lack of time to build my own, I bought four speaker boxes with good mid and high characteristics, each channel is two speakers in parallel, they are Raveland X2508. For surprisingly little money available from Conrad and with a subwoofer also surprisingly good. The preamp contains electronic filters for the subwoofer and the stereo channels. Unfortunately I had already finished my own de- sign for some time before you published a preamp design with digital potentiometers and 8 elektor electronics - 4/2007 Solution to Hexadoku February 2007 8 2 D F 9 B E 6 0 5 1 7 C A 3 4 C 1 7 9 A 0 5 D 8 E 4 3 2 F B 6 3 0 B E F C 4 1 2 6 A D 8 9 5 7 5 4 6 A 7 8 3 2 B C F 9 E 1 D 0 6 D E C 8 2 1 4 3 A 7 F 5 0 9 B 7 F A 4 5 3 B E D 8 9 0 1 6 C 2 B 8 3 1 0 F 6 9 C 4 5 2 D E 7 A 2 9 5 0 D 7 C A 6 B E 1 F 3 4 8 E 7 1 3 2 6 D F 9 0 8 4 B 5 A C A 6 F D 3 9 0 5 E 2 C B 7 4 8 1 4 5 0 8 B 1 A C F 7 D 6 9 2 E 3 9 B C 2 4 E 8 7 A 1 3 5 0 D 6 F D E 8 7 1 4 2 0 5 3 B A 6 C F 9 0 A 4 5 6 D F B 7 9 2 C 3 8 1 E F 3 9 6 C A 7 8 1 D 0 E 4 B 2 5 1 C 2 B E 5 9 3 4 F 6 8 A 7 0 D a microcontroller complete with remote control, in April 2004. The philosophy behind this is clear: ample dimensions and reproduce as transpa- rently as possible. The object after all is to listen to music as the composer intended. Variations with valves are from this point of view only an option when making music. In this case a certain amount of distortion may be desired and favourable clipping behaviour is also a valuable characteris- tic. I emphasise 'an option', because with the present state of DSP-technology and accompanying high quality A/D and D/A conversion any conceivable transfer function should be able to be realised. Perhaps an idea for a future Elektor Electronics design? However, time moves on and and for the Crescendos too there will be a day when replacement is due. The parts that were used back then (in particular the power MOSFETs) Ethermeter March 2007, p. 72-74, 075035-1 Due to a crashed hard disk in the author's PC an early ver- sion of the circuit diagram was printed. The correct schematic is reproduced here. Canon EOS Cameras go Wireless July/August 2004, p. 102, 030432-1. In the transmitter circuit dia- gram, pushbutton SI should be a normally closed (NC) type. haven't been available for years. In addition, the advance of surround audio is undenia- ble. The future forces the thou- ght of multi-channel amplifiers and speakers. Starting with be above mentioned philosophy it becomes very attractive to go with an amplifier mo- dule along the lines of ClariTy, perhaps partially pre-built, to make it reliable, portable and affordable. Obviously also with a switching power supply. Not a simple job, keeping in mind the EMI/EMC trouble lurking around. On the other hand, the successful builder of such a system can expand his CV with an desirable addition. Oh yes, another important detail: we're talking of course about a system that, to put it mildly, cannot be bought for a more or less reasona- ble amount of money from high street retailers. Because otherwise the result is, after all, limited to extending one's skills in electronics assembly. Not wrong as such, but still. Looking forward to many interesting and challenging projects. Frans Segerink (Netherlands) We are always very pleased to read how many people are still active with serious audio reproduction. We have already thought numerous times about possible new ; high quality am- plifier designs for publication in Elektor Electronics. A switching final stage is certainly one of the possibilities , but we are still searching for good and readily available solutions. For the au- tumn of 2007, we have already planned a few power amplifiers with valves and FETs, because of increased interest in recent times. However, serious semi- conductor designs will definitely appear again in this magazine. MailBox Terms •Publication of reader's correspondence is at the discretion of the Editor. •Viewpoints expressed by corres- pondents are not necessarily those of the Editor or Publisher. •Correspondence may be translated or edited for length, clarity and style. •When replying to Mailbox correspondence, please quote Issue number. •Please send your MailBox correspondence to: editor@elektor-electronics.co.uk or Elektor Electronics, The Editor, 1 000 Great West Road, Brentford TW8 9HH, England. p QaBa Hl =laQDaI=! D a -EIH Ea H- a - EH --a aaaE 3 a -- Ba s- Da ! Corrections & Updates MP3 Preamp February 2007, p. 40-45, 060237-1 On the PCB component overlay, the labels of SMD resistors R29 and R32 have been transpo- sed. Resistor 29 (2 kQ) should be the top device in the row of resistors fitted to the right of SI I and S2. R2 (6k£28) should be directly below it. 4/2007 - elektor electronics INFO & MARKET NEWS & NEW PRODUCTS Full-speed USB 2.0 PIC® micros Microchip now supplies two new Flash PIC® microcontrollers, the PIC1 8F2450 and PIC18F4450, with certified Full-Speed USB 2.0 connectivity for 12 megabits-per- second (Mbps) data-transfer rates, and 12 MIPS (48 MHz) process- ing performance. Combined with a wide variety of on-chip peripher- als, nanoWatt Technology power management, and self-program- mable Flash memory, these fea- tures provide a complete solution for designers working with USB in industrial, medical and many other embedded applications. Many USB-capable microcontrol- lers are optimized for applications in PC peripherals and consumer markets, rather than for embedded designs. Microchip's USB PIC mi- crocontroller family makes the ben- efits of Full-Speed USB available to a broader range of embedded ap- plications that operate in harsh en- vironments and only occasionally connect to personal computers. Some applications that may ben- efit from these new USB PIC micro- controllers include industrial data- logging, timing and analysis tools; battery-powered handheld devices; and fire, security, home-automation and back-up (UPS) systems. The two new USB PIC microcontrollers feature 16 Kbytes of self-program- mable Enhanced Flash memory, which allows field upgrades for end applications via the USB port. Microchip's advanced Flash tech- nology provides high endurance of up to 1 00,000 erase/write cycles and data retention of more than 40 years. Other key features include: • 768 bytes of RAM, 256 bytes of which can be a dedicated USB buffer • AUSART for RS232 and RS485 • 1 0-bit A-to-D Converter with up to 1 3 input channels • Capture/Compare/PWM mod- ule with 16-bit capture resolution • Three Timers (2 x 1 6-bit, 1 x 8-bit) • Programmable Brownout Reset and Low Voltage Detect circuits • Enhanced In-Circuit Debugging capabilities One area of concern for most USB-application designers is the quantity and quality of available firmware support. Microchip has an extensive set of libraries for the most common application classes, including the Human Interface De- vice (HID), Communication Device Class (CDC) and custom drivers. In addition, Microchip has published application note AN956 "Migrat- ing Applications to USB from RS- 232 UART with Minimal Impact on PC Software" for migrating legacy serial applications. The new USB PIC microcontrollers are also supported by Microchip's development systems, including: MPLAB® Integrated Development Environment (IDE), MPLAB Cl 8 C Compiler, MPLAB ICD 2 In-Circuit Debugger, MPLAB ICE 2000 and MPLAB ICE 4000 In-Circuit Emula- tors and MPLAB PM3 Universal De- vice Programmer. In addition, the PICDEM™ Full-Speed USB Demo Board (part # DM163025) assists development with this family's ad- vanced USB features. www.microchip.com / usb (077029-VI) Comprehensive line of V* I chip evaluation and validation boards Vicor Corporation an-nounces the availability of a comprehensive line-up of 52 Factorized Power Architecture (FPA) Customer Evalu- ation and Validation Boards, fea- turing BCM™, PRM™ and VTM™ V*l Chip™ power components. In addition Vicor has created an expanding library of V*l Chip™ application notes to support the implemen-tation of power system designs. The introduc-tion of the evaluation boards and applica- tion note library provides a quick and easy way to get an apprecia- tion of the advantages of V*l Chip technology. FPA technology and the families of V*l Chip power components of- fer a fundamentally new and im- proved approach to distributed power. Fac-torising DC-DC power conversion into its basic isolation functions — isolation and trans- formation in the VTM units and regulation in the PRM module — functions maximizes power system performance and cost effective- ness. Unregu-lated BCM convert- ers complete the line-up. Four PRM non-isolated regulator boards and 13VTM current multi- plier boards are available now. A PRM board is selected to match the desired input voltage, and a VTM board is se-lected to provide the desired output voltage and current. Plugged together, they allow the user to explore FPA's regulated DC- DC capa-bilities and develop an understanding of the technology. Fourteen 48-V BCM con-verter evaluation boards with fixed ratio outputs from 1 .5 V to 48Vdc are also available, along with high voltage (352 Vin and 384 Vin) versions. In addition, 21 BCM validation boards with standard 1/4 brick pinning are designed for engineers to test the perform- ance of the BCM intermediate bus con-verter in their existing applica- tion and enable 300W or 600W solutions. The customer evaluation boards are equipped with test sockets, trim pots, and convenient input and out- put connec-tions. They provide de- sign engineers with a jump start toward im-plementing this lead- ing edge technology in technically challenging applications, meaning faster time to market and faster re- turn on design investment. The new application notes cover a wide range of topics to give pow- er designers practical knowledge and insights to ensure their access to all of the advantages that Fac- torized Power Architecture offers. All are available on the Vi-cor web site at: http://www.vicorpower.com/li- brary/technical_docunnenta-tion/ design_center/application_notes/ www.microchip.com / usb (07001 7-l-U) 10 elektor electronics - 4/2007 PWM control 1C for 12V to 75V input voltage range International Rectifier introduced the IR3651, a synchronous PWM control 1C designed for high per- formance synchronous DC-DC buck applications with an input voltage range up to 75 V. With program- mable switching frequency up to 400 kHz, the IR3651 is ideal for a wide range of applications includ- ing telecom and base-station power supplies, networking servers, auto- motive and industrial control. The IR3651 is designed to drive a pair of external N-channel MOS- FETs up to 25 A. Protection fea- tures such as programmable soft- start, hiccup current limit and un- der-voltage lockout are provided for required system-level reliability in the event of a fault condition. The device also offers synchroni- zation which allows simplified sys- tem-level EMI filter design. The new controller includes a 150V half-bridge driver that al- lows for considerable design flex- ibility. For instance, the device may be used in low power (less than 60 W) non-isolated DC-DC converters for network equipment as well as high power (greater than 200 W) pre-regulator stages in regulated isolated converters. As a result, the IR3651 can be applied to de- signs for 36 V inkjet printers, 28 V aerospace applications, 24 V elec- tric bicycles, 72 V battery systems, 1 8 V wall bricks, 1 2 V second- ary-side post regulators and general pur- pose high-volt- age, non-iso- lated DC/DC converters. www.irf.com (07001 7-IV) Minisens ASIC transducer for iso-lated current measurement LEM introduces Minisens, a mini- ature, integrated circuit transduc- er for AC and DC isolated current measurement up to 1 00 KHz. This new component offers full isola- tion (no optocouplers required) and high sensitivity (from 20 mV to 200 mV per Amp of primary current) with no insertion losses. It is mounted directly onto a printed circuit board as an SMD device, reducing manufacturing cost. Minisens integrates, within one mixed signal ASIC, Hall-effect sen- sors with a magnetic concentrator to allow direct current measurement without the need for an additional magnetic core. The non-contact measurement enables an almost un- limited current level as it eliminates the need for current to flow through the device. The only limitating factor is the thermal capacities of the pri- mary conductor. The current can be carried either by a track (or tracks) located on a PCB underneath the Minisens, or by a cable or bus bar under or above the 1C. The unlimited design possibilities for the primary conductor allow current measure- ment up to 70 A or even higher. Many parameters of the ASIC can be configured by on-chip non- volatile memory: adjustment of the transducer's gain, offset, po- larity, temperature drift and gain algorithm (proportional to, or in- dependent of VDD). Two outputs are available: one filtered, to limit the noise bandwidth; and one un- filtered, which has a response time of less than 3 microseconds. The degree of electrical isolation and output sensitivity can be in- creased by the PCB design - for example, a primary track on the opposite side of the 1C gives best isolation; a track on the same side gives the highest sensitiv- ity. Mounted as part of a standard PCB assembly process, manufacturing costs are minimized. The Min isens operates from a single 5 V sup- ply. To minimise power consumption an optional input pin can be used to switch the Minisens into standby mode. The transducer is manufactured with a CMOS process and assembled in a S08-IC package. The combination of different 1C configurations and flexible PCB de- signs results in very versatile and attractively priced current trans- ducer solutions. This opens up op- portunities for applications such as white goods or air conditioning to benefit from isolated current meas- urement, which previously was not feasible. Minisens will also enable enhanced motor control to produce energy savings where other meth- ods such as a shunt have tradition- ally been used. www.lem.com (070017-V) Supersize your display Lascar has added to its popular SP Series of meters with the introduc- tion of the large SP 8-1 00 voltme- ter. This meter is a 3 72-digit, red LED voltme-ter that features a 200- mV full scale reading and a one- piece housing that ensures splash- proof protection when correctly mounted with the supplied seal. Using two scaling resis-tors the SP 8-100 can be set up to measure DC voltages of up to 200 V, allow- ing for connection to a wide variety of ap-plications such as sen-sor out- puts, test box applications and the monitoring of critical processes. The digits of the meter are 14.2 mm (0.56.) in height and use bright red LEDs to provide a clear, easy-to-read display. The SP 8-1 00 is directly compatible with other industry standard mod- els and is available im-mediately at a cost of £ 29.95 (£ 17.97 in OEM quantities of 250+). Lascar Electronics, (+44) (0)1794 884567; Email sales@lascar.co.uk; Website www.lascarelectronics.com (070017-11) 4/2007 - elektor electronics 1 Human Body as an Energy Source New technologies for generating energy 'Save energy! 7 is a much-heard slogan these days, with rising oil prices and the greenhouse effect always in the news. Research has taken place in the Holst Centre for some time on the development of 'energy scavengers 7 , energy converters that use body heat. These can only generate small amounts of power, but there are no waste products. Figure 1. The prototype of the pulse oximeter is already small enough to be worn as a wristwatch. These days a lot of thermal ener- gy is lost to the environment. The giant cooling towers next to po- wer stations are a clear example, with their billowing steam clouds. New de- velopments are taking place on a much smaller scale to utilise this ‘waste heat’ and convert it into electricity. EVERLASTING ENERGY Electronic devices need electrical ener- gy to operate. For portable devices bat- teries have predominantly been used, but this could be about to change... At the Holst Centre development is ta- king place of ‘Energy Scavengers’, also called ‘Energy Harvesters’. These inge- nious technological devices make use of piezo-electric, electrostatic, electro- magnetic or thermal energy to genera- te a voltage. The latter form of energy is of particular interest. There are many heat sources that lose (and therefore waste) thermal energy to their sur- roundings. Just think of the heat ge- nerated by industrial machines, cars, ovens, etc. Another source of thermal energy is the human body. MUSIC OF THE FUTURE? For mobile applications it would of course be great if we could make use of an existing heat source such as the human body. We could then listen end- lessly to our iPod or MP3 player and our mobile phone would never have to be connected to a mains charger again... But we haven’t come that far yet. The current technology still requires too much power to work off just our body heat (unless you convert all of the body heat, which isn’t very practical). The Holst Centre has already developed a prototype of a blood gas data logger (Figure 1). This is a completely auto- nomous system, which takes its power from the heat coming from the wrist of the volunteer. The underlying technique in this sy- 12 elektor electronics - 4/2007 igure 2. Structure of thermopiles in silicon. The heat flow (yellow arrows) creates a voltage across the thermal elements. The series connection increases the voltage to a useable level. stem isn’t new however. It makes use of the so-called Seebeck-effect (see in- set). What is new is the way in which the thermal energy from the heat sour- ce is converted... TECHNOLOGY So-called thermopiles can now be constructed using silicon (see Figure 2). These thermopiles consist of ther- mocouples, which generate a small voltage when there is a temperatu- re difference across the thermocou- ple junction. When a large number of thermocouples is connected in series a useable voltage is generated. This voltage is calculated using the formu- la Uo = m a-AT, where m is the number of thermocouples, a the Seebeck coef- ficient and AT the temperature diffe- rence between the two metals of the thermocouple. In practice each thermocouple genera- tes about 1 mV. To obtain a useful vol- tage (between 1 and 10 V) we there- fore need at least a thousand of them. Such a large number isn’t a problem since the thermal elements are built on silicon. Figure 3 shows the block diagram of a thermo-electric power supply. At an ambient temperature of 22°C the hu- man body releases about 10 mW/cm 2 of heat energy (measured near an ar- tery). Depending on the conditions, the thermo-electric generator can generate between approximately 100 to 200/jW. The charger circuit stores this energy in a battery or capacitor. This is then used to supply the circuit with power. The maximum power transfer occurs when the load resistance is the same as the internal resistance of the ther- mopiles. The energy scavenger in the blood gas data logger supplies bet- ween 100 and 600 /iW, depending on the conditions. As the ambient tempe- rature rises, the power output decrea- ses. At about 36° there is no tempera- ture difference between the skin and the surroundings so no energy can be generated (see Figure 4). Should the temperature rise even further, the ele- ment will start to produce a voltage again. However, it now works ‘in the opposite direction’ in that the skin is now warmed up by the element rather than cooled. This heat is then released elsewhere by the body. THERMAL RESISTANCE The power output of the thermal ele- ment is greatly influenced by the to- tal thermal resistance. This consists of Figure 3. Block diagram of a thermo-electric supply. The energy extracted by the energy scavenger needs further processing before it becomes useable. Holst Centre The Holst Centre (www.holstcentre.com) is a joint imitative of IMEC and TNO. It is an independent Research & Develop- ment institute that develops new technol- ogies for autonomous wireless transduc- ers and systems-in-foil. Research into en- ergy scavenging techniques is carried out within IMEC-NL. An important hallmark of this institute is the interaction and col- laboration with industrial and academic institutions. This overlap means that the Holst Centre can adapt their scientific strategies to the industrial requirements. Investments provided by the government and several companies have significantly increased the chances of a successful outcome of the research. The combined knowledge along with the new develop- ments gives the contributing parties a head start in the market, something they couldn't have achieved without this level of co-operation. 4/2007 - elektor electronics 13 TECHNOLOGY ENERGY SOURCES See beck- effect The Seebeck effect was discovered in 1821 and is named after its inventor Thomas Johann Seebeck. It is the direct conversion of a temperature difference at the junction of two different metals or semiconductors into an electrical poten- tial. It is actually the opposite of the well- known Peltier effect, where an electrical current is converted into a temperature difference. In fact these two processes are the same, with the energy conversion happening in opposite directions. For this reason they are collectively called the Peltier-Seebeck or thermo-electric effect. Figure 4. Power output of the thermopiles. Graph 1 is of a seated person; graph 2 is of a running person. The difference is caused mainly by the cooling capacity of the heatsink. Figure 5. Thermal resistance of the body. The best place for the heat exchanger is clearly near an artery. the thermal resistance of the body, the thermo-electric generator and the sur- rounding air. Several studies have been made of the thermal resistance of the human body. The optimum thermal transfer is achieved when the thermal element is placed over an artery (see Figure 5). The thermal resistance is then about 150 cm 2 K/W. The resistance of the heat exchanger is in the region of several hundred cm 2 K/W. The thermal resistance of the air de- pends very much on the surrounding air movement. For a person sitting down this was 500 cm 2 K/W with the heatsink used. The same heatsink had a resistance of ‘only’ 200 cm 2 K/W when this person was walking (refer to Figure 4). During these tests it was also found that heavy exercise by the test sub- jects didn’t result in any extra energy being generated. The body is so effi- cient in dissipating excess heat that the skin temperature doesn’t rise sig- nificantly and hence there won’t be an increase in the energy extracted. The head is generally the warmest part of the body. It is therefore from here that you can get the best return when converting body heat into elec- trical energy. The only disadvantage is that it doesn’t look very appealing (see Figure 6). 'ENERGY-FREE' MEASUREMENTS The device designed at the Holst Cen- tre, the wireless pulse oximeter sensor (see Figure 1), uses these newly deve- loped technologies. The signals from a blood gas and hart rate sensor (of the type also used in hospitals) are connec- ted to a sort of wristwatch. This strap contains all of the electronics as well as the power supply. The block diagram in Figure 7 shows how the pulse oxime- ter is constructed. The heat exchanger is placed above the artery, which indi- rectly supplies the electronics with the required energy. All the analogue and digital signal processing is carried out on-board. A radio transmitter is used to send the data to (for example) a PC, so that the information can be displayed in real-time and, if necessary, an alarm can be raised when the data goes out- side a certain range. OLD AND NEW TOGETHER The theories behind these devices aren’t exactly new. The technology has existed for quite some time, but was much too bulky for portable applicati- ons. Because of this, the Holst Centre concentrates its research mainly on the miniaturisation of the technology. They are now researching the production of a thermopile using silicon. This means that the energy collectors can be ma- nufactured on silicon wafers, similar to microprocessors, which provides a big cost saving. The tiny dimensions of the elements mean that you can connect enough of them in series to produce a useable voltage. This isn’t exactly a new idea, as can be seen from the Seiko Thermic Watch [1,2]. This watch makes use of the same effect that the pulse oximeter uses. The dimensions of the thermo- pile are much greater, since it is con- structed using discrete elements. It Figure 6. This many scavengers seems a bit over the top igure 7. The internal structure of the wireless pulse oximeter is directed at making the size and energy consumption as small as possible. also converts much less energy into an electrical output. Other products that use ambient ener- gy sources are of course solar cells (see Figure 8). A less well-known, but no less interesting, application are the light switches made by EnOcean (see Figure 9). Pressing the switch genera- 14 elektor electronics - 4/2007 tes enough power to energise a small transmitter, which activates a remote relay [3]. There are many other devices that make use of ‘human energy’: wind-up radios and telephone chargers, and torches that first have to be shaken to charge them up. But most of these are nowhere near as ingenious as the mo- dern technologies. ENERGY EVERYWHERE Energy scavengers are the future. They operate wirelessly and have uses in numerous applications. Just think of alarm systems, industrial applications where the heat from machines can be used, medical applications, such as the wireless pulse oximeter described earlier, which can also be connected to Thermocouples A thermocouple consists of two wires made from different metals or alloys that have been joined together, preferably welded. When a temperature difference occurs across the junction a potential difference is created, which is propor- tional to the temperature difference. The potential difference is in the order of 6 to 60 microvolt per °C (jjV/°C). ELECTRONICS UNLIMITED The amount of electronics used in our day-to-day lives is increasing all the time. Just think of the car, coffee ma- chine, electric toothbrush, etc. Many new solutions are invented to provide all these electronic devices with po- wer. The thermopiles from the Holst Centre are just the tip of the (techno- logical) iceberg, which will grow to new heights despite the greenhouse effect... ( 060317 ) With thanks to Ruud Vullers, seni- or researcher Holst Centre, for his assistance. Figure 9. A light switch made by EnOcean. This wireless switch converts the energy used in pressing the switch into electrical energy, which powers a transmitter that activates a remote relay. Figure 8. The Camel fridge. This is a good example of an alternative energy source, (photo Naps Systems Oy) a GSM, making remote readings from greater distances possible. Other uses are in domotics, where many sensors can be used without having to install cables, gaming (the controller doesn’t require batteries and won’t run out of power in the middle of that all-impor- tant game), wireless keyboards and mice, and so on. Another area where these devices will have a future is in the automotive in- dustry. In America it is compulsory for new cars to continuously monitor their tyre pressure. Realistically, this can only be implemented using wire- less technology, which is an area that energy scavengers excel in (see the May 2005 issue of Elektor electronics, ‘Sense Organs for Vehicles’). The technology can also be used as an alternative to RFID, which is a passive system. With energy scavengers it is possible to actively monitor what hap- pens to a product. As an example, you could tell if a deep freeze product has been defrosted. The temperature can be continuously logged via a sensor, so you can tell at a later date exactly what happened to the product. In combinati- on with a paper display you could even tell directly what the shelf life of the product was. Weblinks: [1] www.roachman.com/thermic [2] www.natureinterface. com/e/ni03/P045-049 [3] www.enocean.com 4/2007 - elektor electronics 15 INFOTAINMENT FREE ENERGY Message in a Bottle K The quest for the holy grail of free energy Wisse Hettinga It's too good to be true, and the laws of thermodynamics say it isn't true, but it's still a persistent dream: free energy. It also seems a bit strange that the universe is bursting with energy, while here on earth energy is a source of so much misery. Somehow, we just can't seem to find efficient and sustainable ways to warm our buildings, light our surroundings, and transport ourselves and our goods. Does Elektor Electronics see a ray of hope here? Figure 1. Nathan Stubblefield's battery. A MESS The fact that the science of thermo- dy namics tells us that it’s impossible to extract more energy from a system than you put into it is not enough to stop a large number of enthusiasts from spending their money and time on the quest for free energy, the ‘holy grail’ of the 21st century Many of them publish their ideas and experiments on the Internet. If you enter “free energy” in Google, you will find yourself in a bizarre world of believers, pseudo-sci- entists, and - fortunately - normal peo- ple who enjoy devoting their attention to this topic. A number of ‘discoveries’ appear to be treacherously interesting. It actually takes a certain amount of ef- fort not to believe them. To cite a few examples: a man who makes normal incandescent bulbs light up by hold- ing them against a number of rods; the inventor of the N-Machine; a company named Steorn; and the ‘joecell’, which lets car engines run on water. There’s not much you can say about this, except that you can see what the problem is with all these free energy researchers. To put it in a nutshell: it’s a mess. You see dozens of sites with the strangest messages couched in Word Art and idiotic flashing designs. On the video sites, you can find dozens of clips that take you to obscure plac- es where obscure persons perform ob- scure experiments. It almost appears that everything related to free ener- gy must necessarily be obscure and imprecise. And now it’s time for Elektor Electron- ics to turn its attention to this subject. Just to make things clear, it’s not our intention here to take you on a peril- ous adventure with an unknown out- come. But when we see that so many people are spending time on this, and we see meter pointers swinging and lamps lighting up, Elektor Electron- ics wants to be in the front row to see what’s happening. 16 elektor electronics - 4/2007 JOURNEY INTO THE PAST First we have to take a brief journey in time. Ever since the early days of natu- ral science, amateur researchers have been fascinated with the idea of free energy There appears to be a clear link with ancient sciences and descriptions of strange experiments, and dowsers have something to say here as well. This is actually not all that surprising, since the earth conducts electricity to an extent. This was already known around 1800, when Giovanni Aldini discovered that the two conductors of a telegraph circuit could be replaced by a single conductor, with the return path being provided by the earth. (For some interesting reading, search the Internet for Aldini, the cousin of Galva- ni, and read about his unusual experi- ments on recently deceased criminals.) But beside the earth as a conductor of electricity, there are also descriptions of the spontaneous occurrence of elec- trical currents and telegraph circuits that continue working properly even without external batteries or other sources of power. This brings us to the theory of energy currents or ‘tel- luric currents’, and from there it’s only a small step to dowsers searching for energy currents and earth rays. The story of Nathan B. Stubblefield (1860-1928), a melon grower who lived in Murray, Kentucky, is especially in- teresting. He liked to tinker with coils and wires, and he managed to make history is his own way. However, it was a somewhat sad history. He is said to be the original inventor of the radio. For instance, tradition has it that he managed to create a wireless com- munication link exactly 100 years ago, with a clarity and quality that people found frightening at the time. Nathan Stubblefield was a contemporary of Al- exander Graham Bell. He knew about Bell’s inventions, and he made a wire- less version using electromagnetic coupling - the same principle as we use in transformers. In these experi- ments - and this is where it starts to get interesting for us - he used an unu- sual form of energy generation: earth batteries. The principle behind these batteries is well known. If you drive a copper rod and a zinc rod into the ground, the chemicals in the ground create a small potential difference that can be meas- ured with a voltmeter. However, the situation with Nathan’s experiments was quite different. According to the legend, a large amount of energy was released during the experiments. Stub- blefield used coils in his earth batter- ies (Figure 1), and it appears that he managed to generate high voltages and currents from the earth. Stubblefield’s experiments were re- markable for his time. There is pic- ture where he shows how a wireless link can be established between a boat and the shore (Figure 2), which is something he actually did. Howev- er, he came to a sad end. His financers abandoned him, and he became a rec- luse who spent the last years of his life in his workshop. He destroyed all his instruments before he died and thus took the secret of his earth batteries with him to his grave. The only thing that keeps his memory alive today is a memorial plaque in Murray, his home town, HIGH TENSION And then there’s Nicola Tesla, of course. He lived from 1856 to 1943, and he managed to literally electrify eve- rything with his Tesla coil. He also in- vented the induction motor. Besides his experiments with high voltage, which incidentally are perfectly clear and ex- plainable and thus not at all mysteri- ous, Nicola was also a sort of visionary. For instance, he assured his contem- poraries that it would be possible to use a small transmitter/receiver device - not much large than a wristwatch - to establish contact with other people and communicate with someone on the other side of the world. Nowadays this doesn’t sound very strange, but at that time it seemed like pure fantasy. Ac- cording to Tesla, it was necessary to broadcast large quantities of energy in order to achieve this. Nicola Tesla had a special project in mind for this, called the Wardenclyffe project. A 60- metre tower would serve to broadcast electromagnetic energy, which could then be simply plucked out of the air anywhere in the world. But here again, things start to get hazy. Construction was started with financial backing, but optimism quickly changed to fear of the electrical forces. Everything was stopped, and Tesla’s big project faded into oblivion. We also know that Tesla had plans to tap energy from space. He had the idea of using a large metal plate and draw off the energy using a sort of me- chanical rectifier (Figure 3). Just like Stubblefield, Tesla became a recluse. He held annual meetings with journal- ists, where he made several remarka- ble predictions. In honour of his mem- ory, the unit of magnetic flux density is called the Tesla (T). All of this is past history. The only re- maining memory of Stubblefield is a 4/2007 - elektor electronics 17 INFOTAINMENT FREE ENERGY See for yourself No matter whether it's truth or fiction, 'free energy' is exciting. The simple search term "free energy" will turn up all sorts of sites that provide hours of amazing web surfing. Some of the more remarkable sites are described briefly below. www.teslascience.org - Several enthusiasts are trying to save the site and buildings of the Warden- clyffe project. www.keshetechnologies.com - Note the opening screen of this site. If you dare to go further, you can learn the latest news about Keshe's experiments, including the cola bottle experiments. www.senternovem.nl/projecten- galerij/overzicht/energie_en_ klimaat/h2uvpagina.asp - A ridiculously long link name, but well worth the effort of typing it in. Here you can learn what is happening at the of- ficial scientific level. Worth monitoring. www.nuenergy.org/alt/archive.htm -A variegated collection of free-energy projects. www.nathanstubblefield.com -The man and his inventions. http://www.ecn. nl/egon/rd-programma/micro-wkk -The Stirling engine is back in fashion, and within a few years it is expected to find a place in every house to help re- duce energy consumption. monument in Murray where he used to live, and the ruins of Tesla’s War- denclyffe project can still be seen on Long Island. BACK TO THE PRESENT Nowadays we rarely encounter sensa- tional figures such as Stubblefield and Tesla. That’s a pity, since it would be fun to meet the modern-day Teslas and Stubblefields. Our first search on the Internet didn’t turn up very much. It appears that all the free-energy gurus live in North America. But just when it seemed that all our efforts were in vain, we ran into a remarkable group of peo- ple in the press room of the Jaarbeurs building (Utrecht, The Netherlands) during the ‘Instruments’ exhibition. The setting was entirely in the style of the ‘free energy’ community: obscure arrangements with lots of wires and cables running over the table, multim- eters, and flashing lamps. And now let me introduce Mr Keshe and his mes- sage in a bottle! MESSAGE IN A BOTTLE It ultimately took several months be- fore I had an opportunity to speak with Mehran Keshe in person. First I was brushed off by an employee who said I wouldn’t understand it anyhow and thus could spare myself the trou- ble of a visit. After that, I was told that I could come if I promised to support and promote Mr Keshe’s message, but I wasn’t interested in being used that way. The contact became more and more diffuse until a few weeks later, when I once again tried the telephone number and found myself talking di- rectly with Mr Keshe, who said he would be pleased to speak with me. We agreed to meet in a dismal hotel in Antwerp, which appeared even more bleak in the miserable weather. Mehran Keshe is a native of Iran and a nuclear scientist by profession. He studied at the Queen Mary College of the University of London. He lives in Belgium and is confident that he has the support of the Belgian government, which he emphasized repeatedly dur- ing our conversation. He also had a plastic cola bottle (Figure 4), and this bottle carries the secret of the world’s future energy supply. As a side effect, the bottle also provides a solution for the C02 problem, as well as an inex- pensive way to produce nanomaterials and a spectacular way to transform a length of ordinary stranded wire into a multi-conductor cable. To avoid mak- ing things too difficult, for now we’ll omit any mention of his ideas regard- ing black holes and travelling through space and time. The basis for all these discoveries has to be found in Mehran Keshe’s insights into the relationship Figure 4. The cola bottle with the solution to the energy problem (www.keshetechnologies.com). between the earth’s magnetic field and the force of gravity. He remained vague in response to my question about the underlying theories and how he arrived at these insights; he simply arrived at his understand- ing by contemplation and study. Me- hran Keshe: “There’s actually nothing strange about all this; it’s just how the energy of the world and the universe works. That’s what I have seen, and now I translate it into usable products. Nobody is surprised if you say that mil- lions of stars are created in the uni- verse every day, but if I copy this on a small scale, nobody is willing to accept it.’’ What he meant by “copying it on a small scale” was the demonstration with the cola bottle. Before our meeting, he had prepared a new bottle specifically for this meet- ing. It was a normal plastic cola bottle containing several copper nails (roof- ing nails) fitted to provide electrodes on the outside of the bottle. The cop- per nails were held in place by plastic glue. The key to all this was not the ac- tual bottle, but instead a special liquid that Keshe has developed. The com- position of this liquid is secret, but it is not hazardous. Mr Keshe poured the liquid into the bottle, shook it briefly, set it down again and continued with the conversation. He showed several other bottles that he had used for pre- 18 elektor electronics - 4/2007 Figure 5. Small voltage differences can be measured between the copper nails in the cola bottle. vious demos. It was obvious that the plastic of the bottles was deteriorat- ing. The liquid and the chemical re- action had made the plastic granular and fragile. “What you have here with these old bottles is in fact the solution to the C02 problem”, according to Mr Keshe. “This reaction will enable us to convert C02 into matter, and then it can be processed easily as household waste.” In the meantime, a reaction had start- ed in the cola bottle. The copper elec- trodes were turning black. Mr Keshe opened the bottle and poured the liq- uid back into a glass bottle. “This bot- tle has become worth many hundred euros in the last half hour”, he said. Ac- cording to him, the black deposit was “grapheme”, a form of graphite with a nanostructure. “Usually you can only make this under very special condi- tions of temperature and pressure, but here it happens at ordinary room tem- perature.” According to him, a previous study with a special meter used in the diamond industry had confirmed that the material was genuine. But the real trick came next: the bottle was empty, the cap was off, and Mr Keshe brought out a simple digital multimeter. He briefly shorted the tips of the probes to show that the meter read 0 volts and then measured the electrodes: 600 mV on the one, and 800 mV on some of the others (Figure 5). In my mind, I can hear voices from the public saying “Just a minute here, that calls for fur- ther study!” I do not disagree with an- yone on this, but with the knowledge I have and what I can see from the other side of the table, I must at least say that this is remarkable. “This is how future batteries will work”, said Mr Keshe. “Pretty soon, you will be able to buy a battery for 1 dollar that in principle will last as long as you want. We still think in terms of electronic components and batteries as being separate things. In a few years, energy cells will be created by vapour deposition during chip manufacturing, and the chips will leave the factory al- ready working”, he continued. However, the black deposit in the bot- tle is least just as interesting, because the nanomaterial is electrically insu- lating instead of conductive. Mr Keshe showed how a length of ordinary flex- ible wire made from a large number of individual copper strands could be con- verted into a multi-conductor cable in the bottle. All the copper strands were effectively isolated from each other by the black deposit. Now there you have a perfectly clear situation (Figure 6). The meter came out again, and in fact the two treated copper strands proved to be fully insulated. After this, the conversation turned to the more unusual possibilities of the insights of Mehran Keshe: black holes Mehra Keshe, Nudeair Scientist. that can enclose us so we can trav- el through space and time, antigrav- ity systems, and remarkable ideas about how to solve all of our energy problems. Is Mehran Keshe a swindler? Did I overlook the hidden wires? Was I blind to the enormous transformer under the table? Do I have reason do doubt the sincerity of this man? According to Keshe, several institutions and univer- sities are presently studying his find- ings, and up to now they have report- ed that they all appear to correct. Time will tell. But there’s still the question of why he chooses to present himself this way. “If you are convinced of what you know, you have to commit yourself to it”, says Mehran Keshe. Time will tell. ( 070096 - 1 ) 4/2007 - elektor electronics 19 HANDS-ON SOLAR ENERGY Solar energy, along with wind and wa- ter power, is one of the renewable or ‘green’ energy resources that cannot be blamed for creating C0 2 emissions or radioactive waste. Photovoltaic tech- nology — PV for short — in which solar cells generate electricity directly from sunlight have a valiant role to play in the climate change challenge. Just now the percentage of electric power pro- duced by PV means is very small; 0.2 per cent of total electricity consumpti- on in Germany [1] and probably about the same in Britain, where a mere two per cent of electric power comes from renewable sources. Unfortunately the efficiency of solar cells is not exactly staggering, since only a small propor- tion of light energy is converted into electricity (in some latitudes up to 1 ki- lowatt per square metre). The most wi- dely available cells (made of polycrys- talline silicon) are between 14 and 17 per cent efficient. On the positive side, large commercial systems composed of these cells can save the same amount of C0 2 that their manufacture involved in just two to three years. SILICON SHORTAGE In pure economic terms the figures for solar electricity generation are not ex- actly overwhelming; the cost of one kilowatt-hour of electricity produced by photovoltaic means amounts to between 24 and 40 pence, depending on the size of setup, the expected us- able life of the modules, the annual sun- light hours total and various other para- meters. ‘Cheap as chips’ silicon is not; the production and purification of the base material is both involved and ex- pensive, since it must be almost as un- adulterated as the silicon used in the chip industry. In order to promote solar power some European Union countries offer a rebate for consumers who export power into the grid, meaning that an- yone who owns or has shares in a solar power system can treat this as an in- vestment for tax relief. A renewable en- ergy law [1] in Germany [2] helped that country take world leadership in solar energy two years ago; the country’s 957 megawatts solar generating capacity was more than twice that of the USA and Japan combined [3]. The downside of this was the shortage of modules that followed and a price hike of up to 30 per cent from many suppliers. The produc- tion bottleneck was the requirement for purest silicon; the days when a modest demand for solar cells could be fulfilled with the IC industry’s surplus silicon were long gone. Respite will not come before 2008 and afterwards, when pro- duction plants will have sufficient ca- pacity to satisfy the demand for solar silicon and alternative new cell techno- logies (see panel, Solar Cell Basics) be- gin to offer serious competition. OFF-GRID OPTIONS The high price of solar modules is at least democratic and affects everybo- dy equally to exactly the same degree, regardless of whether they want to generate power for sale or would just like to enjoy a little independence from the grid. For better or for worse, cam- pers, boat owners, people with remo- te country cottages and experimentally minded enthusiasts will all have to dig deep in their pockets to achieve electri- 20 elektor electronics - 4/2007 cal independence. On the other hand, the remaining ele- ments of a standalone solar power sys- tem are not particularly difficult or ex- pensive to procure, assuming we’re talking about a typical setup delivering between 10 and a few hundred watts. Systems of this kind are ideal for DIY construction too. With standalone systems we shall not be feeding any surplus back into the national grid, so we don’t need to worry about the safety complexities of isolating our plant from the grid net- work. For this reason the block diagram (Figure 1) turns out extremely simp- le. The voltage source (generator) is the solar module shown. Because the module’s actual output voltage de- pends on a number of factors (in par- ticular the light level, temperature and loading), direct connection of the mo- dule to a suitable battery is not an op- tion. Instead, we employ an electronic interface between the two main buil- ding blocks: this is the charge regula- tor, which matches the energy available to the needs of the rechargeable battery Standalone solar power installations play a vital role in regions lacking significant electrical infrastructure. This is a 4.2 kW setup in Indonesia (photo: Schott Solar GmbH). Figure 1 The block diagram for a standalone setup is extremely straightforward. Figure 2 The charge regulator matches the energy available to the battery's requirements (photo: Phocos AG). (Figure 2). AC AND DC To maximise the life of your solar setup special batteries known as ‘solar bat- teries’ are recommended (Figure 3). In reality they differ very little from the ‘maintenance-free’ and ‘position-inde- pendent’ gel-cell lead acid rechargeab- le batteries that people have used for many years in burglar alarms and many other applications. These batteries are excellent for the task in hand and they have only two drawbacks. The first is the price you pay for their ‘fit and for- get’ and reduced self-discharge cha- racteristics, which is higher than for, say, automotive starter batteries. The other thing is the lower amount of load they can handle. Don’t forget that the- se are lead-acid batteries and they will rely on the charge regulator to protect them against overcharging, excessive charging current and ideally of course deep discharge. The charge regulator has an additional function of making sure the solar cells are properly loaded to achieve their optimal efficiency [4] . Basic standalone setups comprise just three components therefore, specified to achieve the desired electrical capacity. Low power systems (up to a few hund- red watts) tend to use 12 V solar mo- dules, which can be connected in paral- lel if necessary (using protection diodes in this case). Charge regulators and re- chargeable batteries are designed for 12 V operation in the main. If all you need is a few 12 V lamps and suchlike this kind of setup is fine. In this power range you can also buy 12 V refrigera- tors and low- voltage halogen lamps, in- tended for mobile homes. There are also special 12 V power supplies for Laptops but there are many other kinds of elec- trical device that you cannot get in 12 V versions; the cost of redesigning these gadgets would be just too expensive or plain disproportionate. For most people it would be far simpler to use standard mains appliances and de-luxe standalone systems can inde- ed provide ‘normal’ 230 V alternating current (AC). This is where the fourth component comes in, the AC power in- verter. The key requirements now fo- cus on high efficiency and low standby current draw. Lately charge regulators with integrated power inverters have appeared on the market, simplifying systems design and cabling quite sig- nificantly (Figure 4). With this kind of integrated charge regulator the cons- truction of a 230 V AC system is almost as straightforward as a 12 V DC one, only more expensive. 4/2007 - elektor electronics 21 HANDS-ON SOLAR ENERGY QUICK CALCULATIONS Various manufacturers offer comple- te ready-to-install kits comprising module(s), charge regulator and batte- ry. The simplest way of getting hold of these is to visit specialist dealers and be guided by their advice. It’s worth figuring our your requirements and some rough estimates in advance, if only to avoid buying a system that’s under (or even over) specified. Fal- se economies can end up costing you dearly as well. The Internet is definitely the solar enthusiast’s friend and is highly re- commended for doing your own rese- arching. That said, you can easily end up with information overload, unable to see the wood for the trees. Accordingly here are a few rules of thumb and basic calculations for simplifying the design and specification of your system. The maximum power you’ll need is the sum of all devices active simultane- ously. For illuminating a mobile home or cabin you should look to 50 watts. Even the most economical fridges will grab a good 100 watts for the compres- sor motor. This illustrates a significant difference between 12-V and 230-V technologies, incidentally. The high- voltage version requires a power in- verter that can deliver a surge current of up to ten times the normal operati- onal motor load at the moment the re- frigerator compressor starts up. Some inverters cannot handle this and will just cut out. If you don’t spot the over- load lamp is on until the evening your food will already have started to spoil. Some special fridges provide a good compromise between chilling capacity and power greed — but don’t buy the cheap models using Peltier elements, since their poor overall efficiency will drain your battery completely. A good compressor-equipped coolbox is a kind of mini refrigerator, with a (very silent) motor taking less than 50 W. ENERGY APPETITES Generally, you will not have all the lights on at once, even for all-night card games. With 50 watt-hours (Wh) at your disposal you’ll be able to light a 10- watt lamp for five hours — and remember that halogen lamps consu- me more than twice the power that fluorescents use. Adding a refrige- rator will drive up your power needs (and your costs!) exponentially. Even the best energy-saving models (pro- perly insulated and naturally without any freezer compartment) can easi- Solar cell basics The smallest current-generating element in a solar power system is the so-called solar cell. These cells are always made up from at least two differing materials, frequently arranged in two thin layers overlaid one above the other. When light falls upon these materials one ser- ves as a donor of electrons, the other acting as an acceptor. Key to this process is a barrier region between the two materials, which permits an electric current to flow in one direction only and is how the electrical voltage arises. If you now attach a conductive electrode (such as metal) to each of the materials and connect these electrodes to an external load, the electrons produced will 'do the business' very effectively. metal contact r ± 1 p-n junction ^ zone (~) w electron W missing electron y (gap) anti-reflection layer n-doted layer p-doted silicon backplane contact (full area) 060313-11 The solar cells most widely used by far are produced from a thin layer of mono or polycrys- talline silicon (polycrystalline cells display a typical snowflake pattern after cutting and poli- shing). The silicon is highly pure but it is doped (depurified) with an extremely small quantity of boron, which then gives a high level of control over the electronic properties of the semi- conductor. At the same time the top layer is doped with phosphorus [5]. Within the cell is a p-n junction, exactly as in a diode. Photons of light falling on the cell drive electrons out of what is called the 'valence band' into the 'conduction band' and in the process this electron traffic across the band gap is transformed into electric current. The voltage that can be abs- tracted by way of the (silver) contacts attached to the upper and lower sides of the cell is in the region of 0.6 V. The current is proportional to the surface area of the cell, the incident light energy and the efficiency factor. In our latitudes commercially available polycrystalline cells deliver a couple of amps. Cascading cells in 'strings' and paralleling these chains of cells to make modules can achieve higher voltages and currents. Polycrystalline cells are up to around 1 7 % efficient and monocrystalline examples up to 22 % (these figures fall slightly when connected in modules). Improved efficiency can be had using cells made from germanium, gallium arsenide and other combinations; these are more expensive, however, and for this reason are employed only in special applications. Tandem and triple junction cells can be created using multiple overlaid layers, each of these being optimised for maximum sensitivity to a particular wavelength of light. Lastly, it is also possible to use lenses to concentrate sunlight onto a smaller surface area. Employing all these tricks should soon raise the world efficiency record above 40 % [6]. Other approaches are focused not so much on improving efficiency as on reducing the cost. The target is to reduce or avoid altogether the need for absolutely pure silicon. One ap- proach uses so-called CIS Modules, such as those produced by the German company Wurth [7], although not in quantities likely to worry to the manufacturers of silicon solar cells. Thin- film solar cells made of amorphous silicon with efficiency levels up to about 10 % possess for now such a good price/performance ratio that they can be recommended as an alterna- tive, provided of course that users have enough room to accommodate these modules. Not yet commercially available are a new breed of dye-sensitized solar cells (DSCs), in which organic material serves as light collectors (see the other article on solar cell technology in this issue). Looking further ahead, a five-year development programme announced a year ago by the international energy company BP pic and the California Institute of Technology will develop a new type of solar-cell technology called nanorods. These cylindrical 'wires' of silicon 1 00 times thinner than a human hair will absorb light along their entire length, with efficiency levels far greater than conventional solar cells [8, 9]. 22 elektor electronics - 4/2007 ly guzzle more than 300 Wh a day in summer. An adequately dimensioned standalone setup can then cost £1,500 quite easily. More appropriate and af- fordable are the coolboxes mentioned above, which can get by with less than 100 Wh a day when properly installed using compressor operation. Summing up, standalone installations divide more or less into two basic ty- pes. The first is the basic variety with around 50 W peak power and a pro- jected energy budget of 50 Wh a day, which will be appropriate for lighting purposes and charging MP3 players or camera batteries. The second type co- mes with a coolbox, for which a good 100 W maximum power must be provi- ded and 150 Wh energy budget a day. If you need TV in your holiday home or weekend cottage it makes sense to choose a small LCD set with a screen measuring a few inches across, as the- se require only a few watts. Screens larger than 10 inches diagonal will add several times their price onto the cost of the solar system... SIZING UP YOUR SYSTEM The decision on how large a solar mo- dule to go for is by no means simple, with no ‘exact’ answer. The average amount of sunlight expected will play a role, also whether you want to gu- arantee full power even under clou- dy conditions. In addition you need to clarify how much reserve energy you want to keep in the rechargeab- le battery. Commercial kits of components are normally dimensioned on a ‘1-1-1’ ba- sis, which suits the majority of appli- cations in central Europe. This states that for an energy consumption of 1 Wh per day a battery with a capaci- ty of 1 amp-hour and solar cells with a peak power of 1 Ah (at 12 V) should be sufficient. The battery can also car- ry you over a couple of dull days. The matching charge regulator is usually reasonably overspecified, allowing you to retrofit extra solar modules and/or further battery capacity as required. For a 50 W/50 Wh entry-level setup the choice of the right module and battery is just as simple. A solar module rated 50 watts peak (in other words, maxi- mum performance) and a 50 amp-hour battery will suffice. A complete pa- ckage including charge regulator and 230 V AC power inverter should cost between £350 and £700. The solar cel- ls account for the lion’s share of this cost, which is expected to fall in future. The fridge option (needing the 150 Wh a day mentioned) will call for a sing- le 150 W peak module (or two 75 Wp modules) plus a battery rated between 100 and 200 Ah, so reckon on paying from £1,000 to £1,400 for this. TAIL-END TIPS From a cost viewpoint the particular type of module used is an incidental consideration of course. Whether the silicon cells you buy are (poly) crys- talline or amorphous is determined by the bang per buck you get in watts, or more elegantly the price/performance Figure 3 "Solar batteries', unlike conventional lead-acid batteries, are genuinely maintenance-free and are less prone to self-discharge (photo: Deutsche Exide GmbH). Figure 4 Charge regulator with built-in power inverter that makes an off-grid 230V AC installation almost as straightforward as a 12 V DC system (photo: Fronius International GmbH). ratio. Because charge regulators come in several voltage versions (not just 12 V alone), the one you buy must of course match the voltage range of the solar module selected. If a coolbox is to be used, the power inverter must de- liver at least 500 W and preferably so- mewhat more. There are plenty of offerings on the market; Conrad and Reichelt both have packages for small solar instal- lations in their range. These two sup- pliers even offer components for really small setups, such as a single garden lamp or a pump to run a pond fountain. The simplest and smallest standalone systems are the ones that power the- se low-cost garden lights, comprising three small solar cells, a diode, a re- sistor (= charge regulator) and a 1.2 V NiCd battery. In our latitudes this ba- sic combination will keep an LED lamp alight all night long. ( 060313 ) WEB LINKS [1] www.erneuerbare-energien.de [2] www.solarfoerderung.de [3] www.photon.de [4] www. elektor-electronics . co .uk/De- fault.aspx?tabid=30&List= l&Cat egorylD = 5&Level = 1 &SortField = 8 (Elektor Electronics 6/2005, ‘Solar Power made simple’) [5] http ://en. wikipedia. org/ wiki/Solar_cell [6] www.spectrolab.com/com/news/ news-detail. asp?id= 172 [7] www. wuerth- so- lar. de/ web site/ frames . php?parL ANG = EN&parKAT = 233 Additional material [8] www.eetimes.com:80/ news/semi/ show Article . jhtml?articleID = 189602144 [9] www.economist.com/sci- ence/tq/displayStory. cfm?story_id= 20 19909 [10] www.nef.org.uk/greenenergy/ solar.htm [11] www.pv-uk.org.uk [12] www.cat.org.uk 4/2007 - elektor electronics 23 HANDS-ON BATTERY CHARGER LiPo/Li-lon Florent Coste More and more electronic devices use batteries, often of varying types. Finding a universal solution now seems more justified — one that's not only capable of handling a maximum of batteries but also with the ability to evaluate their status. packs and cells Originally developed for receiver bat- teries in radio-controlled (RC) models, the circuit discussed in this article is used to charge, discharge and evalua- te the capacity of battery packs com- posed of one up to eight NiMH or NiCd cells, or LiPo (Lithium Polymer) or Li- Ion (Lithium-Ion) batteries composed of two elements (serial charge). Model hobbyists, other rechargeable battery users and generally all soldering iron fans will find in the present circuit a low cost, simple solution that’s also easily integrated. NOT JUST A SIMPLE CHARGER... To update this category, integration and functionalities were pushed ‘to the max’ (just a glance at the size of the circuit makes that point). It really refers to a project that can verify the perfor- mance level of your battery packs. No exotic components, only one integra- ted circuit (a microcontroller from ST), a few transistors that are very easily obtained, all neatly done up with a few square centimetres of epoxy. Ready, set, to your soldering irons! THE BRAINS OF THE PROJECT Everything depends on using only one unique microcontroller whose original function has been somewhat changed, since it is more specifically dedicated to motor control (see ‘Brushless Motor Controller’ in Elektor, February, 2006). Its very interesting particularity is that it can be integrated into a PWM cell (Pulse Width Modulation) which can work at high frequencies (50 kHz), all coupled with a current loop (see Figu- re 1). Even better, an internal operatio- nal amplifier makes it possible to avoid using any external analogue integrated circuit. That is the way to perfectly ful- fil one’s mission! CURRENT REGULATION: THE PRINCIPLE Designed to make synchronous and asynchronous motors run, the ST7MC includes a current-level control cell that makes it possible to monitor the current intensity in a motor coil win- ding. Starting from this functionality, we had no doubts about substituting a battery (pack) for it! The behaviour of the current loop obviously remains unchanged. The principle of the regulation is very simple: when a preprogrammed inten- sity level is reached, the microcontroller automatically cuts off the output until the next PWM pulse (or as long as the current level remains above the refe- rence level): the duty cycle is therefore directly controlled by the cell hardwa- re, without the least external interven- tion. Therefore, only one adjustment of the current setpoint is necessary. Figu- re 2 registers the incidence rate of the current readout on the PWM output of the microcontroller. The operational amplifier included in the ST7MC comes to assist current de- tection — the amplifier is configured as an inverter with a gain of 9.2 times. Then we amplify the low signal to the terminals of the shunt resistor (low ohmic value) before it is processed by the current loop. In this way, we can 24 elektor electronics - 4/2007 The author Florent Coste, electronics specialist, received his Electrical Engineering degree in 2000 at the Charles Fabry Institute, Marseilles, France. He is currently an STMI- CROELECTRONICS employee based in Hong-Kong. Specialised in microcontroller software, Florent heads development for entirely new platforms based n STR750 (32-bit, ARM core-based) for vectorial motor control of synchronous and asynchronous motors intended for the Asian market. A passio- nate fan of microelectronics and attracted by everything high-tech and technical, he is always on the lookout for something new. Here, he presents one of the Cube prototypes. Contact : florent.coste@st.com eliminate any expensive Hall-effect transducers. LOOK AT THE SCHEMATICS CAREFULLY The ST7MC functions at maximum speed, while an internal PLL doubles the frequency and filters the 8-MHz si- gnal from the quartz crystal. The PWM frequency controlling the charge and discharge circuit has been set at 50 kHz, thus reducing the size of coil LI and the noise pollution (slim chances your ears are still sensitive enough to hear it!). We can divide the diagram (Figure 3) into three distinct parts: one charge circuit, one discharge cir- cuit and the control logic (on the left) that goes along with the rest. The charge circuit is a traditional Buck converter, based on Tl, LI, D2 and the connected charge (i.e., battery). The PWM control signal comes from pin 42 (MCOO= Motor Control Output Zero) and is applied to a level shifter han- dling the conversion from TTL level to the power supply (typically +12 V). The converter is based around MOS- FET T4 and push-pull circuit T2/T3. Schottky-type diode Dl, in parallel with resistor Rl, enablles a slow acti- vation (ON) of power MOSFET Tl (un- der 56 ohms), and a fast de-activation (OFF) (using the low on resistance of the biased diode). LI comes at the end to ‘smooth out’ the charge current injected into the battery. The discharger section of the circuit is organized around a very traditional N-channel MOSFET type IRF640N, T5; the latter may be replaced by any other equivalent transistor, the most impor- tant characteristic being the thermal resistance (it dissipates lots of heat du- ring the discharge phase!). The PWM control signal (pin 43, MCOl) is filtered with the help of the R8/C10 network. Then we have direct current again on the T5 grid, which works well in linear mode. This may seem atypical at first sight, but it is very efficient in 4/2007 - elektor electronics 25 HANDS-ON BATTERY CHARGER Current PWM OFF PWMON 050073-12 Figure 2. Effect of the current readout on the PWM output of Figure 3. Circuit diagram of the electronics on the main board, the micro. the end in order to simulate a variable resistor. As long as the current level detected at the terminals of resistors R12/R13 is not affected, the voltage on the grid will increase. Inversely, ex- ceeding the current level will cause it to decrease. For that, implementing a pi-type closed-loop control was neces- sary to manage the input current set point. As previously noted, MOSFET T5 will be responsible for continuous- ly dissipating heat during the dischar- ge phase. Despite the fact that its coo- ling will be assisted by a fan, a 12-V battery with 4 amperes capacity will produce, for example, 48 W to be dis- sipated. Therefore, the circuit must be able to ‘breathe’ and the IC2 tempera- ture sensor must be mounted as close as possible to the MOSFET. The circuit has been tested up to 80 watts (16 V, 5 A) without mishap, and an automa- tic cut-off has been planned, in case of overheating. One last point: the circuit allows the discharge of any battery with a maxi- mum voltage equal to the project’s own supply voltage. In case of a battery vol- tage that’s in excess of the supply vol- tage, the current will be drained off to the power supply by the intrinsic diode of the P-channel MOSFET (Tl), a situa- +5V +5V Figure 4. Electronics for the display (LCD) and the 4-button control sub-unit. 26 elektor electronics - 4/2007 Principles and measurements Whether referring to LiPo or Li-Ion, the principle for recharging) is the same: constant voltage and limited current intensity. This may seems simple at first if this type of battery was not very squeamish about two things: one, it cannot withstand overcharging, however slight; and second, the level of voltage is to be respected absolutely or else charging will be interrupted. Then nominal voltage of the cur- rent generation of LiPo and Li-Ion batteries is stated as 3.7 V. A charging voltage of 4. 1 V per element was adopted by the author. The author happily proceeded with a few measurements and logged them in an Excel file. The curves clearly illustrate the process of charging and discharging. We can see the versatility of "Cube" which can accommodate a NiCd pack with 8 cells (Figure a) as well as an LiPo battery composed of two cells (Figure b). Rarely has the fundamental difference between NiMH and LiPo battery charging been so clearly illustrated. For users of Li-Ion cells, the bracket of end of charge stabilisation is set at 8.2 V (2 x 4.1 V, corresponding to the maximum cell voltage recommended by the Figure a. Oscillograms taken during a discharge/charge cycle of a NiCd battery (8 cells, 1,300 mAh) stabilisation stretch at 8.4 V 1.125 * threshold voltage; and end-of-charge detection time [15 mins] 050073 - B Figure b. Oscillograms taken during a discharge/charge cycle of a LiPo battery (2 cells, 1,400 mAh). tion which should be avoided! Finally, the rest of the circuit makes it possible to control different external parameters. An I C EEPROM, IC3, is included with 256 bytes storage spa- ce. A type 24C02 will work perfectly (24C04, 24C08, ...remaining compa- tible). The latter makes it possible to store data, such as the name of the batteries (or miniature models for our hobbyist friends), as well as the char- ge and discharge currents selected, the type of battery (NiMH, LiPo), etc. Transistors T6 and T7 allow for the multiplexing function to be executed, which is necessary to sample the char- ge or discharge intensities. The layout retains the use of distinct shunt resis- tors in order to detect the charge (R6 & R7) and discharge (R12 & R13) cur- rent. If we had only kept one of the two shunts, it would have been necessary to read the positive and negative vol- tage levels on the latter (since the cur- rent circulates in both directions, de- pending on whether we are supplying or draining the battery). Of course, we could have done without a multiplexer (which costs practically nothing in this case), but we would have had to add an external operational amplifier (set up as an inverter) and a DC/DC converter in order to be able to work in negative voltage range. Moreover, the use of small MOSFETS (functioning as switches, here) is lar- gely adequate. For example, during discharging, T6 is on and T7, off. Wha- tever the discharge current, the volta- ge gap between the source and grid will be too low to turn back to on or to interfere with the measurement taken with T6. The voltage level of the battery is evaluated by the resistive divider R15/R14/R18. Temperature control is handled by the venerable sensor LM335 (IC2) connec- ted to the 10-bit ADC input on the mi- crocontroller. Depending on the amount of heat to be dissipated, we will find a PWM signal on pin 40 (PE3) applied to the T10 grid for which the drain will supply an RC filter (R22/R24/C16) connected to the base of T9, configu- red as an emitter-follower. It results in an output (T9 emitter) of nearly conti- nuous voltage: the simplicity of the project results in a few compromises in terms of residual ripple, but is more than adequate to permit control of a small external PC -type fan (12 V). In addition, it is useless to spend a lot for the radiator and fan unit, you just have to find it in the computer ‘flea market’ 4/2007 - elektor electronics 27 HANDS-ON BATTERY CHARGER for a few pence, or salvage the whole thing from an old PC motherboard. Buzzer Bzl will indicate the end of the discharge and/or charge process, loud enough to wake you up if you are asleep! One last point: LCD display control is established with the help of a connection over 7 wires (4-bit mode), used to limit the size of the flatcable connected between the boards. See Fi- gure 4 for the diagram of this part of the project. CONSTRUCTION This setup has two boards, the main board with the processor and the board for the control units and the LCD dis- play. Nothing too difficult, the double- sided boards for this setup are easily made using simple UV exposure and transparencies made on the printer (you have my word!). For those who do not have access to boards with metallized holes (order code 050073-1 /-2, available from the usual sources), it is best to place the through-hole contacts using wire-wrap wire, for example (you will also have to solder some of the pins like those of the K4 base on each side of the printed circuit), then install the resistors, ca- pacitors and SMA integrated circuits, to finish with the largest components (connectors, 2-W resistors, electrolyticl capacitors, etc.). Also note that Schottky diode D2 will need to be soldered ‘in the air’, between the circuit ground and the T1 drain. The latter may be replaced by any (near-) equivalent with the same package (DO-201). We will assume that you will use two ready-made boards (Figure 5) to avoid any problems All components, except the two power transistors T1 and T5, are mounted on the component side of the board (see the photo of our proto- type in Figure 6). As far as power transistors T1 and T5 are concerned, it is best to orient them so that their metal tabs are turned to- ward the centre of the board; then you must fold their pins to an angle of 90 degrees and thread them through the holes in the printed circuit, without sol- dering them right away. Next, we will attach the radiator to the circuit (held in place by a screw and clamp), and we will mark the points for drilling the attachment ho- les for Tl, T5, as well as the one to be used to mount the temperature sen- sor LM335 (IC2), to be positioned as close as possible to N-channel MOS- ! COMPONENTS LIST I main board # 050073-1 Resistors (SMA case shape 0805 except unless indicated differently) R1 = 200CI R2 = 1 ka R3 = 2kQ2 R4,R1 0,R2 1 =4kQ7 R5,R25 = 270Q R6,R7R1 2,R 1 3 = 0Q2 2W (not SMA) R8 = 200kQ R9 = 2kQ R1 1 = 9kC2l R 1 4= 8kQ2 R1 5 = 2kQ preset R16,R23 = lkQ R1 7 = 5kQ preset R1 8 = 6to2 R1 9,R26,R28 = lOkQ R20 = 6kQ8 R22,R27 = 470Q R24 = 82Q Capacitors Cl = 220|jF 16V radial (low profile) C2, Cl 0,0 2 = lOOnF C3,C5 = 2200|jF 16V radial (low profile) C4 = 1 OnF C6,C7 = 33pF 08,09,0 1 = 330nF 0 3 = 470nF 04 a Cl 7 = 22|jF 16V Inductor LI = 4|jH 5A Semiconductors D1 = BAT54 D2 = B520C D3 = 1N4001 Tl = IRF9Z24N T2 = BC8 17-40 T3 = BC807-40 T4,T6,T7,T8,T1 0 = FDV301N T5 = IRF640N T9 = BD138 IC1 = ST7FMC2S4, programmed, order code 050073-41 (SMA device; STMicroelectronics) 102 = LM335 (National Semiconductor) IC3 = M24C02 (SMA device) IC4 = 78L05 Miscellaneous XI = 8MHz quartz crystal K2 = 2-way SIL pinheader, lead pitch 0.1 inch K3 = 3-way connector for PC CPU fan K4 = 14-way boxheader or pinheader Bzl = piezo ceramic resonator (buzzer) Heatsink and fan for Tl & T5 PCB, ref. 050073-1 I I I I Figure 5. Copper track layout and component mounting plan of the two boards required to make the multi-purpose charger. FET (thermal coupling demands!). This sensor will be held in place with a simple clamp. Finally, we can solder Tl and T5. Next, drill all the necessary holes, at- tach the radiator to the circuit again, without forgetting to first add a bit of thermal paste on Tl, T5 and IC2. You should also solder a few centimetres of flexible cable to IC2 in order to connect to the three points identified (IC2) on the printed circuit. Finish by connecting the LCD board using a piece of flatcable. If you have an LCD display with an LED backli- ght, you should create a solder point on K2 (double solder island) on the LCD board, to allow the +5 V supply to be carried. Note: this will result in an additional power consumption of 28 elektor electronics - 4/2007 [ COMPONENTS LIST Display board # 050073-2 Resistors R1 = 1 Ok £2 potentiometer R2,R3 = 6kQ8 Capacitors Cl ,C2 = lOOnF Semiconductors D1 = LED Miscellaneous S1-S4 = 'Digitast' pushbutton with make contact K1 = 14-way boxheader or pinheader K2 = double solder point LCD1 = general purpose LCD, 2x16 characters PCB, ref 050073-2 Figure 6. One of the charger/discharger prototypes built to validate the concept. Technical characteristics Charger Input voltage: 11 to 1 6 V Charge current: adjustable from 200 mA to 4.5 A Supported batteries: from 1 to 8 NiMH or NiCd cells, 2 LiPo or Li-Ion cells 'Reflex' type charge for NiMH/NiCd batteries; continuous for LiPo/Li-lon batteries Detection of end of charge: automatic ('delta-peak' with adjustable sensibility) Discharger Discharge current: adjustable from 200 mA to 5 A with programmable voltage threshold Capacity meter 14 models, with memory Regulated fan and thermal protection at least 200 mA. Therefore, you must replace the 78L05 (5-V regulator) with a more robust model (likew the good old 7805), possibly with a small heat- sink attached. The LCD display will be mounted on the control board and is attached using its connector. Since the attachment points depend on the type of display used, we did not plan them. It is easy to drill a pair of holes in the board, considering that there are no si- gnals in that spot. CALIBRATION AND UTILISATION For the first start-up, we recommend to not to connect the setup directly to a 12-V car battery; it is preferable to use a current-protected lab power supply! If there is a short-circuit on the board, the setup will be very grateful. The circuit should consume about 20 mA with no load (without backlighting). If the LCD is not detected (problem with connections, soldering, etc.), the buz- zer will beep at regular intervals. Before using it, you should calibrate the circuit. The setup should be sup- plied with 12 to 16 V (car battery, for example), and we will have a DC 5 to 9 V power supply capable of delivering at least 2 A (with an adjustable power supply, we will adjust the output to about 8.40 V, if possible, which corres- ponds to the voltage of two LiPo cells at the end of the charging process). As soon as it is connected to ground, you will simultaneously press the FUNC + and FUNC- keys until an initial menu ‘Calibration #1’ appears (voltage cali- bration). Then connect the power sup- ply to output BATT+ and BATT- of the setup (beware of inverted polarities!) and connect a multimeter in parallel (an accurate one...) in DC mode. Then turn potentiometer R15 until the same value is displayed on the LCD and on the multimeter. With the circuit adjusted, disconnect the multimeter and configure it as a DC ammeter (it should be able to withs- tand a current of at least 2 A). Then connect it in series with the DC power supply, all of it still connected to out- 4/2007 - elektor electronics 29 HANDS-ON BATTERY CHARGER A few words about the firmware All of it was written in C using the free version of IDE (Integrated De- velopment Environment), available at SOFTEC (www.softecmicro.com) and with the COSMIC compiler (www.cosmic-software.com). Also a free version and limited to 1 6 kB of the C compiler, it allows you to practice on the entire line of ST micr ill not cost a lot (available at SOFTEC, http://www.softecmi- cro.com/ products. html?type=det ail&title=inDART-STX%2FD or else at RAISON ANCE, http://www. raisonance.com/ products/ST7. php#hardware). Those interested can download the source code from the ELEKTOR website; all you need to do is install the SOFTEC development environment and open the dedicated configuration file. You will then be able to make any modifications and re-program the ST7MC at will (long live Flash memory!). puts BATT+ and BATT-. Holding down any button will get you to the second menu, this time for current calibration. Here all you need to do is adjust R17 until you see the same current value (about 2 A) on the LCD screen and the multimeter. Once this last operation is completed, you can disconnect all power supplies. The interface for adjusting the various parameters is very easy to use. As soon as it is powered up, a welcome mes- sage is displayed, then you enter the main screen. The FUNC + and FUNC- keys allow us to navigate between the different parameters, and the DATA+ and DATA- keys simply let you change those values. We can navigate to our heart’s content among the 14 batteries that can be me- morised and adjusted independently: - Battery name. - Sensitivity of the delta-peak )CP) for the NiMH/NiCd batteries (at least for the most sensitive: T for low, 1, 2, or ‘H’ for high). Strive to use high sen- sitivity for batteries with a low num- ber of cells, so there is a smaller drop in voltage at the end of the charge (approximately from 5 to 15 mV per element). - Maximum time allocated for rechar- ging, in order to avoid overcharging a battery (frequent when defective) if the end of charge is not detected. - Current values at the start and the end of discharge, in 50 and 100 mA increments. A closed-loop control is used to handle the process automa- tically (you may, for example, begin discharging at 3 A and end at 200 mA). The discharge process may be cancelled in order to only do one charge operation. - Charge current value in 50 and 100 mA steps (this process may also be cancelled in order to only do one dis- charge operation). -Battery type (NiMH/NiCd or LiPo/Li-Ion). - Battery voltage at which the dischar- ge process must be cut-off (V cutoff ). Once your parameters have been ad- justed (and automatically memorised in the EEPROM), you only have to launch the discharge and/or (re)charge opera- tions by holding down the FUNC+ or FUNC- button. During the battery discharge process, the capacity will be displayed as well as the voltage level. A ‘full’ battery of 1 Ah discharged at 500 mA should therefore display a capacity of approxi- mately 1,000 mA after two hours. The user may carry out many experiments, for example, by changing the begin- ning and end of discharge parameters or increasing or decreasing the ‘delta- peak’ sensitivity. Finally, you can, at any time, interrupt the discharge and/ or charge process by holding down any button. TWO FINAL POINTS TO HIGHLIGHT Be sure to use properly-sized cables ca- pable of carrying the anticipated cur- rents! Also, if necessary, add dedica- ted cables and plugs. In order to char- ge the NiMH/NiCd accumulators with seven or eight cells, you will need at least 13 to 15 volts to power the circuit. This is justified during the charge by a voltage level that can exceed 1.5 V for each of the NiMH/NiCd cells (8 ele- ments times 1.5 V = 12 V on the bat- tery), as well as by the internal resistor causing a noticeable drop in voltage, especially at high current levels. If you observe a current charge setpoint that is lower than the one you have selec- ted, raise the power supply voltage le- vel of the setup! ( 050073 - 1 ) Internet Links Product sheet features for the ST7MC2S4: http : / /www. st .com/ stonline/product s/ literature/ds/972 l/st7mc2s4.pdf Application note for the ST7MC: http ://www. st .com/ stonline/books/ pdf/docs/10267.pdf More information about charging LiPo and Li-Ion batteries: http://www.ni-cd.net/accusphp/theo- rie/charge/liion.php 30 elektor electronics - 4/2007 Paltronix Limited www .paltronix.com Microcontroller Development Tools PICmicro Starter Pack now with ICD — still £99 • High-quality development board with on-board USB programmer and built-in I/O devices. • Supports 8, 14, 18, 20, 28 and 40- pin PICs in 10F, 12F, 16F and 18F families. • Now features mikrolCD in-circuit debugger. • Supplied with PIC16F877A. PICmicro BASIC, C and Pascal Compilers — from £59.50 • Easy to use with user-friendly IDE. • Features simulator and mikrolCD in-circuit debugger. • Plentiful ready-written routines and example programs. • 30% discount for customers pur- chasing EasyPIC4/BIGPIC4 devel- opment boards. The new EasyPIC4 development board now supports even more PICs including 8, 14, 18, 20, 28 and 40-pin devices from the 10F, 12F, 16F and 18F families. With its on-board USB programmer, mikrolCD in- circuit debugger and useful I/O devices, the EasyPIC4 must be the best-value development board on the market. Our Starter Pack in- cludes the EasyPIC4 board, USB cable, 16x2 LCD, 128x64 GLCD, DS1820 temperature sensor and a starter’s guide with example pro- grams in assembly language, BASIC, C and Pascal. MikroElektronika’s popular mikroBASIC, mikroC and mikroPascal compilers now include the mikrolCD in-circuit debugger for use with the EasyPIC4 and BIGPIC4 development boards — programs can now be executed on a target PIC with variable values, special function registers, memory and EEPROM viewed on the PC screen. Great value at £85 each for mikroBASIC/mikroPascal and £145 for mikroC, or when bought with an EasyPIC4/BIGPIC4 only £59.50 each for mikroBASIC/mikroPascal, and £101.50 for mikroC. We also stock development tools for 8051, ARM, AVR, dsPIC, PICmicro, PSoC and other devices — please see our website for details Educational Products PICmicro Microcontroller Training System — £99 Digital Logic Training System — £99 • Teaches both assembly language programming and interfacing. • Based on the popular PIC16F877A. • Includes USB programmer. • Features built-in I/O devices and solderless breadboard. • Supplied with tutorial and program examples. • Ideal for learning about and experi- menting with digital logic devices. • Built-in logic and pulse switches, LEDs, 7-segment displays, piezo speaker, pulse generator, logic probe and solderless breadboard. • Supplied with useful range of ICs, jumper wire and mains adapter. The PICmicro Microcontroller Training System is an ideal platform for students and hobbyists alike to learn about PIC microcontrollers. The experiment board features a range of built-in I/O devices and a solder- less breadboard on which experiments may be conducted. Circuits are connected using the provided jumper wires. A USB programmer is also supplied and connects to the experiment board to program the PIC. Also included are a mains power adapter, 16x2 character LCD, connecting leads and a tutorial with example programs. The Digital Logic Training System makes learning about digital logic and experimenting with discrete logic ICs easy. The experiment board features a range of built-in I/O devices and a solderless breadboard on which experiments may be conducted. Circuits are connected using the provided jumper wires and the system includes features such as a power supply, pulse generator and logic probe. Also included is a mains power adapter, selection of ICs and a tutorial with example circuits. 1 We also stock other trainers, circuit labs and solderl 1 ess breadboards — please see our website for details Robots and Accessories Test Equipment Robo-BOX 3.0 Robot Kit — £99 PoScope USB Oscilloscope/Logic Analyser — only £99 • Complete robot kit including con- troller, programming software and all mechanical parts. • Build different robot configura- tions from one kit, including wheel-based and track-based. • Program intelligence to follow light, detect collisions and trace lines. • Low-cost PC-based instrument featuring oscilloscope, spectrum analyser, logic analyser, pattern generator, and chart recorder. • Decodes serial buses including UART, SPI, I2C and 1-wire. • Supplied with logic analyser test lead set, two oscilloscope probes, USB cable and software. Learn about, experiment and have fun with robotics with Robo-BOX 3.0 — an incredibly easy-to-build yet adaptable and expandable robot. Various wheel-based and track-based robots can be built from the standard kit including light-following, collision-detecting and line- tracing models. Programming is carried out in graphical Logo. A range of low-cost options allow for easy expansion and the development of more sophisticated robots. We also stock similar robot kits based on PICmicro, 8051 and 68HC11 microcontrollers. PoScope has to be one of the best-value pieces of test equipment available and features a dual channel oscilloscope (100Hz to 200kHz sample rate), 16 channel logic analyser (1kHz to 8MHz sample rate), and 8-channel pattern generator (1kHz to 1MHz). What makes the PoScope really useful to those working with microcontrollers is its ability to decode serial communications including RS-232, I2C, SPI and 1-wire. Priced at only £99, the PoScope comes with a USB cable, logic analyser test lead set, two oscilloscope probes and software. Tel: 0845 226 9451 Fax: 0845 226 9452 Email: sales@paltronix.com All prices exclude UK delivery (£5 standard/£10 next-day) and VAT. Major credit and debit cards accepted. Secure online ordering. HANDS-ON MINI PROJECT Simple Solar Cell Charger Avoids overcharging of NiCad-batteries Luc Lemmens Small solar cells can be obtained very cheaply these days — or you could remove them from an old solar powered garden light. It would be nice to use them, but for what? With a handful of parts you could use such a solar panel to safely charge ^ a set of batteries. • « n A ■ m ' * " 1 “ ^ 1 ^ In In theory you could just connect a solar panel via a Schottky diode to several batteries connected in series. The internal resistance of a small so- lar panel is sufficiently large to limit the charging current to a safe value. But with such a simple circuit it would still be possible to overcharge the bat- teries. That’s why we’ve put together a little charging circuit that avoids this (Figure 1). OPERATION There’s not much to the circuit: it consists of just two transistors and a few passive components. The way it works is very straightforward. The voltage across the batteries is conti- nuously monitored. When this voltage rises above a certain level (meaning that the batteries are fully charged), a power resistor is switched in paral- lel with the solar panel, which causes output voltage of the panel to drop and stops the batteries from being charged any further. The voltage is monitored by the circuit around T2. Zener diode D2 puts the emitter of T2 at an offset of about 1.4 V. Potential divider R3, PI and R6 sup- plies the base voltage to T2. When this rises above roughly 2 V (1.4 V plus the base-emitter drop of T2) the transistor starts conducting. This pulls the base of T1 lower via R5, which also causes T1 to conduct. The current from the so- lar panel is then diverted through po- wer resistor R7 (10 Q, a 1 W type is usually sufficient). This causes the vol- tage of the panel to drop, stopping the charging process of the batteries. Depending on the tolerance of the com- ponents in the potential divider, T2 and D2, you’ll have to experiment a bit with the setting of preset PI to obtain the correct final voltage for the NiCad bat- 32 elektor - 4/2007 Schottky diode Dl, the nominal modu- le voltage should exceed the charge voltage set on PI by about 0. 3-0.4 V. A typical (inexpensive) solar module (array) to charge two cells consists of eight series connected solar cells. With a sufficient amount of sunshine such a module will supply about 140 mA at 8 times 0.45 V = 3.6 V. Of course, you can use larger modules with a hi- gher nominal current capacity in or- der to reduce the charger time — this will be a matter of cost. With the 140- mA module, for example, a totally flat 1400-mAh battery (pack) will require 12 to 14 hours worth of uninterrupted sunshine (rare in the UK). There is one thing you may have to watch out for during the construction: a zener diode of 1.4 V often consists of two normal diodes connected in series. This pseudo-zener should be connec- ted in forward bias, not reverse biased like a true zener. The cathode (the con- nection with the ring) has to be con- nected to ground in this case! The setting of the final char- ging voltage is best done by temporarily replacing the bat- teries with an adjustable DC po- wer supply. Its output should be set to exactly 2.88 V. Connect a voltmeter across power resistor R7. Then place the solar panel in bright sunlight. Set the preset to the maximum resistance. Now slowly turn the preset back until the voltmeter suddenly shows a vol- tage of a few volts, indicating that T1 is conducting. The adjustment is now complete and you can disconnect the power supply and replace it with the batteries again ( 060315 ) CONSTRUCTION Since the circuit consists of relatively few components it can easily be built on a piece of experimenter’s board (as the photo of our prototype shows). If you use screw terminals for the input and output connectors it will be easier to connect the leads from the solar pa- nel and the batteries to the board. The nominal voltage of the solar mo- dule is determined by the number of cells to be charged. Because of the ty- pical voltage drop of 0.3 to 0.4 V across teries. The accepted value for a fully charged battery is usually taken to be 1.44 V. In this case (for two batteries connected in series) the circuit has to be adjusted such that T2 starts con- ducting when the voltage across K2 reaches 2.88 V. If you want to charge more than two batteries at a time you only need to modify the potential divi- der. Simply increasing the value of R3 will make the circuit work with three or four batteries connected in series. D1 BAT86 Figure 1 . The circuit consists of only two transistors, two diodes, a preset and six resistors. 4/2007 - elektor 33 TECHNOLOGY BATTERIES High power nanophosphate batt Ludwig Retzbach Lithium-based chemistries have for some time been showing the most promise of all battery technologies. Although they offer an unsurpassed energy density they are difficult and expensive to manufacture and require careful handling and gentle charging. Things could be about to change with the introduction of nanotechnology into the manufacture of the cathode. The author tested some of the first examples of these new Li-ion units for Elektor Electronics, with results varying from the merely respectable to the sensational! LiPo (lithium polymer electrolyte) batteries have been used at high discharge currents by model aircraft builders for years [1]. The energy density (in Wh/kg) and power den- sity (in W/kg) are such important factors that compromises are made in reliability and service life which would not be acceptable in industrial applications such as power tools or hybrid cars. Here other technologies, such as NiCd, NiMH and even lead-acid (for example ordinary car batte- ries) are still used. The American manufacturer A123 Sys- tems has been mass-producing a new type of nanotechno- logy-based high-load cell in Asia since 2006. These lithium cells appear to combine the advantages of traditional lithium cells with those using nickel-based chemistries, wi- thout suffering from the disadvantages of either. According to the manufacturer's information (see Table) the batteries are practically ideal, offering the following benefits: - safety (nonflammable, no protection circuitry required); - robustness (high cycle life, simple charging procedure); - withstands high loads and rapid charging; - constant discharge voltage (flat discharge curve); - high cell voltage and low self-discharge (compared to NiMH and NiCd cells); - high power and energy density. The price is already comparable to that of similar LiPo cells and will surely drop significantly as production quantities increase to satisfy industrial demand. It almost sounds too good to be true: and so we were naturally keen to find out how well the cells perform under test. 34 elektor electronics - 4/2007 ANR26650M1 Specifications LESS IS MORE? The text box 'A little physics and chemistry' discusses the construction and special features of the new cell design, called 'nanophosphate' by the manufacturer after the iron phosphate (FeP04) cathode. The first device in the series to be available, 'ANR26650M1 ' to give it its full part num- ber, is a convenient cylindrical cell 26 mm in diameter and 65 mm in length. Traditional Li-ion cells have a nominal voltage of 3.6 V and a charge voltage of 4.1 V, although some manufacturers quote 3.7 V and 4.2 V respectively. Here we see the first difference: the new cells have a nomi- nal voltage of 3.3 V and a charge voltage limited to 3.6 V. The nominal capacity of 2.3 Ah is nothing special when compared to the 2.5 Ah or 2.6 Ah offered by ordinary Li- ion cells. More notable is the difference in weight: where a similar Sony or Panasonic Li-ion cell might weigh 88 g or 93 g, the A1 23 Ml cell weighs just 70 g. A reason for this is that the casing of the cell is made from aluminium (Figure 1) rather than sheet steel. This also has the advan- tage of improving heat conduction from the cell. Breaking with tradition the casing forms the positive terminal of the cell, with a thin layer of ferromagnetic material (presuma- bly nickel) forming the actual contacts. For testing a pair of cells with welded-on connections (Figure 2) was made available to us. Unless otherwise stated, voltage values gi- ven below refer to a series connection of two cells. FIRST IMPRESSIONS To verify the specifications given in the data sheet it is necessary to approach the maximum permissible values carefully to avoid premature damage to the battery. The characteristics of the battery did indeed change: with each charge/discharge cycle we measured a decrease in ca- pacity of approximately 1 mAh, or around 0.05 % of the nominal capacity C. To begin, we tried charging at 1 C (2.3 A) and dischar- ging at 4 C (9.2 A). The cell temperature remained prac- tically unchanged during charging; during discharge, the temperature rose from 21 °C to 31 °C. The 1 0 C (23 A) discharge test also went smoothly, with the cell temperature rising to 49 °C. With discharge down to 4 V (measured under load) the battery delivered a mean discharge voltage (Urn) of 5.68 V, or 2.84 V per cell. The calculated energy density was 94 Wh/kg. The Sony 26650VT cell, which is the same size, gives a rather hi- gher mean voltage of 3.24 V at 1 0 C discharge. The ener- gy density is slightly but measurably lower than the FeP04 cell at 89 Wh/kg. This difference can be ascribed to the lower cell weight. However, the new cell falls well short of the performance of the LiPo cells (Figure 3) widely used in modelling circles: these commonly have mean discharge voltages of 3.5 V and above at 1 0 C. The energy density of high-current LiPo cells is typically between 1 20 Wh/kg and 170 Wh/kg. Nominal capacity and voltage: 2,3 Ah, 3,3 V Internal impedance (at 1 kHz) 8 m£2 typical Internal DC resistance (10 A, 1 s) 10 mQ typical Recommended standard charge rate 3 A to 3.6 V (CCCV), 45 min Recommended fast charge rate 10 A to 3.6 V (CCCV), 15 min Maximum continuous discharge current 70 A (approximately 30 C) Pulse discharge current (10 s 120 A (approximately 50 C) Recommended charge/discharge cutoff voltages at 25 °C 3,6 V/2 V Recommended charge/discharge cutoff voltages at below 0 °C 4,2 V/0,5 V Cycle life at 10 C discharge, 100 % discharge depth More than 1 000 cycles Operating temperature range -30 °C to +60 °C Storage temperature range -50 °C to +60 °C Abmessungen (aLange/Durchmesser) 65 mm/26 mm Weight (without connections) 70 g Residual capacity after 1000 cycles at 100 % discharge depth (at 25 °C, 2.3 A charge and discharge current; at 95% 45 °C, 3 A charge and 5 A discharge current; at 60 °C, 88% 3 A charge and 5 A discharge current) 77% (Source: A123 Systems) Figure 1. Individual Li-ion FeP04 cells (only available as samples), and welded together to form battery packs. Figure 2. Eight-point spot welding guarantees low contact resistance. Figure 3. Only LiPo cells in a foil envelope can offer a higher energy density. 4/2007 - elektor electronics 35 TECHNOLOGY BATTERIES For our next test we fully charged the cells at 1 C and then cooled them to -8 °C. The subsequent discharge at 1 0 C took place at room temperature 23 °C): before the measurement the surface temperature of the cells had risen to 9 °C, although the internal temperature (unfortunately impossible to measure directly) would have been conside- rably lower. Figure 4 shows very clearly, however, that the terminal voltage of the cooled cells initially fell very sharply and then, as the internal temperature increased, returned to the same level as if the experiment had been started with the cells at room temperature. The difference in the final temperature of the cells (47 °C versus 49 °C) is surprisingly low. One explanation is the temperature de- pendence of the internal resistance of the cells: considera- bly more power is dissipated internally when the cells are at a lower temperature. The next test involved increasing the discharge current to 15 C (34.5 A). Again the cells delivered more than their nominal capacity with their temperature rising from 23 °C to 53 °C. Now to try to push the cells to their limits! Figure 4. Effect of temperature: the voltage of the cooled cell falls initially and increases again as the cell warms up. CURRENT FUN The experimental setup is shown in Figure 5. A very low resistance circuit is used to measure the peak cur- rent levels. The total resistance in the circuit is made up of contributions from the 1 mQ shunt, the built-in shunt in the 1 00 A current sink and other resistances associated with it (the cable resistances and the contact resistances in the MPX connector). Together these were so great that it was not possible to discharge a single cell at more than 65 A. We therefore carried out the high current measurements using two cells in series as before: this meant we could also use a pair of multimeters to measure voltage matching between the cells. At the cell's quoted peak current of 1 20 A the current sink we used would have been overloaded, so we restricted our experiments somewhat. The temperature rises we ob- served at 15 C discharge had in any case indicated that it would not be appropriate to test the cells together at their specified continuous discharge rate of 30 C (70 amps). Ex- perts agree that a cell surface temperature of 65 °C during discharge is the maximum allowable for safety. We therefore tested using the following discharge regime: 1 6 s discharge at 69 A (30 C) followed by alternating 're- covery' periods of 1 1 .5 A (5 C) lasting 30 s, and 1 0 s pul- ses at 69 A. Discharge was terminated when the minimum discharge voltage or maximum temperature was reached, whichever was earlier. The results are shown in Figure 6 . The terminal voltage fell rapidly during the high load periods, indicating that the lithium ions inside the cell are not able to move quickly enough. However, the cell clearly recovers quickly during the low-load periods. Although the voltage gradually decreases overall as the cell is dischar- ged, the drops caused by the higher load becomes signi- ficantly less sharp as the cell temperature rises. This shows the dependence on temperature of the internal resistance of the cell. When half discharged we measured an internal resistance to DC of approximately 1 1 mQ (the data sheet quotes a typical value of 1 0 rr\Q). By the time discharge was complete, the cell temperature had risen to 63 °C. This leaves very little margin for safety without additional cooling for the cells, and so we did not carry out further tests using longer high-load pulses. In this test the battery delivered 2320 mAh: again, more than the nominal ca- pacity. Matching between the cells was impressive, with a difference between the cell voltages of at most 1 0 mV over the whole test. We stopped the discharge at full load when the terminal voltage reached 1 V per cell. One minute later the open- circuit voltage of each cell had recovered to 2.74 V. FAST CHARGING We carried out fast charging experiments at 4 C (9.2 A) without an electronic balancer; we did, however, conti- nuously monitor the individual cell voltages. As with lead- acid batteries, it is only possible to set the initial charging current because the maximum voltage supplied by the charger (Figure 7) must be limited, and after the cell vol- tage rises to a certain level the charge current starts to be reduced (constant current/constant voltage charging). This happens in this case after about 1 0 minutes, a time slightly shortened by the effect of the shunt in the meter. After 20 minutes the cell is charged to more than 97 % of its nomi- nal capacity and the charge current has fallen to 0.5 A. A fast charger would then report the cells as 'full'. Over the fast charging process the cell voltages deviated from one another only occasionally and by at most 20 mV, and the cells completed charging practically simultaneously. During the fast charging process the cells do warm up to a measurable extent, with the temperature slightly lagging the charge current. This can be put down to losses in the internal resistance of the cells. When charging the ANR26650M1 it is important for safety reasons not to exceed the recommended char- ging voltage of 3.6 V. However, throwing caution to the winds, the author tried 'overcharging' the pair of cells with a terminal voltage of 7.8 V (3.9 V per cell). Do not try this experiment at home! The cell voltages (Figure 9) remained matched and no strange noises or smells were emitted, but the rewards were limited: the subsequent 3 C discharge delivered an extra 1 00 mAh, and the mean discharge voltage was just marginally higher. The conclu- sion is that overcharging brings a small increase in energy density from 1 03.6 Wh/kg to 1 04.6 Wh/kg, not enough to outweigh the risks and the probable negative impact on the life of the cells. 36 elektor electronics - 4/2007 A little physics and chemistry The idea of using nanotechnology in conjunction with a lithium battery chemistry is to increase the surface area of the electrodes over which reactions can happen. Scope for further developments in the graphite anode (negative terminal) seems to have been almost exhausted, but progress is being made regarding the cathode. At the cathode compounds (generally oxides) of transition metals are used for ion capture. Cathodes using metals such as manga- nese, cobalt and nickel are already in mass produc- tion, each having their own particular advantages and disadvantages. A123 Systems has chosen to use iron (also in the fourth period). In iron phosphate (FeP04) they seem to have found a cathode mate- rial which even at relatively low voltages is capable of accepting enough lithium ions to provide adequa- te battery capacity. Li-ion batteries are essentially only chemically stable within a narrow voltage win- dow from 2.3 V to 4.3 V; and towards either end of this range there are compromises to be made in terms of service life. In practice an upper limit of 4.2 V is regarded as acceptable, with 4.1 V recommen- ded for increased life. To keep within these voltage limits traditional lithium batteries made of a number of cells connected in se- ries come with electronic add-ons such as balancers, equalisers or (at the very least) accurately-set voltage limiters. As charge currents increase these devices become more and more complex and inevitably bring power losses with them. The user would rather do without these devices, and of course would pre- fer cells which can withstand deep discharge. Other desiderata include as wide as possible an opera- ting temperature range and the ability to charge quickly. The A1 23 Systems FeP0 4 cells are defini- tely a step in the right direction. It is, however, not yet clear how well the ANR26650M1 responds to mistreatment. J current sink or charger 11 connecting wires temperature sensor (4 mm 2 c.s.a) UniTest 2 www. sm-modellbau.de Cell 1 voltage CD Cell 2 voltage cm 070019-12 Figure 5. All measurements were taken using two cells connected in series. A Unitest2 datalogger recorded the results. The two multimeters show the individual cell voltages. a> a) re • 4 -* o > 3 i discharg e voltage two cc ills type ANR26I 350M1 ( i r 30 C / 5 ( V N _ \ \ \ 1 cell t jmf erature __ discharg e current 80 70 O 60 ° (/> Cl) CD L. D> 50 2L 0 i— 3 40 P 30 0 a E 0 20 0 3 O 10 o CO o CO o a> o cnj o LO o 00 o CNJ o CNJ o N- CNI time [s] o o CO 070019-13 Figure 6. High-rate discharge using a current alternating between 30 C and 5 C. Figure 7. This charger, made by Graupner, allows constant current/constant voltage charging with a current limit at 9.2 A and a maximum charge voltage of 3.6 V per cell. 4/2007 - elektor electronics 37 TECHNOLOGY BATTERIES PRELIMINARY CONCLUSIONS The new Li-ion cells using an FeP04 cathode bring high- current industrial applications closer to reality, especially considering their broadly flat discharge voltage curves. The energy density offered is not significantly greater than that of traditional Li-ion cells, but the power density is rather greater. The combination of low internal resis- tance and low weight augurs well for their replacing cells based on nickel or lead in high power applications. The fact that the cells cannot withstand continuous discharge at 30 C without the temperature rising to unhealthy levels is no great disadvantage since you are unlikely to want to discharge a 2.3 Ah cell at 70 A over a period of just two minutes. For such applications lithium cells are not the only solution. On the other hand, there is always demand for faster char- ging, especially if the charging time can be reduced to the length of a tea break. This is one reason why these batte- ries are already available in 36 V (ten-cell) professional hammer drills [2]. The most promising application to date is in hybrid and other environmentally friendly vehicles. A battery made from four FeP04 cells (1 3.2 V) is around 70 % lighter than a lead-acid battery. Lithium technology is expected to be seen in hybrid vehicles such as the Toyota Prius III from 2008. Better cycle life and considerably higher energy and power densities will enable considerable progress in hybrid vehicle technology and moves towards zero-emis- sion vehicles. A series of projects in the USA is under way to develop 'plug-in hybrids' whose batteries can be rechar- ged from a supply socket. A1 23 is working with automo- tive supplier Cobasys and, together with Johnson Controls (Varta/Saft), has agreed to work with General Motors to develop lithium batteries for a plug-in SUV. The techno- logy is also interesting from the point of view of even more economical electric vehicles from leisure-oriented electric scooters via the trendy Segway to electric bicycles. With acceleration from a lithium battery discharging at 50 C (ten seconds is long enough) perhaps electric bicycles will start to be seen as more than mopeds for the elderly, wegkommt... ( 070019 - 1 ) Availability The samples we tested were obtained from the Ger- man battery system supplier BMZ [3]. As far as we know BMZ is currently the only European importer of A 1 23 batteries. Batteries sold under the 'BMZ' and 'Konion' brands are assembled by Akku-Service Untermain. It seems likely that as demand increases the cells will also become available from specialist battery suppliers and from the larger electronics distri- butors. A1 23 Systems offer developer kits from their own website [4]. A separate site aimed at modellers [5] offers ready-made battery packs and chargers. Figure 8. Fast (20-minute) charging test with an initial current of 9.2 A. Figure 9. Even a little overcharging does not upset the matching between the two cells of the battery. m ' 2 ' : 3 : '4' '5' Ulrich Passern: 'Super Lithium Batteries', Elektor Elec- tronics April 2005, p. 52 http:// www.dewalt.com http://www.bmz-gmbh.de/englbmz/eindex.html http://www.a 1 23systems.com http://www.a 1 23racing.com 38 elektor electronics - 4/2007 far Windows Joi Number One Systems The World Beating PCB design software Easy- PC Easy-PC version 10 sets another mile s to WWlflJftg ailxGlddei th< world over, Eatjr-PC! fbr Window* VIO ** anc-thor major milestone in cwglution of this extremely popular stjftwar-e tool Try a demorfinratiofi ropy of Easy-PC and prepare eq bo amazed ,n rh-o power. VG-rsauliry and remarkable. vnluE- for nwiey. ftuu hi 1 |.^J " !■ — ■ rlr-i i_ ■■■! ■S 3 -! ! t , “L-v„ — -p-i r t l 1 ■«■ 4* K ® Version 10 feature* ■ Intelligent Gerber Import epekm ■ Ti ^ 1 4 . ^ 1 1 a p f# - h .!_,■ ■ t'tude Routing ■ Teat C-klteuEi ■ L^er |r VI* Stic^i Fiwlewi ■ Blind A Byried Vm Support ■ Te-qrdrep P+d+ ■ Dm* Spacuif Off-vrantri- ■ Sfdnl Traces- A Hhapei many jwirp ^jh; itwij b-plurpv,--- — Fu 1 ijr inte^raied hhemidu * PCB lay&irt In a single application- complete v^-ich toward aj^d back annoeauon. Design and rules checks at all ju^ei ensure Iniegrky at all timet. FVofes ilc-r^l um.i^ura-dEurin^ output allow you to finish tho design process with e-nse- Stop prtis... Stop press... Stop press.,, Slop press-. Bsy.FC imports Eatf& files as well asTsien Boardnuker 2 files «n br; t™diure.pncwA CD j PreriT*, www.numberone.com ■Qit Laiw. Breikrn.Iewtaabyrr. Gkni GL20 7 LR. United KiJijcdijrn No Compromise Oscilloscope Other oscilloscopes to this prke- range font* F«J ip ( Bm piomm itfi bfm Save as...). Figure 3. The display matrix test program. Figure 4. Transfer of the variable COLUMN to PORT A. 4/2007 - elektor 41 HANDS-ON E-BLOCKS m !-ns is "=« Figure 7. Figure 5. Interrupt configuration. The very simple interrupt routine. Figure 6. The C code included in the interrupt routine. Interrupts This scanning operation must be extremely fast, but it's a routine task that doesn't require any computation as such. So, we're going to entrust it to an interrupt triggered by one of the microcontroller's timers. We drag an INT hexagon below the initialization of the variables and configure the interrupt as shown in Figure 5. Each time counter TMRO passes zero, i.e. 300 times a second, it triggers the execution of the routine (called a MACRO in Flowcode parlance) INTERRUPT_TMRO. So all we have to do is transfer the instructions that up till now have been in the main body of the program into this rou- tine. We click on Macro in the menu bar, then on Edit/ Delete , then on INTERRUPT_TMRO. We drag a C CODE box to the start and copy there the instructions from the previous program. To avoid a lot of work and the risk of introducing errors, all you need do is open the file Ch2D0.c (created by the last compilation) in Wordpad or another simple text edi- tor. Use the mouse to select the block to be copied, then press Ctrl-C (for Copy), go back to the Flowcode editor window and press Ctrl-V (for Paste) (Figure 6). After the C code, all that remains to be done is add the output symbols for PORT A and PORT B (Figure 7). The multiplex demonstration program (Figure 8) picks up again at the interrupt routine. Let's move it! Since our aim was to have an animated light display, we're going to make the diagonal chase, and even add a second one, four steps away. This is going to be the Ch2D2 program. ANSI standard and the language C as used by MPLAB The language C understood by MPLAB (the Microchip development tool) doesn't seem to correspond exactly to the ANSI standard. The masking operation can be written as: FCV COLUMN &= 7; Endless loop END C programmers love these highly-condensed forms because they are hard to read (including by themselves!) and disconcerting for novices, who are therefore likely to have greater respect for the masters. Oddly enough, the expression: FCV COLUMN %= 8; Figure 8. Multiplexing demonstration. A stationary diagonal is being displayed. (correct according to the ANSI standard) is refused by the compiler. Using computers and modern editors, cut-&-paste operations have become so easy that we really don't any longer need to worry about saving a few keystrokes. In both cases, the result is the same, as can be verified by checking the .LST file generated by the compiler and the assembler each time. When the compiler refuses a line in C or as- sembly language, all it does is say so, without explaining why. So you will always have to look back at the .LST file, which contains all the details of the program in assembly language. Another small difference between ANSI and MPLAB: in MPLAB, variable names must be in capitals, whilst the ANSI standard recognizes both cases and differentiates between them. 42 elektor - 4/2007 First of all, the initial values of ROW are replaced in such a way as to illuminate two spots, and then the primary loop shifts the contents of all the registers. The successive hex values for ROWO to ROW3 are Oxl 1 , 0x22, 0x44, and 0x88. These four values are repeated for ROW4 to ROW7. Because Flowcode does not understand either binary or hex — neither C (0x1 1 ) nor Intel (1 1 h) modes — these have to be written in deci- mal: 1 7, 34, 68, 1 36. While the program is running, shifting takes place in each register via a 2-times multiplier. When the bit to be shifted is furthest left, a value of 136 (1000 1000 in bi- nary), it jumps back to the initial value 17 (0 0010001 ). Depending on the exact moment, we will have three or four lines instead of two (Figure 9). It is now possible to change the initial values, to produce for example a single diagonal (1 , 2, 4, 8, 1 6, 32, 64, 1 28), chevrons (1 , 2, 4, 8, 4, 2, 1 , 2), or a line broken up into several spots. The program itself can count the scans and, after a given number, change the values to produce another pattern, loaded from blocks of constants defined in the program memory. Although this microcontroller is one of the smallest, the last version of this program occupies only a small fraction of the Flash memory available: 391 words out of 4,096. Construction The project can be built on perforated prototyping board or on the printed circuit board shown in Figure 10. It has two male sub-D connectors, J2B and J3B, so named because they mate with the female DB9 sockets J2 (PORT A) and J3 (PORT B) on the E-blocks Multiprogrammer board. The +5 V power will be taken from the +V termi- nals of screw terminal block J7; the ground is already connected via pin 9 of the DB9 connectors. ! COMPONENTS LIST I Resistors I R1-R8 = 22Q I Semiconductors I D1-D64 = LED, diam. 3 or 5 mm 1 IC1 = 74HC1 38 Miscellaneous . J2B, J3B = 9-way sub-D plug, (male) , PCB mount J7B = 2-way terminal block, PCB mount Figure 10. The board can be built single-sided, with a series of jumpers for paralleling the 8 LEDs in each row. Component layout takes a bit of care in orienting the LEDs. The 22 Q resistors are pretty much a token, as the LED current is limited (oh horror, heresy!) by the microcon- troller outputs' maximum output current. The total current drawn by the eight pins of PORT B is 100 mA. In any event, it's worth using high-efficiency LEDs. Double-sided circuit board is far from being necessary. The transverse connections can be produced very simply using wire-wrapping wire. Start by tinning liberally the va- cant pads above the LED anodes. Then push the wire into the blob of solder using the soldering iron tip and enough force. The plastic insulation squashes up, melts, and re- tracts just enough for the copper to become soldered to the pad. Tug gently to check the joint holds, and move on to the next one. Cut off the wire after the last solder joint on the row. ( 075032 - 1 ) Figure 9. The simplicity of the flow diagram conceals numerous statements and instructions in C. 4/2007 - elektor 43 QUASAR electronics Quasar Electronics Limited PO Box 6935, Bishops Stortford CM23 4WP, United Kingdom Tel: 0870 246 1826 Fax: 0870 460 1045 E-mail: sales@quasarelectronics.com Web: www.QuasarElectronics.com Postage & Packing Options (Up to 2Kg gross weight): UK Standard 3-7 Day Delivery - £3.95; UK Mainland Next Day Delivery - £8.95; Europe (EU) - £6.95; Rest of World - £9.95 (up to 0.5Kg) iOrder online for reduced price UK Postage! We accept all major credit/debit cards. Make cheques/PO’s payable to Quasar Electronics. Prices include 17.5% VAT. Call now for our FREE CATALOGUE with details of over 300 kits, projects, modules and publications. Discounts for bulk quantities. 08717 Credit Card 1 77 1 68 Get Plugged In! Motor Drivers/Controllers Here are just a few of our controller and driver modules for AC, DC, unipolar/bipolar stepper motors and servo motors. See website for full details. NEW! PC / Standalone Unipolar Stepper Motor Driver Drives any 5, 6 or 8-lead unipolar stepper motor rated up to 6 Amps max. Provides speed and direc- tion control. Operates in stand-alone or PC- controlled mode. Up to six 3179 driver boards can be connected to a single parallel port. Supply: 9Vdc. PCB: 80x50mm. Kit Order Code: 31 79KT - £1 1 .95 Assembled Order Code: AS3179 - £19.95 NEW! Bi-Polar Stepper Motor Driver Drive any bi-polar stepper motor using externally sup- plied 5V levels for stepping and direction control. These usually come from software running on a computer. Supply: 8-30Vdc. PCB: 75x85mm. Kit Order Code: 3158KT - £15.95 Assembled Order Code: AS3158 - £29.95 NEW! Bidirectional DC Motor Controller Controls the speed of most common DC , motors (rated up to 16Vdc/5A) in both the forward and reverse direction. The range of control is from fully OFF to fully ON in both directions. The direction and speed are con- trolled using a single potentiometer. Screw terminal block for connections. Kit Order Code: 3166KT - £16.95 Assembled Order Code: AS3166 - £25.95 DC Motor Speed Controller (100V/7.5A) Control the speed of almost any common DC motor rated up to 100V/7.5A. Pulse width modulation output for maximum motor torque at all speeds. Supply: 5-15Vdc. Box supplied. Dimensions (mm): 60Wx100Lx60H. Kit Order Code: 3067KT - £13.95 Assembled Order Code: AS3067 - £20.95 Most items are available in kit form (KT suffix) or assembled and ready for use (AS prefix). Controllers & Loggers Here are just a few of the controller and data acquisition and control units we have. See website for full details. Suitable PSU for all units: Order Code PSU445 £8.95 Serial Isolated I/O Relay Module Computer controlled 8- channel relay board. 5A mains rated relay outputs. 4 isolated digital inputs. Useful in a variety of con- trol and sensing applica- tions. Controlled via serial port for programming (using our new Windows interface, terminal emulator or batch files). Includes plastic case 130x100x30mm. Supply: 12Vdc/500mA. Kit Order Code: 3108KT - £54.95 Assembled Order Code: AS3108 - £64.95 Computer Temperature Data Logger 4-channel temperature log- ger for serial port. °C or °F. Continuously logs up to 4 separate sensors located 200m+ from board. Wide range of free software appli- cations for storing/using data. PCB just 38x38mm. Powered by PC. Includes one DS1820 sensor and four header cables. Kit Order Code: 3145KT - £18.95 Assembled Order Code: AS3145 - £25.95 Additional DS1820 Sensors - £3.95 each Rolling Code 4-Channel UHF Remote State-of-the-Art. High security. 4 channels. Momentary or latching relay output. Range up to 40m. Up to 15 Tx’s can be learnt by one Rx (kit in- cludes one Tx but more avail- able separately). 4 indicator LED ’s. Rx: PCB 77x85mm, 12Vdc/6mA (standby). Two and Ten channel versions also available. Kit Order Code: 3180KT - £44.95 Assembled Order Code: AS3180 - £51.95 NEW! DTMF Telephone Relay Switcher Call your phone number using a DTMF phone from anywhere in the world and remotely turn on/off any of the 4 relays as desired. User settable Security Password, Anti- Tamper, Rings to Answer, Auto Hang-up and Lockout. Includes plastic case. Not BT ap- proved. 130x110x30mm. Power: 12Vdc. Kit Order Code: 3140KT - £46.95 Assembled Order Code: AS3140 - £64.95 Infrared RC Relay Board Individually control 12 on- board relays with included infrared remote control unit. Toggle or momentary. 15m+ range. 112x122mm. Supply: 12Vdc/0.5A Kit Order Code: 3142KT - £47.95 Assembled Order Code: AS3142 - £66.95 PIC & ATMEL Programmers We have a wide range of low cost PIC and ATMEL Programmers. Complete range and documentation available from our web site. Programmer Accessories: 40-pin Wide ZIF socket (ZIF40W) £15.00 18Vdc Power supply (PSU010) £19.95 Leads: Parallel (LDC136) £4.95 / Serial (LDC441) £4.95 / USB (LDC644) £2.95 NEW! USB & Serial Port PIC Programmer USB/Serial connection. Header cable for ICSP. Free Windows XP software. Wide range of supported PICs - see website for complete listing. ZIF Socket/USB lead not included. Supply: 16-18Vdc. Kit Order Code: 3149EKT - £37.95 Assembled Order Code: AS3149E - £52.95 NEW! USB 'All-Flash' PIC Programmer USB PIC programmer for all ‘Flash’ devices. No external power supply making it truly portable. Supplied with box and Windows Software. ZIF Socket and USB lead not included. Assembled Order Code: AS3128 - £44.95 “PICALL” PIC Programmer “PICALL” will program virtu- ally all 8 to 40 pin serial-mode AND parallel-mode (PIC16C5x family) pro- grammed PIC micro controllers. Free fully functional software. Blank chip auto detect for super fast bulk programming. Parallel port connection. Supply: 16-18Vdc. Assembled Order Code: AS31 17 - £24.95 ATMEL 89xxxx Programmer Uses serial port and any standard terminal comms program. Program/ Read/ Verify Code Data, Write Fuse/Lock Bits, Erase and Blank Check. 4 LED’s display the status. ZIF sockets not included. Supply: 16-18Vdc. Kit Order Code: 3123KT - £24.95 Assembled Order Code: AS3123 - £34.95 www. QuasarElectronics. com Secure Online Ordering Facilities • Full Product Listing, Descriptions & Photos • Kit Documentation & Software Downloads ,2 5 n,« N ! T YIV1 n< 8> A W W J J ■■ .. J J L 1 SERVICING YOUR COMPLETE PROTOTYPE NEEDS 1 EUROCARD 4 (160 x 100 mm) + Tooling Price example Any size and contour possible! Optional: • Soldermask • Fast-turnaround • Silkscreen • 4-Layer Multilayer • 6-Layer Multilayer huj ii r j I HHhEJ Freephone Q) 0800-3898560 Simply send your files A/i A A/l/ll £*t%AA and order ONLINE: r V Virl THE VERY BEST CCTV AT liOW PRICES SYSTEM Jtl . 4 CDLDlrfi CAMERAS p-.-n ■-«. n-.j M iTW £438 1 C;Tr,:. ; -ski i : : r r', n ii 1 1 ~r^nr — iin £489 9 CDLDUH CAMERAS - DVR FA£Hit aHH eo- n^r-^il**** All r'Jifflf jr» MUfe arpj.rj i T.r. Cjff m* i'ky j i7m inrniraTfrii w rw ^ l j i f; r. T-P?" W Fn I > ! ■ i 1 ■ lrVc#i :■ ■ i# V ' mhif-r# Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 208 261 4509 See also www.elektor-electronics.co.uk All free, printed, supplements our readers got last year, like the Visual Basic, C and i-TRIXX booklets are also contained on the CD. The Elektor Volume 2006 CD-ROM has a rather different look and feel than previous editions. It’s gone through a makeover in more than one way! leading the way lectromcs cd-rom Elektor 2006 Completely new HTML user interface This CD-ROM contains all editorial articles published in Elektor Electronics magazine Volume 2006. Using the supplied Acrobat Reader program, articles are presented in the same layout as originally found in the magazine. £16.25 / US$ 28.75 ISBN 978-90-5381-207-5 All articles in Elektor Electronics Volume 2006 on CD-ROM Order now using the Order Form in the Readers Services section in this issue. 4/2007 - elektor electronics 45 HANDS-ON FREESCALE MICROS 0-Force on ^ Two-axis 2g accelerometer with SpYder and a Freescale micro Jan Buiting & Luc Lemmens, in cooperation with Inga Harris (Applications Engineer, Freescale Semiconductor Inc.) Here's a playful yet educational application of a Freescale MC9S08 microcontroller. It continues from last month's Attack of the SpYder article and should help you get to grips with the basics of migrating an MC9S08 micro from thinkware to hardware, all along an extremely low-cost route with three free items thrown in exclusively for Elektor readers. This month it all falls into place - the- ory, hands-on, free components and software together form an educational and fun to build project that’s sure to find its way into your car, RC model or on your bicycle. We could even envis- age the accelerometer being used in a dragster car, whether real or a scale model! Besides two maga- zine articles (the second of which you’re reading right now), all items that go into building the project are listed in Table 1 . The low price of the SpYder kit and the free accelerometer device you get with the two PCBs for this project is the result of Elektor and Freescale having teamed up in exclu- sive cooperation for the benefit of Ele- ktor readers. PROJECT TARGETS Elektor and Freescale set out to pub- lish this project with a few ambitious aims and deliverables in mind. Let’s list them, with the solutions found I Figure 1. The SpYder Discovery Kit in its final guise (last month we showed a beta version). Thanks to a special arrangement with Freescale Semiconductor, the kit is available from Elektor at a price of just £ 6.45 (Euro 9.75 / US$ 12.70) plus postage & packing. Note that the 6-way BDM ribbon cable has to be sourced or made locally. printed in italics. 1. The microcontroller used should be cheap - if possible, free. An MC9S08 device was chosen of which samples can be obtained free of charge from Freescale. 2. The micro should come with a full complement of programming and debugging tools. CodeWarrior and the SpYder USB BDM fit the bill. 3. Reader support should be available online. Freescale and Elektor forums are available. 4. The project should be educational and ‘open-platform’. All source code files, datasheets and development notes are available free of charge. 5. The project should have a ‘real-life’ aspect. A compact 2-axis accele- rometer with 2g range and LED readout. 6. With students in mind, overall cost to be kept to a minimum. Free ac- celerometer device, free MC9S08, low-cost PCBs and SpYder Disco- very Kit. 46 elektor electronics - 4/2007 Item Source / Supplier Description How to obtain Cost SpYder Discovery Kit Elektor Contains USB BDM, 8-pin MC9S08 sample, CodeWarrior & utilities CD. Order code 060296-91 from Elektor SHOP. £ 6.45 plus P&P. Free with module or kit from Elektor SHOP MC9S08QG8CPBE Freescale Freescale 16-pin PDIP microcontroller Order from Freescale free sample service Free Set of PCBs Elektor Two bare PCBs for home assembly using through-hole components Order code 060297-71 from Elektor SHOP £ 10.00 (US$18.85) MMA7260Q Elektor Freescale accelerometer device on carrier board Two (!) pieces Included f.o.c. with PCB set 060296-71 Free Other components Local supplier/ mail order Miscellaneous through-hole components as shown in components list. Buy locally or by mail order, e.g. Farnell Approx. £ 5.00 (US$ 9.50) Table 1. What - Where - How Overview of hardware/software items needed to build the Two-Axis Accelerometer project. An impressive list that’s sure to have worried managers and workers in com- mercial departments here and there but stuff to grind their teeth on for the makers of this project. Via the maga- zine publications, the challenge should extend to you if you are interested in making a start in embedded techno- logy using low-cost 8-bit microcontrol- lers that have proven worth their salt in automotive applications (very likely your new car will contain one). ACCELEROMETER An accelerometer is a device measu- ring and indicating force exerted on a moving body due to acceleration ( + g) or deceleration (-g). The present project can measure forces up to 2 g in two planes: forward/reverse and left/right. The readout is comprised of coloured LEDs with the highest value of g be- ing indicated by red LEDs. The instru- ment is battery powered and suitable for fitting in a vehicle where it will tell you and your passengers (like kids on the back seat) a lot about your driving habits. access to memory data and traditio- nal debug features such as CPU reg- ister modify breakpoint, and single- instruction trace commands. If you have used the HC05 or other older Freescale cores, as we endeavoured to, you will appreciate the advancement this module enables. The SpYder tool uses a standard USB interface to communicate to the PC and uses the USB bus voltage to pow- er the tool and microcontroller without the bulky wall adapters of old, making it truly portable. This USB power sup- ply can also power the target board, pro- vided you don’t run too many motors on it (up to 100 mA)! With the tool’s reliance on USB, the SpYder tool’s heart is Freescale’s MC908JB16 MCU. The MCU has a USB (2.0 low-speed) interface and operates from the 5 V supplied by USB. As the tool supports the RS08 microcontrol- type or use your own target board (as in the case of our accelerometer applica- tion) you can do so. By adding a 0-ohm resistor or a short circuit on the space next to the bed of nails labelled R2, you are effectively connecting the power supply to the BDM socket so that you can use another target board. The net result is the SpYder Discovery Kit turned into a BDM pod, but don’t worry... it still works as a standalone tool. If you do not have a BDM form ca- ble already you can easily build one: all you need is two off 6-way IDC sockets with strain relief (Farnell order code 1097021) and ribbon cable with 1.27- mm pitch (Farnell order code 9187111). A small vise allows the IDC connec- tors to be easily pressed onto the rib- bon cable ends. Keep the length below 30 cms or so. Remember to only have one micro con- nected at a time: either in the socket on the SpYder board or on a target board. The PCBs to build the project come with two free MMA7260 accelerometer sensors mounted on carrier boards - courtesy Elektor & Freescale SPYDER AGAIN -STEP BY STEP Before moving on to the project and the trusted solder iron, a word or two about your new companion in 8-bit Em- bedded Land. SpYder (Figure 1) relies on the HCS08 and RS08 Background Debug Controller (BDC). This enables a fast and easy way to program the on- chip Flash and any other memories. It is the primary debug interface for development, allowing non-intrusive lers too, 12 V is needed to program the RS08 devices. The MC908JB16 can recognise the target and via control of PTD0 can enable the 12-V signal using the ST662 DC -DC converter chip. Step 1 - SpYder board assembly The essential parts of the SpYder tool are already populated for you, which will allow you to use it as a standalone tool with the socketed micro. If you want to use another package Step 2 - Debugger installation CodeWarrior™ Development Studio for Freescale HC(S)08/RS08 v5.1 is avail- able FOC in its Special Edition incar- nation, a copy of which is on the SpY- der CD. A detail of what features Spe- cial Edition has over the Standard and Professional editions are available at www. freescale . com/code warrior. With- out a license key, the product will run in a 1-kB code size in limited demon- stration mode. To break the 1-kB limit, 4/2007 - elektor electronics 47 HANDS-ON FREESCALE MICROS The MMA7260Q acceleration sensor With Freescale's strong roots in automotive electronics, it is not surprising to see the company supply a wide range of acceleration sensors. Very likely, the brake light control in your new car will contain one! The electronics community was also quick to discover the advantages of Freescale's g sensors for use in model building (amateur rocketry, RC modelling, etc). An example of such an application will be published in our May 2007 issue. The MMA7260 is a low cost capacitive micromachined accelerometer with signal conditioning, a 1 -pole low pass filter, temperature compensation and g-Select which allows for the selection among 4 sensitivities. Zero-g offset full scale span and filter cut-off are factory set and require no external devices. This device includes a sleep mode that makes it ideal for handheld battery powered electronics. The g-cell inside the MMA7260Q is a mechanical structure formed from semiconductor materials (polysilicon) using semiconductor processes (masking and etching). It can be modelled as a set of beams attached to a movable central mass that move between fixed beams. The movable beams can be deflected from their rest position by subjecting the system to an acceleration. o o Acceleration O > o o x o r L £ — — 060297 - 13 As the beams attached to the central mass move, the distance from them to the fixed beams on one side will increase by the same amount that the distance to the fixed beams on the other side decreases. The change in distance is a measure of acceleration. The g-cell beams form two back-to-back capacitors. As the centre beam moves with acceleration, the distance between the beams changes and each capacitor's value will change, as expressed by this equation: C = AS / D where A is the area of the beam, X is the dielectric constant, and D is the distance between the beams. The on-chip ASIC uses switched capacitor techniques to measure the g-cell capacitors and extract the acceleration data from the difference between the two capacitors. The ASIC also signal-conditions and filters (switched capacitor) the signal, providing a high level output voltage that is ratiometric and proportional to acceleration. Two free MMA7270Q SMA devices mounted on carrier boards are included with the circuit boards for the project described in this article. The device is normally priced at US$5.95 each for 1 k+ order volumes ant then it comes without the carrier board (!). For your convenience, the MMA7260Q datasheet is included in this month's free download for the project. Application notes (and videos!) on this interesting device at http://www.freescale.com/webapp/sps/site/prod_summary. you have two options: 1. contact Freescale to request an un- limited period, free license key to in- crease the code size limit to 16 kB. 2. contact Freescale to request a 30-day limited, free license key to run the com- piler without limitations. Step 3 - Drivers Once the board is physically the way you want it to be and CodeWarrior is installed you must make the SpYder communicate with your debugger. The next step is to install the SpYder drivers available from the accompa- nying CD. Instructions on how to do this are available on the inside cover. When the tool is connected to the PC for the first time, Windows recogniz- es a new USB device; the “Windows New Hardware Wizard” dialogue box will be opened and asks for the re- quired driver. To complete the installa- tion choose the “Install Automatically” option. Simple! Figure 2. In CodeWarrior, be sure to select the right debugging connection to the PC. READY TO START DISCOVERING It is important to understand that SpY- der uses the target microcontroller to execute the in-circuit execution, not an emulator, so microcontroller’s peripher- als e.g. Timers, A/D converters, Serial Communication Modules etc. are not reconstructed by software or an exter- nal device. The first time you enter a debugging session, an MCU Configuration dialog box will open, prompting you to select the debugging hardware connection to your PC. Make sure that the connec- tion type “USBSPYDER08” is selected (Figure 2). At this point CodeWarri- or has erased and reprogrammed the memory and trimmed the oscillator if that feature is available on the select- ed MCU. Now you have everything you need to start debugging your code, you just need to know how to do it. CodeWarri- or enables a variety of ways to analyse program flow via breakpoints, watch- points and a trace buffer. All these features are implemented by taking advantage of the target microcontrol- ler’s debug peripheral. Your window will consist of: - a source window with your code displayed; - an assembly window where you can 48 elektor electronics - 4/2007 J COMPONENTS LIST \ Resistors I Rl = 10Q | | R2 = 4kQ7 I I R3-R7 / R9 / R12 / R13 = lkQ I I R8,R1 0,R1 1 = 1 00Q I Capacitors 1 Cl -C7 = 1 OOnF J Semiconductors I D1 = zener diode 1 8V 500mW | | D2-D5 = LED, green, low current, 3mm | | D6,D7,D8,D1 1 = LED, amber or yel- I I low, low current, 3mm I I D9,D1 0,D1 2,D1 3 = LED, red, low cur- I rent, 3mm 1 T1 -T4 = BC547 1 J IC1 = TS2950CT-3.3 ! IC2 = MC9S08QG8CPBE (16-pin PDIP; ( Freescale free sample service) ■ I IC3 = MMA7260Q acceleration sen- | | sor on carrier board (free, see PCB set | I below) I I Miscellaneous 1 Kl = 2-way pinheader for battery connection. K2 = 6-way boxheader - K3 = 9-way SIL pinheader . K4 = 9-way receptacle for K3 ■ ■ SI ,S2 = pushbutton, 1 make contact, | | footprint 6mm | I 4 PCB spacers, length = 10 mm I I PCB set, includes two free MMA7260Q I accelerometer devices (IC3). Order ^ code 060297-71, see Elektor SHOP ^ Project software and supplementary do- cuments, free download . # 060297- 11. zip ( ■ (www.elektor-electronics.co.uk) ■ Figure 3. Circuit diagram of the 2-axis 2g accelerometer. Figure 4. Component mounting plans of the two boards you have to populate and then assemble in piggy-back fashion. see what the compiler has created of your source code; - a registers window where the CPU registers are visible; - a memory window where you can watch any location or force bytes to another value; - other windows with data, procedures and commands. The format of the data and the re- fresh rates of the data can be changed by right clicking on the window and changing the mode or format. You can save the changes by following File Save Configuration. Take a few minutes to find and play with the Start/ Continue, Single Step, Step Over, Step Out, Assembly Step, Halt and Reset Target buttons. These two documents: AN3335 - Introduction to HCS08 Back- ground Debug Mode and AN2616 - Get- ting Started with HCS08 and Code War- rior Using C are a good place to start to find you way around the debugging environment. The bed of nails next to the MCU can be connected to a ’scope to allow you to monitor the pins’ output with the debugger in real time. YOUR FIRST PROJECT - AN ACCELEROMETER The circuit diagram of the MC9S08 powered accelerometer is shown in Figure 3. The microcontroller, IC2, is a 16-pin PDIP device you can obtain from Freescale’s online free sample program as discussed last month. The micro comes ‘blank’ and obviously has to be programmed with the firmware. This is done using SpYder. The accelerometer sensor type MMA7260Q is an SMA device that comes fitted on a 12x12 mm carrier board, specially for this Elektor project. You will get two of these free of charge with the PCBs for the project (see parts list). For the rest, there is little more than 12 LEDs physically arranged in four directions and switched on an off in a matrix constellation, under con- trol of the PB0-PB6 lines the MC9S08 micro. The circuit is powered by a battery (pack) with a minimum voltage of 4.5 V (e.g. three AA or AAA penlights in se- ries) and consumes about 25 mA when 4/2007 - elektor electronics 49 HANDS-ON FREESCALE MICROS Modify that accelerometer! The Accelerometer gadget can easily be modified to keep the maximum g reading for each axis displayed. Start by opening the project in the CodeWarrior environment (5.1). The source file, main.c, is where the application code is located. The change is to the Byte2LED function. The following code replaces the previous version: void Byte2LED (char Val, char Dir, char SenMode) { The code uses the passed parameter Val to scan the range of the G spectrum and finds out whether it is neutral, positive (G, A or R) or negative (G, A or R). Once it has found the correct range, it clears the opposite axis but leaves the maximum LED displayed. It then decides whether Val is a new maximum and updates if appropriate (always if Red). The routine then displays the magnitude with the maximum on that axis. Remember to add the new LED Bitmap definitions to the header file and LEDMax bitmap to the global variables in main.c. You can now save the project under a different name if you wish by following File Save A Copy As... as soon as the project is made, it is saved so the previous project version will be lost. You can also save the individual source files by doing File Save As... when in the source code window. Once the code has been modified you must compile/ make the project. If no errors messages are created (fingers crossed) you can now debug the project using the button to the right (green arrow with insect). E * 9 '% ** &*3 Ensure that USBSpYder08 is selected as the Hardware Model and the MC9S08QG8 as the Device. CodeWarrior will now erase and reprogram the device with the new project. If you go to the Byte2LED function and place a breakpoint at the first if statement by right clicking, CodeWarrior will halt the program when it reaches this point. In the Data window you will be able to see the value of Val and by single stepping through the function you can see the program flow in to the correct range. You can add more breakpoints and remove them by right clicking around other parts of the program. /* Positive Green */ if ((Val < PosA [SenMode] )&& (Val >= PosG [ SenMode] ) ) { //if (PosA [SenMode] > Val >= PosG [SenMode] ) { LEDMag [NegYLED + Dir] = (LEDOFF | LEDMax [NegYLED + Dir]); if (LEDMag [PosYLED + Dir] > LEDMax [ PosYLED + Dir]) { LEDMax [PosYLED + Dir] = LEDG; } LEDMag [PosYLED + Dir] = (LEDG | LEDMax [ PosYLED + Dir] ) ; /* Positive Amber */ if ((Val < PosR [SenMode] )&& (Val >= PosA [ SenMode] ) ) { //if (PosR [SenMode] > Val >= PosA [SenMode] ) { LEDMag [NegYLED + Dir] = (LEDOFF | LEDMax [NegYLED + Dir]); if (LEDMag [PosYLED + Dir] > LEDMax [ PosYLED + Dir]) { LEDMax [PosYLED + Dir] = LEDA; } LEDMag [PosYLED + Dir] = (LEDGA | LEDMax [ PosYLED + Dir] ) ; /* Positive Red */ if (Val >= PosR [SenMode] ) { LEDMag [NegYLED + Dir] = (LEDOFF | LEDMax [NegYLED + Dir]); LEDMag [PosYLED + Dir] = LEDGAR; LEDMax [PosYLED + Dir] = LEDR; /* Negative Green */ if ((Val < NegG [SenMode] )&& (Val >= NegA [ SenMode] ) ) { //if (NegG [SenMode] > Val >= NegA [SenMode] ) { LEDMag [PosYLED + Dir] = (LEDOFF | LEDMax [ PosYLED + Dir]); if (LEDMag [NegYLED + Dir] > LEDMax [NegYLED + Dir]) { LEDMax [NegYLED + Dir] = LEDG; } LEDMag [NegYLED + Dir] = (LEDG | LEDMax [NegYLED + Dir] ) ; /* Negative Amber */ if ((Val < NegA [SenMode] )&& (Val >= NegR [ SenMode] ) ) { //if (NegA [SenMode] > Val >= NegR [SenMode] ) { LEDMag [PosYLED + Dir] = (LEDOFF | LEDMax [ PosYLED + Dir]); if (LEDMag [NegYLED + Dir] > LEDMax [NegYLED + Dir]) { LEDMax [NegYLED + Dir] = LEDA; } LEDMag [NegYLED + Dir] = (LEDGA | LEDMax [NegYLED + Dir] ) ; /* Negative Red */ if (NegR [ SenMode] >= Val) { LEDMag [PosYLED + Dir] = (LEDOFF | LEDMax [ PosYLED + Dir]); LEDMag [NegYLED + Dir] = LEDGAR; LEDMax [NegYLED + Dir] = LEDR; } /* Neutral */ if ((Val < PosG [SenMode] )&& (Val > NegG [SenMode] ) ) { //if (PosG [SenMode] > Val > NegG [SenMode] ) { LEDMag [PosYLED + Dir] = (LEDOFF | LEDMax [ PosYLED + Dir] ) ; LEDMag [NegYLED + Dir] = (LEDOFF | LEDMax [NegYLED + Dir] ) ; } 50 elektor electronics - 4/2007 Figure 5. Populated boards prior to assembly with PCB spacers in the four comers. three LEDs in a row are lit. An onboard TS2950CT-3.3 regulator steps the bat- tery voltage down to 3.3 V for the cir- cuitry. Two pushbuttons are provid- ed: SI is the on/off control and S2 for sensitivity selection. Note the clever and economic method of reading the switches. The circuit is built on two circuit boards, which are stacked using 10-mm PCB spacers. Although the artwork for the boards is duly shown in Figures 4a and 4b, home etching and drilling is large- ly defeated by the low price of the set of ready-made boards with two sensor devices thrown in free of charge. Can’t beat that. Although we were tempted to design the whole thing in SMA, on second thoughts we decided to stick to a mi- crocontroller in a plain old PDIP 16- pin case, and dead common through- hole components on two 55X55 mm through-plated boards. The sensor carrier board is mounted in area ‘IC3’. Connector K2 is the 6-way BDM link to SpYder. The LED/switch board is mounted on top of the controller board using PCB spacers. The electrical connection with the controller board is made via a SIL pinheader. The assembled, fully work- ing prototype is shown in the introduc- tory photograph, the separate boards, in Figure 5. PROGRAMMING Believe it or not but we still get com- plaints from readers that Elektor projects do not work despite “a brand new micro bought from Xxyyzz Corp. plugged in at the right location and all solder work approved by a friend with 40 years experience in electronics”. Blank microcontrollers have to be pro- grammed before they can do anything that’s even remotely useful. Download the free archive file 060297- 11. zip from the Elektor website and unpack it in a suitably named direc- tory, e.g., Accelerometer’. Get SpYder, the accelerometer hard- ware and CodeWarrior connected up and running. In CodeWarrior IDE, fol- low File-^Open ‘Project’ and then nav- igate to the previously created direc- tory to locate Accel Proj.mcp’. Load the project, select the right device to program (MC9S08QG), compile, create the object code and program the mi- cro on the accelerometer control board through the BDM link. It’s a good exer- cise to get to know all aspects of the Freescale microcontroller environment, and nothing can go wrong really as you can always erase and have another go. Let us know how you get on - a topic will be found on the Elektor online Fo- rum to communicate with other users and the designers. PRACTICAL USE Keep the on/off button depressed until the LEDs come on. A running light(-ish) sequence will be performed allowing you to see that the micro is awake, run- ning firmware and all LEDs are func- tional. The instrument is then ready for use. Give the boards a few sudden motions with your hand to verify the g readout in four directions. The sensitivity switch may be pressed to select between three ranges, as follows: Sensitivity Min. Med. Max. Green on 0.45g 0.29g 0.15g Yellow on 0.80g 0.53g 0.27g Red on 1.15g 0.97g 0.39g The instrument is switched off by keep- ing the on/off pushbutton depressed until the LEDs start to do a crosshair imitation. A more detailed discussion of the op- eration of the accelerometer firmware is available in a separate document in- cluded in the free download with this article. The content is aimed at sea- soned programmers. CONCLUSION The SpYder Discovery Kit is a sur- prisingly flexible tool that does meet all the needs of low-budget develop- ments. It directly supports Freescale ’s 8-pin S08 PDIP devices with the abil- ity to extend pin count using the chip ‘target’ option. CodeWarrior is a very powerful tool and a bit daunting at first, but once you been shown where all the necessary buttons are you can get started very quickly. You are also sure to learn about other capabilities as you get used to the tool, with the help of the documents and training Freescale provide online. Further projects using SpYder are in the pipeline at Elektor. ( 060297 - 1 ) 4/2007 - elektor electronics 51 HANDS-ON MICROCONTROLLERS Programmer for Freescale 68HC(9)08 Guillaume Dupuis First steps in 8-bit development h-dikD^ t- Freescale is one of the leaders in the microprocessor and microcontroller market, backing up its products with a very comprehensive range of support products and high-performance development tools. For the price of a 74xx TTL 1C, there's something to delight anyone nostalgic for the 68HC1 1. Here's a programmer that lets you program Flash M68HC08 and 68HC908 family microcontrollers. t L1 ( There are several ranges in the Frees- cale micros, available in different pac- kages (DIL, SOIC, QFR LQFP). There are also hybrid solutions (RF, motor control, etc.) We’re going to take a look at this manu- facturer’s 8-bit products and suggest a suitable programmer. The architecture is inherited from the 68HC05, rewor- ked to be optimised with C (address modes, stack operations, conditional branching, and so on). Pure ASM programming is not recom- mended — it’s better to include the ASM code within the C program. The software suite supplied by Freescale is very powerful and saves a lot of valu- able time. THE FREESCALE RANGE Freescale offers ColdFire 32-bit micros intended for heavy-duty applications (Ethernet IDE, etc.). DSPs and 16-bit 68HC12 microcontrollers are also avai- lable, used mainly in automotive fields. In the 8-bit category, there are three ranges: 68HC908 This is the oldest range, so it’s no sur- prise that it includes a wide range of products. Programming is achieved by a monitor program present in ROM, via an RS-232 link. 68HCS908 The latest generation of micros, these have the greatest number of communi- cation ports (I 2 C, USB, Serial, LIN) and a higher operating frequency. A key feature is their BDM link. See Attack of the SpYder’ (Elektor March 2007) and ‘Two -Axis 2g Accelerometer’ (in this is- sue). Elektor, in exclusive cooperation with Freescale, sells the SpYder Disco- very Kit for just £ 6.45. 68RS08 An ultra-cheap microcontroller ($0.50 in quantities) available in 8- or 6-pin, with a slimmed-down instruction set, and many hardware functions emula- 52 elektor - 4/2007 Ifi.ll'! j WTW.yin \ % iCMil pi ■p 1 QT\i pl PI pTO 01 ^^ - '" 1 pill iaislgntn* lil- ted in software (e.g. timer, interrupts, and so on). CHOOSING A MICROCONTROLLER FROM THE 68HC908 RANGE In view of the number of versions avai- lable in a family like the 68HC908, befo- re choosing a microcontroller you need to start by defining the specification you want for it. Does it need to be able to communicate? have USB capability? have specialised outputs? It’s perhaps worth taking a quick look at the characteristics of each of these elements to see what the available op- tions are... The advantage of programming in C C is a language that makes it possible to carry out direct manipulations on the memory (pointer). It also makes it possible to forget about the assembler code specific to the micro. In terms of optimisation, C makes it possible to generate fast code, in particular thanks to the various address modes. It's always possible to insert chunks of ASM code so as to opti- mise a function in terms of execution speed — feel free to do so. Example: DDRA = OxFF; For ( PTA=0 ; PTA !=0xFF;PTA++ ) { PTA++ ; } Or : DDRA = OxFF; For ( PTA=0 ; PTA !=0xFF;PTA++ ) {_asm INC PTA; } Bit manipulation in C The ANSI C language does not allow manipulations on bits out of a byte. Fortunately, Frees- cale declares Byte types as a structure of eight characters. Example: x = PTA_PTA2; x = (PTA & 0x04) »2 ; These two expressions are equivalent; the first is more readable and stores the result in the stack, which avoids problems when using an interrupt, or recursive functions. Communication Does the application require specific communication ports? Synchronous or asynchronous serial ports are available, as well as an ADC or I 2 C interface. USB The USB port is currently widely used, and two of the families incorporate a USB1 controller. Specialised outputs In certain applications, you may have a requirement to control a 3-phase mo- tor. To do this, you need to use a spe- cialised IC. A 68HC908MR32 family exists that incorporates 6 PWM out- puts capable of working with an IGBT bridge. Frequency and dead time (rest time) can be adjusted independently for each bridge. In certain families, 20 mA current sour- ce outputs are provided — ideal for po- wering an LED, for example. There are also outputs that include in- ternal pull-up/-down resistors. Space requirement Each model is offered in different pac- kage types: DIR PSDIR LQFP This ex- plains why some families have only a limited number of I/Os. Memory Each family has several models with different sizes of Flash memory, vary- ing from 2 to 64 kB; they are generally pin-compatible. The development tools are restricted to 16 kB — to remove this restriction, you need to purchase a professional license. The number of read/write cycles is not infinite for Flash-type memory, which is why the 68HC908AB32 family has an EEPROM memory zone. Supply voltage Care is needed with the supply volta- ge: certain models operate at 1.8, 2.5, 4/2007 - elektor 53 HANDS-ON MICROCONTROLLERS D1 1N4004 SI K3 O- o- K2 SUB D9 R5 R9 H 680 IC3 C9 □ 9V1 +5V © 7805T 470|i Cl 7 lOOn C2 +5V © C4[ C== I 1|X 14 7 13 C5J □ in in V + C1 + © IC2 Cl- TIOUT T1IN T20UT T2IN RUN RIOUT R2IN R20UT C2+ MAX232 C2- V 16 11 10 12 15 C3 I +5V ■© OSC1 R3 i a o 00 i i CD i i D4 i 14 © L +5V R2 +5V © D2 i Cl 22p 1N4148 R1 H 1M H IC1.F (14) IC1 © IC1 = 74AC04N 13 XI I I IC1.D K1 1 3 5 7 9 11_ 13 15 O O O O J 8 10 12 14 16 X C6 TSp © +5V 060263 - 1 1 +5V © CO 00 tr Dl cc JP1 o o o 0 0 0 Figure 1. Programmer circuit diagram Note presence of quartz resonator option, which is not on the board. 3.3, or 5 V. The programmer we’re sug- gesting only works with 5 V micros. Special inputs Virtually all the micros incorporate a multiplexed ADC on several inputs; the resolution may change from one model to another (8- or 10 bit), as well as the acquisition time and the number of multiplexed inputs. Pulse counters can be produced using the timers. We suggest using these two models: 68HC908QY4A A micro intended for smaller applicati- ons, available in DIL format, this has: - Built-in oscillator - 4 kB of Flash - 2 16-bit timers - 6 10-bit ADCs - 13 I/Os 68HC908JL16 With a larger memory and serial and I 2 C communication ports, this has: - 16 kB of Flash - two 16-bit timers - 13 10-bit ADCs - 26 I/Os including ten LED drivers (20 mA) and eight interrupts. - Serial port and I 2 C PERIPHERALS COMMON TO THE 68HC908 FAMILY Flash memory This can be programmed in the course of the program, but the write routine and data to be written have to be in RAM. The maximum number of writes is 10,000, advertised data retention is 10 years. All the 68HC(S)08s have a charge pump to produce the voltage required to write to Flash memory. The Flash memory is read-protected by a security register, offering program security. Special peripherals All the micros have an LVI (Low Vol- tage Interrupt) that enables generation of an interrupt when the supply volta- ge drops, very useful for saving set- tings before the system shuts down. Certain micros have a KBI (KeyBoard Interrupt), the principle being to have a large number of outputs with inter- rupts for easy keyboard interfacing. Power saving All the micros have the WAIT instruc- tion that makes it possible to put the CPU into stand-by until an interrupt is received. One of the families puts all peripherals except the interrupt modu- le into standby; the stand-by current is virtually nothing (800 nA). THE MON08 INTERFACE In order to standardise the various ty- pes of programmers, it was decided to adopt common connectivity. The ma- nufacturer’s data gives the pin-outs used according to the family (see the examples given in the ‘K3 jumper set- ting’ box). BDM LINK This link can be found on the HCS908 categories and the RS908s, see the SpYder article mentioned above. Unlike the MON08 link, which uses a large number of I/Os, the BDM uses only three wires: ground, data, Vap (Flash memory). This interface communicates via the USB port, and circuits for programmers are available. They are, however, more complicated as a 68HC908 has to be programmed to manage the USB and the BDM link. You can find BDM pro- grammers for about £35 ($50) (through P&E micro, for example). COMING SOON In 2007, Freescale is expected to re- lease ColdFire VI, the principle being to use a 32-bit CPU with the 68HCS908 peripherals. The packages will be pin-compatible with their 8-bit equivalents. CIRCUIT DESCRIPTION Current microcontroller programmers have one thing in common: their elec- tronics are as simple as could be. As the circuit diagram in Figure 1 shows, we have opted for a tried and tested solution and an RS-232 interface. This 54 elektor - 4/2007 Components list Resistors Rl = 1MQ R2 = 1 OkQ R3,R5,R9 = 680D R6 / R7 / R8 = IkQ Capacitors C1,C6 = 22 pF C2-C5 = 1/iF 16V C9,C10 = 47jL/F 16V Cl 6, Cl 7 = lOOnF Semiconductors D1 = 1N4004 D2 = 1N4148 D3 = zener diode 9.1 V / 400mW D4 = LED, red, 5mm IC1 = 74AC04N IC2 = MAX232 (Maxim) IC3 = 7805 Miscellaneous: SI = momentary switch, push-to-make XI = 9. 8304MHz quartz crystal K1 = HE 10 header, 2 rows of 8 contacts K2 = 9-pin sub-D socket (female), PCB mount K3 = snap-off pinheader, 1 row of 2 con- tacts (Power) JP1 = snap-off pinheader, 2 rows of 3 contacts PCB, ref. 060263, from The PCBShop Figure 2. Track layout and component side overlay designed for this project. explains the presence of an old friend, the MAX232, IC2. At the bottom left of the circuit diagram is a traditional power supply based around a regula- tor IC, IC3, with the usual filtering and smoothing capacitors. LED D1 lights to indicate the presence of the sup- ply voltage. We might be wondering what on earth IC1 is for. Well, it’s a hex inverter, often used for clock genera- tion when there is no processor on the board. Here, it’s used to generate the clock frequency needed by the Mode Monitor to talk to the PC at the serial frequency the latter is expecting. The clock frequency can be obtained in two ways: by a combination of a crystal and capacitors plus a pair of inverters built in to IC1 (the solution we’ve cho- sen here); or by using a quartz resona- tor, OSC1 (shown here in grey). In the latter case, IC1, Rl, X, Cl, and C6 will not be fitted. The momentary push-to- make button SI is used for Reset. Header K1 is used to connect the pro- grammer to the target board. It accepts a 16- way cable, the other end of which will plug into an adaptor whose cha- racteristics depend on the unit being programmed (see heading ‘Program- ming support’ below). SERIAL LINK The programmer we suggest building uses an RS-232 serial link, which is modern computers and laptops don’t tend to have. Version 5.1 of the soft- ware does not work very well with USB RS-232 adaptors. One solution is to use version 3.1 of the development software. CONSTRUCTION Thanks to the printed circuit board shown in Figure 2, building this project should be within the grasp of most rea- ders, even beginners. You need to start by deciding which type of oscillator to use, either quartz crystal XI and as- sociated components, or the oscillator block OSC1 (see reference to this under the ‘Circuit description’ heading). The simplest solution is to fit a 14-pin soc- ket in the position marked for IC1, and then to plug into it either IC1 or OSC1 — the two components have the same pin-out, although the quartz oscilla- tor only has 4 pins. If the IC1 option is chosen, Rl, XI, Cl, and C6 must be fit- ted. If you choose the OSC1 approach, these four components are not fitted. As usual, start by fitting the passive components, resistors and capacitors, 4/2007 - elektor 55 HANDS-ON MICROCONTROLLERS Setting the jumpers on K3 The selection header K3 has to be configured according to the exact type of 68HC908 mi- crocontroller in use (see Figure 3). Two examples are given here, using either a JL1 6 or a QY4A. 68HC908 JL16 Communication Fosc PTB1 4.9152 1 9.8304 1 68HC908 QY4A Fosc PTA1 4.9152 1 9.8304 1 9,600 baud PTB2 0 0 PTB3 0 1 PTA2 0 0 Bit rate 4,800 baud 9,600 baud JL16 QY1A 1 2 1 2 NC O o GND NC O o NC O o RST NC O o NC o o IRQ NC O o NC o o MON4 = NC NC O o NC o o MON5 = PTBO(COM) NC O o NC o o MON6 = PTB1(1) NC o o OSC o o MON7 = PTB2(0) OSC o o VDD o o MON8 = PTB3(DIV) VDD o o 15 16 15 16 GND RST IRQ MON4 = PTAO(COM) MON5 = PTA4(0) MON6 = PTA1(1) MON7 = NC MON8 = NC 060263-12 Figure 3. MON08 connector pin-out if a QY4A or JL16 is being used. then the diodes (pay attention to the polarity of the polarised capacitors C2- C5, C9, CIO, and the diodes). There are three wire links in the circuit that must not be overlooked on penalty of crea- ting a hard to find fault in the circuit. Connection between the programmer and the support is via a 16- way ribbon cable. Then the IC sockets, crystal, regulator (lie it flat on the board) and the headers can be fitted. Pushbutton SI will be soldered directly to the pins provided for it, or linked to them via three leng- ths of flexible wire, if the programmer is to be fitted into an enclosure. TESTING THE PROGRAMMER When the switch is ‘ON’, the LED should light. Check the orientation of the diodes and electrolytic capacitors. Before fitting the ICs, check the ground and supply rails for proper continuity. Test the continuity of the program- mer tracks as far as the programming socket. There’s a tutorial application showing how to test the software element. PROGRAMMING SOCKET The I/Os used for programming differ between models, so a programming socket has to be built for each fami- ly. This socket is very easy to make, it only has an IC socket and a MON08 connector (16-pin). Using the MON08 pinout makes the socket compatible with all programmers, which is very useful when you use QFP or ShrinkDIP supports. Another approach uses an MON08 con- nector on the target board. PROGRAMMER CLOCK A 4.9152 or 9.8304 MHz clock can be used; changing jumpers allows the os- cillator frequency to be divided by two. It is also possible to set 4,800 baud instead of 9,600 baud in the software. It is preferable to use a quartz resona- tor, though they’re not always easy to find in the shops, hence it’s possible to fit a crystal with its oscillator circuit. PROGRAMMER VS. EMULATOR The principle of the programmer is to communicate with the HC908 to perform debugging and send the program. The I/Os used to perform these operations cannot be enabled during debugging. An emulator is a much more complex system that involves emulating these I/Os by another circuit, leaving all the I/Os usable during debugging, whence its higher price. DEVELOPMENT KIT Freescale offers kits comprising the programmer, USB connectivity and a microcontroller on the same board (e.g. the SpYder BDM). I/Os are avai- lable, along with a connector for de- moting’ them. These kits normally cost £ 25 ($ 50). DEBUG The software includes a debugger that lets you go through the instruc- tions one step at a time. The contents of each register can be displayed at any moment. However, you have to be careful not to disrupt the commu- nication between the micro and the programmer. PROGRAMMING PRINCIPLES To be programmed, the IC has to go into monitor mode; to achieve this, all you have to do is apply a voltage of 9 V, generated by zener diode D3, to the IRQ pin. Once in monitor mode, the trans- mission rate must be set using the jumpers. Commands are sent via the RS-232 link to carry out Flash memory operations, display register status, and also to run the program in step-by-step mode (In-Circuit-Debug) . APPLICATIONS So why would anyone want to start programming a microcontroller like the 68HC08 in the first place? Frees- cale is bound to have asked itself the same question and suggests numerous applications for the products in this fa- mily. We’ll mention just a few of them, to whet your appetite and make you want to have a go with these inexpen- 56 elektor - 4/2007 sive components, since the invest- ment required for such a programmer is negligible. Controlling a fan The aim is to adjust the rotational speed using a Hall-effect sensor, and also to limit the speed in the event of overheating. Wireless air-conditioning controller This application comprises two mo- dules: a base unit that controls the air-conditioner, and an IR remote to control it. The base unit is designed around a specialised micro used for management of LCD screens. Controlling high-power LEDS We also spotted a 68RS08 micro that can replace a traditional regulator cir- cuit. With a more powerful model, one could produce a so-called ‘industrial’ application, consisting of driving se- veral channels (RGB). Freescale also offers ZigBee and Bluetooth modu- les ideally suited to all sort of remote control. CONCLUSION A very comprehensive range of high- performance products, primarily inten- ded for industrial applications, and as a result, largely unknown to the lay- man. The choice of a make is no longer based on operating speed; a compari- son performed by the author demon- strates the optimisation of Freescale micros in the face of Microchip PICs. It can be seen that manufacturers are competing over the development suite — an important criterion in choosing a micro for an application. The advent of the new generation of Freescale Cold- Fire VI micros should open up some interesting possibilities. ( 060263 - 1 ) WEB LINKS www. frees cale .com www. softecmicro .com w ww. pemicro .com www.68hc08.net (French) https://www.freescale.com/webapp/ search/MainSEREjsp?SelectedAsset = Design%20Tools# 1694054 Search for CWX-HC08-SE (you have to be signed up to be able to download) Development support Via its CodeWarrior development environment, Freescale offers us three tools to speed up development time. So you need to start off by installing this IDE (Integrated Development Environment). Figure 4. Here's the first screen you'll see when developing a project based on the HC08. The CodeWarrior software is very user-friendly. Figure 5. Development using Processor Expert; on the left is the list of 'Beans' and on the right, the target micro. None This mode creates a project, initialising both the registers and the memory. It includes a li- brary defining the addresses of all the registers. Device Initialisation With this tool, the various registers are configured when the micro starts up. Everything is graphical and intuitive, it generates C code or ASM and the necessary functions (interrupts, etc.). This step is transparent for the user. Processor Expert This is the ultimate solution, the principle is that Beans are used throughout the project. Each Bean can be configured graphically, possesses functions, and can generate interrupts. You just tick the functions you are interested in. To use them, you just drag-and-drop them into place. The system performs very well and offers advanced settings. Functions can still be created in C or ASM. Sticklers will say that this mode is not optimised in terms of the size of the code. True, it isn't optimal — but is this really a problem when you have 1 6 kB of Flash to play with? On the other hand, anyone developing simple applications will be glad of the substantial time saving. For smaller projects, it is possible to create an application without even opening the documentation! 4/2007 - elektor 57 HANDS-ON PIC24F DESIGN SERIES eefing up the Thermometer Jan Buiting & Luc Lemmens, in cooperation with Microchip Technology and Labcenter Electronics In this final part of the series we combine the information from instalments 2 and 3 to create a system which provides much larger memory capability and therefore increased flexibility, potential for larger spoken messages, and, as we shall see, the option for multi-language support and a (much) larger vocabulary. 3m w J *.d rii H f * LtVa - B# - ■■■ ■ t- I S I •r ■ ■ p m m m m v ■ m mm m I PROTEUS d- Cl # I# Jk > ■ Ml ■- i L rif 4 MICROCHIP Figure 1. Demo4 for MPLAB / VSM packs together the things we learned in the two previous instalments. We’re sure you can get a speaking thermometer from Highstreet electron- ics outlets that costs far less than the Explorer- 16 design we’ve demonstrat- ed on these pages and on our website. Sadly, the devices of far-eastern origin are not only of doubtful construction standards, but more importantly they teach you nothing about microcontrol- ler programming and simulation. On a positive note though, funny bits of Babelfish ‘Engrish’ may be gleaned from the user manuals that typically come with these low-cost ‘black box engineering’ products. Regarding the hardware aspect of this series, our Explorer- 16 Value Pack also proved popular with the first batch of 250 pieces selling out in less than three weeks after publication of Part 2. THAT CRYPTO PUZZLE! The cryptographic puzzle we present- ed last month has drawn a very good response and lots of readers enjoyed cracking the secret agent’s code. The enthusiasm was such that correct solu- tions were reported on our forum less than a day after the article instalment and the free download were available from our websites! As it turned out, it was unnecessary for us to post clues to solving the puzzle. To solve the puzzle, readers had to ex- plore the contents of CFIMAGE.BIN using a hex editor and find the direc- tory table and/or possibly the text it- self of ENCODE. C. This revealed the encryption algorithm. It was then a fairly simple task to modify the code in DEM03.C to read, decode and dis- play SECRET.DAT within the simulated environment. 58 elektor electronics - 4/2007 The algorithm itself was a simple rolling XOR mask. The operation having been set up as symmetrical, the same loop can be used for both encoding and decoding! Hence no specialist cryp- tography skills (or investments) were required to actually solve the puzzle. Free, fun and challenging! Once decoded, readers found the email address ‘elektor_competition@micro- chip.com’ to send his/her details to plus other terms and conditions relat- ed to the competition. The programs that went into making the ‘secret agent’ puzzle are now avail- able as a free download called Crypto, zip from the Explorer- 16 project page. NOT TOO EZ There are complexities to grapple with in getting a multi-language system to function using the vocabulary building method which has been implemented for the sake of structural programming and file use. But then, Explorer- 16 is a microcontroller challenge in itself, es- pecially once you are beyond the dem- os, so let’s tackle the complexities. English, Dutch and German being Ger- manic languages, they share common features in respect of accentuation, sentence construction and morphology. French being a Romance language is a little more tricky as it requires more logical constructs in the source code to be developed but surprisingly is more efficient in terms of total words required. CONSTRAINTS To help with resource usage across the system, individual files have been limi- ted to 4 k on the flash (CF card) me- dia (see Part 3). This can obviously be extended if larger phrases are record- ed as a whole, however the buffering on the MCU side would become more complex. For ease of understanding, the buffering method has been kept simple since we use small sound bites of <4 k for the vocabulary. This pro- vides a sensible file size relative to available RAM on the MCU and mini- mises code complexity. This also eases streaming of data from the flash media. Where more RAM is available, larger file sizes can be used, or buffering the data. Also, the system should ensure the file is left open on the card. The format for the overall vocabulary is similar to that of the original Eng- lish language variant, but uses a lan- guage prefix to allow the correct file to be selected. As an example, DE100.dat would be the German language file for one hundred. When constructing your sound samples and saving them, this requirement should be noted as it ef- fectively limits the short file name to six rather than eight characters. MPLAB/VSM SIMULATION #4 For this month’s final instalment, Mi- crochip and Labcenter have created yet another free demo for you to run on your PC — . Like the previous three demos, it works even if you do not ac- tually have an Explorer- 16 Value Pack. Demo4.zip to be released as a free download with this magazine article again shows the respective products PIC24F and Proteus VSM interlocking seamlessly. Demo4 is shown in action in the screendump in Figure 1. For the simulation, an additional DIP switch has been added to the design file which does not exist on the Ex- plorer- 16 hardware! This is added as an aid to simulation and, ultimately, if a PCB were being generated from the schematic/PCB design and simulation capability from within the same design file. Add to this the debug capability afforded by the MPLAB and Proteus VSM combination and we have a very powerful tool indeed. The DIP switches are added to allow the batch mode simulation to occur and hence the speech output to be generat- ed. Since batch mode is a mixed mode simulation the user has no ability to in- put and perform such operations as a button press. Therefore some addition- al stimulus is needed to allow the code to interpret the desired user operation. This method has already been put to use in the original Explorer- 16 speech design in Demo2 which uses a stimulus input to simulate pressing the S4 but- ton to initiate sampling the ADC and generation of the relevant output. In much the same way the DIP switch is used to override the function of the S3- S6 buttons and provide the language selection. The default language being English, it is however left as an exer- cise for the user if they wish to change the default state. Figure 2. PICtail CF/MMC board and a sample of a Sandisk SD flash card (not included in AC164122). simulation files, the DIP switch can be excluded from the board, in much the same way as the virtual DVM would also need to be excluded. This is one of the powerful features of the VSM en- vironment since it allows for this dual 4/2007 - elektor electronics 59 HANDS-ON PIC24F DESIGN SERIES IN HARDWARE... If you wish to try the operation in hard- ware, you need to plug in both the PIC- tail Audio Plus board and the CF Card board (on the Explorer-16 develop- ment board. The latter is available from Microchip Direct as item no. AC 164122 (PICTail board for SD & MMC cards), see Figure 2. You will need to solder in the second PICtail bus connector on the dev board. The connector is avail- able from www.samtec.com, or from Digikey, part number MEC1-160-02-S- D-A. The complete hardware setup is pictured in Figure 3. By the way, the right-angle pinheader fitted on Micro- chip PICtail daughterboards is to allow them to work with 18F devices on the standard PICtail board. Here at Elektor we decided to cut off the pins because they are dangerously close to the JTAG connector on the Explorer- 16 develop- ment board. The card edge connector on the PICtail CF/MMC board fits the blank section in either the second or third segment of the high-density bus connector on the dev board. This is to allow it to operate with either SPI1 or SPI2. The FAT software uses SPI1. The language would be selected by the relevant key press whilst a reset is performed. This should then keep the desired language state until a differ- ent language option is required. Again, this could be modified to make use of the LCD or Serial Terminal Feature. In this case however we have opted for a simplified operation to prove the concept. A GUIDE TO CREATING YOUR OWN SOUND FILES i C RYPTO PUZZLE HOW THEY DID IT Elektor readers are smart readers. Here's how one of them - who shall remain anonymous - solved the I Explorer-16 Crypto Puzzle. Mind you, it's just one of many approaches to I cracking the code. We were impressed. ■ 1 . Wrote the bin file of the CF image onto an SD card (no CF cards available here) 2. Read the SDcard using card reader, then I noticed two files: ENCODE. C and SECRET.DAT 3. Programmed this: // Store the character into the buffer using a simple // xor encryption scheme ■ buf fer [pos++] = c A mask; mask++; 4. Decrypt is done basically the same way as encode buf fer [pos++] = c A mask; mask++; 5. Applied Winhex and selected the content of secret.dat. Saved as a C array, see xorc.txt next i used C+ + paste the array using a for loop unsigned char data [1130] = { | 0x56, 0x67, 0x6F, 0x68, 0x25, 0x62, 0x68, 0x66, 0x6C, 0x2B, 0x06, 0x06, 0x20, 0x04, 0x56, 0x7F, 0x64, outFile = f open ( "c : \xor . txt" , "w+b") ; | for (i =0; i < 1130; i++) { fputc ( (data [i] A (i+1) ) , outFile) ; } fclose (outFile) ; | Explorer board used to combine the databanks to fit the large array (1 1 30), then connect an ■ SDcard connector to the dspic. First read the file using fopen secret.dat, then next overwrite this file on the SDcard with the converted array contents using fwrite character or similar (basically the same as fputc does), fopen secret.dat. Read the contents to array using fread character | for (i =0; i < 1130; i++) { ■ data [ i ] =f read; //asuming fread will point to next character each time when calling } I fclose ■ fopen secret.dat for (i =0; i < 1130; i++) { fputc ( (data [i] A (i+1) ) ; ■ } | fclose; The solution took some time to find because in my case the workaround with sdcard.c is needed (I still have limited experience using Proteus). Well done! The step-by-step action of creating the sound files for the speaking thermom- eter is complex as well as specialised. That’s why we decided to outline it in a free supplementary article that may be found on the Explorer-16 project page on the Elektor website. Look in the Free Downloads Area, section Part 4. The pdf document is well worth ob- taining for budding programmers in- terested in sound sampling, imitating Chemical Brothers and what have u. It should be noted that for the exter- nal media cards we can omit the step performed with the MPFS utility. In- stead, the FATUtil utility, described in another free download with this month’s instalment, will be used to add the compressed ADPCM (.dat) files to the binary image of the card in the Proteus design folder. In cases where You have successfully deciphered the secret message stored on the compact flash card. A prize will be awarded for the first 12 correct solutions. To enter the competition you must email elektor competition@microchip . com with the following a) A brief description of the method you used to extract the secret message, including any code you used. b) Your contact details include name, physical address telephone number and email address. Entered solutions will be judged to be valid or otherwise at the sole discretion of Microchip Technology. All solutions will be acknowledged with an indication of whether they were valid or not, and whether you were among the first 12 correct entries. By entering the competition you agree that you may be contacted by employees of Elektor, Microchip or Labcenter Electronics for research and marketing purposes. However, you may be assured that your details will NOT be passed to any other parties. You also agree that your solution may be published by Elektor either in print on their Website. 60 elektor electronics - 4/2007 the files are added to an actual media card for use with the hardware, you simply copy the .dat files to the card. The limitation imposed is that all files must be in the root directory on the media card as the present demo code has no support implemented for folder navigation. Also, it should be duly noted that the FAT 16 code is released in beta format to help support these articles and may be subject to future changes. At the time of writing, the code is not official- ly supported by the standard Micro- chip support network, which goes to show Elektor once again being in the forefront of microcontroller technology. Once the relevant code is released as a full library, the normal support will be fully available. In the interim period, support or questions can be funnelled via the Explorer- 16 topic on the Elektor forum. LOOSE ENDS A few ‘niggling details need to go in print specially for those who do not fol- low the updates and messages pub- lished on the Explorer- 16 project page, and the Elektor forum. • When redeeming the C30 discount Coupon in the Explorer- 16 Value Pack via www.microchipdirect.com (select your national flag), near the end of the ordering procedure for C30 Com- piler you are asked to enter a Voucher Reference Number. Omit ‘ELEKTOR’ and the final digit. • The centre pin of the supply con- nector on the Explorer- 16 dev board is the positive supply (9-15 VDC unregulated). • Labcenter have special offers for a number of their simulation modules for Proteus VSM, see www. labcenter. co.uk/products/elektoroffer.htm. • Spare PIC24F/H and dsPIC33 PIMs are available at www.microchipdi- rect.com (select your national flag). • There is no way you can run the demos and simulations on a ZX81 or a Windows 98 PC. CONCLUSION Hopefully this four-instalment article has provided an insight into some of the capabilities and tasks which can be achieved on the PIC24 micro. As already intimated in previous instal- ments, there is much more to offer. The series has also highlighted an excellent combined tool package in MPLAB and Proteus VSM. This has allowed us to provide high functionality demonstra- Figure 3. Audio Plus board and CF/MMC board plugged on to the PICtail bus of the Explorer-1 6 development board. tions of a simulated microcontroller system at zero cost to the user. Look out for more from this winning combi- nation in the future. Finally, we would like to express our thanks to several experts at Microchip Technology and Labcenter Electronics who have burned their midnight oil to bring you this unique series of articles with a CD-ROM and lots of free soft- ware thrown in ‘for your pleasure’. (060280-IV) Where not indicated, trademarks (™) and co- pyrights (©) of Microchip Technology acknow- ledged for their PIC, dsPIC, MPLAB products. Project news, free downloads & updates for this are available from the Explorer-1 6 project page at www.elektor-electronics.co.uk/explorer-l 6 and the 'Explorer- 1 6' topic on the Forum at http://www.elektor-electronics.co.uk/default. aspx?tabid = 29&view=topics&forumid = 22 Explorer- 1 6 Value Pack! I Elektor's Explorer-16 Value Pack consists of four components packaged together in a single box: 1. Explorer-16 Demo Board 2. PIC Kit 2 Starter Kit 3. Audio PICtail Plus daughterboard 4. MPLAB C30 20% Discount Voucher The pack is available for £ 722.90 (€ 1 79.00 / US$ 232.50) from the Elektor SHOF) see www.elektor-electronics.co.uk or the SHOP pages in this issue. Labcenter Electronics have listed several Proteus VSM offers for Elektor readers following the Explorer-16 article series. Have a look at www.labcenter.co.uk/products/elektoroffer.htm. 4/2007 - elektor electronics 61 HANDS-ON MODDING & TWEAKING Michael Gaus & Thijs Beckers The market for electronic gadgets thrives like never before. Can we still make something nice ourselves? Yes of course! In this month's Modding & Tweaking article we use a mobile phone display to dynamically show images. Mobile, illuminated and very eye-catching as a name badge or case mod. L Jill rvm t’4 if i w- L Figure 2. The C60 display from Siemens. There is no way you could make this yourself for just over a fiver... The standard pin or clip-on badges are well-known by now. They are almost a necessary evil when visiting ex- hibitions and the like. But why not make it into something nice? That is how the following project was born. Using an LCD from an older model mobile phone this is certain to be a success. ANY COLOURS The displays in mobile phones are getting better all the time. In the past there was only black and white, these days the colours seem to jump off the screen. We could of course use the latest and greatest display, but that will unfortunately hurt our wallet a lot. A little bit less will work just as well, for example the display from a Siemens C60 we got from E-bay for 7 quid or so (Figure 2). That's more like it! The display with the riveting part number LM15GFNZ07 has a resolution of 101 by 80 pixels and can display 4096 colours. After a little experimenting we discovered that the LCD operates with an SPI bus. Once we knew this, we realised we could use an AVR microcontroller type ATMega8, to drive the display. The only thing that re- mained to be provided was some sort of medium to store the pictures to be displayed. For this we decided to use an SD memory card (MMC can also be used; it has the same dimensions and pinout). The AVR micro reads the fi- les from the memory card and shows them on the display. Multiple bitmaps are shown one after the other in a slide show. The amount of time that each image is displayed is adjustable. HEART OF SILICON In the schematic (Figure 1) we see that only eight discre- te components are used. The other two components are ICs. The heart of the circuit is the AVR-microcontroller of course, its program memory of 4096 words is for 99.8% full. There are only 14 bytes spare. For a future model we keep the pin-compatible ATMegal 68 already in mind. This one is via the reset output also easy to debug. To regulate and condition the power supply voltage for the microcontroller we use a low-drop voltage regulator from Analog Devices, the ADP 3303. Flint: using the sam- ples-program from Analog Devices you can have this 1C delivered to your door at no cost. The LEDs for the LCD backlight are connected directly to the 4.5 V input vol- tage via R1 and R2. 62 elektor - 4/2007 Mobile phone LCD with slide show IC2 V+ Cl = lOOn o 8 20 18 21 GND 19 22 RESET (SCK)PB5 (MISO)PB4 (MOSI)PB3 XTAL2 (SS)PB2 (OCI)PBI XTAL1 (ICP)PBO AREF (ADC5)PC5 AVCC (ADC4)PC4 AGND (ADC3)PC3 (ADC2)PC2 VCC (ADCI)PCI GND (ADCO)PCO (AIN1)PD7 VCC2 (AIN0)PD6 GND2 (T1)PD5 (T0)PD4 (INT1)PD3 ADC6 (INT0)PD2 ADC7 (TXD)PDI (RXD)PDO ATMEGA8 TQFP c n Q o v Q M-ZOJZO 0 ,QO>OOQ A 1 I I I I I I goooooo co co co co co co CM 0000000 vcc ©- 17 16 15 14 13 12 28 27 26 25 24 23 11 10 32 31 30 CM 00 LO CD HI o o <7) I Q ( 7 ) GND 1. Hsi r GND VCC © QTY o VCC © R5 HZ J1X R1 1500 Z HZZI V+ R2 1500 8 to to to k) to to o o 10 to to LCD GND VCC = 3,0 V V+ = 4,5 V /LCD_CS /LCD_RESET LCDRS LCD_CLK LCDDATA LCDVCC LCDGND LCD_LED1_A LCD_LED_K LCD LED2 A LM15SGFNZ07 075043 - 1 1 Figure 2. The C60 display from Siemens. There is no way you could make this yourself for just over a fiver... Figure 3. Our prototype. The display is fitted on the other side. Figure 4. Wires with reducing lengths make threading easier. 4/2007 - elektor 63 HANDS-ON MODDING & TWEAKING Figure 5. he LCD certainly works well. n \W\\ «Vfc*d p r r BuyfiJFluli mHm uc*-^ “?J| tsw* ■UtrptfnC fKHITE r Hhf i l*rh ^Kton 1 ■ >--:-r-j; [■«■ ;pr kM - 1 i ,-]ii Gt [I'tfGlIk r p«f fkA **413 xi-r ^.=- jarna foqh. fe Fa* Pkrh mten -fc-lKJ -*h E>- dm »>ifi :-WC0C J=ODT’ r (Mfffi-W* ***■ - £ j r* ^ E>IL-[MJ] iUf»! ~J 4 V jk^VH^ V ^MlVr >: v-*r n**t r M AC $K 1 MHt ta* tCK •* 0 *. pafitLrfOm M.Hrii: A riwRCU* twrir ^tnr^Plm |I^FL -OBI «WT-DI f" TA At Die I UMp 5i*"*£i HW S ft ■ M -■! [U SfL^ttl *117*1 r fr« nc *uj r . in * ick + Dk. c«rL-fflin wtj* r h n: Die. JNHt sw«« mbIek-im. id jeweia »ft-oi r H. AC Die ^ MHz S'ir-iC fcpw 4 Cft * M m gO-llCL^a wr-l r w Fir uu^ i mk- -ii*n^i l™ t lp - u »j, ni-:n -mi i dit-k r fri At Ok: 4 MHt -rr- b Cr - ■ pn |D S£Wtfl 1 tllTJl r *■ AC Ok 1 HHf. fMp tmn « CK » u ™|«BL-»n tUT-t r 4* Rt d* ?MHt M- &C* * P ta. pcKsarfipp anmc r*i. AtDic tUb iHHf taADC -ipw la stL^dPS^Un PhRCDw #fc*k U*w m* iff I U « CO"Ml>PinBir>l r U PGflX ■ « MHt *f tt|»ElHN r b ht Ox - 0 3Wl SMwIm ?BtX. - j ms. lOStL-tm r f J BC(ht ■ PlfcWk 1— sna +ciJiN. F*£ft4T rb PCftie - CiiM-lf Wta>t£K>4talftm4lll w < s '■' ja \ '.r f Figure 6. The fusebits in the AVR micro must be set correctly of course. L'/n (£^>rpvqmk >..‘i 1 ^%k^4hwn lW>1 CbM Cl I Lw-nd iMfr auni a hA tit 1 To get the circuit to work it is of course necessary to pro- gram the AVR. The source code in HEX-format can be downloaded from the Elektor Electronics website (see month of publication). On the SD or MMC card there has to be a configuration file indicating how long each pic- ture is to be displayed. Although the file is just a text file containing only the time in milliseconds, we have zipped it together with the HEX file for convenience. PRELIMINARY WORK The BMP files need to conform to a few requirements. Firstly, the dimensions: 101 pixels horizontal and 80 ver- tical. The colour depth has to be 1 6.7 million. In this way, every bitmap file, including the header, is exactly 24,374 bytes in size. The microcontroller takes the first four bits of each of the colours (red, green and blue). The image has to be stored upside down (i.e., mirror it horizontally first). The reason for this is the way a BMP is stored, namely 'from bottom to top'. By storing the picture reversed ('normal') the task of reading the file and dis- playing it by the AVR has been made much easier. The memory card has to be formatted in FAT-1 6 format. This can be done with a standard card reader. This for- mat limits the number of files that can be stored in the root directory to 5 1 2. Taking into account the config file and since no directory structure is supported a maximum of 51 1 pictures can be stored on the memory card. This is sufficient for the time being. The files are also not allowed to be fragmented. By first formatting the card and then copying all the BMP files in one go you can prevent this from happening. The images are displayed in the same order as they are stored on the SD card. The file name has to be in DOS 8.3 format. Long file names are not supported. CONSTRUCTION WORK Because the badge was going to be worn by colleagues at the E mbedded 2007 exhibition, we quickly designed a small PCB (Figure 3). The design of a proper PCB we leave up to you. When mounting the parts it is best to start with the AT- Mega8. Followed by the memory card holder after which the other parts can be fitted. Note the wire link which is shown on the schematic as R5. To attach the display it is easiest to first connect copper wires to it (see Figure 4). Cut the wires to different leng- ths so that they are easier to thread through the holes in the board. A small piece of double-sided tape holds the display in place on the front of the circuit board (Figure 5). Seeing that the circuit is to be worn as a badge, the po- wer supply consists of three batteries, which brings the power supply voltage to 4.5 V. The regulator turns that into 3 V for the processor. Once we have checked this, we can program the AVR micro. For this we use an ISP (In System Programming). This can be done in one of two ways: 1 . solder wires to the programming pins of the ATMega8 (MOSI, MISO, SCK, RESET, VCC and GND) and con- nect these with the corresponding pins of an AVR-ISP from Atmel; 2. make an SD adapter (see inset). Before programming, pay careful attention to the fuse bit setting (see Figure 6). 64 elektor - 4/2007 SD programming adapter A Transflash-to-SD adapter can easily be modified into an SD programming adapter. The contact pins are simply connected to the (6-way) plug of the At- mel AVR-ISP In-System Programmer, for example. To do this, carefully cut the adapter open so that the connecting pins for the Transflash card holder are accessible. Then connect the pins to a small PCB into which the ISP header is soldered. This PCB can be glued to the adapter. The correct connections are: SD Dl MOSI SD DO MISO SD CLK SCK SD VCC VCC SD GND^GND A test clip is connected to the reset pin. This can then be easily connected to the reset pin of the AT- Mega8 (or R3). You could make a small wire loop at the appropriate side of R3 to make this easier. The end product is something to behold! It is of course not necessary to use the display just as a name tag. It could also be used as an original case mod. For the really smart guys among you who thought of making a movie with 51 1 pictures, each displayed for 50 ms, we have bad news. The AVR is unfortunately not fast enough for this. ( 075043 - 1 ) Figure 7. The AVR micro generates a test image when the circuit is turned on for the first time. PRACTICAL WORK It's a good idea to test the circuit first without an SD card. By the way, when connecting the battery observe the correct polarity because there is no reverse-polarity protection. After switching on, the display shows four coloured bars, white, red, green and blue, the firmware version and the text 'No SD card' (Figure 7). If this is all working pro- perly then disconnect the batteries and insert the SD card (never insert or remove the SD card when the circuit is powered). Once the battery is reconnected, the four co- loured bars appear again for a short time, after which the slide show starts. To adjust the display contrast, SI has to be held depres- sed while the power is turned on. A menu will appear where you can select the contrast adjustment (Figure 8). With a brief push on SI (< 500 ms) you can scroll throu- gh the menu. To select an item SI needs to be pushed for longer than 500 ms. Figure 8. The AVR micro even controls the contrast adjustment. 4/2007 - elektor 65 HANDS-ON CLOCKS Martien Schot Way back in 1971 the Dutch edition of Elektor published a 'Hebinck Clock'. That original article was in two parts and was nearly ten pages long in total. These days we can do the same and more with fewer parts — this 'very simple dock' comprises about 20 parts while its 35 year older counterpart required nearly 100. Electronics moves with the times. Over the years the options available change and there are ever different solutions to realising a certain concept. It is often the case that the amount of integra- tion is increased as much as is possi- ble. A good example is this Very Sim- ple Clock. This clock is based on the Hebinck-clock that was published on the May and June 1971 issues of Ele- ktor Netherlands (the design was nev- er published in the English-language edition, which first appeared in 1975). Old times The Hebinck clock back then was built with TTL logic combined with transis- tors. The time was indicated with lit- tle bicycle light bulbs. For many this was the introduction to integrated TTL technology. Now, more than 35 years later, we present the same way of indi- cating the time, but using modern elec- tronics instead. The Very Simple Clock obtains its name from the simplicity of the circuit. Notwithstanding the DCF77 receiver module, the number of components is very modest. DCF77 is a timecode transmitter near Frankfurt in Germany. The station transmits CET timecode signals at 77.5 kHz and has a range of about 2,000 km. Returning to the present project, the complexity in the year 2006 is no longer in hardware but in the software. Simple The schematic (Figure 1) consists of the power supply, the microcontroller and the display. The power supply is 8 V AC. This is easily obtained from a simple mains power- adaptor. This volt- age, connected to Kl, is then rectified (Bl) and subsequently regulated with a 7805 (IC2). We used a PIC16F628 for the microcontroller. This is clocked at 16 MHz with a quartz crystal (XI). For the display we will now obviously use LEDs, instead of the bicycle light bulbs. The choice of colour is up to you, but selecting different coloured LEDs for the hours and minutes makes read- ing the clock easier. Use LEDs with a high light output so that it is still easy to read the clock during the day in bright sunlight. The purpose of resis- tors R1 through R8 is to limit the cur- rent. Resistor R9 serves as the pull-up resistor for the open-collector output of the DCF77 receiver module. 66 elektor electronics - 4/2007 The component overlay in Figure 2 shows that LEDs D1 through D12 are intended to indicate the minutes. D13 to D24 indicate the hours. Fit the microcontroller in a socket, so that it is much easier to carry out a soft- ware-update, should the need arise. If you place the LEDs a little high- er above the board it will be easier to position them on an optional front panel with could also have hour and minute numerals. The ‘resolution’ of the clock with LEDs D1 to D24 amounts to 5 minutes. LEDs D25 to D28 are intended to indicate the minutes in between. The number of LEDs that are lit indicate the number of minutes that have to be added to the main ‘dial’. As an example, Figure 3 shows 10:12. The DCF function ensures that the clock always indicates the cor- rect time. Daylight Saving time is auto- matically corrected for. Operation The Very Simple Clock is based mostly on software. This consists of an inter- rupt routine and a main program run- ning in an endless loop (for the source code see www.elektor.com). The com- plete flowchart for the program is also available as a free download. R9 + 0 Od 1 +5V © 17 18 "~1 ^ToOn 14 IC2 © MCLR RB7 IC1 RB6 RA4 RB5 RB4 RAO RB3 PIC16F628 RA1 RB2 RA2 RBI RA3 RB0 OSC1 OSC2 16 XI I I C2 22 P^P 16MHz 15 • Cl 22p C5 7805 B40C1500 lOOn +5V 1 > < C6 ■ 1 _ C4 =1 lOOn 47 n 16V 13 12 11 10 R1 H. ^ A, "A, Dl j D4 ^ D8| R2 5 min 45 min 1 min R3 10 min 50 min 2 min R4 15 min 55 min 3 min R5 20 min 0 min ^ D9 ] Dip} Dll | D12| D13| D14| D15| D16 I R6 25 min 1 h R7 30 min 2 h R8 35 min 3 h 40 min 4 h 5 h 6 h 7 h 8 h 9h lOh 11 h 12 h D17| D18 | D19| D20 } D21 \ D22 } D23 } D24 | 4 min ^ ^ ^ ^ D25 \ D26 \ D27 \ D28 | 060350-11 Figure 1. The schematic of the Very Simple Clock clearly shows the origin of its name. | COMPONENTS LIST | Resistors . R1-R8=100Q . - R9 = 1 OkD . Capacitors I Cl ,C2 = 22pF | I C3 = 220jlxF 25V radial ( I C4 = 47|nF 16V radial I I C5,C6,C7 = lOOnF I I Semiconductors D1-D24 = LED, 5mm, high intensity I D25-D28 = LED, 3mm, high intensity | I B1 = B40C1 500R (round case ) (40V | | piv, 1 .5A) | | IC1 = PIC1 6F628-20/P, programmed, | | order code 060350-41 | | IC2 = 7805 | | Miscellaneous | | DCF receiver module, Conrad Electron- | | ics # 6411 38. I I K1 = 2-way PCB terminal block, lead I I pitch 5mm I I XI = 1 6MHz quartz crystal I I PCB, ref. 060350-1 from ThePCBShop I I PIC source and hex code files, free I I download # 060350-1 1 from I www. e I e kto r. co m o 060295-1 r-sesoao ioi>l9lEI (O) / DIO D21 D23 D22 o[ © © © © *2£d20 moo.iot>l9l9.www D25 D2 D14 XI © © © © © © © © X 1 — 1 C2 . •P® oil© 015 1 R9 1© T oo\\ r©C7 © O © R1 © © © © R8 © s R2 © © © © R7 • © R3 © Q O © R6 © R4 © Q O © R5 © D16 D3 D4 D17 Figure 2. The component overlay for the double-sided PCB for this clock. The PCB layouts can be downloaded free from the Elektor Electronics website. 4/2007 - elektor electronics 67 HANDS-ON CLOCKS The interrupt routine deals with the following tasks: • counting the rising edges from the DCF77 receiver module for the fault indication; • the fault indication itself; • the internal binary clock; • decoding the time information so that the correct LEDs can be turned on and • multiplexing the LED outputs. The main program is responsible for the following tasks: • copying the binary code to the in- ternal clock if the parity is correct and 59 seconds have been counted in the past minute; • read the DCF77 information (BCD code and parity); • checking the parity and of course • converting the received BCD code to binary Every 2 ms an interrupt is generated by TmrO. This is the source for the bi- nary registers for the seconds, minutes and hours of the internal clock. The clock will therefore also work in the absence of a DCF77 signal (up to one hour). When a valid signal has been re- ceived, the registers for hours and min- utes are filled with the DCF77 time and the seconds register is set to zero. Usage For the DCF77 receiver a simple im- plementation from Conrad Electronics was selected. With this module we use the non-inverting output (pin 3 that is). The power supply is connected to pins 1 and 2. For more information we re- fer you to the datasheet from Conrad Electronics. After the power supply is turned on, all the LEDs will light one by one. This lets you check that all LEDs are con- nected properly and that the PCB has been assembled correctly. LEDs D25 to D28 can be used to find the optimum orientation of the antenna for the DCF- module. D25 and D27 light up when a DCF77 signal is received, D26 and D28 are on when the signal has stopped. This means that the LEDs have to flash in pairs for a good reception. The fre- quency is 1 Hz. After a maximum of 1 minute and 59 seconds the clock will jump to the correct time. If this doesn’t happen then the antenna is not orient- ed correctly or the signal strength of DCF77 is too low. In addition, the clock checks the par- ity of the minutes and hours, and if 59 DCF77 seconds pulses were received in one minute. If over a period of one hour not a single cor- rect minute was received, the clock will switch back to the fault indication (LEDs D25 to D28 will flash again). ( 060350 - 1 ) j DCF77 ■ DCF77 is a timecode transmitter operating at 77.5 kHz in the long-wave band (VLF). DCF is ■ the callsign for this transmitter; the letters mean Deutschland (D), long-wave (C) and Frank- furt (F). The number 77 indicates the frequency of 77.5 kHz at which the transmitter broad- I casts. The transmitter is actually in Mainflingen near Frankfurt and transmits a complete I timecode/date string every minute. It can be received over an area with a radius of about | 2000 km using fairly basic antennas. Figure 3. The time is now 10:12 according to the Very Simple Clock. 68 elektor electronics - 4/2007 Your price conscious PCB su CERDU 1 TS On Int L'licu calcj la Ihon Online unfr ring omirw wrier tf k in# online 14/24H .rnd ?;?a [Ml, r> ..letfl Cftnrsi I ul! 4-4* MHB 16? Oft 1 '- VI£IT US AT NEPCOf* BOOTH ISO www.etjroclt'cuit s*com ¥«H AM J | A !■«■ LArl? p4w lOn ilAmnnn - pofti.nj for %t J irui k ir ci banrci - up \ u S lay en -fratn 1 to 10OT pNh.^ * from 3 vtorkifbg d«syi# onwardi - pacl.n^i with more □£; ti onv - up TO R lAy ftT* -from 1 qp 1QM -from 3 wftrlilnd days p u'ii i ho.i->alr (nut ihaihcni^D lip 14 1Si4^ri> from J, plaM pflMVIinlB from 3 wioMjiog di^s onwnrrH ClmScon 5 USB Scon Tool • Diagnose any car with EOBD • Based on the ELM327 1C • Supports all EOBD and OBD-II protocols ✓ ISO 1 5765-4 (CAN) S ISO 1 4230-4 (Keyword 2000) s IS09 141-2 s JI850 VPW s JI850 PWM 9600 or 38400 baud Supported by more software than any other OBD interface Inexpensive Full Speed USB l.l Automatic protocol detection Package includes cables, software CD, and Quick Start Guide Buy from your local UK distributors! www.ElmScan5.com/elektor Take out a free subscription to E-weekly now Do you want to stay up to date with electronics and computer technology? Always looking for useful hints, tips and interesting offers? Subscribe now to E-weekly, the free Elektor Electronics Newsletter. Your benefits: * The latest news on electronics in your own mailbox each friday *■ Free access to the News Archive on the Elektor website * You’re authorized to post replies and new topics in our forum 4/2007 - elektor electronics 69 HANDS-ON POWER SUPPLIES A Simple Mains Inverter 12 V DC Reinhardt Weber (weber.reinhardt@t-online.de) Circuits that convert a DC supply into a 50 Hz AC supply are called inverters. Commercial units are notable for their small size, high efficiency and high power output. A simpler approach using a standard mains transformer is however more than adequate to power a TV set and satellite receiver from a 12 V vehicle battery. The task of converting an alternating voltage to a higher or lower voltage is most often performed by a transformer; it offers good efficiency and provides galvanic isolation between the two voltages. Generating a higher voltage level from a DC source is not quite so simple, before we can use any form of transformer it is first necessary to use a circuit which converts DC into AC. BACK TO BASICS There are basically two configurations used for mains inverter designs: - direct conversion using a 50 Hz mains transformer; - conversion using a switch mode inverter. The direct conversion principle shown in Figure 1 switches a low voltage DC supply through the low voltage wind- ing of a standard mains transformer. The switch configuration steers the current alternately in one direction and then the other through the winding. A 50 Hz switching signal produces a high voltage 50 Hz square wave AC output, the voltage level is governed simply by the ‘turns ratio’ of the mains transform- er. This approach has the advantage of simplicity; all the electronics are con- fined to the low voltage side of the circuit but the main drawback is the size and weight of the transformer. De- signs of inverters with ratings greater than around 200 W begin to get quite cumbersome. Converters using the switch-mode principle (Figure 2) interrupt or switch the DC input voltage passing through a transformer winding. The switching frequency used is much higher, gen- erally in the region of 30 to 100 kHz which allows the transformer design to be much smaller and lighter. The trans- former high voltage output also alter- nates at the same switching frequen- cy so it is necessary to first rectify it and then use some fairly complex elec- tronics including four semiconductor switches in a bridge configuration to convert the high voltage DC into a 50 Hz AC output. The drawbacks of this design are firstly that the high frequen- cy (HF) transformer is not a standard off-the-shelf component; it will need to be specially made using a ferrite core. The high frequency switching wave- forms also produce substantial levels of EMI (Electro Magnetic Interference) which must be suppressed with filters. All-in-all this type of inverter is not an ideal construction project for a new- comer to electronics. The inverter design suggested here uses a standard mains transformer switched by a 50 Hz signal derived from a crystal oscillator. The frequen- cy accuracy ensures that any mains equipment with a built-in clock (or time switch) will keep good time when it is powered by this unit. 70 elektor electronics - 4/2007 Figure 1 A simple inverter using a mains transformer. Four semiconductor switches in a bridge configuration produce an AC signal in the low voltage winding of a mains transformer by alternately reversing the low voltage DC source. Figure 2 High power inverters switch at high frequency. The high voltage is rectified and smoothed, then converted to a 50 Hz AC mains voltage using high-voltage semiconductor switches in a bridge configuration. STRAIGHTFORWARD The inverter circuit diagram is shown in Figure 3 and is quite straightfor- ward; there are no traps to catch out the unwary constructor. The integrat- ed circuit IC1 (74HC4060) is a binary counter with an integral oscillator. A 3.2768 MHz crystal connected across the oscillator inputs produces a divid- ed-down square wave signal of 200 Hz at output Q14 of the counter chip. The 74HC112 JK flip flop (IC2) performs a divide-by-two function on this signal while the second half of this chip di- vides the frequency by two once again to produce a 50 Hz square wave at pin 5 together with an inverted version at pin 6 (i.e. phase shifted by 180°). The four MOSFETs VI to V4 are config- ured in a so-called H bridge configu- ration with the low voltage transform- er winding forming the central arm of the bridge. Transformers with two low voltage 6 V windings can also be used if the two windings are connected in series to form a single 12 V winding. Similarly a transformer with two inde- pendent 12 V low voltage windings can be used if these two windings are connected in parallel. In both cases ensure correct phasing of the winding connections. Power MOSFETs have a relatively high input (gate) capacitance of a few nF, which slows down their maximum switching rate. The driver stage using transistors Q1 and Q2 has a low im- pedance output to help overcome this capacitance and speed up switching times. The drive signals to transistors Q1 and Q2 are derived from the complemen- tary outputs (Q and Q) of IC2A. The oscillator can stop running when the supply battery voltage falls too low so capacitors CE2 and CE3 provide AC coupling of the control signals to Q1 and Q2. The pull-up resistors R8 and R9 then ensure that both Q1 and Q2 become conducting, turning off Viand V2 which holds the ends of the trans- former winding at the same potential so that there is no path available for destructive current to flow through the winding and MOSFETs. RESULTS The oscilloscope screen shot in Figure 4 shows current and voltage wave- forms at the output of the transformer when it is driving a resistive load (a 60 W mains lamp). Using a fully charged 12 V car battery (14 V terminal volt- age) as a power source the input cur- rent was 4.9 A giving a power con- sumption of 67 W. Power in the load was measured at 54 W (215 V at 0.25 A) which yields an operating efficiency of around 80%, not bad for such a sim- ple design! Losses incurred in the transformer and switching transistors mean that the output voltage does not quite reach 230 V but is within the supply tolerance of the majority of electrical applianc- es. An 11 V mains transformer would help compensate for the voltage loss- es but these are not widely available. A standard 12 V toroidal mains trans- former can however be modified; these generally have the low voltage wind- ing wound over the top of the mains winding so it is a relatively easy job to take off a few turns (around 10 %) to produce an 1 1 V secondary winding. The MOSFET heatsinks specified allow the use of a transformer with a rating up to around 150 W. Larger heatsinks must be used if a higher power trans- former is required (the MOSFET data sheet indicates that they can switch 50 A max). The half-eurocard sized PCB layout shown in Figure 4 is, like the circuit, also quite straightforward. Fit the two wire links to the board before the rest 4/2007 - elektor electronics 71 HANDS-ON POWER SUPPLIES I i Components list i i Resistors Rl = 2MQ2 R2,R8,R9 = 1 0k£2 R3, R5 = 1 00kf2 R4, R6 = 22CK2 I RIO = 22Q I I Capacitors I Cl = 47pF I C2 = 27pF ■ C3, C4 = 1 OOnF 1 CE 1 = 4700jL/F CE2,CE3 = 1 00yL/F J Semiconductors IC1 = 74HC4060 IC2 = 74HC112 | Q1 ,Q2 = BC547 | V1,V2 = IRF4905 I V3,V4 = IRF3205 I ZD1 = 10V/0.5W (zener diode) I Miscellaneous PLl ,PL2 = 2-way PCB terminal block XT1 = 3. 2768MHz quartz crystal PCB, ref. 060171-1 from The PCBShop I I I Figure 3 The circuit uses a crystal oscillator to give an accurate and stable 50 Hz operating frequency. of the components are mounted. The ICs can be mounted to the board using sockets. Each MOSFET has its own heatsink so it is possible to mount them without any form of electrical in- sulating gas- kets provided that the heat- sinks are nev- er allowed to make electri- cal contact with any oth- er part of the circuit during operation (it sometimes pays to be pessimistic; Murphy’s law states whatever can go wrong will go wrong so its probably safer to fit in- sulation). The two terminal blocks used for connecting the battery and trans- former should be the correct size for Figure 4 Component placement on the single sided PCB. the cables used. Ensure that the cable to the battery is of sufficient cross-sec- tional area to handle the input current to the inverter and also be sure to fit an in-line fuse between the inverter and battery. A rating of 15 A (slow) should be sufficient for operation of the unit up to around 150 watts. ( 060171 - 1 ) 72 elektor electronics - 4/2007 I “Elektor? Prescribed reading for our R&D staff because that’s where we need professional guidance for microcontroller technology.” - Frank Hawkes, 39, development engineer - lektor 1-UlVi eniMi Electronics at all the right levels • f 'Mm EMIK.0 L ' Secure a head start in electronics with a subscription! Advantages to subscribers: * .1 ■■ I ill L fc-r* — J ■ Mo'ce Cheaper than 1 1 issues from the newsstand Subscribers get up to 40% discount on special Elektor products As a welcome gift you get a free 1GB MP3 player worth £ 34.50 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-electronics.co.uk/subs Tel. +44 (0) 208 261 4509 Or use the subscription order form near the end of the magazine. ekto the world-leading network for electronics HANDS-ON INSIDE OUT PC fan analysed Harry Baggen These days most PCs contain several fans that help cool the CPU, graphics processor, motherboard chipset and the rest of the electronics. At first sight such a fan may appear to have a simple construction, but there is a lot of control electronics working behind the scenes as well. Figure 1 . The PCB inside the fan has four poles with coils that are driven by a rotating magnetic field generator. The modern-day fan is a low-key part in a case that con- tains super-fast processors, memory and other high-tech chips. Even so, the manufacturers of these fans have incorporated a lot of electronics to provide them with se- veral fail-safe mechanisms and a longer lifespan. Motors using a commutator and brushes (lots of wear!) haven't been used for this purpose for a long time! We have dismantled several PC fans in the Elektor Electro- nics labs to give you an insight of their construction. The inside of such a modern fan (called a DC brush- less motor) consists of a number of stacked metal sheets, which make up four poles, each of which has a coil wound round it (Figure 1). On the rotor (the rotating part with the blades) is a circular magnet that has four north/south poles divided evenly around its circumferen- ce. If we now generate a rotating magnetic field in the four coils using an electronic circuit powered by the PC's DC supply, the rotor will turn with a specific number of revs. To detect the instantaneous position of the north/sou- th poles of the rotor-magnet a Hall sensor, which reacts to the changing magnetic field, is mounted close to the mag- net. This signal is used to drive the coils in pairs at just the right time to make the fan turn at the required speed. Thanks to the high level of integration these days it is possible to put all the driver electronics including the hall sensor into a single four-pin package, as you can see in Figure 2. Several years ago you still needed a handful of components for this, as shown in the photo of an older model in Figure 3. ALL IN A SINGLE 1C In Figure 4 you can see the internal block diagram of the 4-pin 1C used in this fan. In this case it is an ATS276 made by Anachip, but there are many other similar ICs available from other manufacturers. Inside the 1C is a vol- tage regulator (Reg.), which provides the internal circuit with a stable supply voltage. The Hall sensor's output is fed to a differential amplifier (Amp) with a hysteresis cir- cuit, which drives the two transistors for the coils. This is a fairly basic 1C. There are also more intelligent versions that can detect when the rotor stalls, provide 74 elektor electronics - 4/2007 Hall-sensor Figure 2. Calling it a rotating magnetic field generator seems to be an overstatement: all the electronics and the Hall sensor are in a 4-pin 1C. Apart from an electrolytic capacitor no other components are required. A Hall sensor operates using the so-called Hall effect. This was discovered in 1 879 by the American physicist Edwin Hall. When a current flows through a magnetic field, a potential difference is created at right angles to the magnetic field. The strength of the magnetic field can be determined by measuring this potential difference. A Hall element consists of a thin sheet of semiconductor material, which has a cur- rent forced through it. When there is a magnetic field at right angles to the sheet it causes a change in direction of the driving current. This creates a change in concentration of the charge carriers, which is perpendicular to the cur- rent flow. This potential difference is called the Hall voltage. In the production of Hall elements use is made of materi- als such as indium antimonide (InSb) and indium arsenide (InAs). Figure 4. Internal block diagram of the 1C used in our fan. The coils are driven directly by the 1C, with currents up to 0.4 A. Figure 3. For a comparison we opened up an older fan. The drive electronics and sensor are all discrete components. an output signal of the revs (usually found on CPU and motherboard chipset fans) and which also have thermal protection. The weakest point of a PC fan is often not the control electronics but the bearing. Cheaper fans usually have a simple sleeve bearing that can wear out fairly quickly and introduce some play to the rotor. More expensive (and better) fans make use of ball bearings. In the last few years special lubricants and techniques have been intro- duced to make the fans run almost noiselessly and give them a longer lifespan. ( 070022 ) 4/2007 - elektor electronics INFOTAINMENT RETRONICS Adjustable high-voltage power supply (1961) Jan Buiting A small mistake I made when I collected this instrument from a kind reader clearing out his shack (owing to emigration) was to think that the unit was very heavy. In fact, it weighs just over 13 kg and is easily carried by its chrome-plated handles. The mistake is not uncommon. Just combine these hints: (1) a 19- inch case with dull grey lac- quer, (2) Tower Supply' print- ed on the front panel and (3) large valves visible through a mesh cover, and you will easi- ly understand why Americans call this type of equipment a 'boat-anchor'. According to the manual, the Van der Heem type 8619 power sup- ply can be used to supply a sta- bilised DC voltage of low source impedance, for powering experi- mental set-ups and calibration of instruments and numerous other applications in laboratory and industry. The stabilized voltage supplied by the 861 9 is continuously ad- justable in three ranges: 0-35 V, 20- 190 V and 180-350 V, at a current of 1 50 mA maximum on all ranges. Unstabilised voltages of 245 V, 375 V and 540 V are also available. Furthermore the instrument sup- plies two valve filament voltag- es, 6.3 VAC and 4 VAC, and a continuously adjustable nega- tive voltaqe with ranqe of 0 to -40 V. The instrument is built to profes- sional standards in a 22-cm high 19-inch case finished in matt grey lacquer typical of high- end lab instruments sold in the 1 960s. The front panel has wan- der sockets, knobs with arrow pointers, rocker switches and a moving-coil meter with com- bined V / mA scales. Everything has very solid look and feel. Having blown the dust off I was pretty confident the 8619 would work so I gave it a 'soft start' to prevent the electrolytic capacitors coming to grief. The trick with vintage valve equipment hav- ing gathered dust for years is to always use an adjustable mains transformer to allow the equip- ment to operate at, say, 50-75% of the nominal mains voltage for a number of hours. This will en- able any dried out high-voltage electrolytics in the equipment to 'reform' and valves to come alive in a gentle, controlled manner. Despite good patience and a gentle approach in waking up this sleeping beauty, no out- put voltage was obtained from, or indicated by, the 8619. As it turned out, a 1 50 mA fuse had blown and after replacement the instrument worked properly. A regulated, adjustable supply is nothing special, but try to find one for high voltages required in valve equipment and you'll find that they are rarer than hens' teeth. Not surprisingly, the 8619 has valves inside and the good news is that dead common types are used like the EL34 (6CA7), EF94 (6AU6), OA2 and 85A2. The simplified circuit of the reg- ulator section shows 7 resistors (including a potentiometer and a preset) forming a voltage divi- der between the reference volt- age (-85 V) and the stabilised output voltage. The preset is for calibration and the pot allows the desired output voltage to be set. The control grid of the EF94 amplifier valve is connected to a tap on the voltage divider. Due to the high loop gain and the high negative feedback ratio, the EF94 creates a constant poten- tial difference with respect to the common rail. Consequently, the output voltage is determined by the dividing ratio effectively set on the divider chain by the pot. Our thanks are due to Mr. Cor de Boer for putting this rare in- strument at our disposal. ( 075036 - 1 ) Retronics is a monthly column covering vintage electronics including legendary Elektor designs. Contributions, suggestions and requests are welcomed; please send an email to editor@elektor-electronics.co.uk, subject: Retronics EE. 76 elektor electronics - 4/2007 HEXADOKU INFOTAINMENT Hexadoku Puzzle with an electronic touch Here's another Hexadoku puzzle that hopefully will keep you busy for a few hours with the soldering iron switched off. Once again, three E-blocks Professional Starter kits and three Elektor SHOP vouchers are up for grabs for those who manage to solve the puzzle. Participate! Please send your solution (the numbers in the grey boxes) by email to: editor@elektor-electronics.co.uk Subject: hexadoku 04-2007. Alternatively, by fax or post to: Elektor Electronics Hexadoku Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom. Fax (+44)(0)208 2614447 The closing date is 1 May 2007. The competition is not open to employees of Segment b.v., its business partners and/or associated publishing houses. The instructions for this puz- zle are straightforward. In the diagram composed of 1 6 x 1 6 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 in each column and in each of the 4x4 boxes (mar- ked by the thicker black lines). A number of clues are given in the puzzle and these determine the start situation. All correct entries received for each month's puzzle go into a draw for a main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. The puzzle is also available as a free download from our website (Magazine 2007 — > April). Prize winners The solution of the January 2007 Hexadoku is: 9BC24. The E-blocks Starter Kit Professional goes to: Don Allen (UK). An Elektor SHOP voucher worth £35.00 goes to: Adam Burdeniuk (AUS), Tuomo Hyyronmaki (FIN), Roy Turner (UK) Congratulations everybody! A C 8 5 3 5 1 6 E F 9 C F 1 2 9 0 3 6 D 8 9 F B 3 8 6 1 3 F C B 8 D A 4 E 9 D 2 4 9 7 8 E C F E 7 1 9 E F 0 B A C D 5 3 8 1 0 9 7 6 2 A 5 4 D F C B 8 9 3 0 2 5 4 F B 4 A 8 5 7 2 A 8 0 7 D 3 9 E 5 0 7 5 6 F 6 9 C D 4 3 A D A 6 5 9 0 1 (c) PZZL.com Solve Hexadoku and win! Correct solutions received enter a prize draw for an E-blocks Starter Kit Professional worth £248.55 and three Elektor Electronics SHOP Vouchers worth £35.00 each. We believe these prizes should encourage all our readers to participate! 4/2007 - elektuur 77 ELEKTOR SHOWCASE To book your showcase space contact Huson International Media Tel. 0044 (0) 1932 56 ATC SEMITEC LTD www.atcsemitec.co.uk Thermal and current-sensitive components for temperature control and circuit protection; • NTC Thermistors • Current Diodes • Thermostats • Re-settable Fuses • Thermal Fuses • Temperature Sensors Call today for free samples and pricing Tel: 01 606 871 680 Fax: 01 606 872938 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 £15.00. BAEC http://baec.tripod.com "The British Amateur Electronics Club Archive Website. Archiving extracts from 140+ Newsletters from 1966- 2002. Currently have interesting and useful selected articles from 1 2 Newsletters. Also a section about built electronics projects with schematics and photos. Plus useful info., downloads and links. NO ADVERTS!" 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 manufacturer’s prices. cost of the usual 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 • device programmer manufacturer • selling through contracted distributors all over the world • universal and dedicated device programmers • excellent support and after sale support • free SW updates • reliable HW • once a months new SW release • three years warranty for most programmers FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk/PICProTrng.html Microchip Professional C and Assembly Programming Courses. The future is embedded. Microchip Consultant /Training Partner developed courses: • Distance learning / instructor led • Assembly / C-Programming of PIC1 6, PIC1 8, PIC24, dsPIC microcontrollers • Foundation / Intermediate FUTURE TECHNOLOGY DEVICES http://www.ftdichip.com FTDI designs and sells USB-UART and USB-FIFO interface i.c.’s. Complete with PC drivers, these devices simplify the task of designing or upgrading peripherals to USB LONDON ELECTRONICS COLLEGE http://www.lec.org.uk Vocational training and education for national qualifications in Electronics Engineering and Information Technology (BTEC First National, Higher National NVQs, GCSEs and Advanced Qualifications). Also Technical Management and Languages. MODular ElecTRONics www.modetron.com • Plug and Program • FREE application s/w • Hobbyist ease-of-use • Professional finish with enclosure and LEXAN faceplate • We will design and brand your custom application • Growing range of PSU’s, i/o modules, displays and microcontrollers 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 NEW WAVE CONCEPTS www.new-wave-concepts.com Software for Hobbyists: • Livewire - circuit simulation software, only £34.99 • PCB Wizard - PCB design software, only £34.99 • Circuit Wizard - circuit, PCB and breadboard design software, only £59.99 Available from all Maplin Electronics stores and www.maplin.co.uk PCB WORLD http://www.pcbworld.org.uk World-class site: Your magazine project or prototype PCB from the artwork of your choice for less. Call Lee on 07946 846159 for details. Prompt service. ROBOT ELECTRONICS http://www.robot-electronics.co.uk Advanced Sensors and Electronics for Robotics • Ultrasonic Range Finders • Compass modules • Infra-Red Thermal sensors • Motor Controllers • Vision Systems • Wireless Telemetry Links • Embedded Controllers SOURCEBOOST TECHNOLOGIES http://www.sourceboost.com Next generation C compiler and development products at highly affordable prices: • C, C++, and Basic compilers for PIC12, PIC16, PIC18 • Modern IDE, with PIC simulator, source level debugger and virtual devices. • RTOS for PICmicro. • PIC based controller and Development boards. • Download and try for Free from http://www.sourceboost.com SYTRONIC TECHNOLOGY LTD www.m2mtelemetry.com Supplier of wireless modules and accessories for remote monitoring M2M applications. • GSM/GPRS TCP/IP modules • Embedded GSM/GPRS modem • Development Kits • GPS modules • GSM/GPS antennas • Adapter cables Online ordering facilities. Tel: 01728 685802 78 elektor electronics - 4/2007 products and services directory SHOWCASE YOUR COMPANY HERE ULTRALEDS \uitr sleds..*.* http://www.ultraleds.co.uk tel: 0871 7110413 Large range of low cost Ultra bright leds and Led related lighting products. Major credit cards taken online with same day depatch. 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. 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 £220 + VAT (£20 per issue for eleven issues) Elektor will publish your company name, website adress and a 30-word description • For £330 + VAT for the year (£30 per issue for eleven issues) we will publish the above plus run a 3cm deep full colour image - e.g. a product shot, a screen shot from your site, a company logo - your choice Places are limited and spaces will go on a strictly first come, first served basis. So please fax back your order today ! I wish to promote my company, please book my space: • Text insertion only for £220 + VAT • Text and photo for £330 + 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 lectronics ISBN 0-905705-68-8 476 pages £27.50 / US$ 51.50 Visual Basic for Electronics Engineering Applications This book is targeted towards those people that want to control exis- ting or home made hardware from their computer. After familiarizing yourself with Visual Basic, its development environment and the toolset it offers, items such as serial communications, printer ports, bitban- ging, ISA, USB and Ethernet interfacing and the remote control of test equipment over the GPIB bus are covered in great detail. Each topic is accompanied by clear, ready to run code. Where necessary, schema- tics are provided that will get your projects up to speed in no time. This book discusses tools like Debug to find hardware addresses, setting up remote communication using TCP/IP and UDP sockets, writing your own internet servers and even connecting your own block of hardware over USB or Ethernet and controlling it from Visual Basic. All examples are ready to compile using Visual Basic 5.0, 6.0, NET or 2005. Extensive coverage is given on the differences between what could be called Visual Basic Classic and Visual basic .NET / 2005. for Electronics Engln earing Applies lions Irfi Order now using the Order Form in the Readers Services section in this issue. Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 (0) 208 261 4509 See also www.elektor-electronics.co.uk 4/2007 - elektor electronics 79 Our range of more than 40 hardware circuit blocks, 6 CD-ROMs, 50 sensors and a host of accessories and support materials, means that whatever you want to make, you can make it with E-blocks. If you are a beginner then we suggest you start with one of our E-blocks Starter Kits. These have everything you need for your first project. If you need to learn how to program in C for AVR, PIC or ARM, or you want to connect your system to the internet, or develop CAN bus communication systems, then we have the right starter kit for you. You’ll save a massive 30% discount w.r.t. individual items! If you want to make up your own kit then it is also easy: just select the items you need for your project from the list below. Modules ARM programmer AVR multiprogrammer Bluetooth board CAN board CPLD board FPGA daughter board Internet board IR/IRDA transmitter receiver Keypad LCD board LED board Patch board Power board Prototype board Quad 7-segment display RS232 board Screw terminal board Sensor interface Switch board USB multiprogrammer X-10 home automation board Software (single user) Assembly for PICmicro MCUs £117.90 C for ARM microcontrollers £ 118.00 C for AVR microcontrollers £ 118.00 C for PIC microcontrollers £ 118.00 Flowcode for PICmicro MCUs v3 (pro version) £ 118.00 Programmable Logic Techniques £ 117.90 Ordering Use the order form at the back or go to www.elektor-electronics.co.uk (shop). E-blocks will be shipped after receipt of payment. Prices are exclusive of postage leading the way Free downloads available on www.elektor-electronics.co.uk/eblocks! lektor K]®P Order now using the Order Form in the Readers Services section in this issue. CD-ROM BESTSELLERS Elektor 2006 This CD-ROM contains all editorial articles published in Elektor Electronics Volume 2006. Using the supplied Acro- bat Reader program, articles are presented in the same layout as originally found in the magazine. All free, printed, supplements our readers got last year, like the Visual Basic, C and i-TRIXX booklets are also contained on the CD. The Elektor Volume 2006 CD-ROM has a rather different look and feel than previous editions. It’s gone through a makeover in more than one way! ISBN 978-90-5381-207-5 I £16.25 (US$ 28.75) USB TOOLBOX This CD-ROM contains techni- cal data about the USB inter- face. It also includes a large collection of data sheets for specific USB components from a wide range of manufacturers. There are two ways to incorpo- rate a USB interface in a micro- controller circuit: add a USB con- troller to an existing circuit, or use a microcontroller with an integrated USB interface. Included on this CD-ROM are USB Basic Facts, several useful design tools for hardware and software, and all Elektor Elec- tronics articles on the subject of USB. ISBN 978-90-5381-212-9 I £18.95 (US$ 34.95) Home Automation This CD-ROM provides an overview of what manufactu- rers offer today in the field of Home Networking, both wired and wireless. The CD-ROM contains specifications, stan- dards and protocols of commer- cially available bus and network systems. For developers, there are datasheets of specific components and various items with application data. End-users and hobbyists will find ready-made applications that can be used immediately. ISBN 978-90-5381-195-5 I £12.95 (US$ 22.90) Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Telephone +44 208 261 4509 Brentford TW8 9HH Fax +44 208 261 4447 United Kingdom Email: sales@elektor-electronics.co.uk More information on www.elektor-electronics.co.uk Visual Basic for Electronics Engineering Applications This book is targeted towards those people that want to control existing or home made hardware from their computer. After familiarizing yourself with Visual Basic, its development environment and the toolset it offers are discussed in detail. Each topic is accompanied by clear, ready to run code, and where necessary, schematics are provided that will get your projects up to speed in no time. NmJgntt ISBN 978-0-905705-68-2 476 Pages £27.50 (US$ 51.50) 71 LJ ISBN 978-0-905705-67-5 230 Pages £18.70 (US$ 33.70) Microcontroller Basics Microcontrollers have become an indispensable part of modern electronics. They make things pos- sible that vastly exceed what could be done previ- ously. Innumerable applications show that almost nothing is impossible. There’s thus every reason to learn more about them. This book offers more than just a basic introduction. It clearly explains the technology using various microcontroller circuits and programs written in several different programming languages. In the course of the book, the reader gradually develops increased competence in converting his or her ideas into microcontroller circuitry. BESTSELLING BOOKS (Top-5 Visual Basic for Electronics Engineering Applications ISBN 978-0-905705-68-2 £27.50 (US$ 51 .50) 2 s ) Microcontroller Basics ISBN 978-0-905705-67-5 £18.70 (US$ 33.70) 3 ) PC-1 nterf aces under Windows ISBN 978-0-905705-65-1 £25.95 (US$ 52.00) 4 s ) Modern High-end Valve Amplifiers ISBN 978-0-905705-63-7 £25.95 (US$ 52.00) 308 ISBN 978-0-905705-66-8 £18.20 (US$ 37.00) More bestsellers on www.elektor-electronics.co.uk ISkf Of Order o @K]@© www.elektor-el Order now using the Order Form in the Readers Services section in this issue. Wireless USB in miniature (March 2007) iDwarf -168 Transmitter module (built & tested) 050402-91 £ 24.10 / US$ 45.45 iDwarf Node Board (built & tested) 050402-91 £ 1 7.20 / US$ 32.45 iDwarf Hub Board (built & tested) 050402-93 £ 1 7.20 / US$ 32.45 No. 364 APRIL 2007 Battery Charge-n-Check 050073-1 PCB, bare, main board 050073-2 PCB, bare, display board 050073-11 CD-ROM, project software 050073-41 ST7FMC2S4, programmed g-Force on LEDs 060297-71 PCB set, incl. 2 MMA7260 sensors, BDM cable parts 060297-11 CD-ROM, project software Programmer for Freescale 68HC(9)08 060263-1 PCB, bare A Simple Mains Inverter 060171-1 PCB, bare Very Simple Clock 060350-1 PCB, bare E-blocks Light Chaser Squared 075032-1 PCB, bare No. 363 MARCH 2007 Attack of the SpYder 060296-91 SpYder Discovery Kit AVR drives USB 060276-1 PCB, bare 060276-1 1 CD-ROM, project software incl. source code 060276-41 ATmega32-16PC, programmed Wireless USB in Miniature 050402-1 PCB, bare, iDwarf prototyping board 050402-91 iDwarf -1 68 Transmitter module (built & tested) 050402-92 iDwarf Node Board (built & tested) 050402-93 iDwarf Hub Board (built & tested) Mobile Phone LCD for PC 060184-1 PCB, bare 0601 84-1 1 CD-ROM, project software 060184-41 ATmega16-16PC, programmed Scale Deposit Fighter 070001-1 PCB, bare 10.30 19.50 10.30 19.50 5.20 9.75 16.90 31.85 10.00 18.85 5.20 9.75 www.thepcbshop.com www.thepcbshop.com www.thepcbshop.com www.thepcbshop.com 6.45 12.70 10.00 18.85 5.20 9.75 8.95 16.85 8.30 15.60 24.10 45.45 17.20 32.45 17.20 32.45 www.thepcbshop.com 5.20 9.75 8.95 16.85 www.thepcbshop.com SpYder Discovery Kit For Freescale MC9RS08KA, MC9S08QD, MC9S08QG and MC9S08SH microcontrollers (March 2007) Contains USB Programmer/- Debugger BDM, CD-ROM and one MC9S08 8-pin PDIP microcontroller. 060296-91 Normal retail price: £ 20 ELEKTOR PRICE: £6.45/ $12.70 FREE WITH EVERY ELEKTOR KIT OR MODULE! Order an Elektor kit or module and receive a free SpYder Discovery Kit. Act fast as the offer is limited to stocks. Elektor Kits & Modules are listed on www.elektor-electronics.co.uk/kits No. 362 FEBRUARY 2007 ... 3, 2, 1 Takeoff! 050238-1 Transmitter PCB, bare www.thepcbshop.com 050238-2 Receiver PCB, bare www.thepcbshop.com MP3 Preamp 060237-1 PCB, bare www.thepcbshop.com A Telling Way of Telling the Time 050311-1 PCB, bare www.thepcbshop.com 050311-31 CPLD, programmed 35.50 66.95 FPGA Course (9) 060025-9-11 CD-ROM, course software incl. source code 5.20 9.75 Explorer-16 Value Pack 060280-91 Four components packaged together in a single box 122.90 232.50 No. 361 JANUARY 2007 Sputnik Time Machine 050018-1 PCB www.thepcbshop.com 050018-11 CD-ROM, project software (incl. source code) 5.20 9.75 050018-41 AT89C2051, programmed 3.40 6.45 Very Simple Clock 060350-1 PCB www.thepcbshop.com 060350-1 1 CD-ROM, project software (incl. source code) 5.20 9.75 060350-41 PIC16F628-20, programmed 5.50 10.35 FPGA Course (8) 060025-8-1 Software (incl. source code) 5.20 9.75 No. 360 DECEMBER 2006 Shortwave Capture 03041 7-1 PCB, bare (receiver board) www.thepcbshop.com 03041 7-2 PCB, bare (control & display boards) www.thepcbshop.com 030417-41 AT90S8515-8PC, programmed 11.40 21.45 No. 359 NOVEMBER 2006 USB Stick with ARM and RS232 060006-1 PCB, bare 060006-41 AT91SAM7S64, programmed 060006-91 Assembled & tested board 060006-81 CD-ROM, all project software 11.00 20.75 27.60 51.95 79.90 149.95 5.20 9.75 nline at ectronics.co.uk Due to practical constraints, final illustrations and specifications may differ from published designs. Prices subject to change. See www.elektor-electronics.co.uk for up to date information. USB Stick with ARM and RS232 (November 2006) Assembled and tested board 060006-91 £ 79.90 / $ 1 49.95 GameBoy ElectroCardioGraph (October 2006) PCB, ready built and tested 050280-91 £ 55.20 / $ 1 03.95 Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 (0) 208 261 4509 Fax: +44 (0) 208 261 4447 Email: sales@elektor-electronics.co.uk Kits & Modules Elektor RFID Reader (September 2006) Ready-built and tested PCB with USB port for connection to the PC. Including USB cable; not including display and enclosure. - Read and write 13.56 MHz RFID cards - MIFARE and ISO 14443-A compatible - Programmable 060132-91 £ 41 .50 / $ 77.95 LC display 030451-72 £7.25/$ 13.65 Matching enclosure 060132-71 £ 8.90 / $ 1 6.85 CD-ROM (all project software) 060132-81 £ 5.20 / $ 9.75 No. 358 OCTOBER 2006 PIC In-Circuit Debugger/Programmer 050348-1 PCB 5.20 9.75 050348-41 PIC16F877, programmed 17.90 33.75 050348-71 Kit, incl. PCB, controller, all parts 34.50 64.95 GBECG - Gameboy ElectroCardioGraph 050280-91 PCB, ready built and tested 55.20 103.95 ECG using a Sound Card 040479-1 PCB 5.20 9.75 040479-81 CD-ROM, all project software 5.20 9.75 No. 357 SEPTEMBER 2006 Elektor RFID Reader 060132-91 PCB, ready assembled & tested, with USB cable 41.50 77.95 030451-72 Standard back-lit LC display 7.25 13.65 060132-71 Matching enclosure 8.90 16.85 060132-81 CD-ROM, all project software 5.20 9.75 Experimental RFID Reader 060221 -1 1 Disk, all project software 5.20 9.75 060221-41 ATmegal 6, programmed 8.90 16.85 DiSEqC Monitor 040398-1 1 Disk, PIC source & hex code 5.20 9.75 040398-41 PIC16F628A-20/R programmed 5.50 10.35 USB/DMX512 Converter 060012-1 1 Disk, all project software 5.20 9.75 060012-41 PIC16C745, programmed 6.90 12.95 No. 356 JULY/AUGUST 2006 RC Servo Tester/Exerciser 0401 72-1 1 Disk, project software 5.20 9.75 040172-41 PIC1 6F84(A), programmed 10.30 19.40 040172-71 Kit, incl. PCB, controller, all parts 22.70 42.85 LED Thermometer 0301 90-1 1 Disk, project software 5.20 9.75 030190-41 PIC16F873-20/SP, programmed 16.50 31.00 Toothbrush Timer 0501 46-1 1 Disk, project software 5.20 9.75 050146-41 AT90S2313-10PC, programmed 6.90 12.95 Easy Home Control 050233-1 1 Disk, project software 050233-41 PIC16F84, programmed Universal LCD Module 050259-1 1 Disk, project software 050259-41 AT90S231 3, programmed 1-Wire Thermometer with LCD 060090-1 1 Disk, project software 060090-41 PIC16F84A-04CP, programmed GBPLC - Gameboy PLC 050190-1+2 PCBs, bare, GBPLC Module & Programming Interface 050190-51 Programmed PAL, EEPROM and Flash 1C Ready-built and tested GBPLC Module and Programming Interface I2C I/O Box PCB, bare Ready-built and tested board Binary Clock 020390-1 1 Disk, project software 020390-41 PIC6C54-04/P, programmed No. 355 JUNE 2006 FM Stereo Test Transmitter 050268-1 PCB Network Cable Analyser 050302-1 PCB 050302-1 1 Disk, PIC source code 050302-41 PIC1 6F874-20/P 050190-91 GBPLC 060098-1 060098-91 5.20 9.75 10.30 19.40 5.20 9.75 6.90 12.95 5.20 9.75 10.30 19.40 11.70 22.00 11.00 20.75 84.95 159.95 17.90 33.75 84.95 159.95 5.20 9.75 8.05 15.10 11.70 22.00 8.20 15.55 5.20 9.75 16.90 31.85 No. 354 MAY 2006 Onboard OBD-2 Analyser 050176-72 Kit of parts, incl. 050176-1, 050176-2, 050176-42, all components, excl. LCD and Case 24.80 46.70 050176-73 LCD, 4x20 characters with backlight 28.80 54.50 Products for older projects (if available) may be found on our website www.elektor-electronics.co.uk home construction = fun and added value INFO & MARKET SNEAK PREVIEW Software-defined Radio with USB The concept of software-defined radio (SDR) enables excellent reception of radio stations with a minimum of electronic circuitry to build. This is due to all signal processing being done in software. Our project like no other demonstrates the sheer scope and power of SDR: tuning range 1 50 kHz through 30 MHz; for AM, DRM, SSB and CW. The receiver (or what's left of it) is powered as well as tuned 'over USB' (i.e., by the PC). Its output signal is applied to the soundcard for software-driven demodulation. The software offers continuously variable bandwidth and an accurate S meter. Universal JTAG Programmer Programmable logic of the CPLD, EPLD, uPSD or MSPS variety is extremely powerful but unfortunately not exchangeable in terms of the programmer you need. The good news is that a cross-platform programmer connection exists called JTAG (joint test action group) that allows all these ICs to be 'burned' in-circuit. Our JTAG programmer can be built in various configurations to make it compatible with CPLD and EPLD (Altera, Xilinx), PSD, uPSD / DSM (STMicroelectronics) and MSP430 (Texas Instruments). RC Transmitter to USB Joystick Emulator Over the years there have been a fair number of designs published enabling a radio-control (RC) transmitter to interface with a personal computer running flight simulator software. Having such an interface enables budding aircraft pilots to hone their skills using a simula- tion program, rather than aviating their pride and joy into the nearby landscape. The circuit is based on a 1 6C745 PIC clocked at 6 MHz or an 1 8F2550 clocked at 8 MHz. Also... ELF Reception; Magnetometer/Seismograph; R8C Competition Winner; RDS Test Transmitter; E-blocks Graphic Display; Hexadoku. RESERVE YOUR COPY NOW! The May 2007 issue goes on sale on Thursday 26 April 2007 (UK distribution only). UK mainland subscribers will receive the magazine between 21 and 24 April 2007. Article titles and magazine contents subject to change, please check www.elektor-electronics.co.uk. NEWSAGENTS ORDER FORM SHOP SAVE / HOME DELIVERY Please save / deliver one copy of Elektor Electronics magazine for me each month Name: Address: Post code: Telephone: Date: Signature: lectroni ding * Please cut out or photocopy this form, complete details and hand to your newsagent. Elektor Electronics is published on the third Thursday of each month, except in July. Distribution S.O.R. by Seymour (NS). , elektor-electronics.co.uk www.elektor-electronics.co.uk www.elektor-electronics.a Elektor Electronics on the web 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 down- loads, circuit boards, programmed ICs and corrections and updates if applicable. Complete magazine issues may also be downloaded. In the Elektor Electronics Shop you'll find all other products sold by the publishers, like CD-ROMs, kits and books. A powerful search function allows you to search for items and references across the entire website. Also on the Elektor Electronics website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Surveys and polls • FAQ, Author Guidelines and Contact 84 Please supply the following. For PCBs, front panel foils, EPROMs, PALs, GALs, microcontrollers and diskettes, state the part number and description; for books, state the full title; for photocopies of articles, state full name of article and month and year of publication. PLEASE USE BLOCK CAPITALS. Description SpYder Discovery Kit Explorer-16 Value Pack CD-ROM Elektor 2006 new CD-RO M USB Toolbox £ Visual Basic for Electronics Engineering Applications £ Price each Qty. Total Order Code 6.45 122.90 16.25 18.95 27.50 METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer Cheque (UK-resident customers ONLY) Giro transfer Prices and item descriptions subject to change. The publishers reserve the right to change prices without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Sub-total P&P Total paid Expiry date: Verification code: SWITCH ONLY: Start date: Issue number: .... Please send this order form to * (see reverse for conditions) Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Address + Post code Tel.: +44 208 261 4509 Fax: +44 208 261 4447 www.elektor-electronics.co.uk. sales@elektor-electronics.co.uk ■ Tel. Email Date - - 2007 Signature EL04 Yes, I am taking out an annual subscription to Elektor Electronics and receive a free 1GB MP3 player. I would like: [ | Standard Subscription (11 issues) Subscription-Plus (11 issues plus the Elektor Volume 2007 CD-ROM) * Offer available to Subscribers who have not held a subscription to Elektor Electronics during the last 12 months. Offer subject to availability. See reverse for rates and conditions. Name Address + Post code Tel. Email Date - - 2007 Signature * cross out what is not applicable EL04 *USA and Canada residents may (but are not obliged to) use $ prices, and send the order form to: Old Colony Sound Lab P.O. Box 876, Peterborough NH 03458-0876. Tel. (603) 924-6371, 924-6526, Fax: (603) 924-9467 Email: custserv@audioXpress.com METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer Cheque (UK-resident customers ONLY) □ Giro transfer Expiry date: Verification code: SWITCH ONLY: Start date: Issue number: .... Please send this order form to Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 208 261 4509 Fax: +44 208 261 4447 www.elektor-electronics.co.uk. subscriptions@elektor-electronics.co.uk ORDERING INSTRUCTIONS, P&P CHARGES Except in the USA and Canada, 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. On-line ordering: http://www.elektor-electronics.co.uk Readers in the USA and Canada may (but are not obliged to) send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Old Colony Sound 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: UK: £4.00 Europe: £5.00 (Standard) or £7.00 (Priority) Outside Europe: £8.00 (Standard) or £12.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. 40209520 held by Elektor Electronics (Publishing) / Segment b.v. with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20. 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 (Publishing) / Segment b.v.. 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. Giro transfer into account no. 34-152-3801, held by Elektor Electronics (Publishing) / Segment b.v. Please do not send giro transfer/deposit forms directly to us, but instead use the National Giro postage paid envelope and send it to your National Giro Centre. Credit card VISA, Access, MasterCard, JCBCard and Switch cards 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 Electronics 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 guarantee 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 10-days (UK); 14-days (Europe) or 21 -days (all other countries). Cancelled orders All cancelled orders will be subject to a 10% 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 Electronics (Publishing) does not accept responsibility 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 magazines (other than in third-party advertisements) 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 Electronics (Publishing) 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 Electronics (Publishing) 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 Electronics (Publishing) other than to supply goods as described or, at the option of Elektor Electronics (Publishing), 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 Electronics (Publishing) shall be determined in all respects by the laws Of England. January 2007 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION Standard Plus United Kingdom £41 .90 £48.80 Surface Mail Rest of the World £54.50 £61.40 USA & Canada US$ 95.50 US$106.50 Airmail Rest of the World £68.90 £75.80 USA & Canada US$120.00 US$131.00 HOW TO PAY Bank transfer into account no. 40209520 held by Elektor Electronics (Publishing) / Segment b.v. with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20. 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 (Publishing) / Segment b.v.. 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. Giro transfer into account no. 34-152-3801, held by Elektor Electronics (Publishing) / Segment b.v. Please do not send giro transfer/ deposit forms directly to us, but instead use the National Giro postage paid envelope and send it to your National Giro Centre. Credit card VISA, Access, MasterCard, JCBCard and Switch cards 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 perma- nent 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) reduc- tion 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 £33.50, a Student Subscription- Plus costs £40.40 (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 per cent) of the full subscription price or £7.50, whichever is the higher, plus the cost of any issues already dispatched. Subsciptions cannot be cancelled after they have run for six months or more. January 2007 Elektor Electronics (Publishing) Regus Brentford • 1000 Great West Road Brentford TW8 9HH • United Kingdom Telephone +44 (0) 208 261 4509 Order now using the Order Form in Fax +44 (0) 208 261 4447 the Readers Services section in this issue . Email: sales@elektor-electronics.co.uk ELEKTOR AUDIO BOOKS 3 must-haves for all audio-enthusiasts! Build your own Modern High-end Audio Valve Amplifiers Valve Amplifiers Build your own High-End Audio Equipment To many people, the thermionic valve or electron tube is history. However, whether it is nostalgia, interest in the technical parameters, the appeal of a gleaming amplifier chassis with softly glowing valves or perhaps the firm con- viction that the sound of a valve cannot be bettered, it is a fact that the valve is making a come-back. This book con- tains, apart from construction projects for preamplifiers, power amplifiers, and amplifiers for musical instru- ments, information on the operation of electron tubes, while the first chapter gives a short history of the valve. • !■ Jrs . I ■ "fr'l-tl+rnk \l ISBN 0 905705 39 4 253 Pages £15.55 (US$31.00) Valve amplifiers are regarded by many to be the ne plus ultra when it comes to processing audio signals. The com- bination of classical technology and modern components has resulted in a revival of the valve amplifier. The use of toroidal-core output transformers, developed by the author over the past 15 years, has contributed to this revi- val. This book explains the whys and wherefores of toroidal output transfor- mers at various tech- nical levels and offers innovative solutions for achieving perfect audio quality. ISBN 0 905705 63 7 264 Pages 25.95 (US$52.00) The name high-end equipment is a good indication of the prices charged for it. For those who cannot, or will not, pay these high prices, there is a solution offered in this book: build your own at considerable cost savings. This book is aimed not only at this sector of the market, but also at the many enthusiasts who want to be able to experiment and to make their own modifications to their high-end equipment. Contents include solid-state and valve preamplifiers and power amplifiers, active cross- over filters, an active subwoofer, a headphone amplifier and more. ISBN 0 905705 40 8 262 Pages £15.55 (US$31.00) Index of Advertisers ATC Semitec Ltd, Showcase www.atcsemitec.co.uk 78 Avit Research, Showcase www.avitresearch.co.uk 78 BAEC, Showcase http://baec.tripod.com .78 Beta Layout, Showcase www.pcb-pool.com 45, 78 Bitscope Designs .www.bitscope.com 3 Cricklewood www. cctv centre, co. uk .45 Easysync, Showcase www.easysync.co.uk .78 Elnec, Showcase www.elnec.com .78 E u ro ci rcu its www. euro circuits, com .69 First Technology Transfer Ltd, Showcase .www.ftt.co.uk 78 Future Technology Devices, Showcase . . .www.ftdichip.com 78 Jaycar Electronics www.jaycarelectronics.co.uk 2 JB Systems, Showcase www.modetron.com .78 Labcenter www.labcenter.co.uk .88 London Electronics College, Showcase . .www.lec.org.uk 78 Mikro Elektronika www.mikroe.com 7 MQP Electronics, Showcase www.mqp.com 78 New Wave Concepts, Showcase www.new-wave-concepts.com 78 Newbury Electronics www.newburyelectronics.co.uk .69 Number One Systems www.numberone.com .39 Nurve Networks www.xgamestation.com Pa Itro n ix www.paltronix. com PCB World, Showcase www.pcbworld.org.uk Pico www.picotech.com Quasar Electronics www.quasarelectronics.com Robot Electronics, Showcase www.robot-electronics.co.uk Scantool www.ElmScan5. com/ elektor Schaeffer AG www.schaeffer-ag.de Showcase SourceBoost Technologies, Showcase . . .www.sourceboost.com Sytronic Technology Ltd, Showcase www.m2mtelemetry.com Ultraleds, Showcase www.ultraleds.co.uk USB Instruments, Showcase www.usb-instruments.com Virtins Technology, Showcase www.virtins.com . . .69 . . .31 . . .78 . . .39 . . .44 . . .78 . . .69 ... .7 78, 79 . . .78 . . .78 . . .79 . . .79 . . .79 Advertising space for the issue of 21 May 2007 may be reserved not later than 24 April 2007 with Huson International Media - Cambridge House - Gogmore Lane - Chertsey, Surrey KT1 6 9AP - England - Telephone 01 932 564 999 - Fax 01 932 564998 - e-mail: aerrvb@husonmedia.com to whom all correspondence, copy instructions and artwork should be addressed. }MlHn «. ' '\r ft- V FROM CC CHEMAT1C CAPTURE PRIliPICE EMBEDDED SIMULATION PLH DESIGN A p«worful capture lailorod foi todays engineer and Signed to allow rapid tr nlry or complu^ ^eh-ornatE-cs for simulation and PCB Layout. A cu^lomisod [FnpIdmpfiMtl^n of tho Industry standard Berkeley 3 PICK 3F 5 engine with extensive Optimisations Snddi^aitCMI^nLi lor tPUd Tni^d mack- fi^rtiulfrt^ri and circuEl nnimailon. Tho worlds first and bast schema lie based microcontroller co-simulation r.oftwnr^. Frotou s VSM allows you to simulate tho Interaction fcKtween software run ruing on a rtiierMOntnflliOf and any analog or digital cl££ Ironies connected to it. This stream linos tho prejecl lifecycle and obviates tho need for expensive hardware analysis tools;. J 3 ST r= E 5 i l VIH ■ TP n rrvl A modern and professional Payout package which seamlessly integrates with the ISIS capture TtuflwarO. Features such dS autoplaeement and ,iuto routing, interactive DRC and pn inluJtivr> interface atl wrve to inpilmiM prnrtutthdfy pnd reduce time to mariwf. lirti. CONTACT US NOW A technology pioneer In the EDA industry since 193 S. reoulf*»i-thlt or Technical luppert direct from the prog m m an then. request m FREE evaluation copy. FlOvrlbfo pacing of and prFOlng tailored to -cui-lomcr requirements. Email! m to ■' liibl.Ollteir.CS.Uh