MAY 2007 £3.80 www.elektor-electronics.co.uk SMART FAIRCHILD ASYNCHRONOUS MOTOR CONTROL E'L*F RECEPTION MOTHER EARTH ON THE RADIO PROJECTS 4 SHOCKING - Seismograph & Magnetometer ■ PROGRAMMING - Universal JTAG Interface ■ TX-ING - RDS Test Transmitter - USB FliteSim lectrooRB 770268 45112 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. Jacob's Ladder High Voltage Display Kit jC KC-5445 £11.75 + post & packing (jjA With this kit and the purchase of a 12V ignition coil (available from auto stores and parts recyclers), create an awesome rising ladder of noisy sparks that emits the distinct smell of ozone. This improved circuit is suited to modern high power ignition coils and will deliver a spectacular visual display. Kit includes PCB, pre-cut wire/ladder and all electronic components. • 12V car battery, 7AH f SLA battery or 5Amp DC power supply required Speedo Corrector MKII Kit Mi||l KC-5435 £14.50 + post & packing When you modify your gearbox, diff ratio or change to a large circumference tyre, it may result in an inaccurate speedometer. This kit alters the speedometer signal up or down from 0% to 99% of the original signal. With this improved model, the input setup selection can be automatically detected and it also features an LED indicator to show when the input signal is being received. Kit supplied with PCB with overlay and j[ 4 - l all electronic components _ C ' -J with clear English M instructions. L»Trr- . ' HIGH VOLTAGE 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 • Max & min RPM adjustment • Optional knock sensing • Optional coil driver • Kit supplied with PCB, and all electronic components. 50MHz Frequency Meter MKII Kit KC-5440 £20.50 + post & packing This compact, low cost 50MHZ Frequency Meter is invaluable for servicing and diagnostics. This upgraded version, has a prescaler switch which changes the units from Mhz to GHz, kHz to MHz and Hz to kHz, and has 10kHz rounding to enable RC modellers to measure more accurately. Kit includes PCB with overlay, enclosure, LCD and all electronic components. Other features include: • 8 digit reading (LCD) . jjxk • Prescaler switch (jufTIW • Autoranging Hz, kHz or MHz • 3 resolution modes including 10kHz rounding, 0.1 Hz up to 150Hz, 1Hz up to 16MHz and 10Hz up to 16MHz x )' ' nioT Ved — ’ \ N Requires 5VDC wall adaptor (Maplin L66BQ Deluxe Theremin Synthesiser MKII Kit KC-5426 £43.50 + post & packing By moving your hand between the metal antennae, create unusual sound effects. The Theremin Mkll allows for the adjustments to the tonal quality by providing a better waveform. With a \ ' multitude of controls this :> mot/e < J^ ecf instrument's musical potential f Jm L .2007 — is only limited by the skill / and imagination of it's / J player. Kit includes stand, j Mwjf * PCB with overlay, machined case lffir with silkscreen printed lid, loudspeaker, pitch and volume antennae and all specified electronic components. ™ Requires 9-12VDC wall adaptor (Maplin #UG01 B £13.99) KC-5442 Ignition System Fuel Cut Defeat 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 that the boost level and fuel mixture don't reach unsafe levels. + • Kit supplied w- ^ T" — ■ with PCB, and all electronic Li J * , -4*4^. components, f* | j _ . :: \ ™ KC-5386 Hand Controller KC5444 Coil Driver Ignition Coil Driver KC-5443 £13.00 + post & packing * \ s 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. Note: Prototype shown Variable Boost Kit for Turbochargers KC-5438 £6.00 + post & packing It's a very simple circuit with only a few components to modify the factory boost levels. It works by intercepting the boost signal from the car's engine management computer and modifying the duty cycle of the solenoid signal. Kit supplied in short form with PCB and overlay, and all specified electronic 1 ^ components. -« 1 1 ’ JHW Note: Prototype » shown Knock Sensor KC-5444 £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 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 n • { y ■ BitScope PC Oscilloscopes <& Analyzers DSO Test Instrument Software for BitScope Mixed Signal Oscilloscopes 4 Channel BitScope 2 Channel BitScope Pocket Analyzer 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. 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. www . bitscope .com Ten Commandments of Electronics 1 . Beware the lightning that lurketh in an undischarged capacitor, lest it cause thee to be bounced upon thy buttocks in a most ungentlemanly manner. 2. Cause thou the switch that supplies large quantities of juice to be opened and thusly tagged, so thy days may be only on this earthly vale of tears. 3. Prove to thyself that all circuits that radiateth and upon which thou wor- keth are grounded, less they lift thee to high frequency potential and cause thee to radiate also. 4. Take care thou useth the proper method when thou taketh the measure of high voltage circuits so that thou doth not incinerate both thee and the meter; for verily, thou hast no account number and can easily be replaced, the meter doth have one, and as a consequence, bringeth much woe unto CEO, Accounts & the Supply Department. 5. Tarry not amongst those who engage in intentional shocks, for they are not long for this world. 6. Take care thou tampereth not with interlocks and safety devices, for this will incur the wrath of thy Seniors and bringeth the fury of the Safety Officer down about thy head and shoulders. 7. Work thou not on energised equip- ment, for if you doth, thy buddies will surely be buying beers for thy widow and consoling her in other ways not generally accepted by thee. 8. Verily, verily I say unto thee, never service high voltage equipment alone, for electric cooking is a slothful process and thy might sizzle in thine own fat for hours on end before thy Maker sees fit to end thy misery and drag thee into His fold. 9. Trifle thou not with radioactive tubes and substances, lest thou com- mence to glow in the dark like a light- ning bug, and thy wife be frustrated nightly and have no further use for thee except thy wage. 1 0. Commit thou to memory the works of the Prophets, which are written in the Instruction Books, which giveth the straight dope and which consoleth thee, and thou cannot make mistakes — yeah, well, sometimes, maybe. (author unknown) SD rad io receivers use a bare minimum of hardware, relying instead on their software capabilities. This SDR project dem- onstrates what's achievable, in this case a multi-purpose re- ceiver covering all bands from 1 50 kHz to 30 MHz. It's been optimised for receiving DRM and AM broadcasts but is also suitable for listening in to the world of amateur transmissions. Besides natural events like earthquakes, humans can also cause seismic tremors, examples are extrac ting natural gas or nuclear tests. These are generally not audible or noticeable from a large distance, but they can be detected with a sensitive vibration sensor. The seismograph descri bed here makes that possible. 24 Seismograph Mobile phones, Wi-Fi and satellite communications are increasingly making use of ever higher frequencies stretching up into the Gigahertz bands. That doesn't mean that there is nothing interesting going on at the other end of the radio spectrum. We build a simple receiver and tune into some of the more bizarre signals in the extremely low frequency (ELF) domain. CONTENTS Volume 33 May 2007 365 This adaptor was originally intended to allow pro- gramming of the memory and CPLD of a PSD81 3 device. As it turned out, it's much more umversa than that! Our adaptor connects to a PC parallel port and uses the JTAG IEEE 1 149.1 protocol. 56 Universal JTAG Programmer 62 68 72 28 42 44 66 projects Software Defined Radio Thank you for Flying USB-FliteSim Seismograph ATtiny as RDS Signal Generator Asynchronous Motor Control using Atmel Evaluation Board Speedmaster Universal JTAG Programmer Magnetometer Temperature from a Distance E-blocks Graphic Display technology ELF Reception Smart Power Modules Power to the LEDs New Technologies, new Tools 50 Speedmaster Here is the circuit voted winner of the International R8C Design Competition by Elektor Electronics readers: an intelligent 3D accelero- meter that not only measures acceleration on all three spatial axes, but also calculates the total distance moved. And, as promised, a ready-assembled printed circuit board! info & market 6 Colophon Mailbox News & New Products Sneak Preview infotainment 76 Hexadoku 77 Transverter for the 70cm band (1981) lektor lectronics Volume 33, Number 365, May 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, 1 000 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. Underthe 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 Editor: 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: Antoine Authier, Ton Giesberts, Paul Goossens, Luc Lemmens, Jan Visser, Christian Vossen Editorial secretariat: Fdedwig Fdennekens (secretariaat@segment.nl) Graphic design / DTP: Giel Dols, Mart Schroijen Managing Director / Publisher: Paul Snakkers Marketing: Carlo van Nistelrooy Customer Services: Margriet Debeij (m.debeij@segment.nl) Advertisement 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 Fdead 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 ClmSccin 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) >4 ISO 1 4230-4 (Keyword 2000) S IS09I4I-2 SJI850VPW S JI850 PWM • 9600 or 38400 baud • Supported by more software than any other OBD interface • Inexpensive • Full Speed USB I . I • Automatic protocol detection • Package includes cables, software CD, and Quick Start Guide • Buy from your local UK distributors! www.ElmScan5.com/elekfor 6 elektor electronics - 5/2007 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 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 EasyPIC4 Development Board with on-board USB 2.0 programmer and mikrolCD 3 ini DEVELOPMENT SYSTEM 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- trollers (it comes with a PIC16F877A). HARDWARG ICD ON-BOARD USB 2.0 ON-BOARD PROGRAMMER HIGH DEVELOPMENT PERFORMANCE DEVELOPMENT BOARD 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) mikroPascal(AVR) $149.00 USD rnikroBasic(AVR) (-30%) $99.00 USD $149.00 USD rnikroPascal(AVR) (-30%) $99.00 USD mikroBasic(dsPIC) $149.00 USD mikroPascal(dsPIC) $249.00 USD mikroC(dsPIC) $249.00 USD Find your distributor: mikroBasic(dsPIC) (-30%) $99.00 USD mikroPascal(dsPIC) (-20%)$1 99.00 USD mikroC(dsPIC) (-30%) $175.00 USD 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 onboard 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. Easy8051 A 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 onboard 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 Hameg function generator Dear Jan — I read with great in- terest your overview of function generators (March 2007, Ed.). I spotted an error though in the specs you printed for the Hameg HM8030-6. As the designer of the instrument, I should point out that the 8030-6 does have a VCF input — it is accessible at the rear side of the mother- board module HM8001-2. This function is also described in the user manual. Also at the rear side is the output supplying the sawtooth used by the swept fre- quency generator. This signal en- sures the correct triggering dur- ing the swept frequency measure- ment and is particularly useful for bandwidth measurements. Michael Waleczek (Germany) Thanks for that Michael, you are right , the VCF input should have been included in the table. The two outputs are mentioned in the user manual. Interested read- ers may find the 8030-6 specs sheet and manual on the Hameg website at www.hameg.com. Freescale at last Dear Editor — I was thrilled to see Elektor taking the lead again by covering Freescale micros in a way suitable for beginners. I just wanted to let you know that I worked on a compact baseboard for the Freescale 9S08GB60. My 'GB60 Board' is compat- ible with the open-source BDM you mentioned, as well as the SpYder BDM you sell (well done on the low pricing for that!). My homepage is at www.qdev.de for all interested readers to visit. Stefan Robl (Germany) We are pleased and not a little proud that our publications on Freescale micros and the ac- companying low-cost SpYder kit have been received with great enthusiasm from our readers. Freescale , as part of a new strat- egy to broaden their markets , has chosen Elektor as one of their vehicles to reach tens of thousands of electronics enthusi- asts , lab workers and students , rather than a handful of high-end professional customers. Elektor will publish further MC9S08 projects later this year. Wrong circuit symbol Dear Jan — may I just point out that in your article 'LDO Regula- tor' (Design Tips, February 2007) you used an incorrect circuit sym- bol for the FET. The BSS1 39 is a 'depletion-mode' MOSFET; your symbol is for an enhancement- mode device. Dave Moffat (UK) You are right Dave. The correct device symbol is printed here. Note the solid line between drain (D) and source (S) termi- nals , indicating the self-conduct- ing FET ’ which starts to work at UGS=0 V. + 5Vllnreg P — — — — — — — — — — — — — — — — — Corrections & Updates Shortwave Capture December 2006, p. 24-33, ref. 030417-1. Inductors LI 1 and LI 4 have been transposed on the component overlay. This may be corrected by transposing the component ref- erences in circuit diagram Figure 2. In the components list, LI 1 should be marked as 1 pi H2 . The PCB design has a length of copper track missing at pin 1 9 of the MAX7219. The connection should be made with a piece of wire. Updated Gerber files were sent to ThePCBShop on 2 March 2007 The corrected parts list and PCB artwork (pdf file) may be downloaded from our website. Depending on the response of the readout to fast turning of the rotary encoder, and the encoder used, the value of capacitor C40 may be changed a little. Although on MIX1 the marking is with pin 6 instead of pin 1, the device can be mounted as shown because of its internal symmetry. For SSB reception, the amount of frequency pull that can be ob- tained from the CSB455 device (X3) will depend on the exact type and brand. The CSB455 supplied by Barend Hendriksen and used in our prototype gave good results. Suggested methods of obtain- ing sufficient pull from nondescript CSB455 devices may be found on our Forum. AVR drives USB March 2007, p. 34-38, ref. 060276-1 In the components list, IC4 should be marked ULN2803, not ULN2003. Also, R4 should be lkQ5, not 1 kQ. Sputnik Time Machine January 2007, p. 42-45, ref. 050018-1 In the components list, 'R15' should read 'R9'. Capacitor C8 is listed as 4piF7 400V, but appears as 1 0|jF/350V in the schematic. Either value will work as only little current is drawn from the high- voltage supply, and even 4jjF7/ 1 80V will work in this circuit. 8 elektor electronics - 5/2007 Battery voltage from the USB? Dear Jan — I found a web- site showing details of a bat- tery supply implemented by 'stealing' power from the USB port, see www. hackaday. com/2005/01 /20/how-to- make-a-usb-battery/. Can you tell me if this is and good and safe to use as a power source for my MP3 player? The original battery lasts for a good half hour only. I'm sure Elektor readers will also find this of interest. Fred Jackson (USA) Although the method described on the site will work in practice , it is a tad wasteful of energy. One of the comments under this DIY tip hints that it is better to connect four penlight batteries in series and then add a diode in series with the USB connec- tor. This will yield a supply volt- age close to 5 V. Another op- tion is to line up four penlight rechargeables in series (NiMH or NiCd), this should also give you about 5 volts but without the diode in series. RFID Reader fine tuning Dear Jan — I read with great interest your article on improv- ing the sensitivity (or, detection range) of the Elektor RFID reader (Labtalk, January 2007, Ed.). I only have a grid dipper avail- able for my measurements and I have resolved resonance at 12.1 MHz with about 400 kHz worth of incertitude. The coupling between the etched coil on the RFID Reader board and the me- ter coil has to be very light and you need to take the average of the 'rising' and the 'falling' dip observed on the meter ('rubber band' effect, Ed.). The accuracy so obtained I reckon is sufficient for amateur use, also considering the Q factor. I have also tested one of your RFID cards and found it to res- onate at about 14.8 MHz ±200 kHz using the above meth- od. Unfortunately only one card was available. Would you be so kind as to inform me about the exact resonance frequency of Solution to Hexadoku March 2007 5 C D 6 4 E 0 1 8 A 2 3 7 B 9 F 2 1 E 3 9 A 5 6 B C F 7 0 8 D 4 9 7 F 4 B 3 8 C D 0 5 1 A 2 E 6 0 A 8 B 2 7 F D 6 E 9 4 3 5 1 C D 0 9 C 7 B 3 E 1 6 A 2 F 4 5 8 B F 7 E 1 6 9 8 5 4 0 D 2 A C 3 3 4 1 2 F 0 A 5 C 7 8 9 E 6 B D A 8 6 5 C 4 D 2 3 B E F 1 9 7 0 C B A D 5 9 4 F 0 1 7 E 6 3 8 2 1 E 2 9 0 C 7 A F 3 6 8 B D 4 5 7 3 5 8 6 2 1 B 4 D C A 9 F 0 E F 6 4 0 D 8 E 3 9 2 B 5 C 7 A 1 8 D 3 1 E F 2 7 A 9 4 C 5 0 6 B 4 2 C F A 1 B 0 7 5 D 6 8 E 3 9 E 9 B A 3 5 6 4 2 8 1 0 D C F 7 6 5 0 7 8 D C 9 E F 3 B 4 1 2 A your cards, mine is a Philips My- Fare supplied with the magazine (September 2006, Ed.). Thanks for your interest and please inform me if my measure- ments are any good. Patrick Dourlet F4EKN (France) Thanks for your response to my article and glad to see that you confirm my findings. The resonance frequency of the printed coil on the MyFare RFID cards is purposely set slightly higher than the theoretical value of 13.56 MHz because detun- ing ( down pulling) occurs when the card is within the E/M field of the transmitting coil. Once E/M coupled the two coils form a mutually damping , over- coupled L section. So, although you (and we) correctly measure about 14-15 MHz with a lightly coupled dip meter , in actual fact optimum resonance occurs at a slightly lower frequency (13.6 MHz approx.) when the card is actually read. As I wrote in my article , the frequency that gives the largest card detection range can only be found empirically. I stopped my experiments once a range of about 5 cms was achieved but more may well be possible. Due to the production methods and components used, a toler- ance of about 1 MHz (i.e. 7%) should be taken into account in the resonance frequency of our RFID cards. This is well within the standards for 13.56 MHz RFID systems. The dip meter in our laboratory is about 25 years old, cheap and flaky and I would not ex- pect it to offer an accuracy that's anywhere near the figures you mention. I can confirm however that a resonance was measured just above 14 MHz. Patrick responds: Dear Jan, thank you for your re- ply wich was very pertinent and interesting. That's just funny to say 13.56 with 7% tolerance. Why not 13.5612263 ± 1 MHz hi! As we say in our ham community, HF articles are scarce in Elektor but they are always of quality. Best regards, Patrick. Elektor Flash Micro board (1999) Hello Jan — Further to my e-mail earlier today regarding my com- ms problems with the Flash micro- controller Starter Kit. I looked on Burkhard Kainka's own web site & found a FAQ for 'Microcontrol- ler Basics'. It makes reference to updates to ATMELISP, MicroFlash, & TASMEdit specially for use with the updated AT89S8253 micro- controller. I downloaded these and.... success! Once I knew the file names, I found MicroFlash53, & TASMEd- it53 on your supplied CD in a separate directory. I did not re- alise the significance of the '53' to match the controller's last two digits. No versions of ATMELISP are on your CD (either for AT89S8252 or AT89S8253), but that is OK if it is not your software. However, perhaps a readme.txt file could be included on the CD to direct people to use the relevant software for TASMED- IT & MICROFlash and a link to the correct edition of ATMELISP, depending on their type of microcontroller. I am now very much look- ing forward to learning about Microcontrollers. Chris Johnson (UK) Since publishing the article on the Flash Microcontroller Board in December 1999 (I), the AT889S8252 went obso- lete. Several notices appeared in Elektor advising readers of the '53 device as a possible replacement for the '52, along with updated, improved, soft- ware. Chris is now one of about 3,600 happy users of the Elektor Flash Micro board. 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, 1000 Great West Road, Brentford TW8 9HH, England. 5/2007 - elektor electronics 9 INFO & MARKET NEWS & NEW PRODUCTS Next generation energy-measurement 1C and reference design Microchip Technology, recently announced the MCP3909 energy- measurement 1C and reference de- sign. The highly accurate 1C com- bines low power consumption with an SPI interface and active power- pulse output, making it adaptable to a wide variety of meter designs. Together with the MCP3909 3- Phase Energy Meter Reference De- sign, the 1C enables designers to develop and bring meter designs to market quickly. The MCP3909 1C has two 16-bit delta-sigma Analog-to-Digital Con- verters (ADCs) onboard that can be accessed through its SPI inter- face, while simultaneously provid- ing a pulse output with a frequen- cy proportional to the active-power calculation. This simultaneous out- put of data makes the 1C flexible and easy to use, as well as adapt- able to a variety of meter require- ments. Additionally, with its very low, 0. 1 % typical measurement er- ror over a 1000:1 dynamic range, the MCP3909 1C easily fits into meter applications requiring high accuracy. Its extremely low sup- ply current of only 4 mA makes it suitable for many single- and three- phase energy meter designs, and helps customers remain within their power budget. The MCP3909 3-Phase Energy Meter Reference Design (Part # MCP3909RD-3PH1 ) in-cludes three MCP3909 ICs, plus a PIC1 8F2520 and a PIC18F4550 microcontrol- ler. The PIC1 8F2520 performs all power calculations in the reference design, while the PIC18F4550 provides a USB interface to desk- top software. The software pack- age that comes with the reference design enables meter calibration and the ability to read active and apparent power, as well as RMS current and RMS voltage. The ref- erence design is expected to be available for purchase in March at www.microchipdirect.com, at a price of $1 75 each. For additional resources, visit Mi- crochip's online Utility Meter De- sign Center at www.microchip.com/meter ( 070017 - 111 ) Easy- PC is more popular than ever Demand for Easy-PC, the world's leading entry-level PCB design software continues to grow. New users are attracted by the fact it still continues to offer product fea- tures and options found in many of the world's leading PCB design sy- stems for the price of standard PC software on the High Street. Easy-PC For Windows may have been launched in the early Win- dows operating system days 10 years ago, but the release of VI 0 demonstrates it still leads this mar- ket sector. Windows Vista compati- bility, Spice Simulation, Library cre- ation Wizards and 3D Viewer are just some of the new features now available in this exciting product. The original Easy-PC was launched in 1989, winning a British Design Award the same year. Easy-PC For Windows is Microsoft Accredited and there are has over 45,000 Easy-PC users across more than 1 00 countries. Re- nowned for offer- ing profes- sional level lay- out for PCB designers at computer store prices, Number One Systems is now of- fering existing loyal users an op- portunity to upgrade at a special price to benefit from the investment and features they've incorporated for a 1000-pin limited version. inVersion 10. (070212-1) New Easy-PC systems start at £227 www.numberone.com Vero Technologies purchases moulded enclosures business from APW Vero Technologies has acquired all the moulded enclosure and card guide standard product lines from APW (in administration), and man- ufacturing of all items has recom- menced from the original tooling, guaranteeing continuity of supply. Such well know brand names as Veronex, IDAS, Apollo, General Purpose Box, Patina and many oth- ers are back in full scale produc- tion, enabling companies who had specified the products as the hous- ing for their equipment to continue to purchase. A large number of ac- cessories such as battery holders, various designs of card guides, both general purpose and specif- ic to the KM6 subrack system, are also available. In addition to supplying the enclo- sures as standard products, Vero Technologies offer the additional service of customisation, with drill- ing, punching, legend silk screen- ing and custom front panel man- ufacture provided on short lead times. Vero Technologies also manu- factures the iconic Veroboard, also know as Stripboard, Verow- ire wiring pens, ex- tender boards, loop terminal assemblies, PCB test points, solder pins and a wide range of electronic prototyp- ing boards and bread- boards for the elec- tronics engineer. ( 070212 - 3 ) www.verotl.com 10 elektor electronics - 5/2007 LP Radio system-on-a-chip named finalist of 2007 EE Times ACE Award for Ultimate Product of the Year Cypress Semiconductor Corp. an- nounced that its WirelessUSB(tm) LP radio system-on-chip was named as a finalist for CMP Technology's EE Times third Annual Creativity in Electronics (ACE) Awards for 2007 Ultimate Product of the Year in the RF/Microwave category. The Ul- timate Products of the Year are awarded to the most significant product introduced in the last 12 months in each of seven catego- ries, as determined by large-scale peer review. WirelessUSB LP (CYRF6936) is a highly integrated 2.4-GHz radio transceiver plus digital baseband that enables customers to replace cables without compromising end- user experience. Manufacturers of Human Interface Devices (HIDs) and other wireless applications avoid power-consumption issues with WirelessUSB LP's advanced power-optimization techniques that extend battery life to greater than one year. Likewise, the device ad- dresses range and robustness con- cerns with Cypress's AgileHID(tm) protocol with patented frequency agile Direct Sequence Spread Spectrum (DSSS) technology for best-in-class interference immunity. Cypress recently announced that WirelessUSB LP has earned over 1 75 design wins in under a year. Cypress's WirelessUSB LP offers an unparalleled feature set to enable superior interference immunity, low bill-of-materials (BOM) costs, higher data rate applications, and faster time-to-market for keyboards, mice, gaming devices, present- er tools, and remotes, as well as other simple, multi-point-to-point wireless applications. Featuring a highly integrated radio transceiver plus digital baseband on a single chip, it operates between 1 .8 and 3.6 volts, using advanced power- saving techniques to extend bat- tery life in devices such as wire- less mice. WirelessUSB LP uses Cypress's patented frequency ag- ile DSSS technology to offer best- in-class interference immunity for a 2.4-GHz radio system. This combi- nation of low power consumption, interference immunity and low cost make it ideal for wireless HID applications ( 070212 - 2 ) www.cypress.com Altium Designer busts high-speed design myths Altium Limited announced the ad- dition of a raft of new productiv- ity-enhancing features for its Altium Designer unified electronics devel- opment system to assist engineers deal with the ever changing nature of today's mainstream board-level design and its convergence with the wider electronics development process. With the latest electronic compo- nents offering a wide range of fast- switching I/O and dense packag- ing options, particularly in the latest generation programmable devices, Altium has focused de- velopment of its Altium Designer system to include a wide range of high-level interactive and automat- ed tools designed to allow all engi- neers to assess, manage and trou- bleshoot signal integrity issues. Altium Designer now adds inter- active net length tuning, enhanced board layer navi- gation and more powerful polygon area fill place- ment modes to its arsenal of high- speed, high-den- sity capabilities that already in- cludes interactive differential pair routing, imped- ance-controlled routing, built-in signal integrity analysis and ter- mination match- ing, automatic BGA escape routing, automatic FPGA board-level pin optimization and full PCB-FPGA bi-directional design synchronization. Altium Designer's intelligent inter- active routing system has been en- hanced with the addition of a new interactive length tuning tool spe- cifically for high-speed designs. This new feature allows designers to quickly optimize and control net lengths by dynamically inserting 'ac- cordion' segments into a track. Tun- ing can be manual or rules-driven, and designers can select from a number of amplitude styles available in the system. This feature combines seamlessly with impedance-con- trolled, differential pair and multi- trace routing capabilities to give Altium Designer users a comprehen- sive interactive solution tuned for the high-speed, high-density board design projects that are being sig- nificantly impacted by modern day programmable devices. Several board-level system enhan- cements, and more, are now avai- lable with the latest software up- date called Altium Designer 6.7. All Altium Designer 6 license hol- ders can download this update for free at www.altium.com/Commu- nity/Support/Softwarellpdates/. Altium Designer 6 is available for purchase through Altium's sales and support centres worldwide. For information on pricing and flexible product licensing options, customers should contact their local Altium sales and support center. ( 070212 - 4 ) www.altium.com / contacts. 5/2007 - elektor electronics 11 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. ARM programmer £ 89.20 AVR multiprogrammer £ 77.65 Bluetooth board £ 117.80 Bluetooth CODEC board NEW £ 119.00 CAN board £ 33.50 CPLD board £ 117.95 FPGA daughter board £ 104.50 Graphical LCD display NEW £ 89.30 Internet board £ 71.95 IR/IRDA transmitter receiver £ 58.50 LCD board £ 19.30 LED board £ 14.65 MIDI board NEW£ 35.70 Power board £ 35.95 Prototype board £ 20.50 Quad 7-segment display RS232 board Screw terminal board Switch board USB multiprogrammer X-10 home automation board Software (single user) Assembly for PICmicro MCUs C for ARM microcontrollers C for AVR microcontrollers C for PIC microcontrollers Flowcode for PICmicro MCUs v3 (pro version) £118.00 Programmable Logic Techniques £117.90 £117.90 £118.00 £118.00 £118.00 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! Helping You Succeed Use microchipDIRECT to: Register today! Order directly from Microchip, 24 hours a day, 7 days a week with a credit card or credit line Receive competitive, direct volume pricing on all devices Check our product inventory Order broken reels at steep discounts Use fast and inexpensive production programming (now available) Place and maintain your order securely from any network connection Assign a PO number to your order Create a unique part number for any item ordered Receive e-mail notification of orders, deliveries, quote status and more The Microchip name and logo, PIC, and dsPIC are registered trademarks of Microchip Technology Incorporated in the USA and other countries. All other trademarks and registered trademarks are the property of their respective owners. © Microchip Technology 2006. All rights reserved. ME156Eng/05.06 ti lij •*+ 2* J £> u Ito. yj 1 - SUES Does your business need more support and resources? Successful organizations recognize the value of a strategic supplier relationship to help them deliver innovative products to their markets in a timely and cost-effective manner. Microchip Technology supports more than 45,000 customers worldwide, and we’re committed to helping you succeed. In addition to our high-performance silicon solutions, Microchip provides a long list of support functions that reduce time to market and lower your total system cost. And we have significantly expanded our local technical resources. SDR SD (software-defined) radio receivers use a bare minimum of hardware, relying instead on their software capabilities. This SDR project demonstrates what's achievable, in this case a multi-purpose receiver covering all bands from 150 kHz to 30 MHz. It's been optimised for receiving DRM and AM broadcasts but is also suitable for listening in to the world of amateur transmissions. The designer’s aim for this project was to create a receiver displaying high li- nearity and phase accuracy. Develop- ment was focussed on the characte- ristics that were most important for a top-notch DRM receiver and the end result is a receiver with remarkable in- terference rejection characteristics. Re- ception of DRM stations using DREAM software produced signal-to-noise ratio (S/NR) values of well over 30 dB. The design principle of the receiver gua- rantees an extremely flat filter-curve response. This works out rather well not only for DRM but also for the audio quality of AM broadcasts, which sound almost as good as VHF FM. It’s worth noting too that some transmitters that do not conform to the normal band- widths laid down for medium wave (9 kHz) and shortwave (10 kHz) as rigidly as perhaps they should. Whilst these stations produce no observable sound improvement for listeners using normal receivers (since their IF filters limit the bandwidth and in the process the fre- quency response too), this is not the case with SDR, where it’s no problem to select a wider bandwidth at will. It gets even better: in software receivers the fine-tuning capabilities of PC deco- der programs give you the capability of determining the desired bandwidth with notch filters to the automatic le- vel control (ALC) settings along with selecting all the usual receive modes from AM by way of DRM and SSB to CW. Further refinements can be added for SWL (shortwave listening) applica- tions. If for instance you wish to incre- ase the sensitivity on the upper ama- teur bands this is easily arranged by using two switchable antenna inputs and providing an optimised preselector circuit or preamplifier in one of them. The receiver’s printed circuit board itself provides a pretty basic RF front end, which is nevertheless perfectly adequate for broadcast reception. A long wire antenna of adequate length will lift the strength of signals above atmospheric noise level to ensure you miss virtually nothing. Hardware requirements Most SDR programs [1] require the Win- dows XP platform to operate satisfacto- rily. The most important hardware ne- cessary then is an SDR-capable sound card. We have developed a small cir- cuit for testing sound cards, described elsewhere in this issue under the hea- ding ‘Developer Tips’. Without perfor- ming this test first it’s utterly pointless starting to make the SDR receiver! All about USB The receiver is controlled over a USB connection and powered with +5 V in the same way (no additional mains power supply needed). For the USB in- terface in the receiver circuit (Figure 1) we selected the FT232R from our Scot- tish friends at FTDI. This modern USB- to -serial converter works without the need for a quartz crystal, as it is equip- ped with an internal R-C oscillator of adequate stability. The module (IC4) is used here in its ‘bit-bang’ mode along the lines of a fast parallel port. Eight data lines are available for use and the- se can be driven in whichever way we choose. Two of the lines are used as an I 2 C Bus and control the frequency of the receiver. Three wires connect the input multiplexer to one of up to eight anten- na inputs with and without filtering. Two additional inputs serve to control the IF amplification of the receiver. In this way the receiver operates entirely under remote control. Kiss good-bye to all those knobs and controls of bygone radio days . . . Please pay particular attention to de- coupling the power supply. One rea- son for this is because the USB chip 14 elektor electronics - 5/2007 vcc L2 rvw\_ C8 1 0n GND K1 1 16 15 USB-B connector GND J2 27 28 17 L3 C16 lOOn 26 3V3 Q VCC vcc 4u7 [l6V GND GND GND GND C7 lOOn GND VCCIO USBDM USBDP o o > IC4 TXD RXD CBUSO CBUS1 CBUS2 CBUS3 CBUS4 DTR FT232R CTS RTS DSR DCD TESTi Q q q Rl o z z z <(500 RESET OSCI OSCO 3V30UT T GND 1 _ 5 23_ 22. 13_ li 11 2 R2 R3 330 330 10 13 17 9_ li. 6 31 V O O Q a a a > > > AVDD VDDL IC3 PDM/OE CL0CK1 CL0CK2 CL0CK3 CL0CK4 CLOCKS CL0CK6 SDA SCL VCXO/WP CY27EE16ZE AVSS VSSL 5 o co X X > C12 lOp 1 1 20 CO H h > C13 H ■ 10MHz lOp 11 8 _ 9_ _ 12 _ 11 _18_ 3 TEST CLK GND VCC 2 IC1A ts> 1T> c T vcc 5 tJL Q_SW_N Q_SW I SW N I SW C5 IC1C lOOn 0 C6 lOOn "(i) IC2E 1 IC1 = 74AC74 IC2 = 74HC4066 IC5 = TL084CN IC7 = 74HC4066 Gk vcc VCC [ci4 . |ci5 J m h 470u 4u7 16V ( GND Figure 1. Diagram of the receiver circuit, which in fact comprises just a tuning oscillator and a mixer. 5/2007 - elektor electronics 15 SDR FT232R operates internally at the same frequency range that we are receiving through the antenna downlead and we don’t want any of this RF to leak across from one stage to another. That said, the decoupling within the chip itself is remarkably good and the residual RF on the control port lines is barely detectible. Consequently we can cont- rol the HC4051 RF input multiplexer di- rect from the control port lines, without traces of the processor clock appearing in the wanted signal region. Using its built-in 3.3 V voltage regu- lator, the FT232R provides the opera- ting supply for the programmable clo- ck generator CY27EE16ZE, avoiding the need for an additional voltage re- gulator. The rest of the circuit (Figure 1) operates exclusively on 5 V. Sever- al different smoothed and filtered vol- tages are produced, to guarantee good RF decoupling on one hand and to en- sure suppression of audio frequency interference on the other. This is parti- cularly crucial at the RF input stage of the receiver, from which the signal is fed via the mixer to the IF circuitry. For this reason a large electrolytic is provi- ded at this point (VCC_HF) to ensure proper ‘peace and quiet’. Programmable VFO The SDR calls for an oscillator frequen- cy running four times higher than that of the signal received, in order that the necessary phase filtering can be divi- ded by four. If we are aiming to receive signals up to 30 MHz, then the oscilla- tor needs to run right up to 120 MHz. DDS oscillators are very popular in HF projects today but at 120 MHz a DDS is dearer, more power-thirsty and far less controllable. Accordingly we shall look away from DDS oscillators and use a programmable clock oscillator with internal PLL here. Many Elektor Elec- tronics readers will remember the CY- 27EE16ZE back from the February 2005 issue. This clock oscillator, developed specially for digital applications, per- forms equally well in RF circuitry. The frequency resolution does not quite match that of a DDS but the phase ac- curacy of the output signal achieves comparable results. Restricting pow- er consumption to a relatively modest amount is important with this project, since we must not draw too much cur- rent from the USB port. The chip is programmed over the I 2 C- Bus using lines SCL and SDA. The in- ternal VCO operates in the frequency range 100 to 400 MHz, stabilised by means of the 10-MHz crystal and a PLL. Its output signal then goes via co- unters to the desired outputs. Here we select the clock output Clock5, where a VFO signal between 600 kHz and 120 MHz is available for further processing in the 74 AC 74 counter. The principle of the I-Q mixer has been described already in Elektor Electro- nics 12/2006. A two -stage mixer is cre- ated here from a total of four analogue switches inside an HC4066 IC. This is controlled by two phase-shifted oscil- lator signals, which themselves are produced with a 74HC74 counter. Sup- posing the programmable clock oscil- lator produces 24 MHz, then the mixer would need a drive of 6 MHz. The re- ceiver would in this case operate in a region of around ± 24 kHz either side of the centre frequency of 6 MHz. Vital here is a phase shift of exactly 90 degrees between the two oscillator si- gnals. Any deviation will lead to redu- ced suppression of the image frequen- cies. A 74HC4053 or 74HC4052 integra- ted changeover switch device would not make a good choice for the analo- gue switch because the signal transit delays in the internal decoders would then cause different phase errors to appear in every frequency range. Our chosen solution using the rather more basic switches of an HC4066 retains all four phases in sync. Since the 74AC74 counter is configured as a synchronous counter we would not expect to find any phase errors here either. In fact the receiver displays image frequency sup- pression of around 40 dB up to 15 MHz or so, although this value decreases beyond about 20 MHz (which we can tolerate given that these frequencies are not so heavily occupied). Signal processing The receiver is provided with several inputs, selected by the 74HC4051 input multiplexer (IC6). The antenna input ANT is fed by way of filters to the first three inputs. The first switch setting (wideband) uses only one input choke (L6), which shunts any audio frequen- cy signals at the input to ground. In the second position (Medium Wave) there is a low-pass filter with a boundary fre- quency of 1.6 MHz, using resistor R12 to attenuate excessive resonance. This filter suppresses interference to medi- um wave reception from overtone mi- xing with stations in the short wave range. The third position makes use of a simple R-C high-pass filter to attenu- ate strong medium wave signals. An additional input (PCI) can be se- lected if you wish to connect external tuned input circuits or preamplifiers. Fi- nally three more inputs are provided for future developments. The input filters on the printed circuit board are good to be getting on with and are certain- ly adequate for most applications. You can of course introduce steep low-pass filtering ahead of the filters provided if you want to be certain of blocking out overtone mixing in every possib- le situation. Or you might choose to fit different resonant circuits, selected by input switching. The particular input that is active at any given time is connected to the common output COM (pin 3). Coupling capacitors are provided either side of the switch. A bias voltage of about 2.5 V is provided to the switch from the source connection of the BF245 via a 1 -megohm resistor. This eliminates any distortion from large input signals that might arise when signals are limited by the protection diodes on the analo- gue inputs to the ICs. Input A7 delivers a calibration signal from Output 3 (Test-Clk) of the pro- grammable crystal oscillator. The oscil- lator produces a square-wave signal of 3.3 V peak-to-peak at 5 MHz. A signal voltage of around 5 mV at 5 MHz is produced at the voltage divider, cor- responding to a signal strength of S9 + 40 dB. This enables the field strength meter created in software to be calibra- ted without any further expenditure. JFET BF245 on the output of the input multiplexer serves as an impedance transformer. This provides a relative- ly high impedance termination of 100 kQ for the RF signal, enabling for in- stance a high-Q resonant circuit to be connected even to input In2. At the low-impedance output of the source follower we arrange to have a voltage of circa 2.5 V, fed via the mixer and the following op-amp all the way to the output. It is important that no audio frequency signal remnants appear at the source connection and for this rea- son the ‘critical’ supply Vcc_HF is also filtered very thoroughly. The FET itself provides additional decoupling of the supply voltage, but we don’t want any signal escaping from the Gate either that might fall in the IF region below 24 kHz. This is why an RF choke is con- nected directly to the antenna input, to shunt for instance any 50 Hz mains hum signal. Leading off from the Source connection are two 100-Q resistors that go to the two mixers for the I and the Q signals. 16 elektor electronics - 5/2007 [components : i LIST i I Resistors I | R1,R7,R19 = 100f2 | | R2,R3 = 330^ | R4 = 1 00f2 R5,R8,R1 3,R1 7,R20 = 100kf2 R6,R10,R14,R22 = 10k^ R9,R21 = 4kQ7 R1 1 ,R23 = 27kQ R12,R1 5,R18 = 470Q ■ R16 = 1MQ ■ I R24 = 1 k£2 I I R25 = 4^7 I I Capacitors I Cl ,C2,C5,C6,C7,C1 0,C1 1 ,C1 6,C1 7 # C1 9,C20,C21 ,C25-C28,C30,C32,C33,C 34,C36,C38,C39,C40 = lOOnF C3,C4,C9,C1 5 = 4jL/F7 16V radial C8,C1 8 = 1 OnF 1 Cl 2, Cl 3 = lOpF 1 ■ C14 = 470/jF 16V radial I I C22,C24,C35,C37 = 2nF2 I I C29 = 220pF I | C31 = lOOpF | Semiconductors IC1 = 74AC74 IC2JC7 = 74HC4066 IC3 = CY27EE1 6 (Cypress) IC4 = FT232R (FTDI) IC5 = TL084CN with socket (see text) I IC6 = 74HC4051 I I T1 = BF245 I I Inductors I L1-L4 = 10/iH L5 = 47/jh 16 = 2.2mH Miscellaneous K1 = USB-B socket, PCB mount K2 = stereo jack socket, 3.5mm, PCB I mount I I K3 = 2-way PCB terminal block, lead I | pitch 5mm | | PCI = solder pin I XI = 1 0MHz quartz crystal Ready-populated and tested PCB, order code 070039-91 Project software, free download 070039-1 1 Supplementary document, free download I PCB, bare, ref. 070039-1 from www.thep- I I cbshop.com I They improve the symmetry of the mi- xers, the ‘on’ resistances of which let through a certain amount of leakage. The mixers themselves are HC4066 analogue switch ICs ganged as chan- geover switches. The voltage of these too is set around 2.5 V, allowing them to be controlled without overdriving up to about 5 V peak-to-peak. The IF amplifier consists of two exact- Figure 2. The SDR receiver board. 5/2007 - elektor electronics 17 Figure 3. This lab sample board is not quite equivalent to the production version supplied through the Elektor SHOP ly equal branches that together pro- duce an attenuation of up to 40 dB at all times. When you are using 5 V sup- plies, the gain bandwidth (GBW) of the selected op-amp is important, in order to achieve tenfold amplification without phase errors for signals around 20 kHz. In the author’s test samples a TL084 turned out to be adequate. If you provide a socket for IC5 you will be able to try other, faster op-amps. The input stage works as a differential amplifier. In dimensioning the resistors what we are looking for is not the best common-mode suppression but rather an input resistance that’s as equal as possible across the inverting and non- inverting inputs. Tests show that good phase accuracy (and consequently high image-frequency suppression) depend on equal impedance existing on all four phases of the mixer. The input impe- dance amounts to around 5 kQ at all of the inputs. Note the load resistance of 4.7 kQ on the non-inverting input as opposed to 10 kQ on the inverting one. This is correct, since signal transit on this input gets dispersed in exact an- tiphase by inverse feedback, halving the input resistance to 5 kQ. In this way both inputs offer the same input resistance as close as matters. The 2.2 nF capacitors together with the mixer’s internal resistance and the 100 Q series resistors form simple low- pass filters with a limiting frequency of over 100 kHz, so as to keep remnants of RF well away from the audio frequen- cy stages. The limiting frequency lies far above the transfer frequency range, meaning that capacitor tolerances do not produce any discernible phase er- rors. You can use even ceramic disc ca- pacitors here. Tolerances between 10 and 20 % are not a problem with any of the capacitors in the signal path acting as high-pass elements with a limiting frequency of around 300 Hz. The final stage has a tenfold gain (20 dB), which can, however, be reduced to unity gain by the analogue switches. A total of three attenuation steps are provided: 0 dB, -10 dB und -20 dB. To avoid it being driven too hard, the gain can be reduced in software. As the receiver’s input displays high re- sistance to being overdriven the atte- nuator is placed in the final stage, so as to prevent overdriving of the output. This corresponds to gain control in an IF amplifier. Construction The printed circuit board shown in Fi- gure 2 uses standard wire-ended com- ponents as far as possible, with the ex- ception of the LSI (large scale integra- tion) chips FT232RL and CY27EE16, which unfortunately are available only in SSOP case format with a pin spa- cing of 0.65 mm. Figure 3 shows the laboratory prototype PCB with compo- nents fitted. The best way to begin is by soldering the two surface-mount device (SMD) chips in place. It pays to start first at the four corners, before soldering all the other pins generously. Superfluous solder can be removed with desolder braid, followed by thorough checking with a magnifying glass to avoid un- welcome surprises later on. The components with wire leads will present no difficulty. The circuit does not call for any special RF componen- ts or test points. Capacitors C12 and C13 should not be fitted initially. The CY27EE16 has presettable internal capacitors that should enable you to achieve a frequency of exactly 10 MHz without difficulty. C12 and C13 will be needed only if the crystal used requires greater loading capacity. Once all construction is complete you need to make a quick round-up with a multimeter checking for any short cir- cuits around the USB connections, as you certainly don’t want to damage the PC. 18 elektor electronics - 5/2007 Hook-up and alignment Before connecting the receiver to the computer’s USB port for the first time you will need to install the driver soft- ware for the FT232R. You can find this on the manufacturer’s website (www. ftdichip.com/FTDrivers.htm) or alter- natively in the software download for this article. Installation using CDM_ Setup.exe automatically removes any traces of older FTDI drivers on your computer. After this has been done Windows will find the correct driver automatically as soon as the receiver is connected. The same process pro- vides the PC automatically with an additional virtual COM-port interface. For this you do not even need to know which COM number is allocated to the device, as it effectively sets up its own direct connection to the FT232R. FT- D2XX.dll controls the eight data lines of the chip as for a parallel port, eli- minating at the same time all timing problems. To save time the multiple le- vel changes involved in controlling the I2C bus are loaded conveniently into a buffer and then fed out to the data lines in short order. The program Elek- torSDR.exe enables you to control all functions of the receiver (Figure 4) and can be found in the download archive as an executable file together with the Delphi source code. Also available for download is a supplementary .pdf do- cument that describes initialisation and commissioning. Decoder software Nearly all significant characteristics of the receiver are determined by settings in the decoder software on your PC. As the survey in [1] indicates, there are a number of different programs to choose from. You could perform your first test with SDRadio [2] for example. After this you will discover additional possibili- ties in DREAM [3] or G8JCFSDR [4]. Whichever program you select, it’s vital to set up the sound card correctly (this is described in the supplementary do- cument). Information on the programs can be found on the relevant Web pages and in the Elektor Electronics articles listed below. Further advice may be found on the author’s home- page (www.b-kainka.de) and will ap- pear also in due course on the project page at www.elektor-electronics.co.uk and, if necessary, in the Forum on the same website. ( 070039 - 1 ) Figure 4. Elektor Electronics SDR Tuning control program. Figure 5. Four AM stations in tuning range spectrum, as displayed by the SDRadio program. Web links: [1] www.nti-online.de/diraboxsdr.htm [2] www.sdradio.org/ [3] http://sourceforge.net/projects/drm [4] www.g8jcf.dyndns.org/ Literature: Burkhard Kainka: DREAM Team -Software for DRM reception, Elektor Electronics 4/2004, pp. 20 ff. Wolfgang Hartmann and Burkhard Kainka: 'Radio listening with Matlab — Diorama software DRM receiver', Elektor Electronics 4/2006, pp. 76 ff. Burkhard Kainka: l-Q: a hiqhly intelligent approach to quality radio, Elektor Electronics 12/2006, pp. 38 ff. 5/2007 - elektor electronics 19 Brendan Hughes Arguably, many RC modelling enthu- siasts would rather see a PC ‘crash’ than the latest model built with blood sweat and tears, not forgetting lots of time and money. In this respect, the follow a buzzword in modern elec- tronics: simulation. Simulating flights, landings and takeoffs for a given model is a great way of familiarising yourself with its response to your actions (and errors) on the RC transmitter. Excellent flight simulators are available these days that give very realistic results — to the extent of users actually starting to sweat and exhaust themselves try- ing to keep the model where it should be — up in the air! The circuit described in this article is the ‘glue’ between the ‘buddy’ (or ‘trainer’) connection on your RC mod- el transmitter and the virtual model aircraft, car, boat or even helicopter gracefully finding its way across the PC screen in response to your operating the joystick(s) and pressing buttons. No model will be lost to unforgiving rocks, trees, church steeples or Farmer Jim’s cowherd. If you crash, simply start the simulator again and do better. the years, ... there have been a fair number of designs published enabling a radio-control (RC) transmitter to interface with a personal computer. Having this interface enables prospective model aircraft pilots to hone their skills using a simulation program rather than aviating their pride and joy nose-down into the nearby landscape. PROJECTS RC TRANSMITTER INTERFACE Thank you for 20 elektor electronics - 5/2007 Figure 1. Circuit diagram of the RC TX to USB interface. Hardware, what hardware? Goodbye gameport, welcome USB Most designs interface to the PC via the gameport which is now becoming less common on newer PCs and has disappeared completely from laptops and notebooks. The design discussed in this article utilises the USB port which offers greater accuracy. Some commercial designs offer similar capa- bilities but most only have 6-bit preci- sion on the linear axis, so small trim changes may not be effective. Capabilities and limitations As published here, four linear controls and four switched controls are catered for as would be used in a typical 8-chan- nel transmitter, i.e., two 2-axis joysticks and four switched inputs. The linear in- puts are measured with 12-bit accuracy although in reality just over 11-bit ac- curacy is achieved with this software on a typical RC set. With this level of resolution, poor joystick centring is eas- ily measured using the joystick calibra- tion program in Windows (Select ‘Dis- play raw data’). More channels could be easily added but it was felt that eight would be adequate for most users. Super simple hardware The hardware is simplicity itself, see Figure 1 . At the heart of the circuit is a PIC18F2550 clocked at 8 MHz, with a simple transistor buffer/inverter on the input. Eight jumpers have been included although only four are pres- ently used to select between different options. The remainder are to enable possible future enhancements. When plugged into an USB connec- tion on the PC, the HID firmware in the F2550 enables the circuit to be enumer- ated as a 4-axis with 4-button joystick, so no additional drivers are required. Note that due to the PIC software used, the circuit is a low-speed USB device and Chapter 6.4.4 of the USB 1.1 speci- fication states that USB cables should be hardwired to the peripheral and not use the USB ‘B’ connector. However, considering that the circuit will typi- cally be for personal use only, the ‘B’ connector was elected. Software The following description of the soft- ware is pertinent to the PIC 16C745. See the heading ‘Project History’ for a brief overview of the differences to the current 18F2550 software. All the USB dedicated software is available from the Microchip website and is included with the source files supplied free of charge through the Elektor website as file no. 060378 - 11. zip (see month of publication). A snippet of the extremely well-com- mented source code listing is shown in Listing 1 — very useful for the jumper descriptions! Of the Microchip supplied files, both DESCRIPT.ASM and USB_CH9.ASM need to be modified. USB _CH9 .ASM needs the following compiler directive commenting out (or removing) so that port B is available for our use: # define SHOW_ENUM_STATUS DESCRIPT.ASM needs some more seri- ous editing of the various descriptors to allow for proper enumeration and operation of the USB functions. Seven bytes are sent to the PC every 10 ms. The arrangement of the data within these seven bytes is laid out in the re- port descriptor. Essentially, four blocks of 12 bits representing the four joystick axes followed by four bits representing the four switches are sent. That makes a total of 52 bits, which falls short of the 56 bits available in seven bytes, 5/2007 - elektor electronics 21 RC TRANSMITTER INTERFACE Figure 2. Copper track layout and component mounting plan of the miniature PCB designed for the interface. [components 1 | list | Resistors 1 R1,R2 = 1 OOk£2 1 1 R3 = 1 Ok£2 1 1 R4 = 2k£22 1 Capacitors 1 Cl ,C4 = 1 OOyL/F 25V radial 1 ■ C2 = lOOnF ■ ■ C3 = lOnF ■ ■ C5,C6 = 22pF I Semiconductors I IC1 = PIC1 8F2550-I/S, programmed, or- I I der code 060378-41 I I T1 = BC547 I I Miscellaneous I I K1 = 5-way SIL pinheader I I K2-K10 = 2-way SIL pinheader with I I jumper I I K1 1 = 2-way SIL pinheader I I K9 = USB-B connector, PCB mount I I XI = 8MHz quartz crystal I I PCB no. 060378-1 from The PCBShop I I PIC source code files, free download no. I I 060378-1 1 from www.elektor-eleo I I tronics.co.uk I therefore a further four bits of padding are sent. The RC_USB.ASM source file has a good number of comments so should be fairly easy to follow. Because the USB functions make unpredictable use of the interrupts, these are not used for pulsewidth measurements. Therefore, the only user of the interrupt facility is the USB routine. Pulsewidth measurements are made using the Capture/Compare/PWM module. Capture register CCPR1 is a 16-bit register configured to cap- ture the contents of Timer 1 on either the High-to-Low or the Low-to-High transitions on the input (as selected by jumper K10 on RBO). Timerl runs continuously with a -h 2 prescaler at 3 MHz and therefore increments eve- ry 333 ns. Pulsewidth can therefore be detected to an accuracy within 666 ns. Due to the way servos are controlled, pulsewidths vary from 1-2 ms for each channel, therefore we have a range of approximately 0 to 3000. When the program starts, InitRC USB is called that configures the ports, sets up the CCPR to capture on a rising edge and starts Timerl. Next, InitUSB is called and the device is enumerated. The firmware waits until enumeration is complete. LOOP is the main body of the pro- gram. If a pulse is detected (CCP1IF bit set), we check if it is a synchroni- sation pulse ( >2.7 ms) or one of the channel pulses, which vary between 1 and 2 ms pulsewidth. The last value of CCPR1 (TmrlLo and TmrlHi) is sub- tracted from CCPR1 to give pulsewidth in units of 333 ns. If it is a sync pulse, we send the data in the BUFFER to the USB routines for transmission to the PC. Else, if a normal channel pulse is detected, we subtract 4500 (4500 counts of 333 ns = 1.5 ms) to central- ise the pulse on 1.5 ms so that posi- tive numbers indicate a positive swing from neutral on the joystick and neg- ative numbers indicate a negative swing. Next, the pulse width infor- mation is stored at the appropriate place in BUFFER as pointed to by the Pulse_Count variable. Temp_Count is a working copy of Pulse_Count that can be manipulated without losing track of the channel number. Jumpers for unusual cases Left-handed modellers may wish to have the aileron/elevator joystick on the left. To this end, jumper K8 on port line RBI adjusts the value of Temp_ Count so that the data is stored in the correct part of BUFFER. Certain RC transmitters use a non- standard sync pulse. This may affect the operation of the device. Install- ing the jumper on RBO causes CCPR1 to capture on the falling edge of the pulse train. Unfortunately we did not have access to any of these non-stand- ard RC radios so we cannot guarantee that this will help. Construction The interface is built on a small prin- ted circuit board of which the true-size artwork is reproduced in Figure 2. This board is available from Elektor’s busi- ness partner The PCBShop who reside at www.thepcbshop.com. With so few parts on the circuit board, — and all of the ‘leaded’ variety as op- posed to SMDs — there should be no problems building the interface if you exercise normal care in fitting the parts to match the component overlay, and of course the soldering. We recommend fitting the PIC micro (IC1) is a 28-way narrow DIL socket. We reckon there’s much to be learned, enjoyed and economised upon if the project is undertaken as a joint under- taking by RC modelling club members. Subtasks can be assigned like compo- nent/PCB purchasing, soldering, pro- gramming and software tinkering to those with the relevant skills or their arm twisted. Calibration When the interface is plugged into a USB port on a PC, it should enumer- ate with a message stating that a ‘RC/ USB Interface’ has been found. Open up the Control Panel and select ‘Game Controllers’. Listed in the dialogue box should be ‘RC/U’ or ‘RC/USB Inter- face’. Select the controller and click on Properties. Movement of the joysticks should produce the required move- ment on the screen. If no movement is observed, then toggle jumper K10. Huh, “toggle”? If the jumper is Fitted then Remove it and vice versa. Simi- larly, toggling jumper K8 will cause the two joysticks to be swapped. When it is working as required, the system will need to be calibrated. Select ‘Set- tings’ and in the new dialogue box select ‘Calibrate’. Follow the instruc- tions onscreen. This completes the installation. 22 elektor electronics - 5/2007 Listing 1. Source code snippet ******************************************************************* f ; filename: RC_USB_18F2550 . ASM Ver 1.0 - 01 Dec 2006 F ; This file implements the conversion of a PPM mo- dulated output from a radio ; control transmitter to a 3 axis plus throt- tle and 4 button USB joystick. ; PORTB, 0 pin header selects inverted in- put i.e. pulses are active low ; PORTB , 1 pin header selects joystick swapping ; PORTB, 2 pin header selects the Airtronics option ; PORTB, 3 pin header selects the JR option ; PORTB, 4.. 7 not used ; The code is written for a Futaba transmit- ter but by installing EITHER PortB,2 or 3 ; pin header, then it can be configu- red for an Airtronics or JR radio ; The USB port is configured to interrupt eve- ry lOmS and sends 7 bytes of data ; (maximum is 8). The 4 joystick chan- nels are sent as 12 bit values and the 4 ; switches as boolean values. Therefore, 52 bits are required to be sent and the ; 7th byte is filled with 4 bits of ' padding' ; The following shows how the bits are saved in the Buffer prior to being sent ; to the USB port : Throttle=T Rudder=R Aileron=A Elevator=E Switches=S Padding=P Buf f erO MSB A7 A6 A5 A4 A3 A2 Al LSB AO Buf f er 1 E3 E2 El EO All A10 A9 A8 Buf f er2 Ell E10 E9 E8 E7 E6 E5 E4 Buf f er3 T7 T6 T5 T4 T3 T2 T1 TO Buf f er4 R3 R2 Rl RO Til T10 T9 T8 Buf f er5 Rll RIO R9 R8 R7 R6 R5 R4 Buf f er6 P P P P S4 S3 S2 SI F ********************************************* F ********************************** ; All USB routines kindly provided by Brad- ley A. Minch of the Franklin W. Olin ; College of Engineering and the origi- nal source can be obtained from ; http: //pe . ece . olin . edu/ece/pro jects . html . ; The source was the Lab2 project that was then modified by myself with ; permission from the author to distribu- te as required. The main areas of ; change are the descriptors up to line 265 and all code after line 1178 is ; new. There are a few small changes in between. ; Revision History: ; 2006-12-01 Versi- on 1.0 Brendan Hughes ******************************************************************* F #include #include # include Wrong enumeration For some reason the device may be re- ferred to as ‘RC/U’ even though Win- dows retrieves the full name of ‘RC/ USB Interface’ during enumeration. If this bothers you, simply edit the regi- stry setting at HKEY_LOCAL_MACHINE\SYSTEM\ ControlSet\Control\MediaProper- ties\PrivateProperties\ Joystick\OEM\VID_04D8&PID_FE70 Each USB device manufacturer is allo- cated a unique Vendor ID code (VID) and each device model that the manu- facturer produces is allocated a Pro- duct ID code (PID). We have obtained a sub-licence from Microchip to use the Microchip VID (04D8) with a PID code of FE70. This should ensure that this device will not conflict with any other commercial USB device. Interlude — odds & ends Note that the interface will only de- code Pulse Position Modulation (PPM) pulses and not Pulse Code Modulation (PCM), and therefore the transmitter will need to be in PPM mode. A list of the buddy-lead pinouts for var- ious RC transmitter manufacturers can be found at [1] and [2]. A good tutorial on the on the principles of PPM can be found at [3] and [4]. Project History Originally the software was written for the PIC16C745, and later modified to work on a 18F2550. Microchip did not (yet) release USB framework code for the 18F2550 in assembler format. For- tunately, Brad Minch of Olin College has generated an assembler frame- work that is freely available [5]. This code was adapted and mated to the file rc_usb.asm that was tweaked for 18F2550 code to produce the file RC_ USB_18F2550.asm which needs to be compiled with the included ENGR2210. inc and usb_defs.inc files. The code should also run on the 18F2455 with- out any further adjustments. The advantage of the 18F devices is that they are flash-programmable and faster to erase. K1 is a 5-pin header that allows in-circuit programming of the device with an appropriate pro- grammer, like the Microchip PICkit2 (pin 1 of PiCkit podule not used). Those interested in learning more about USB are advised to have a look at websites [6] through [9]. A full set of source files for both the 16C745 and 18F2550 processors is supplied through Elektor’s website. It should be noted though that hardware changes are required in the circuit if the C745 is used: change the quartz crsystal to 6 MHz and fit a lkQ5 resis- tor between Vusb and the USB D-line. ( 060378 - 1 ) Web links [1 ] http://users.belgacom.net/TX2TX/tx2tx/en- g lishAx2txgb3.htm [2] www.rc-circuits.com/ Transmitter%20Connector%20Pinout.htm [ 3 ] www. mh.ttu.ee/ r i sto/ rc/e I ectro n i cs/ra d i o/ signal.htm [4[ http://rc-circuits.com/PPM%20signal.htm 5] http://pe.ece.olin.edu/ece/projects.html [6] www.usb.org [7] www.lvr.com/ [8] www.beyondlogic.org/usbnutshell/usbl .htm [9] http://pe.ece.olin.edu/ece/projects.html 5/2007 - elektor electronics 23 PROJECTS MEASUREMENT T* Loudspeaker as vibration sensor Gert Baars Big earthquakes are rare events, but every now and then we are startled by small shocks that (luckily!) do not usually have any serious consequences. With the circuit described here and a PC you can very easily keep an eye on all earthquakes. Natural phenomena such as earth- quakes, volcanic eruptions, landslides and meteorite impacts generate seis- mic tremors that can propagate over (through) the earth’s surface. With vio- lent events such as a large earthquake on the other side of the world these tremors can travel several times around the earth before they completely die away. Humans can also cause seismic trem- ors, examples are extracting natural gas or nuclear tests. These are gener- ally not audible or noticeable from a large distance, but they can be detect- ed with a sensitive vibration sensor. The seismograph described here makes that possible. The sensor Normally a seismograph sensor uses a spring with a weight attached. The weight just stretches the spring a lit- tle. Because of the inertia of the mass- spring system, vibrations cause chang- es in the elongation of the spring, which can be electronically detected and displayed. This type of sensor is rather expensive to buy and the construction is not that straightforward. There is also the need for a damping mechanism (for example a ring in an oil bath) because the mass-spring system has the tendency to continue to vibrate for a long time. The author thought of a much simpler solution: a loudspeaker. A loudspeaker contains a coil attached to the back of the cone. The coil is centred in the gap of a permanent magnet. A voltage is generated when this coil moves. Plac- ing a weight on the cone of the loud- speaker turns it into a vibration sensor. When the loudspeaker moves up and down because of vibrations in the un- derlying surface, the mass, because of its inertia (Newton’s first law) will stay in the same place and exerts a force on the cone. In this way a voltage is gen- erated across the coil. The loudspeaker that is used is a small type of 0.5 W/8 Q, with a diameter of about 8 to 12 cm, preferably with a flexible suspension. A mass in the shape of a steel, M 10x25 bolt is used to weigh down the cone. A few additional nuts on the bolt give a good result without jamming the cone against the magnet. This lowers the resonant fre- quency of the loudspeaker and the amount of damping is not too large. These are very useful properties that make it suitable for it to be used as a seismic vibration sensor. Principle The signal from the loud- speaker is first amplified and then fol- lowed by a filter to eliminate hum and to reduce noise. The signal is then pre- sented to the ADC -input of an ATtiny- microcontroller. Once the conversion is completed, the microcontroller sends the signal to the computer via the seri- al link. A program running on the com- puter or laptop converts this data into a graphical representation, which al- lows the user to read the time and strength of the seismic activity. In two smaller windows you can see in real- time the amplitude and the frequency spectrum of the signal. When designing the hardware, one of the requirements was that it should be powered from the serial port of the PC (or laptop). This does away with the need for a battery or external power supply. This does mean however that the current consumption cannot be all that much. This is mainly achieved by running the microcontroller at a slow clock frequency and selecting low-cur- rent devices for the voltage regulators. 24 elektor electronics - 5/2007 i Specifications - 0.5 to 25 Hz bandwidth (50 S/s) - Sensitivity from a few jum - Sensor circuitry is powered from the PC - Serial port: 2400 baud, 8 bits data transmission SUB-D9 GND Figure 1. The signal from the sensor is first amplified considerably, then filtered and subsequently digitised by an ATtiny which passes the signal on to a PC. D1 1N4148 0 2 7 3_ 8 4 9 5 D2 IC1 LP2950CZ-5.0 C2 Zl |?20u 25V +5V O R6 C17 R2 lOu 25 V +5V O +5V O GND IC3 C19 lOOn GND R1 j£18 ^pOOn GND TL081ACN o o > PBO AINO PB5 RESET PB1 INT0/AIN1 PB2T0 ATtiny45 T- CM X X co CQ CO Q Z o o Q > C3 ft 2u2 R3 XI HflH C8 2™ R4 4MHz C7 TSp OS SHDN IC2 OUT IN MAX7400CPA COM o CLK z U C5 220n C6 4u7 C4 15n CIO GND GND GND C13 220u 25 V 1N4148 — a z Vin SENSE Vin IC6 OUT ILIM2 ILIM4 SHDN 060307- 11 LT1175CN8-5 Schematic The schematic for the electronics is shown in Figure 1. A dual opamp of the type TL082 was selected for the preamp. The total gain of about 10,000 times (80 dB) is divided across two opamps. This is to prevent the effect of the input offset voltage of the opamps of having too great an influence. For the same reason, the total DC gain is set to lx by Cl 1 and C15. The signal from the preamp is subsequently fil- tered by and eighth order low-pass fil- ter to remove hum and reduce noise. This filter is an IC from Maxim; the MAX7400 (a so-called switched capac- itor filter, SCF). With capacitor C4 con- nected to pin 8 of this IC the corner fre- quency is set to a fixed value of about 25 Hz. This results in a total frequency range from about 0.5 to 25 Hz, which is suitable for seismic recording. The ADC in the microcontroller, an ATti- ny45 from Atmel, converts this signal into an 8-bit result, sufficient for this application. A single, low-power opamp, type TL081 (IC4) is then used as a level shifter, converting the data that the ATtiny transmits from TTL to RS232-level. The power supply is derived from the RS232 lines with the aid of D1 and D2. Two thrifty, low-drop voltage regula- tors (an LP2950 for the positive voltage an an LT1175 for the negative voltage) subsequently provide regulated volt- ages of plus and minus 5 V. In an at- tempt to spread the load roughly equally between the positive and neg- ative rails, the filter and microcontrol- ler are powered from the positive side, while the two opamps in IC5 are powered from -5 V. A voltage di- vider R8/R13 has also been added for the DC adjust- ment of the opamps. A printed circuit board has been designed for the circuit, which is shown in Figure 2. There is nothing special that we need to say about the construction, in this case this is just a very straightforward job. Software The assembler- written software in the microcontroller has the simple task of transmitting the ADC -result when re- quested. Because this particular con- troller does not have a UART, this is done with additional software. The PC -application is programmed in the Delphi programming language. A disadvantage of Windows is that it is not a real-time operating system. Com- mands from the user interface such as the mouse and keyboard and also system tasks that need to be done are not im- mediately carried out, but are placed in a type of queue; depend- ing on the priority they will have to wait until Win- dows can deal with them. From the perspective of the user this goes so fast that you will hardly notice this. When reading or sending data, the exact timing is how- ever difficult for the programmer to control. For this type of measurement a spec- trum from about 0.5 to 25 Hz is very appropriate. This means that the meas- urements have to be done at 50 sam- ples/s (Nyquist theorem). In this case Programming of the controller. If you program your own micro for this project, the following fuses need to be selected: O Crystal oscillator fuse: ext crystal osc 3-8 MHz O Clock divider fuse, divide by 8: CKDIV8 5/2007 - elektor electronics 25 MEASUREMENT Figure 2. If you would like to make a PCB yourself you can get going with this layout. the timing can be done by the hard- ware so that the software timing of the PC does not need to be that accurate. The samples that can be read suffi- ciently fast by the program are dis- played in three windows, each contain- ing a different type of graph. These are a ‘real-time’ oscilloscope to show the details of the amplitude history of the seismic vibration, a spectrum display for the frequency components and a large graphical display for the long- term record. On the latter, the number of lines per window and the duration of each line can be adjusted. An obvi- ous setting is to select 24 lines of 1 hour each for one 24-hour period per window. The user is however free to change this. Working with the seismograph program When the Windows application is started (Figure 3), the serial port is ini- tialised with RTS high and DTR low. This is how the hardware is provided with its power supply. At the top right of the window are two graphs. These display the present state of the sensor. The left window shows the amplitude of the sensor over a time period of 3 seconds. The window on the right shows the frequency analysis of the signal that is shown in the left window (DFT), with a bandwidth from about 0 to 25 Hz. The actual recording starts after click- ing the ‘Start’ button. There then ap- pears a large recording window that shows the amplitude history of the sensor on multiple lines, the number of lines per window and the duration of each line can be adjusted. By default there are 24 lines of 1 hour each, but the user can change this by entering other values. This must be done before the start button is clicked. If the recording is already in progress it has to be stopped first by clicking the start button again. The recorder can also be started at a specific time with a timer by ticking the box ‘Start at’ and filling in the time below it. The format for this is HH:MM: SS AM/PM. To start at 10 o’clock in the morning this becomes 10:00:00 AM (AM in capital letters). Once the recorder has been started, measuring will continue indefinitely and the window is automatically re- freshed whenever it is full. Using the File-menu this window can be saved as a bitmap (picture). In the Settings-menu the COM-port, magnification, automatic data saving and the audio settings can be adjust- ed. The magnification setting (Magni- fy) allows 1, 2 or 4 times vertical magnification. Via the Analyze-menu data can be read back in that was saved with the Au- tosave-setting, for each line or for each window. The format of the data is sim- ply in bytes. The file name of each part of the recorded data is ‘DDMMYYYYH- HMMSS.dta’. 26 elektor electronics - 5/2007 Looking up a recording via the Load- data option is therefore just a case of finding the required date and time in the list of file names. When this file is selected with ‘Open’ it is displayed in graphical form on the screen. This data can then be saved as a picture or print- ed via the File-menu. The number of lines is the value shown underneath the text ‘Lines’ that is shown on the screen. The same data can be dis- played with a different number by sim- ply changing the value and clicking on the text ‘Lines’. The value of the Magnify-setting is also applied when clicking ‘Lines’, so that can be changed as well. A good way of recording is to select a ‘Line time’ of 1 hour with 24 lines and with a ‘Per line’ setting for the Au- tosave setting. Each data save action is now one hour apart; when reading this data back at a later time, this one hour can be stretched across 24 lines so that each line now displays 2.5 minutes which results in a very good display of the details. In the Analyze-menu there is also the option ‘Listen’. This allows the data that has been loaded with ‘Load data’ to be made audible. The Audio-option in the Settings-menu allows the vol- ume and sample rate to be adjusted. This window disappears when ‘Audio’ is clicked again. Since the recording is at 50 samples/s, at a sample rate of 5000 S/s the audio is played back lOOx faster. Listening to a recording of one hour duration there- fore takes only 36 seconds. Remarkable is that when listening to the recording, the sound has a resemblance to listen- ing to a VLF-receiver in the audio range. Post processing of the data can simply be done with the ‘Paint’ program in Windows. To do this, a previously re- corded data file has to be read in with the Load-data option and then saved as an image with the Save-BMP option. The picture can then be opened with Paint and you can, for example, add text to certain ‘events’. In use The foundation is important when po- sitioning a seismograph sensor. Soft, swampy soil damps the seismic trem- ors while, on the other hand, hard rocky ground ensures a very good transmission of these signals, even across large distances. Soft soil really requires a stake to be driven into the Figure 3. Screen dump of the accompanying PC program that makes the measured signal visible. ground, but in many situations this has effectively already been done in the form of piles under the foundation of a building. Because the concrete that is often used for the floors and walls is also a good transmitter of seismic vi- brations, the seismograph sensor can also be used indoors in these situa- tions. On the floor it is best when this is uncovered, such as in the garage or on a balcony. But perhaps hanging the sensor from a concrete wall is the sim- plest solution. In many cases the sen- sor can be placed on the wall behind the PC. The sensor has the be fixed rig- idly to the wall to prevent additional damping. It is, however, ideal to measure in the open field on a hard surface, far from urban areas to avoid the seismic vibra- tions resulting from human activity and machines. ( 060307 - 1 ) r “ — — — — — — — — — — — — — — ! COMPONENTS i LIST Resistors ■ R1 ,R6 = 1 Mf2 I R2,R5 = lOOkQ I R3,R13 = 22kQ | R4 = 220k^ I R7,R1 2 = 4SAQ7 R8 = 1 5kQ R9 # R1 1 = 47kQ R10 = 1 OkQ Capacitors ■ Cl ,04 = 10jL/F 25V radial I C2,C1 2,0 3 = 220 /J F 25V radial I C3 = 2jL/F2 | C4 = 1 5nF | C5 = 220nF C6 = 4jL/F7 C7,C8 = 22pF C9,C1 6 = InF CIO = 470nF Cl 1,0 5 = 4yL/F7 25V radial C17-C21 = lOOnF Semiconductors D1,D2 = 1N4148 IC1 = LP2950CZ-5.0 IC2 = MAX7400CPA IC3 = ATtiny45 (programmed, order code 060307-41) IC4 = TL081ACN IC5 = TL082CN IC6 = LT1 1 75CN8-5 Miscellaneous K1 = 9-way sub-D socket (female), PCB mount XI = 4MHz quartz crystal PCB, ref. 060307-1 from www.thePCBShop.com 5/2007 - elektor electronics 27 TECHNOLOGY RECEIVERS Rolf Hahle Mobile phones, Wi-Fi and satellite communications are increasingly making use of ever higher frequencies stretching up into the Gigahertz bands. That doesn't mean that there is nothing interesting going on at the other end of the radio spectrum. We build a simple receiver and tune into some of the more bizarre signals in the extremely low frequency (ELF) domain. A quick check on the tuner scale of any old analogue radio is all that is required to find out that the lowest frequency used for commercial broadcasting is 150 kHz on the long wave scale. That doesn't mean to say that if you were able to tune the radio below this frequency you would hear nothing but radio silence or maybe the odd crackle of static. Some of the bands below 1 50 kHz are used for scientific purposes and also for military applications. Communications with submerged submarines for example are carried out in the band between 70 and 80 Hz. As the transmission wavelength gets longer so the expenditure on transmitting and receiving equipment gets higher and higher. Submarine communication requires a kilometre long antenna and a very high power transmit- ter, however the advantage of this band is that the signal can penetrate almost everything and can be received anywhere, even under the sea. Some applications of the low frequency bands are shown in the table. In addition to these man-made signals there are some naturally occurring sources of radio signals below 150 kHz. The propagation of these signals is intimately related with the properties of the ionosphere and many radio amateurs have become experts in the study of these phenomena. Below 1 6 kHz in the VLF (Very Low Frequen- cy) band it is possible to detect atmospherics or 'sferics'. These signals are produced where an electromagnetic pulse from a lightning stroke bounces around between the earths surface and the ionosphere producing signals that can be categorised as 'tweeks' while others are 'whistlers' and another type is the 'dawn chorus'. The 'dawn chorus' occurs at daybreak and sounds like birds calling to one another. The electrical properties of the ionosphere are affected by radiation from the sun so signal paths are constantly changing. Frequency bands ELF SLF ULF VLF LF Extremely Low Frequency Super Low Frequency Ultra Low Frequency Very Low Frequency Low Frequency Frequency 3 Hz to 30 Hz 30 Hz to 300 Hz 300 Hz to 3 kHz 3 kHz to 30 kHz 30 kHz to 300 kHz Applica- Technical Military: Earthquake: Worldwide broadcast Standard Time tion maintenance: Submarine Pre-quake sensing. for various applica- signals: PIGs = Pipeline In- communications: tions (Between 10 and DCF 77 Frankfurt spection Gauges (20 ZEVS Russia (82 Hz) Communications be- 30 kHz) (77.5 kHz) Hz) Saguine USA (76 Hz) low ground: MSF Rugby UK (60 kHz) Bunkers, caves Omega navigation HBG Switzerland Military: system: (75 kHz) Submarine 1 0 to 14 kHz (up to communications 1997) Military: Submarine com- Signals of unknown Sferics: munications (below origin Signals from natural events: 'Whistlers', 50 kHz) 'Tweeks', 'Dawn Amateur radio: Chorus' 1 37 kHz band in some countries 28 elektor electronics - 5/2007 Figure 1. The ELF receiver circuit. The mains power supply can be replaced by batteries. At these low frequencies there is no need to apply any demodulation to the signal, it is only necessary to convert the electromagnetic waves into audio waves. There are a number of Internet sites suggesting designs of receivers capable of picking up the types of signals mentioned above. Many of the designs stand little chance of picking up more than a mains hum signal if they are operated in a normal domestic environment. The 50 Hz or 60 Hz mains signal pervades most populated regions of the world and it is difficult to filter out even with a steep high-pass filter. The mains signal is ideally a pure sine wave but in practice it contains many higher order harmonics that extend into ultrasonic frequencies and these can block the signals of interest. VLF reception can only be successfully attempted once the receiver is situated far enough away from towns, villages, high voltage cables and factories. It goes without saying that a VLF receiver cannot be powered from the mains. Reception of ELF signals below 50 Hz does not present so many problems as the mains frequency (50 or 60 Hz) does not contain any lower order harmonics so it is relatively easy to remove its effect with a simple low-pass filter. A receiver for these ELF frequencies can be built using just a highly sensitive audio amplifier together with a low-pass filter with a cut off frequency of around 20 Hz and a coil of wire to pick up the electromagnetic compo- nents of the signals (See the inset for details of coil construction). A low-pass filter does the trick There are several different design suggestions for ELF receivers posted on the Internet but none of them are universally suitable for the application. One contributor suggests connecting a pick-up coil directly to the sound card input and relying on the software spectrum analyser program to recover the ELF signals. Interference from the mains frequency is however so much higher in the average environment that the really interesting ELF signals are completely swamped when this approach is used. Even with the addition of a low-pass filter the 50 Hz signal is still too large. In principle the signal induced in the coil need only be amplified by a factor of 1 00,000 (minimum) but it is important to ensure that the interfering 50 Hz signal is sufficiently suppressed before the signal is amplified too 5/2007 - elektor electronics 29 TECHNOLOGY RECEIVERS Figure 2. The receiver and power supply mounted in a small plastic housing. The connections go to the pick-up coil (in the black box) and to the laptop soundcard. The laptop is running CoolEdit. much otherwise the amplifier will be driven into saturation by the mains signal. The receiver circuit suggested here amplifies the signal picked up by the coil before some of the 50 Hz content is removed by the first low-pass filter. The next stage provides the same amount of gain together with another low-pass filter. After the final filter the 50 Hz hum is barely perceptible on an oscilloscope display. The wanted ELF signals are however still present and can be further amplified or analysed. The Receiver Circuit The circuit shown in Figure 1 should be quite easy to follow for anyone with some experience in analogue design. Amplifier A1 is configured as an inverting amplifier and boosts the signal picked up in the coil by a factor of 1 80 and presents a low impedance match to the coil. This is followed by a high pass filter formed by Cl and R4 which has a corner frequency 1 Hz. This filter is not strictly necessary for the frequency response of the circuit but Cl ensures that the signal is AC coupled to the next stage so that any DC offset on the output of A1 is not amplified by successive stages. The high pass filters can be omitted if Figure 3. Spectral content of the 'cow' signal. This is just one of over 20 different signals that the author has recorded. more expensive offset-free op-amps are substituted here. A2 is simply a unity buffer amp while R5 and C2 form a low-pass filter, attenuating frequencies of 23 Hz and above. A3 is again a unity-gain buffer. The overall effect of these three opamps is to provide band pass filtering between 1 and 23 Hz together with some gain. The following three amplifiers are a repeat of the first three and provide more gain and further attenuation of the 50 Hz signal. The unwanted mains hum signal becomes weaker after each stage while the signals of interest are amplified. The resulting receiver is so sensitive that it can detect the movement of a small magnet (salvaged from an old loudspeaker) at a distance of 5 m. Waving the magnet up and down produces a corresponding sinewave on an oscilloscope connected to the amplifier output. The 50 Hz mains signal is barely perceptible on the oscilloscope trace. Not all plain sailing The signals picked up by the circuit are of such low frequency that they are subsonic and by definition cannot be heard. There is also little point in displaying them on a standard oscilloscope because the signals are seen as a mixture of different frequencies and it is difficult to extract any meaningful information. For this reason it is more useful to make a recording of the signals over a long period (15 minutes minimum) and then display them using a spectrum analyser. Both of these features are available in the audio editing program Cool Edit which is shown here in Figure 2 running on a laptop PC. This program is however designed to show the entire audio spectrum so the subsonic ELF signals are cramped up in the corner of the display which makes it difficult see what is going on at these frequencies. The simplest way to expand the displayed ELF region is to fool the spectrum analyser into thinking that the received signal lies in the audio range (i.e. from around 50 Hz up to 20 kHz). This can be achieved by sampling the signal during recording at a one rate and then playing it back using a faster sample rate. It is basically the same technique as time lapse photography where slowly occurring events are played back much faster. For example a plant may take 1 00 days to develop from a seed to a flower. Growth is so slow that it is difficult to notice any difference from one day to the next but if you were to take a snapshot every four hours of the plant's life and then view the pictures at 25 frames per second the entire growth period would be shown in just 24 seconds. The same basic technique is used to capture, display and hear the ELF signals: 1 . Connect the VLF receiver output to a PC sound card input and use a PC recorder program to store the received signal. Note that a standard PC sound card provides sharp attenuation to signals below 1 6 Hz. 2. The sample rate must not be higher than 200 Hz. If the recorder software does not allow selection of this low rate then it is necessary to write a program that effectively reduces the sampling down to this rate by just taking say every hundredth sample in the record file and discarding all the others in between. The effective sample rate is now one hundredth of the original. 3. The resultant sound file can now be used in the analyser program with the sampling rate set to 32 kHz which has the effect of multiplying the signal by 1 60 (assuming an original sample rate of 200 Hz) and making the signal 30 elektor electronics - 5/2007 audible. The time lapse effect on the signals makes it possible immediately to see structures and patterns in some of these slowly changing received signals which are not obvious when the signals are observed in real time. The time and frequency markers displayed on the analyser program must of course be divided be the difference in sample rates to obtain their true values. Curious results The strange nature of the signals that the author has picked up in this frequency band over the past six years really has justified the effort invested to build the ELF receiver. To start with the more banal signals that you are likely to tune into there is a weak 50 Hz line shown on the spectrogram produced by the ubiquitous mains power distribution network and also another signal peak at 1 6.66 Hz emanating from the railway network power distribution (in Germany) which can even be detected up to 6 km from the railway line! These two frequencies are not at all interesting but can be used as markers for testing the receiver. The majority of train networks outside the UK distribute power using overhead cabling; in Germany this generates a strong 1 6.66 Hz alternating electromagnetic field which swamps the input to the ELF receiver if it is operated within 1 km of the railway. These are probably the least interesting signals that you are likely to hear with this receiver. After many years of investigation into ELF phenomena the author has been able to identify locations on the earth's surface (in his locale) from where specific signals in the range from 0.8 to 20 Hz seem to emanate. The source of the signals is a mystery; some of the more interesting transmissions have particular characteristics and are strongest in certain areas. Examples of processed ELF signals can be downloaded from our website at www.elektor-electronics.co.uk. The signal pitch of these sound files has been multiplied by 160 using the 'time lapse' technique described earlier to make them audible. Figure 3 shows the spectrum (against time) of a particu- lar type of signal which has come to be known as the 'cow' signal. No prizes are on offer if you can guess what it sounds like once it has been transposed into an audible signal. In real time each transmission lasts for around five minutes and has been detected over a number of years, it occurs at random intervals, day or night and seems to be strongest along the main approach road around the northern edge of the village of Eifel in Germany. The 'goose signal' sounds a bit like a quack when it is transposed but each sequence actually lasts for around one hour. There is a recognisable structure to the signal starting with what looks like a message 'header' and a (variable) series of mark/space pulses at about 1 6 Hz where each mark lasts for four periods. The complete sequence is repeated after 24 hours. Again this signal is quite localised to the Eifel region of Germany but has been detected up to 40 km away. The 'heartbeat' signal sounds like the continuous emer- gency tone emitted by a heatbeat monitor. A look at the spectrum of this signal shows a fundamental frequency of less than 1 Hz with peaks at odd harmonics of the fundamental i.e. 3 and 5 times and so on. This character- istic indicates that the signal is actually a square wave. The signal begins at apparently random times and is interrupted at minute intervals; the entire broadcast can last for several hours and has been detected throughout The pick-up coil The receiver antenna consists of a coil of about 1 000 turns of fine enam- el coated wire wound on a 40 cm diameter former. The wire can be salvaged from the pri- mary windings of several old mains transformers (solder, then insulate the joints), alternatively a large spool of suitable wire can be pur- chased (the internet offers a good source of suppliers). For coil winding a quick and simple former can be con- structing by hammering in 8 nails evenly spaced around the circumference of a 40 cm circle drawn on a block of wood (don't hammer them in too far). A little patience and a note- pad (you don't want to lose count half way through) is all that is necessary to wind the 1 000 turns around the former. Insulating tape should now be wound around the finished winding to give some protection from the elements. The nails can now be carefully withdrawn to release the coil. The finished coil is quite rigid and self-supporting but it helps to protect the fine wire from damage if it is fitted into a flat wooden box. A quarter inch mono jack socket can be fitted to the box to provide electrical connection to the coil. NB: Ensure that the coil assembly is fixed firmly and not sub- ject to vibration or any other type of movement during use, even a small movement interacts with the earth's magnetic field and induces a signal in the coil which can overload the input stage. The coil can also be used for direction finding; the received signal will be strongest when the magnetic field lines are at 90° to the coil plane. The signals have a long period and the recording process is rather slow so it takes a great deal of patience to make the measurements necessary to identify the location of the signal source. Germany. Listeners to this particular transmission Fiave reported an increase in activity over the last three years. The signals are quite localised so it is unlikely that they Fiave some connection with submarine communications or are of cosmic origin. One possible explanation is that they are generated by currents in the earthi produced by the switchiing and operation of powerful electrical machiines but if that were the case you would expect the signal structures to be similar eachi time they appeared and that is not the case. Maybe one day the mystery will be solved but until then it certainly makes interesting listening! ( 060320 - 1 ) Web links Example sound files at www.elektor-electronics.co.uk; click on Magazine — > May 2007 — » ELF Reception. www.vlf.it 5/2007 - elektor electronics 31 TRANSMITTERS Em Use a miniature m Martin Ossmann These days many radios are capable of receiving and decoding RDS signals, displaying the broadcaster's name and much more besides. Traffic announcements are also triggered via RDS. The very simple transmitter described here will let you test receivers and investigate faults, and could be used as the basis for your own projects. By using advanced techniques we have made it possible to write all the code for the ATtiny2313 microcontroller in C and compile it using the free WINAVR compiler. Most car radios available today sup- port RDS, usually providing an eight- character display to show the broad- caster’s name. Nevertheless, some broadcasters manage to make the dis- play show more than just their name, for example to include music track ti- tles or stock market indices. This is done by using the PS (‘program serv- ice’) data field in creative ways so that variable data can replace the broad- caster name. It would be more elegant to use the RT (‘radio text’) function for this purpose, which provides for up to 64 characters of information, but this is of little use if the radio does not sup- port the feature. The TP/TA (‘traffic programme’/’traffic announcement’) feature is widely sup- ported, however. Our test transmitter trans- mits the bits to control the TP/ TA function along with an example text (‘ELEKTOR’) for the PS field. The C program code can be used as a basis for more advanced projects. For exam- ple, a parameter could be measured and sent via RDS for display on an FM radio. If a threshold value is exceeded this can be flagged as a pseudo-traffic announcement, causing the radio to turn up the volume. Surprisingly enough the whole trans- mitter consists of just two digital ICs, together costing just a couple of pounds. One is an Atmel ATtiny2313 microcontroller, and the other is a standard CMOS 74HC00 quad NAND gate. The FM signal is generated as a harmonic of the clock frequency, mean- ing that its frequency is crystal-control- led and that no RF adjustments are re- quired to the circuit. There are a few clever ideas in the design of the trans- mitter which make the circuit astonish- ingly simple. Fractional PWM The first step to generating an RDS sig- nal is to create a 57 kHz subcarrier, ac- curate in frequency to a few Hertz. We need to be able to generate this fre- quency without using a special crystal. The now standard frequency of 11.0592 MHz is not a simple integer multiple of 57 kHz: 11.0592 MHz/57 kHz = 194.0210526.... It is therefore not possible to use a sim- ple divider. However, if we switch a di- vider between ratios of M=194 and M+ 1 = 195 in the right proportions we 32 elektor electronics - 5/2007 as RDS Signal Generator icrocontroller to send characters to an FM radio display CLOCK Listing Interrupt routine // 10 MHz to 7 7.5 kHz DDS PWM generator // 10MHz/77. 5kHz=129. 032258065. . ; 0 . 032258065*2 A 16= 2114 . 0639 . . . equ M = 129 . equ R = 2114 TIMl OVF : // interrupt in SREGsav , SREG // save status subi DDS0 , low(R) // 16 Bit subtract sbci DDSl,high(R) ldi temp,M // preset PWM period brcs nol // check carry dec temp // decrement PWM period nol : out ICR1L, temp // set new PWM period out SREG, SREGsav // restore status reti // return from PWM interrupt Figure 1. Fractional divider using PWM. Technically, no problem Several interesting applications can be imagined if you (1) adapt the microcontroller source code, (2) burn the object code into a larger, more powerful micro and (3) add a small RF output amplifier (say, one tran- sistor and a filter). For example, you could make the inside and outside temperature, or the oil temperature, appear on the RDS display on your car radio. In principle, any sensor signal lends itself to this application, provided you add the necessary interfacing and software extensions. The more communicative among you may just play with the idea of 'narrowcasting' RDS text messages to other people, for example, fellow drivers stuck in yet another traffic jam on the M25. You need to be sure, though, of the radio station they are tuned to (best guess: Radio Kent). Technically speaking, a lot is possible, but not from a legal point of view as in most countries the use as well as the ownership of non-ap- proved transmitter gear is prohibited by solid legislation. can obtain an average division ratio between these two integer values. In the ATtiny microcontroller a suitable switchable divider can be found in the form of the PWM unit. We simply need a software module which sets the PWM period to M+ 1 = 195 for an over- all fraction of its cycles given by r = 0.0210526... and to M=194 for the re- maining fraction 1-r of its cycles. The average division ratio is then exactly r(M+l)-F(l-r)M=M-Fr= 194.0210526.... A suitable module to control the switching of ratios is a device known as a DDS signal generator: Figure 1 shows a block diagram of the concept. The system is based around an N-bit accumulator, which can hold values up to 2 N -1. Each clock output from the M/ M + 1 divider adds a fixed value R to the value P in the accumulator. The Figure 2. Signal generator block diagram. 5/2007 - elektor electronics 33 TRANSMITTERS BB909B PI C3 13 II 12 3n3 1 <5 t> XO RST XI PB7 PD0 IC2 PB6 PD1 PB5 PD2 PB4 *nmy PD3 2313-20 PB3 PD4 PB2 PD5 PB1 PD6 PB0 2 _3 6 _ 7 57 kHz Clock -O Bit-Clock -O CRC-Active -Q Test-Sync 10 l 060253-11 Figure 3. Circuit of the RDS test transmitter. fraction of divider cycles for which the carry output of the adder is set is then r=R/2 N . If the master clock frequency is /clock’ the PWM module (when con- trolled in this way) will have an output frequency given by ■^OUT = ^CLOCK / + R/ 2 N ). A disadvantage of this technique is that the output signal exhibits jitter, which corresponds to phase noise in the output spectrum. Once suitably initialised, the interrupt routine for the ATtiny2313 is very sim- ple, as can be seen in the Listing. The values given generate an output fre- quency of 77.5 kHz from a clock fre- quency of 10 MHz. It is also straightforward to use the method described above to generate the RDS clock frequency from an 11.0592 MHz master clock. The method is so efficient that the whole thing can be written using the C programming language, with the result that the project is considerably easier for the non-specialist to modify. In our case we use a 15-bit phase accumulator. A schematic diagram of the whole sys- tem is shown in Figure 2. Modulating the bitstream The RDS bit clock of 1.1875 kHz can readily be obtained from the 57 kHz clock by division by 48. The bit clock is used to shift data bits from a shift reg- ister into a differential encoder, as well as in modulating the 57 kHz subcarrier. It is used to apply a phase shift of 180 degrees to the subcarrier, performed by an exclusive- OR gate in Figure 2; in software we can invert the polarity of the PWM generator output by simply changing a configuration bit. The phase shift is determined by the out- put of an exclusive-OR gate which combines the RDS bit clock with the output of the differential encoder. The differential encoder changes the modu- lation polarity from bit to bit when the bit to be transmitted (obtained from the shift register) is a logic one. The data payload has the necessary error correction bits added before being loaded into the shift register. The whole of the above process is im- plemented in software, with the RDS signal being present at the output of the PWM module as a square wave (being therefore spectrally rather im- pure). This signal is used to frequency modulate the master clock generator. Since the biphase-modulated PWM signal has zero overall offset, this mod- ulation does not affect the centre fre- quency of the oscillator. The bit timing is also essentially unaffected by this frequency modulation. Construction The frequency-modulated clock gener- ator is built around a simple CMOS os- cillator using a varicap diode. The over- all circuit diagram is shown in Fig- ure 3. Two NAND gates produce > j Jr Figure 4. Construction on prototyping board. 34 elektor electronics - 5/2007 narrow spikes at the output, rich in harmonics. A short length of wire makes an adequate antenna for initial testing. The ninth harmonic is at nine times 11.0592 MHz, or 99.5328 MHz, comfortably in the middle of the FM frequency band. The photograph at the head of this article shows a portable receiver with RDS receiving the test signal and displaying the broadcast- er’s name (‘ELEKTOR’, naturally enough). Wire links or switches connected to pins 12 to 14 of the microcontroller ac- tivate the TA (traffic announcement) and TP (traffic programme) bits, and a test mode where a 16-bit test pattern is repeatedly transmitted instead of the RDS packets. Pins 6 to 9 carry the most important signals needed for test purposes. Trimmer C2 should be ad- justed so that the frequency on pin 6 (PD2) is 57 kHz. The RDS output provides the baseband RDS signal, which can be used for di- rect testing of RDS demodulators. Al- ternatively, the signal can be used to drive another FM transmitter. The total component count is remark- ably small and so construction on a piece of prototyping board (see Fig- ure 4) is entirely practical. The ATti- ny2313 microcontroller software (hex file and C source file) is available for free download from the Elektor Elec- tronics website. Ready-programmed microcontrollers are also available from the Elektor SHOP You can modify the source code to im- plement various special functions. You will need a copy of the RDS standard to understand how the information is en- coded, and this standard is available on the Internet (see links below). Because the test transmitter only out- puts a tiniest amount of RF power in the VHF FM band, it is possible to con- nect its output directly to the input of an RDS radio using a length of coaxial cable to minimise the stray emissions. It should be noted that the transmit- ter’s output signal covers a wide band of frequencies so the suggested meth- od of connecting is recommended to comply with relevant legislation. (060253-1) Weblinks http://en. wikipedia. org/wiki/Radio_Data_System www. g. laroche.free.fr/english/rds/ rds.html References RDS: FM with text and data, Elektor Electro- nics, April 1 989. Martin Ossmann: RDS Decoder, Elektor Elec- tronics, February 1991. j Of 1 1 J j li SERVICING YOUR COMPLETE PROTOTYPE NEEDS 1 EUROCARD (160 x 100 mm) + Tooling + Photoplots + VAT m Price example Any size and contour possible! Optional: • Soldermask • Fast-turnaround • Silkscreen • 4-Layer Multilayer • 6-Layer Multilayer mbmioji fa Simply send your files and order ONLINE: Freephone Q) 0800-3898560 0 .| i . PC8-POOL.COM THE VERY BEST CCiFV AT LOW PRICES tmW 1*1, 4 MiWfi + CWtPIUCKAiPI JPir. iiJ UfllTH JHUf AAPFF1 . Wr. r -Wi m E 438 I i |B I * Uft SYSTEM U3. A COLOUR CAMERAS 4 DUfl FAC K AGE rtWftrflfr mm A A £469 SYSTEM uinii * hr hlhue ■ 1 ■ 1 - r i vv !•* | HlUi Ml V A m r ■ I h ii £799 JIT /If*] Jit ■ipififrfr— C*ll wit flur ] t rf-f ww i Brfiwt E~ll M : K ■ ■ «„!. ELECfnuHfgv its*- hilrn .1 M u -rari 5/2007 - elektor electronics 35 POWER ELECTRONICS With AT90PWM3 microcontroller and Fairchild Smart Power Module Paul Goossens Controlling the speed of an asynchronous motor requires a three-phase frequency inverter. The ATAVRMC200 evaluation kit from Atmel is based around a flexible motor control board which uses a special AVR microcontroller, along with a Fairchild SPM for the output driver stage. A special feature of the system is that it can control asynchronous motors without using a sensor. Engineers usually refer to asynchronous motors as 7 AC induction motors 7 [1], especially when powered from a three-phase supply. The stator in a three-phase induction motor uses the three supply phases, called U, V and W, to create a rotating magnetic field. The simplest way to drive such a motor is to use a sinusoidal voltage on each of three windings, with phase shifts of 1 20 degrees be- tween each. Normally a three-phase supply will deliver these three voltages at a frequency of 50 Hz and with an amplitude of 400 V between phases. Since the rotor in an asynchronous motor follows the ro- tating magnetic field with just a small lag, the speed of the motor is strictly limited by the frequency of the three- phase supply. With a 50 Hz supply the range of avail- able speeds is relatively narrow and independent of the load on the motor. It is really only practical to change the speed of the motor by adjusting the driving frequen- cy. A frequency inverter solves this problem: from the rectified mains power it generates a three-phase sinusoi- dal output signal with adjustable frequency and (usually) adjustable amplitude, allowing control over both speed and torque. The frequency inverter The three-phase frequency inverter essentially consists of three variable frequency sine wave inverters. As with the more familiar single-phase inverters (which convert 1 2 V DC to 230 V AC) linear power output stages are eschewed because of their poor efficiency when generat- ing sine wave signals. It is better to use power transistors as switches (see Figure 1), minimising power losses. If switch S a+ is driven by a PWM signal and switch S a _ is driven by the inverse of that PWM signal, the result is a voltage that (on average) can be set at will between 0 V and the supply voltage of the circuit by controlling the width of the PWM pulses. The Smart Power Modules (SPMs) allow the power switch- es to be controlled using TTL-compatible (5 V) logic inputs. When driving the power switch elements (IGBTs or FETs) it is essential to ensure that the two parts of one half-bridge (such as S a+ and S a _ in Figure 1) are never on simultane- ously. The result would be a short circuit across the supply and an undesirably high current would flow. Since the power transistors do not switch instantly, it is necessary to introduce a small delay in the control circuit between switching one transistor off and the other on. This ensures that a transistor only starts to conduct when its partner is off, and vice versa. 36 elektor electronics - 5/2007 Constant voltage-to-frequency ratio The simplest way to control the speed of the motor is via the frequency of the rotating magnetic field. To maintain the performance of the asynchronous motor, in particular its torque, it is necessary to keep the ratio between volt- age and frequency constant. As the speed increases we must therefore also increase the amplitude of the sinusoi- dal signals we produce. This can of course only go as far as the point where the maximum permissible voltage for the motor is produced at the frequency inverter's output. If we wish to increase the frequency further we must limit the voltage and so the torque produced will no longer be constant; indeed, it will fall. Torque can also fall off at very low speeds. Maintaining the voltage-frequency ratio constant implies the use of low voltages, which in turn means that the re- sistance of the windings becomes a consideration. This is compensated for by setting a lower frequency limit (called the boost frequency) below which the amplitude is kept constant rather than reduced. As a rule of thumb this limit can be set to 5 % of the frequency at which the motor's maximum voltage is attained. To change the direction of rotation of an asynchronous motor it is sufficient to swap the connections to two of the three windings, for example, V and W. This exchange is straightforward to implement in the frequency inverter's control software. More than just a sine wave When an asynchronous motor is controlled electronically we have the ability to increase the motor power by using a drive waveform that is not sinusoidal, in particular by using a sine wave plus a component at its third harmonic. If the amplitude of the third harmonic is one sixth that of the fundamental we have a signal that approximates a n Figure 1. Principle of the inverter controller for asynchronous motors. Figure 2. A non-sinusoidal waveform allows a higher RMS voltage to be achieved for a given peak voltage, giving greater power. 5/2007 - elektor electronics 37 PROJECTS POWER ELECTRONICS Figure 3. The Atmel evaluation board and optional asynchronous motor. square wave (Figure 2). The advantage is that the RMS value of this signal is higher relative to its peak voltage than is the case for a simple sine wave. This enables the motor to produce more power for a given peak winding voltage. Dum volvo, video disco Theory is all very well, and data sheets and application notes can provide large amounts of information, but these are no substitute for actual practical experience. Semicon- ductor manufacturers such as Fairchild and Atmel are of course aware of this and so it is no coincidence that they have produced a useful development board as an aid to applications developers, featuring an AVR microcon- troller for control and a Smart Power Module as power output stage. The board forms the heart of the Atmel ATA- VRMC200 evaluation kit [2]. The development board is delivered with software and detailed diagram showing which connections should be made where in order to connect mains supply, motor and PC together. The evalua- tion board can be used with mains voltag- es from 1 1 0 V to 230 V and frequen- cies from 50 Hz to 60 Hz. The drive is controlled by an AT- 90PWM3 mi- crocontroller, developed by Atmel specifically for three-phase invert- er applications [3]. The board comes with firmware ready-loaded and with a potentiometer and three push-buttons for direct operation. It can therefore be used im- mediately without a PC or programming: simply connect the three windings of the asynchronous motor to be controlled (maximum 370 W) and the mains supply and adjust the speed of the motor using the on-board potentiometer. If required, a suitable motor for use with the evaluation kit is available directly from Atmel (Figure 3). Smart, powerful and modular The board is designed to accept Fairch- ild SPM units in DIP packages. The board is shipped with a type FSAM1 0SH60 1 0 A module, with a maximum output power of 370 W. In principle any other pin-compatible SPM in a DIP package could be used, for example to obtain a higher output power. The Table shows four types differing in maximum current (and hence output power rating. They are otherwise identical, all having a built-in NTC thermistor, the same package type, the same pinout and the same SPM frequency. This means that the board can easily be adapted for use with differ- ent-sized motors. If desired a (free) sample SPM can be ordered directly from the Fairchild website. Development platform As well as offering the opportunity for modifications to suit different-sized motors, the hardware and software of the evaluation board provides a well-equipped platform for your own projects. Figure 4 shows an overview of the hardware. On-board regulators provide the voltages of 5 V and 15 V required for the microcontroller and for the Smart Power Module. The safety circuits built into the Table. This table shows pin- and function-compatible SPMs for various output power levels Smart Power Modul SPM frequency l c at T c = 100 °C Maximum motor Motor voltage (SPM) [kHz] [A] power [kW] [V] FSAM1 0SH60A 15 10 0,4 220 FSAM1 5SH60A 15 15 0,75 220 FSAM20SH60A 15 20 1,5 220 FSAM30SH60A 15 30 2,2 220 38 elektor electronics - 5/2007 No mains isolation! Power electronics operating at 230 V is rarely isolated from the mains, and the Atmel motor control evaluation board is no ex- ception to this rule. When in operation and during testing you must always be conscious of the fact that the majority of the circuit is connected directly to the mains and therefore that any conductive part may be carrying mains voltages! This remark applies equally to the digital parts of the circuit, including the microcontroller. If the board is in the open and accessible, while taking measurements, testing or experimenting, you should power it via an iso- lating transformer. In any case you must ensure that no-one can come into contact with mains voltages. Fairchild module can be monitored using the microcon- troller. These include a thermistor for temperature monitor- ing, a short circuit or overcurrent detector and a monitor for the supply voltage to the gate drivers inside the SPM. Should a fault occur a signal generated by the module is sent to the microcontroller. The board can be connected directly to a PC via an opti cally isolated interface. The three sensor inputs and the ISP interface are also optically isolated. Fairchild celebrates tenth and fiftieth anniversaries Join in the celebrations and win a complete frequency inverter board plus asynchronous motor! The year two thousand and seven marks a double an- niversary for Fairchild Semiconductor. In 1 957, fifty years ago, the 'Traitorous Eight' left the team of transistor co- inventor William Shockley to found their own company in what is now known as Silicon Valley, to manufacture better transistors based on silicon. The name, and the money, for the company came from inventor and legen- dary entrepreneur Sherman Fairchild. In 1958 the pla- nar transistor was invented at the company, forming the basis for a new industry. There followed a series of firsts: the first silicon 1C (1 960); the first static flip-flop 1C, and, with the jL/A702, the first operational amplifier 1C (both in 1 964). The ji/A709 (1965) and the jL/A741 (1 968) can still be bought today. Ten years after being taken over by National Semicon- ductor (itself founded by ex-Fairchild employees), Fair- child became independent once again in 1 997. In 2007, therefore, we mark the tenth birthday of the new Fair- child. Making a fresh start in logic, memory and discrete devices, Fairchild has become 'The Power Franchise'. According to its own figures, it is the biggest provider of components worldwide for system power optimisation. The Smart Power Modules (SPMs) described in this issue of Elektor Electronics are a part of the widest range of integrated motor control products in the industry, with devices rated from 50 VA to 1 0 kVA. Anniversary Quiz Answer these three questions correctly, and you could win a prize! a) Who developed the planar transistor at Fairchild in 1 958? (Hint: he was Swiss by birth.) b) How many integrated components comprise an IGBT? c) What is the phase angle between any two of the three-phase outputs of a frequency inverter? As prizes we are giving away ten ATAVRMC200 asynchronous motor controller evaluation kits, including asynchro- nous motors (see photographs), each worth well over £ 200! Send your answers, by 21 May 2007, by e-mail to editor@elektor-electronics.co.uk or by post to Elektor Electronics, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England, marking your envelope 'Fairchild'. The editors' decision is final. 5/2007 - elektor electronics 39 POWER ELECTRONICS 070174 - 13 The AT90PWM3 The AT90PWM3 is an AVR-series microcontroller developed by Atmel specifically for applications in fluorescent lamp bal- last and motor control. A special feature of the device is its three high speed PSCs (power stage controllers). Each PSC has two PWM modules and so can create two PWM signals. In software it is very easy to control these outputs so that they are complementary to one another. It is also easy in software to add a 'dead time' to avoid the problem of a brief short-circuit between the power rails in the output stage when both transistors in one half-bridge conduct simultaneously. The PSCs can also react, without software intervention, to fault signals, zero-crossing detection and the like. It is also possible to update the settings for the three PSCs simultaneously. Figure 4. Block diagram of the evaluation board, which can be used directly for motor control. Software Software tools for developers are provided on the CD delivered with the hardware, and the most recent ver- sions are also available for download from the Atmel website. Code for your own projects can be written in the C programming language and compiled. Two firmware examples for the AT90PWM3 can also be freely downloaded from Atmel [4]. The source code is thoroughly commented and a detailed description is given in two application notes (also available for download [4]). A small but important part of the code, determining the U/f characteristic, is shown in the Listing. In-system programming (ISP) makes it easy to adapt the microcontroller for new applications. Neither of the rec- ommended programmers (AVR ISP or JTAGICE Mk II) is provided with the evaluation kit. Weblinks: [1 ] http://en.wikipedia.org/wiki/ Electric_motor#Three-phase_AC_induction_motors [2] www.atmel.com/dyn/resources/prod_documents/doc4096.pdf [3] www.atmel.com/dyn/products/ product_card.asp?part_id = 361 5 [4] www.atmel.com/dyn/products/tools_card.asp?tool_id = 3901 ( 070014 - 1 ) U/f characteristic in software This listing shows the implementation of a constant U/f ratio, taking into account the boost frequency and maximum permissible voltage. U16 controlVF ( U16 wTs ) { U16 amp ; if (wTs <= OME G A_T S_M I N ) // boost frequency { amp = ( Vf_SL0PE * OMEGA_TS_MIN ) / 10; // boost voltage } else if ( ( wTs > OMEGA_TS_MIN ) & (wTs < OMEGA_TS_MAX ) ) amp = (Vf_SL0PE * wT s ) / 1 0 ; // V/f law else amp = ( Vf_SL0PE * OMEGA_TS_MAX ) / 1 0 ; // rated value return amp ; } 40 elektor electronics - 5/2007 Version 1 0 features M Intr.-Higciu Gerber Impart nptior* ■ Track/Shapa ’Nu^' Mode Routing I Text Callouts I Layer St Via Suck Previews ■ Blind St Buried Via Support ■ Teardrop Pads ■ Dr.iw Spicing C France* ■ Spiral Tracks St Shapes Plus many more exciting feiturs^ version 10 sets another milestone Winning accolades the world over. Easy- PC for Windows V 1 0 is another major miles rone in the evofution of this extremely popular software tool. Tf‘y a demonstration copy of Easy- PC and prepare to be amazed at the power, versatility and remarkable value for money. * Fully Integrated Schematics a PCB layout in a single application complete with forward and back annotation. Design and rules checks at all stages ensure integrity at all times. Professional manufacturing outputs allow you to finish the design process with ease. Stop press.,. Stop press, .. Stop press,*. Stop press. Easy-PC imports Eagle files as well asTsien Boardmaker 2 files call far □ brochure, prices * CD on + 44 (0)1 684 773662 or e-mail wlci@numbcrone.-cem yo-u enn d!sq download a demo ^am www.numberone.com Oiik Lane, Brtdon, Tewkesbury Glos. GL20 7LR. United Kingdom Other oscilloscopes in this price range www,picotechxom/s force you to compromise on one of the key specifications: sampling rate, memory depth or bandwidth. The PicoScope 5000 series is a no compromise PC oscilloscope at a price every engineer can afford. IGS s sampling rate 25 Q MHz bandwidth I 2 SM s ample buffer memory I 25 MS/S 12 bit AWG buljt In Pf coScope 5203 32M buffer £1(95 PicoScope 5204 !23M buffer £1795 5/2007 - elektor electronics 41 TECHNOLOGY POWER ELECTRONICS Smart Power Modules Power output stages with integrated drivers for motor control With a contribution by Ralf Keggenhoff (Fairchild Semiconductor) The energy consumption of household appliances and industrial machines is determined to a large extent by (asynchronous) motors. Motor controllers should produce little interference and have high efficiency in order to economise on energy, and Smart Power Modules help developers meet these requirements. The modules include not only the necessary half- bridges but also a driver stage, enabling direct connection to a 5 V microcontroller. Figure 1. Block diagram of a Mini-DIP module. (22) V (21) V B(W) CC(W H ( 20 ) IN ,wh) ( 23 ) V S,W) (18) V B(v) (17) V CC(VH) (16) COM (h) ( ( 15 ) IN ( 19 ) V s V b,u, ' O 2 ) V CC(UH) i (11)'N (U h) ' (14)V S(U) i 0°) R SC 0) C sc ( 8 ) C fod ( 7 > V fo (6) COM (l) (5) IN (WL) ( 4 ) IN ,vl) ( 3 )'N (ul) (2) COM (l) (1 ) Wc(L) VB VCC OUT COM IN VS VB VCC OUT COM IN VS C(SC) OUT(WL) C(FOD) VFO IN(WL) IN(VL) IN(UL) COM(L) VCC OUT(VL) OUT(UL) (32) P 0 < 31 ) W 0(3°) v 070016 - 11 Figure 2. A single module replaces these ten components. The main industrial applications for motor control are in fans, pumps, cranes, conveyor belts and in automation generally. In the household we find motors in (among other things) air conditioning units, refrigerators, washing machines and extraction hoods. In all these applications there is continuous demand for improved efficiency, power factor (a near-sinusoidal input current), electromag- netic compatibility and compactness. Reliability is also an important criterion. Requirements A power control module must satisfy many requirements: small dimensions, easy installation during assembly, high reliability, low power losses, good heat dissipation, simple design and low cost. The most significant require- ment on the manufacturer of power control modules is to match these properties to market needs by combining carefully-selected individual components. An example of this is the series of Smart Power Modules (SPM™) from Fairchild which use a well-matched combination of innovative packaging technology and robust semiconduc- tors that dissipate very little waste power. Convenient power A three-phase motor controller needs six power semicon- ductors and the same number of driver stages. The Fairchild SPM family includes devices employing IGBTs as well as short-circuit proof MOSFET-based devices [1]. A feature of all the modules is that they include not only the power components but also drivers optimally matched to them. This is especially important with regard to meeting ever more stringent EMC requirements. Figure 1 shows an example block diagram, in this case of an FSAM1 0SH60A Mini-DIP module [2] which features six IGBTs. To obtain the same functionality we would otherwise need ten components: six IGBTs and four driver ICs (Figure 2). The 'discrete' solution increases develop- ment and manufacturing costs and increases the chances of failure. It is also more bulky and less EMC-friendly. 42 elektor electronics - 5/2007 The example application circuit shown in Figure 3 illustrates how simple it is to construct an asynchronous motor controller using a Smart Power Module. Besides a microcontroller (CPU) and the module from Figure 1 there are just a few discrete components. The module used here includes an NTC thermistor for temperature monitoring. The SPM family Members of the SPM family come in the following packages: - Tiny-DIP module (Figure 4a); - Smart Power Module in SMD package (Figure 4b); - Mini-DIP module (Figure 4c); - DIP module (Figure 4d). There are two different versions of the Mini-DIP and DIP Modules. The main difference between them is in the thermal connection to the heatsink. For lower-power devices this is done using a ceramic, while for higher power devices DBC (direct bonded copper) is used. Both variants offer a specified isolation voltage of 2500 V. Figure 3. Typical application: driving an asynchronous motor using a Smart Power Module. Mechanical construction Figure 5 illustrates the construction of the ceramic and DBC SPM module variants. In the ceramic version the semiconductor die is first bonded to its leadframe. The leadframe is then attached to the ceramic using a thermally-conductive adhesive. Bond wires are added to make the remaining electrical connections. The whole assembly is then potted in a plastic. The connection pins are formed and a final electrical test completes the module. Many of the manufacturing steps are the same in the case of the DBC module. The main difference compared to the ceramic-based version is that the connections inside the module are made not via the leadframe but rather using a DBC structure similar to a printed circuit board. The DBC structure consists of a ceramic with a full copper plane on the underside which provides the thermal connection to the heatsink, and printed conductors on the top side. The power semiconductors are bonded to this structure and the remaining electrical connections (for example to the leadframe proper) made using bond wires. Again the assembly is potted, the pins are formed and the device is given a final electrical test. ( 070016 ) Figure 4. a. Tiny-DIP module b. A Smart Power Module in an SMD package c. Mini-DIP module d. DIP module. Weblinks [1 ] http://www.fairchildsemi.com/power [2] http://www.fairchildsemi.com/pf/FS/FSAMl 0SH60A.html Availability SPM devices are available from Fairchild themselves (http://www. fairchildsemi.com) and their authorised distributors. Free samples can be requested directly from Fairchild's website. Figure 5. Construction using direct bonded copper (above) and ceramic (below). 5/2007 - elektor electronics 43 TECHNOLOGY LED-DRIVERS Power to the Driver circuits for high-power LEDs Eberhard Haug LEDs have started living up to their name in recent years: "Advanced Power TopLEDs' from Osram are used as daytime running lights in the new Audi R8 (photo: Audi AG). Although the acronym 'LED' has stood for 'light-emitting diode' since the 1960's, LEDs have only recently started to emit significant amounts of light. High-power LEDs need suitable drivers to enable them to emit light under a wide variety of conditions. Here we present a summary of driver designs ranging from simple to sophisticated. We can't say it too often: LEDs are essentially current- driven devices. This is simply due to the fact that they have non-linear current versus voltage characteristics with a distinct 'corner', which depends on the colour or the technology-dependent forward voltage. To make things even worse, the 'corner' or threshold voltage is tempera- ture dependent and varies from one device to the next. Figure 1 shows the measured current versus voltage characteristics of three high-power white LEDs (also called high-brightness LEDs or HB LEDs) from different manufac- turers. However, these characteristic curves could just as easily be measured with three different examples of the same type or at three different temperatures. Although even a small change in voltage causes a large change in the LED current and thus the brightness of the LED, a small change in current (in the normal operating range) does not produce any significant change in LED brightness. Linear LED driver This means that LEDs must be powered by a stiff current source. The combination of a voltage source and a series resistor that limits the current through the LED to the desired or permitted value can only be used if the supply voltage is more or less constant or an especially inexpen- sive solution is required. In many cases, a linear voltage regulator with a suitable load resistance can be regarded as a 'good' LED current source (LED driver). Figure 2 shows a linear LED driver for powering three HB LEDs with a supply voltage (U B ) of 1 2 V. In contrast to standard three-pin linear regulators such as the LM3 1 7T, the MIC291 52 [1 ] has a supplemen- tary Enable input that can be used to switch the regulator on or off, but it is also quite suitable for PWM dimming at a frequency of several hundred hertz. Pull-up resistor R2 is only necessary if the EN input is driven by a switch contact or an open-collector signal. A TTL or CMOS logic signal can also be used for this purpose. R2 can be omit- ted in this case, or it can be connected to the logic supply voltage instead of +U B . The 1C can easily source 350 mA with three LEDs and a 1 2-V supply voltage, and it doesn't need a heat sink. The LED current is determined by the ratio of U1 and R1 (/ LED = U 1 /R 1=1 .24 V / 3.9 Q = 3 1 8 mA). If you want the full 350 mA, you can connect a 39-Q resistor (El 2 series) in parallel with R1 . The losses in the linear circuit are dissipated in current sense resistor R1 (approximately 0.5 W) and the low-dropout (LDO) regulator. 44 elektor electronics - 5/2007 Due to the low dropout voltage (the minimum voltage between the input and output of the LDO regulator necessary for reliable operation at a specific current), a single HB LED can also be operated from a supply voltage (+U B ) of 5 V. At the other extreme, up to seven LEDs in series can be driven by this circuit if the supply voltage +U B is raised to the maximum permissible value of 26 V (and the voltage rating of the capacitors is in- creased accordingly). Efficiency The basic prerequisite for using a linear LED driver is that the supply voltage is greater than the forward voltage of the LED(s). The product of the difference voltage and the LED current gives the approximate value of the dissipated power with a linear LED driver (ignoring losses in the driver 1C and other components connected in parallel, but including the loss in the current sense resistor, since it is connected in series with the LED). A simple expression for the efficiency can be derived from this: r| = U LED /U B . This means that a relatively high supply voltage leads to low efficiency. However, it is possible to achieve even better efficiency than a more sophisticated switch-mode LED driver if the difference voltage is small, although this requires an LDO regulator that does not need much voltage headroom to control the LED current (the dropout voltage is usually well below 1 V) and the lowest possible voltage drop (around 0.5 V to less than 0.1 V) across the current-sense resistor usually present in such a circuit. As a rule of thumb, you can say that a linear driver is always an attractive option if the voltage headroom (LDO dropout voltage) is less than 1 0%, since its efficiency will be on the same order as that of a switch-mode LED driver but with distinctly less effort, lower cost, and possibly better performance characteristics. Another aspect worth considering is that linear LED drivers do not produce any electrical or electromagnetic interference (as long as they are not dimmed using a PWM signal). LED controller The circuit shown in Figure 3 is similar to the circuit in Figure 2. The MIC5 1 90 is an LDO controller that does not supply the output current directly, but instead drives the LED via a power MOSFET (T 1 ). This makes it an LED con- troller. On the one hand, this means the LED current can have almost any desired value with a voltage drop across the MOSFET that can be limited to almost any desired val- ue, while on the other hand the HB LED can be connected to the positive supply rail, which means that RGB LEDs with a common anode can be used if necessary. Another difference is that here the LED is connected to the drain lead of the MOSFET. This yields sufficient gate- source voltage for the N-channel MOSFET. The LED current sense voltage is only 0.5 V in this circuit. The LED current is thus given by the expression / LED1 = 0.5 V/Rl . The MOSFET may require a heat sink, depending on the LED current. This example also indicates how a three-channel LED driver (for example, for a high-power RGB LED) can be implemented. For simplicity, the drive circuitry of the second and third channels using two additional LDO controllers is not shown here. The LED currents can be set individually using R1 , R2 and R3, which can be used with an RGB LED to obtain the best white balance. PWM dimming (or colour adjustment in the case of an Figure 1. Current versus voltage characteristics of high-power LEDs from different manufacturers. Although even a small change in voltage causes a large change in LED current and thus the brightness of the LED, a small change in current has almost no effect. +12V 0 — r +U B j R2 EN a IN OUT IC1 MIC29152 EN ADJ GND GND ©- C2 10(i 25V < E o m co I LED2 SE LI 21 LED3 +Ui 1 V24 R1 Cl □ 0W5 X 10^1 25V 070013-14 Figure 2. A linear LED driver for powering three high-power LEDs from a 12 V supply (maximum total forward voltage 10.5 V). The Enable input can even be used for PWM dimming at a few hundred hertz. RGB LED) is again possible using the Enable inputs. Once again, the pull-up resistor R50 can be omitted if EN1 is driven by a logic-level signal. This LED controller does not need any capacitors in the output circuit, so relatively high PWM dimming frequencies can be used thanks to the short response time. The circuit shown in Figure 3 can be used to power one LED per channel in a 5-V system. If you want to connect several LEDs in series (in which case it is naturally no longer possible to use common-anode RGB LEDs), you can simply increase the supply voltage to a suitable level and connect the most positive anode to the supply rail. If you do not have MOSFETs suitable for logic-level drive, you will need a separate power supply for VCC2 (refer to the MIC5190 data sheet 2]). Switch-mode LED driver There are two conditions under which it is practically imperative to use a switched-mode LED driver. The first condition is when there is a large difference between the supply voltage and the net forward voltage of the LED(s), combined with a high LED current. The second condition is when the total LED forward voltage is larger than the 5/2007 - elektor electronic 45 TECHNOLOGY LED-DRIVERS Figure 3. The 1C used here is a LDO controller that does not supply the output current directly, but instead drives an LED via a power MOSFET. sense voltage to the level of the available reference voltage or starting with a small reference voltage. As more and more step-down voltage converters for output voltages below 1 V are becoming available, it should be relatively easy to find a suitable candidate among modern ICs. The especially simple and tiny MIC4628 HB LED driver (Figure 4) can power up to three HB LEDs in series with a 24-V supply voltage (typically available in industrial sys- tems). The Enable input can be driven by a 24-V signal or a contact if necessary, but it can also be driven by a logic signal. In this case, R5 can be omitted or connected to the logic supply voltage instead of +L/ B . The value of Cl must be selected according to whether PWM dimming is to be used. The suggest value of 220 jjF can be used for the least possible LED current ripple if dimming is not necessary. If PWM dimming is necessary, use a value of 1 0 piF for C 1 (tantalum or aluminium electrolytic) so it can discharge faster. The circuit remains stable despite the smaller value of Cl , although the ripple current (as measured with a 100% PWM dimming ratio) is somewhat larger. With the given component values, the voltage divider at the output (R3/R4) limits the output voltage to approxi- available supply voltage. The first case involves a 'step- down' LED driver, while the second case involves a 'step- up' LED driver (all pretty logical, isn't it?). However, even more complicated solutions are possible. In contrast to a step-down voltage converter (also called a 'buck regulator'), a step-down LED driver is a switch-mode current source instead of a switch-mode voltage source. In the same way as a linear voltage regulator can be used to make a linear LED driver, a switch-mode voltage source can be converted into a current source relatively easily by using a current-sense resistor (R s ) in combination with the reference voltage U REF (typically 1 .2 V) to generate the desired LED current. The LED current is then given by the expression ^LED = ^REF / ^ The drawback of this approach is the relatively high reference voltage, which degrades the overall efficiency despite the use of a switch-mode current source. This can be remedied by amplifying a significantly smaller current- mately 14 V if the LED string is open (be careful with connecting the LEDs if the circuit is already switched on!). R1 sets the LED current. Its value is taken from a diagram on the MIC5682 data sheet [3]. A value of 22 kQ for R1 yields a LED current of approximately 700 mA. One criterion for selecting a suitable switch-mode LED driver is its switching frequency (the available range is a few dozen hertz to several megahertz). This essentially determines the size of the coil, and it inversely affects the level of LED current ripple that can be achieved. However, dynamic losses can increase strongly at high frequencies, depending on the design, thus decreasing the achievable efficiency. Figure 4. This simple step-down LED driver can power up to three series-connected high power LEDs when used with a supply voltage of 24 V. 46 elektor electronics - 5/2007 LEDs on the mains An extreme case of a step-down LED driver is powering LEDs directly from the mains voltage. Here the objective is to obtain a relatively high LED current, usually at a very low LED voltage, from a very high and highly variable voltage. The main challenge here is the extremely low PWM duty cycle resulting from the ratio of the LED forward voltage and the actual supply voltage (usually the rectified AC mains voltage). With a single white LED and a 230-V mains voltage plus a 15% overvoltage allowance, the worst-case duty cycle would be approximately 1%. The number of suitable converter ICs that can meet such requirements is rather small. An example of a possible implementation of a step-down LED driver for operation from the AC mains has already been published in Elektor Electronics under the title 'HV9901 - a novel LED driver' [4]. A completely new approach is provided by LEDs that can be operated directly from the AC mains without a driver. In any case, the Acriche LED modules displayed by Seoul Semiconductor at the Electronica 2006 trade fair (Figure 5 ) certainly drew attention. A few other companies, such as Lynk Labs, are also active in this area. Figure 5. The Acriche LED modules from Seoul Semiconductor can be operated directly from the AC mains without a transformer. This is a 2-watt single-LED module. The manufacturer plans to boost the light yield from the current 48 lumen/W to 80 lumen/W in Q4 2007 and 120 lumen/W in 2008. the LED, since especially with a relatively low battery voltage the required peak currents in MOSFET switch and the converter coil can be correspondingly high. For this reason, such converters usually require a minimum supply voltage of more than 2 V so they can continue to provide satisfactory operation with two nearly discharged batteries. Although step-up LED drivers for high-power LEDs that can operate from a single cell (nominal voltage Manufacturers Manufacturers of LED drivers (list not necessarily complete) www.allegromicro.com www.analog.com www.austriamicrosystems.com www.catsemi.com/ www.fairchildsemi.com www.infineon.com www.intersil.com www.ixys.com www.linear.com www.maxim-ic.com www.melexis.com www.micrel.com www.microchip.com www.monolithicpower.com www.national.com www.nxp.com www.onsemi.com www.ricoh.com/LSI/ www.rohm.com www.semtech.com www.sipex.com www.st.com www.supertex.com www.ti.com www.zetex.com Step-up LED driver The other end of the supply-voltage spectrum is found with very low supply voltages, usually provided by batteries. A step-up LED driver (also called a boost regulator) is essential in such cases. The number of LEDs to be driven varies, and it can be as much as ten or more LEDs in series, which yields a total LED forward voltage of more than 30 V. A step-up LED driver of this sort using a MIC2 1 96 boost controller [5] with an N-channel MOSFET can easily drive a six-chip Ostar LED with a rated power of 24 W. Here you have to bear in mind that with this type of boost topology, the input voltage must be lie below the LED forward voltage. This versatile circuit is described in detail in the documentation of an evaluation board available from Micrel [6]. Here the challenge to the designer is not so much the voltage ratio as amount of power that must be supplied to D1 The triumphal march of high-power LEDs is imminent. This is the author's suggestion for a dynamo-driven LED lighting system for bicycles [7]. 5/2007 - elektor electronic 47 TECHNOLOGY LED-DRIVERS 1 .2-1 .5 V) are technically feasible, they are not necessar- ily economically feasible. Another tricky issue with step-up drivers is PWM dimming. Entire essays can be written about the advantages and disadvantages of PWM dimming, so here we limit ourselves to the remark that if you want to have a large dimming range (0-100% if possible), you need a step-up LED driver with a relatively high switching frequency and a relatively small control-loop time constant. One of the critical situations that must be mastered with a step-up converter is operation with an open load circuit. A failed LED normally leads to an open circuit, and only rarely to a short circuit. There are several possible approaches to open-circuit protection. The simplest solution is a Zener diode with a breakdown voltage greater than the maximum total LED forward voltage. The disadvantage of this is that the Zener diode must conduct the LED current in case of an open circuit, and the resulting power dissipation [U z x / LED ) is always greater than the total power dissipation of the LEDs. A much more elegant solution is to use a voltage limiter such as with a voltage regulator, but this usually requires a supplemen- tary input pin on the 1C. Alternatively, the Zener diode can be connected directly to the current-sense feedback input and the current-sense voltage ca be provided via a resistor that normally does not carry any current. In this case, a situation in which the setpoint value of the control loop is exceeded can be simulated if the LED chain is open. This avoids unneces- sary output power dissipation in case of an open-circuit condition and eliminates the need for an additional pin. These tricks are incorporated in the circuit diagram shown in Figure 6, which is a step-up LED driver based on an MIC2196. Mixed-mode operation Besides the previous described step-down and step-up LED drivers, there are implementations that support mixed- mode operation. LED drivers of this sort are necessary in situations where the battery voltage is higher than the LED forward voltage when the battery is fully charged but drops below the LED forward voltage during operation. LED drivers of this sort are usually based on Sepic, CUK, buck/boost, or inverting buck/boost topologies. These LED driver topologies are also used when the supply voltage is fixed (such as in a car) but the number of LEDs can vary. A combined step-up/step-down solution can be used as a versatile but complicated 'general- purpose' LED driver in such situations. Another type of step-up circuit is the charge-pump LED driver, which is based on capacitors instead of the coils used by the previously described types of switch-mode LED drivers. In simplified terms, a charge pump uses MOSFET switches operated in a suitable switching arrangement to generate an output voltage by 'stacking' the charges stored in the capacitors. It is usually only possible to obtain a multiple of the input voltage, which is the main drawback of these compact circuits. In most cases, the LED forward voltage is not an exact multiple of the input voltage, so the charge pump is usually followed by a linear LED driver to regulate the current. This means that the efficiency depends indirectly on the input voltage, but it is relatively good if the LED forward voltage is just below an integer multiple of the input voltage. Modern charge-pump LED drivers can even adjust the multiplica- tion factor automatically, which can be seen from their step-shaped efficiency characteristic curves. ( 070013 - 1 ) Weblinks [1 ] www.micrel.com/_PDF/mic291 50.pdf [2] www.micrel.com/_PDF/mic51 90.pdf [3] www.micrel.com/_PDF/mic4682.pdf [4] Elektor Electronics, January 2004 [5] www.micrel.com/_PDF/mic21 96.pdf [6] www.micrel.com/_PDF/Eval-Board/mic21 96_led_eb.pdf [7] www.led-treiber.de Figure 6. Circuit diagram of a step-up LED driver. Zener diode D3 provides open-circuit protection (see text). Uin Uout 10V.. .16V , H D1 17V.. .30V 48 elektor electronics - 5/2007 EzPCB; Easy Way To RGB 4 UL Proved Hfgh Quality ISO 9000 Certificated ^ * Accept Ordera From 3pcs to 1M Pcs. ■h w VB V»' p Capabilities: fP? JL ;p * •* Up to 40 l\ • . ^ 2. 5mi) Track/ ^pace *0? ftffli Hole Size ■ % -* % Blind And Buried Vias * RoHs, H VVEpE Compliant * * •* Prices: ^ \ ** ** * , Only $50 For S|dcs 4^/ 4^ 2L Only $188 For 3pcs 4" x 4"^4L Only $288 Fj*»~3pcs 4' *4' „ 0 Free Solder Mask & Silkscreen Ve^> Competitive Price For Bulk Orders m ^ d *** I I ■ * ■ f^r rj t v . Http: //www. ezpcb. com ■SCf#G_Li'\ * ■ sa!e§|ezpcb. com Anoftf ILjfcMOrnC'u XBameStatudn Lriflw a-TTP^»V^H TTHS 1 Mm* TQ Ci ml j"> , juvcr iirmOM focjn Omh v-r.-f □ lja^e Lirs'-vrim f r minims try Itw Atari SOO 2&M, EUncLiir 2X Sp*cii urn. Apo** U (L CefflRWtfPA fi4f rM^rUby WCf * lpF« / V s'*. V * - TuMti* ft ^s ' ■ £i’? j| Ini Hirir!>vMli. Ahl/t Skitfivni" . * ' T>* Fun VYjt Ho Lrjn-n EjttfjmMM S-f-WBfll ^ " +P\rt>r A^HK'ihlJ'^ii X4S Miuu Ddttfa^ LJta*l ? >C«f-;M¥ firvl^mr P.H! ■ rBwc:*i HI EhrtfKJHft« c# XOSCwweia ^CiAftn jihI Pwn* Sugelv kmluilntT WWW.XGAMESTATinN.CDM 3JJ PHi ‘9g5 ! 7-36rSQPB | B4iFtpomrfu^i ..h /r . ntt S^*ali. Si ■H-Sfi* uS* HtVM. r.i€T Schaeffer I JK0 Customized front panels can be designed effortlessly with the Front Panel Designer. The Front Panel Designer is available free on the Internet or on CD. FRONT PANELS & HOUSINGS Cost-effective single units and small production runs • automatic price calculation • delivery in 5-8 days • 24- Hour-Service if required f rrrr p. m ._ ■ ■ II P r _ _ Sample price: 30,42 € plus VAT/shipping Schaeffer AG ■ Hohentwielsteig 6a • D-14163 Berlin • Tel +49 (0)30 8058695-0 Fax +49 (0)30 8058695-33 • Web info@schaeffer-ag.de • www.schaeffer-ag.de 5/2007 - elektor electronics 49 R8C DESIGN COMPETITION Speedmaster The winning circuit in 3D Markus Simon Here is the circuit voted winner of the International R8C Design Competition by Elektor Electronics readers: an intelligent 3D accelerometer that not only measures acceleration on all three spatial axes, but also calculates the total distance moved. And, as promised, a ready-assembled printed circuit board! Figure 1. The R8C/13 daughter board described in the February 2006 issue. It all began in February 2006 with the Tom Thumb’ R8C starter kit special of- fer: an ultra low-cost R8C/13 processor on a carrier board to which you could solder two SIL headers (see Figure 1). The response from our readers showed that this tiny 16-bit microcontroller had inspired many people to develop their own projects. As a result, we an- nounced in the May 2006 issue of Ele- ktor Electronics our international R8C design competition. An expert jury was assembled to judge the excel- lent response, and the winners were published in the November 2006 issue — with the exception of the first prize, which we asked our readers to decide. An essential part of the first prize was that we would see the winning design go into production. Our readers have now reached their decision. From the concept... Ten years ago, on a skiing holiday, Markus Simon was wondering (as any self-respecting engineer would) what would be the best way to meas- ure his speed on the slopes. It rapidly became apparent that suitable accel- eration sensors were far too expensive and that small microcontrollers were not powerful enough. Ten years on, we have the economical MMA7260Q sensor from Freescale as well as the Elektor Electronics R8C board. When he heard of our competition, Markus went back to his idea with renewed ambition. The first thing was to plan the kind of functions that the completed design might offer. The author imagined a de- vice that could calculate speed from two- or three-dimensional acceleration information, and, from that, calculate distance travelled from a given start point. That all sounded rather compli- cated; however, pilots were already ac- customed to using accelerometers in addition to GPS for navigation. The device could also be used in cars to measure acceleration and the effec- tiveness of the brakes, along with in- stantaneous speed and distance trav- elled. Another application would be to measure how smoothly a lift is control- led or how exciting a fairground ride is. And we can estimate how many horse- power a car would need to provide a g-force comparable to that experienced in an aircraft on take-off. The particular charm of this project is that so little hardware is required: just the sensor, R8C board, and an LCD panel. And, like practically every mi- crocontroller-based project, the real cleverness lies in the software. 50 elektor electronics - 5/2007 About the author: Markus Simon studied Elec- tronic Engineering at the Koblenz University of App- lied Sciences, specialising in instrumentation and process control technology. Since graduation in 1996 he has been working on software development for embed- ded systems. In his spare time he works on digital electronics. ... via the printed circuit board... The hardware consists of the R8C module, a three-axis acceleration sensor, and a three-line LCD module. Two of the lines of the display can be used together to pro- duce large, easy-to-read characters. Besides these com- ponents there are also three buttons to operate the unit, some simple power supply electronics, and a couple of capacitors and resistors. Just a few small changes from the prototype design have been made to the printed circuit board for produc- tion. Figure 2 shows the front and back of the populated board. Hard-core experimenters can of course assemble a Speedmaster unit themselves from the individual com- ponents. Tip: two free MMA7260Q devices on carrier boards are supplied free of charge with parts/PCB set 060297-71 for the Elektor accelerometer project (‘g-Force on LEDs’, April 2007). However, an easier approach is to use the ready-made printed circuit board from Elektor Electronics. This avoids having to work with SMD components and tracking down a supplier for the display and sensor, which come already fitted. All that is left to do is burn the software into the R8C/13 daughter board and then fit this to the main board. Put the whole thing in a suitable enclosure and the job is done. Figure 3 shows the circuit diagram of the Speedmaster. The unit is operated using the three buttons. The bottom line of the display shows the function of these buttons (either symbolically or as text) to simplify operation. All settings are stored in the R8C’s internal flash memory, and so are retained when the device is reset. The MMA7260Q acceleration sensor is a capacitive three- axis device whose range can be switched between 1.5 g, 2 g, 4 g and 6 g (although we do not recommend that readers experience accelerations of 6 g themselves!). Power is provided by four AA cells, rechargeable if de- sired. IC2 is a 3.3 V regulator that can withstand higher input voltages, and so it is possible to run the unit from the 12 V supply in a car without problems. D1 provides protection against reversed polarity ST1 brings out the R8C’s spare port pins P14 to P17. These could be used to connect to an SD memory card in SPI mode to record sensor readings, given suitable soft- ware. The foundations for this modification have been laid in the source code, but are commented out. The display includes a step-up converter to generate, in conjunction with C8 and C9, the higher voltages it re- quires internally Chiefly to economise on power consumption the R8C is clocked at 10 MHz (divider 2 in ‘system clock control’). In Figure 2: Front and back of the populated Speedmaster printed circuit board, fitted with LCD and R8C module. 5/2007 - elektor electronics 51 R8C DESIGN COMPETITION +3V3 +3V3 Figure 3. Considering its capabilities the Speedmaster circuit is remarkably simple. Figure 4. Diagram showing the functions of and interactions between the various software modules. operation, with the LCD backlight off, the circuit draws only about 6 mA, and in power-down mode just 0.5 mA. To extend battery life the circuit automati- cally enters power-down mode 60 s af- ter the last button press, as long as no measurement is in progress. ... to the software The source code to Speedmaster is, of course, too complex to describe in de- tail (or even list in full) here. Instead the various C source files and the cor- responding hex files can be download- ed free of charge from the Elektor Elec- tronics website [1]. The firmware is divided into ten modules whose inter- relationships are displayed in Figure 4. We now look at each module in turn. Speed. c: This calls the function initHW(void) in the module ncrt0.a30 (the NC30 start-up code). This func- tion initialises the system clock (using function IO_set_clock()), the configura- tion of the input and output ports (us- ing function IO_init()), and the system timers (using function TimerX_init()). The tick timer is initialised to use a 1 ms timebase. Timer.c: This is where the 1 ms time- base for the tick timer is generated, us- ing Timer X. TIMER_get_Ticks(void) returns the system tick count, giving the time in milliseconds since the sys- tem was initialised. Function TIMER_ OVER_ms(x,y) returns TRUE or FALSE depending on whether a specified time has elapsed. The A/D converter is triggered on each increment of the tick timer. Thanks to the computing power offered by the R8C it is possible to read in ana- logue values from three sensors every millisecond and process the results. Acc.c: Interrupt service routine ACC_ ADC_ISR(void) captures results from A/D converter channels ANO to AN2. The conversion for ANO (the x-axis) is initiated from Timer.c; when this con- version is complete, the conversion for AN1 (y-axis) is initiated; and when this completes, the conversion for AN2 (z- axis) is initiated. Acquisition and con- version for the three channels takes just a few microseconds. Sixteen readings are averaged for cal- ibration. In measurement mode the arithmetic means of the readings on each axis are taken in groups of four before further processing in Math.c. Four and sixteen are powers of two 52 elektor electronics - 5/2007 Physics fundamentals Acceleration a is the first derivative of velocity v(t) with respect to time: a = dv/dt. It is also the second derivative of displacement s(t) with res- pect to time: a = d 2 s / dt 2 . We can therefore derive these quantities from acceleration as follows. Velocity is the integral with respect to time of a: v = Ja d Displacement is the integral with respect to time of velocity v: s = Jv dt For implementation on a microcontroller we have to evaluate these integrals using discrete time steps (replacing dt by At). Then we obtain the expressions v = a At and s = vt + aAt 2 / 2 for displacement. When set to its 1 .5 g range and operated from a 3.3 V supply the ac- celeration sensor produces an output voltage of exactly 1 .65 V at 0 g. With a sensitivity of 0.8 V/g it outputs 2.45 V at + 1 g and 0.85 V at -1 g. Using the 10-bit resolution of the A/D converters integrated in the R8C we can obtain very precise measurements with low drift. We can also perform a very accurate calibration using the 1 g reference conveniently provided by the Earth. and so the averaging process can take advantage of fast shift operations. Math.c: This function performs cali- bration using the 1 g reference accel- eration due to the Earth’s gravity. In measurement mode the acceleration, speed and distance calculations are carried out every 4 ms. Values shown on the LCD are averaged over periods of 512 ms. Lcd.c: The display driver operates the display in 4-bit mode. The display is updated cyclically every 125 ms via function LC_TASK() in Speed. c. The in- formation to be displayed is read from the global array ucLCD_Display[48] and passed directly to the LCD. Menu.c: The menu control code proc- esses button presses and causes rele- vant text and data to be passed to the LCD module. Flash. c: This file contains the func- tions for erasing and storing data in block A of the internal flash memory. All settings made via the menu are stored here. If any change is made the entire block must be erased and rewritten with the new values from tSpeedParam. Key. c: The keyboard driver is called from the menu control code at Key_ get_ID(). The return value is a code corresponding to the key that has been pressed. The key must be released be- fore another press can be registered: auto-repeat is not implemented. Print. c: Function sprint_f(char*, long int, char) performs the conversion of numbers into formatted strings for dis- play. It writes directly into the display buffer array ucLCD_Display[48]. The sprintf() function from the C stand- ard library is not suitable for use here as its memory footprint is too great. Io.c: Every 50 ms the ‘g-Select’ inputs of the acceleration sensor are updated. At the same time the LCD backlight status is updated from the setting in the control menu. Construction, calibration and operation As we noted earlier, we recommend using the ready-populated printed cir- cuit board: the parts list is only given for the benefit of more intrepid con- structors and the sake of complete- ness. Construction using the ready- made board is very simple: solder in the LCD as described, program the firmware into the R8C module, fit the Calculations To produce our results we need to choose a regular timebase. In the Speedmaster we selected a timebase of 4 ms , which enables us to use the shift instructions of the R8C microcontroller for speed. This in turn gives the advantage of allowing us to use integer variables in all our calculations , which again leads to increased speed. Every 4 ms the acceleration is calculated from the arithmetic mean of the sensor readings. From this we compute the instantaneous velocity and displacement. All the following calculations are carried out in source file Math.c. Velocity: v = a * 4 ms Using the shift operation: USpeed = tMeasure.HAcceleration << 2 Displacement (every 512 ms for positive accelerations): s = 0.5 * a(512 ms) 2 Using the shift operation: //Way = tMeasure.HAccelerationAverage << 4 Displacement (every 4 ms for negative accelerations): s = v * 4 ms Using the shift operation: tMeasure.HDeltaWay += tMeasure. USpeed << 2 5/2007 - elektor electronics 53 R8C DESIGN COMPETITION Figure 5. The Speedmaster menu system. R8C module, test the circuit and fit the whole thing into an enclosure. Do-it-yourself constructors should be- ware one thing: before fitting the dis- play the backlight should be soldered to it. The protective films should be re- moved from the backlight and display (both front and back) first. Calibration is performed from the menu (see Figure 5). Using a spirit level, turn the Speedmaster so that each axis in turn experiences the 1 g acceleration due to the Earth’s gravity. A correct- ly calibrated and accurately aligned Speedmaster should indicate 1 g on the axis that is vertical and 0 g on the other two axes. Operation of the device is largely self- explanatory: have fun experimenting! ( 070021 - 1 ) Web link [ 1 ] http ://www. elektor-electronics . co .uk/Default . aspx?t abid =110 Acceleration due to gravity: the good and the bad The constant presence of Earth's gravity makes precise calibration of the unit very simple , but unfortunately has a detrimental effect on measurements. This effect is particularly noticeable when the an- gle that the Speedmaster makes to the horizontal changes during a measurement or between two measurements. The effect is detectable when the orientation of the Speedmaster is different in its initial po- sition from its orientation while a measurement is being carried out. In the skiing example the orientation of the Speedmaster changes frequently in a hard-to-reproduce way and it is very difficult to remove the effect of the Earth's gravity completely. Perhaps an ingenious reader can come up with an elegant solution to this problem. Ideally we would measure the orientation of the device , but it is not clear how this can be done. 54 elektor electronics - 5/2007 components list Resistors R1,R2,R3 = lkQ R4 = 1 0£2 R5 = 4k£27 Capacitors Cl ,C2,C4-C7,C1 0,C1 1 = lOOnF C3 = 10jL/F C8,C9 = IjL/F 25V Cl 2 = 22jL/F 25V Semiconductors D1 = 1N4001 T1 = BC547C IC1 = MMA7260QT (Freescale) IC2 = TS2950CT-3.3V MODI = R8C/13 carrier board Miscellaneous K1 = 1 0-way SIL pinheader $1,32,33 = pushbutton LCD1 = LCD type EA DOG-M, 3 lines, with backlight 32-way socket for MODI Ready assembled board 070021 -91 , populated & tested board (ex- cept MODI and K1 ) 5/2007 - elektor electronics 55 This adaptor was originally intended to allow programming of the memory and CPLD of the PSD813 used in the GBECG Gameboy cartridge, which converts this games console into an electrocardioscope (see October 2006 issue). But it's much more universal than that (see box entitled In-Circuit JTAG') Our adaptor connects to a PC parallel port and uses the JTAG IEEE 1 149.1 protocol. Informed microelectronics amateurs will of course be aware that other ‘In- Circuit’ programmable devices use this same port (parallel) and an identical protocol. Unfortunately, the program- mer/emulators intended for these de- vices are not compatible — far from it in fact: so there’s no point hoping for a mixed marriage! However, closer examination of the cir- cuit diagrams of certain programmers suggested by the IC manufacturers shows that the differences are relatively minor and in fact concern the intercon- nections between the LPT port signals and the JTAG connectors. So a few mul- tiplexing functions is all it takes to pro- duce a ‘universal’ adaptor. Had it been achieved using convention- al logic components, the circuit of our adaptor would have been quite com- plex, with different electronics for each of the sections for the different types of processor. Using an EP900 program- mable logic circuit (Altera, on free offer from Elektor) makes it possible to offer a very cheap and simple programmer. Many manufacturers have adopted the JTAG (Join Test Action Group) protocol for programming, debugging, and test- ing their ICs in situ on the board (IC for In Circuit). Fortunately, you don’t need to know all the details of this protocol to be able to use it: the PC software (usually free) and the target compo- nents each include a JTAG core that al- 56 elektor electronics - 5/2007 lows them to communicate completely transparently. The devices involved have special JTAG’ pins that you merely need to connect to the pins of the same name on the programmer connector. The size (number of contacts) and pinning of this connector differ from one manufacturer to another. This information is given in the various diagrams shown in the box- es of Figures 1-4, concerning respec- tively Altera CPLDs and EPLDs (Byte- blaster II) (Figure 1), Xilinx CPLDs and EPLDs (Parallel Download Cable) (Fig- ure 2), MSP430 microcontrollers from Texas Instruments (LPT IF 4 wire JTAG Communication) (Figure 3) and the PSD, uPSD and DSM families (Flashlink FL101) from ST Microelectronics (Figure 4). It should also be noted that there is a certain discrepancy in the naming of the signals between the different JTAG connectors. j JTAG 'In-Circuit' - ; some applications 1 - PSDs, uPSDs and DSMs from ST Microlectronics l - MSP430 microcontrollers from Texas Instruments - EPLDs and CPLDs from ALTERA I - EPLDs and CPLDs from XILINX V C C © TCK 1 O O 2 GND TDO 3 o o 4 VCC TMS 5 o o 6 7 o o 8 TDI 9 o o 10 GND a* 6 8 10 -o o o o o o o o v C c © 1 TCK 3 TDO 5 TMS 7 9 TDI jt: j* tri I 4> ■{> -{> TCK Vcc TDO Target TMS Altera Device TDI GND 060287- 12 ADAPTOR CIRCUIT Figure 1. CPLD and EPLD (Byteblaster II) from Altera: 10-pin DIL connector. Software: Quartus II Web Edition, Quartus II Programmer [1] The heart of the circuit (Figure 5), which with its 44 pins could hardly go unnoticed, is an EP900 PLD. This PLD forms the link between the PC’s parallel port, Kl, and the four DIL pin headers for the JTAG connections to the four tar- gets, named respectively MSP430 (K2), FLASHLINK (K3), XILINX (K4) and AL- TERA (K5). SW, a dual-gang DIP switch comprising contacts JP1 and JP2, al- lows selection of one of the 4 types of programmer recognized by the JTAG adaptor (see truth table in the circuit diagram, also given on the component overlay on the board). These four op- tions appear in the form of the same number of HE- 10 headers in the bottom right-hand part of the circuit. Each op- tion has its own logic structure with- in the EP900; all these various sub-as- semblies using logic gates are shown in Figure 6. Each of these structures is drawn from the manufacturers’ programmer circuits. For reasons of efficiency, the EP900’s logic structure is described in Altera’ s AHDL language. The circuit diagram is easier for an electronics technician to read, but the AHDL’ form is more ef- ficient here. Just for information, the ‘source’ file (.tdf) for the contents of the EP900 is given in the inset. At the bottom left we find the . . . POWER SUPPLY The EP900 PLD is quite an old IC al- ready! It requires a 5 V supply, but as its consumption is quite high, the pro- i GND 3 GND 5 GND 7 GND 9 GND 11 GND 13 O o O o O o O o o o o o 1 ° U=£= 2 VCC 4 TMS 6 TCK 8 TDO 10 TDI 12 14 V C C © --o 11 13 o o o o o o o o o o o o-- 10 12 14 TMS TCK TDO TDI <■ XILINX O- SX T Vcc T I GND TMS TMS TMS TDI TDO TDI TDO TDI TDO TCK TCK TCK 060287-13 Figure 2. CPLD and EPLD (Parallel Download Cable) from Xilinx: 14-pin DIL connector. Software: ISE WebPACK [2] TDO TDI TMS TCK GND RST 1 3 5 7 9 11 13 O O O O O O O O O O O o O o 2 4 6 8 10 12 14 VCC out VCC in TCLK TEST V C C Figure 3. MSP430 microcontrollers (LPT-IF 4-wire JTAG Communication) from Texas Instruments: 14-pin DIL connector. Software: lAR-Kickstart [3] 5/2007 - elektor electronics 57 JTAG ADAPTOR About the author Marcel Cremmel, the author, has been a qualified lecturer in Electrical Engineering, electro- nics option, since 1979 (state certified by the French National Education system). After completing his first years of teaching in the School of Engineering in Rabat in Morocco, under the Co-operation scheme, in 1 982 he was assigned to the Louis Couffignal College in Strasbourg, in the BTS SE section (Higher Technician's Certificate, 'electronics systems'). His job requires him to cover all fields of electronics, though his preference is for telecom- munications, video, microcontrollers (MSP430 and PIC) and programmable logic devices (Altera). Alongside electronics, his other passion is motorbikes in all their forms: touring, competitions, etc. His personal website is at http://electronique.marcel.free.fr/ Figure 4. PSD, uPSD and DSM families (Flashlink FL-101) from ST Microelectronics: 14-pin DIL connector. Software: among others, PSDsoft Express [3] for programming the PSD813 in the ECG cartridge for Game Boy. gramming adaptor can’t be powered di- rectly from the outputs of the PC’s LPT port. To simplify implementation and al- low us to dispense with a special dedi- cated power supply, we have decided to power the adaptor from the power rails in the target systems. But these are usually content - especially nowa- days! - with 3 V or 3.6 V, which is not enough to power the EP900. So we’ve fitted the adaptor with a very flexible switched capacitor voltage con- verter that supplies a regulated 5 V out- put from an input voltage anywhere be- tween 2.7 and 5.5 V! Yes, that’s right: the converter works just as well with an input voltage either lower or higher than the output voltage, with an effi- ciency of around 90% ! Bravo to the Burr Brown engineers (that company since taken over by Texas Instruments, which explains why the spec, sheet has to be obtained from the TI website). Howev- er, the current is limited to 30 mA. The only awkward point for amateurs is the size of the regulator IC (it’s only available in an SM version), making it tricky to solder. But luckily it only has six pins. So its now or never, to try your hand with an SM device. Position IC2 accurately on its pads. Apply a little sol- der to one of the pad + legs. Once the solder has set, solder the leg diametri- cally opposite the previous one. If eve- rything is OK, now solder the remain- ing legs. If you create a solder bridge between two legs, remove it using de- soldering wick. CONSTRUCTION As shown in Figure 7, the board de- signed for this project is double sided; it uses only a very few SM components, mainly around the EP900. Naturally, these are to be fitted on the track side of the board. So let’s get stuck in! For reasons of practicality, we recommend starting with the SM components. Watch out - certain of them, in particu- lar capacitor Cl, are tucked away at the centre of the board, right between the legs of the PLCC44 socket (into which the EP900 is going to be plugged, on the other side). Take care to solder the regulator IC2 carefully, as without this, nothing else will work. It’s surround- ed by capacitors that are bigger than it is. Take care to identify the values of the SM components correctly (resistors often have coded value information: 103 means 10 kQ, 1203 means 120 kQ; things are trickier with the capacitors, which are often not identified or iden- tifiable. Once the SM components are fitted, you can fit the row of resistors, the rest of the conventional compo- nents, the selector SW, the headers K2 (MSP430) to K5 (ALTERA), the PLCC44 socket, finishing off with the 25-pin sub- D connector Kl. Make sure you pick the male version of the printer connector (LPT); the female version won’t make for a very good connection! One little note about the dual selector SW: it’s not always easy to get hold of a dual DIP switch, so we’ve left enough room to fit a quad one, but you’ll need to cut off the spare legs before you fit it. If you’re making your own board, it’s equally possible to make it single-sid- ed - the second side of the double-sided board is in fact only used to avoid the need for the wire links that a single- sid- ed version will require. Construction is the same, but in this case, it’s prefer- able, for reasons of practicality, to start off by fitting various wire links, using tinned copper wire. Take care to avoid shorts with the wire links positioned between the ‘FLASH- LINK’ and ‘XILINX’ connectors, which are relatively close together. All that remains is to plug the EP900 into its socket. Check the quality of your construction one last time (soldering, component values - luckily there’s only one value for the conventional resis- tors), as there is no way of testing the proper operation of this circuit except by trying it out for real! Note about the EP900 PLD (order code 060287-41): this is available pro- grammed, free of charge (apart from standard postage and packing charges) from the Elektor SHOP If you order PCB # 060287-1, the programmed IC will be automatically supplied with it. TARGET CONNECTIONS Watch out - you must only use one connector at a time! In most cases, a 58 elektor electronics - 5/2007 SUB D25 ? VCCIN ©- C5 □ +5V © o- 1 STROBE 14 AUTOFDX o_ 2 DO 15 ERROR 3 D1 16 INIT o_ 4 D2 17 SLCTIN 5 D3 sj- 18 GND1 6 D4 1 v^r- 19 GND2 1 7 D5 1 20 GND3 1 r>L_ 8 D6 1 21 GND4 1 9 D7 22 GND5 10 ACK 1 23 GND6 1 11 BUSY 1 24 GND7 1 12 PE 1 25 GND8 1 rv. 13 READY 1 100R 100R 100R 100R 100R 100R 100R 100R 100R 100R 100R 100R 100R 100R 100R 100R C3 II 220n PUMP+ PUMP- 102 IN OUT REG710NA-5 EN 47(0. C2 2(o2 X +5V © R28 R29 R30 R3 R32 R1 2 24 STRB 20 RIO . AFDX 19 R9 DO 21 R17 ERR 30 R8 9 D1 25 R11 INIT 26 R7 D2 27 R12 SLCT 41 R6 D3 32 | R5 D4 31 1 | R4 D5 34 1 | R3 D6 33 1 | R13 D7 ACK 35 1 | R14 BUSY 37 1 | R15 1 PE 38 1 ' | R16 RDY 40 2 +5V © 44 R35 © © CLK1 CLK2 IN IN IN IN IN IN IN IN I/O I/O I/O IC1 I/O EP900LC I/O I/O I/O I/O I/O SELO SEL1 NC NC IN IN IN I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O 22 10 R37 43 42 X7 39 R36 JP1 JP1 JP2 ON ON ALTERA OFF ON XILINX ON OFF PSD OFF OFF MSP430 JP2 VCCIN © R34 100R 100R 100R R20 R24 TDO TDO F R25 NstatTDO 11 12 13 - \ 100R \ R19 TMSTDI 14 15 JI6 18 100R 100R 100R R21 TCLK R22 TCKTMS R23 TDITMS - \ 100R \ R26 TCK RST 28 29 36 6 _ 7 H 1 00R \ - \ 100R \ R18 R27 23 TDO TCK TCK A R33 $ VCCIN K5 ALTERA VCCIN © N y TCK A 1 TDO V TMSTDI NstatTDO 7 TDI TMS O o- O o- O O o o- o a 10 TCKTMS TDO TCK C4 C7 ■ □=□ +5V -© VCC IN K4 © XILINX 47(j. 11 13 o o- o o- o o o o- TMSTDI TCKTMS 8 Nstat TDO 10 TCK RST 12 14 VCC IN K3 @ FLASHLINK \ TMS TDI VTDI TMS \TOK_RST_ \TDO_F_ 11 13 O O o o o o 8 TDO TCK / 10 12 14 X VCCIN © K2 MSP430 ©— i TDO 1 \ TMS TDI V TCK TMS V TDO TCK ^TCK RST 11 13 o o o o o o o a TCLK/ 8 TDITMS/ 1 JO 12 14 060287-11 Figure 5. The EP900 takes pride of place in the centre of the circuit for the universal JTAG programmer. It's available ready-programmed, free of charge, when you order the PCB 060287-1. 5/2007 - elektor electronics 59 JTAG ADAPTOR ALTERA TCK TMS PIN8 PIN6 TDI ACK TDO- PIN7- BUSY READY |*S,WIFt ERROR XILINX NT 1 Hi rs Ri Hi D3 i , \NOT [>-j [S^WIRE ^^/VIRE l VCC ^^VIRE ^^VIRE ± D4 TDO AND2 D- READY 060287 - 16 Figure 6. Nothing like it to illustrate the flexibility of a PLD like the EP900! A single device can fulfil several complex logic functions. simple 10- or 14- way ribbon cable, with a crimped connector at each end (watch out for the orientation!) is used to es- tablish the electrical links between the target and the adaptor (see the circuit diagrams of Figures 1 through 4 and the pinning of the relevant connectors). If you have direct access to the rear of the PC, the adaptor can be inserted di- rectly into the LPT port, without using an extender cable interconnecting the PC and the JTAG adaptor. USB adaptors The latest office and notebook PCs no longer have parallel ports (LPT) - a highly regrettable decision, especial- ly for this project! To make up for this, you can find USB/LPT adaptors, but do make sure you check their compatibil- ity with our JTAG programmer; many of them will only accept printers. We can’t go into details of the programming pro- cedures for all the possible targets, so we’re going to confine ourselves to one example, the. . . GameBoy ECG cartridge The cartridge uses an SMD connector with a pitch of 1.25 mm (K3). To make the cable, we recommend you follow the following procedure. 1. Press a piece of 14-way ribbon cable to a female DIL14 connector; 2. Use the Molex connector and the wires already prepared in the compo- nents list (see Elektor Electronics Oc- tober 2006) to make up the appropriate 6- way connector for K3; 3. Solder the four wires TCK, TDI, TDO and TMS and the two power supply wires to both connectors; 4. Check the connections with a conti- nuity tester and then insulate the sol- dering with heat-shrink sleeving. And there you go, all ready to program the PSD813s in the GameBoy ECG cartridge. One last remark: the adaptor is compat- ible with Byteblaster II (Altera); it does not work with the first version of the driver (Byteblaster on its own, with- out the II). This old driver was used by the MaxPlus II software, and has been replaced by Quartus for two or three years now). ( 060287 - 1 ) Figure 7. Component overlay for the board designed for this project. The track layout is available for free download. 60 elektor electronics - 5/2007 Bibliography and Internet links [1 ] https://www.altera.com/support/soffware/ down load/sof-down load_center.html [2] http://www.xilinx.com/ise/logic_design_ prod/webpack.htm [3] http://focus.ti.com/docs/toolsw/folders/ print/iar-kickstart.html [4] http://mcu.st.com/mcu/modules.php? name=Content&pa = showpage&pid = 57 REF710-5 data sheet: http://focus. ti.com/lit/ds/symlink/reg71 0-5.pdf Supplementary information, file # 060287- 1 1 .zip, free download from: www.elektor- electronics.co.uk Components list Resistors R1 ,R3-R27 = 100Q R28-R32,R34 = lOOkQ (SMD) R33,R35,R26,R37 = 10kl2 (SMD) (R2 not fitted) Capacitors Cl = lOOnF (SMD 1206) C2,C4 = 2jL/F2 (SMD 1206) C3 = 220nF (SMD 1206) C5,C7 = 47jL/F 10 V radial (C6 not fitted) Semiconductors IC1 = EP900LC (programmed, order code 060287-41) * IC2 = REG71 0-NA5 Miscellaneous K1 (K_LPT) = 25-way sub-D plug, (male), right-angled pins, PCB mount K2 (FLASHLINK), K3 (MSP430), K4 (XI- LINX) = 14-way 2-row pinheader K5 (ALTERA) = 10-way 2-row pinheader J1 ,J2 (SW) = 2 -way DIP switch PLCC-44 socket Project software, file # 060287-1 1 .zip, free download from Elektor website PCB, order code 060287-1 * Ready-programmed PLD supplied free when ordering PCB # 060287-1 from the Elektor SHOP Optional Parts for the cable connection to K3 on the GBECG: - 14-way (2x7) press-on IDC socket - Molex socket, 6-way, 1 .25mm lead pitch (RS Components # 279-91 78) - 6 wires with crimped contacts for Molex connector (RS Components # 279-9544) j'AHDL' source file for the EP900 Contrary to first impressions, an AHDL file can tell you a lot. Looking at this one a little more closely, it's easy to spot the various options (->). subdesign prog_jtag_univers 1 ( TD0,Nstat_TD0, TD0_F : input; I STRB , AFDX , INIT , SLCT : input; D [ 6 . . 0 ] : input ; ■ SEL [ 1 . . 0 ] : input; — 0->ALTERA, 1->XILINX, I — 2->FLASHLINK, 3->MSP430 ■ ACK, BUSY, READY, ERROR: output; ■ TCK_A,TMS_TDI,TCK_TMS,TDO_TCK,TDI_TMS,TCK_RST,PE : bidir; 1 ) variable ■ TCK_A,TMS_TDI,TCK_TMS,TDO_TCK,TDI_TMS,TCK_RST,PE : tri; begin TCK_A. in=D0 ; TCK_A . oe=AFDX ; case SEL [ ] is when 0 — ALTERA I => TMS_TDI . in=Dl ; TMS_TDI . oe=AFDX ; TCK_TMS . in=D3 ; TCK_TMS . oe=AFDX ; TD0_TCK. in=D2 ; TD0_TCK . oe=AFDX ; TDI_TMS . in=D6 ; TDI_TMS . oe=AFDX; TCK_RST . in=GND ; TCK_RST . oe=GND ; ACK =D4 ; BUSY =TD0 ; PE . in=GND ; PE . oe=GND ; READY=Nstat_TDO ; ERR0R=GND ; when 1 — XILINX => TMS_TDI . in=D2 ; TMS_TDI . oe= ! D3 ; TCK_TMS . in=Dl ; TCK_TMS . oe= ! D3 ; TD0_TCK . in=GND ; TD0_TCK . oe=GND ; TDI_TMS . in=GND; TDI_TMS . oe=GND ; TCK_RST . in=D0 ; TCK_RST . oe= ! D3 ; ACK =GND; BUSY =D6 ; PE.in=D6; PE.oe=VCC; READY=Nstat_TDO & D4 ; ERR0R=VCC ; when 2 — FLASHLINK => TMS_TDI . in=D2 ; TMS_TDI . oe= ! D3 ; TCK_TMS . in=GND ; TCK_TMS . oe=GND ; TD0_TCK. in=!D5 ; TD0_TCK . oe=VCC ; TDI_TMS . in=Dl ; TDI_TMS . oe= ! D3 ; TCK_RST. in=D0 ; TCK_RST . oe= ! D3 ; ACK =GND ; BUSY =GND ; PE . in= ! TD0_F ; PE.oe=VCC; READY=D6 ; ERR0R=GND ; when 3 — MSP430 => TMS_TDI . in=D0 ; TMS_TDI . oe= ! SLCT ; TCK_TMS . in=Dl ; TCK_TMS . oe= ! SLCT ; TD0_TCK. in=D2 ; TD0_TCK . oe= ! SLCT ; TDI_TMS . in=INIT; TDI_TMS . oe=VCC ; TCK_RST . in=STRB ; TCK_RST . oe= ! AFDX ; ACK =GND ; BUSY =GND ; PE.in=TD0; PE.oe=!SLCT; READY=GND ; ERR0R=GND ; end case; end; For info: the 'Jedec' programming file (prog_jtag_univers.jed) is available from the Elektor website (www.elektor-electronics.co.uk). 5/2007 - elektor electronics 61 MINI-PROJECT Refect s^eMe iut h e *s mall esf changes Rev. Thomas Scarborough The circuit described in this article is incredibly sensitive to changes in the magnetic field. It can be used to detect earthquakes, but it can also function as a car alarm or for theft prevention. The construction is straightforward and only sfanlfovd^gmponents have been used inlftie design. The author, who lives in Cape Town, South Africa, originally designed this circuit to detect small earth tremors that could be possible precursors to more violent earthquakes. We know that earthquakes only occur very rare- ly in Western Europe, but this circuit also lends itself for use in several oth- Figure 1 . This oscilloscope trace shows the signals generated when a magnet is moved nearby (see text). er applications. The circuit in question is fairly simple and it uses an ordinary mains transformer as a sensor coil. It is capable of picking up minute chang- es in the magnetic field strength. It is so sensitive that it can detect a pass- ing train at a distance of two kilome- tres. Before we look at the principle of operation we’ll take a look at several possible applications for the circuit: - Theft prevention: fix a neodymium magnet to your laptop or briefcase and the magnetometer will immediately warn you when it’s picked up. - Car alarm: when the car is moved and changes its angle to the Earth’s mag- 62 elektor electronics - 5/2007 Figure 2. The circuit diagram shows the large number of amplification stages used. They ensure that even the smallest variations in the magnetic field can be detected. netic field it will be detected by this circuit. - Vehicle detector: ap- proaching cars or trains can be detected over a large area around the magnetometer due to the vibra- tions they cause. - Extremely sensi- tive vibration alarm: minute vibrations in the vicinity can be de- tected, such as a bouncing ball on a wooden floor tens of me- tres away. - Magnet sensor: the circuit obviously reacts to nearby magnetised objects as well, such as a magnetised screw- driver half a meter away, or even an ‘old-fashioned’ 3.5-inch floppy disk. - Cat flap opener: attach a magnet to the cat collar and when the cat comes close to the cat flap it will be opened automatically by the circuit. Concept There are basically two types of mag- netometer: ones that give an absolute value of the magnetic field strength and others that show the change in the field strength. This circuit detects the variations. Figure 1 shows an oscilloscope trace of the output of the circuit, when a strong loudspeaker magnet was moved at a distance of about a metre away from the sensor (an old mains trans- former). The magnet is first tilted one way (at 0.5 s), then the other way (at 2.5 s), then the magnet is shaken back- wards and forwards (from 5 to 6.5 s) and finally the magnet is slowly rotat- ed. It is interesting to see that you can tell from the shape of the waveform in which direction the field changed. When this circuit was first designed the author wanted to create a seis- mometer that was inexpensive and could operate in a stand-alone fashion (i.e. without the use of a PC or data logger). This resulted in a fairly simple circuit that used standard components, including a mains transformer as sen- sor and an LED bargraph as indicator. There is also a trigger (alarm) output that turns on when the full scale of the LED bargraph is reached. Practical circuit The most important part of the magne- tometer is the detection coil. In the prototype a mains transformer was used (230 V/12 V, 2 A), but in theory nearly any transformer or coil could be used. The author found that the above- mentioned model worked well and gave the circuit a very good sensitivity. The primary and secondary windings of the transformer were connected in series (and in phase) to increase the sensitivity. The coil is connected to the inputs of a type LM380 opamp (see Figure 2). This is really a power-amp IC that can de- liver 2.5 W, but it turns out to be just right for this circuit because it has a fixed gain (50 times) and the output automatically settles to half the supply 5/2007 - elektor electronics 63 MINI-PROJECT Figure 3. A PCB has been designed for the circuit to make the construction easier voltage without the need for separate bias resistors at the inputs. The low-frequency signal is then am- plified further using a number of gates from an unbuffered 4069UB CMOS IC. An unbuffered CMOS inverter can be made to function as an amplifier with the addition of a resistor between the input and output. In this case four in- verters have been used as sequential amplifier stages (IC2A/B/C/E) with passive RC low-pass filters in between (R5/C3, R6/C4, R7/C5). This provides an enormous gain to the output signal from the LM380. All the filter stages (another two follow later on) reduce frequencies above about 20 Hz, mainly to suppress interference from mains- borne signals. Next, IC2D adds another dose of gain to the signal, where the DC offset to the input of the gate is provided by po- COMPONENTS LIST Resistors R1 = 470kQ R2 = 330kQ R3 = 220kQ R4,R10,R13 = 47kQ R5,R6,R7,R9,R1 1 = lOOkQ R8 = 1 0Q R1 2 = lOkQ PI = 1 MD preset P2 = 1 OkD preset P3,P4 = 100kf2 multiturn preset Capacitors Cl = 1 OjitF 1 6V radial C2 = IjliF 16V radial C3,C4,C5,C9,C1 2 = 470nF C6 / C7 / C1 0,C1 3,C1 4,C1 5 = IOOjllF 16V radial C8,C11,C16,C17 = lOOnF Semicondcutors D1-D4,D6-D10 = LED, red, 3mm D5 = LED, green, 3mm D1 1 = 1N4148 IC1 = LM380N-8 IC2 = 4069UB (unbuffered version) IC3 = TL072CN IC4 = LM3914N IC5 = 78L12 Miscellaneous SI = pushbutton, 1 make contact LI = coil, e.g. discarded mains transformer 230 V/ 12 V@2A PCB, ref. 050276-1 from www.thepcbshop.com tential divider R4/P2/P3. After another RC filter (R9/C9) the signal is buffered by IC3A and fed to a halve- wave peak rectifier (D11/C13), which supplies a DC voltage to the input of the LED bar- graph circuit. In this way a peak-hold function is implemented, which shows and holds the largest measured value on the display. Pressing SI resets the LED display. If you don’t need this peak-hold function you can replace Dll with a wire link and leave out C13 and SI. All changes in the signal level will then be shown on the LED bargraph display. The rectified signal is fed via a buffer (IC3B) and a final RC filter (R11/C12) to the input of the well-known LM3914 (IC4), a much used LED driver IC that contains all the electronics to drive a 10-segment LED bargraph display (D1 to DIO). The reference input of the LM3914 has been set such that the signal strength is indicated relative to LED D5. LED DIO is on continuously to indicate that the circuit is powered up; it may be left out of the circuit if not required. Opamp IC3C provides a trigger output that generates a logic high when the LED for the strongest signal level lights up (Dl). P4 is used to set the trigger level. The supply to the circuit is provided by a 12 V regulator, since any mains ripple on the supply line would be disastrous for the small signals we’re amplifying. The power supply can be any mains adapter that has an output voltage of about 15 to 20 V DC (50 mA is sufficient). Construction and setting up With the help of the PCB artwork shown in Figure 3 it shouldn’t be too difficult to make a board or have one made for you. Make sure that you get the 8-pin package for the LM380 since the PCB has been designed for this. Keep in mind that you need the unbuff- ered version of IC2 (4069UB), other- wise the circuit will definitely fail to work! Use IC sockets for all ICs to make the construction easier and to help with any potential faultfinding. All re- sistors are mounted vertically. The re- set switch is connected to the board via a pair of wires. The circuit can be mounted in an enclo- sure that has suitable cutouts made for the LEDs, the reset switch and the power connector. An old transformer works very well as a detector ‘coil’. It should have all 64 elektor electronics - 5/2007 windings connected in series, and you should take care that they are all in phase, otherwise the sensitivity will be reduced. Two short pieces of wire should be used to connect the trans- former to the board. Once all components have been sol- dered onto the PCB we can connect the mains adapter and start with the ad- justments. First set the sensitivity con- trol (PI) midway, as well as P2. Now turn P3 until the centre green LED (D5) lights up on the LED bargraph. During normal use, P2 can be used to adjust the display (you could also use an ordi- nary potentiometer for this) as and when necessary. Especially when the sensitivity is set to a high value you’ll find that the null-point can vary. When the sensitivity is lowered via PI it should be possible to obtain a stable setting that shows very little drift. The final adjustment is the trigger lev- el, set via P4. This isn’t critical, and should be set such that IC3C switches reliably when LED D1 lights up and switches back again when D1 turns off. Application tips At the start of the arti- cle we already showed a few possible applica- tions for this magne- tometer. Most of these are fairly straightforward and there is no need to give detailed instructions. It is important that you should first ‘play’ a bit with the circuit to find out how sensitive it is, what it reacts to and what the best setting is for PI. Whilst experi- menting you should have as few met- al or magnetic materials as possible near the circuit, since they interfere with its operation. You can make a simple seismometer by hanging an old loudspeaker magnet from the ceiling using a long piece of string and placing it just above the transformer. PI should then be adjust- ed such that the LED bargraph remains just unlit. To make a vibration alarm that can detect passing traffic you should attach a magnet to the end of a long ruler. The other end of the ruler Figure 4 For the prototype in the lab we used an old PCB-mounted transformer with all windings connected in series. should be fixed to a large surface and the transformer should again be placed just below the magnet. You’ll be amazed by the distance at which vi- brations can be detected with this sim- ple circuit! ( 050276 - 1 ) See your design in print! Elektor Electronics (Publishing) are looking for Freelance Technical Authors/ Designers If you have # an innovative or otherwise original design you would like to see in print in Europe's largest magazine on practical electronics # above average skills in designing electronic circuits # experience in writing electronics-related software # basic skills in complementing your design with an explanatory text # a PC, email and Internet access for efficient communication with our in-house design staff; then do not hesitate to contact us for exciting opportunities in getting your designs published on a regular basis. Elektor Electronics Jan Buiting, Editor P.O. Box 75 r NL-6I90-AB Seek, The Netherlands, Fax: (+ 37 ) 46 4370161 Email: editor@elektor~electronics.co.uk 5/2007 - elektor electronics 65 Luc Lemmens The soldering iron has been the pre-eminent tool since the year dot to 'stick' electronic circuits together. The first few generations of SMD parts could still be soldered with a soldering iron, even though it required a little more effort and accuracy. But the parts are forever getting smaller and smaller, and the connections have now become so minuscule and inaccessible these days that other equipment is re- quired to get the job done. Our January 2006 SMD Oven - a new version of which will be published in the near future — is very appro- priate for building a complete circuit board, but not when just fitting or replacing one component. For this task there is a more appropriate tool available, which is not all that expensive either: the hot-air iron or rework station. For about 1 10 pounds (approx. 145 euro) you will have a complete station that is ready to go. As the name indicates, this iron works with hot air to achieve the solder connection or to de-solder a component. The name 'rework station' suggests that it is intended for repair work, but it also proves to be very useful when building prototypes. With a conventional sol- dering iron we have to take into account the size of the tip and the temperature. With the hot-air iron we have to deal with the size of the nozzle, the temperature and the airflow. There is thus an additional parameter and it requires a certain amount of experience and skill to use the iron effectively. Nozzles are available in many types and sizes. There are those that are suitable for soldering an entire 1C in one go, others are a little smaller and intended to deal with one or a few connections at a time. The choice of the correct nozzle is very dependant on the job to be done, but it is certainly not necessary to buy a complete arsenal of them. Fortunately, these nozzles have a much longer life expectancy than a soldering iron tip, so each nozzle is, in all likelihood, just a one-time investment. The selection of the correct nozzle for the correct job is usually very easily made, the settings for the correct temperature and airflow are a little more complicated. This is really something that you will have to develop a knack for. When you start to work with a hot-air iron for the first time it will take a little while before you have found the cor- rect settings and these will differ from iron to iron and job to job. It is, however, very important that the heat and airflow are applied only to the spot that you want to (de-)solder. Also, make sure that the airflow is not so strong, otherwise it is very easy to blow small parts away and that is obviously not the intention. It is a good idea to practise first on a scrap circuit board and/or components from the junkbox whose demise do not seriously hurt your wallet; it can take a while before you acquire a feel for this. When using a hot-air iron it is common practice to use solder paste instead of solder. In a professional environment, a so-called 'dispenser' is used. This is a device that squirts the exact amount of paste on each solder pad. A good dispenser is quite expensive; if you do not have one of these it is possible to use a sharp implement to apply the paste to the PCB, for example a straightened paper clip. Not a fantastic me- thod when doing a large production run, but it will do for a prototype. You could also put a small amount of solder on each pad using an ordinary soldering iron and solder, but this often results in unevenness that makes the correct positioning of components more difficult. It is recommended to use a so-called 'pre-heater' in combination with the hot-air iron. This is a type of hotplate that pre-heats the circuit board so that the iron is now only required to push the temperature of the paste or solder that last little bit beyond the melting point. All in all, a fine method that requires a little bit of practice to find the optimum settings and the best way of using this tool. ( 075051 ) 66 elektor electronics - 5/2007 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) lOrder 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. Oi I ■■in n oto 0871 7 Credit Card 177 168 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 Programme^ 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 Secure Online Ordering Facilities • Full Product Listing, Descriptions & Photos • Kit Documentation & Software Downloads MODDING & TWEAKING Figure 1. The inside of the remote controlled power point, now still with far too many parts. Figure 2. the RF receiver occupies only a small part of the circuit board These parts (plus the SMD-IC on the other side) are enough to function as an RF receiver. Weather stations with a wireless connection between the sensors and the base station don't cost that much these days. For a song add one of those dick-on-dick-off systems and you're ready to mod. This time we build a simple data logger system and keep an eye on the temperature using a PC. The weather keeps us continually occupied. Some people have even made it their profession. At home too, we like to measure all kinds of things related to our climate. That is why weather stations are available in all types and sizes. If we want to know the temperature inside and outside then purpose-built indoor/outdoor thermometers are available for under a tenner. Wireless While in the past the outside sensor of these weather stations was connected with a wire, it is now fairly standard to use RF transmission for this data. It is however also easy to use these sensors for our own applications, without opening the sensors or the base station and risk voiding the warranty. That is because the wireless transmitters in these units usually make use of the 433-MHz ISM band, and finding a 433-MHz receiver is quite straightforward. At the better electronics retailers these shoiudl not set you back more than about ten pounds. You could also use the receiving module from another device, provided it operates on the same frequency. A power point with remote control ('click-on-click-off' system) meets our requirements in this case (see Figure 1). After this, it is theoretically a piece of cake to hang the whole lot off a computer so that a nice database of recorded temperatures can be established. Unfortunately, it is a little more awkward in practice. That is because there is no standard for the transmission of temperature data over an (ISM) 433-MHz connection using type-approved, licence free transmitters. Manufac- turers are usually not so helpful as to send a description of the protocol along with the sensor. Sometimes someone else has already made an attempt at decoding the protocol. But if no-one has yet ventured there, there is only method left to discover this information: reverse engineering. Designing the other way around To be able to reverse-engineer we need two things. Firstly, we need a way to receive the signals and secondly we have to be able to make these signals visible. For the first, we can obtain, as already mentioned, a ready-made receiver. But to get into the spirit of reverse engineering, we disassembled an existing RF-controlled power point. An interesting aspect when disassembling an existing 68 elektor electronics - 5/2007 Distance About the author Jeroen Domburg is an electrical engineering student at the Saxion technical University in Enschede. He is an enthusiastic hobbyist, with interests in micro- controllers, electronics and computers. In this column he displays his personal handiwork, modifications and other interesting circuits, which do not necessarily have to be useful. In most cases they are not likely to win a beauty contest and safety is generally taken with a grain of salt. But that doesn't concern the author at all. As long as the circuit does what it was intended to do then all is well. You have been warned! Figure 3. the first prototype of the receiver circuit. On the base station we can see what values the temperature modules are transmitting. Very handy as a check. +5V Figure 4 . The schematic once again clearly shown that the microcontroller is at the heart of the circuit. device is that you get a glimpse into the thought process- es of the designers. Some devices are put together in such a smart way that while looking at it you cannot avoid but have respect for the designers, while other devices are such a bungling mess that you nearly get annoyed with the whole design. In any case, it is useful to note that designers, more often than not, build things in a modular fashion. It is also not unusual with such a click-on-click-off power point, that the power supply and RF-receiver share several components. Taking the click-on-click-off power point apart was quite simple. It consists of a couple of capacitors and resistors to reduce the voltage from 230 V to a lower voltage, the RF receiver, a special chip for interpreting the received pulses and a transistor plus relay to switch the load. The method of only keeping the RF receiver is quite straightforward. Just remove everything that you know has nothing to do with the RF receiver and in the end you will be left with an RF receiver (see Figure 2). But be careful: on our board it turned out that there was a zener diode across the power supply rails to regulate the power supply voltage of the receiver. When connecting a bench power supply with a slightly higher voltage than the breakdown voltage of the diode alarming clouds of smoke were released... Annoying, particularly if it is the intention that the circuit continues to work. A still functioning zener diode would have been useful. That is because its value is equal to the power supply voltage that the receiver needs. If, for example, it had contained a 7805-voltage-regulator 1C then this would have been much easier to find. With the disassembly of the RF receiver from the click-on- click-off power point we have successfully tackled the first problem. We now have a receiver board that generates a signal that is equivalent to the signal that is sent by the RF temperature transmitter. The next step is to decode the signal. Normally an oscilloscope is eminently suitable to look at a signal, but this signal is sent only about once a minute. Without a storage scope it becomes very hard to take a good look at the signal. To be able to proceed we made an early start on the final circuit: an ATTiny23 1 3 which has a serial connection with the PC (see Figure 3). Hardware & software The schematic of the circuit is shown in Figure 4. A power supply voltage of 5 V is indicated here, but if the RF receiver requires less or more, then this will have to be adapted of course. The AVR can operate from about 3 to 6 volts. If the power supply voltage is in this range then there is no need to change anything in the circuit. If the receiver runs off 1 2 V, for example, then it will be necessary to generate two power supply voltages and a resistor of 1 0 Q or thereabouts will have to be added in series with the signal line from the RF-receiver to the AVR. The 1 2-V signal on this line is then attenuated by the resistor and the ESD diodes in the AVR. Now that the signal pulses arrive at the AVR it is time to let it process the coded signal so that we can view it on the PC via the RS232 connection and figure out how the coding works. A simple assembly language program was written for this purpose, which stores the times between the signal edges of the received pulse train in the RAM of the AVR. At the end of the pulse train the code is transmitted via the serial port. In this way it is quite easy to determine what the bit timing is and what coding is used. 5/2007 - elektor electronics 69 MODDING & TWEAKING mmnruioj V V V 1 0 1 Figure 5. Here we see the coding of the RF signal. After a little puzzling we can find the temperature in this. Figure 6. This transmitter is waiting patiently until it is brought into service. Figuring it out Both of the temperature sensors we tested used the length of the transmitted pulse as a way to send a bit, but that is where the similarity ends. With one sensor a short high pulse means 7 1 7 and a long high pulse means 'O'. With the other sensor it is just the other way around, with a long pulse meaning 7 1 7 and a short high pulse meaning 7 0 7 . This was all easily deduced from the data sent by the AVR. With a constant length of the high 7 pulse 7 it is plausible that the data is coded in the low 7 pulse 7 and the other way around (see Figure 5). The length of time that the signal is high is the same everywhere; the length of time that the signal is low indicates whether a 7 1 7 (long) or a 7 0 7 (short) is being transmitted. The signal represents a binary number with the temperature in tenths of degrees, increased by 50. The correct temperature is obtained thus: (727 /1 0) - 50 = 22.7°C Although this type of coding seems to be the simplest way and is quite common, it is by no means the only method that could be used by the manufacturer. FM-, MFM-, RLE, or some other sort of coding could also be used. These types of coding can often be recognised by the variable length of both the low and high pulses. Once the pulse duration of the long and short pulses is known, the meaning of the entire pulse train can be figured out. We do this by guessing the value of the short and long pulse, the temperature that is received by the base station (or is indicated on the sensor itself) and a lot of staring at the bits that are spit out by the AVR. With a bit of luck the temperature is immediately recognised in the mountain of zeros and ones. Without such luck well have to stare a little harder. The coding of the temperature into a binary value is not standard either. Some sensors send the temperature in tenths of degrees as a 12-bit number, other sensors send the value of each individual digit as a 4-bit number. Negative numbers too are presented in different ways. Sometimes this is done with a separate bit, but a two's- complement number does also occur, just as increasing the temperature value by, for example, 30 degrees before transmitting it. Once the coding has been found, it is merely a question of writing a piece of code to decode the temperature and put it on the serial data line. More sensors If more than one sensor is used, then this is not enough however. We also need to know which temperature comes from which sensor. Different brands of sensor are very likely to be able to be distinguished because they use a different protocol. If, however, we want to use multiple sensors of the same brand then things get a little more complicated. The manufacturers have already encountered this problem and have found two solutions for this. The first is to simply add a 'channel 7 switch to the sensor. This setting can then be found in the binary data stream that the sensor generates. The second solution is to generate a random number when the sensor is turned on, which is then sent with every temperature measurement. The chance that this random number is different for each sensor is quite large. In this way it is simple to determine which temperature belongs to which sensor. In addition to the temperature and the ID, some sensors also send a checksum along, so that the receiver can determine whether the temperature has been received correctly or not. The present firmware for the AVR does not use this checksum, because a check for errors is already made at a lower level. If the pulse durations are outside a certain minimum or maximum, depending on the type of sensor, then the pulse train is ignored. This rejects the majority of errors so that a checksum is not necessary. Your own Programming At the time of writing this article only the two sensors that we used here were implemented in the code: the KW901 0 and the WS7050 from Conrad Electronics (see Figure 6). If another sensor has to be read, then the code for this will have to be written first. This is actually quite easy of you are familiar with the AVR assembly language. The framework for this is already in place. For the first few steps in this process there are a 70 elektor electronics - 5/2007 Figure 7. This is what the AVR makes from all this. Each time a sensor transmits something a line is added with the ID of the sensor and the measured temperature. Figure 8. The measured temperatures are easily collected in a spread- sheet. This is a graph of room temperature (purple) and the temperature in the freezer compartment of the fridge (orange). number of jumpers that make this job easier. J3 selects that for each received pulse train the lengths of the pulses are transmitted as hexadecimal numbers out of the serial port. J2 lets the AVR try to interpret these numbers itself. The AVR will then determine itself whether the data is stored in the high or low pulses and generates a line with the letters 's' (for a short pulse) and T (for a long pulse) repeated a number of times. After this it is up to the programmer to decide which is a 'O' and which is a ' 1 ' and how the temperature is coded. Once this is known, some programming will have to be done. First we have to find out the limits of the high and low pulse durations and the number of pulses. This will be used to determine the required protocol-decoder routine. Secondly, this routine itself has to be written. Although this looks tricky, there are already a few existing subroutines that have been designed to make most of these tasks much easier. Have a look at the existing implementation for more information. J1 can come in handy while testing. Normally the AVR suppresses the debug information for each correctly recognised pulse train. By placing a jumper on J1 , the AVR will show the debug information for each set of pulses. To the PC Because the processing of the temperature data is all done in the AVR, the data that is transmitted to the PC is quite simple. The COM port needs to be set to 1 15200 baud, no parity, 8 data bits and 1 stop bit. Each line of text that is transmitted is built up as follows: ssss: tt.t where V is the unique hexadecimal ID of the sensor and Y represents the (decimal) temperature that the sensor has measured in degrees. This data can be collected with a simple script or program that listens to the serial port (see Figure 7). This data can then be used to make useful and/or pretty graphs (Figure 8). A few comments about the connection with the computer: because there is only one TxD signal, a single transistor has been used to convert the signal from the micro to an RS232 compatible level. This method works quite well for most serial ports. Some serial ports are a bit more critical with their signals. If that is the case the circuit around R1 , R2 and T1 can be replaced with a standard MAX232 circuit (see Figure 9). The firmware for this project can be downloaded free, of course, [1] and [2], and is released under the GPL [3]. If you have added an additional sensor type you can send the code to the email address in [2]. We will then add the code so that other readers can also benefit. ( 070112 - 1 ) Web links: [1] www.elektor-electronics.co.uk, May 2007 page [2] sprite.student.utwente.nl/~jeroen/proiects/rftemp [3] http://www.gnu.org/licenses/gpl.txt Figure 9. Should the combination of TI/RI/R2 not work properly then this can be used as an alternative. 5/2007 - elektor electronics 71 blocks Grap I Understanding, John Dobson & Ben Rowland Most of you will by now be familiar with the commonly used alphanumeric LCD screen that has two lines and 16 characters. These are great - but by no means the only displays you can use. Here we look at the use of more advanced graphical displays which - thanks to the mobile phone - are now readily available. The display pictured above features 1 32 by 1 32 pixels totalling at 17,424 individually addressable pixels. There is a maximum of 65,536 individual colours available for each pixel and a white backlight to provide maximum dis- play visibility even in the dark. The interface is a 4-wire serial interface that operates using the SPI bus protocol. The display used is compatible with the popular Nokia 6 1 00 colour LCD and also uses the Epson S 1 D 1 5G 1 4 controller chip [!]• Nokia 61 00 LCDs are widely avail- able for under £ 20 (approx. € 30). Problems From this short description it sounds like an ideal succes- sor to the simple LCDs we are all used to — but there are some problems: • Because theses displays are used in mobile phones the interface requires signals at 3.3 V — a problem if you are using 5V components. Figure 1. Close up of the original prototype PCB with display surface mount 'plug' and 'socket'. • The backlight operates at 14 V — this means that phones that use these displays need some kind of 'whis- tler' (step-up) inverter circuit to convert the normal 5 V supply to 14 V. • These devices are purely graphical: unlike the simpler LCD displays there is no inbuilt character set — you need to make your own! • The displays are designed for mass production and of- ten use an exotic surface mounted connector that's hard use in a prototype situation. Fortunately for Elektor readers we have solved these prob- lems as you will see. However, let's first look in a little more detail at how the display is used. Writing data To send a data packet to the display the data has to be clocked in serial form. Fortunately the chip inside the dis- play works in a serial form requiring only four pins. The timing diagram in Figure 2 shows how this is achieved. The first bit of data to be sent is marked 'A' and tells the display whether a command or a parameter is being sent. Commands are sent as a logic 0 and parameters as a logic 1 . Following the instruction bit is the data byte. This is transmitted one bit at a time starting with the most sig- nificant bit and ending in the least significant bit. Each bit is read into the graphical LCD at the change from Low-to- High on the clock input. Command list To help you control the display a number of commands are available for the built-in Epson controller. There are quite a few of these but the main ones are given in Table 1 . This gives you some clues as to how to use the display. 72 elektor electronics - 5/2007 For example, a startup sequence for the display would be as follows: 1 . Send command 0x01 to reset graphics hardware. 2. Wait 10 milliseconds. 3. Send command 0x1 1 to bring display out of sleep mode. 4. Wait 40 milliseconds. 5. Send command 0x29 to switch on the display. 6. Wait 40 milliseconds. SD CL CS A DATABYTE RS 075050 - 1 1 Figure 2. Timing diagram for command sent to he LCD. Dealing with colour The display has two basic colour modes - 65,536 col- ours and 4,096 colours. One issue you have to resolve fairly early on is the colours you will use: for most appli- cation 65,536 colours is just a few too many, and has the added disadvantage that each pixel colour will need to be represented by two bytes of information. 4,096 colours is better in terms of memory usage and speed, great for photos but awkward for graphics. Fortunately the display allows you to set up just a subselec- tion of 256 colours from the 4096-colour palette. This allows us to represent colour information with just one byte of data which makes communication with the display a little easier, and quicker. But how do you select 256 colours from the palette of 4,096? In a 4096-colour palette there are four bits for each of red, green, and blue (2 12 = 4096). That means 1 2 bits of information per pixel or 1 .5 bytes. Flmm, some- how we need to reduce that to one byte. So how is it done? Let's look at a possible solution. What we would like to do is split up each byte so that three bits represent the red part of the colour, another three the green part and two the blue. This is commonly called '3- 3-2' and is a technique which has been used in digital video for some time. We suspect that short-changing the blue like this is based on our eyes being less sensitive to variations in blue compared to red and green - we are sure a reader out there will be able to confirm this. The proposed systems is given in Table 2. If this system were possible then to get a colour of your choice you would simply approximate the colour you need in terms of its RGB content. Fortunately this is possible with the use of another lookup table. This second lookup table allows you to match the col- ours in the 3-3-2 system with shades in the 4-4-4 1 2-bit sys- tem. Consider the following table for matching the eight red colours in the 3-3-2 system with those in the 4-4-4 system: 3-3-2 0 0x0 1 0x2 2 0x4 3 0x6 4 0x9 5 OxB 6 OxD 7 OxF Table 1. LCD command list Command Hex value Parameter Function SWRESET 01 - Software reset SLPIN 10 - Send control chip into standby SLPOUT 1 1 - Control chip wake up DISINVOFF 20 - Normal display mode DISINV 21 - Invert display mode ALLPXOFF 22 - Turn off all pixels ALLPXON 23 - Turn on all pixels WRCNT 25 1 Set contrast DISPOFF 28 - Turn display off DISPON 29 - Turn display on CASSET 2A 2 Set column address PASSET 2B 2 Set page address RAMWR 2C DATA Write to RAM RGBSET 2D 20 Set RGB colours Flere the eight available shades of red in the 3-3-2 system are matched to eight of the shades of red in the 4-4-4 sys- tem giving an approximate even mix of shades to the 3-3- 2 system. This is used for both the Red and Green match- ing. Blue has to whittle the choices down further to only four out of the possible 1 6 shades as you can see here: Fortunately you do not have to write code or lookup ta- bles to implement all of this - the LCD is designed with this facility in mind and all you need to do is to write the 3-3-2 colour selection to the display on start up, using the command code 0x2D, to select the shades you want. So, after initializing the display you need to send the fol- lowing commands: 5/2007 - elektor electronics 73 E-BLOCKS Table 2. Colour control/selection Colour R G B Hex Decimal Black 0 0 0 0x00 0 White 1 1 1 1 1 1 1 1 OxFF 255 Red 1 1 1 0 0 OxEO 224 — Green 0 1 1 1 0 0x1 C 28 Blue 0 0 1 1 0x03 3 Yellow 1 1 1 1 1 1 0 OxFC 252 Orange 1 1 1 1 1 0 0xF8 248 Lilac/Lavender 100 0 10 0x82 130 Figure 3. Example of letter M 'pixelled out'. 1 . Send command 0x3A to set interface mode into pixel format. 2. Send parameter 0x02 to set: 8 bits per pixel. 3. Send command 0x20 to set: no colour inversion. 4. Send command 0x2D to build an 8-bit colour lookup table. 5. Send the 20-byte col- our constants as param- eters to build the lookup table: 0x00, 0x02, 0x0 4 , 0x06, 0x09, 0x0B,0x0D, OxOF, 0x00 , 0x02 , 0x04 , 0x06 , 0x09 , OxOB, 0x0D,0x0F, 0x00, 0x04, 0x0B,0x0F. Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 LSB MSB 075050 - 12 After this you are ready to start to write data into the dis- play. Before that, however, more new concepts! Windows with microcontrollers! The graphical display is based on a memory device inside the display itself. When you are writing to the display you therefore need to tell the display where to show the data sent. In practice you define a subset of the display as a 'window'. The window can be a section as small as a single pixel, or it could be the entire screen area. A few steps must be taken when writing information to windowed areas. 1 . Send command 0x2A to assign a 'column' address. 2. Send parameter upper left x coordinate of window (0 to 131). 3. Send parameter upper left y coordinate of window (0 to 131). 4. Send command 0x2B to assign 'page' address. 5. Send parameter bottom right x coordinate of window (XI to 131) 6. Send parameter bottom right / coordinate of window (Y 1 to 131) 7. Send command 0x2C to set the window as editable area. 8. Send parameter colour value to be assigned to top left pixel. 9. Continue sending parameter colour values until every pixel in that row has been assigned a colour. 1 0. Repeat steps 8 and 9 for all of the pixels in the speci- fied window. The concept of a 'column' address and 'page' address needs some explaining: unlike a conventional LCD dis- play where you specify the character location in terms of the x and y location of the character, in a graphical dis- play you specify an area of the screen you want to use. This corresponds to a block of memory inside the display device itself. Once you have specified a memory loca- tion or screen area then you sequentially dump the colour of each pixel in turn inside that block. You do not need to specify the x and / location of each pixel in the win- dow — the display takes care of that for you. This might seem a strange technique but the device is managed in this way for a good reason: it allows very fast writing of images to the display, which is a great advantage for dis- playing photographs and even video. Managing text Having understood how to write to an area of the screen you should now be getting some ideas as to how you write a character to a particular location on the screen. As we learned earlier there is no in-built character set with this kind of display: you need to make one yourself. To output text to the display the first step is to create a window size of 5x8 to house the pixel information. Each character will take up five bytes of memory to fill the 5x8 window. It is then simply a case of going through the bytes 1 to 5 and checking the least significant bits. If the bit is a 0 then send a background colour, else, if the bit is a 1 then send a fore- ground colour. After completing this for all five bytes you then move onto the next least significant bits and so on until the windowed area is full of pixel data. So for the letter 'M' illustrated in Figure 3 the sequence would be: 0x7F, 0x02, 0x04, 0x02, 0x7F. Similarly, for a lower case 'm' the sequence is 0x7C, 0x04, 0x18, 0x04, 0x78. Of course constructing datastreams for each character as it is written is a little longwinded. In practice you need a lookup table which specifies the bitmap image for each character. Managing graphics Managing graphics is a little harder. For example, to draw a line you need to either declare a sequence of win- dows 1 pixel by 1 pixel wide and send one pixel to that window, or you need to declare a larger window and somehow calculate the data you need to send to the win- dow to get the graphic you want. Ready to go software If you are starting to think that this all sounds great but is just too much like hard work then "don't panic Mr Main- waring". What we have done is prepared a standard kit of hardware and software for you that makes life a great deal easier. The software consists of a number of C rou- tines and lookup tables. If C makes you come over all shaky then don't panic: these libraries fit nicely into Flowcode 3 and make the LCD accessible to programmers of all levels. We have 74 elektor electronics - 5/2007 even provided a demo program in Flowcode 3 which produces the graphic you can see in the introductory pho- tograph. You can use this Flowcode file as a starting point for all of your programs. The Flowcode file is called Example_file.fcf. The C library is called GFX_LCD_Func! , ions.c. Both files are contained in a zip archive file you can download free of charge from the Elektor website as file # 075050- 1 l.zip. The archive also contains a supplementary docu- ment called GFxLGD Programming Strategy. Lots of useful stuff in there even if you are not into E-blocks. Note that if you are using Flowcode then you must have the C file in the same directory as the Flowcode file as Flowcode uses this as an external C library during the compilation process. Listing 1 . Text character map (extract) rom char* ASCII3 = {0x36 , 0x49 , 0x49 , 0x49 , 0x36, , // 8 // 56 - 67 0x06 , 0x49 , 0x49 , 0x29 , OxlE , // 9 0x00 , 0x6C , 0x6C , 0x00 , 0x00 , // • • 0x00 , OxEC , 0x6C , 0x00 , 0x00 , // • , 0x08 , 0x14 , 0x22 , 0x41 , 0x00 , // < 0x24 , 0x24 , 0x24 , 0x24 , 0x24, // = 0x00 , 0x41 , 0x22 , 0x14 , 0x08 , // > 0x02 , 0x01 , 0x59 , 0x09 , 0x06 , // 0x3E , 0x41 , 0x5D , 0x55 , OxlE , // @ 0x7E , 0x09 , 0x09 , 0x09 , 0x7E , // A 0x7F , 0x49 , 0x49 , 0x49 , 0x36 , // B 0x3E , 0x41 , 0x41 , 0x41 , 0x22 } ; // C Text character map Firstly we have constructed a standard set of character tables which allow you to use the display like a 22 by 1 5 character LCD display. Each character is made up of five pixel columns by eight pixel rows and this is based on the ASCII table. So, to write a character you simply write its ASCII equivalent. So far we have just allocated the main characters — those of you who need umlauts, accents or diacriticals will need to expand the table as required. Listing 1 shows an extract only — the complete table is called TXTCHAR.txt and contained in the free down- load for this article. The characters are split into arrays. Several are used be- cause is some C compilers there is an upper limit on the size of the array. Standard functions Secondly we have prepared a standard set of functions which behave in the same way as conventional LCD dis- plays with the following commands available to the user: LcdJnitQ initializes the display; Lcd_clear() clears the display Lcd_drawline (XI , Y1 , X2, Y2, Colour) draws a line of the appropriate colour between pixels XI , Y1 and X2, Y2. Lcd_print(String, X, Y, Size(0-2), FontColour, BackColour, StringLength) prints a string with charac- ter location X, Y, Size 0, 1 , or 2 (size 0 is default, 1 uses 4 pixels per normal pixel, size 2 uses 9 pixels per pixel) with font and background colours. With this command you also need to specify the string length. Lcd_box (XI, Yl, X2, Y2, Colour) draws a 1 pixel box based on pixel locations XI , Yl and X2, Y2 with a colour of your choice. Referring again to the introductory photograph, the complete program in C using our library is given in Listing 2. The Flowcode file for this program is shown in Figure 4. A new E-blocks module You can buy the E-blocks graphical LCD module from the SHOP section on the Elektor website. The module has the LCD connected up and secured on a circuit board and is ready for connecting into an E-blocks system, from which it takes all control and supply signals. The extensive descrip- tion of the LCD operation in this article goes to show that the module is also suitable for systems other than E-blocks. ( 075050 - 1 ) [1 ] Datasheet of SI D1 5G1 4 display at www.epson-electronics.de BEGIN Init LCD trisc = 0x00; Lcdjnit(); Clear LCD Lcd_clear(); Paint Background Blue // L cd box (X. . . Lcd_box (0, ... Create White Border // L cd box (X. . . Lcd_box(25,... Print text E-Blocks Graphic //Led print(St.. Lcd_print("E M ... nes Draw L //Lcd^drawlin.. Lcd_drawline.. Paint Coloured Squares //L cd box (X. . . Lcd_box (15,... END Listing 2. LCD demo program (example) Lcd_init ( ) ; Lcd_clear ( ) ; Lcd_box (0, 0, 131, 131, BLUE); Lcd_box( 25,20,106,65 , WHITE ) ; Lcd_print ( "E" , 3, 2, 2, BLACK, WHITE, 1); Lcd_print( "-BLOCKS", 8, 2, 1, BLACK, WHITE, 7); Lcd_print ( "Graphic LCD", 5, 6, 0, BLACK, WHITE, 11); Led drawline (25, 67, 106, 67, BLACK ) ; Led drawline (20, 69, 111, 69, BLACK ) ; Led drawline (15, 71, 116, 71, BLACK ) ; Led box (15, 90, 35, 110, RED); Led box (35, 90, 55, 110, YELLOW ) ; Led box (55, 90, 75, 110, GREEN ) ; Led box (75, 90, 95, 110, ORANGE ) ; Led box (95, 90, 115, 110, BRIGHTBLUE); Figure 4. Flowcode program producing the screen shown in the introductory photograph. 5/2007 - elektor electronics 75 INFOTAINMENT PUZZLE Hexadoku Puzzle with an electronic touch For the month of May we've prepared a fresh Hexadoku puzzle for you to solve with brain power only! As before, there are fine prizes on offer: an E-blocks Professional Starter kit and three Elektor SHOP vouchers. Participate! Please send your solution (the numbers in the grey boxes) by email to: editor@elektor-electronics.co.uk Subject: hexadoku 05-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 June 2007. The competition is not open to employees of Segment b.v., its business partners and/or associated publishing houses. The instructions for this puzzle are straightforward. In the di- agram 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 (marked 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 -> March). Prize winners The solution of the March 2007 Hexadoku is: CA9F0. The E-blocks Starter Kit Professional goes to: Patrick Leary (UK). An Elektor SHOP voucher worth £35.00 goes to: Leo Hallback (N); George Leith (UK); Birger Egner (S). Congratulations everybody! 2 1 D 3 6 E B F 4 5 8 0 D 7 8 7 6 C F B 3 0 A 5 7 9 9 5 F C 4 0 E C A 4 0 7 D F 3 E 7 E 2 B F 3 F E 2 4 A B 5 9 6 D 8 9 6 7 4 3 5 7 C 3 E 4 4 1 D E B 9 2 E 1 2 9 C D B 2 8 9 6 A 1 0 3 A B 6 1 F C 7 6 8 E 5 F 0 D 9 0 3 4 A C 7 B F (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! 76 elektor electronics - 5/2007 RETRONICS INFOTAINMENT Transverter for the 70cm band (1981) Designs for transverters are typi- cally published when (1) a new frequency band is allocated to licensed radio amateurs and/or (2) big Japanese companies like Yaesu, Kenwood and Icom think the band is exotic and best left to a dozen or so half-witted ex- perimenters. Six metres (50 MHz) is an example of a band that was 'Icom-free' for a number of years after it became availa- ble. 10 GHz (3 cm) is still totally free from Japanese plug & talk boxes and a great band for true experimenters. 'Transverter' is an acronym for (I think) transmitting/receiving-con- verter. A home-made transverter is used in combination with an existing shortwave or VHF rig to give access to a band you dif not have previously. The one for the 70 cms band (430-440 MHz) published in two parts in Elektor June and October 1 981 , is a fine example of a publication aimed at radio amateurs not willing to pay the exorbitant prices of com- mercial equipment available at the time. The same radio enthu- siasts simply want- ed SSB (single side- band) on 70 cms the way they had been able to enjoy it on shortwave as well as 2 m (1 44- 146 MHz) for many years. As op- posed to FM, SSB is a 'linear mode' requiring good lin- earity of all trans- mitter stages right up to the antenna connector. Good all-mode trans- ceivers being avail- able at the time for 2 m band, the de- signer of the Ele- ktor 70 cm trans- verter, J. de Win- ter PE0JPW, went for the '288-MHz' concept, which means that a sig- nal received on 432 MHz is down- converted to 144 MHz, but a 144-MHz transmitter signal of a few watts gets up-converted to 432 MHz via 374.4 MHz. The front cover of the June 1 981 is- sue proudly showed an Icom IC21 1 2-m all mode transceiver in combination with the transvert- er in its tin-plate enclosure. Un- fortunately, no finished example of the transverter has survived so I was unable to put it through its paces, or indeed print a photo- graph of the real thing. During the early 1980s, the 70 cm band had a particular at- traction, not just for as a meeting place for amateurs with 100% home built equipment (includ- ing amateur television — ATV), but also for satellite communi- cations that enabled cross-con- tinental QSOs in CW and SSB, all using relatively low transmit powers (but highly directional antennas). The June 1981 instalment of the article discussed in some detail the advantages of using a 2-m rig and 288-MHz RX down mix- ing over other much more com- plex transverter concepts based on intermediate frequencies like 336 MHz and 374 MHz for RX and TX. It also explained the need for a quartz crystal with an unusually high frequency (at the time!) of 57.6 MHz for the oscil- lator, mainly to prevent unwant- ed signals from the x5 multiplier section supplying the 288-MHz injection signal to the mixer. Spectrum analyser screens were printed to prove the concept. 25 years ago, the transverter originally submitted by the au- thor was Elektorised by senior designer Gerrit Dam PA0HKD and Ed Warnier PEI CJ P (now PA1 EW), the latter doing his ap- prenticeship with the company. The two ensured that the de- sign was reproducible by Elektor readers as well as compliant with legal requirements in terms of harmonics and spurious sig- nal levels. Gerrit (now retired) and Ed (now working as an RF maintenance engineer) remem- ber that putting the design on a PCB (to Elektor standards) was a major headache at the time as they had to struggle not just with 'spurious' from the 288- MHz exciter section but also with PCB design staff quite unused to the vagaries of 400-MHz sig- nals (but comfortable with 'DC stuff' like audio, microcontrollers and PSUs). In the end, they killed two (or was it three?) flies with one stroke by the use of micro- stripline inductors etched on the board. The third fly was known as Mr. Can't-wind-me-own-coils, and much dreaded in Elektor's Technical Queries department. ( 075053 - 1 ) Scans of the original article instalments from 1981 are available free of charge from the Elektor website. 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. 5/2007 - elektor electronics 77 ELEKTOR SHOWCASE To book your showcase space contact Huson International Media Tel. 0044 (0) 1932 564999 Fax 0044 (0) 1 932 564998 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. 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. 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 12 Newsletters. Also a section about built electronics projects with schematics and photos. Plus useful info., downloads and links. NO ADVERTS!" 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 tint Technofogy frcmstfer IMi BETA LAYOUT www.pcb-pool.com Beta layout Ltd Award- winning site in both English and German offers prototype PCBs at a fraction of the cost of the usual manufacturer’s prices. 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 EasyDAQ *1 I P »AQ www.easydaq.biz — ■■ ■ ,5a We design & supply low cost USB/RS232 based data acquisition, automation & control products: • USB connected & powered, 8 opto isolated voltage inputs chans, 4DI0 & 4 onboard relays capable of switching 240V@10A. With Labview, VC & VB examples - £60 FUTURLEC http://www.futurlec.com Save up to 60% on • Electronic Components • Microcontrollers, PIC, Atmel • Development Boards, Programmers Huge range of products available on-line for immediate delivery, at very competitive prices. 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 . u k 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. 78 elektor electronics - 5/2007 products and services directory 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 O 0 W SOURCEBOOST TECHNOLOGIES http://www.sourceboost.com Next generation C compiler and development products at highly affordable prices: • C, C++, and Basic compilers for PIC1 2, PIC1 6, 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 ULTRALEDS kUl trial <=dz. DD.lJ http://www.ultraleds.co.uk tel: 0871 7110413/01625 576778 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. WWW. elektor- electronics. co.uk SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business, Showcase - a permanent feature of the magazine where you will be able to showcase your products and services. • For just £220 + VAT (£20 per issue for eleven issues) Elektor will publish your company name, website address 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 3 cm deep full colour image - e.g. a product shot, a screen shot from your site, a company logo - your choice Places are limited and spaces will go on a strictly first come, first served basis. So please fax back your order today! I wish to promote my company, please book my space: • Text insertion only for £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 5/2007 - elektor electronics 79 Things of the past Elektor is now & tomorrow. EF 0 L" "j , t- FTr e lektor ru **»*•» . l - .l i * •; ' ’3 ,c ** I 1*1 lUPlO . ■ V Secure a head start in electronics with a subscription! Advantages to subscribers: 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. the world-leading network for electronics lektor 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 Brentford TW8 9HH United Kingdom Telephone +44 208 261 4509 Fax +44 208 261 4447 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. ISBN 978-0-905705-68-2 476 Pages £27.50 (US$ 51.50) MiubtcwnnuiiH 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) Microcontroller Basics ISBN 978-0-905705-67-5 £18.70 (US$ 33.70) 3 ) PC-Interfaces under Windows '~- y ISBN 978-0-905705-65-1 £25.95 (US$ 52.00) 4 ) Designing Audio Circuits ISBN 978-0-905705-50-7 £20.75 (US$ 42.00) Modern High-end Valve Amplifiers ISBN 978-0-905705-63-7 £25.95 (US$ 52.00) More bestsellers on www.elektoi^electronics.co.uk lektor @ Order now using the Order Form in the Readers Services section in this issue. Order o www.elektor-el 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 g-Force on LEDs (April 2007) PCB set, bare, incl. 2 MMA7260 sensors, BDM cable parts 060297-71 £10.00 /US$18.85 USB Stick with ARM and RS232 (November 2006) Assembled and tested board 060006-91 £ 79.90 / $ 1 49.95 r rr^i n No. 365 MAY 2007 £ $ Software Defined Radio 070039-91 Ready-populated and tested board 070039-11 CD-ROM, project software Thank your for Flying USB FliteSim 060378-1 PCB, bare 060378-41 PIC18F2550I/SP, programmed Universal JTAG Adaptor 060287-1 PCB, bare, with programmed microcontroller 060287-41 EP900LC only, programmed Magnetometer 050276-1 PCB, bare Speedmaster 070021-91 Ready-populated and tested board (excl. R8C module) Seismograph 060307-1 PCB, bare 060307-11 CD-ROM, project software 060307-41 ATTiny45, programmed ATtiny as RDS Signal Generator 060253-41 Attiny2313-20, programmed 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 www.thepcbshop.com No. 363 MARCH 2007 Attack of the SpYder 060296-91 SpYder Discovery Kit 6.45 12.70 AVR drives USB 060276-1 PCB, bare 10.00 18.85 060276-11 CD-ROM, project software incl. source code 5.20 9.75 060276-41 ATmega32-16PC, programmed 8.95 16.85 Wireless USB in Miniature 050402-1 PCB, bare, iDwarf prototyping board 8.30 15.60 050402-91 iDwarf -168 Transmitter module (built & tested) 24.10 45.45 050402-92 iDwarf Node Board (built & tested) 17.20 32.45 050402-93 iDwarf Hub Board (built & tested) 17.20 32.45 Mobile Phone LCD for PC 060184-1 PCB, bare www.thepcbshop.com 060184-11 CD-ROM, project software 5.20 9.75 060184-41 ATmega16-16PC, programmed 8.95 16.85 Scale Deposit Fighter 070001-1 PCB, bare www.thepcbshop.com No. 362 FEBRUARY 2007 ... 3, 2, 1 Takeoff! 050238-1 Transmitter PCB, bare 050238-2 Receiver PCB, bare MP3 Preamp 060237-1 PCB, bare A Telling Way of Telling the Time 050311-1 PCB, bare 050311-31 CPLD, programmed FPGA Course (9) 060025-9-11 CD-ROM, course software incl. source code Explorer-16 Value Pack 060280-91 Four components packaged together in a single box 72.45 126.50 5.20 9.75 www.thepcbshop.com 15.50 29.25 11.00 20.75 P&P only P&P only www.thepcbshop.com 51.70 97.45 www.thepcbshop.com 5.20 9.75 10.35 19.50 4.20 7.80 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 www.thepcbshop.com www.thepcbshop.com www.thepcbshop.com 35.50 66.95 5.20 9.75 122.90 232.50 nline at Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road ectronics.co.uk Due to practical constraints, final illustrations and specifications Brentford TW8 9HH United Kingdom Tel.: +44 (0) 208 261 4509 Fax: +44 (0) 208 261 4447 Email: sales@elektor-electronics.co.uk may differ from published designs. Prices subject to change. See www.elektor-electronics.co.uk for up to date information. 050348-71 £ 34.50 / $ 64.95 PIC In-Circuit Debugger/Programmer (October 2006) Kit of parts including PCB, programmed controller and all components. GameBoy ElectroCardioGraph (October 2006) PCB, ready built and tested 050280-91 £ 55.20 / $ 1 03.95 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. 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 PIC1 6F628-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 030417-1 PCB, bare (receiver board) www.thepcbshop.com 030417-2 PCB, bare (control & display boards) www.thepcbshop.com 030417-41 AT90S8515-8PC, programmed 11.40 21.45 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/P, 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 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 PIC In-Circuit Debugger/Programmer 050348-1 PCB 050348-41 PIC16F877, programmed 050348-71 Kit, incl. PCB, controller, all parts GBECG - Gameboy ElectroCardioGraph 050280-91 PCB, ready built and tested ECG using a Sound Card 040479-1 PCB 11.00 20.75 27.60 51.95 79.90 149.95 5.20 9.75 5.20 9.75 17.90 33.75 34.50 64.95 55.20 103.95 5.20 9.75 LED Thermometer 0301 90-1 1 Disk, project software 030190-41 PIC16F873-20/SP, programmed Toothbrush Timer 0501 46-1 1 Disk, project software 050146-41 AT90S2313-10PC, programmed Easy Home Control 050233-1 1 Disk, project software 050233-41 PIC16F84, programmed Universal LCD Module 050259-1 1 Disk, project software 050259-41 AT90S2313, programmed 1-Wire Thermometer with LCD 060090-1 1 Disk, project software 060090-41 PIC16F84A-04CP, programmed 5.20 16.50 5.20 6.90 5.20 10.30 5.20 6.90 5.20 10.30 9.75 31.00 9.75 12.95 9.75 19.40 9.75 12.95 9.75 19.40 INFO & MARKET SNEAK PREVIEW The great thing about multimeters with a serial interface is that they allow readings taken in the lab and on the road to be stored and processed on a computer. Datalogging, temperature and fault recording are just a few applications that come to mind. In this article, we cover the meter's possibilities and specs as well as the associated software. Class-A Triode Push-Pull Amplifier This year marks the 1 00th anniversary of Lee deForest's invention of the triode valve. Fittingly and with a bit of nostalgia, we present a triode amp that's cheap and easy to build. The design is based on 6AS7 valves in push-pull class-A configuration supplying an output power of 2 x 9 watts. A special feature of the amplifier is its switchable feedback, allowing you to select the best response for a music genre or volume setting. Stand-alone OBD-2 Analyser Also... After the resounding success of the computer-linked OBD-2 analysers published in Elektor Electronics we now give you a stand-alone version. Compared to its predecessor, the new design has lots more features, is more compact and easier to build, not forgetting that it supplies error descriptions on the display, instead of just codes. Digital Inductance Meter; 2.4 GHz WiFi Spectrum Analyser; Web Oscilloscope; New Fingerprint Sensors; Hexadoku. RESERVE YOUR COPY NOW! UK mainland subscribers will receive the magazine between 24 and 27 February 2007. The June 2007 issue goes on sale on Thursday 24 May 2007 (UK distribution only). 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: lectronics 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.ci Elektor Electronics S3 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 elektor electronics - 5/2007 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 Price each Qty. Total Order Code CD-ROM Elektor 2006 £ 16.25 CD-ROM USB Toolbox £ 18.95 Visual Basic for Electronics Engineering Applications £ 27.50 Sub-total Prices and item descriptions subject tn change The publishers reserve the right to change prices p&p without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Total paid Name 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 * (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 EL05 *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 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 EL05 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) HOWTO 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-1 52-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 HOWTO 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 o lectronics £16.25 / US$ 28.75 ISBN 978-90-5381-207-5 cd-rom Elektor 2006 Completely new HTML user interface All articles in Elektor Electronics Volume 2006 on CD-ROM 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. An extensive search machine is available to locate keywords in any article. 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! ft ■T 1 3 1 __ 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 208 261 4509 See also www.elektor-electronics.co.uk 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 Beijing Draco .www.ezpcb.com 49 Beta Layout, Showcase www.pcb-pool.com 35, 78 Bitscope Designs .www.bitscope.com 3 Cricklewood www. cctv centre, co. uk .35 EasyDAC, Showcase www.easydaq.biz .78 Easysync, Showcase www.easysync.co.uk .78 Elnec, Showcase www.elnec.com .78 E u ro ci rc u its www. eurocircuits, com First Technology Transfer Ltd, Showcase .www.ftt.co.uk 78 Future Technology Devices, Showcase . . .www.ftdichip.com 78 Futurlec, Showcase www.futurlec.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 Microchip www.microchip.com .13 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 .49 Number One Systems www.numberone.com .41 Nurve Networks www.xgamestation.com .49 PCB World, Showcase www.pcbworld.org.uk 78 Pico www.picotech.com .41 Quasar Electronics www.quasarelectronics.com .67 Robot Electronics, Showcase www.robot-electronics.co.uk 79 Scantool www.ElmScan5. com/elektor Schaeffer AG www.schaeffer-ag.de .49 Showcase 78, 79 SourceBoost Technologies, Showcase . . .www.sourceboost.com 79 Sytronic Technology Ltd, Showcase www.m2mtelemetry.com 79 Ultraleds, Showcase www.ultraleds.co.uk .79 USB Instruments, Showcase www.usb-instruments.com 79 Virtins Technology, Showcase www.virtins.com 79 Advertising space for the issue of 25 June 2007 may be reserved not later than 29 May 2007 with Huson International Media - Cambridge House - Gogmore Lane - Chertsey, Surrey KT 1 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. NEW IN DESIGN SUITE 7: NEW: Redesigned User Interface includes modeless selection, modeless wiring and intuitive operation to maximise speed and ease of use. NEW: Design Explorer provides easy navigation, design inspection tools and cross-probing support to improve quality assurance and assist with fault finding. NEW: 3D Visualisation Engine provides the means to preview boards in the context of a mechanical design prior to physical prototyping. NEW: Simulation Advisor includes reporting on simulation problems with links to detailed troubleshooting information where appropriate. NEW: Trace capability within both MCU and peripheral models provides detailed information on system operation which allows for faster debugging of both hardware and software problems. NEW: Hundreds of new device models including PIC24, LPC2000, network controllers and general purpose electronic components. Electronic Design From Concept To Completion Labcenter Electronics Limited Registered in England 4692454 Electronics E-mail: info@labcenter.com Tel: +44 (O] 175E 753440 Fax: +44 (□] 175E 752857 Registered Address: 53-55 IVIain Street, Grassington, North Yorks, UK, E3DE3 5AA