9 770268 45198 2 i Mixed Signal Oscilloscopes BitScope Analog + Digital Digital Storage Oscilloscope Dual Channel Digital Scope with industry standard probes or POD connected analog inputs. Fully electrically isolated from PC. Mixed Signal Waveform Analyzer Capture and display analog and logic signals together with sophisticated cross-triggers for precise waveform timing measurement. Instant Replay Signal Generator Built-in synchronized waveform generator. Synthesize arbitrary waveforms or replay captured analog or logic signals instantly. Multi-band Spectrum Analyzer Display analog waveforms and their spectra simultaneously in real-time. Baseband or RF signals with variable bandwidth control. Integrated Waveform Data Recorder Record to disk anything BitScope can capture. Allows off-line replay and waveform analysis. Export captured waveforms and logic signals. Multi-platform & user programmable Supports Windows, Linux and Mac OSX. USB and Ethernet models with user programming libraries, drivers and customizable software. Logic/Timing Analyzer Probes BitScope Software and Libraries BitScope 325 includes DSO, an intuitive test and measurement software application for your PC. The integrated test instruments include a digital storage oscilloscope, spectrum analyzer, logic state and mixed signal timing analyzer and an arbitrary waveform generator in one package. DSO is fast, with display rates up to 50Hz and deep, with capture up to 512kS per frame. Also included is a built-in data recorder to share captured signals with colleagues or customers via data export and real-time offline analysis. If you also need programmability, BitScope 325 comes with the BitLib application programming library for custom software applications or full integration with existing third party tools. BitScope is built tough to last a lifetime. Enclosed in a new low profile solid extruded aluminium case BitScope 325 can handle the harshest working environments. Its full metal jacket and electrically isolated design means that unlike cheap plastic alternatives it is also highly noise immune for the most sensitive mixed signal measurement applications. On the road or in the lab, BitScope is the ideal choice! Industry Standard Scope Probes Software Included Windows, Linux or Mac Ethernet or USB www . bitscope . com DEVELOPMENT TOOLS mlkroilektronika DEVELOPMENT TOOLS | COMPILERS | BOOKS EasyPIC5 supports 8-, 14-, 18-, 20-, 28- and 40- pin PIC microcontrollers (it comes with the PIC16F887). The mikrolCD (Hardware In-circuit Debugger) enables very efficient step by step debugging. Examples in C, BASIC, Pascal and Assembly language are provided with the board. EasyPIC5 comes with the following printed documentation: EasyPIC5 Manual, PICFIash2 Manual and mikrolCD Manual. BIGPIC5 BIGPIC5 supports the latest 64 and 80-pin PIC microcon- trollers (it is delivered with PIC18F8520). There are USB 2.0 on-board program- mer, on-board mikrolCD and on-board TouchPanel controller. PICPLC16B PICPLC16B is an advanced system for installing into devices and for developing industrial and home or office control. Features: 16 relays, 16 optocoupled inputs, RS485, RS232, Serial Ethernet, etc. PICPLC8A PICPLC8A is a system for installing into devices as well as for developing industrial control. Features: 8 relays, 8 optocoupled inputs, RS485, RS232, PS/2 and USB 2.0 on-board programmer and mikrolCD on-board. PICFIash with mikrolCD PICFIash with mikrolCD support is a fast USB2.0 programmer and in-circuit debugger for the Microchip PIC FLASH microcontroller family. LV 18FJ LV18FJ supports 64, 80 and 100 pin PIC18FxxJxx micro- controllers (it comes with PIC18F87J60). There are USB 2.0 on-board program- mer, on-board mikrolCD and on-board TouchPanel controller. PICPLC4 PICPLC4 is a system designed for controlling industrial systems and machines via ethernet with 4 relays (up to 10A). 18FJprog programmer can be easily connected to PICPLC4 board via I DC 10 connector. dsPICPR04 dsPICPR04 supports 64 and 80-pin dsPIC30F micro- controllers (it comes with dsPIC30F6014A). There are USB 2.0 on-board program- mer, on-board mikrolCD and on-board TouchPanel controller. \ \ EasydsPIC4A The system supports 18, 28, and 40-pin dsPIC microcon- trollers (it is delivered with dsPIC30F4013). There are USB 2.0 on-board program- mer, on-board mikrolCD and on-board TouchPanel controller. LV 24-33A The system supports 64, 80 and 100 pin PIC24F, PIC24H, dsPIC33F micro- controllers (it comes with PIC24FJ96GA01 0). There are USB 2.0 programmer and TouchPanel controller on-board. EasyPSoC4 The system supports 8, 20, 28 and 48 pin PSoC® micro- controllers (it comes with CY8C27643). There are ultra fast USB 2.0 program- mer and TouchPanel con- troller on-board. BIGAVR2 The system supports 64- pin and 100-pin AVR microcontrollers (it is deliv- ered with ATMEGA128 working at 10MHz). There are ultra fast USB 2.0 pro- grammer and TouchPanel controller on-board. EasyAVR5A The system supports 8, 14, 20, 28 and 40 pin microcon- trollers. It is delivered with ATMEGA16. There are ultra fast USB 2.0 programmer and TouchPanel controller on-board. Easy8051 B The system is compatible with 14, 16, 20, 28 and 40 pin MCU's (it comes with AT89S8253). There is a fast USB 2.0 programmer on- board. Also there are PLCC44 and PLCC32 sockets on-board. EasyARM The system supports 64 and 144 pins ARM microcon- trollers (it comes with Philips LPC2148). There are ultra fast USB 2.0 programmer and TouchPanel controller on-board. SmartGSM/GPRS SmartGSM/GPRS is a development tool that will help in clear understanding of GSM & GPRS technolo- gies. Antenna can be placed on-board for better signal quality. System supports different GSM modules. http://www.mikroe.com/ SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD Summer Circuits — made (or you, by you As the days shorten and the first autumn winds howl and buf- fet the castle walls, the initial plans are drawn up. Seasons pass, autumn and winter make way for spring, and when everyone looks like they could do with a bit more sunshine on as well as in their faces, it's finished and ready for print- ing: Elektor's Sum- mer Circuits edition! To mark the real start of 'SC', howev- er, we must go back even further in time — to the beginning of the summer of 2008, when many of you were thinking up exciting new ideas for the edition and eventu- ally got round to sending them by email — and some even by snail mail. Summer Circuits has been a collective effort since it was first produced, now over 30 years ago. Every year we receive over 500 entries and ideas for publication!The projects come from all over the world, and we happily evaluate each item because the effort confirms the creativity and ingenuity of you, our readers. All circuits in this edition have been tried and tested by Elektor Labs so repeatability should not be an issue if you read and work carefully. ElektorWheelie While ElektorWheelie was mostly 'under cover' in the June 2009 edition, this month we are unveiling the electronics starting on page 66 . Our DIY 'self-balancing two-wheeler' will take you further, both in distance and knowledge. In distance, because it is designed to take you from A to B in spectacular fashion. In knowledge, because ElektorWheelie is an 'Open Development'. Open for students and companies to redesign or modify, to make it even faster, or to make it go farther on a battery charge. Who knows, we might even organise an ElektorWheelie Com- petition. Have fun exploring this electrifying collection of more than 1 00 circuits, tips and ideas. None of our competitors has ever man- aged to publish anything remotely resembling our Summer Cir- cuits edition. And don't forget, after a long day spent reading, soldering or measuring, comes well deserved recreation. On behalf of the Elektor Team, Wisse Hettinga International Coordinating Editor lekto r electronics & microcontrollers Plus Colophon 6 ElektorWheelie 66 Hexamurai Puzzle 124 Elektor SHOP 128 Coming Attractions 132 (Colour of title indicates category, bold type = PCB design included) Audio, Video & Photograph Audio Source Enhancer 94 Automatic TV Lighting Switch 52 DMX Transmitter 1 08 Guitar Amplifier PSU 1 05 Guitar Pick-up Tone Extender 60 Improved Hybrid Headphone Amplifier 114 Load Protection for Audio Amplifiers 72 Sensitive Audio Power Meter 97 SRPP Headphone Amplifier 1 5 Stereo Widening 38 S-video Converter 41 Two TV Sets on a Single Receiver 1 00 Vocal Adaptor for Bass Guitar Amp 59 Wireless S/PDIF Connection 23 Computers, Software & I nternet Cheap Serial Port for the Mac 1 1 Control Interface via PC Keyboard 46 Fan Speed Controller 49 Network RS232 81 One Wire RS-232 Half Duplex 24 PC Power Saver 1 22 Powering a Second Hard Drive 77 Pseudo Fan 17 Remote Control for Network Devices 1 20 TurboGrafx-1 6 (PC Engine) RGB Amplifier 48 USB Switch 64 VGA Background Lighting 22 Hobby, Games & Modellin 106 34 Acoustic Distress Beacon Annoy-a-Tron CONTENTS Volume 35 July & August 2009 no. 391/392 Braitenberg Robot 1 1 6 Bread boa rd/Perf board Combo 26 Full-colour Night-flight Illumination 84 Going for Gold 102 Impact Clock 74 Lighting Up Model Aircraft 30 Lipo Monitor 21 Low-drop Series Regulator using a TL431 22 Servo Driver 91 Speed Control 43 Home & Garden 12 VAC Dimmer 62 Automatic Bicycle Light 121 Automatic Curtain Opener 75 Bathroom Fan Controller 97 Chill Out Loud 92 Daylight Switch 45 Dimmable Aquarium Light with Simulated Sunrise and Sunset 93 Economy Timer 83 Long Duration Timer using ATtiny231 3 1 1 1 Luxeon Logic 10 Phone Ring Repeater 53 Power On Indicator 99 Power-up/down Sequencer 50 Pulse Clock driver with DCF Synchronisation 54 Remote Washing Machine Alert 31 Snail Mail Detector 107 Solar-driven Moisture Detector 86 Switching Delay 19 Two-button Digital Lock 78 Wireless Baby Monitor 80 Microcontrollers Driver-Free USB 29 Easy LEGO Robotics Set Up 1 6 An E-blocks IR RC5 Decoder 1 1 8 l 2 C Display 88 Port Expander 14 Six-digit Display with SPI Port 20 USB RadioTerminal 101 Power Supplies, Batteries & Chargers LEDify It! 32 Lithium Charger using BQ241 03 61 Single Lithium Cell Charger 1 1 0 Single-cell Power Supply 82 SSR2.0 42 RF (radio) 0-1 8 MFIz Receiver 1 2 FM Audio Transmitter 90 Pre-emphasis for FM Transmitter 96 Test & Measurement Digital Sweep and Sinewave Generator 1 04 Frequency and Time Reference with ATtiny231 3 56 Measuring Milliohms with a Multimeter 1 06 Preamplifier for RF Sweep Generator 1 0 Quartz Crystal Tester 1 1 2 Servo Scales 28 Simple Temperature Measurement and Control 62 SMD Transistor Tester 39 Smoggy 85 Tester for Inductive Sensors 1 01 Miscellaneous Electronics & Desian Ideas Backlight Delay 98 Cut-rate Motorbike Alarm 1 03 Floating Message 51 Four-component Missing Pulse Detector 44 Freezer Trick 32 Frequency Divider with 50% Duty Cycle 58 Hassle-free Placement of SMD Components 44 LED Bicycle Lights 30 Micropower Crystal Oscillator 52 Momentary Action with a Wireless Switch 27 PR4401 1 -Watt LED driver 47 Programmable Nokia RTTL Player 1 8 Simple Wire Link Bender 82 Simple Wireless and Wired Emergency Stop System 35 Slow Glow 14 Start-up Aid for PCs 1 3 Stress-o-Meter 76 TL431 Multivibrator 40 Desulphater for Car Batteries Doubling Up with the PR4401/02 Lead-Acid Battery Protector 35 95 75 TOR ELECTRONICS WORLDWIDE elektor international media Elektor International Media provides a multimedia and interactive platform for everyone interested in electronics. From professionals passionate about their work to enthusiasts with professional ambitions. From beginner to diehard, from student to lecturer. Information, education, inspiration and entertainment. Analogue and digital; practical and theoretical; software and hardware. Volume 35, Number 391/392, July/August 2009 ISSN 1757-0875 Elektor aims at inspiring people to master electronics at any personal level by presenting construction projects and spotting developments in electronics and information technology. Publishers: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 www.elektor.com The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor is published 1 1 times a year with a double issue for July & August. Elektor is also published in French, Spanish, American English, German and Dutch. Together with franchised editions the magazine is on circulation in more than SO countries. International Editor: Wisse Hettinga (w.hettinga@elektor.nl) Editor: Jan Buiting (editor@elektor.com) International editorial staff: Harry Baggen, Thijs Beckers, Eduardo Corral, Ernst Krempelsauer, Jens Nickel, Clemens Valens. Design stct Antoine Authier (Head), Ton Giesberts, Luc Lemmens, Daniel Rodrigues, Jan Visser, Christian Vossen Editorial secretariat: Hedwig Hennekens (secretariaat@elektor.nl) Graphic design / DT Giel Dols, Mart Schroijen Managing Director / Publisher: Paul Snakkers Marketing Carlo van Nistelrooy Subscriptions: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 Internet: www.elektor.com/subs 6 elektor - 7-8/2009 Elektor PCB Service y Your professional PCBs and Prototypes Elektor PCB Service is a new service from Elektor. You can have your designs converted into a professional- quality PCBs via the www.elektorpcbservice.com website. Elektor PCB Service is intended for prototype builders and designers who want to have their PCBs made to professional standards, and for users who want customised versions of Elektor PCBs. If you need a couple of y protos' with fast turnaround or a batch of 5 to 50 units, we can meet your needs at a favourable price. r J B 1 ■ T ^ * L — J "JH ■ I l ’ M The advantages at a glance • The PCBs are professional quality. • No film charges or start-up charges. • There is no minimum order quantity or charge for this service. • Available to private and commercial customers. • Well first check if your project is producible. We'll let you know within 4 hours! • In order to supply two PCBs, we make three. If the third board is also good, you receive it as well - free of charge. • You can use our online payment module to pay easily, quickly and securely with Visa or Master- Card. Procedure: Create Place your account . your order Your project is checked Payment Your order is shipped lektor PC B Stpvlct Now available for everybody at www.elektorpcbservice.com Email: subscriptions@elektor.com Rates and terms are given on the Subscription Order Form. Head Office: Elektor International Media b.v. P.0. Box 1 1 NL-61 1 4-ZG Susteren The Netherlands Telephone: (+31 ) 46 4389444, Fax: (+31 ) 46 43701 61 Distribution: Seymour, 2 East Poultry Street, London EC1A, England Telephone:+44 207 429 4073 UK Advertising Huson International Media, Cambridge House, Gogmore Lone, Chertsey, Surrey KT1 6 9AP, England. Telephone: +44 1932 564999, Fax: +44 1932 564998 Email: r.elgar@husonmedia.com Internet: www.husonmedia.com Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photo- graphs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software carriers and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopy- ing, scanning an recording, in whole or in part without prior written permission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may ex- ist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publisher to alter the text and design, and to use the contents in other Elektor International Media publications and activities. The Publisher cannot guarantee to return any mate- rial submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2009 Printed in the Netherlands 7-8/2009 - elektor 7 Memory «, Discover Deep Memory Performance. Du* to memory constraints, traditional digital stooge oscilloscopes do not haw iJhe capability of displaying a complete electronic signal at a high samplp #at*. The GD5-1QQQA Series uses Memory Prime technology to overcome ihe problems assoc lated with memory constants- By displaying com pie?* signals with greater detail, the GD5-1000A Series can maintain a high sample rate over a wider horizontal range, without affect ing performance. Challenge yourself to go deeper P CDS1M0A I CDS 1000A Series Digilnl Storage Osci loscope * 1 50/1 CM/60 MHz Bandwidth, 2 Input Chamets * Sample Rales up to tCSa/s Real-Time Maximum, 2SGsa/s Equivalent Time ■ 2M Points Record Length MaKrnwnli * ImV^IOV Vertical Scale,! ns-ifts Horizontal! Range ■ Up to 27 Automatic Measurements ■ USB mi SD ruterlace Supported ir'-armiiicn jtuHji Ihr ardvanlajc^of MemfryP^rneEKhnn 1 ^. %na-«l O'jr A.P&5. «e ,.| w^-^n-e^&ry-pr-irc.cfir'. ur coni.ultrwj r k-:jl d^Lribol^f. |buy CDFI-nrrir-. fir L a lirnilvd li^clitwPTJfTinLT & a cornplimefihor SO card reader \ GOOD WILL INSTRUMENT CG. P LTD. Ho. 7 - 1 , fiaad, TuC^tSIf Clft Oipti C^yFYffrJJG. Uiwj- r «fH4-U£frti)£9 f4U3rZHI G^mSTEK Wrtde to Measure sh=f rjjt www.gwins1ek.com S 0845 226 9451 Your source for MikroElektronika Development Tools and Accessories in the United Kingdom We can supply all MikroElektronika development tools including compilers, development boards, add-on boards, programmers and starter packs. We aim to keep all products in stock for same-day dispatch and can offer next-day delivery within the UK as well as insured delivery by airmail post or courier worldwide. EasyPIC5 PIC Development Board - £89 BIGPIC5 PIC Development Board -£119 LV18FJ PIC Development Board - £89 Get off to the best start with PIC microcontrollers with the EasyPIC5. Supports 8, 14, 18, 20, 28 and 40-pin PIC10F/12F/16F/18F devices and features built- in USB programmer, in- circuit debugger and useful I/O devices. LCD displays sold separately. An advanced development board for 64 and 80-pin PIC microcontrollers in the 18F family, the BIGPIC5 provides on-board USB programmer, in-circuit debugger plus extensive I/O devices and communications interfaces. LCD displays and SD card- sold separately. Designed for low-voltage PICs in the LV18FxxJxx family with on-chip Ethernet connectivity, the LV18FJ incorporates USB program- mer, in-circuit debugger and useful I/O devices and supports 64, 80 and 100-pin MCUs. LCD displays and SD card sold separately. EasyPIC5 Starter Packs also available comprising EasyPIC5, character and graphic LCDs, touch panel, tem- perature sensor and either BASIC, C or Pascal compiler. BIGPIC5 Starter Packs also available comprising BIGPIC5, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. LV18FJ Starter Packs also available comprising LV18FJ, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. EasydsPIC4A dsPIC Development Board - £89 dsPICPR04 dsPIC Development Board - £149 LV24-33A PIC/dsPIC Development Board - £99 A versatile development board for 18, 28 and 40-pin digital signal controllers in the dsPIC30F family, the EasydsPIC4A provides built-in USB programmer, in-circuit debugger and useful I/O devices. LCD displays sold separately. The new dsPICPR04 is an advanced development board for 64 and 80-pin dsPIC30F devices with built- in USB programmer, in-circuit debugger and extensive I/O features and communications interfaces. LCD displays and SD card sold separately. Easily develop 16-bit PIC24 and dsPIC33 applications with the LV24-33A. Features USB programmer and in- circuit debugger plus useful I/O devices and supports 64, 80 and 100-pin low-voltage devices. LCD displays and SD card sold separately. EasydsPIC4A Starter Packs also available comprising EasydsPIC4A, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. dsPICPR04 Starter Packs also available comprising dsPICPR04, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. LV24-33A Starter Packs also available comprising LV24-33A, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. EasyAVR5A AVR Development Board - £89 BIGAVR2 AVR Development Board - £89 Easy8051B 8051 Development Board - £89 Get off to the best start with Atmel’s Flash 8051 micro- controllers with the Easy8051B. Supports 14, 16, 28, 32, 40 and 44-pin 8051s and features on- board USB programmer and useful I/O devices. LCD displays sold separately. Get off to the best start with AVR microcontrollers with the EasyAVR5A. Supports 8, 14, 20, 28 and 40-pin AVRs and features on- board USB programmer and useful I/O devices. LCD displays and SD card sold separately. Work with 64, 80 and 100-pin AVR microcontrollers with the BIGAVR2 development board. Includes built-in USB programmer and range of on- board I/O devices. LCD displays and SD card sold separately. EasyAVR5A Starter Packs also available comprising EasyAVR5A, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. EasyARM ARM Development Board -£109 Easily develop for NXP’s 32-bit ARM microcontrollers with the EasyARM. Includes on-board USB programmer and useful I/O devices and supports 64 and 144-pin devices. LCD displays and SD card sold ’ ■ separately. Compilers BIGAVR2 Starter Packs also available comprising BIGAVR2, character and graphic LCDs, touch panel and either BASIC, C or Pascal compiler. EasyPSoC4 PSoC Development Board - £89 Learn about and develop for Cypress’s exciting PSoC mixed-signal array devices with the EasyPSoC4. Features built-in USB programmer and advanced I/O devices and supports 8, 20, 28 and 48-pin PSoCs. LCD displays and SD card sold separately. Add-on Boards Easy8051B Starter Packs also available comprising Easy8051B, character and graphic LCDs, touch panel, tem- perature sensor and either BASIC, C or Pascal compiler. UNI-DS3 Universal Development Board - £99 With the UNI-DS3 you can easily work with a number of popular microcontrollers from different manufacturers simply by buying optional plug-on MCU cards. Devices sup- ported include PIC, dsPIC, AVR, 8051, ARM and PSoC. MCU cards, LCD displays and SD card sold separately. Starter Packs mikroBASIC, mikroC and mikroPascal compilers now available in versions for PIC, dsPIC, AVR and 8051 microcontrollers. All feature user-friendly development environments, built-in library routines and easy integration with MikroElek- tronika’s programmers and debuggers. We stock an extensive range of add-on boards that plug straight onto Mikro- Elektronika’s development boards including A/D, D/A, RS-485, CAN, LIN, Ethernet, IrDA, RTC, EEPROM, Compact Flash, SD/MMC, MP3, Bluetooth, ZigBee, RFid, stepper motor driver and many more. wi' M Save money by buying one of our Starter Packs. Each includes a development board with options such as LCD displays, touch panel, temperature sensor and come with a full version of either mikroBASIC, mikroC or mikroPascal. Available for PIC, dsPIC, PIC24/dsPIC33, AVR and 8051. NEW PRO versions just released for PIC and AVR - existing mikroBASIC, mikroC and mikroPascal customers can upgrade free-of-charge! Contact us for details. NEW range of GSM/GPRS and GPS add-on boards and accessories just released. Contact us for details. NEW PIC and AVR Starter Packs now come with PRO versions of mikroBASIC, mikroC or mikroPascal. Please see our website at www.paltronix.com for further details of these and other products We also stock components, control boards, development tools, educational products, prototyping aids and test equipment Paltronix Limited, Unit 3 Dolphin Lane, 35 High Street, Southampton, S014 2DF | Tel: 0845 226 9451 | Fax: 0845 226 9452 | Email: sales@paltronix.com Secure on-line ordering. Major credit and debit cards accepted. Prices exclude delivery and VAT and are subject to change. Luxeon Logic Brightness control for LED torches Oliver Micic (Germany) The small super-bright Luxeon LEDs from Philips are suitable for many applications, including small but handy (that is, bright) pocket torches. However, you don't always need maximum brightness, so it would be nice to have a sim- ple brightness control. After giving this ques- tion a bit of thought, the author designed the circuit described here. An ATtiny microcon- troller enables convenient one-button opera- tion. Three brightness levels can be selected by pressing the button one to three times in succession, and pressing it yet again switches the LED off. In this state the ATtiny enters sleep mode with a cur- rent consumption of around 1.2 pA. The current consumption rises to around 12 mA in normal operation, plus the current through the LEDs. At 4.5 V, the currents measured by the author at the three brightness settings were 50 mA, 97 mA, and 244 mA. The LED current can be set to other levels by adjusting the value of R1 in the circuit, although the maxi- mum operating current of the LED should not exceed 350 mA. If you want to use more than one LED, you will have to use a different transistor Features • Three selectable brightness levels • One-button operation • Microcontroller control circuit • Current consumption in sleep mode only 1.2 pA type, since the maximum rated current of the 2N2222 is 600 mA. With regard to the quite simple circuit, we can mention that it lacks a crystal because the clock is provided by the internal 8-MHz oscillator of the ATtiny microcontroller. The firmware [1] is written in BASCOM and works with PWM control using the internal clock divider (1:8). If any changes are made, this should be maintained to ensure that the firmware runs at 1 MHz, which reduces the current consumption. A suitable small PCB is available via the Ele- ktor website, and as usual the layout can be downloaded free of charge [1]. The author [2] designed a round PCB that fits nicely in a pocket torch with three AA batteries. ( 081159 - 1 ) Internet Links [1] www.elektor.com/081159 [2] www.dg7xo.de Downloads 081159-1: PCB design (.pdf), from [1] 081159-11: Source code and hex files, from [1] Product 081159-41: ATtiny25 microcontroller, ready programmed COMPONENT LIST Resistors R1 = 3Q3 (1206) R2 = 390Q (1206) Capacitors Cl = 100nF (1206) C2 = 22pF 10V (SMD) Semiconductors T1,T2 = 2N2222 (SOT-23) IC1 = ATtiny25-20SU (SOT-8) LED1 = Luxeon LED, 1W (SMD), white Miscellaneous Pushbutton PCB #081159-1 [1] Preamplifier for RF Sweep Generator M Gert Baars (The Netherlands) The RF sweep frequency generator ('wobbu- lator') published in the October 2008 issue of Elektor has a receiver option that allows the instrument to be used as a direct-conversion receiver. This receiver does however have a noise floor of only -80 dBm, which really should have been —107 dBm to obtain a sen- sitivity of 1 pV. So, for a good receiver some more gain is required. A wideband amplifier, however, generates a lot of additional noise as well and as a consequence will not result in much of an improvement. As an experiment, the author developed a selective receiver with a bandwidth of about 4 MHz. Because a gain of at least 35 dB is required, the preamplifier consists of two amplifying elements. The input amplifier is designed around a dual-gate MOSFET, type BF982. This compo- nent produces relatively little noise but pro- vides a lot of gain. The output stage uses a BFR91 A for some additional gain. 10 elektor - 7-8/2009 Preamplifiers where both the gate and the drain are tuned often strug- gle with feedback via their inter- nal capacitance. Here, the drain cir- cuit has a relatively low impedance, which prevents this from happening. In the prototype that was tested, the input and output are located at right angles with respect to each other to prevent inductive coupling (see photo). Despite the high gain, the amplifier was perfectly stable even without any shielding. The two air-cored coils in the circuit both consist of 4 turns and have an internal diameter of 6 mm, made from 1-mm diameter silvered copper wire and with a tap after 1 turn. The amplifier is mainly intended for the 144 MHz amateur band, but with other coils can also be used for the FM broadcast band, for example. FM detection is achieved by tuning near the edge of the IF filter. At an offset of 15 kHz this is only a few dB lower than at the cen- tre of the pass-band, so that damping is not noticeable. The measured sensitivity in the 2 m band was about 1 pV (6 dB). A good antenna always contributes to the reception, of course. A wideband (scanner) outdoor antenna will give good results. Add- ing this wobbulator/receiver option results in a nice monitor receiver. By setting the scan frequencies of the spectrum analyser to 144 and 146 MHz (or 148 MHz where applicable), any signal within this range is directly visible. When a signal is detected it is merely a case of clicking the scan stop button and then clicking on the signal in the dis- play window using the right mouse button. After this, the receiver switches directly to this frequency and you can listen to the signal. You can subsequently resume the scan- ning so that you can continue to look for other signals. For narrowband FM detection you need to select the FMN button in the window for the receiver and this then provides the required offset for the edge detection at 25 kHz band- width. This value is adjustable via the 'setting' menu (default is 12,500 Hz) and can be changed experimentally for best results. To power the circuit you can use a 9- V battery. It is also possible to power the amplifier directly from the RF sweep generator, if output capacitor C6 is replaced with a link; in the 'options' menu you will then have to select the option 'use probe'. ( 090134 - 1 ) Cheap Serial Port for the Mac Gerrit Polder (The Netherlands) Many people would agree that the Apple Macintosh is a fantastic computer. Even so, it's been less popular for a good while amongst electronics engineers and enthusiasts. Of course there was a good reason for this: Apple was one of the first companies that left out the ever so useful RS232 port. And not only on their notebooks (sorry, Mac- Books), they also left them out from their desktop computers. It's been a good 1 0 years since Apple started delivering those beautiful, futuristic iMacs in a range of colours, but unfor tunately without an RS232 port. However, times change and Apple has steadily increased its market share, also amongst electronics enthusiasts. And as far as 'the other brands' are concerned, there is virtually no laptop made nowadays that does come with an RS232 port. The RS232 port is still considered very use- ful by many electronics-minded people though. These days microcontroller circuits that employ ersatz-RS232 often work at 3 V rather than 5 V. The ±12 volt swing originally specified for RS232 isn't found or indeed useful anymore. For that reason a checklist was created to help you add a 3 or 5 volt RS232 port to 1. Buy a GSM USB cable from a shop or via the Internet from Hong Kong; it shouldn't cost a lot. 2. Look at [2] for the pinout of the plug. It will tell you what connections are used by RS232 and what the operating voltage is. This will be 3 volts for most modern telephones; for older models it is usually 5 volts. 3. You will usually get some software for Win- dows with the cable — if you can use it you're done. Congratulations! 4. Mac users have to do a bit more work though. Connect the cable to the compu- ter and have a look in the System Profiler (Applications/Utilities) under Hardware/ USB to see what type of interface it is. As an example, you could see the following: usb data cable: Version: Bus Power (mA): Speed: Manufacturer: Product ID: Serial Number: Vendor ID: 1.00 500 Up to 12 Mb/sec Silicon Labs 0x1 0c5 0001 OxIOab 5. You can see from this that you have a 'Sili- con Labs' interface. From the website of this company [1] you download the CP210x USB to UART Bridge Virtual COM Port (VCP) driver for Mac OS X. 7-8/2009 - elektor 11 6. The driver is installed by double-clicking on the SLAB_USBtoUART Installer. 7. Unfortunately, the standard Product and Vendor ID of this driver do not correspond with those of the GSM cable, but that is easily rectified. The Product and Vendor ID that dis- covered in step 4 can be included in the file: /Sys tem/ Library /Extensions /SLA B_ USBtoUART. kext/Contents/Info.plist. All that's left to do is to type a few instructions to load the driver. 8. Open a terminal session and type: $ sudo kextload /System /Library /Extensions/ SLAB_USBtoUART.kext $ touch /System/Library/Extensions $ Is -a\ /dev/tty. SLAB* If all went well you should see something like this: crw-rw-rw- 1 root wheel 9, 8 Oct 18 08:32 /dev/ tty.SLAB_USBtoUART as proof that the new COM port is available. ( 090092 - 1 ) Internet Links [1] www.silabs.com [2] http://pinouts.ru 0-1 8 MHz Receiver M Gert Baars (The Netherlands) The receiver shown in the schematic has some characteristics not unlike those of the so-called 'world band receivers' from the old days, which could usually receive LW, MW and SW up to about 20 MHz in AM and which were crammed with transistors. Because of the 'low-budget' character of this circuit it forgoes a tuning scale/indicator and the design has been kept as simple as possible. Nevertheless, the name 'Mini World Receiver' would not be inappropriate for this design. In the RF bands up to 30 MHz, the majority of stations can actually be found below 18 MHz. It is possible to make a receiver for this with a relatively simple circuit. The simplicity of the circuit is therefore its primary strength, but that does not mean that the results are poor. The receiver is a single superheterodyne with the salient characteristic that the receiving range from DC to 18 MHz can be tuned in a singe range. The circuit uses a high intermediate fre- quency (IF). This makes the image frequency large, so that its suppression is very easy, which contributes to the simplicity of the cir- cuit. This also means that the ratio between the highest and lowest required VFO frequen- cies remains small as well. The circuit starts with a NE612 mixer 1C (IC1), which also contains an oscillator. The oscilla- tor is a Colpitts type and is tuned here using a dual-varicap diode (D1). The Mixer is fol- lowed by a crystal filter which has a centre 12 elektor - 7-8/2009 frequency of 45 MHz and a bandwidth of 15 kHz. This bandwidth is a little large for AM, but the advantage of the filter, type 45M15AU, that is used here, is that it is priced quite favourably. With an IF of 45 MHz and a receiving range from DC to 18 MHz, the VCO frequency there- fore has to be IF+FO = 45 to 63 MHz. The image frequency is now 90 MHz higher than the desired receiver frequency, at 90-108 MHz. A single coil in series with the antenna provides sufficient suppression at these frequencies. It really cannot be any simpler. After the IF filter follows an LC combination which suppresses the fundamental frequency of the IF filter (45M15AU is a 3rd overtone type) and increases the damping. A logarith- mic detector was chosen for the IF amplifier. The advantage is mainly the small number of external components that are required for this. The detector is an AD8307 (IC2) and has a sensitivity of about -75 dBm, which works out to about 40 pV. Together with the gain of the mixer (around 17 dB) the sensitivity of the receiver ends up at about 5 pV. Because of the logarithmic characters of the detector, an AGC (automatic gain control) is not neces- sary. A simple RC filter subsequently provides some additional fundamental frequency and Egbert Jan van den Bussche (The Netherlands) Since one of the servers owned by the author would not start up by itself after a power fail- ure this little circuit was designed to perform that task. The older PC that concerned did have a noise suppression. The AF amplifier follows this filter and is configured for a gain of approximately 200. This is enough to drive a speaker so that it exceeds the ambient noise. If necessary the volume can be adjusted with PI. To tune such a large frequency range it is cer- tainnly preferable to use a multiturn potenti- ometer. Because of the low-budget character of this design, a circuit around two potenti- ometers is used instead. A transistor config- ured as a current source provides a constant voltage of about 1 volt across the Tine' tun- ing potentiometer (P2). The 'Band' poten- tiometer (P3) has a negligible effect on the voltage across the Tine' potentiometer, but it does allow the voltage at both extremes to be changed. In this way the 'Band' control can be used to select a window within which the Tine' potentiometer is used for the actual tuning. The ratio is about 1 to 5. If you pre- fer a ratio of, say, 1 to 10, you can increase the emitter resistor R4 from 4.7 kohms to 10 kohms. Because the VFO has to be stable, only the power supply to the mixer/VFO 1C has been regulated. The power supply voltage to the AD8307 has been reduced with a resistor to a safe value, while the AF amplifier is pow- standby state, but no matching BIOS set- ting that allows it to start up unattended. Although a +5 V standby supply voltage is available, you always have to push a but- ton for a short time to start the computer up again. Modern PCs often do have the option in the BIOS which makes an automatic start ered directly from the battery. The current consumption of the circuit without a signal is less than 20 mA and with good audible audio about 50 mA. The circuit continues to work well with power supply voltages down to about 6.5 volts. This means that a 9 V bat- tery will last extra long. Calibration of the circuit is simple. The tun- ing potentiometers have to be set to the lowest frequency first. Use trimmer capaci- tor C7 to find a point where AC power line hum becomes audible. Here the receiver frequency is at 0 Hz. Optionally you can also tune to a strong longwave station as the low- est receiver frequency. As a minimum a simple telescoping antenna with a length of 50 cm is required, which makes the receiver eminently suitable for portable use. With such an antenna dozens of stations are audible, particularly during the evening when propagation becomes favourable. A length of wire several meters long does however increase the signal strength, particularly during the day, but it is not strictly necessary. ( 090082 - 1 ) M (d> (£> i i i i i i i (£> \ (£> [ 1 d> _J 090128 - 12 after a power outage possible. After build- ing in the accompanying circuit, the PC starts after about a second. Incidentally, the push- button still functions as before. The circuit is built around two golden oldies: a NE555 as single-shot pulse generator and a Start-up Aid for PCs 7-8/2009 - eleklor 13 TL7705 reset generator. The reset generator will generate a pulse of about 1 second after the supply voltage appears. The RC circuit between theTL7705 and the NE555 provides a small trigger pulse during the falling edge of the 1 second pulse. The NE555 reacts to this by generating a nice pulse of 1. IRC. Dur- ing that time the output transistor bridges the above mentioned pushbutton switch of the PC, so it will start obediently. Other applications that require a short dura- tion contact after the power supply returns are of course also possible. ( 090128 - 1 ) Port Expander Steffen Graf (Germany) It can sometimes happen that even when using the largest version of a microcontroller for a particular design application there are just not enough 1/ O port pins to handle all the inputs and outputs. This can be the case when for example several LCDs are driven in par- allel or when it is necessary to input val- ues from a large number of switches and pushbuttons. The circuit shown here solves the prob- lem using the I/O port expander 1C type MAX7301 from Maxim [1]. This device can be powered from a supply between 2.5 V and 5 V which makes it suitable for use with both 3.3 V and 5 V controllers (the value of resistor shown as R2 is suit- able operation from a 3.3 V supply). The port expander uses the SPI interface so it only requires four microcontroller pins: Data In, Data Out, Clock and Slave Select. Many microcontrollers have an SPI interface already implemented on- chip but if not it should be relatively easy to implement the function in software. We have sacrificed four pins on the inter- face but this port expander now gives us 28 general purpose I/O pins (GPIOs) which can be configured as either inputs (with or without pull-ups) or outputs. Providing the microcontroller is fast enough the GPIOs can be switched at a rate of 26 MHz. The project page of this article [2] includes full listings (in the form of a small C library) of the author's software implementation. This allow the ports to be configured as inputs or outputs and the value of the input port pins to be read or output pins to be set. The instruction io_max73 01 ( OxF, Portpins); selects port pins used as outputs. A macro expression such as PCONF8_11 is used for Portpins to refer to port pins 8 to 11. The instruction io_max73 01 ( 0x0 , Portpins); configures port pins as inputs. To output data from the port pins use set_max73 01 (data , Portpins); where doto = binary data. And the instruction data = get_max73 01 ( Portpins ) ; reads the binary value of input data. ( 080247 - 1 ) Internet Links [1] http://datasheets.maxim-ic.com/en/ds/ MAX7301.pdf [2] www.elektor.com/080247 Download Software 080247-11 source code, from [2] Slow Glow Dirk Visser (The Netherlands) There are many different ways in which a lamp can be made to light up gradually. This circuit presents one of them. What is spe- cial about this circuit is that it can be turned into a power potentiometer with only a small modification. Slow Glow operates as follows: the instant the circuit is turned on, the inverting input of the opamp is at the same voltage as the inverting input, which is equal to the sup- ply voltage. However, Cl will slowly charge up, which causes the voltage on the invert- ing input to drop. This voltage therefore looks like an inverted RC charging curve. The reduction of this voltage causes the output voltage of IC1 to increase, and T1 is driven open harder. This in turn causes the voltage across the lamp to follow the K shape of an RC charging curve, and the use of a transistor means that a large current can be supplied. When it comes to the choice of op amp you have to keep in mind its common mode range. In this circuit it needs to be equal to the full supply voltage. As a voltage follower the need is therefore for a rail-to-rail opamp. An LM8261 was picked mainly because it 14 elektor - 7-8/2009 combines an exceptionally small package (SOT23-5, 2.92 x 2.84 mm) with an equally exceptional supply voltage range of 2.7 V to 30 V. There are very few rail-to-rail opamps offering such a large supply volt- age range. The opamp has been decoupled with C3 because of its speed (GBWP: 21 MHz). The speed isn't critical in this case though. R3 is connected in series with the MOS- FET to prevent spurious oscillations from occurring. It stands to reason that this cir- cuit is best built using SMD com- ponents. Cl can be obtained in an 0805 package (ceramic multilayer) and all other parts are also availa- ble in SMD packages. For the MOS- FET we found an SOT-223 variant made by ST, the STN4NF03L. It can switch more than 6 A, which is impressive considering its dimen- sions (7 x 6.5 mm). If more power is needed than the maximum dissipation of 3.3 W (at 25 °C) permits, there is no problem if a big- ger FET is used (for example, one in a larger 090029-11 D2PAK package). There is a large number of FETs available in this type of package that can cope with significantly higher currents and power. The circuit can also be used with normal 12 V halogen lighting if a bit of cooling and a TO- 220 package is used. With the values used for R1 and Cl the transistor needs to dissi- pate the maximum power for only just over a tenth of a second. This power is obviously dependent on the type of lamp connected up. The gate-source voltage of the MOSFET determines the permissible supply voltage range. The absolute maxi- mum value here is 16 V, and there is also a minimum voltage required to obtain a low channel resistance (<0.05 Q at U GS = 5 V). Hence the supply voltage range for this circuit is 6 to 1 5 V and a 1 6 V rated type for Cl is sufficient. When Cl and R1 are replaced with a potentiometer (with the slider connected to R2), the whole circuit behaves much like a potentiome- ter, but one with very large output power. The MOSFET is driven by IC1 such that a balance exists between the inputs of the op amp. The voltage at the drain therefore becomes equal to the voltage at the wiper of the potentiometer. ( 090029 - 1 ) SRPP Headphone Amplifier M < F2 1 1 1 t HP] , tl D3 o w\ , ||C5 rj 200mA C 230V £ 65W 1 < ’ II U D4 r+P -112- 4700uF 10V FI TR1 31 5mA T (630mA T) D3...D6 = 4x1 N4007 C4...C7 = 4x1n/1000V F3 F4 200mA T (400mA T) TR2 4AT 6V3 40W HI D6 C7 lo R9 |q^ lo R10 R5 i 470R | 5W C8 470uF 400V C9 470uF 400V CIO lOOn 400V R6 5W R7 PI5W 80V C11 lOOn 400V 2" 6V3 ^*4 081151-11 Martin Louw Kristoffersen (Denmark) Mention valve amplifiers and many design- ers go depressive instantly over the thought of a suitable output transformer. The part will be in the history books forever as eso- teric, bulky and expensive because, it says, it is designed and manufactured for a specific valve constellation and output power. There exist thick books on valve output transform- ers, as well as gurus lecturing on them and winding them by hand. However, with some concessions to distortion (but keeping a lot of money in your pocket) a circuit configuration known as SRPP (series regulated push-pull) allows a low-power valve amplifier to be built that does not require the infamous output transformer. SRPP is normally used for pream- plifier stages only, employing two triodes in what looks like a cascade arrangement. Here we propose the use of two EL84 (6BQ5) power pentodes in triode SRPP configura- tion. The reasons for using the EL84 (6CA5) are mainly that it's cheap, widely available and forgiving of the odd overload condition. Here, two of these valves are SRPP'd into an 7-8/2009 - elektor 15 amplifier that's sure to reproduce that 'warm thermionic sound' so much in demand these days. Before describing the circuit operation, it must be mentioned that construction of this circuit must not be attempted unless you have experience in working with valves at high voltages, or can rely on the advice and assistance of an 'old hand'. As a safety meas- ure, two anti-series connected zener diodes are fitted at the amplifier output. These devices protect the output (i.e. your head- phones and ears) against possibly danger- ous voltages at switch-on, or when output capacitor C3 breaks down. The power supply is dimensioned for two channels, i.e. a stereo version of the amplifier. The values in brackets are for Elektor read- ers on 120 VAC power. Note the doubled val- ues of fuses FI and F3 in the AC primary cir- cuits. The PSU is a conventional design, pos- sibly with the exception of the 6.3 V heater voltage being raised to a level of about +80 V through voltage divider R7-R8. This is done to prevent exceeding the maximum cathode- heater voltage specified for the EL84 (6CA5). R6 is a bleeder resistor emptying the reservoir capacitors C8 and C9 in a quick but control- led manner when the amplifier is switched off. Rectifier diodes D3-D6 each have an anti- rattle capacitor across them. In the amplifier, assuming the valves used have roughly the same emission, the half- voltage level of about +145 V exists at the junction of the anode of VI and the control grid of M2. The SRPP is no exception to the rule that high quality, (preferably) new capac- itors are essential not just for reproducibility and sound fidelity, but also for safety. ( 081151 - 1 ) Easy LEGO Robotics Set Up TiloGockel (Germany) At the beginning of 2006 the Danish com- pany LEGO introduced the NXT programma- ble brick into their 'Robotics Invention Sys- tem'. Many schools and universities all over the world have since recognised this as an ideal tool to introduce the concepts of soft- ware and hardware design. Spare parts or additional components for the system can be purchased from on-line auction sites or ordered from the LEGO web shop [1]. If you are planning to invest in the system for a child, teenager or even for your own per- sonal use you should be aware that you may encounter some issues when first install- ing the software. The problems can occur on machines running Windows XP or Vista because the software is not officially sup- ported. The following tips will be helpful and should solve the main problems you are likely to come across. First off, try installing the software on the supplied CD as suggested in the manual. With any luck it will be successful. Choose 'complete installation' option and then tick Quicktime 2.1 option and not the Quicktime 3.0 and DirectX 6.1. It is likely that there is a more up to date version of DirectX already installed on your machine. It is important to specify Quicktime 2.1; more recent versions are not recognised! In some cases the computer may now 'hang' when it tries to execute probe.exe, if this is the case then it is necessary to make a few changes to the installation: 1 . Uninstall the LEGO software (Program files / LEGO MINDSTORMS / ... / uninstall) 2. Uninstall all versions of Quicktime (Start / Control Panel / Add or Remove Programs / right click on Quicktime) 3. Re-install the LEGO software selecting Quicktime 2.1. 4. Start / Control Panel / System / click 'Advanced' tab / Perform- ance click 'Settings' / click 'Advanced' tab / Now on 'Virtual memory' reduce the size to 384 MB. Step 4 is important, otherwise Quicktime reports that there is too little memory available and does not even start — a somewhat curious bug. Now a change is nec- essary to the start icon for Mindstorms; right click on the LEGO Mindstorms desktop icon and select 'Properties', now click the Shortcut tab and change the 'Start in' path from 'C:\ Program\LEGO MINDSTORMS\probe.exe' to 'C:\Program\LEGO MINDSTORMS'. Occasion- ally a problem will occur with the Windows installer service (error 1281) which causes the computer to hang. To get round this you can either reboot before each new installa- tion or you can manually stop the installer by going to Start / Control panel / Adminis- trative tools / Services / right click Windows Installer and click on the service status box 'Stop'. Now run the software by clicking on the desktop LEGO icon (make sure that the CD is in the computer's CD drive). Installing the older LEGO Robotics Invention Version 1.0 can sometimes generate a problem with the screen Display Properties; a solution to the problem can be found at [2]. Some practical tips for newcomers to the LEGO system: commu- nications between the brick and the IR transmit- ter can be dis- rupted by strong external light sources such as table lamps and fluorescent lighting. A green LED on the IR transmitter indicates that the communication was successful. When it is anticipated that the sys- tem will not be used for a period of time don't forget to remove the battery from the IR transmitter station. The IR tower needs a serial port but newer computers do not usu- ally have this type of port, in this case try a USB — infrared transmit- ter dongle these can be found on Inter- net auction sites and retail at relatively low prices. Alternatively an even cheaper solu- tion is a USB to RS232 interface (e.g. the USB2 Serial USB 1.1 from Reichelt in Germany). Several alternative programming environ- ments have been developed for the LEGO system and for more adventurous projects like those described in [3] it is better to use a high-level compiled language rather than the LEGO graphic programming environment which comes bundled with the controller. A good choice is the free NQC (Not Quite C) cross compiler [4] which uses a C-like syntax. ( 081129 - 1 ) 16 elektor - 7-8/2009 Internet Links [1] http://shop.lego.com/ByCatalog http://www.lego.com/education/school [2] www.crynwr.com/cgi-bin/ezmlm-cgi/7/21888 Pseudo Fan Dr. Thomas Scherer (Germany) The aim of this circuit is to trick a so-called 'intelligent' fan controller that a fan is con- nected to it when it is not. This may sound like madness, yet there is method in it. The author was so pleased with his small pri- vate server (a network attached storage, or NAS, device) that he recommended it to a friend. The friend had found a good source of low-cost SSDs (solid state disks) and replaced the spinning hard disks with semiconductor memory, with the aim of saving power. With the drives replaced, it became apparent that there was an opportunity to make the unit quieter still. Since the SSDs only dissipated a Characteristics • simulates a fan of any size(!) • pseudo-rotation frequency adjustable from 15 Hz to 150 Hz • current consumption less than 5 mA • operating voltage from 4 V to 15 V • low noise! total of 5 W, surely it would be possible to dis- connect the noisy internal 60 mm fan? Unfortunately it was never going to be that easy. The moment the fan was disconnected an annoying buzzer started to sound contin- uously: the electronics in the NAS box does not just control the fan speed to maintain a reasonable temperature inside the unit, it also checks that the fan is indeed spinning. If the controller thinks the fan has stopped, it sounds the alarm. The author was called in to see if he could solve the problem. It immediately became clear that the fan had a standard three-pin connector. The cable carried a voltage of between +5 V to +12 V on the red wire and ground on the black wire; on the yellow wire the fan produced a square- wave signal with a frequency of about 35 Hz. To fool the controller into thinking that the fan is turning we simply needed to generate a square wave! [3] www.tik.ee.ethz. ch/tik/education/lectures/PPS/mindstorms/#finished www.informatik.uni-kiel. de/rtsys/lego-mindstorms/projekte/#c1798 D1 v+ ©-M4 SB140 a (2> C3 □ 47)0. R1 H 47k H R © THR IC1 DIS OUT NE555 TR CV 16V Cl lOOn 5 C2 lOn PI \ s 470k 090445 - 1 1 Old hands will no doubt be able to guess what comes next: the 555 timer, one of the best-selling ICs ever, is ideal for this task. It can cope with the range of supply voltages, and conveniently features a traditional open- COMPONENT LIST Resistors R1 =47kO PI = 470kQ, small, upright Capacitors Cl = 100nF C2 = 10nF C3 = 47pF 16V Semiconductors D1 =SB140 (Schottky diode) IC1 = NE555 Miscellaneous Branched cable with 3-way plug PCB# 090445-1 www.youtube.com/results?search_type=&search_qu ery=lego+mindstorms&aq=f [4] http://bricxcc.sourceforge.net/nqc/ K collector output. The circuit diagram contains no great sur- prises. Rather than using the standard asta- ble configuration of the device, the fre- quency-determining resistance (comprising the series connection of R1 and PI) is wired to pin 3, which is normally used as the output. This has the twin advantages of leaving pin 7 free to use as an open-collector output and of giving a 50 % duty cycle. With the compo- nent values suggested the output frequency can be adjusted from approximately 15 Hz to approximately 150 Hz, which should be more than enough for any application. It is of course possible to build a simple cir- cuit like this on a small piece of prototyping board. However, a much more professional look can be achieved using the printed cir- cuit board we have designed for the job. The layout file can, as usual, be found on the Ele- ktor website on the pages accompanying this article [1]. The pseudo-fan is of course not limited to being used in small servers. It is becoming more and more popular to build PCs that are quiet, especially if they are to be used as media centres. This means using passive cooling wherever possible. Unfortunately in some cases the BIOS throws its spanner in the works by not allowing the fan rotation sensors on the motherboard to be disabled individually. The pseudo-fan provides a sim- ple and quick solution to this problem and avoids complicated BIOS patches. Some fans use a four-wire cable, and these too can be 'virtualised' using this circuit by ignoring the fourth wire and connecting the remaining three in the way described above. If it will not be necessary to adjust the pseudo- fan speed PI can be replaced by a wire link and R1 chosen appropriately. The frequency is then given by f- 1 .44 / (2 x R1 x Cl). ( 090445 - 1 ) Internet Link [1] www.elektor.com/090445 Download 090445-1: PCB design (.pdf), from [1] 7-8/2009 - elektor 17 Programmable Nokia RTTTL Player M +5V © si H S2 H I C2 □ (5 t) PB5/RESET PB2 IC1 PB3 PB1 ATTiny13 PB4 PB0/OC0A PLAY J NEXT J 2 1 OOjj. 16V R2 R1 H 220 Q h -© B :: □ 220n BD139 LSI 8 Q 090243 - 1 1 RTTTL Nule tunvt»i lei Hocc vour notes n Ihc boa bdow: FuFli'j* ,1=4 . . =6 1. =1?T| fir Riltt ft*. ft, IB ftr*. ftT, ft, I ft- ft,, ftrH. fW> fW.. If, ft,, ft*T.. RyttTi ftlf, I Awd 2bg,8o#,1 bg,l bp,l bg^cb,yg.W,g.8db,1 bg.1 bp.l bg,bd«b,ydb,&>4*.8g,8db,8gb r l bg.1 bl/ > UscdWa hrcojcncvIMH^I: r l. Convert » Sajjad Moosavi (Iran) This circuit is an easy way to play monophonic music as you may remember it (fondly or not) sound- ing from those good old Nokia 3310 cellphones. The circuit can be used in applications like doorbells, phone ringers, bike horns or any other alarm circuit — waves of recognition and cellphone wistfulness in the audi- ence guaranteed! Monophonic music is made of some notes in a specific order with a given duration for each note. These notes are selected from a range specified in the table shown here. Nokia developed a programming language to transfer monophonic music to its cellphones and called it RTTTL, for Ringing Tone Text Trans- fer Language. Looking at the table, each note has a different frequency according to selected octave. An octave is the interval between two points where the frequency at the second point is twice the frequency of the first. So to select a specific note in this table, you specify its column and row like A4 (220 Hz) or A #7 (1864.7 Hz). Two successive notes in the table dif- fer by a factor of exactly the 12th root of 2 (approximately 1.059). For example: E6 (1318.8) = D#6 (1244.8) x 1.059 Hz. After selecting the note, the next issue is its duration, i.e. how long it should sound. In contemporary music you will typically observe see the following basic note dura- tions 1/1, 1/2, 1/4, 1 /8th, 1/1 6th . A Whole Note, a.k.a. '1/1' or semibreve, is typically equal to four beats in 4/4 time. A Beat is the basic time unit of a piece of music. The real duration of a beat is related to Tempo. Tempo or BPM (beats per minute) is the speed of a given piece and specifies how many beats should be played in a minute. The RTTTL format is a string divided into three sections: name, default value, and data. The name section consists of a string describing the name of the ring- tone. The default value section is a set of val- ues separated by commas. It describes cer- tain defaults which should be adhered to dur- ing the execution of the ringtone. Possible names are: d (duration), b (tempo), o (octave). The data section consists of a set of charac- ter strings separated by commas, where each string contains a duration, note, octave and optional dotting (which increases the dura- tion of the note by one half). For example here is RTTTL ringtone for the famous Fur Elise piece: FurElise:d=4,o=6,b=125:8e, 8d#, 8e, 8d#, 8e, 8b5, 8d, 8c, a5, 8p, 8c5, 8e5, 8a5, b5, 8p, 8e5, 8g#5, 8b5, c, p, 8e5, 8e, 8d#, 8e, 8d#, 8e, 8b5, 8d, 8c, a5, 8p, 8c5, 8e5, 8a5, b5, 8p, 8e5, 8c, 8b5, 2a5 The string consists of three parts separated by colons. The first part is the song name, 'FurElise' (apologies from Mr ASCII to the Beethoven Her- itage for the non-umlauted u). The second part contains the defaults, with 'd=4' meaning that each note without a duration specification is by default a quarter note, 'o=6' setting the default octave, and 'b=125' defin- ing the tempo. The third part com- prises the notes proper. Each note is separated by a comma and includes, in sequence: a duration specification, a standard music note (as shown in first column of the table) and an octave specification. If no duration or octave specification is present, the default applies. The circuit shown in Figure 1 con- tains an ATtiny13 microcontrol- ler programmed to read the RTTTL format (with some modification), store strings in its program mem- ory and generate notes in the form of square waves. The note frequen- cies are read from a table stored in memory and durations will be cal- culated in the program. The com- monly used octaves 3 through 7 (110 Hz - 3323.7 Hz) can be played by this circuit. The microcontroller is an 8-pin ATtiny13 Atmel microcontroller employing its internal oscillator. The music signal generated at the PB0 pin applied to a simple emitter follower circuit that's open to your improvements in terms of filtering and amplification. Also, because the program puts a low demand on CPU use and resources, you can make the free microcontroller I/O ports do other jobs. The microcontroller's 1 KB program memory is good for storing about 20 songs. Other microcontrollers with larger memories may be used to be able to store more songs. As a minimum hardware requirement, the micro should have an 8-bit timer with compare/match capability. The microcontroller must first be pro- grammed with the firmware for the project. 18 elektor - 7-8/2009 Octave Note i 2 3 4 5 6 7 8 9 A 27.5 55.0 110.0 220.0 440.0 880.0 1760.0 3520.0 7040.0 A#/Bb 29.1 58.3 116.5 233.1 466.2 932.4 1864.7 3729.4 7458.9 B 30.9 61.7 123.5 247.0 493.9 987.8 1975.7 3951.3 7902.7 C 32.7 65.4 130.8 261.6 523.3 1046.6 2093.2 4186.5 8372.9 C#/Db 34.6 69.3 138.6 277.2 554.4 1108.8 2217.7 4435.5 8871.1 D 36.7 73.4 146.8 293.7 587.4 1174.8 2349.7 4699.5 9398.9 D#/Eb 38.9 77.8 155.6 311.2 622.4 1244.8 2489.5 4979.1 9958.1 E 41.2 82.4 164.9 329.7 659.4 1318.8 2637.7 5275.3 10550.6 F 43.7 87.3 174.7 349.3 698.7 1397.3 2794.6 5589.2 11178.4 F#/Gb 46.2 92.5 185.1 370.1 740.2 1480.4 2960.8 5921.8 11843.5 G 49.0 98.0 196.1 392.1 784.3 1568.2 3137.1 6274.1 12548.2 G#/Ab 51.9 103.9 207.7 415.5 830.9 1661.9 3323.7 6647.4 13294.8 The programming procedure comprises these steps: 1. Convert your favorite RTTTL format songs using the 'Converter' utility. 2. Compile the ASM file using an AVR assem- bler like the one provided with Atmel AVRStudio. 3. Write the HEX file to the microcontroller using a suitable device programmer. In the first step, use the 'Converter' software shown in Figure 2. This utility was developed using Visual Basic which runs under Win- dows operating systems. Paste or type the song data and specify the clock frequency of the microcontroller in Megahertz, then press the 'Convert' button. Note that the ATtiny13 micro uses its 9.6 MHz internal oscillator. The software converts the songs and copies them to a file called 'ringtones.inc'. Next, Assemble the 'rtttl.asm' file with 'ringtones.inc' using an AVR assembler. The assembler outputs are two main files, 'rtttl.hex' and 'rtttl.eep'. These files should be written to the microcontrol- ler's program memory (or EEPROM) using a serial or parallel programmer. ( 090243 - 1 ) Downloads & Products Programmed Controller Order code: 090243-41 (plays 'Popcorn' song only) Software File: 090243-11.zip (free download) Content: ATtiny13 source & hex files; 'Converter' utility Location: www.elektor.com/090243 Switching Delay Thorsten Steurich (Germany) The circuit described here was designed as an addition to a remotely-controlled garage door opener. The problem was that a brief burst of interference, arising from a thunderstorm or a mains spike, was enough to trigger the mechanism, and the author found this a nui- sance. The effect of the circuit is to enable the output from the receiver module only when a relatively long pulse (more than about 0.5 s) is received. The cir- cuit can of course also be used in other similar situations, such as electrically-powered shut- ters, alarms and the like. At the heart of the circuit is NAND gate IC1.C. The output of the circuit (after inverter IC1.D) only goes high when both inputs to IC1.C are at a high level. When the circuit is triggered T1 conducts, and the output of inverter IC1. A, and hence also pin 8 of IC1.C, go high. If we now arrange things so that for a preset time the other input to IC1 .C remains low, the trig- ger signal will not be propagated to the out- put until this period has elapsed. In the case of the author's garage door opener, this will only happen if the button on the transmitter is held down. The 555 timer is used to generate the delayed gating signal for IC1.C. It is wired as a monostable multivibrator in a similar 7-8/2009 - elektor 19 fashion to the arrangement in the 'Economy Timer' circuit elsewhere in this issue. When the circuit is triggered T2 will briefly conduct as a result of the positive edge at the output of IC1.A. This triggers the 555 timer: its out- put will go high, and thus pin 9 of IC1.C will go low. Because of the propagation delays through the components a very short low pulse will appear at the output of IC1 .C when the circuit is triggered. The RC combination at the input to IC1.D ensures that this does not affect the output. When the period of timer IC2, as determined by R7 and C5, expires its output returns low. This allows the input signal to pass through IC1.C. If the button on the remote control has been released before the timer expires, no signal will pass to the output. When the trigger signal is removed the out- put of IC1 .A goes low, which resets the timer: the 555's reset input, like its trigger input, is active low. The circuit is now again in its qui- escent state. ( 081086 - 1 ) Six-digit Display with SPI Port M Characteristics • six-digit seven-segment display • just two components, plus display modules • driven using software SPI emulation • C driver routines easily adapted to any type of microcontroller Uwe Altenburg (Germany) There is no essential difference between a seven-segment display and seven individual LEDs with either their cathodes or their anodes connected together. Often the display will be driven by a microcontroller, and when several digits are wanted, they are usually driven in a multiplexed fashion. This involves connecting together each segment in a given position across the digits, with each of the seven common segment lines (plus decimal point) being driven by an output port pin of the microcontroller via a series resistor. Each digit also requires a transistor, which again needs an output port pin to drive it. For a six-digit display, this means a total of fourteen output port pins: almost two whole ports on an 8-bit microcontroller. Maxim offers a solution to this problem in the MAX7219. The device is controlled overan SPI port, requiring just four I/O pins on the microcontroller. It can drive up to eight individual seven-segment displays. Contrary to popular belief, multiplexing the displays does not reduce overall power consumption: although each digit is only driven briefly the LED current must be correspondingly increased in order to achieve the same average brightness. According to the device's datasheet the MAX7219 can deliver up to 500 mA per digit.The rapidly changing current drawcan cause interference to the microcontroller's power supply if adequate decoupling is not provided. An advantage of the MAX7219 is that neither series resistors nor drive transistors are required. Only one external resistor is needed, which is used to set the segment current for all the digits. Since it is also possible to adjust the segment current over the SPI port, a fixed 10 kO resistor is suitable. The small printed circuit board is designed to accept Kingbright SC52-11 common cathode display modules, which have a digit height of 13.2 mm. The display is available in a range of colours. If you wish to modify the board layout to suit a different display, the Eagle file is available for download from the web pages for this article [1]. A special feature of the MAX7219 is the ability to cascade multiple devices, allowing several display boards to be driven from a single microcontroller. No extra I/O pins are required on the microcontroller as the data bits are shifted through the chain of 20 elektor - 7-8/2009 devices: the output DOUT of one module is connected to the DIN input of the next, and the LOAD and CLK signals are wired in parallel. How do we program the device? The MAX721 9contains 1 6internal registersthat can be serially addressed and written to. Each seven-segment display is configured using a separate 16 bit message, where bits 0 to 7 carry the data to be displayed and bits 8 to 1 1 carry the register address. Bits 1 2 to 1 5 are not used. Each bit is clocked into the device on the rising edge of the CLK signal. While the data bits are being transmitted the LOAD signal must remain low; when it goes high the message is written to the addressed register. It is not necessary for the microcontroller to have dedicated SPI hardware: a low data rate is adequate in almost all cases and so the necessary COMPONENT LIST Resistors R1 = 10kn Semiconductors D1-D6 = SC52-11 (Kingbright) IC1 = MAX7219CNG Miscellaneous JP1 = 6-way pinheader PCB# 081154-1 [1] waveforms can be generated in software. The author has written suitable routines in C [1 ], which are easily adapted for any type of microcontroller. The routine SendCmdO is responsible for'bit banging'the I/O ports to generate the SPI signals. A couple of the MAX7219's registers require initialisation. The mode register determines whether the internal BCD-to- seven-segment decoder is used orwhether the data stored in the registers correspond directly to segment patterns. The latter option is more general but requires the use of a look-up table in the driver: in the author's source code this array is called Segments. A further register sets the total number of digits to be driven; and finally the segment current must be set and the display enabled. Once everything is initialised the digit registers can be written to using the function UpdateDisplayO. The display module is also supported by the M16C TinyBrick [2] described in the March 2009 issue of Elektor. A simple example program can be downloaded from the project website, showing how easy it is to control the display using the built-in BASIC interpreter. ( 081154 - 1 ) Internet Links [1] www.elektor.com/081154 [2] www.elektor.com/080719 Downloads 081 1 54-1 : PCB layout (.pdf), from www.elektor. com/081154 081 1 54-1 1 : source code, from www.elektor. com/081154 CAD files, from www.elektor.com/081154 LiPo Monitor 2x Lipo RIB 1 V3@6V0 ■> R2B 1V3@6V6 — > R3B 3x Lipo R1A o o I". O) CM in 1 V3@9V0 -E>— R2A 1V3@9V9 R3A ■SO oo (O O) Cl T © SET1 OUT2 HYST2 IC1 ICL7665 HYST1 SET2 OUT1 2jll2 25V Tr4 D1 R5 D2 -f §. ■ BT1 I ! 2, 3x Lipo 090038 - 1 1 Werner Ludwig (Germany) The LiPo Monitor simplifies voltage monitoring of Lithium Polymer (LiPo) batteries during use. You clearly want to avoid discharging them too far and another thing on your wish list should be a warning when the permitted limit of safe dis- charge is approaching. A green LED remains on for all the time that the battery voltage remains adequate. If the volts drop as far as the terminal voltage level, a red LED lights to signal that fur- ther use (and discharge) of the battery will be harmful and not allowed. Before this happens, in the lower but still OK voltage range, both LEDs illuminate to warn that the end is nigh. The circuit is particularly suitable for monitoring the LiPo propulsion batteries of radio control models that are used pri- marily in short range operation, such as indoor model helicopters. The ICL7665 device used in this circuit con- tains two comparators plus an internal 1.3 V voltage reference. Each comparator has two out- puts, OUT and HYST. This ena- bles you to monitor each of the two inputs SET1 and SET2 for over and under-voltage. OUT1 is an inverting output, whereas the other three are non- inverting. The maximum current is 25 mA per output. OUT1 and OUT2 are current sinks (open- drain outputs of N-channel MOSFETS, source to ground). HYST1 and HYST2 are current sources (open-drain outputs of P-channel MOSFETS, source to +U B ).The truth table shown be- low provides information on the switching behaviour of the ICL7665. The two comparators in the LiPo Monitor form a window discriminator (voltage range 7-8/2009 - elektor 21 ging and avoids deep discharge of propulsion batteries. ( 090038 - 1 ) sensor). The bat- tery voltage under observation is app- lied, via a voltage divider, to both of the inputs. The vol- tage dividers in this circuit are designed for situations using Internet Link two or three LiPo cells and are arranged so light together, lies between 3.0 and 3.3 http://datasheets.maxim-ic.com/en/ds/iCL7665.pdf that the warning range, in which both LEDs volts per cell. This makes for timely char- ICL7665 Truth Table SET1/SET2 0UT1/0UT2 HYST1/HYST2 USET1 > 1.3 V OUT1 = ON = LOW HYST1 = ON = HIGH USET1 < 1.3 V OUT1 = OFF = high-impedance HYST1 = OFF = high-impedance USET2> 1.3 V OUT2 = OFF = high-impedance HYST2 = ON = HIGH USET2< 1.3 V OUT2 = ON = LOW HYST2 = OFF = high-impedance Lars Kruger (Germany) Like the author you may keep some 12 V lead- acid batteries (such as the sealed gel cell type) in stock until you come to need them. A simple way of charging them is to hook up a small unregulated 15 V 'wall wart' power supply. This can easily lead to overcharging, though, because the off-load voltage is really too high. The remedy is a small but precise series regulator using just six components, which is connected directly between the power pack and the battery (see schematic) and doesn't need any heatsink. The circuit is adequatele proof against short o -X- 090014 - 11 circuits (min. 10 seconds), with a voltage drop of typically no more than 1 V across the col- lector-emitter path of the transistor. For the voltage source you can use any trans- former power supply from around 12 V to 15 V delivering a maximum of 0.5 A. By providing a heatsinkforTI and reducing the value of R1 you can also redesign the circuit for higher currents. ( 090014 - 1 ) Internet Link http://focus.ti.com/lit/ds/symlink/tl431.pdf VGA Background Lighting +5V Heino Peters (The Netherlands) More and more people are using a PC (con- output can be used to provide a matching ventional or notebook) to view films. The VGA 'Ambilight' effect for this. If you restrict your- 22 elektor - 7-8/2009 self to a single RGB LED, you can also draw the power for this circuit from the VGA con- nector, along with the RGB signals. The following pins of the 15-way VGA con- nector (three rows of five pins) are used for this circuit: Pin 1: Red video signal Pin 2: Green video signal Pin 3: Blue video signal Pin 5: GND Pin 9: +5 V The video signals for the red, green and blue channels are available at the RGB out- puts. These signals have an amplitude of 1 to 1 .35 V, and they output the screen imagery at the rate of dozens of frames per second. This produces the visible image on the screen. The circuit described here drives an RGB LED according to the average values of each of these three signals. Of course, this is not a full-fledged 'Ambilight' system, but the RGB LED will produce a nice green light during a football match or an orange hue if a sunset is shown on the screen. A sawtooth generator is built around IC1 and T1. It supplies a nice sawtooth signal to opamp IC2a via R6. The frequency of the sawtooth signal is approximately 850 Hz, and its amplitude ranges from 1.6 to 3.4 V. IC2A subtracts approximately 1.6 V from this due to voltage divider R4/R5. After this, voltage divider R10/R11 reduces the peak value of the sawtooth to around 1.35 V. The result- ing sawtooth signal is buffered by IC2b and used to drive the three comparators in IC3. The level of the red video signal is averaged by the R12/C2 network. IC3a constantly com- pares the previously generated sawtooth sig- nal with the average value of the red video signal. If the image has a high red content, the output of IC3a will be logic Low a good deal of the time, while with a low red content it will be Low less often. This comparator cir- cuit thus implements a PWM driver for the red LED. The same arrangement is used for the green and blue channels. Note that with a notebook computer you always have to enable the VGA first, usu- ally by pressing Fn-F5. If you use a desktop or tower PC, you can tap off the video sig- nals from an adapter connected between the video cable and the monitor. You can also use several LEDs or a LED strip (available from Ikea and other sources) in place of a single RGB LED. In this case you will need an external power supply for the LEDs, but the control circuit can still be pow- ered from the PC. If you use multiple LEDs or a LED strip, connect the cathodes (negative leads) of the LEDs to the comparator outputs of IC3 as shown on the schematic diagram, and connect all the anodes (positive leads) to the external power supply. Resistors R15-R17 are often already integrated in the LED strip. There's no harm in using an external supply with a higher working voltage, such as 12 V. Remember to connect the ground terminal of the external supply to the ground of the control circuit. IC3 can handle a current of 15 mA on each output. If this is not enough, swap the con- nections to the inverting and non-inverting inputs of the three comparators in IC3 and connect their outputs to the bases of three BC547 transistors. Connect a 10-kO resistor between each base and the positive supply line (+5 V). Connect the emitter of each tran- sistor to ground, and connect the collector to the LED strip. A BC547 can switch up to 100 mA with this arrangement, and a BC517 can handle up to 500 mA. ( 090080 - 1 ) Wireless S/PDIF Connection M Ton Giesberts (Elektor Labs) A question came to mind after the 'Hi-fi Wireless Head- set' article was published in the December 2008 issue of Elektor: why don't we design a wireless S/PDIF connection? This would of course have been a very useful option (the modules in question digitise an analogue signal in the transmitter, which is then converted back to analogue by the receiver). The idea is therefore to cre- ate a digital (in other words, lossless) connection between two devices. As a compro- mise we could have added an S/PDIF input to the transmitter men- tioned above. However, in that case the D/A converter in the receiver would mainly deter- mine the quality of the analogue signal, and that was something we didn't want. Amongst lots of other things, a possible solution was found on the Internet, which we wanted to try out in practice. It concerns the use of wireless audio/video modules to transfer the signal. However, no use is made of the audio section of the modules! The S/ PDIF signal is connected directly to the video input of the transmitter, without modification or any extra circuitry! At the video output of the receiver you then have a copy of the S/PDIF signal — well, that is the theory. The bandwidth of the mod- ules we used is just enough to transfer the digital signal from a CD. We tested this with a Gigavideo 30 made by Marmitek.This is a somewhat older version, and equiva- lent devices shouldn't cost much more than a few tens of pounds. To reliably transfer an S/PDIF signal from a CD player you need a bandwidth of at least 6 MHz. The minimum pulse width of an S/PDIF signal of 44.1 kHz is 177 ns. The video bandwidth of 5.5 MHz (this depends very much on the qual- ity of the modules used) seems to be suffi- cient to create a usable link. The shape of the signal at the output of the receiver no longer consists of a tidy square 7-8/2009 - elektor 23 wave, but looks more like a sine wave. This is of course the result of the limited band- width available. Everything will be fine as long as the zero crossing points (or original pulse edges) haven't shifted with respect to each other. This is because an S/PDIF receiver retrieves the clock signal from the input sig- nal with the help of a PLL circuit. Because the edges are less steep, the receiver will be more susceptible to noise and some jitter could occur. If the edges start shifting with respect to each other it is likely that the PLL can no longer cope with the signal. The quality of the connection is therefore not as good as that provided by a coaxial cable, but for those of you who don't want to lay a cable, between two floors for example, this is obvi- ously a cheap alternative! Something that should also be taken into account is that walls can significantly reduce the maximum distance between the transmitter and receiver. In our lab are two areas that are partially divided by a 1-metre (3 feet) thick brick wall. When this wall was between the transmitter and receiver the maximum range was reduced to barely two metres (6.5 ft). We decided to test the circuit with an S/PDIF signal with a sample frequency of 96 kHz (DVD with 24-bit audio). The minimum pulse width for this signal is only 81 ns. This would seem to be too short to be transferred reli- ably by the modules. The oscillogram shows the signal at the input of the transmitter (top waveform) and the output from the receiver. This shows clearly how the shorter pulses are attenuated (the bottom waveform has been delayed by about 440 ns compared with the top one). We tried adding a frequency dependent amplifier to compensate for the restricted bandwidth, but the amplitude of the atten- uated pulses could not be increased enough without affecting the phase of the pulses. We found out that the S/PDIF receiver just couldn't cope with this 'improved' signal at all. ( 081034 - 1 ) One Wire RS-232 Half Duplex Andreas Grim (Germany) Traditional RS-232 communication needs one transmit line (TXD or TX) and one receive line (RXD or RX) and a Ground return line. The setup allows a full-duplex communica- tion; however many applications are using only half-duplex transmissions, as protocols often rely on a transmit/ acknowledge scheme. R1 |— |4K7 I-i R2 r-DEOn TX a TX -o 1N4148 1N4148 RX o- RX -o GND o- GND 080705 - 1 1 With a simple circuit as shown in Fig- ure 1 this is achieved using only two wires (including Ground). This cir- cuit is designed to work with a 'real' RS-232 interface (i.e. using positive voltage for logic 0s and negative voltage for logic Is), but by revers- ing the diodes it also works on TTL based serial interfaces often used in microcontroller designs (where 0 V = logic 0; 5 V = logic 1). The cir- cuit needs no additional voltage sup- ply, no external power and no auxil- iary voltages from other RS-232 pins (RTS/CTS or DTR/DSR). Although not obvious at a first glance, the diodes and resistors form a logic AND gate equivalent to the one in Figure 2 with the output con- nected to both receiver inputs. The default (idle) output is logic 1 (nega- tive voltage) so the gate's output fol- lows the level of the active transmit- ter. The idle transmitter also provides the negative auxiliary voltage -U in Figure 2. Because both receivers are 2x 1N4148 TX1 — TX2 o D1 n R1 © -u RX1 -O RX2 -o 080705-12 RX o- TX o R2 ■GO- D1 T1 R3 1N4148 R1 ‘H4k7 |-l BC547B D2 1N4148 M W ci GND o- 10|i RX -o GND -o 080705 - 13 connected to one line, this circuit generates a local echo of the trans- mitted characters into the sender's receiver section. If this is not accept- able, a more complex circuit like the one shown in Figure 3 is needed (only one side shown). This circuit needs no additional voltage supply either. In this circuit the transmitter pulls its associated receiver to logic 1 (i.e. negative voltage) by a transis- tor (any standard NPN type) when actively sending a logic 0 (i.e. posi- tive voltage) but keeps the receiver 'open' for the other transmitter when idle (logic 1). Here a negative auxiliary voltage is necessary which is generated by D2 and Cl. Due to the start bit of serial transmissions, the transmission line is at logic 1 for at least one bit period per charac- ter. The output impedance of most common RS-232 drivers is sufficient to keep the voltage at Cl at the nec- essary level. Note: Some RS-232 converters have quite low input impedance; the val- ues shown for the resistors should work in the majority of cases, but adjustments may be necessary. In case of extremely low input imped- ance the receiving input of the sender may show large voltage vari- ations between Is and 0s. As long as the voltage is below -3V at any time these variations may be ignored. ( 080705 - 1 ) 24 elektor - 7-8/2009 ACCESSORY BOARDS DAC Board ADC Board mlkroilektronika DEVELOPMENT TOOLS | COMPILERS | BOOKS CANSPI Board Compact Flash RS485 Board 12-bit output DA converter MCP4921 with serial interface. 12-bit 4 input AD converter MCP3204 with serial interface. Board with MCP2551 CAN transceiver and MCP2515 CAN controller. Easy to connect Compact Flash Board with flat cable connector. Connect multiple devices into RS-485 network with ADM485 line transceiver. Three-Axis Accel ADXL330 is a small, thin, low power, complete 3- axis accelerometer. MMC/SD Board Easy way to use MMC/SD cards in your design, data acquisition etc... Serial 7-seg 2 MAX7219 SPI Interfaced, LED Display Drivers on- board with 8 common cat. SmartMP3 VSIOOIk MPEG audio layer 3 decoder with SPI Interface and MMC/SD Slot. EasyBee Stepper Motor Driver Connect your development board to wireless network using ZigBit Module. Add stepper motor control to your prototype device with A3967SLB. Serial Ethernet ENC28J60 Stand-Alone Ethernet Controller with SPI Interface. Port Expander Easy to connect board with MCP23S17 - 16-bit I/O expander. Digital Pot Board with MCP41010 single - channel digital potentiometer on-board. Train for the future Now you need a... ACCESSORY BOARD Accessory Boards were designed to allow students or engineers to easily exercise and explore the capabilities of the various microcontrollers with peripheral devices such as: ADC, DAC, CAN, Ethernet, IrDA, MP3, RS485 and many more. Light to Freq. Board with TSL230BR light-to-frequency converter. mikroBuffer LIN Board Board with MCP201 LIN Transceiver with voltage regulator. RFid Reader Add RFid reader to your prototype device easily. mikroDrive Potentio. Board Buffer the analog signals connected to development board inputs. Board with ULN2804 high-current Darlington arrays. Test analog inputs on your development board easily with 8 potentiometers. SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD M Bread boa rd/Perf board Combo Based on an idea from Luc Heylen (Belgium) Electronic hobbyists and engineers often use breadboards to experiment with small cir- cuits. A breadboard consists of a thick strip of plastic with an array of holes and embed- ded metal contact strips that interconnect individual rows of holes. A few long rows extending over the entire length are located along the sides; they can be used for sup- ply voltages. With this arrangement of holes and strips, you can plug all sorts of electronic components (including ICs) into the bread- board and build a circuit by interconnecting them as desired with short lengths of wire. Of course, we don't have to explain this to most of our readers, since they have probably used a breadboard occasionally. The advantage of a breadboard is that you can try out different ideas to your heart's content without having to use a soldering iron every time you make a change. It's also a lot easier to see what you're doing than when you build a circuit on a piece of perf- board, where the wiring on the copper side can quickly turn into a rat's nest that isn't so easy to sort out when you want to make changes. Of course, breadboards also have their disad- vantages. They can't be used for RF circuitry, which is something you always have to con- sider. The spring contacts also tend to wear or weaken over time, which can lead to poor connections. Despite these disadvantages, breadboards are especially convenient and affordable tools for electronic designers. If you do a lot of work with a breadboard, you are often faced with the problem that after you have managed to build and test a cir- cuit that works the way it should, you have to take it all apart and rebuild it on a piece of perfboard because the circuit has to be used somewhere right away. In such cases, leav- ing the circuit in its breadboard form is not a long-term option. The person who thought up the idea described here, who is a fervent breadboard user, encountered this problem regularly and came up with the following solution. Make a printed circuit board with the same layout, hole spacing and interconnections as a stand- ard breadboard. Secure this PCB on top of the breadboard, and then plug the components and interconnecting wires through the holes in the PCB, mounting them the same way as you would normally do with the breadboard (Photo 1). Use slightly longer component leads and wire ends than usual, due to the extra thickness of the PCB. Fit ICs in sockets with extra-long pins (wire-wrap pins). In a cir- 26 elektor - 7-8/2009 cuit built using this arrangement, the contact strips in the breadboard provide the intercon- nections, so there's no need for soldering. Once the circuit is finished and works the way it should, you don't have to rebuild it before you can use it somewhere else. Press a sponge or a bag filled with styrofoam parti- cles on top of the circuit (Photo 2) and clamp it securely in place (Photo 3). After this, you can pull the PCB with the components free from the breadboard, turn it over, and then trim all the leads protruding from the copper side and solder them in place (Photo 4). The interconnections are exactly the same as on the breadboard. To make it easy to work with this combina- tion of a breadboard and a PCB, it's a good idea to mount the breadboard on a piece of wood with four long M3 screws arranged to fit exactly through the corner holes of the printed circuit board. This way you can mount the PCB precisely and securely on top of the breadboard. For the breadboard, we used a type SD12N from Velleman [1], which is carried by a number of electronics retailers. Note that other types of breadboards may have dif- ferent dimensions or contact arrangements, which means that they cannot be used with the PCB layout shown here. ( 080937 - 1 ) Internet Link [1] www.velleman.be/nl/en/product/view/?id=40573 Download 080937-1: PCB layout (.pdf), from www.elektor. com/080937 Momentary Action with a Wireless Switch M Matthias Haselberger (Germany) Many different types of wireless switch mod- ules with a relay for switching AC power loads are commercially available. However, some applications require a short On or Off pulse, such as is provided by a momentary-action (pushbutton) switch. Here we describe a solu- tion that simulates a pushbutton switch with a standard wireless switch. A supplemen- tary circuit converts the switch module into a remotely controllable momentary-action switch. In the supplementary circuit, SI is the switch- ing contact of the relay in the wireless switch module. This contact energises a 24-V power supply connected directly to the AC power outlet, consisting of a bridge rectifier (D1-D4) with a series resistor (R1), a series capacitor (Cl), and a charging capacitor (C2). The two Zener diodes in the bridge rectifier (D1 and D2) limit the DC voltage on C2 to approxi- mately 24 V. When the wireless switch module closes con- tact SI, 24 VDC is applied to the coil of relay RE1, which closes. At the same time, capacitor C3 charges via D5. When the contact of RE1 switches, capacitor C4 provides the charg- ing current for C3. The charging current flows through the coil of RE2, which remains actuated as long as the current is sufficiently large. The current decreases as the voltage on C4 rises, with the result that RE2 drops out and the contact of RE2 (the 'momentary' con- tact) opens again. o / HO 7-8/2009 - eleklor 27 SI opens when the relay in the wireless switch module is de-energised, which causes RE1 to drop out shortly afterward and con- nect capacitor C4 to ground. The capacitor discharges through the coil of RE2, causing its 'momentary' contact to be actuated again. The timing diagram shows the switch-on and switch-off sequences of the wireless switch (SI contact). The duration of the 'button press' (engage- ment time of RE2) depends on the capacitance of C3 and C4. The equation Q = Cx U = I xt can be used to calculate suitable capacitor values for a specific hold time (^ in the tim- ing diagram) with a given relay current. The value shown in the circuit diagram (1000 pF) corresponds to a hold time of 1 second with a relay current (holding current / H ) of 10 mA: C = l H xt*\ / U = (0.01 A) x (1 s) / 10 V = 1000 pF. A reed relay cannot be used for RE2 because the voltage across the coil reverses. This Tim U t ing ON OFF b b SI +24V - ^ +24V +14V- / f ' RE2 L f i , 080912 - 12 also means that a free-wheeling diode can- not be used, but it is anyhow not necessary due to the slow discharge of C4. RE2 should be a 'Class II' relay (such as the Omron G6D- 1A-ASI 24DC) to provide adequate insula- tion of the switch contact. RE1 does not have to be a Class II relay. Due to the presence of AC power line voltage, R1 and R2 must have a rated working voltage of 250 V (150 V), although they can also be formed from two resistors with half this rated working voltage connected in series, each with half of the specified power rating. In this case, R1 con- sists of two 47 O / 1 W resistors and R2 of two 100 kQ/0.25 W resistors. Readers on 120 VAC 60 Hz power networks should change Cl into 680 nF. The circuit can be fitted in a plastic enclosure with an integrated AC power plug, which can easily be plugged into the wireless switch module. The contact of RE2 can then be fed out to a terminal strip as a floating contact. For adequate AC isolation, a safety clearance of at least 6 mm (air and creepage paths) to other conductors must be maintained, in addition to using a Class II relay. ( 08091 2 _ 1 ) Servo Scales 2 IC2 Gert Baars (The Netherlands) With a bit of adeptness, you can build an electronic scales based on a servo motor. Depending on the type of servo you use, it can measure weights of up to around five kil- ograms (11 lbs) with reasonable accuracy. If you examine the operating principle of a servo motor in more detail (Figure la), you can see that in simple terms, it consists of a control loop that uses a potentiometer to convert the motor position to a voltage that is compared to the voltage from a PWM con- verter. Based in this information, the motor is rotated so that its measured position corre- sponds to the desired position (U2 = U1). As can be seen from Figure 1 , all you need for a scales based on a servo motor is a square-wave oscillator that supplies a sig- nal at a constant frequency of around 50 Hz with a fixed duty cycle of approximately 1 0%. This defines a fixed setting for the posi- tion of the motor axle. If a mechanical force tries to rotate the motor axle in this situa- tion, the servo control loop adjusts the drive signal to the motor to counteract the rota- 28 elektor - 7-8/2009 tional force. The motor thus has to supply an opposing force, and that costs power, with the result that the current through the motor increases. With a type RS-2 servo, this current can rise to as much as 1 A, while the quiescent current is no more than a few dozen milliamperes. If you attach an arm to the motor axle and fit it with a weighing pan, and then connect an ammeter in the servo supply line, you have a sort of simple elec- tronic scales. The scales can be calibrated using a reference weight, with the length of the arm set to produce a certain amount of current with a certain weight, such as 0.5 A with 1 kg. Two kilograms would then draw 1 A, and so on. The scales can also generate a voltage out- put if you measure the voltage across a sense resistor in series with the ground lead of the servo (Figure 1c). Due to the quiescent cur- rent consumption of the servo motor with no load, this voltage is not zero with no weight on the scales, but it is low compared with the value with a certain amount of weight. Natu- rally, this offset can be compensated by using an instrumentation amplifier. This increases the accuracy, and you could even consider equipping the scales with a digital readout. Driver Free USB Richard Hoptroff (United Kingdom) USB (universal serial bus) was supposed to solve a lot of problems when connecting devices to PCs, but in many ways it's still a bit of a pain in the plughole. Typically, each new device needs a new driver to be installed. Often, a COM port then gets assigned, and you have to find out from the operating sys- tem what the COM port number is. And with some products, that COM port number can change if you plug it into a different socket! A sneaky way round the driver problem is to use the Human Interface Device (HID), as used by mice and keyboards, or the Mass Storage Device (MSD) interface, as used by flash drives. This is because just about all the flavours of Windows, Mac and Linux oper- ating systems available today have HID and MSD drivers pre-loaded. HexWax Ltd. have adopted this approach for their driver-free USB chip sets. Their USB to UART, SPI and l 2 C bridges use the HID interface and their embedded file system and data logger chips use the MSD interface. A particularly flexible friend is called 'expan- dlO-USB'. As its name suggests, it is an I/O expander with a USB interface. But that's a modest description, considering its ana- < < < < < < < < < < < < VDD IC1 RC0/AN4/C12IN+/INT0/VREF+ RST RC1/AN5/C1 2IN-/INT1 A/REF- RC2/AN6/P1 D/Cl 2IN2-/CVREF/INT2 RC3/AN7/P1 C/Cl 2IN3- RC4/P1 B/C1 20UT/SRQ RC5/CCP1/P1A/T0CKI D- RC6/AN8/SS/T1 3CKI/T1 OSCI RC7/AN9/SDO/T1 OSCO D+ EXPAND 10-USB RB4/AN10/SDI/SDA RB5/AN11/RX/DT RB6/SCK/SCL RB7/TX/CK VUSB OSCI 0SC2 VSS X 1 < C5 > C4 22 ^^ 12MHz^22p USB © © © *-© 090367-11 logue-to-digital inputs, interrupts, PWM, comparators, counters, timers, SPI, l 2 C, UNI/ O, etc. The USB interface is designed so that all the programming is done on the PC rather than on the chip, which saves a lot of devel- opment time. For example, to measure the analogue voltage on AN6, you send the fol- lowing 4-byte command from the PC (Ox pre- fix denotes hexadecimal): 0x96 0x06 0x00 0x00 Figure 2 shows a simple finished version with a PWM oscillator and analogue read- out. The two potentiometers can be used to adjust the offset and weighing range. The length of the scale arm multiplies the tor- sion on the servo motor due to the weight. Doubling the arm length reduces the weigh- ing range by half and thus doubles the accu- racy, but it also increases the zero offset due to the weight of the arm. In practice, an arm length of around 10 cm proved to be a good compromise. ( 090086 - 1 ) M The chip takes the measurement and reports the result as a 4-byte response: 0x96 0x06 0x02 0x36. In this example, the voltage measured is 5 V x 0x0236 -r 0x03FF = 2.76 volts. Similarly, the following command exchanges three bytes with a slave SPI device: OxAF 0x03 0x45 0x67 0x00. Command: Send 0x45 0x67 0x00 to slave. OxAF 0x03 0x00 0x00 0x89. Response: Slave sent 0x00 0x00 0x89. The commands are sent using the operating system's HID interface, which is very similar to reading and writing to a file. Example source code is provided at [1]. In the basic circuit of the driver, Figure 1, only a crystal and filter capacitors are required in addition to the 'expandlO-USB' chip also described in some detail at [1]. Although it is available as a through-hole device, the surface mount version has the 7-8/2009 - elektor 29 advantage that it is small enough for 'don- gle'-style applications as shown in Figure 2. Surface mount USB plugs can be quite dif- ficult to source, but an elegant, zero-cost solution exists. You can design one into the printed circuit board itself, so long as you don't mind a PCB 2.0-2.20 mm thick includ- ing tracks (arrow 'A' in Figure 2) for the dimensions. For best reliability, the PCB con- tacts ('B') should be plated with hard gold flash (0.25-1.27 pm) over nickel (2.6-5.0 pm). Finally, shoulders ('C') are required to pre- vent over-insertion force. The overall PCB width should be 16.00 mm or less. ( 090367 - 1 ) Web Link [1] www.hexwax.com Lighting Up Model Aircraft Werner Ludwig (Germany) This circuit provides aircraft mod- ellers with extremely realistic bea- con and marker lights at minimum outlay. The project's Strobe out- put (A) provides four brief pulses repeated periodically for the wing (white strobe) lights. In addi- tion the Beacon output (B) gives a double pulse to drive a red LED for indicating the aircraft's active operational status. On the proto- type this is usually a red rotating beacon known as an Anti-Collision Light (ACL). The circuit is equally useful for road vehicle modellers, who can use it to flash headlights and blue emergency lights. All signals are generated by a 4060 14-stage binary counter and some minimal output selection logic. Cycle time is determined by the way the internal oscillator is con- figured (resistor and capacitor on pins 9/10) and can be varied within quite broad limits. High-efficiency LEDs are your first choice for the indicators connected to the Bea- con and Strobe outputs (remem- ber to fit series resistors appropri- ate to the operating voltage Ub and the current specified for the LED used). The sample circuit is for operating voltages between 5 and 12 V. Cur- rent flow through the two BS1 70 FET devices must not exceed 500 mA. ( 090036 - 1 ) LED Bicycle Lights BT1 5 6V LI* m rrm « 220u D1 7N4148 Cl IOOuF 25 V D2 7N4148 R1 C2 2u2 63V T2 BC337 Lf C3 HH- 1N4148 T1 P * D5 22 V DO ~ 1W3 NTD4815N Ik D3 1N4148 R3* 12R I • • I C4 lOu 63V D6 D7 "" NTD4815N ii R4 080702 - 11 Ian Field (United Kingdom) Before getting started an acknowledgement is due, the circuit presented here uses an ingenious method of controlling a flyback converter by the voltage developed on a cur- rent sensing resistor, this was published by Andrew Armstrong in the July 1992 issue of ETI magazine. The reworked circuit is quite simple. At the instant that power is applied only a small cur- rent flows to charge C4 so insufficient voltage is developed on R3 to switch T2 on. Also, D1 allows C2 to charge from the 6 V battery, so R1 feeds enough voltage to switch on T1 — this shunts the voltage across LI and the cur- rent in it starts to rise. At a certain point the current which returns via R3 will develop suf- ficient voltage to switch on T2 which shunts the gate voltage to T1 causing it to switch off, initiating the flyback voltage from LI . The fly- back pulse forces a current around the circuit, charging C4 and feeding the LEDs. As the return current is via the current sensing resis- tor R3, this keeps T2 turned on and T1 turned off, so the flyback phase is not clamped until it has given up all its energy. Capacitor C3 provides positive feedback to ensure reli- able oscillation and sharpen up the switch- ing edges. Components D1, D2 & C2 form a bootstrap boost circuit for the MOSFET gate, although it is logic level it only guarantees the stated fl D _ S(on) at a V g level of about 8 V — by happy coincidence the combined l/ f of 30 elektor - 7-8/2009 four ultrabright red LEDs is about 8.8 V and this is the value that the output is normally clamped to. There are some notes on the components specified. For position T1 an n-channel MOS- FET with a very low R D _ S(on) of 15 mO (at 10 V) Is suggested, although its high l D rating (35 A) is not strictly necessary. Purists may wish to use Schottky barrier diodes for D2 and D4, but a quick look at the data sheet for the popular BAT85 shows that with a T rr of 4 ns it is not actually any faster than the 1 N4148. It is doubtful whether the lower V f would make any noticeable difference. Zener diode D5 has been included as a safety measure in case the output should ever find itself open circuit. The flyback converter can develop a quite impressive voltage when run without load and would have no diffi- culty damaging the MOSFET. If a higher volt- age MOSFET is used then C4 could easily fall prey to excessive voltage if the lead to the LED breaks. In the final working prototype D5 was a 1.3-watt 22-volt zener, but any value between 18 and 24 V is fine. Bear in mind that with four white LEDs on the output the volt- age will be somewhere in the region of 13 V. LI is a 9 mm diameter 0.56 A 220 pH inductor with a low DC resistance (Farnell # 8094837); don't even think about using those small axial lead inductors disguised as resistors — even the fat ones last only a few seconds before failing with shorted turns. On R3, this resistor is selected depending on the configuration of LEDs. A value of 20 mA is fairly typical for 5 mm LEDs, on this basis four red LEDs will need about 12 O; five red LEDs about 10 O, and four white LEDs about 6.8 O. Resistor R4 (1 O 1%) is provided to use as a temporary connection for the LEDs' neg- ative lead so the volt drop can be measured to indicate the current flowing during setting the correct LED current by adjusting R3. The efficiency of the circuit depends on the LED current, which also determines to some extent the switching frequency. At 10 mA (4 white LEDs) 170 kHz was measured on the prototype — and that's about the maximum normal electrolytic capacitors are able to withstand. If more current is drawn (e.g. three white LEDs at 30 mA) then the switching fre- quency drops to about 130 kHz and the effi- ciency rises to around 75%. The circuit is simple enough to construct on stripboard, which can be built as a single or double unit to suit whatever lamp housings are ready to hand. The double unit should fit comfortably in a 2x D cell compartment and the single board is only a whisker bigger than a single C cell. Suggested lamp housings are the Ever Ready and the Ultralight but there should be many others that can be modified to house the stripboard. In many cases the hole for the bulb will need 4 notches cut with a round file so that the LEDs can be pushed far enough through. These can be secured in place with a spot of hot melt glue. The battery and switch box can be surpris- ingly challenging, the unit built for a fam- ily member went on a bicycle with a wire basket so it was easy to bolt a Maplin ABS project box to that. With only the tubular frame to fix things onto, it's not so easy. The authors' battery box for the present project is an old Halfords lamp — the one that drops into a U shaped plastic clip that does noth- ing to deter thieves, but it's far more secure when cut down to make a battery box and clamped to the handlebar with a jubilee clip. It easily holds a 6 V 1 .3 Ah SLA battery from Maplin but any nominal 6 V type can be used as per individual preference. Deep discharg- ing should be prevented. Please Note. Bicycle lighting is subject to legal restrictions, traffic laws and, addition- ally in some countries, type approval. ( 080702 - 1 ) Remote Washing Machine Alert Gotz Ringmann (Germany) It is often the case these days that the washing machine and tumble dryer are installed in an outbuilding or corner of a garage. This not only makes the kitchen a much quieter place but also leaves room for a dish washer and gives additional cupboard space. The prob- lem now is how to tell when the wash cycle is finished. In bad weather you don't want to make too many fruitless trips down the garden path just to check if the wash cycle is finished. The author was faced with this problem when he remembered a spare wireless door chime he had. With a few additional components and a phototransistor to passively detect when the washing machine's 'end' LED comes on, the problem was solved. Cl smoothes out any fluctuations in the LED light output (they are often driven by a mul- tiplex signal) producing a more stable DC voltage to inputs 2 and 6 of IC1. The circuit is battery powered so the CMOS version of the familiar 555 timer is used for IC1 and IC2. The output of IC1 (pin 3) keeps IC2 reset (pin 4) held Low while there is no light falling on T1. When the wash cycle is finished the LED lights, causing T1 to conduct and the voltage on Cl starts to fall. Changing the value of R1 will increase sensitivity if the LED is not bright enough. When the voltage on Cl falls below 1/3 of the supply volt- age IC1 switches its output (pin 3) High, removing the reset from IC2. T2 conducts and LED D1 is now lit, sup- plying current to charge C2. When the voltage across C2 reaches 2/3 supply IC2 switches its output Low and C2 is now discharged by pin 7 via R3. The discharge time is roughly one minute before the transistor is again switched on. The proc- ess repeats as long as light is falling on T1. Transistor T2 is a general-purpose small sig- nal NPN type. The open collector output is wired directly in parallel with the bell push (which still functions if the transistor is not switched on). Ensure that transistor output is wired to the correct bell push terminal (not 7-8/2009 - elektor 31 the side connected to the negative battery terminal). Each timer consumes about 60 pA quiescent and the circuit can be powered from the Freezer Trick Reuben Posthuma (New Zealand) There are a number of explanations to why putting devices in the freezer often repairs them. Firstly, cooling PCBs down to minus 20 degrees Celsius or so can often repair dry joints, because of the effects of expan- sion/contraction due to temperature change. Although the wholesome effect of a night in the freezer may be temporary, it may help you track down rare or otherwise elusive errors in circuits. Secondly, with rechargeable batteries on boards, the cold temperatures basically cause the cell(s) to do a complete discharge cycle, LEDify It! Mobile 3-watt LED Lamp Jurgen Stannieder (Germany) A traditional hand-held torch could hardly be described as a cutting-edge piece of tech- nology; in fact it's probably the exact oppo- site, circuits don't come much simpler! Text books have for years used a battery, light bulb and switch to describe just what a circuit is. We are also aware of the shortcom- ings of the filament lamp; the light dims as the battery dis- charges and occasionally you need to replace a burned- out bulb. Why not treat an old torch to a 21st century make-over? Replace the bulb with more efficient LEDs, the 5 mm 70 mW types will not be very illuminating but 1-watt white LEDs are now reasona- bly priced. It's not quite as simple as removing the bulb and replac- ing it with an LED. Unlike a fila- transmitter battery. Alternatively a 9 V bat- tery can be substituted; it has much greater capacity than the original mini 12 V battery fitted in the bell push. Before you start construction, check the which effectively resets corrupted memory by causing a complete 'factory' reset to be performed. Features • Three 1 W LEDs powered from 4.8 V • Efficiency > 80 % • Light output independent of battery voltage • Battery deep-discharge protection range of the wireless doorbell to make sure the signal reaches from the washing machine to wherever the bell will be fitted. ( 081156 ) K Thirdly, the low temperatures can (sort of) rejuvenate the chemicals in the battery, which results in a 'good as new' battery! Although any or all of the above explana- tions may be refuted scientifically, the 'he who dares, wins' approach prevails. In other words, no harm in giving it a try. Be sure to use good quality plastic bags to securely package circuit boards, components or bat- teries before putting them into the freezer. This will eliminate any risk of contaminating foodstuffs. ( 090205 ) M ment bulb an LED exhibits differential resist- ance i.e. its resistance depends on the applied voltage. It is necessary to supply it with a con- stant current. This can be achieved (approxi- mately) by using a series resistor but power loss in the resistor reduces efficiency. Also, light output will decrease as the battery volt- age sinks. The LEDify design solves both these problems: firstly, a switching regulator reduces losses and maintains a constant light output as the battery voltage falls. Secondly, an adjustable constant current source maintains stable oper- ating conditions for the LEDs. The LM2577T-ADJ step-up voltage regulator [1] forms the centre point of the design. Together with coil LI and the flywheel diode D1 it boosts the input voltage from 4.8 V up to 10 to 12 V. The 4.8 V input is provided by four NiMH rechargeable batteries connected in series while the 10 to 12 V output is used to power three series connected white LEDs. One half of the 32 elektor - 7-8/2009 C4 lOOn C5 470u 16V C6 470u 16V 100k fi 2VmW5 25V dual op amp IC2 forms an adjustable current source while the other half switches the light off when the supply voltage sinks too low to avoid discharging the cells too much. IC2A is configured to generate a constant current. Zener D2 supplies a reference 2.7 V at its cathode which is divided by the R9/P3 network to supply an adjustable voltage of 0 to 128 mV to the non-inverting input of IC2A. IC2A controls T1 so that the voltage at its inverting input, produced by the volt- age drop across the resistors R12 to R15, is the same as at its non-inverting input. The adjustment range of P3 produces a current of between 0 and almost 0.5 A through the 0.25 O resistor formed by the four parallel 1 Q resistors. The typical operating current of a 1- watt LED is around 350 mA, this produces a voltage of 88 mV across the four parallel resis- tors. With the LM358 even with the input at zero there will be an output voltage of 0.6 V so with P3 at a minimum a few milliamps will still be flowing through the LEDs. The LEDs are turned off when the battery voltage falls too low, IC2B comparing a pro- portion of the battery voltage via P2 with the reference voltage on D2. If the battery voltage is below the reference voltage the output of IC2B will go high and the current source IC2A will be switched off. The circuit still draws a few milliamps when under-volt- age is triggered so a good lower threshold to set is around 1 V per cell. With four cells P2 should be adjusted so that the LEDs switch off when the battery voltage falls below 4 V. The adjustment range on P2 produces a voltage of around 3 V to over 10 V. Although four cells are shown in the diagram the cir- cuit can accommodate anything from three to six. Do not use more than six cells when driving three LEDs in series, the input volt- age would produce excessive dissipation in IC1 which can result in the battery voltage being applied directly to LI and D1. The volt- age step-up function of IC1 ensures that the cathode of D1 is at a higher voltage than the anode so D1 is not conducting. When the 1C output switches, energy stored in LI is con- verted into a higher voltage but lower cur- rent passing through D1 and then stored on capacitors C5 and C6. The 52 kHz switching frequency gives a stable output voltage with very little ripple. IC1 reads the feedback voltage measured at pin 2 and compares it with a reference COMPONENT LIST Resistors R1,R3 = 2kQ2 R2 = 22kQ R4,R5,R6 = IkQ R7,R9 = lOOkQ R8 = 3MQ9 R10 = 4kQ7 R11 =5600 R12,R13,R14,R15 = IQ P1,P2 = 10kQ preset, miniature, horizontal P3 = 5kQ preset, miniature, horizontal Capacitors Cl = 330nF MKT lead pitch 5mm or 7.5mm C2 = 47pF 25V radial, lead pitch 2.5mm, 0 max. 8.5mm C3,C4,C9 = lOOnF ceramic, lead pitch 5mm C5,C6 = 470pF 16V radial, lead pitch 2.5mm, 0 max. 8.5 mm C7 = lOpF 63V radial, lead pitch 2.5mm, 0 max. 6.5 mm C8 = lOOpF ceramic, lead pitch 5mm Inductor LI = lOOpH axial, upright mounting, suggested types: 5800-101 (Bourns) rated 0.63A/0.2Q (Digi- Key # M8290-ND), B82111EC25 (Epcos) rated at 1A/0.65Q (Farnell # 9752102) or MESC-101 (Fastron) rated at 1A/0.65 Q (Reichelt # MESC lOOp) Semiconductors D1 = 1N5822 D2 = 2V7 0W5 zener diode D3 = 1N4148 T1 = BD139 IC1 = LM2577T-ADJ (TO-220-5 case, straight pins) IC2 = LM358 (DIP-8) Miscellaneous K1,S1,BT1 = 2-way PCB terminal block, lead pitch 5mm SI = single-pole on/off switch BT1 = holder for 4 NiMH batteries* 3 pcs 1-watt power LED PCB #080585-1 * see text 7-8/2009 - elektor 33 of 1.23 V. It adjusts the peak switch current accordingly to maintain a constant output voltage. The divider chain formed by R2, R3 and PI allow the output voltage to be var- ied between 3.5 V and 19 V. A typical 1 W LED has a forward voltage drop of around 3.25 V. Three LEDs in series gives 9.75 V, when the voltage drop across T1 and R12 to R15 are added to this we get 10 V. The adjustment range of PI is sufficient to cater for LEDs with a forward voltage drop of up to 4.0 V. In the Elektor lab we measured a supply cur- rent of 0.87 A from the 4.8 V battery pack giving a current through the LEDs of 0.35 A. Using 2000 mAh rechargeables you can expect a full battery pack to last for more than two hours. The circuit efficiency is over 82 % with a 4.8 V battery pack and around 89 % with a 5.6 V battery. The set up procedure for the completed cir- cuit is simple. Using an adjustable power supply set the output voltage to 4.8 V. Con- nect three LEDs in series to the anode and cathode (A, K) contacts of K1 and adjust PI so that the voltage measured between the A connection of K1 and ground is 12 V. Now set the current by adjusting P3 until 88 mV is measured across resistors R12 to R15.To oper- ate the circuit at optimum efficiency reduce the 12 V supply by adjusting PI, check that a constant 88 mV is maintained across R12 to R15, if it starts to fall then you have set PI too low. Lastly adjust P2 so that the LEDs turn off when the supply drops below 4 V. Should the LEDs not light at all check that P2 has not been set too high. ( 080585 - 1 ) Internet Links [1] www.national.com/mpf/LM/LM2577.html [2] www.elektor.com/080585 Download PCB 080585-1 PCB design (pdf) from www.elektor. com/080585 Annoy-a-Tron Tolunay Giil (The Netherlands) The idea for this circuit came from the website www.think- geek.com [1]. The author thought that it could be made better and simpler. A search on the Internet didn't get any results so the next logical step was to design some- thing himself. With the help of a small AVR microcontroller from the spares box and a buzzer the experimenting could begin. The circuit consists of little more than the AVR micro, a buzzer and an ISP header to program the code into the microcontrol- ler. Apart from two resistors, a jumper to select the mode and an on/off switch, the circuit just needs a battery. The author used an old battery from a Nokia mobile phone because it had a large capacity, but was still fairly small. In principle a small but- ton cell and a holder will suffice as well, and possibly even some solar cells from an old calculator could work. The mode switch is used to choose between normal mode and a test mode. In the latter mode the Annoy-a-Tron will beep constantly. In normal mode the tone generator creates irritat- ing beeps with a random pause of 10 to 500 seconds between successive beeps. the code starts with a regfile that states which AVR is used. This is followed by the Xtal/internal oscillator choice. Next come the software and hardware stack, the frame size and the config- uration settings. First portb.3 is configured as an output and given the name 'speaker'. Then the variable 'seconds' is defined as a 'word' type. When the AVR is turned on it first comes to an endless loop. In this it checks if the mode jumper is in place or not. If it's not in place (a logic '1' caused by the pull-up resistor) the micro jumps to subl. Here it comes to an endless loop again. Within this loop it creates a constant beeping noise. When the mode jumper is put in place and the power is removed from the circuit and then reap- plied (a reset), the controller once more comes to an endless loop. However, this time it sees a '0' because the jumper pulls the I/O pin to a low level. This causes the program to jump to sub2. This is again an endless loop, which immediately gen- erates a beep. It then generates a random number from 0 to 50, adds one to it and stores it in the variable 'seconds'. The number in 'seconds' is then multiplied The controller obviously needs a program by 10 to obtain a longer pause before the written for it. As is usual for BASCOM-AVR next beep. The program then waits for the jpi ici 8 © PB5/RST/ADC0 PB1/AIN1/CC0B/INT PB4/ADC2 PB0/AIN0/OC0A PB3/CLKI/ADC3 PB2/ADC1/T0 MODE ATTINY13 BZ1 090084 - 1 1 34 elektor - 7-8/2009 required number of seconds before jumping back to the beginning of the loop. The circuit can be easily built on a piece of stripboard. Alternatively, an SMD board could be designed, which means that the resulting circuit could be made very small. The soft- ware can be downloaded from the Elektor website [2]. ( 090084 ) Internet Links [1] www.thinkgeek.com/gadgets/electronic/8c52 [2] www.elektor.com/090084 Download 090084-11: source code and hex files, from [2] Simple Wireless and Wired M Emergency Stop System Jacquelin K. Stroble (USA) This circuit allows a cheap or dis- carded wireless doorbell set (i.e. transmitter and receiver unit) to be used as a remote emergency stop on a high-power electrical motor or motor controller system. When the button on the wireless doorbell unit is pressed, the resul- ting 0 V signal from the receiver unit ('motor E-Stop') causes PNP transistor T1 to be turned on. Via transistor T2, latching relay Rel then changes state. The same is achieved when the wired Motor E-Stop button, SI, is pressed. The reset button, S2, must be pressed to reverse the state of the latching relay. The choice of T1 and T2 is not cri- tical — they are general purpose, low voltage PNP and NPN switching transistors respectively, for which many equivalents exist. As an EMC precaution, small capaci- tors (100 pF) are fitted across base resi- stors R1 and R2, preventing the motor from being shut down by external electrical noise and interference. The set and reset coils of the latching relay each have a flyback diode to prevent back-emf peaks damaging T1 andT2. The contacts of the latching relay can be used to switch a more powerful relay, or a motor driver. ( 090148 - 1 ) Desulphater for Car Batteries M Christian Tavernier (France) Even if you take great care of your car or motorbike battery, you're bound to have noticed that its life is considerably shorter than the high purchase price and sales pitch probably led you to expect. Of course there are several reasons for this, and high on the list is the phenomenon of slow but inevitable sulphating of the plates. To understand prop- erly what this involves, we need to look at a bit of chemistry. A lead/acid battery exploits a chemical reaction which is written as follows, when discharging: Pb + 2H2S04 + Pb02 — > PbS04 + 2H20 + PbS04 This indicates that, in contact with sulphu- ric acid, the porous lead of one plate and the porous lead dioxide of the other are both converted into lead sulphate and water. Dur- ing charging, the following reverse chemical reaction occurs: PbS0 4 + 2H 2 0 + PbS0 4 — > Pb + 2H 2 S0 4 + Pb0 2 This time, the electric current being passed converts the lead sulphate and water into lead, lead dioxide, and sulphuric acid. In the- ory, the reaction is totally reversible, which is why a battery can be charged and discharged a great many times. Unfortunately, with the passing of time and successive charge/discharge cycles, the sec- ond reaction, i.e. the one that converts the lead sulphate back into lead, becomes incom- plete, and leaves some lead sulphate on the surface of the battery plates. As this is a poor conductor, it tends to get thicker in places where it has started to collect, and unfortu- nately this phenomenon of sulphating, for that's what it's called, is cumulative and gets worse and worse as time goes by. Once a battery has got badly sulphated beyond a certain point, no standard charging process is able to recover it. What happens is that, because the lead sulphate Is a poor conductor, the battery's Internal resistance Increases, which In turn reduces the charging current, and thereby the effectiveness of the 7-8/2009 - elektor 35 charging chemical reaction; this in turn leaves even more lead sulphate on the plates... and so it goes on, in a vicious circle. There is a chemical process that makes it possible to eliminate the lead sulphate from a battery before it's too late, but it's a tricky opera- tion and uses highly corrosive chemicals that are danger- ous to handle. What's more, many of the batteries sold these days are sealed and so it's impossible to gain access to their electrolyte without damaging them. The project we're suggest- ing here lets you desulphate your battery electronically — and the sooner you start doing it, the more effective the process will be. It is based on research carried out in the United States, which showed conclusively that if you apply short, high-amplitude pulses to the battery, the resulting ionic agita- tion produced at the battery electrodes gradually breaks up the lead sulphate crystals. Even if you're a bit sceptical about the effectiveness of this process, you can try it out for yourself without any great financial risk, as the circuit required is simple and cheap. Nothing ventured, nothing gained! The circuit used is very similar to the one currently to be found in the United States, where this type of desulphat- ing process is popular as well as wide- spread. Apart from a few details, it's pretty much like a 'boost' type switch- mode power supply unit (SMPSU) — i.e. one that steps up the input voltage. IC1 is wired as an astable multivibrator running at a frequency of the order of a kilohertz and generates very short mark/space (on/off) ratio pulses at its output. When T1 is turned off by the level of these pulses, capacitor C5 is able to charge up to the battery voltage through inductor L2. When T1 turns back on again, which happens for only a very short time, given the mark/ space ratio of the pulses, capacitor C5 dis- charges abruptly via T1 and LI. When T1 then turns off again, the inductor LI means that the discharge current can't stop instantly. So it is obliged to pass through the battery via diode D2. With a high-quality capacitor for C5 (mean- ing a device with a low ESR) and a short con- nection in heavy-gauge wire from the circuit, we can push a peak current of some 5 to 10 A through the battery. Despite this, the power consumption of the circuit is still fairly low, of the order of 40 mA, because of the very low +12V dally if you use the printed cir- cuit board design suggested [1], but for optimum perform- ance, you do need to pay care- ful attention in choosing the components. The inductors used must not be changed. They are available, for example, from Radiospares (RS Components) as part numbers 228-422 (LI) and 334-9207 (L2). Diode D2 is a readily-available type and should only be replaced if this is unavoidable, and then only by an ultra-fast device. Capac- itor C5 must be a low series resistance type, such as those intended for switch-mode power supplies. As can be mark/space ratio of the signals produced. seen from the component overlay of the PCB designed by Elektor Labs, T1 and D2 are fit- Construction shouldn't be any problem, espe- ted with small U-shaped heatsinks designed to take TO-220 packages. It is advisable to install the circuit into an earthed metal case, as it generates quite severe electromagnetic interfer- ence that it's best not to allow to radi- ate out as it is likely to upset the oper- ation of other equipment. EMC regu- lations and recommendations apply here. The battery connection must be made using short wires, of at least 2.5- 3.0 mm 2 gauge (AWG # 12-13), securely connected to the battery terminals, since for the process to be effective, it's important to minimise any series resist- ance between the circuit and the bat- tery. If necessary, it can be left perma- nently connected. Some writers and pundits advise connecting a charger (even a low output one) to the bat- tery at the same time, to avoid the circuit's discharging the battery in the long term. But we would not recommend doing so, since the charger's relatively low output impedance distorts the pulses produced by the circuit and hence diminishes its effectiveness. Cautionary advice. If you use this des- ulphater directly on your vehicle battery, remember to disconnect at least one of the connections to the battery, as the parallel impedance of the many devices that stay per- manently powered in modern cars once again diminish the effectiveness of the system. ( 081175 - 1 ) Internet Link [1] www.elektor.com/081175 COMPONENT LIST Resistors R1 = 470kQ R2 = 22kQ R3 = 330Q R4 = 220Q Capacitors Cl = lOOpF 25 V C2 = lOOnF C3 = 2nF2 C4 = 47nF C5 = lOOpF 25 V, low ESR Semiconductors D1 = 15 V 0.4 W zener diode D2 = BYW29-100 IC1 = NE555 T1 = IRF9540 Inductors LI = 220pF 3.5A LI = ImH 1A Download 081175-1: PCB layout (.pdf), from [1] 36 elektor - 7-8/2009 FEATURES FT2232H/FT4232H USB 2.0 Hi-Speed Interface ICs and Evaluation Modules FT2232H (Dual Hi-Speed USB to Multipurpose UART/ FIFO 1C) has 4k bytes Tx and Rx data buffers per interface. FT4232H (Quad Hi-Speed USB to Multipurpose UART/MPSSE 1C) has 2k bytes Tx and Rx buffers. Multi-Protocol Synchronous Serial Engines (MPSSE), capable of speeds up to 30Mbits/s, provide flexible interface configurations. Entire USB protocol on a chip with integrated LDO regulator and PLL. Extended temperature range (-40°C to +85°C). Future Technology Devices International Ltd. Unit 1, 2 Seaward Place Tel: +44 (0) 141 429 2777 Centurion Business Park Fax: +44 (0) 141 429 2758 Glasgow, G41 1HH, UK E-Mail (Sales): sales1@ftdichip.com Web Shop: http://apple.clickandbuild.com/cnb/shop/ftdichip Now available to order at www.ftdichip.com Stereo Widening Huub Smits (The Netherlands) Although the principle is quite old, 'widening' of the sound image is still done these days in many portable devices, ghettoblasters and PC loudspeakers, even though it is usually called something else in these applications. To generate the stereo image, the left channel also contains part of the sound from the right channel, shifted a little in phase compared to the right channel. The same is true for the right channel, where the signal from the left 38 elektor - 7-8/2009 channel is slightly shifted in phase. To make the stereo image 'wider', you can amplify the difference signals of both channels. To do this you generate a sum- and a dif- ference signal from the left and right chan- nels. With a couple of opamps you can real- ise a 'left+right' signal and a 'left-right' signal. So the (left-right) signal needs to be made stronger with respect to the (left+right) sig- nal. Expressed as a formula: (L+R) + (L-R) = 2L and (L+R) - (L-R) = 2R With a suitable circuit, the left signal in the left channel is increased and the right signal is decreased. Similarly, in the right channel the right signal is increased if the left signal reduces. To maintain a constant volume, we also have to make sure that the total signal strength remains the same. From the schematic you can see how this problem was solved. IC1 and IC2 are the input buffers. After the buffer, the left and right signals are combined with the other channel respectively. IC3 generates the (L-R) signal and IC4 the (L+R) signal. With two times six resistors and a multi-posi- tion switch, the amount of the effect can be adjusted. The values of resistors R7-R12 and R14-R21 are selected such that the total volume remains about the same when changing the switch. IC5 and IC6 generate the final left and right signal from the (L+R) and (L-R) signals. For additional protection, electrolytic coupling capacitors of 10 pF 16 V can be added to the inputs and outputs. Each of the inputs of IC1 and IC2 will then also need a 10 kO resistor to ground, otherwise the opamp outputs will run up against power supply rail. The power supply requires a symmetrical voltage of ±12 V. This voltage can usually be found in an existing amplifier, so normally there is no need to build a special power supply. ( 090174 - 1 ) SMD Transistor Tester Ludwig Libertin (Austria) The article 'SMD Soldering Aid' by Gert Baars in the December 2005 issue of Elektor [1] was the original inspiration for a truly 'electrome- chanical' version of this design for a transis- tor tester for SMD transistors in SOT23 case outline. However, Gert's strip metal construc- tion method was not chosen and instead an alternative design was created out of strips of soldered PCB material. Glassfibre epoxy resin PCB material cannot compare with strip metal for springiness so the spring from a dis- carded ballpoint pen was used, which pro- vides adequate clamping pressure. The key advantage of this choice of materials is that the TUT (transistor under test) is pressed hard onto three PCB tracks that lead directly to sockets into which a conventional transistor tester can be plugged. It really is this simple (without any soldering) to check whether the TUT is flaky or worth keeping for reuse. The actual procedure for using this SMD tran- sistor tester is no different from checking out transistors that have wire leads. In most cases all you are interested in is whether the TUT is dead or alive and also if it is of the NPN or PNP variety. This much you can discover with- out the need to hook up an external transis- tor (and the extra bother). No sooner said than done. The result is a project that's equally useful as a simple 'test connector' hook-up for the TUT and as a sim- ple transistor tester. The very minimalist cir- cuit consists of a CD4049 (CMOS HEX inverter/ buffer) and a few additional components — naturally all in SMD form factor. IC1.D and IC1. C together with R1 and Cl form a squarewave generator with a frequency of around 2 Hz. This drives inverters IC1.A and IC1.F (con- nected in parallel for higher output current), Features • Standalone SMD transistor tester • Identifies defective transistors • Distinguishes NPN from PNP which in turn feed IC1.B and IC1.E. If no tran- sistor under test is connected, LEDs D1 and D2 will both flash together in anti-phase and half the operating voltage will be present at base connection B. Now insert a transistor in the test device: 7-8/2009 - elektor 39 both LEDs flashing indicate an open circuit, in other words the transistor is defective. An internal short circuit (connection between C and E) is indicated by the two LEDs glowing dimly. A functional NPN transistor conducts only when the voltage on C is higher than on E. LED D1 Is now short-circuited and only D2 flashes. In similar fashion only D1 flashes for a PNP device. The circuit draws only 10 mA or so and using pushbutton SI for opera- tion means that the battery will have a very long life. The type GP23A 12 V battery is an inte- gral part of the mechanical structure and is clamped between the upper and lower printed circuit boards. A small section sawn from a piece of plastic pipe is used as a de facto battery clip glues to the vertical printed circuit board improves stability ( 2 ). The nail- like metal pin is passed through a small ring of brass soldered to the upper PCB. To sim- plify the task of replicating the PCBs the author has made the layout files of the three small PCBs available on the article's web page [2]. To use these you will not need the full ver- sion of the Sprint-Layout software, as you can open the files just as well with the free Viewer programme [3]. ( 060267 ) Internet Links [1] www.elektor.com/magazines/2005/december/ smd-soldering-aid. 57995. lynkx [2] www.elektor.com/060267 [3] www.abacom-online.de/html/dateien/demos/ splan-viewer60.exe COMPONENT LIST Resistors R1 = 1MQ R2 = 1 kQ R3, R4 = 10kQ Capacitors Cl = 220nF C2 = lOOnF Semiconductors D1, D2 = LED, 3 mm D3, D4 = BAS32 IC1 =4049 (S0 16) C*) 0 1 k\\ Miscellaneous SI = pushbutton, push to m C •- [#* * «p i - -i i make ~ o m [Ml 12 V battery GP23A i 1 J 1 Mechanical parts as described tk L « J g p PCBs (see text) * C E B TL431 Multivibrator Gilles Clement (France) Oscillators have a certain appeal to electron- ics enthusiasts. They're rather 'alive' because there's something 'beating' inside them, isn't there? Here the TL431 'super zener', an easily- sourced standard device, is made to oscillate. It's a 3-pin 1C: cathode, anode, and ref. input. An op amp compares V ref with an internal 2.5 V reference and drives a bipolar transis- tor that 'shorts' the cathode to the anode. So the cathode voltage V k has two stable states: >4 = Supply if ^ref < 2.5 V and l/ k = 2 V (the l/ ce of the transistor) if l/ ref > 2.5 V. A bit like a transistor that works with voltage instead of current, so with a little effort it should t ! El I I I I dV: 0 00V |4.81 ) (-0. 1 9) dt 0. 09m? 1 /dt 1.01 kHz 40 elektor - 7-8/2009 be possible to force it to oscillate between these two states. If twoTL431s are wired as an astable multivi- brator you'll find that it works! But actually, it ought not to, since the op amp's V+ input is unable to sink the capacitor charging current! So, how does it work then? In fact, the current passes via a stray internal diode between V ref and the cathode (which is certainly noted on some data sheets like [1], but not on all of them). This was checked using the excellent (and free) LTspice simulator [2]. The frequency is defined by R and C (and of course the sup- ply voltage). It gives a very good squarewave (see scope trace) up to around 50 kHz. The signal is much better than using bipolar tran- sistors. However, the low voltage stays at 2 V, but this can be solved by using a FET on the output, or by using similar ICs with lower ref- erence voltages like for example the TLV431 (threshold 1 .24 V) or the ZXRE060 (threshold 0.6 V). The 10 pF capacitor C3 is only there to make the LTspice simulation start up correctly; it's not needed in the real circuit, which makes use of natural asymmetries. The author's LTspice model is available for free download from [3]. ( 081167 - 1 ) Internet Links [1] www.datasheetcatalog.org/datasheet/calogic/ TL431.PDF [2] www.linear.com/designtools/software/#Spice [3] www.elektor.com/081167 S-video Converter Christian Tavernier (France) With the astonishingly rapid growth in the market for flat-screen TVs and hig h-defini- tion TV, many CRT television sets have been consigned to the attic, even though many of them were still working perfectly and could have been used as spare sets in a bedroom or video signal into a composite signal and so will perhaps enable you to give a new lease of life to your old CRT television. The principle of S-video is very simple, as it merely consists of carrying the chromi- nance and luminance information, which form the basis of all colour video signals, ici another room, for example. Although all cur- rent flat-screen receivers have very compre- hensive facilities and include digital inputs via DVI or HDMI connectors and analogue inputs in S-video format, this was unfortunately not the case with the CRT televisions that were being sold only a few short years ago, which were more often than not fitted with only composite video inputs, either directly or via their SCART socket. The converter we are suggesting building, very simple since it only uses two transistor, lets you convert any S- over separate channels. In composite video, by contrast, both these signals are com- bined over a single path, and the resulting inevitable interferences between them degrade the appearance of the image being reproduced. Fortunately, the components of an S-video signal, whether in the SECAM, PAL, or even NTSC standards, are almost the same as the ones found in a composite sig- nal of the same standard. So it's going to be relatively simple to combine them in order to reconstitute the composite video signal K that our CRT television is expecting to see. In order for this recombination to be cor- rect, there is just one constraining factor to be taken into account, concerning the respective levels of the components, as the chrominance one is only half the amplitude of the luminance one. Our circuit picks up the component signals on the two standardised pins of the 4-pin mini- DIN socket normally used for S-video (also known as an Ushiden socket), taking care to maintain the 75 O impedance via R1 and R2. The mixing of the two signals is then taken care of by R3, R4, and PI; the latter lets you adjust the respective levels of the two com- ponent signals exactly. The two transistors that come next are wired in such a way as to create a wideband ampli- 7-8/2009 - elektor 41 fier, the gain of which is set to 3 by the ratio between R8 and R9. Combining the input components has had the effect of dividing the overall amplitude of the video signal by a factor of 1.5, and the output impedance matching resistor is going to divide the sig- nal in half again (once the signal is terminated at the input of the destination equipment), all of which adds up to a total attenuation of 2x1.5, corresponding to the make-up gain we have designed into our amplifier. In this way, inserting our converter into a video chain will have no effect on the level of the signals pass- ing through it. The composite video output passes via 75 Q resistor R11 in order to match the circuit's output impedance to the input impedance of the composite video input on the device to which it is connected. At both input and output, note the parallel combinations of Cl / C2 and C3 / C4, so that the video signals, with a frequency range extending from a few tens of Hz to several MHz, can pass through these capacitors under the best possible conditions. If we want to avoid unwanted colour or brightness variations, it is vital to power the circuit from a stabilized supply, achieved here by using a standard 3-pin regulator 1C to pro- vide a 5 V rail for the circuit. So the project can be powered from a 'plug-top' mains unit that gives 9 to 12 V at 100 mA or so. Diode D1 is there just to protect against any accidental inversion of the PSU polarity that might pos- sibly occur. The circuit itself is very easy and construction shouldn't present any difficulties. It can be built on the PCB we suggest [1] or on a piece of prototyping board, but in either case, we recommend using fibreglass board, because of the high frequencies involved in the video signals. If you want your converter to follow the proper standard in terms of connectors, you'll want to use a female 4-pin mini DIN S-video socket for the input and a female phono socket (a yellow one, for the purists!) for the output. As for the power supply, all you'll need is a simple jack to suit the mains unit you've chosen. The circuit should work right away, and all that you then have to do is to adjust the pre- set PI so as to obtain a composite video sig- nal that gives correct contrast and saturation on the TV receiver you are using. ( 081179 - 1 ) Internet Link [1] www.elektor.com/081179 COMPONENT LIST Resistors R1,R2,R11 = 75Q R3,R7,R8 = 470Q R4 = 560Q R5 = 27kQ R6 = 10kQ R9,R10 = 150Q Capacitors Cl, C3 = lOOnF C2, C4, C8 = 470 (jF 25V C5 = 10nF C6 = 1 0 pF 25V C7 = 220nF Semiconductors D1 = 1N4004 T1 = 2N2222A T2 = 2N2907A IC1 =7805 Miscellaneous 4-pin mini DIN connector Cinch connector (yellow) DC supply connector Download 081179-1: PCB layout (.pdf), from [1] SSR 2.0 OptoMOS semiconductor relays Fredi Kruger (Germany) OptoMOS or PhotoMOS relays are something of a special category. Looking at a block diagram the device falls somewhere between an optocoupler and a conven- tional SSR (Solid State Relay). To compare technologies the input sig- nal to a standard analogue optocoupler modulates the light of an LED. The light induces a current in an isolated pho- totransistor or Darlington. The out- put current from this type of device is relatively small (a few milliamps) and is approximately proportional to the input signal. Solid state relays by comparison have a similar input LED but this time the light is used to trigger a built-in triac or thyristor. They are used to switch M Conventional mechanical relays have been around for years. They switch both AC and DC supplies and can be designed to handle high current and voltage. Standard semiconduc- tor relays can switch high current and high voltage loads but are not suitable for DC sup- plies and cannot be switched at high frequency. Taking a closer look at the block dia- gram of a typical modern optoMOS relay shows an LED at the input as in the a normal optocoupler, but this time the light is used to switch two complementary photo MOSFETs which form a bidirectional switch. This bidirectional configuration is capable of switching both AC and DC sup- plies at speeds of around 1 ms. Most of the major 1C manufacturers pro- duce their own versions and amongst those stocked by one supplier include NEC (PS7141-2B), International Recti- fier (PVN012APbF), Clare (LBB110) and Vishay Semiconductors (LH1502BB). The characteristics of these devices AC loads and some variants include circuitry to ensure switching occurs as the AC passes through zero. This reduces switching EMI but also makes them unsuitable for phase control applications. 42 elektor - 7-8/2009 range from a maximum load current from 50 mA to 10 A with a voltage range from 20 V up to 2 kV. The switch resistance can be as low as a few mO to 100 O and the input control current ranges from around 2 mA to 10 mA depending on the type of relay. Some other manufacturers are Toshiba, Fairchild, Aromat (NAiS), Panasonic, Sharp, Cosmo and Avago. Some of the advantages of OptoMOS relays are: • Small package outline — also in SMD! • Long service life • No contact wear • No contact bounce • No generation of EMI • High switching speed • Insensitivity to vibration • Insensitivity to magnetic fields • No magnetic field emission • Low control power requirements There are several different package outlines including one with eight relays in the same package. When choosing a relay for a particu- lar application the description will include the specification 'X form Y'. X is a number indicat- ing how many switches are in the package and Y indicates the type of contact: 'B' = nor- mally closed while TV = normally open. Some of these relays have both normally open and normally closed in the same package, useful for making a changeover switch. In the Elektor labs we took a look at the TLP4227G-2 from Toshiba. This 8-pin version is described as '2 form B', i.e. two normally closed relays. The contacts are capable of switching 350 V at 150 mA. Without any cur- rent flowing in the LED the device is on and we measured an output resistance of 15 O. With an LED current of 0.5 mA the resist- ance starts increasing and at around 0.9 mA it rises sharply giving an off resistance of around 300 MO. The FOD3180 is another variant from Fair- child; it is a high speed MOSFET gate driver optocoupler which has additional load sup- ply voltage connections. It is capable of switching 2 A at 250 KHz. At this speed it is necessary to take precautions to suppress EMI generation generated in the load. ( 080683 - 1 ) Internet link www.toshiba.com/taec/components2/Datasheet_ Sync//214/4495.pdf Speed Control Mark Donners (The Netherlands) The author went for a ride in a rental Citroen a while ago. This car had a nice gadget onboard that the author was unable to find available as a separate accessory. In such cases, there's only one option for an electron- ics enthusiast: do it yourself! The device in question mon- itors how fast you are driv- ing. An alarm sounds if you go faster than the preset speed. This gives the driver good con- trol over how fast he actually drives. You can regard it as a pseudo cruise control. This circuit is built around an Atmel ATtiny25 microcontroller, which has all the features nec- essary for achieving the desired objective. The microcontroller operates at 1 MHz using a clock signal generated by an internal oscillator. The desired speed is set by a pushbutton switch connected between pins 3 and 1 of connector K1, which is connected to input PB1 of the microcontroller. The idea is that the driver should push the button when the car reaches the desired speed K3 081127 - 11 detection limit. After this speed has been 'stored' via input PB1, the microcontrol- ler will generate an acous- tic alarm if the set speed is exceeded. It produces two short beeps if the speed is slightly higher than the set value, or a long, loud beep if the speed is significantly higher. The speed is measured via pin 2 of connector K1. Opti- cal isolation with IC2 pro- tects the PB2 input of the microcontroller against excessively high voltages. You can tap off the speed input signal of the car speedometer for this pur- pose, or you can fit a mag- net and reed relay to the driveshaft or an axle. The firmware is written in C and assembled using Code- vision. All the firmware does is to monitor the speed input signal using an inter- rupt-driven routine. The sig- nal is monitored by measur- ing the interval between two successive pulses: the shorter this interval, the higher the speed. If the set 7-8/2009 - elektor 43 speed level is exceeded, an alarm signal is generated. You can use connector K3 to pro- gram the microcontroller (1 = SCK; 2 = MISO; 3 = MOSI, 4 = RESET). Information about available speed signals in different makes of cars is found on the Inter- net, for example, at [2]. Lars Nas (Sweden) A missing-pulse detector is a 'one-shot' trig- gered device that is continuously retriggered by incoming pulses before a predefined tim- ing cycle is completed. At room tempera- ture, the positive-going threshold voltage (V th+ ) for the CD40106BC hex Schmitt trig- ger 1C falls in the range of 60% to 86% of its supply voltage (V cc : 5 V-15 V). If we also take into account that capacitor Cl takes a time constant defined as RlxCI [seconds] to reach 63% of its full charge voltage, the constant is roughly the time Cl takes to charge up to the level V th+ , thus changing the logic state of pin 6 on IC1.C. Based on the above assumption, if a pulse train with a High-level period shorter than 7=R1C1 [s] is present on the base of T1, this pnp transis- tor will remain in the cutoff state. This allows Caution. Tapping off or altering the speed signal generated by a vehicle for use on pub- lic roads may be illegal and/or void manufac- turer's warranties. ( 081127 - 1 ) R1 to charge up capacitor Cl, but not suffi- ciently to reach the positive voltage thresh- old set at input pin 5 of the gate. Conse- quently Schmitt trigger output pin 6 will remain High. For a retriggered pulse period of 3 seconds (or 0.3Hz) you'd use R1 = 330 kO and Cl = 10 pF. Now, if the High-level pulse duration on the base of transistor T1 is longer than T, the tran- sistor will remain cut off, but the capacitor will Internet Links [1] www.elektor.com/081127 [2] http://koti.mbnet.fi/jylhami/trip/speedsignal.pdf Download 081 1 27-1 1 Source code and hex code, from www.ele- ktor.com/081127 Detector H charge until V th+ is reached and the output pin 6 of the Schmitt trigger gate will change to logic Low. When no pulse (i.e. a logic Low state) is pres- ent on the base of T1, the transistor is driven into saturation. This allows Cl to instantly dis- charge, setting up the initial conditions for the next pulse. The trigger signal can for instance be sup- plied by a Hall-Effect switch set up to mea- sure if a wheel with a magnet is rotating or not. This circuit uses one gate in the CD40106BC, leaving the other gates free for use for other purposes. Do take into account that CD401 06 devices from different manufacturers or pro- duction batches may have slightly different threshold voltages, which requires the cal- culated value of T to be adapted carefully to match the specifications of the gate used. ( 080137 - 1 ) Four-component Missing-pulse Hassle-free Placement of SMD Components M Leo Szumylowycz (Germany) Gadgets can be very useful to assist the task of placing components in printed circuit boards. Some people clamp the PCB in a small vice, either the vacuum-fixing variety (with a sucker) or the type that clamps to the edge of the workbench, or else they use one of those 'third hand' devices with several crocodile clips. But none of these is much help when you are dealing with surface mount (SMD) components. Even the steadiest hand is of lit- tle use if just the smallest slip causes the PCB to jump out of the croc clips. In this kind of operation you cannot steady your hands on the work surface and they soon get tired. The author has discovered a better, albeit unconventional, solution: a substance like modelling clay that is sold for cleaning the gummy mess out of the metal type letters on traditional typewriters (yes, some people do still use these good old machines). This sub- stance is sold in specialist stationery shops but if you can't find it, a good substitute is Blu-Tack adhesive putty (or one of the several similar products), which you can buy in strips, square or small pads. You'll need to knead it in your hands a while for this kind of assem- bly work. Once you have softened a lump to a suitably elastic consistency, you can press it onto the actual work preparation area and place the printed circuit board on top (see photo). The underlay should be rectangular or circular, about 20 to 25 cm (8 to 1 0 inches) across. This approach enables you to manoeuvre the SMD printed circuit board into the best position at any time during the parts placement proc- ess and fix it firmly in place with both hands. Using a conductive material for this underlay enables it to be earthed for discharging any static electricity charge. Many mousepads are 44 elektor - 7-8/2009 suitable for this purpose, used with the con- ducting surface uppermost. Instead of Blu-Tack you could use other mate- rials such as Plasticine or even chewing gum, although the author has not tested these per- sonally. Here practitioners will state that SMD printed circuits boards can also be populated using double sided sticky tape. Blu-Tack has the advantage, however, that you can use it to fix individual components onto the PCB tidily and 'squarely' before soldering, leaving both hands free for the actual soldering. ( 090368 - 1 ) Daylight Switch Mickael Bulet (France) This project was originally designed for lighting up an illuminated sign for a wine-grower. The sign was originally controlled by a simple time-switch, which had to be reprogrammed every day to avoid the sign's lighting up while it was still daylight. This is time- consuming, and can lead to wastage of electricity and other resources. A better solution would be an auto- matic switch capable of detecting the transition between daylight and night-time. In addition to that funda- mental requirement, the specifica- tions also demanded a very compact unit that would be easy to install and not require major modifications to the existing electrical installation. The project described here is com nal dimensions) IP55 junction box, for example, the Plexo® range from Legrand. It is easy to install; all you have to do is cut into the cable lead- ing to the light and wire it in series. The circuit is AC powered, without using a transformer. The impedance of a capacitor is used to drop the 230 VAC power voltage and limit the cur- rent. Resistor R1 protects the capaci- tor (Cl) against surge currents when power is applied at lighting-up time, and R2 ensures that it is discharged at turn-off. Readers on 120 VAC, 60 Hz power should change component val- ues as follows: R1 = 2x 100 Q in paral- lel (stacked) or lx 47 O, 2 watts; Cl = 2.2 pF. Also note P = phase, N= neutral, P (PE) = protective earth. Rectification is achieved using a bridge pact enough, fitting into an 80x80 mm (inter- rectifier, which makes it possible to double COMPONENT LIST Resistors R1 = 47Q 1W R2 = 470kQ R3 = LDR R4, R5 = lOOkQ R6 =1kQ PI = 1 MQ multiturn preset, vertical Capacitors Cl = 1pF5 400V MKT C2 = 1000pF25V axial C3 = lOOnF LCC 63V C4 = lOpF 25 V radial Semiconductors D1-D4,6= 1N4007 D5 = 15V 1.3W zener diode T1 = BC547 or equivalent IC1 = pA741 or equivalent IC2 = 7812, or low-drop equivalent Miscellaneous RE1 = relay, 12V coil, lx 10A, 250V c/o contact K1,K2,K3 = 2-way PCB terminal block, 5mm (0.2") lead pitch Type IP55 electricity junction box, internal dimensions 80 x 80 mm (3.15" x 3.15") e.g. plexo LEGRAND #922-06 20 mm length of electricity conduit, diam. 20 mm (0.8") 7-8/2009 - elektor 45 the usable current compared with the conventional rectification often encountered in this sort of power sup- ply. A zener diode of around 15 V (min- imum, as the 12 V regulator needs to be allowed enough headroom to do its job properly) limits the voltage in the first instance; it is then smoothed by C2, then more accurately regulated by IC2 and finally decoupled by C3. The stable 12 V supply is required above all for the voltage divider that acts as a reference for the comparator. The darkness is detected by an LDR, which in conjunction with R4 forms a voltage divider, the output voltage of which is inversely proportional to the intensity of the light falling on the LDR. Capacitor C4 absorbs rapid changes in this voltage, in order to avoid unwanted triggering. R5 and PI form a voltage divider for the comparator (IC1) refer- ence voltage — this is what determines the threshold for the light to be turned on. When the voltage on pin 3 of IC2 is higher than the voltage on pin 2, the comparator activates the relay via T1, and the sign is lit up. A printed circuit board has been designed (the design is available free from [1]) to make build- ing the switch easier. Don't forget to tin the tracks switched by relay RE1 so they can carry as much current as possible to the light to be controlled. In some cases, it may be necessary to beef up the tracks with pieces of solid cop- per wire. The circuit fits into a sealed IP55 box, like an electricity junction box, for example. Drill a hole in the lid of the box to allow the leads to pass through from the LDR, which you will need to glue to the lid. In front of the LDR, fit a piece of 20 mm diam- eter plastic conduit about 20 mm long as a shield, so that the LDR won't be affected by the light coming from the light you are trying to control. Install the switch as far away as possible from the light it is operating, to avoid end- ing up with a flasher! Last of all, adjust PI for the light level at which you want the relay to switch on. Cautionary Notice When you're handling the circuit for testing etc., be really careful to avoid getting a shock, as there is live AC power present over most of the PCB. Never connect the circuit's internal ground rail to the protective earth (E) line. ( 090049 - 1 ) Internet link [1] www.elektor.com/090049 Control Interface via PC Keyboard Jacob Gestman Geradts (France) One of the more difficult aspects when making a control or security system that uses a PC (a burglar alarm using a PC, for exam- ple), is the connection of the sensors to the compu- ter. In addition to typically requiring specialist inter- face expansion boards, the writing of the program that includes interrupts is often also an insurmountable obstacle. But when only a simple system is concerned consisting of, for exam- ple, four light barriers or, if need be, trip wires giving a digital on/off signal when uninvited guests enter, then a much cheaper but never- theless effective interface is possible. For this interface we use an (old) computer keyboard. This contains as many switches as there are keys. IC2.D IC2.C These switches are scanned many times per second in a matrix in order to detect the potential press of a key. The number of columns is usually eight (C0-C7 in the schematic); the number of rows varies for each type of keyboard and can range from 14 to 18 (R0-R17 with the HT82K28A keyboard encoder mentioned in the example). To each switch there is a single column- and a single row connection. The intention of the circuit is that sensor A will 'push' the letter A, when it senses something. This requires tracing the keyboard wir- ing to figure out which col- umn and which row is con- nected to the A key. One of the four analogue switches from the familiar CD4066 CMOS 1C is then connected between these two con- nections; that is, in paral- lel with the mechanical A key on the keyboard. When the Control-A input of the 46 elektor - 7-8/2009 CD4066 is activated by sensor A, the letter A will be sent to the computer by the key- board. The PC can then act appropriately, for example by entering the alarm phase. The system is not limited to (burglar) detec- tion using a PC. The remote control of a TV set or other electronic devices can also be operated with a 4066 in the same way; for example to scan through a number of TV channels in a cyclical fashion. To do this, you could, for example, shunt the 'next chan- nel' button using one of the 4066 switches, which itself is activated by a 1-Hz square wave generator. In the schematic only switches A and B of the CD4066 are connected to the keyboard. You can, of course, use all four of the switches and if you need more than four you can use multiple CD4066 ICs. The indicated wiring between the keyboard 1C and the 4066 is an example only, and each 'typed' letter has to be determined by the user for the specific keyboard that is used. It is important that each CD4066 switch is always connected between a row- and a column connection. The output signal from the sensors has to be suitable for the CD4066 and the power sup- ply voltage of 5 volts used by the keyboard. The power supply for the CD4066 may be obtained from the keyboard. ( 090379 - 1 ) PR4401 1 -Watt LED Driver T.A. Babu (India) The PR4401 chip from Prema can be used to drive an LED directly, but not a high-power LED like one of the popular 1-watt types cur- rently available on the market. The circuit shows that the drive sig- nal at the V out terminal of the PR4401 chip (pin 2) turns a medium- power PNP switching transistor (T1) on and off. When T1 is switched into conduction, inductor LI is charged. When T1 is switched off, the inductor discharges its stored energy through the LED during flyback with enough current to allow a one-watt LED to light up at nominal brightness. During the 'on' time of transistor T1, the current through inductor L2 ramps up linearly to a peak value as expressed by. ^L2(pk) — l-(^batt — ^CEsat(TI)) ^ ^ ^2 where l/ CEsat(T1) is the collector-to-emitter saturation voltage of T1 (here, a type BD140 is suggested). During TVs 'off' time, the inductor voltage reverses, forward-biasing the LED and discharging through it at a constant voltage roughly equal to the forward voltage of the LED, while its current ramps down to zero. Because this cycle repeats at a high rate, the LED appears to be always on, its brightness depending on the device's average current, which is proportional to the peak value. The LED current is roughly a triangular pulse with a peak current approximately equal to the inductor's current because of the finite turn-off time of T1. The estimated average current may be calculated from ^LED(avg) — V2 X /|_2peak ^ l-^clis ^ (^on ^off^ Where T dis is the discharge time of inductor L2 through the LED. The LED's brightness can be increased or decreased by varying the induc- tance of L2. In practice, any value between 10 and 56 pH will work just fine. The inductor current increases on each cycle until T1 goes out of saturation, hence a small resistance (R1) is required at the base of T1. Without the 'stopper resistor', the final current goes out of control due to the DC gain of TV A transistor with a high DC current gain and low collector-to-emitter saturation voltage is the best choice if you want to tweak the circuit for efficiency. Regarding L2, make sure the peak current through it is below the saturation level. ( 080825 - 1 ) Advertisement China PCB Supplier (Prototype thru Production) / 1 -layer up to 30-layer / Cost and quality / On time delivery / Dedicated service / Instant Online Quote & Order Day and Night No minimum quantity - 1 piece is welcome Check our low price and save big $$$... 86(571 )86795686 sales@pcbcore.com www.pcbcore.com 7-8/2009 - eleklor 47 TurboGrafx-1 6 (PC-Engine) RGB Amplifier M Marco Bettiol (France) The PC-Engine, also marketed under the name TurboGrafx-16 [1] is an 8-bit games console made by NEC/Hudson Soft which appeared in Japan in 1987. In terms of units sold, for some time it exceeded Nintendo and its famous Famicom (NES in Europe). Despite this success, it was never officially distributed in Europe. Sodipeng was the only company to market it, but it remained a pretty well kept secret. Nowadays, people who want to play again with this excellent machine are faced with a problem of incompatibility of the video loscope, and calculator! The principle of this circuit is very simple and is based around a single 1C, the LT6551 from Linear Technology. The package contains four independent video amplifiers with a fixed gain of 6 dB. This 1C is available in MSOP for- mat, which means the overall size of the cir- cuit can be kept down. The RGB + sync sig- nals are picked up directly from the expan- sion port. The input impedance of the circuit is set at 10 kO so as not to overload the HUC6260. R9 for the sync circuit, RIO, 11, and 12 for the RGB. Next, we need to eliminate the 3.6 V DC com- ponent and set the RGB signals at a more suit- B G R SYNC +5V SR SL signals, as the PC-Engine's NTSC video out- put may not be compatible with some PAL/ SECAM television sets. The only way to be able to use this console and obtain a colour picture is to connect directly to the HUC6260 video processor which provides the red, green, and blue primary signals plus sync. As luck would have it, these signals are directly available on the machine's rear expansion port. This port also provides the left and right audio signals, along with a 5 Vdc power rail. Even though the RGB signals are at the standard level of 0.7 V p-p, they still can't be fed to the TV set directly, as the HUC6260 is not capable of driving into a 75 O load. This is where you get out our soldering iron, oscil- able level. If the signal were to be amplified as is, the amplifier would be bound to satu- rate. So the choice of a proper level is vital in order not to distort the reproduction of the image being amplified. Capacitors C12- C16 provide coupling, and only the wanted AC component of the signal passes on to the next stage. SCART socket wiring [2] Ground 4, 5,9,13,17,18,21,(14) R 15 G 11 B 7 Video/Sync 20 Audio Left 6 Audio Right 2 RGB switching 16 PC-Engine expansion port (resembles din 4i6i 2 ) oi A1 Audio Left Cl Audio Right C2, 20 ground A2, 21 +5 Vdc A23 Red B23 Green C23 Blue C22 sync 48 elektor - 7-8/2009 This AC signal needs to be fixed or 'clamped' to an optimum level. The specifications of the LT6551 offer an input range from 0 to 2.5 V maximum with a 5 V supply (see data sheet). R5/R13 and the three other identical pairs of resistors create voltage dividers. By choosing the values of 8.2 kO and 39 kO, you obtain an operating point around 0.86 V. A little calcu- lation just to check: 0.7 V plus 0.86 V gives a maximum input signal of 1.56 V. It's important to choose the coupling capaci- tor value correctly, according to the value of these resistors. Together, they form a high- pass filter that attenuates the lower frequen- cies of the wanted signal. As a rule-of-thumb, you need to calculate this filter in such a way as to set the cut-off frequency at one tenth of the lowest frequency to be passed, which in this case is 30 Hz, the NTSC frame rate (25 Hz for PAL/SECAM). So let's take 30 Hz as the cut-off frequency. The formula for the cut-off frequency of a first-order filter f c = 1/(2ttRC) gives C = 3.9 pF (with R = R5//R13 = 6,775 Q and f c = 3 Hz) and so you'll choose the slightly higher value close to this: 4.7 pF for example. The LT6551 amplifies the video signal by a factor of two (+6 dB) and so we find at its output terminals a signal of 1.4 V, together with a DC component. A capacitor (Cl, C3, C4, C5) removes this unwanted DC compo- nent and the output impedance is set to the standard value of 75 O by a resistor (R1-R4). This 75 Q output impedance is effectively in series with the 75 O impedance of the TV set's input stage, which divides the voltage by two, bringing the video signal back down to its standard value of 0.7 V. And that's why we need to use an amplifier with a gain of 6 dB. An 8-pin DIN socket carries the RGB + sync signals. The sound signals are filtered of any DC component and the RGB switching signal needed by the SCART input is also provided. All that remains is to make up the cable with the correct pin-outs. This little project helps us remember that video games can generate very serious activ- ities, and that in electronics nothing is ever chosen by chance. Enjoy your gaming! ( 090041 - 1 ) Internet links [1] http://en.wikipedia.org/wiki/PC-Engine [2] http://en.wikipedia.org/wiki/SCART [3] http://www.gamesx.com/misctech/pcebp.php Fan Speed Controller Andreas Vogel (Germany) Anyone who uses a computer for long peri- ods will appreciate the benefits of a silent PC. Quite a few websites now sell compu- ter accessories specifically designed to make your desktop run more quietly. The CPU fan is often the main culprit in a noisy PC; in many cases it can be replaced by a large passive heat sink to dissipate the heat more efficiently. The heat sink fins are arranged to make optimum use of air blown through the case by the power supply fan. The specification of Intel's ATX type PC form factor even suggests that the cooling air should be used in this way but to be success- ful on modern machines it is necessary to pay careful attention to a number of factors. Firstly it is important to use a processor which has the lowest possible power consumption (especially in idle mode), the lower cost 45 nm technology chips are a good place to start here. Secondly it is important to pay atten- tion to the air flow in the case to ensure that it is ducted efficiently from the PSU through the passive CPU heat sink. The main draw- back with this setup is that fan speed is only controlled by the temperature of the PSU, not the processor. The solution of course is to install a new fan speed controller and fit a temperature sensor to the CPU heat sink. The controller senses the air temperature in the PSU as well as the processor heat sink and adjusts the fan speed according to the warmest read- ing. This approach ensures that everything remains cool. With this in mind the author built this versa- tile fan speed controller using little more than a small microcontroller, a few transistors and two NTC thermistors. The main circuit ele- ment IC1 is an 8-pin 8-bit ATtiny13 microcon- troller from Atmel. This controller has more than enough 10-bit resolution analogue inputs for the job. The circuit diagram is not so complicated: Two thermistors are connected between NTC1 and NTC2 of K3 and ground. Together with R1 and R2 they form two voltage divider networks. The voltages produced at NTC1 and NTC2 are proportional to the measured temperatures. These are sampled by the ana- logue inputs ADC2 and ADC3 of the micro- controller. The controller will select one often fan speed settings depending on the meas- ured values of temperature. The higher of the two temperature readings will always be used. The output from pin 6 is a pulse modu- lated waveform to control fan speed. The out- put Darlington configuration of T1/T2 drives the fan from the PWM waveform integrated by R6/C2. This low pass network filters out the 15 Hz fundamental of the PWM output signal to reduce any PWM noise generated in the fan windings. 7-8/2009 - elektor 49 The power connections to 12 V and 5 V on K3 can be supplied from an unused floppy disk drive or spare hard disk power cable. K1 pro- vides the connection for the in-circuit pro- gramming cable for the microcontroller. R4 should ensure that the fan is switched on if the microcontroller hangs or a fault occurs. The circuit is so simple that it can comfort- ably fit on a square of perforated stripboard and housed in a small plastic enclosure. Fix one of the thermistors onto the heat sink (doesn't matter which one but make sure it is Christian Tavernier (France) Whether you're talking about a home cinema or a computer system, it's very often the case that the various elements of the system have to be turned on or off in a quite specific order, or at least, automatically. Constructing this sort of automation system is well within the capability of any electronics enthusiast wor- thy of the name, but in this 'all-digital' age, most of the circuits of this type to be found in amateur electronics magazines or web- sites use a microcontroller. Even though that is indeed a logical solution (in more ways than one!), and you might even say the easiest one, it does pose problems for all those people who don't (yet) have the facilities for programming these types of 1C. So we decided to offer you now an approach that's very different, as it only uses a simple, cheap, commonly-avail- able analogue integrated circuit, which of course doesn't have to be programmed. Our project in fact uses as it's 'brain' an LM3914, a familiar 1C from National Sem- iconductors, usually used for driving LED VU (volume unit) meters. Before taking a look at the cir- cuit for our project, let's just remind ourselves that the 1C has one analogue input and ten out- puts intended for driving LEDs. It can operate in 'point' mode, where the LEDs light up in turn, from first to last, depending on the input voltage, but only one LED is lit at any given time. Alternatively it can operate in 'bar' mode (this is the mode normally used for VU meters), and in this case, the LEDs light up one after the other, in such a way as to electrically insulated from the heat sink). The other thermistor can be positioned in the air flow from the PSU so that air can pass freely around it. The PSU fan can now be connected to the new fan speed controller. Some fans have a built-in thermistor which regulates the fan speed autonomously. In this case remove the thermistor and replace it with a fixed resistor to make sure it runs at full speed (try 1 kO). The firmware for IC1 is written in assembly language and would also run in principle on create a strip of light (bar) that is longer or shorter according to the input voltage. This is the mode selected for the LM3914 in the cir- cuit described in some detail below. So as to be able to control the AC powered equipment our sequencer is intended to manage, we are using solid-state relays — four, in our example, though you can reduce or increase this number, up to a maximum often. Since the input devices in solid-state relays are LEDs, they can be driven directly by the LM3914 outputs, since that's exactly what they're designed for. As only four relays are available, these are spread across out- puts L2, L4, L6, and L8, but you can choose any arrangement you like to suit the number of relays you want to use. other variants of the ATtiny microcontroller family. ( 070579 - 1 ) Download & Product Programmed controller 070579-41 Controller ATtiny13 Software 070579-1 1 : source code and hex files, from www.ele- ktor.com/070579 K Resistor R7 connected to pin 7 of the LM3914 sets the current fed to the LEDs by the LM3914 outputs. Here, it's been set to 20 mA, since that is the value expected by the solid-state relays chosen. The input voltage applied to pin 5 of the LM3914 is none other than the voltage present across capacitor Cl — and this is where the circuit is ingenious. When the switch is set to 'on', Cl charges slowly through R5, and the LEDs of the solid-state relays on the outputs light one after another as this voltage increases; in this way, the units being controlled are powered up in the order you've chosen. To power-down, all you have to do is flip the switch so that Cl discharges through R5, and the LEDs go out in the reverse order to that in which they were lit, in turn powering down the units connected Power-up/down Sequencer +9V...+12V ©- D1 RS1...RS4 = S216S02* H 1 N4004 <2> R6 ON SI R5 470k F o OFF Cl □ 100n R7 C C2 □ 470|i 25V • • 25V Lpl • II 3 © MODE LI RHI L2 IC1 L3 L4 SIG L5 LM3914 L6 L7 REFOUT L8 RLO L9 REFADJ L10 18 17 16 15 14 13 12 10 RSI RS2 RS3 RS4 FI * sraf w • • 1,1=1 Q / I J SI A nl VDR 250V SIB o F2* 3MS !,□ O / T R2 VDR 250V S2A S2B o F3* m !,□ O JL J S3A / I VDR 250V S3A S3B o F4* SMf W • • 1,1=1 Q / I J S4A n4 VDR 250V S4B o 081180 - 11 50 elektor - 7-8/2009 to the solid-state relays. Easy, isn't it? If you're not happy with the sequence speed, all you need do is increase or reduce the value of R5 in order to alter the speed one way or the other. The circuit needs to be powered from a volt- age of around 9 to 12 V, which doesn't even need to be stabilized. A simple 'plug-top', 'wall wart' or 'battery eliminator' unit will be perfect, just as long as it is capable of supply- ing enough current to power all the LEDs. As the LED current is set by R7 to 20 mA per LED, it'll be easy for you to work out the current required, according to the number of solid- state relays you're using. In our prototype the type S216S02 relays from Sharp were used, mainly because they proved readily available by mail order. They also have the advantage of being compact, and their switching capacity of 16 A means you can dispense with a heatsink if you're using them for a computer or home cinema system, where the current drawn by the vari- ous units can be expected to remain under 1 A. These solid-state relays must be pro- tected by a fuse, the rating of which needs to be selected according to the current drawn by the devices being powered. Also note the presence across the relay ter- minals of a VDR, also known as a GeMOV or SiOV, intended to protect them from any spu- rious voltage spikes. You can use any type that's intended for operation on 250 VAC without any problem. The values of fuses FI to F4 are of course going to depend on the load being protected. Construction of the circuit shouldn't present any particular difficulty, but as the solid- state relays are connected directly to AC power, it is essential to install it in a fully- insulated case; the case can also be used to mount the power outlet sockets controlled by the circuit. Note that sockets are female components. Let's just end this description with the sole restriction imposed by our circuit — but it's very easy to comply with, given the intended use. In order to remain triggered, the solid- state relays must carry a minimum holding current, which is 50 mA in the case of the devices we've selected. In practical terms, this just means that each of the devices pow- ered by our sequencer must draw at least 50 mA, or in other words roughly 12 VA at 230 VAC, or 25 VA at 120 VAC. ( 081180 - 1 ) Floating Message R8 £ BT1 5 1 V5 2xAAA 2 BT2 5 1 V5 SI N 12 _ 11 (5 9 IC1 RAO RA1 RA2 RC5 RA3 RC4 RA4 RC3 RA5 RC2 RC1 RC0 PIC16F616SL 14 13 10 R1 - | 560 Q R2 { 560 Q R3 ri 560 Q R4 - | 560 Q R5 — |_560£2 R6 i 560 Q R7 ~ | 560 Q ilf- Oh Oh ►h- tf_D7 080441 - 1 1 LudovicVoltz (France) This project lets you display a message floating in the air using just seven LEDs, a microcontrol- ler, and the movement of your arm. How can that be possible? The human eye and brain can't resolve a moving object, and the same applies to anything that changes rapidly. It is by exploit- ing this shortcoming (or capac- ity, depending on which way you look at it!) that we are able to see videos and all types of footage, clips, visual effects and so on, on the many screens around us. When the images on the screen appear at a rate of at least 24 per second, humans can no longer make them out as individual images and perceive the result as a moving object. It's this 'persistence of vision' that the author has exploited in creating this project. The characters of the message to be displayed use a very common 7 line x 5 column character style. The columns are dis- played sequentially by the seven LEDs arranged in a column: first column 1, then 2, and so on up to 5. If the LEDs are moved on slightly before display- ing the next column, the eye thinks it is seeing the whole character. The LEDs flash at a frequency of the order of 200 Hz, and so all you have to do is move the circuit around to see the message appear as if it were floating in mid air. Here's a little gadget that will amuse young and old alike on summer evenings. For simplicity and compactness, this project uses a PIC16F616 microcon- troller from Microchip, capable of working off no more than 2 V. This allows the circuit to be powered from two AAA rechargeable batteries (2 x 1.2 V), a good compromise between battery life and the 7-8/2009 - elektor 51 space taken up. What's more, this solution is environmentally-friendly, as the batteries can be recharged, unlike CR2035 button cells, for example. The messages are created with the help of an Excel file, where all you have to do is fill in the cells with 0's or Vs according to the character you want to display. This file then directly gives the hex code for the correspon- Rainer Reusch (Germany) Crystal oscillators for digital circuits are normally built as Pierce oscillators with an inverter. The inverter operates as a linear amplifier and thus requires extra current. But you can also build a crystal oscillator using an operational amplifier (op amp for short)! If a very low frequency is involved, for instance 32.768 kHz (commonly used for clocks), you can get away with a comparatively 'slow' micro power op amp. In the sample circuit shown a widely avail- able TLC271 is used. On pin 8 we have the opportunity to set the 'bias mode', with three choices ranging between fast operation with higher current consumption and slower oper- ation at low current. For our clock crystal the ding constant. Naturally, this file is available in the download accompanying this article [1]. Using the circuit is as simple as its operating principle. A brief press of the button starts the sequence for displaying the word. Then all you have to do is synchronise your move- ments with pressing the button. In order to be able to read the word properly, it's best to repeat the operation more than once. You can store several words in the PIC's Flash memory (up to the limit of its capacity, of course). To move on to the next word, you must press the button for at least 0.6 s. The reproduction will be clearer if the background lighting is low. ( 080441 - 1 ) Internet Link [1] www.elektor.com/080441 M middle setting will suit us fine. Pin 8 is there- fore connected to the voltage divider R1/R2. The current consumption of the entire circuit is impressively modest and at 5 V this is just 56 pA! The oscillator also functions astound- ingly well at 3.3 V. At the same time the cur- rent drops to a more battery-friendly 41 pA. A prototype built in the Elektor Labs produced the slightly higher values indicated in the cir- cuit diagram. The output signal delivered by this circuit has admittedly scant similarity to a square wave. Nevertheless some cosmetic surgery will tidy this up, with treatment in the Schmitt trigger following. To save current (naturally) we use a CMOS device such as the 74HC14. ( 090320 - 1 ) Micropower Crystal Oscillator Automatic TV Lighting Switch Z.0- 0 230V 'v (110V 'V) A/0- R1 - | io 230V 'V (110V 'V) — © 090071 - 1 1 Piet Germing (The Netherlands) The author is the happy owner of a television set with built-in Ambilight light- ing in the living room. Unfor- tunately, the television set in the bedroom lacks this fea- ture. To make up for this, the author attached a small lamp to the wall to provide back- ground lighting, This makes watching television a good deal more enjoyable, but it's not the ideal solution. Although the TV set can be switched off with the remote control, you still have to get out of bed to switch off the lamp. Consequently, the author devised this auto- matic lighting switch that switches the back- ground light on and off along with the TV set. The entire circuit is fitted in series with the mains cable of the TV set, so there's no need to tinker with the set. It works as follows: R1 senses the current drawn by the TV set. It has a maximum value of 50 mA in standby mode, rising to around 500 mA when the set is operating. The voltage across R1 is lim- ited by D5 during negative half-cycles and by D1-D4 during positive half-cycles. The voltage across these four diodes charges capaci- tor Cl via D6 during positive half-cycles. This voltage drives the internal 52 elektor - 7-8/2009 LED of solid-state switch TRI1 via R2, which causes the internal triac to conduct and pass the mains voltage to the lamp. Diode D7 is not absolutely necessary, but it is recommended because the LED in the solid-state switch is not especially robust and cannot handle reverse polarisation. Fuse FI protects the solid-state switch against overloads. The value of used here (10 O) for resis- tor R1 works nicely with an 82-cm (32 inch) LCD screen. With smaller sets having lower power consumption, the value of R1 can be increased to 22 or 33 Q, in which case you should use a 3-watt type. Avoid using an excessively high resistance, as otherwise TRI1 Christian Tavernier (France) Even though cordless phones have invaded our homes and offices, you don't always have them at hand, and as their ringtones are usu- ally very much quieter than the old rotary-dial- type analogue phones, it can happen that you miss a call you've been waiting for while you've been going about your daily business. Until quite recently, you could still find remote ringers that could be plugged into any standard phone socket in order to have an additional ringer, but it seems as if these accessories are currently being phased out as everyone is 'going cordless'. So we decided to suggest something better, with this phone ring repeater that makes it possible to con- trol any device connected to the AC power outlet using the ringtone available on any subscriber line, and naturally, with all the guarantees of safety and isolation that are of course rightly expected. So it's capable of driving a ringer, or indeed even a high-pow- ered sounder to alert you when you are in the garden, for example; but it is equally able to light a lamp for a 'silent ring' so as to avoid waking a sleeping baby or elderly person. This circuit has been designed to be com- patible with all phone systems the author is aware of and also to be totally stand-alone. What's more, the circuit can be connected to the phone system without any danger — though in some countries, it is forbidden to connect non-approved devices to the public switched telephone network (PSTN). Check local regulations in this respect. In order to understand the principle of it, we just need to remember that the ringtone present on a phone installation is an alter- nating voltage, whose amplitude and fre- will switch on when the TV set is in standby mode. Some TV sets have a half-wave rectifier in the power supply, which places an unbalanced load on the AC power outlet. If the set only draws current on negative half-cycles, the cir- cuit won't work properly. In countries with reversible AC power plugs you can correct the problem by simply reversing the plug. Compared with normal triacs, optically cou- pled solid-state relays have poor resistance to high switch-on currents (inrush currents). For this reason, you should be careful with older-model TV sets with picture tubes (due to demagnetisation circuits). If the relay fails, it usually fails shorted, with the result that quency vary somewhat between countries, but always with comparable orders of magni- tude except in the case of exchange systems used in large companies. However, when the line is quiescent or a call is in progress, it car- ries only a direct voltage. Capacitor Cl makes it possible to pick off just the AC ringing volt- age, which is then rectified by D2 and ampli- tude-limited by D1 . The resulting DC voltage charges capacitor C2, which makes it possi- ble to light LED D3 as well as the LED in the optocoupler IC1 . This is no ordinary optocou- pler, but is in fact an AC power zero-crossing detecting opto-triac, which allows us to con- trol the chosen load while generating no, or less, interference, which would not be the case using a standard opto-triac. The output triac it contains is not powerful enough to drive a load directly connected to the mains, so it is used to drive the trig- ger of triac TR1 1 , which is a totally standard 400 V device, rated at x amps, where x is cho- the TV background light remains on all the time. If you build this circuit on a piece of perf- board, you must remove all the copper next to conductors and components carrying mains voltage. Use PCB terminal blocks with a spacing of 7.5 mm. This way the separa- tion between the connections on the solder side will also be 3 mm. If you fit the entire arrangement as a Class II device, all parts of the circuit at mains potential must have a separation of at least 6 mm from any metal enclosure or electrically conductive exterior parts that can be touched. ( 090071 - 1 ) M sen to suit the maximum power of the load you want to control using this circuit. Resistors and capacitors R5 and C3 on the one hand, and R6 and C4 on the other help, serve to suppress the switching transients, which are already inherently low because of the AC zero-crossing switching provided by IC1. Construction is not at all difficult, but does require a few precautions in choosing some of the components. First of all, capacitor Cl must be an MKT type, mylar or equivalent, with a 250 V operating voltage because of the relatively high amplitude of the ringing voltage. For safety reasons, it is essential that capacitors C3 and C4 are self-healing types intended for AC power use at 250 VAC. These capacitors are generally known as Class X or X2 capacitors. As for the triac, it should have a 400 V oper- ating voltage (but see below for users on 120 VAC power) and maximum current slightly greater than the maximum current drawn by Phone Ring Repeater 7-8/2009 - eleklor 53 the load being driven. As this will usually be a sounder or a common lamp, a 2 A type will usually be more than adequate in most situa- tions. As the circuit can be expected to oper- ate for short periods only, there is no need to mount the triac on a heatsink. One final important point: as the right-hand part of the circuit is connected directly to AC power, it is vital to fit this inside a fully-insu- lated housing, for obvious safety reasons. Make sure you cannot touch any part when the circuit is in use. The circuit should work at once and without any problems, but if you notice that D3 doesn't light up fully, and hence incorrect or erratic triggering of the triac, because of too low a ringing voltage, all you need to put things to rights is reduce the value of resistor R1. The circuit as shown was dimensioned for operation from 230 VAC power. Readers on 120 VAC power should modify the following component values: R4 = 180 O; R5 = 220 O; TRI = 200 V model; IC1 = MOC3031. Option- ally, C3 and C4 may be rated at 120 VAC. ( 081171 - 1 ) Pulse Clock Driver with DCF Synchronisation M LCD1 Hans Oostwal (The Netherlands) Sometimes you can pick up a nice office clock or station clock at a bargain price. To ensure that these clocks all show the same time inside an organisation such as the rail- way system and avoid hassles with changing between winter time and summer time or replacing empty batteries, these clocks are normally connected to a clock pulse network that is driven by a master clock or radio sig- nal. The master clock generates a pulse every minute, with successive pulses having oppo- site polarity. If you want to use a clock of this sort, you naturally want it to keep good time. This is handled by the circuit described here, which offers the following features: • it is synchronised to the DCF 77 time refer- ence signal at 77.5 kHz (from Mainflingen, Germany) so the time is always correct; • it is inexpensive - by using a microcon- troller (in this case a PIC16F648A), the cir- cuit requires only a few components, and it can easily be assembled on a piece of perfboard; • it generates pulses at one-minute intervals with alternating polarity; • it also shows the time and date on an alpha- numeric LCD module; • automatic switching between winter and summer time; • time data is backed up in case of power fail- ure (stored in PIC EEPROM). When using a clock of this sort, note that some models have jumpers that can be fitted or removed to configure the clock for differ- ent working voltages. If you have this type of clock, select the lowest voltage (usually 24 V). Based on the author's experience, clocks from the Dutch PTT (former postal and telecommu- nication authority) also work OK at 12 V. Figure 1 shows the schematic diagram of the hardware. The circuit is built around a PIC16F648A clocked by its internal 4-MHz oscillator. A standard two-row LCD (HD44780 compatible) is connected to the microcon- troller to display operating instructions or the date and time. The circuit can be powered from an AC mains adapter that supplies a DC voltage in the range of 9 to 18 V. A voltage regu- lator (IC2) generates a stable 5-V supply voltage for the electronics from this. The supply voltage from the adapter is con- nected directly to the TI4427A MOSFET driver 1C that drives the clock coil. This driver 1C has a operating voltage range of 4.5 to 18 V and a maximum rated output current of 500 mA (1.5 A peak). This is ade- quate for most clocks. If you need more current, you can add a transistor or relay to the output stage. The clock coil has a fairly high inductance, so the supply voltage has extensive decoupling in the form of several ceramic capacitors (C1-C4) and an electro- lytic capacitor (C5). 54 elektor - 7-8/2009 CX> A DCF77 receiver/decoder module from Conrad Electronics (p/n 641138) provides the time reference signal. It is also pow- ered by the 7805 voltage regulator. The non-inverted output of this module is connected to port RA4 of the microcontroller. As reception of the long-wave signal from the DCF transmitter may not be good in some locations, especially if you fit the cir- cuit in a metal enclosure, it is advisable to fit the DCF module in a separate plastic box that can be placed a certain distance away from the clock. The source code of the software is written in Flowcode 3 Pro and is available free on the Elektor website for downloading (item number 090035-11). It is based on the software for the E- Blocks DCF clock published in the December 2007 issue (075094- 11). The original software has been adapted to this applica- tion and extended with code that generates a pulse signal on ports B6 and B7 with a period of 1 minute and alternating pulse polarity. Pushbutton switch SI is used for most of the operator functions. This button is connected to port A1 and has several functions: - if SI is not pressed when the power is switched on, the micro- controller executes a warm start. This is the normal situation. In the event of a power failure, the analogue time and the polar- ity are saved in EEPROM, and they are restored after the next warm start; - if SI is pressed when the power is switched on, a cold start is executed. This must be done the first time the circuit is used (see below for more information); -if SI is pressed during normal operation, the variables 'a_hrXX' and 'a_minuteXX' are shown on the display, which enables the user to set the analogue clock. In order to synchronise the analogue clock to the digital clock, the analogue clock must first be set to exactly 12 o'clock. If you have a clock that can only be operated electrically, which means it does not have any mechanism (such as a knob) to set the time manually, you can hold SI pressed after the cold start to cause the circuit to generate a continuous series of clock pulses. Release SI when the clock reaches exactly 12 o'clock. If you have a clock that can be set manually, first set it to 12 o'clock and then switch on power to the circuit with SI held pressed. Release SI when the message 'cold start. . . done' appears on the LCD. If the DCF signal is being received properly, the date and time will be shown on the display after a few minutes and the analogue clock will be set to the right time.; If the time shown by the analogue clock differs from the time shown on the LCD by one minute, the polarity of the pulses does not match the state of the stepper motor in the clock. This can be corrected by first setting the clock to the right time and then swapping the two leads. This action must be completed within one minute. ( 090035 - 1 ) Internet Link [1] www.elektor.com/090035 Product 090035-41: Programmed PIC Download 090035-11: Flowcode (.fcf) and hex files, from [1] a> to a> o_ o u to o u • IH a. Technology The new PicoScope 4000 Series high-resolution oscilloscopes ~ , ■ •' 5 - ’ * j - * E H — ’ IBB The PicoScope 4224 and 4424 High Resolution Oscilloscopes have true 12-bit resolution inputs with a vertical accuracy of 1%. This latest generation of PicoScopes features a deep memory of 32 M samples. When combined with rapid trigger mode, this can capture up to 1000 trigger events at a rate of thousands of waveforms per second. • PC-based - capture, view and use the acquired waveform on your PC, right where you need it Software updates - free software updates for the life of the product USB powered and connected - perfect for use in the field or the lab Programmable - supplied with drivers and example code Resolution 12 bits (up to 16 bits with resolution enhancement) Bandwidth 20 MHz (for oscillscope and spectrum modes) Buffer Size 32 M samples shared between active channels Sample Rate 80 MS/s maximum Channels PicoScope 4224: 2 channels PicoScope 4424: 4 channels Connection USB 2.0 Trigger Types Rising edge, falling edge, edge with hysteresis, pulse width, runt pulse, drop out, windowed www.picotech.com/scope1019 01480 396395 7-8/2009 - elektor 55 Frequency and Time Reference M with ATtiny231 3 Vladimir Mitrovic (Croatia) In this project an AVR microcontroller type ATtiny2313 acts as a variable frequency divider, giving a sequence of very stable ref- erence frequencies with a 50% duty cycle and covering a frequency range of 0.1 Hz - 4 MHz in 1, 2, 4 or 8 steps. The circuit is very simple because everything is done inside the micro- controller. In the program 31 different fre- quencies are predefined and may be selected by switches S1-S5 according to Table 1. The ATtiny2313 has two timers/counters: 16- bit Timer/Counterl and 8-bit Timer/CounterO, both offering various modes of operation. The 'Clear Timer on Compare Match' (CTC) mode is the most appropriate for generating a waveform output. In CTC mode Timer/Counterl counts the sys- tem clock or external pulses up to the value given in the OCR1A (ComparelA) register. When the counter value matches the OCR1A value the coun- ter is cleared to zero and the OC1A pin (PB3) toggles. In CTC mode Timer/ CounterO counts the system clock or external pulses up to the value given in the OCROA register. When the coun- ter value matches the OCROA value, the counter is cleared to zero and the OCOA pin (PB2) toggles. Division fac- tors up to 2 x 65536 (for Timerl) or 2 x 256 (for TimerO) can be obtained by setting appropriate values in the OCR1A and OCROA registers. Besides by the timer division factor, an output frequency is also determined by the system clock, the system clock pres- caler (1-2-4-8-16-32-64-128-256) and the timer prescaler (1-8-64-256-1024). In this design, an 8 MHz or a 20 MHz crystal may be used in position XI (20 MHz shown in circuit diagram) but not indiscriminately because matching firmware should reside in the ATtiny. There are obviously several appropriate set- tings for producing a given frequency. As the system clock and the system clock prescaler setting determine the overall current con- sumption as well (lower frequency = lower consumption), we will always choose the low- est possible CPU clock. Assuming XI = 8 MHz, for the 1 Hz to 4 MHz frequency range, only Timer/Counterl is used. It counts the (pres- caled) system clock pulses and the output frequency may be calculated from: f = 8,000,000 / [2 x system_clock_prescale x (1 + OCR1A_value)] For the lower frequencies, 8-bit Timer/Coun- terO is used as an additional prescaler (divi- sion factor: 10) between the prescaled system clock and Timer/Counterl. The latter is set in the counter mode and now counts pulses at the Timer/CounterO output pin OCOA (PB2); hence, the OCOA pin (PB2) and the external input pin T1 (PD5) are interconnected. The output frequency can be calculated as: f = 8,000,000 / [2 x system_clock_prescale x (1 + OCR1A_value x 2 x (1+OCR0A_value)] The program, which was written in BascomAVR, constantly monitors switches S1-S5. It is available as a free download [1]. If any change in the switch settings occurs, the 'Set_f' subroutine is called to set a new frequency. The subroutine will stop timers, reconfigure them, set proper values in var- ious registers to obtain the proper division factor and restart the timers. The values for the registers are written in three tables. 1 . 'Clock_prescale_table' contains the values in the range of 1 to 256 (only values 2 n are allowed) which will be used to calculate the proper value for the Clock Prescale Register, CLKPR. 2. 'Ocr1a_table' contains the values in the range of 1 to 65535 which will be used to calculate the proper value for the Timer/Counterl Output Compare Register OCR1A. Only values 5 n (1, 5, 25, 125, 625, 3125 and 15625) are used in this design. A zero (0) entry denotes that Timer/Counterl is stopped for this frequency. Note that the value in the table is decremented by 1 before being written into the OCR1A. 3. 'Ocr0a_table' contains the values in the range of 1 to 255 that will be used to calculate the proper value for the Timer/CounterO Output Compare Reg- ister OCROA. Only values 0 and 5 are used in this design: a '0' entry denotes that the Timer/CounterO is stopped for this frequency, while '5' produces division of the system clock by 10. If even lower frequencies are needed, other type-5 n values (25 and 125) can be used to produce division factors of 100 and 1000. Note that the value in the table is decremented by 1 before being written into the OCROA. The Fref_ATtiny2313_Elektor_8MHz.bas pro- gram should be compiled and the resulting hex code programmed into the ATtiny2313 microcontroller before first use. Be sure to set the Flash Fuse bits to the proper value for an external crystal resonator (CKSEL3...0 = 1111) because the internal RC Oscillator is selected by default. The hex file for 8 MHz is also avail- able straight away in the download at [1]. A variable capacitor C2 is provided to tune a crystal frequency to exactly 8.000 MHz, if C4 Cl □ S1...S5 -o o- -o o- -o o- -o o- -o o- lOOn 2 100|i 16V 11_ 8 20 © RST PD6 PD4 PD3 PD2 PD1 PD0 IC1 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 ATTiny2313 PD5 . XTAL2 XTAL1 10 C3 22p X1 . n * 19 18 17 16 15 14 13 12 Z 20MHz X +3V ... +5V — © ° _k r-o* <2> 080754 - 1 1 56 elektor - 7-8/2009 possible. If you are satisfied with the crystal's accuracy, replace C2 with a fixed capacitor. Set the configuration switches according to Table 1 to obtain the wanted frequency. Powered at 3 V, the 8-MHz version of the frequency reference may still be used with most logical families running at 5 V: CMOS, LSTTL, HC, HCT and so on. However, be care- ful and do not allow any current to flow from 5 V powered circuits back into the micro- controller through the PB3 pin. This could cause battery charging through the micro- controller's clamping diodes with unpre- dictable results for both the battery and the microcontroller. If such a risk exists, connect a 3 V zener diode between PB3 and GND to effectively limit the voltage to a safe value. Caution: ready-programmed device 080754 - 41 from the Elektor Shop is programmed for the 20-MHz configuration and does not work down to 3 V. Raising the supply voltage to 5 V will approx- imately double the supply current to 15 mA (max.), but it will also allow you to raise the clock frequency to 20 MHz and obtain some higher frequencies from the circuit. If current consumption is not an issue, you may con- template the use of a precision quartz oscil- lator to drive the microcontroller. The program Fref_ATtiny2313_Elektor_20MHz. bas will produce reference frequencies in the 0.001 Hz - 10 MHz frequency range in steps of 1, 2 or 5. The main difference with the 8 MHz program is that the timer prescaler for Timer/CounterO is used here in order to produce frequencies under 0.01 Hz. A table called "TimerO_prescale_table" is added to the program. It contains values '0' (if Timer/ CounterO is not used), T (if it is used but not prescaled) or '8' (if it is used and prescaled by the factor of 8). The frequencies supplied by the 20 MHz version are given in Table 2. The two low- est frequencies, marked by an asterisk (*) in the table, could not be obtained exactly, but the division error is well under the crys- tal tolerance and therefore may be totally neglected. ( 080754 - 1 ) Internet Link [1] www.elektor.com/080754 Downloads & Products Programmed Controller 080754-41 ATtiny2313, ready programmed, 20 MHz configuration Software 080754-11 Source and hex files for 8 MHz and 20 MHz Location: www.elektor.com/080754 Table 1. DIP switch settings for XI = 8 MHz S5 S4 S3 S2 SI PD4...PD0 Output freq. on on on on on 00000 4 MHz on on on on off 00001 2 MHz on on on off on 00010 1 MHz on on on off off 00011 800 kHz on on off on on 00100 400 kHz on on off on off 00101 200 kHz on on off off on 00110 100 kHz on on off off off 00111 80 kHz on off on on on 01000 40 kHz on off on on off 01001 20 kHz on off on off on 01010 10 kHz on off on off off 01011 8 kHz on off off on on 01100 4 kHz on off off on off 01101 2 kHz on off off off on oiiio 1 kHz on off off off off 01111 800 Hz off on on on on 10000 400 Hz off on on on off 10001 200 Hz off on on off on 10010 100 Hz off on on off off 10011 80 Hz off on off on on 10100 40 Hz off on off on off 10101 20 Hz off on off off on 10110 10 Hz off on off off off 10111 8 Hz off off on on on 11000 4 Hz off off on on off 11001 2 Hz off off on off on 11010 1 Hz off off on off off 11011 0.8 Hz off off off on on 11100 0.4 Hz off off off on off 11101 0.2 Hz off off off off on 11110 0.1 Hz Table 2. DIP switch settings for XI = 20 MHz S5 S4 S3 S2 SI PD4...PD0 Output freq. on on on on on 00000 10 MHz on on on on off 00001 5 MHz on on on off on 00010 2 MHz on on on off off 00011 1 MHz on on off on on 00100 500 kHz on on off on off 00101 200 kHz on on off off on 00110 100 kHz on on off off off 00111 50 kHz on off on on on 01000 20 kHz on off on on off 01001 10 kHz on off on off on 01010 5 kHz on off on off off 01011 2 kHz on off off on on 01100 1 kHz on off off on off 01101 500 Hz on off off off on oiiio 200 Hz on off off off off 01111 100 Hz off on on on on 10000 50 Hz off on on on off 10001 20 Hz off on on off on 10010 10 Hz off on on off off 10011 5 Hz off on off on on 10100 2 Hz off on off on off 10101 1 Hz off on off off on 10110 0.5 Hz off on off off off 10111 0.2 Hz off off on on on 11000 0.1 Hz off off on on off 11001 0.05 Hz off off on off on 11010 0.02 Hz off off on off off 11011 0.01 Hz off off off on on 11100 0.005 Hz off off off on off 11101 0.002 Hz* off off off off on 11110 0.001 Hz* off off off off off 11111 standby 7-8/2009 - elektor 57 M Frequency Divider with 50% Duty Cycle Roland Heimann (Germany) In digital circuit design, especially in micro- processor or measuring applications, it is often necessary to produce a clock signal by dividing down a master clock. The 4-chip solution suggested here is very versatile; it takes a 50% duty cycle input clock and out- puts a 50% duty cycle clock selectable (via an 8-way DIP switch) for every divisor from 1 to 255. The most complex chip in this design is IC1, an 8-bit down-counter which is 'programmed' by the binary value set up on the eight DIP switches. An edge detector circuit made up of IC3 and IC4 produces a pulse at every ris- ing and falling edge of the input clockf 0 . Each time the counter reaches zero a flip flop is toggled to produce a 50:50 mark/space ratio output signal. It does not matter if the gates used in the edge detector circuit are inverting or non- inverting; the only important points are that the correct number of gates are used and the delay time produced by each gate. The total propagation delay through seven HC type gates will be enough to generate a pulse of sufficient width to reliably clock the counter. Propagation delay is the time taken for a sig- nal at a gate's input pin to affect the output, and this is given in the data sheet. The edge detector produces a pulse on both the pos- itive and negative edges of the input clock signal. The down-counter decrements its value each time it receives a clock impulse on CP. When- Lionel Grassin (France) ever the counter reaches zero the terminal count pin (TC) generates a negative pulse, reloading the counter (via parallel load PL) with the binary switch setting. The counter continues counting down from this value. The JK flip flop IC3 is configured as a toggle type flip flop (both inputs J and K wired to a In the field of robotics, along with many other applications involving a motor (printers, for example), it is often necessary to measure a motor's speed and acceleration or direction of rotation. One simple technique is to fit a quadrature encoder to the shaft of the motor to be monitored. A quadrature encoder (see photo) is a device that produces two square- wave signals 90° apart as it turns. The direc- tion in which the encoder rotates determines which of these two signals is in advance (compared with the other), thereby making it possible to detect the rotation direction. An algorithm for detecting the rotation direction doesn't need to be complicated, but it does need to be fast enough to be able '1') the outputs Q and Q change state (toggle) on each rising edge of the TC output of IC1. The DIP switches are used to set up the divi- sion ratio, to divide the clock by 23 for exam- ple, set the DIP switches to the binary value of 23 i.e. 00010111 (setting P4, P2, PI and P0 to high). ( 080436 - 1 ) K to follow high speeds and speed variations. This can be achieved using programmable PIC Detects Rotation Direction 58 elektor - 7-8/2009 logic (FPGA, GAL, PAL, etc.), but the author wanted to use a small, cheap microcontrol- ler. He opted for the PIC12C509A from Micro- chip, an 8-pin microcontroller with six I/Os. Two inputs and one output are all the rota- tion direction sensor needs, so the little PIC is able to handle two quadrature encoders at the same time. The algorithm developed by the author operates asynchronously, which ensures a very wide operating range, dependent on the capabilities of the microcontroller. The algorithm loop time is 20 ps for a PIC12C50X using the internal 4 MHz clock, so it is theo- retically possible to follow a pulse signal of up to 50 kHz. This corresponds to a speed of 3,000 rpm for a motor fitted with a quad- rature encoder giving 1024 pulses per rota- Jeremie Hinterreiter (France) These days, music is a major hobby for the young — and not-so-young. Lots of peo- ple enjoy making music, and more and more dream of showing off their talents on stage. But one of the major problems often encountered is the cost of musical equip- ment. How many amateur music groups sing through an amp borrowed from a guitarist or bass player? This is where the technical problems arise — not in terms of the .25" (6.3 mm) jack, but in terms of the sound quality (the words are barely understanda- ble) and volume (the amp seems to produce fewer decibels than for a guitar). What's more, unpredicta- ble feedback may cause damage to the speakers and is very unpleasant on the ear. This cheap little easy-to-build project can help solve these technical problems. A guitar (or bass guitar) amplifier is designed first and foremost to repro- duce the sound of the gui- tar or bass as faithfully as possible. The frequency response of the amp doesn't need to be as wide or as flat as in hi-fi (particularly at the high end), and so this sort of amplifier won't permit faithful reproduction of the voice. If you build an adaptor to compensate for the amp's limited frequency response by ampli- fying in advance the frequencies that are then attenuated by the amp, it's possible to improve the quality of the vocal sound. That's just what this circuit attempts to do. The adaptor is built around the TL072CN low- tion. And all this for two motors/encoders at the same time! You can find all the details of the algorithm — and more — on the (French) website of the Fribotte team to which the author belongs [1]. The program (source code and hexadecimal file) is available on free download from the web page for this article [2]. ( 081164 - 1 ) Internet Links [1] http://fribotte.free.fr/bdtech/detectsens/detect- sens.html [2] www.elektor.com/081164 Download 081 1 64-1 1 : source code and hex file, from [2] M noise dual FET op-amp, which offers good value for money. The NE5532 can be used with almost the same sound quality, but at (slightly) higher cost. The circuit breaks down into two stages. The first stage is used to match the input impedance and amplify the microphone signal. For a small 15 W gui- tar or bass amplifier, the achievable gain is about 100 (gain = P1/R1). For more power- ful amplifiers, the gain can be reduced to around 50 by adjusting PI. The second stage amplifies the band of fre- quencies (adjustable using P2 and P3) that are attenu- ated by the guitar amp, so as to be able to reproduce the (lead) singer's voice as clearly, distinctly, and accurately as possible. To refine the adaptor and tai- lor it to your amplifier and speaker, don't be afraid to experiment with the com- ponent values and the type of capacitors. The circuit can readily be powered using a 9 V bat- tery, thanks to the voltage divider R4/R5 which con- verts it into a symmetrical ±4.5 V supply. ( 080188 - 1 ) C4 Vocal Adaptor for Bass Guitar Amp 7-8/2009 - eleklor 59 Guitar Pick-up Tone Extender David Clark (United Kingdom) This design extends the basic sonic possibili- ties of an electric guitar without the use of any electronic 'effects'. The expanded num- ber of tone possibilities is brought about by mixing continuously-variable amounts of the output from each of the guitar's pick-ups, along with switching the phase of each pick- up. This effectively gives an infinite range of tones as opposed to the five available for a normally switched set-up. This is not a proj- ect for the faint-hearted, however; it involves modifying the wiring to the guitar's pick-up coils and switches, and possibly the scratch- plate itself, depending on the chosen loca- tion for the replacement for the standard 0.25-inch (6.3-mm) jack connector. Use of a cheap 'copy'-style guitar is recommended! The standard 'Stratocaster'-style guitar fea- tures three pick-ups and a five-way switch that allows the player to select one of the fol- lowing combinations: • neck pick-up • neck and middle pick-up in parallel • middle pick-up • middle and bridge pick-up in parallel • bridge pick-up Guitarists keen to find new sounds from their instrument sometimes alter the wiring and add other switches to this arrangement, but this is of course not a flexible arrangement, and certainly not something that could be altered mid-performance playing for a crowd, no matter if a dozen or so in a pub or 20 k at Glastonbury! This project allows up to four pick-ups to be employed, since the bridge pick-up on a 'Stratocaster' is often a so- called 'humbucker' type, which can be split into two independent pick-ups, shown here as Bridge 1 (L3) and Bridge 2 (L4). The really intrepid among you may decide to build the circuitry in SMD and incor- porate a tiny board into the guitar. However, having four switches and four pots on the guitar may be too much of a good thing. The alternative is to wire the guitar pick-ups individually to v+ 60 elektor - 7-8/2009 guitar tone a 9-pin sub-D type connector that is added either to the guitar body or its scratchplate. The connector is linked to the input sub-D connector on the control unit via a long 'straight- through' serial interface com- puter cable. The Tone Extender circuitry may be built in a Vero style box, of which an exam- ple is shown in the photo- graph. Connection from the unit to an unmodified guitar amplifier is via a standard guitar lead. Each pick-up sec- tion consists of two opamps from a TL074 package, one inverter (e.g. IC1.A) and one buf- fer (e.g. IC1.B). Each has a nor- mal/invert switch (NOR/INV, e.g. SI) to select the phase of the signal compo- nent, and a 100-kQ linear law potentiome- ter at its output to set the desired level. The output signals of all four opamp sections are summed by IC3 (a TL071) which provides a suitably low output impedance to drive the guitar amplifier. Opamp IC4 splits the supply voltage obtained from 9 V (PP3) battery BT1 into symmetrical rails V+ and V-. Alternatively, a battery eliminator with a regulated out- put voltage of 9 V DC may be connected to K9, when the battery is automatically disconnected. Whatever method of construction is cho- sen, the unit effectively provides the guitar- ist interested in experimenting with unusual pick-up configurations a flexible way of quickly setting up and trying probably all possible variations, without having to get out the soldering iron and hard-wire each new idea. As such it should be an invaluable aid to allowing all manner of sonic possibili- ties to be realised. ( 080523 - 1 ) Lithium Battery Charger using BQ24103 Vcc* Steffen Graf (Germany) The BQ24013 is a simple-to-use charge con- troller suitable for use with lithium-ion and lithium-polymer batteries. A major advan- tage it has is that it includes integrated power MOSFETs capable of working with charge cur- rents of up to 2 A. Its switching frequency is high, at 1.1 MHz, and so only a small external coil is needed. In comparison to linear charg- ing circuits the switching topology offers a much higher degree of efficiency. A further benefit is that it is capable of charg- ing battery packs consisting of either a sin- gle cell or of two cells wired in series. Two LEDs indicate when the battery is being charged (D1 lights) and when the battery is fully charged (D2 lights). The charge current is set by the choice of external resistors [1]. There are three currents to set: the initial (pre- charge) current, the charge current and the charge termination current. With the component values given the pre- charge current is 67 mA, the charge cur- rent is 667 mA and the termination current is also 67 mA. The 1C of course ensures that the charging process is carried out correctly and in particular that the maximum permis- sible cell voltage is never exceeded: this is extremely important for lithium chemistry cells. Even more important is to note that jumper JP1 should be fitted only in the case where two cells are being charged. When charging a single cell the jumper must not be fitted, or there is a risk of explosion or fire as the charging voltage will be too high. The minimum supply voltage for charging a single cell is 5 V; for charging two cells it is 9 V. According to its datasheet, the 1C is specified for supply voltages of up to 16 V. Unfortunately the 1C is only available in a QFN20 package, which is rather tricky to 7-8/2009 - elektor 61 solder. In compensation, the tiny package does make it possible to build a complete 2 A charging circuit on less than 2.5 cm 2 of printed circuit board. For the prototype, with a charging current of 670 mA, we selected for LI a 4.7 pH inductor with a DC resistance (DCR) of 0.082 Q (82 mO) rated for a current (DCI) of 1.72 A. If a charge current of up to 2 A is wanted, an inductor with a DCR of less than 0.025 O (25 mO) and a current rating of 4 A or more should be cho- sen. For R5 we used a Vishay 150 mO SMD resistor in an 0805 package (available, for example, from Farnell), and for C3 a ceramic barrier-layer capacitor with a working voltage of 25 V. If an electrolytic capacitor is used it must have a very low ESR. An overview of the various versions of the 1C that are available can be found at [2]. For our prototype we used a type BQ24103A. (081147-1) Internet Links [1] www.ti.com/lit/gpn/bq24103a [2] http://focus.ti.com/docs/prod/folders/print/ bq24103a.html 12 VAC Dimmer Ri I — X P1 1 470qM — | \ \r 10k X 4 4V7 0W5 T1 X Qh ci 1 h J3 €) R2 D1 T2 R3 CM 0 D2 J4 %) I 4V7 0W5 ■ 0 — ■ TRI1 LAI 100W max. TIC225 MT1 MT2 MT2 R4 T1,T4 = BC559 (fi T2,T3 = BC550 1 270 h 2C « I G / MT1 1C TIC225 C2 lOOn e > CM 4 — ('X, ®- J 090370 - 1 1 Peter Jansen (The Netherlands) The circuit described here is derived from a conventional design for a simple lamp dimmer, as you can see if you imagine a diac connected between points A and B. The difference between this circuit and a normal diac circuit is that a diac circuit won't work at 12 V. This is the fault of the diac. Most diacs have a trigger voltage in the range of 30 to 40V, so they can't work at 12 V, which means the dimmer also can't work. The portion of the circuit between points A and B acts like a diac with a trigger voltage of approximately 5.5 V. The network formed by RI, PI and Cl generates a phase shift relative to the supply voltage. The 'diac equivalent' circuit outputs a phase- shifted trigger pulse to the triac on each posi- tive and negative half-cycle of the sinusoidal AC voltage. This works as follows. First consider the posi- Jochen Bruning (Germany) The circuit described here and its accom- panying BASCOM software arose from the need to control the temperature in a lami- nator. The laminator does include its own temperature controller, but it was not suit- able for the author's purposes (making printed circuit boards using a thermal trans- fer method [1]). The result (see circuit dia- tive half of the sine wave. Cl charges when the voltage starts to rise, with a time constant determined by Cl, RI and PI. T1 does not start conducting right away. It waits until the voltage across D2 reaches 4.7 V and the Zener gram) is based around an ATmega48 micro- controller with a 2-by-16 LCD panel and a rotary encoder. The base-emitter junction of an ordinary NPN power transistor in a TO220 package is used as the temperature sensor. Although this technique is not often seen, it is far from new: decades ago Elektor pub- lished a digital thermometer design with an NPN transistor pressed into service as the sensor. The approach has the advantage of M diode starts to conduct. Then cur- rent starts to flow, driving T1 and T3 into conduction. This produces a pulse at point B. The same prin- ciple applies to the negative half of the sine wave, in this case with D1, T2 and T4 as the key players. The trigger angle can be adjusted with PI over a range of approxi- mately 15 degrees to 90 degrees. C2 provides a certain amount of noise decoupling. Depending on the load, the triac may need a heat sink. You can use practically any desired transistors; the types indicated here are only exam- ples. If the circuit does not dim far enough, you can change the value of PI to 25 kO. This allows the trigger angle to be increased to 135 degrees. Note: this circuit works fine with normal transformers, but not with 'electronic' transformers. (090370-1) M a wide linear temperature range from -50 °C to +150 °C and the TO220 package is particu- larly convenient because it has a handy fix- ing hole and heatsink to allow good thermal contact. Note that the heatsink is electrically connected to the collector of the transistor, so it may be necessary to use an insulating washer. The BD243C is wired as a diode by connecting Simple Temperature Measurement and Control 62 elektor - 7-8/2009 +5V © K1 10 o o o o o o o- o o +5V © K2 1 o Q. ISP +5V 2 . ci □n 47u 16V MOSI RST SCK MISO R4 * l C* R3 R2 BD243C TEMP. PROBE * D3 D2 \l 33FSI 1 1 o > o D1 +5V jc2 ^^00n 23 24_ 25 26_ 27 28 21 C4 lOOn LI IOuH ' J ] 7 20 C3 lOOn VCC PC6(RESET) AVCC IC1 PCO(ADCO) PCI(ADCI) PC2(ADC2) PC3(ADC3) PDO(RXD) PDI(TXD) PD2(INT0) PD3(INT1/OC2B) PD4(T0/XCK) PD5(T1/OCOB) PC4(ADC4/SDA) PD6(AINO/OCOA) PC5(ADC5/SCL) PD7(AIN1) AT mega48 DIL28 PBO(ICP1/CLKO/PCINTO) PB1(OC1 A/PCINT1) PB2(SS/OC1 B) PB3(MOSI/OC2A) PB4(MISO) PB5(SCK) PB6(XTAL1/TOSC1) PB7(XTAL2/TOSC2) AREF GND AGND OPTPOCOUPLER LED X 11 12 13 14 15 16 17 18 19 10 22 LCD1 2x16 \ J (/) Q > (/) Q O (/> < oi-CMfO'3-miDi^ >>>cciriiJOQOOQoao +5V © 1 PI / V j^Ok DB5 R/W DB7 6 7 8 9 10 SI X -O i o- -o ROTARY ENCODER DB4 DB6 11 12 13 14 SI = ALPS EC11E15244BY 090204 - 1 1 its collector and base together and powered from the 5 V rail via a 4.7 kO resistor. A cur- rent of approximately 1 mA therefore flows through the diode. The voltage across the diode has a reasonably constant negative temperature coefficient of around -2 mV/K, and so the plot of voltage against temper- ature is reasonably straight. The voltage is measured using the ATmega48's internal A/D converter using input ADC5 on pin 28. A point to note is that we can use the 1.1 V internal reference voltage to obtain good precision when converting the diode voltage drop, which is around 0.6 V. Not all AVR-series microcontrollers have the 1.1 V internal refer- ence for the A/D converter, which should be borne in mind if modifying the design to use a different microcontroller. The set point for temperature control is entered using the rotary encoder in one degree steps. Turn the encoder to the right to increase the set point, to the left to decrease it. It is possible to set upper and lower thresh- olds for switching. If the rotary encoder has a pushbutton function, this can be used to select between setting the upper and lower thresholds; if not, a separate button must be fitted. The display consists of the LCD panel and two LEDs. The upper line of the LCD shows the measured temperature and the lower line shows the current set point (upper and lower temperature switching thresholds). PI adjusts the contrast of the LCD. The two LEDs show the state of the controller at a glance. If the blue LED (D2) is lit, the tem- perature is too low (below the lower switch- ing threshold); if the red LED (D1) is lit, the temperature is too high (above the upper switching threshold); and if both LEDs are lit the temperature is just right (between the lower and upper switching thresholds). Since at least one LED is always lit there is no need for a power indicator LED. The output of the controller is the logic level on pin 27 (PC4). The author used this to drive a solid state relay (SSR) in his application which in turn controlled the heating element in the laminator. The circuit diagram shows this as LED D3, which is intended to represent the LED in the optocoupler in the SSR. ISP connector K1 is optional and can be dis- pensed with if a ready-programmed micro- controller is used (see 'Downloads and prod- ucts'). It will then not be possible to calibrate the temperature reading, as this can only be done in the software using the ISP inter- face. However, for many one-off applications it will be sufficient to determine the upper and lower switching thresholds experimen- tally, including compensation for any error in the temperature measurement. Details of the control process can be found by inspecting the BASCOM source code. Cali- bration of the temperature measurement, as mentioned above, is done by directly mod- ifying the software. Remove the comment characters (') from lines 105 to 107 of the program, and comment out lines 108 to 110 by adding a single inverted comma at the start of each. The display will now show the conversion results from the A/D converter in the ATmega48. Immerse the sensor in a mixture of ice and water and wait until the reading stabilises. Note down the conversion result (or take a number of results and aver- age them for better accuracy). Now immerse the sensor in boiling water and repeat the procedure. Replace the number 546 in line 86 of the source code with the conversion result for the ice-water mixture. Now sub- tract the conversion result for boiling water from the ice-water result and divide by 100: substitute the answer for the value 2.460 in line 87 of the source code. As indicated at the start, we assume in this calibration that the conversion result versus temperature relationship is linear. We can write this in the form y = mx + c, where c is the A/D conversion result at 0 °C (the inter- cept of the A/D conversion result axis) and m is the (negative) slope of the base-emit- 7-8/2009 - elektor 63 ter junction voltage-temperature character- istic, calculated by dividing the difference between the conversion results at 0 °C and 100 °C by 100. These two numbers allow you map any conversion result into a correspond- ing temperature. ( 090204 - 1 ) Internet Links [1] http://thomaspfeifer.net/direct_toner_pcb.htm [2] www.elektor.com/090204 Download 090204-1 1: source code files, from [2] Product 090204-41: ready-programmed ATmega48 microcontroller USB Switch Rainer Reusch (Germany) Anyone experimenting or developing USB ported peripheral hardware soon becomes irritated by the need to disconnect and connect the plug in order to re-establish communica- tion with the PC. This proc- ess is necessary for exam- ple each time the peripheral equipment is reset or a new version of the firmware is installed. As well as tiresome it eventually leads to exces- sive contact wear in the USB connector. The answer is to build this electronic isolator which disconnects the peripheral device at the touch of a button. This is guaranteed to reduce any physical wear and tear and restore calm once again to the workplace. The circuit uses a quad analogue switch type 74HC4066. Two of the switches in the pack- age are used to isolate the data path. The remaining two are used in a classic bistable flip-flop configuration which is normally built using transistors. A power MOSFET switches the power supply current to the USB device. Capacitor C2 ensures that the flip flop always powers-up in a defined state when plugged into the USB socket ( 7 B 7 in the diagram). The peripheral device connected to USB socket TV will therefore always be 'not connected 7 until pushbutton S2 is pressed. This flips the bist- able, turning on both analogue gates in the IRFD9024 data lines and switching the MOSFET on. The PC now recognises the USB device. Pressing SI disconnects the device. The circuit does not sequence the connec- tions as a physical USB connector does; the power supply connection strips are slightly longer than the two inner data carrying strips to ensure the peripheral receives power before the data signals are connected. The electronic switch does not suffer from the same contact problems as the physical connector so these measures are not required in the circuit. The simple circuit can quite eas- ily be constructed on a small square of perforated strip- board. The design uses the 74HC(T)4066 type analogue switch, these have better characteristics compared to the standard 4066 device. The USB switch is suitable for both low-speed (1.5 MBit/ s) and full-speed (12 MBit/s) USB ports applications but the properties of the ana- logue switches and perf-board construction will not support hi-speed (480 MBit/s) USB operation. The IRFD9024 MOSFET can pass a current of up to 500 mA to the peripheral device with- out any problem. ( 080848 - 1 ) IRFD9024 64 elektor - 7-8/2009 COMPILERS mlkroilektronika DEVELOPMENT TOOLS | COMPILERS | BOOKS Now you need a... COMPILER mikroC mlkroBasic mlkroPascal u-.Ffcsa I PIC 24 AVR .W V 5 u y ■ i j- 4i ^ S'J* >ri r’ X * * Ti. - Q. JJ B % i 13 jfl jf t ■: ■ | % i ralvn bJ 5T * ■T r^ln * WTH| 1 1 «, *•■1 lf #1 ^rm- ■ k Mr- ■ Lit- in ■ l'_t M «U=*M P iTX- p ? n in- ah ■ i r.=- qa >■'■0 O I l3 -« -JW I " I % P ■ua u . | ifiidi ia -i Elai im M h . 4 11 . h - , .JW __ .. . , Hlri i-*«™ WmtnF rp SB i- ■ ‘■quhi has iu 4 n 1= l ■ h .1 ! a nm i|. J ftrCM jm I IMh k ■*_ rar i ■ v ■ 1 kdCfft wm H a H i.ra » Y H 1 • wmm L m LT" ■■ If l% IB ■ -r Lira- m ’i ■ nr nil 1 p|m li-r m ■ j 4 ■ r Kfi 1 S 4f" fi m L n-^pi l a , _ - r jwwi ■ HI h&JH H! ■ri ■ ■KIIPVTI* Hi" s r hF ■ 1 ■ ■ 1 i - ... rr*j ■ Li ■ 1 1 F ■’* ' LI - uwiw^ c* G H 1 i_F I Pd V - ■ I •? -ra Pi Supporting an impressive range of microcontrollers, easy-to-use IDE, hundreds of ready-to-use functions and many integrated tools makes MikroElektronika compilers one of the best choices on the market today. Besides debugger, mikroElektronika compilers offer a statistical module, simulator, bitmap generator for graphic displays, 7-segment display conversion tool, ASCII table, HTML code export, communication tools for SD/MMC, UDP (Ethernet) and USB, EEPROM editor, programming mode management, etc. Built-in and Library Routines with examples: - ADC Library - CAN Library - CANSPI Library - Compact Flash Library - EEPROM Library - Ethernet PIC18FxxJ60 Library - SPI Ethernet Library - Flash Memory Library - Graphic LCD Library - T6963C Graphic LCD Library - I2C Library - LCD8 Library - Manchester Code Library - Multi Media Card Library - OneWire Library - PS/2 Library - PWM Library - RS-485 Library - Software I2C Library - Sound Library - SPI Library - USART Library - Keypad Library - LCD Library - LCD Custom Library - Util Library - SPI LCD Library - SPI LCD8 Library - SPI Graphic LCD Library - Port Expander Library - Software UART Library - SPI T6963C Graphic LCD Library and many more... http://www.mikroe.com/ SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD PROJECTS ELECTRIC VEHI ElektorWheelie In this first article describing our DIY self-balancing single-axle vehicle we look at the electronics modules. An ATmega32 processes the controls and sensor data and drives the two electric motors via power driver stages. It keeps the vehicle balanced and can drive it in any desired direction at any desired speed from stationary to about 1 1 mph. The electronics in the ElektorWheelie processes input signals from a control potentiometer, an acceleration sen- sor and an inclination sensor. It con- trols the magnitude and direction of the torque applied to the wheels via two motors using PWM signals and MOSFET drivers. The sensors provide enough information to allow the vehi- cle to maintain its balance over its full range of speeds, and it can even spin on the spot. Characteristics • Two 500 W DC drive motors • Two 12 V lead-acid AGM batteries, 9 Ah • Two fourteen-inch wheels with pneumatic tyres • H-bridge PWM motor control up to 25 A • Automatic power off on dismount • Fail-safe emergency cutout • Battery charge status indicator • Maximum speed approx. 1 1 mph (18 km/h) • Range approximately 5 miles (8 km) • Weight approximately 35 kg Sensors: • Invensense IDG300 (or IDG500) gyroscope • Analog Devices ADXL320 accelerometer • Allegro ACS755SCB-100 current sensor Microcontrollers: • ATmega16 (motor control) • ATtiny25 (current monitoring) Compiler: • BASCOM-AVR Basic compiler 66 elektor - 7-8/2009 A delicate balance For the vehicle to be able to balance successfully it is essential that the sensors provide reliable information about the inclination of the platform and its angular velocity. This is in addition, of course, to ensuring that the control system, motor drivers and motors themselves are properly designed. Balancing itself is relatively straightforward. If the rider leans forwards the platform tilts and the motors are driven so as to bring the whole sys- tem (vehicle plus rider) back towards balance. That means that the rider's feet are pushed forwards under the centre of gravity of the whole sys- tem, opposing the rider's leaning and reducing the tilt angle. The system therefore tilts as a whole, which requires both a strong mechanical construction and a carefully designed and experimentally tested filter function. The damping characteristic of the filter is set just short of the point where the system starts to become unstable. Steering is performed by applying differential acceleration or braking to the two motors. Note that at higher speeds the tightness of the turning circle has to be limited. In the ElektorWheelie the limit is set so that the rider cannot overturn the vehicle by trying to change direction suddenly. No motor has an infinite amount of power. In the case of the ElektorWheelie there is the potential for serious consequences for the rider if a mo- tor does not have enough power headroom to allow for balance to be maintained. For this reason the motors are normally only driven up to approximately 70 % of their maximum power. This keeps a little in reserve so that, when top speed is reached, the wheels can be given a small extra acceleration. This throws the rider back slightly, which automatically leads to a reduction in speed. Leaning back slows the vehicle down, leaning forwards speeds it up. The drive train is based on two 500 watt DC electric motors, with power being provided by two 12 V AGM (absorbed glass mat) lead-acid batteries. Most of the electronics is located on a control board, with a sen- sor board mounted on it. The control system uses dynamic sta- bilisation. The vehicle senses the atti- tude of its platform in an analogous way to the human sense of balance. If the platform starts to tilt forwards or backwards, the vehicle makes a pro- portional acceleration to oppose the tilt using both motors. By applying different amounts of drive to the two motors, the vehicle can turn. Block diagram Central in the block diagram of the attitude control and motor drive unit shown in Figure 1 is an Atmel ATmega32 microcontroller. This has two PWM outputs that are used to drive the two 24 V DC motors via a pair of MOSFET H-bridges. A second microcontroller, an Atmel ATtiny25 this time, monitors the motor current using a Hall effect sensor. If an excessive cur- rent (over 80 A) should flow because of a short circuit in the system, the ATtiny25 interrupts the 15 V power supply to the H-bridge driver circuitry using the shutdown input of its regula- tor. In the event of a total failure of the control electronics the battery current can also be interrupted using a purely electromechanical emergency stop device, providing the ultimate protec- tion against the vehicle running out of control. In normal operation the ATtiny25 will also notify the ATmega32 when the motor current exceeds a preset value of around 25 A, which will cause the controller to attempt to reduce the cur- rent by limiting the range of the PWM control signals. The ATmega32 receives sensor inputs Figure 1. Block diagram of the motor controller. 7-8/2009 - elektor 67 ELECTRIC VEHICLE Figure 2. Circuit diagram of the sensor board with gyroscope and accelerometer. using its ADC (analogue-to- digital converter) from the gyroscope and the acceler- ometer on the sensor board and from the high-reliabil- ity potentiometer that is mechanically connected to the steering control of the ElektorWheelie. The ADC inputs are sampled around 100 times per second. As a further safety fea- ture a footswitch is con- nected to an input of the ATmega32. If this switch is not held down (because the rider has dismounted) the microcontroller will interrupt the motor current after two seconds. This also helps to prevent the vehicle from running away on its own. The battery voltage is also monitored by the ATmega32 using its ADC, and used to drive three LEDs that indicate the remaining available run- ning time to the rider. Sensors and stabilisation The attitude sensors are mounted on their own small printed circuit board that plugs into the main control board. Figure 2 shows the circuit of the sen- sor board, which includes an Inven- sense IDG300 [1] two-axis gyroscope and an Analog Devices ADXL320 [2] two-axis accelerometer. Voltage reg- ulator IC3 provides the required 3 V supply for the sensors; this voltage also serves as the reference voltage for the ATmega32’s A/D converter on the main board. The output of the gyroscope is a volt- age proportional to the rate at which it is turning (its angular velocity). If the platform is tipping rapidly there will be a large and rapid swing in the gyroscope’s output voltage. When sta- tionary the output voltage of the gyro- scope is approximately half its supply voltage. The accelerometer measures the com- ponent of the acceleration due to gravity in its own plane. If the sen- sor is tilted this will affect the angle at which gravity acts relative to the device, which therefore operates as an inclination sensor, delivering an out- put depending on the attitude of the platform. To obtain the best possible stability it is important to determine the attitude of the platform as accurately as pos- sible at each instant in time. The out- put of the accelerometer is therefore integrated over a relatively long time period to obtain a smoothed signal. To this smoothed result is added the out- put of the gyroscope, in proportions that have been empirically optimised. The acceleration signal delivered to the motor controller is calculated as a preset linear combination of the atti- tude error (the difference between the actual inclination angle and the tar- get inclination angle) and the angular velocity with which the platform is tip- ping. In essence, the greater the atti- tude error and the greater the angular velocity, the greater the motor accel- eration required for stabilisation. Motor control The circuit diagram of the main printed circuit board in Figure 3 contains all of the control circuitry of the Elektor- Wheelie, including the power driver stages. Only the attitude sensors, as mentioned above, are mounted on a separate board. It is fairly easy to identify the com- ponents corresponding to the vari- ous parts of the block diagram. In the centre is the ATmega32, clocked at 16 MHz. It is directly connected to 10- way in-system programming (ISP) con- nector K4 and to the three LEDs, LED1 to LED3, that show the battery status. The sensor board is connected to K2 on the control board. The X-axis and Y-axis out- puts of the sensors are connected to A/ D converter inputs ADC2 to ADC5 on the ATmega32, and pin 32 (AREF) is fed with 3 V from the volt- age regulator on the sensor board. The 3 V supply is also taken to K3 where it pro- vides power to the steering potentiome- ter. The wiper of this potentiometer thus provides a voltage to analogue input ADC 6 on the ATmega32 that depends on the position of the steer- ing control. Analogue input ADCO measures the battery voltage via the voltage divider com- prising RIO and Rll, and ADC7 moni- tors the position of the footswitch via K3. The fault detection signal (CURR- FLAG) is taken to pin 16 (INTO) of the ATmega32 from the ATtiny25 current monitor IC10, which in turn is con- nected to current sensor IC5. IC5 is an integrated Hall effect sensor from Alle- gro Microsystems offering linear oper- ation up to 100 A. CURRFLAG is set if the current reaches approximately 25 A and causes the motor current to be limited by bounding the range of the PWM drive signal. We now turn to the output signals of the ATmega32. The result of process- ing the various inputs to the microcon- troller appear as the signals on the four outputs PWM-L, PWM-R, CW/CCW-A and CW/CCW-B, on pins 18 to 21. CW/ CCW-A and CW/CCW-B are logically combined with the PWM outputs PWM- L and PWM-R in IC8 and IC9 is such a way that they determine the direc- tion of rotation of the motors, while the PWM signals control the current deliv- ered to the motors via the H-bridges. Each motor thus has two control sig- nals and a complete H-bridge driver, Figure 3. Circuit diagram of the main board, including control and power electronics. 68 elektor - 7-8/2009 7-8/2009 - eleklor 69 ELECTRIC VEHICLE Figure 4. The batteries and electronics module are mounted on the underside of the metal chassis. and each H-bridge is composed of two half-bridge driver ICs type IR2184 and four IRF4105 MOSFETs. The left wheel motor is driven by IC1, IC2 and T1 to T4, while the right wheel motor is driven by IC3, IC4 and T5 to T8. The MOSFET bridge circuits are pow- ered from the 24 V supply derived from the two lead-acid AGM batteries in series via current sensor IC5. The half-bridge driver ICs receive their own 15 V supply from the MIC2941 voltage regulator IC11. This IC has a shutdown input (pin 2) that is con- nected to the ‘enable’ output signal from the current monitoring circuit (pin 5 on IC10). When excess current is detected this signal shuts down the regulator and hence also the bridge driver ICs. The MOSFETs then block and the motor current is interrupted. All the other ICs are powered with 5 V from IC6, a standard regulator. A compact module Figure 4 shows the metal chassis of the vehicle. The electronics module (Figure 5), comprising the main board (Figure 6) and the sensor daughter board (Figure 7) is mounted on the underside of the platform. The eight MOSFETs are positioned in a row on the reverse of the main board and are cooled using a specially- designed common heatsink. The heat- sink is bolted to the printed circuit board and the MOSFETs are held on to the heatsink using spring clips. A self- adhesive thermally conductive sheet between the MOSFETs and the heat- sink provides electrical isolation. The main board contains only leaded devices, in contrast to the SMD -popu- lated sensor board. The printed circuit board layouts are as usual available for free download from the project web pages [3] as PDFs, along with associ- ated parts lists. Software The firmware for the two microcontrol- lers was written using BASCOM-AVR. Figure 8 gives an overview of the main functions involved in controlling the motors, which will be described briefly below. Function Init: This function initialises and configures TimerO, Timer 1 and the PWM outputs, initialises variables and calibrates the gyroscope, accelerometer and steering potentiometer. Function Get Angle: This function reads values from the analogue inputs (gyroscope, ADXL320, potentiometer, battery voltage and footswitch). The gyroscope, ADXL320 and battery voltage readings are inte- grated over a period of fifty samples. 70 elektor - 7-8/2009 Then the angular velocity (Angle_Rate) and absolute angle (Tilt_angle) are calculated. Function Filter: This function calculates the change in acceleration required of the motors (Balance_Diff) and the overall motor speed (Drive_Speed). Function Process: This function uses the current speed and the position of the steering control to calculate the necessary modification to the speed of the motors to turn the vehicle as requested. It checks to see if the ATtiny25 has reported an overcur- rent condition and reduces the motor speed (Drive_speed) if needed. The overcurrent condition and footswitch alarm states are indicated by the LEDs flashing. The function calls Get_speed_batt. Function Get speed batt: This function adds a value Angle_Cor- rection in the case where the maxi- mum speed is exceeded. It also sets the state of the three LEDs according to the battery voltage. Function PWM Out: This function configures the PWM outputs according to the acceleration required for motors A and B, and sets the other outputs to reflect the desired rotation direction. The function also imposes a limit on the maximum drive power (PWM_MAX). Function interrupt: This function is called 100 times per second. In turn it calls Get_Angle, Fil- ter, Process and PWM Out. Mechanics In the second and final part of this series we will look at the mechanics of the ElektorWheelie. We will describe the construction of the vehicle and out- line how it is assembled and wired. Finally we will give a few tips on how to drive the vehicle and some further practical suggestions. ( 090248 - 1 ) Internet links [1 ] http://www.invensense.com/shared/pdf/ DS_IDG300.pdf [2] http://www.analog.com/static/imported-fi- les/data_sheets/ADXL320.pdf [3] http://www.elektor.com/090248 Function Get_Angle Function Interrupt - read A/D channels - calculate angular rate and angle - integrate gyro value - integrate ADXL value deactivate interrupt gosub Get_Angle gosub Filter gosub Process gosub PWM Out Function Filter - calculate balance moment - calculate Drive_Speed activate interrupt Function Process - calculate steering movement - calculate motor speed - check current flag - gosub Get_speed_batt Figure 6. Control software functions. DISCLAIMER & CAUTIONS • The ElektorWheelie vehicle is an Open Development. The buyer is free to make changes and modifications to the hardware or software of the ElektorWheelie kit, at his/her own risk. • The use of ElektorWheelie on public roads or in public spaces may be illegal and/or subject to legislation and type approval. No type approval has been applied for and owners are advised to check local or national legislation for any use other than on private land, or with the land owner's permission. Elektor International media BV accepts no responsibility in this respect whatsoever. • Under the terms of an Open Development Elektor International Media cannot be held liable for any damages, penalties or injuries caused by, or arising from, the use, ownership or assembly of the ElektorWheelie vehicle. 7-8/2009 - elektor 71 Load Protection for Audio Amplifiers Joseph Kreutz (Germany) In order to be effective, any pro- tection device connected between an audio amplifier output and the speakers needs to connect the load only after a few seconds' delay, disconnect it immediately the mains supply is turned off, and prevent any high-level DC component from being able to damage the loudspeakers. As the circuit suggested here can read- ily be 'grafted' onto any existing circuit, it merits the title 'univer- sal'. The circuit diagrams in Fig- ures 1 and 2 relate to a prototype fitted to an amplifier producing 50 W into 8 O, with a ±35 V power supply. This circuit can be readily adapted to other supply voltages, and hence to other audio power outputs. The appropriate values for R1, R2, R8, R15, and R19, along with the operating voltages for Cl and C3 and the choice of semicon- ductors D9, D10,T1,T2, and T3 are given in Table 1. Circuit operation is simple: when the ampli- fier is turned on, the voltage at the junction of bridge rectifier B1 and diode D1 quickly charges capacitor C7 via resistor R3. Capacitor C 7 avoids mains zero crossings causing spu- rious triggering. When the upper threshold voltage of ICIa is reached, its output goes low. At this moment, C6 is gradually charged via R5, and once the voltage across it reaches the required value, ICIb output goes high and turns relays RE1 and RE2 on via tran- sistors T2 and T3. This process produces a delay of around 5 s. In order for us to be certain that ICIb output starts off low, the initial voltage across C6 must be zero. So this capaci- tor is connected directly to the +5 +V S S(RE) V rail. This circuit works by determining volt- age thresholds: this means that we need to choose an SN74HCT132 quad Schmitt NAND gate for IC1. Gate ICIc inverts the relay control signal and feeds it to one input of ICId, which then oper- ates as an oscillator, making LED D8 flash at around 4 or 5 Hz during the delay period. +VSS(RE) (±>— RE ~>0~ ♦o R15 1W I 1 Oo t* y si- r t i — 1N4148 T2 Q> BC639 +10V R9 R13 — | 1k5 | — " Dll ? AMP +10V ©- R12 -| 470k h ©- -10V Oil lOOn C12 lOOn © IC2 IC2 = LM339 ( 12 ) C9 2u2 RIO R11 R17 ii — | 1k5 h D12 ¥ D13 D15 til 5V1 D14 -10V 5V1 D16 R16 -| 470k h CIO 2u2 As soon as the relay control sig- nal goes high and the relays turn on, the ICId oscillator is disabled and LED remains constantly lit. The LED is powered directly from the HT rail across Cl, and 3.3kO resis- tor R8 limits the current through it to 10 mA. As shown in Table 1, the value of R8 depends on the supply voltage and hence on the power of the amplifier to which the protec- tion circuit is to be connected. As soon as the mains is turned off, ICIa output goes high and capaci- tor C6 discharges rapidly through D2, which then causes ICIb out- put to go low and the relays RE1 and RE2 to turn off almost imme- diately. So the amplifier load is isolated instantly and the circuit re-armed so as to produce the required delay next time mains power is applied. Detection of any DC component is performed by IC2, an LM339 quad comparator. The networks C9/R12 and C10/R16actas low-pass filters: they atten- uate the audio signal very heavily, but if any DC voltage is present on the amplifier output, it will be fed to IC2's comparator inputs. If it exceeds ± 3.75 V, at least one of the compa- rators will output a 'low' signal, and thus turn off the corresponding relay control transistor. The load will remain isolated as long as the fault condition continues. This signal will also cause current to flow in the LEDs Dll or D12, indi- cating that the protection has been activated. Zener diodes D13 to D16 provide over-voltage protection for the comparator inputs. It's wise to make sure that R12 and R16 are indeed cor- rectly connected to the amplifier outputs and not to the relay con- tacts feeding the loudspeakers. The choice of relays is not really critical: any R19 1W tw *1 1N4148 ’ -it- R1 R2 C2 C4 1 a +5V -© R10 D1 Cl I 1 M. SFH487 SFH309FA X II lOOn R5 h im r T1 R 3 |R 4 -D 0 0 v / V PI 10k R6 II lOOn R7 \ 560k F R8 D2 T2 BC547 R13 D3 C5 ® 2 ici 100n (4 ) D4 8 +5V -© R12 R11 © R THR IC2 OUT DIS NE555 TR CV Jj =M4 1 a 0 CM CM 2 t—i 5 C7 lOn T3 C6 Gr BC547 2|a2 080831 - 1 1 Powering a Second Hard Drive Leo Szumylowycz (Germany) Just about every hands-on computer builder knows the problem: you've acquired an extra hard drive or cooling fan but there are no spare cables or connectors to power these additional components inside the computer case. In situations like this splitter cables, also called Y-cables, can be a blessing. But what if you don't have one of these to hand and the local computer shop is closed? There's only one thing for it — DIY! As tasks go, splicing in an extra cable is not particularly difficult, as long as you have sharp eyesight. All you need is a second power cable and a choc block ter- minal strip and the job's done. It works ade- quately (for a while) but it doesn't look partic- ularly attractive, reliable or professional. A more elegant solution would be to sol- der the new power cable direct to the cor- responding connector of the existing device. Elegant, yes, but not particularly straightfor- ward, since the power supply rails are seldom easy to get at, whilst the metal pins of indi- vidual power connectors are of course buried inside their plastic shell. A little trick involving the sleeves that go on the ends of wires will enable you to extract the pins as far out of the retaining mount as needed to solder onto the rear of these pins additional wires for the accessory device you wish to install. We need two types of sleeves, 4 mm (0.16") for the plugs and 6 mm (0.24") for the sockets. First of all the contact on the cable is pressed hard into the plastic retainer to ensure the restraint spring grips cleanly and fully. Next we attach wire sleeves to the pin that we are extracting and push it carefully and slowly into the plastic retainer as far as the latch and end stop. Just before this point is reached you will feel some resistance, with 7-8/2009 - elektor 77 a click sound heard after you have overcome the pressure. Exactly as this click is heard you need to remove the wire in question, with its pin, from behind out of the plastic housing. If this doesn't work exactly as desired, it can help to twist the sleeve around while you are pulling. Normally you can release about four pins using one sleeve. For assured reliability, however, it is recommended to use several sleeves. The free ends of the additional cable should be soldered (using great care and as little sol- der as possible, as shown in the photo) to cor- responding pins close up against the exist- ing cable. Any unwanted solder blobs are best removed with desoldering braid (sol- der wick). Finally we need to bend the con- tact springs gently outwards and press each pin back into its right position. You will find the longer sizes of sleeve are easier to han- dle, also that the individual parts of the con- nectors move around more easily if you spray them first with contact lubricant. ( 090201 - 1 ) Two-button Digital Lock Francis Perrenoud (Thailand) Now here's a digital lock unlike any other, as it has only two buttons instead of the usual numeric keypad. The way it works is as simple as its keypad. Button SI is used to enter the digits of the secret code in a pulsed fashion — i.e. the number of times you press the but- ton is determined by the digit to be entered. A dial telephone uses the same type of cod- ing (now maybe there's an idea?). Press four times for a 4, nine times for a 9, etc. Press- ing button S2 indicates the end of a digit. For example, to enter the code 4105, press SI four times, then press S2, then SI once, S2 once, then without pressing SI at all, press S2 again, then finally SI five times and S2 once to finish. If the code is correct, the green LED D1 lights for 2 seconds and the relay is ener- gised for 2 seconds. If the code is wrong, the red LED D2 lights for 2 seconds, and the relay is not energised. To change the code, fit a jumper to J1 and enter the current code. When the green LED D1 has flashed twice, enter the new 4-digit code. D1 will flash three times and you will need to confirm the new code. If this con- firmation is correct, D1 will flash four times. If the red LED D2 flashes four times, some- thing's wrong and you'll need to start all over again. To finish the operation, remove the jumper and turn the power off and on again — the digital lock is now ready for use with the new code. The software can be found on the webpage for the project [1]. Don't forget to erase the M microcontroller's EEPROM memory before programming it, so you can be sure that the default code is 1234 and not some- thing unknown that was left behind in the EEPROM. A little exercise for our readers: convert this project into a single-button digital lock — for example, by using a long press on SI instead of pressing S2 to detect the end of a digit. ( 090127 - 1 ) Internet Link [1] www.elektor.com/090127 Download 090127-11: Source codes and Hex file, from www.ele- ktor.co m/090 127 78 elektor - 7-8/2009 &GnpApl rkPfGff ^j]iAi r jnii>.nf /. ffflYrnri: y.yhr™ SALES COUNTER h^= NOW OD&n ^om/iiy Iq f r irfffr ?. A Sol l t IJO □nliMniuufiM* SWO MW Sold^rurj Statton T-^lden'ng Jrnn Tjpj, 1- A#- As ftAUt T34 iln Tiin-d IVc Idlf-n iuitcfi Testpins.co For “e jj p.ijift j ftrafrv MYjfl PVWI#.4fiir^MriS-.CO.U+ www, p c b - so I deri ng , co.u k itV^k^EktW^UdL*:* 7 **4 rtl|IWv 4HTB &£fr+S*f*>^0 4fli u* P-msI Ik-Ahuton. htorl kntihi Tt C.s+1 1 tff I • 4 * E iHigHb'k^t)i"'3w :* \ ElektorWheelie Elektor's DIY self-balancing vehicle Order before Everyone agrees; the internal combus- tion engine is coming to the end of its life cycle. However you don't need to go to the expense of a Prius or Tesla to experience the future of transportation devices. If you would prefer something more personal (and don't mind turning a few heads) why not build the astonishing ElektorWheelie? First take two electric motors, two rechargeable batteries and two sensors, now add two micro- controllers and the ElektorWheelie is ready to transport you in style to your destination. ptember 2009 £85 DISCOUNT. 1 Se US$150) “Tlektor -fc* SHOP Actual product may differ from illustration. \ Characteristics Two 500 W DC drive motors Two 1 2 V lead-acid AG M batteries, 9 Ah Two fourteen-inch wheels with pneumatic tyres H-bridge PWM motor control up to 25 A Automatic power off on dismount Maximum speed approx. 1 1 mph (1 8 km/h) Range approximately 5 miles (8 km) Weight approximately 35 kg The kit comprises two 500-watt DC drive motors, two 1 2-V lead-acid AGM batteries, two 1 4-inch ABS wheels, casing, control lever and assembled and tested control board with sensor board fitted on top. Art.# 090248-71 • £1380 • € 1599 • US$2275* (reduced price till 1 September 2009: £1295 • € 1499 • US$2125) 5 *lnd. VAT, excl. shipping costs. Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 Further information and ordering at www.elektor.com/wheelie 7-8/2009 - elektor 79 Wireless Baby Monitor M Wolfgang Papke (Germany) Ton Giesberts (Elektor Labs) Walkie-talkies (also known as handheld or PMR, Personal Mobile Radio) can be bought at low prices even from department stores, and they can be operated without a licence in many countries. Considering the low cost, such a set would be very suitable for use as a wireless baby monitor, with the addition of several external components. These are connected to the jack sockets for an external loudspeaker/microphone and an external PTT (Push-To-Talk) switch, which are often found on these devices. The walkie-talkie with the extra electronics and microphone is placed in the baby's room. When the PTT switch on the other walkie- talkie is actuated for about a second the 'baby' walkie-talkie produces a series of tones, which the external electronics can detect. This then activates its own PTT switch for about 5 sec- onds, so it switches over to transmit. During this time the other device can hear what the external microphone picks up. Figure 1 shows the circuit that the author designed for this. It has been designed spe- cifically for a Tevion 3000 PMR sold some time ago by Aldi. This type of PMR has a combined jack socket that includes all the required connections. The voltage present on the PTT connector is used to generate the supply voltage for the circuit via R3, D1 and C1/C2. When the loud- speaker output presents a series of tones (when the PTT switch on the other walkie- talkie is held down), it causes T1 to conduct. This also turns on T2 and T3, so that the exter- nal microphone is connected to ground. The resulting current that flows through the microphone should be sufficient to activate the PTT circuit in the walkie-talkie, causing it to transmit. If the external microphone doesn't draw sufficient current, a resistor (R8) should be connected in parallel. Some experimentation with the value of this resis- tor may be required. If you want to make use of the internal microphone then R8 should be replaced with a wire link. When the walkie-talkie switches to trans- mit the built-in amplifier stops producing a signal and T1 turns off. However, since elec- trolytic capacitor C3 has been charged up in the mean time, transistors T2 and T3 will keep conducting for several seconds until C3 has been almost discharged via R4. In the Elektor labs a simpler version with the same functionality (Figure 2) has been designed for use with a cheaper PMR set that can be obtained from Conrad Electron- ics (PMR Pocket Comm Active Pair, order number 930444). These walkie-talkies have separate jack sockets for the LS/Mic and PTT connections. When there is a call a series of tones is pro- duced that is used to turn on T1 via R3. T1 then activates the PTT function and the microphone amplifier is turned on. How- ever, it's not just the audio signal that is used, but also the DC offset produced when the internal output stage is turned on. Both the internal as well as external loudspeaker are driven via an output capacitor of 100 pF. When there is a call it charges up via R3 and the base-emitter junction of T1. If the walkie- talkie is called often there would be a dan- ger that the output capacitor would remain charged and the DC offset of the audio sig- nal would no longer be sufficient to turn on T1 . To prevent this, D1 is connected in reverse across the base-emitter junction of T1, pro- viding a discharge path for the output capaci- tor. To keep the circuit active for a minimum amount of time the microphone voltage is used to provide an extra base current. This is done by charging Cl via R1. When the trans- mitter is turned off the microphone and R2/ 80 elektor - 7-8/2009 D1 provide a discharge path for the capaci- tor. C2 ensures that the circuit won't react to spikes caused by interference. As can be seen from the second circuit diagram, use is made of two connectors, a 2.5 mm jack plug for an external headset and a 3.5 mm plug for the PTT function. These connectors are particu- lar to the walkie-talkies we used here. With other types of walkie-talkie you should first check the connection details of the connec- tors before you connect the circuit up. When the circuit is used as a baby monitor you should check that the microphone you're using can pick up all the sounds. In our case the microphone didn't appear to be very sen- sitive. The microphone amplifier has proba- bly been designed for a voice that is near the PMR unit. When used as a baby monitor the microphone should therefore be positioned as close to the baby as possible. ( 080701 - 1 ) Network RS232 Marcos Agra-Trillo (United Kingdom) With an ever increasing number of off the shelf electronic mod- ules and boards available at low prices, designers are inclined to use these instead of making all their electronics from scratch. In many cases this makes sense as developing say, a PID motor controller or a GPS receiver from scratch requires considerable skill, time and effort. A surprising num- ber of modules still have an inter- face based on RS232. No wonder, as RS232 is easy implemented on a microcontroller with two I/O pins and a line driver such as the MAX232. In the case where the master is a PC, the serial port is relatively easy to access on both Windows and Linux. Usually mod- ules implement a text terminal interface that decodes single line commands with arguments and generate a reply like this: start and stop bits with no flow control. When idle, all the mod- ules are listening for commands from the master and have their transmitters disabled. Each mod- ule is configured with an identi- fier consisting of a number that the master sends as a single line (e.g. '2/n' selects module 2). If a module receives an identifier that matches its own, it is selected and can decode commands and drive its transmitter for the duration of the reply. Conversely, if the iden- tifier does not match it must not decode commands and ensure its transmitter remains disabled. . argX/n . argX/n Tx: cmd argO argl Rx: cmd argO argl replylineO/n replylinel/n replylineY/n A complication occurs when there are a num- ber of RS232 modules in a project, as each requires a serial interface at the master. A hardware solution in the form of an RS232 multiplexer would be a solution but wouldn't it be nice to get this functionality for free! By deviating from the original aim of RS232 as a point-to-point link, we can have an RS232 network in which all the modules share both transmit and receive lines to one master inter- face. All modules operate at the same speed, In addition to some firmware sup- port, the RS232 driver electronics must be able to tri-state the trans- mitter while keeping the receiver operational. Sadly, the classic MAX232 driver is unsuitable but the ICL3321 and MAX242 are possible can- didates for our purpose. These have low- power shutdown modes that power-down the charge pump and transmitters but keep the receivers enabled for monitoring RS232 activity. The number of modules in your RS232 net- work is limited by the (nominal) 5 kO pull- down at the receiver input of the line driver device. Multiple modules increase the loading 7-8/2009 - elektor 81 on this signal, reducing the maximum operat- ing speed and cable length. Using the circuit shown here, running an application with five modules at 9,600 bps located within 1 meter of each other did not present any problem. Modules need a means of enabling the net- work mode and setting the unique identifier. This can be done via switches, jumpers or, if 1/ O pins are scarce, by storing the configuration in the user EEPROM/Flash provided by many microcontrollers. If the latter is done, it is rea- sonable to assume the module will only be configured with normal RS232. Special con- figuration commands can then be provided that are always decoded irrespective of the identifier match. It is unlikely that commercially available mod- ules can be tweaked to support 'network' RS232 unless the vendor has used a suitable RS232 line driver and is prepared to provide the firmware code. However, it is possible to implement on DYI modules and perhaps module designers can take note and enhance the functionality of their future designs. ( 090326 - 1 ) Simple Wire Link Bender Louter van der Kolk (The Netherlands) When you want to mount components on a PCB or a piece of prototyping board, you not only want to do this quickly, but also tidily. The bending of really tidy wire links with the correct pitch is often a tedious chore. The fol- lowing is a handy aid for doing this. Using a small piece of 0.1 inch (2.54 mm) pro- totyping board, you can very easily make a handy bending jig for wire links. With a jig- saw, cut the piece of prototyping board into a staircase shape as shown in the drawing. You can make it as big as you need. Make sure that the horizontal cuts are slightly towards the outside with respect to the holes, so that clear indentations remain in the horizontal sections. Bending a wire link is now very easy: choose the desired pitch on the jig (dashed line), take a piece of wire and fold it sharply around the indentations corresponding to the selected pitch. A neat wire link is the result, with exactly the right pitch and ready for solder- ing tightly into the PCB or prototyping board. With close-fitting wire links the board looks much better and they are also mounted much more quickly. Tof course he bender is also suitable for resis- tors with leads. ( 090369 - 1 ) Single-cell Power Supply Harald Broghammer (Germany) Many modern electronic devices and micro- controller-based circuits need a 5 V or 3.3 V power supply. It is important that these voltages are constant and so a regulator of some kind is essential, including in battery- powered devices. The simplest approach is to select a (perhaps rechargeable) battery whose voltage is rather higher than that required by the circuit and use an ordinary linear voltage regulator. Unfortunately this solution is rather wasteful of precious energy and space: for a 5 V circuit at least six NiCd or NiMH cells would be required. Both these disadvantages can be tackled using a little modern electronics. A good way to minimise energy losses is to use a switch- Characteristics • Input voltage from 0.7 V to 5 V • Output voltage from 2.5 V to 5.5 V • Maximum output current 2 A • Can run from a single cell ing regulator, and if we use a regulator with a step-up topology then we can simultane- ously reduce the number of cells needed to power the circuit. Fortunately it is not too dif- ficult to design a step-up converter suitable for use in portable equipment as the semi- conductor manufacturers make a wide range of devices aimed at exactly this kind of appli- cation. The Maxim MAX1708 is one exam- ple. It is capable of accepting an input volt- age anywhere in the range from 0.7 V to 5 V, M and with the help of just five external capaci- tors, one resistor, a diode and a coil, can gen- erate a fixed output voltage of 3.3 V or 5 V. With two extra resistors the output voltage can be set to any desired value between 2.5 V and 5.5 V. The technical details of this integrated cir- cuit can be found on the manufacturer's website [1], and the full datasheet is avail- able for download. An important feature of the device is that it includes an internal refer- ence and integrated power switching MOS- FET, capable of handling currents of up to 5 A. It is, for example, possible to convert 2 V at 5 A at the input to the circuit into 5 V at 2 A at the output, making it feasible to build a 5 V regulated supply powered from just two NiCd or NiMH cells. With a single cell the maximum 82 elektor - 7-8/2009 possible current at 5 V would be reduced to around 1 A. The example circuit shown here is configured for an out- put voltage of 5 V. The capaci- tor connected to pin 7 of the 1C enables the 'soft start' feature. R2 provides current limiting at slightly more than 1 A. For maximum output current R2 can be dispensed with. Pins 1 and 2 are control inputs that allow the device to be shut down. To configure the device for 3.3 V output, simply con- nect pin 15 to ground. V|N LI 01 v OUT The coil and diode need to be selected carefully, and depend on the required current output. To minimise losses D1 must be a Schottky type: for a 1 A output current the SB140 is a suitable choice. For LI a fixed power inductor, for example from the Fastron PISR series, is needed. A fun- damental limitation of the step-up converter is that the input voltage must be lower than the output volt- age. For example, it is not pos- sible to use a 3.7 V lithium- polymer cell (with a terminal voltage of 4.1 V fully charged) at the input and expect to be able to generate a 3.3 V out- put, as diode D1 would be permanently conducting. On the other hand, there is no difficulty in generating a 5 V output from a lithium-poly- mer cell. ( 090070 - 1 ) Internet Link [1] www.maxim-ic.com/quick view2.cfm/qv_pk/3053 Economy Timer si w +) BT1 5 4V5 [ N S < ► # | R4 Schmitt- Trigger R © THR IC1 DIS OUT 555 TR CV -L x D1 1N4148 BZ1 °R2 Tr 3 ~ Cl II R1 lOn I Monoflop 8 R © THR IC2 DIS OUT 555 TR CV C2 □ I 470u 16V 5V R5 D2 * 090109 - 11 Stefan Hoffmann (Germany) Windows should be opened only a few minutes for ventilation, and due to the risk of break-ins, you shouldn't leave windows open for hours on end or when nobody is at home. This circuit detects when a window is open (it can also be used with a door), indicates that the window is open by means of a red LED or a blinking LED, and emits a loud acoustic signal from an intermittent electronic buzzer to remind you to close the window. The active components consist of a pair of type 555 timer ICs. Switch SI is a reed switch that is attached to the window frame, and when the window is closed the switch is closed by a magnet attached to the window casement. When the window is closed, the reed switch connects resistor R1 to the 4.5-V supply voltage. If the window is opened, SI opens as well and the voltage on R1 drops immediately to 0 V. As a result, the trigger input of IC2 is briefly pulled to ground via Cl. IC2 is wired as a monostable flip-flop, and it is triggered by this pulse. After Cl charges, the supply voltage is again present at the trigger input of the monostable flip-flop (via R2). This prevents retriggering and allows the monos- table to time out normally. The red LED or blinking LED (user option; select the value of the series resistor accord- ingly) indicates that the timer is run- ning (pin 3 is logic High). The output of the second 555 1C, which config- ured as a Schmitt trigger, also goes High when its trigger input is pulled to ground. As a result, the DC buzzer connected between the outputs of the two 555 ICs is not energised because both outputs are High. If the window is closed within the time interval determined by the R3/C2 network, the output of the Schmitt trigger returns to the Low state. If the output of IC2 is still High, diode D1 prevents any current from flowing through the DC buzzer. After the monostable times out, the outputs of both 555 ICs are Low and the buzzer remains silent. Things are different if the window is still open when the monostable times out. The Schmitt trigger out- put remains High, but the monos- table output goes Low. As a result, a positive voltage is applied to the buzzer, and it generates an acoustic signal until the window is closed. As befits an intermittent buzzer, it gen- erates an intermittent signal. The time-out interval of the monos- table can be calculated reasonably accurately with the formula t = 1.1 x C2 x R3 7-8/2009 - elektor 83 With the indicated component values (1 MO and 470 pF), the alarm sounds after approx- imately nine minutes if the window is still open. Instead of the reed switch, you can use a light- dependent resistor (LDR) to detect the light from the refrigerator lamp. If you replace R1 with a trimpot and adjust it so that the mon- ostable is triggered when the refrigerator lamp goes on (when the refrigerator door is opened), after the monostable times out the buzzer will remind you to close the refrigera- tor door (which is often left open). A nice side effect here is that you can use this circuit to definitively answer the age-old question of whether that refrigerator lamp actually goes off when the fridge door is closed ;-). ( 090109 - 1 ) Full-colour Night-flight Illumination M Steffen Schiitte (Germany) There are various types of night-time illumi- nation available for model aircraft. The cir- cuit described here is special in that it allows the colour of the RGB LED that is used to be controlled remotely. The circuit can be con- nected to a spare receiver output channel or in parallel with a channel already in use for other purposes. The colour of the RGB LED changes according to the servo position for the selected channel and according to the selected mode of operation. Characteristics • Supply voltage: 4.8 V (4.5 V to 5.5 V) • Maximum current for each output: 150 mA • Maximum current per LED module: 150 mA (50 mA per colour) • Operating modes: 3 • Servo range: ±100 % • Dimensions (prototype): 32 mm x 25 mm x 7 mm • Controller weight: 5 g • LED module weight: 0.7 g At the heart of the circuit is a PIC12F675 microcontroller (IC1), which is connected to one output channel of the radio receiver: this allows it to measure the corresponding servo position. Depending on its operating mode, the microcontroller generates pulse- width modulated waveforms on three out- puts, which in turn drive the connected RGB LED (or LEDs) via transistors T1 to T3 to pro- duce a range of colours. The other main com- ponents are the mode button SI and a four- way connector (K2) used for in-system pro- gramming (ISP) of the microcontroller. D1 and D2 are required to prevent a connected radio receiver from interfering with the program- ming operation. In contrast to the simplicity of the hardware, the software running in the microcontrol- ler is rather complex. Commented source code is available for free download from the project page at www.elektor.com. The most important parts of the program are the Mode 1 Mode 2 — ► Mode 3 080060 - 11 o- r\_ rf r\_ r r\- l ILr R8 82R R7 LED1 A3 180R r C3 i_ Cl LED CONI R6 120R 3x * RGB A2 C2 A1 LRTB G6TG 84 elektor - 7-8/2009 initialisation code, the interrupt routine and the main loop. The interrupt routine is triggered by a level change on the input port pin connected to the radio receiver. It tests whether the edge is rising or falling: if rising, Timerl is set to zero to allow the time to the following falling edge to be measured. The pulse width corre- sponds to the servo position and is output by the receiver every 20 ms. The 20 ms timebase derived from the receiver signal is also used to orchestrate the polling of the mode but- ton. When the mode button is pressed (the input port pin going from High to Low) the device changes mode. If the device is not in continuously-changing mode the new colour for the RGB LED is cal- culated in the interrupt routine by calling the routine 'calcResult'. If the device is in contin- uously-changing mode the relevant calcula- tions are performed in the main loop. Pressing SI cycles through the following operation modes (see also the accompany- ing figure). In mode 1 the colour changes from blue (minimum servo position) to red (maximum position). A press of SI advances to mode 2, where the colour changes simi- larly from green to red. A further press enters mode 3, where the colour changes continu- ously, with the speed of the change depend- ing on the servo position. Finally, pressing the button once more returns to mode 1. The most recently used mode is stored in the microcontroller's EEPROM while power is not applied. When power is applied to the receiver the channel that has been selected for use must be set to its minimum position. This is because the circuit uses the initial value of the pulse width to 'learn' the minimum posi- tion. If the channel is not set to its minimum position, the device will never fully reach the colour red (in modes 1 and 2) or the maxi- mum possible colour-changing speed (in mode 3). The upper part of the circuit diagram shows how the RGB LED can be connected to con- nector K3. It is possible to connect multiple LED units in parallel. An extra pin on K3 is taken to ground in order to allow perma- nently-lit LEDs to be connected alongside the RGB LEDs. It is of course necessary to keep within the maximum permissible cur- rent draw from the receiver or battery elimi- nator circuit (BEC). ( 080060 - 1 ) Download 080060-11 : source code and hex files, from www.ele- ktor.com/080060 Product 080060-41: ready-programmed PIC12F675 microcontroller Smoggy use your Walkman to detect electrosmog Tony Ruepp (Germany) Even if your good old (Sony) Walkman sees little use nowadays it would be a shame to get rid of it altogether. The more so when just removing the tape head would allow the built-in audio amplifier to become an outstanding electrosmog detector for a variety of purposes. Looking at the schematic, readers with RF experience will have no difficulty in rec- ognising the diodes and coils of the two detector-receivers, which serve to cap- ture and demodulate RF signals. With its coil of four turns (L2) one receiver cov- ers the higher frequency range of the electromagnetic waves, whilst the sec- ond detector takes care of the lower fre- quency range. For this reason a coil with a greater number of turns is required: LI is an RF choke of about 250 pH. The precise value is not critical and it could equally be 220 pH or 330 pH. The outputs of both detector-receivers are connected to the cables disconnected previously from the tape heads, feeding the right and left channel inputs to the Walk- man's audio amplifier. Please note here that the screening of the tape head cable does not have to be absolutely identical to the ground connection of the amplifier circuitry. As we are dealing with a stereo amplifier, we are listening into both channels and thus both RF ranges at the same time. One channel of the amplifier can also be used to demodulate low-frequency mag- netic alternating fields via a capacitor (C3) bypassing diode D1 and connect- ing either a third coil (L3, for instance; a telephone recording adapter) as the pickup device or else a long piece of wire for acquiring low frequency AC electri- cal fields. Sources like this are discerni- ble mainly by a distinct 50 Hz (or 60 Hz) humming in the earphones. Predicting what you may hear down to the very last detail is difficult, since every locality has its own, individual interfer- ence sources. Nevertheless, with practice users will succeed in identifying these interference sources by their particular audio characteristics. To sum up, four different 'sensors' can be connected to the inputs of this circuit: ANTI (approx. 50 cm long whip antenna), ANT2 (3.5 cm short stub antenna), ANT3 (approx. 1 m long wire antenna for low fre- quency electrical fields) and a coil for mag- netic fields. Finally, two more tips: 7-8/2009 - elektor 85 1. Use only 'good old' germanium diodes for D1 and D2. Sensitivity will be much reduced if silicon diodes are used, as these have a higher threshold voltage. 2. Smoggy does not provide an absolute indi- cation of field strength and even more so can- not provide any guidance whether anything it detects might be harmful. Its function is to detect electromagnetic signals and compare their relative magnitude. ( 090151 - 1 ) Solar-driven Moisture Detector M Christian Tavernier (France) When we think of solar cells or panels, what springs to mind immediately is producing power — only natural, given the primary purposes of such devices; but we don't nec- essarily think of using them in applications where the fact they don't produce power in the absence of light may actually be use- ful. Yet this is just the case in the project dis- cussed here. The project, then, is intended for detect- ing moisture here on Earth using solar power. It's pri- marily aimed it at those of you who like to brighten up their house or flat with pot plants, but are afraid of inadvertently let- ting them die of thirst. Using its two elec- trodes, formed from two stiff pieces of bare copper wire, it can be stuck into the pot of any plant you want to monitor. As long as the plant isn't thirsty, i.e. the soil in the pot is moist enough, it will just sit there and do nothing at all. But when the soil dries out below a certain threshold (which you can adjust to suit the soil used and the plant being monitored), it starts 'squealing' to tell you it is time to give the poor plant a drink. But so that your husband/wife/girlfriend/ boyfriend (as applicable!) won't throw your plant out of the window because the detec- tor has started squealing in the middle of the night, we obviously want it to work only dur- ing the day. This is where the solar cell comes in handy: on the one hand, it is used to power the circuit, making it totally stand-alone; and on the other, the lack of power produced when in darkness means the circuit is auto- matically silenced at night. Once we've adopted this principle, the circuit is remarkably simple, using just a single 4093 CMOS logic chip, which contains four 2-input Schmitt trigger NAND gates. The first gate, ICIa, is wired as a very low fre- quency astable oscillator. When its output is at logic high, which occurs at regular inter- vals, it enables ICIb, which is also wired as an astable oscillator, but this time at an audible frequency. The signal from ICIb then has to pass through ICIc, which can only happen if El and E2 are not connected, allowing the corresponding input to be pulled up to logic High. You will have realised that El and E2 are the electrodes stuck into the soil and so will not be connected if the latter is not suf- ficiently conductive, i.e. when it starts to dry out. The threshold at which gate ICIc turns on is obviously adjustable using PI. COMPONENT LIST Resistors R1 = lOOkQ R2 = 10kQ R3 = 47kQ PI = 1MQ linear potentiometer Capacitors Cl = 22(jF 25V C2 = lOOnF Semiconductors IC1 =4093 Miscellaneous Solar cell (see text) Piezo buzzer 2 copper wire electrodes PCB no. 081174-1 86 elektor - 7-8/2009 Depending on whether or not the circuit is supplied from a voltage greater or less than 3 V — which depends on the solar cell used, as we'll be seeing in a moment — the piezo sounder can be connected either directly between ICIc output and the positive sup- ply, or between the outputs of ICIc and ICId, which is wired as a simple inverter and so enables you to double the output voltage. The circuit is very simple to build, and you can just as easily use the suggested board design [1] or build it on a piece of prototyp- ing board. The sounder used must of course be one without built-in electronics, as here it is just being used as a simple transducer. If it's a large-diameter flat type, you could, for example, glue it onto the casing of IC1, while if it's a small-diameter type with rigid pins, it can be soldered directly onto the end of the PCB where its connection pads are located. As for the solar cell, for the prototype Solems devices were used, available for example from Selectronic France [2]; these are marked with a very simple 3-figure code in the form NN/LL/WW, where NN is the number of ele- ments in the cell (each element producing around 0.5 V), LL is the length of the cell, and WW the width, in mm. Equivalent cells from other suppliers may work equally well though. Although in theory standard CMOS logic ICs only work above 3 V, the majority of those we tried in our circuit did actually work with a lot less, which means that if you're on a tight budget (or have a lot of plants to moni- tor!), you can use the cheapest cells, part no. 05/048/016. If your budget is a little higher, and you don't want to bother selecting the 4093 CMOS ICs, go for a 07/048/016, or better still a 07/048/032, which will allow the circuit to work under excellent conditions as soon as the illumination reaches around 1,000 lux. You can also cannibalize such cells from solar-powered garden lights, which can often be found at giveaway prices in the big DIY stores. Given the size of the suggested PCB, the Solems cells can be soldered directly onto the copper side of it. But when connecting the cell up, do take care to be very quick sol- dering the leads to the two silvered pads at each end of it. They are actually metallised directly onto the glass of the cell and so are pretty fragile. As soon as the cell is connected, if the two electrodes El and E2 are 'in mid-air', the cir- cuit should start 'squealing', as long as it is getting enough light. You can then solder two stiff copper wires onto El and E2 (e.g. stripped offcuts of 1.5 mm 2 / AWG16 domes- tic wiring cable) and spike the circuit into the plant you want to monitor. Then all you have to do is adjust PI so that the circuit cries for help when the soil has reached the level of dryness you have chosen. If the frequency of the sound produced doesn't suit you, you can change it by increasing or reducing C2 and/or R2. Like- wise, if you don't like its repeat frequency, you can change that by adjusting Cl and/ or R1. ( 081174 - 1 ) Internet Links [1] www.elektor.com/081174 [2] www.selectronic.fr Download 081174-1 PCB layout (.pdf), from [1] Advertisement RoboThespian A Robotic Actor with Propeller Motion Control “We chose the Propeller microcontroller because it fits the application so well with cogs dedicated to various functions and is able to communicate quickly. The cost-to-performance ratio is incredible. We were also impressed by Chip Gracey’s design approach to Propeller - We trust the silicon because we know the dedication and passion that went into the design of it.” Will Jackson, Co-Creator http://www.robothespian.com With eight 32 -bit processors in one chip and deterministic c - ^ - control over the entire system 9 imagine what the Propeller i Q £ microcontroller can do for your next project! c Milford Instruments www.milinst.com www.parallax.com www.spinvent.co.uk 7-8/2009 - eleklor 87 I 2 C Display R. Pretzenbacher (Austria) Pretty graphical simulators are all very well when developing circuits using microcontrol- lers, but sometimes there is no substitute for a proper display connected to real hardware. LCD panels based on the Hitachi HD44780 controller are popular as they are cheap and, at least in principle, easy to use. Unfortu- nately they require a large number of control signals, which in turn means bulky cables and losing the use of many of the microcontrol- ler's I/O pins. Here we present a solution to the problem in just three characters: l 2 C! Characteristics • Universal LCD module for microcontrollers • Requires just two I/O port pins • Multiple displays on one l 2 C bus • Simple to use with AVR firmware With the addition of just one extra chip to bridge the gap between the l 2 C bus and the LCD panel's parallel interface, we can make a universal display module on a simple com- pact printed circuit board. Besides ground and +5 V power, the module needs just two control lines from the host microcontroller system: SCL and SDA. This makes the job of interfacing to a display much more straight- forward. The Hitachi controller can be oper- ated in its 'four-bit mode', where only four data lines are connected along with three control signals: 'E', 'R/W' and 'RS'. And now we come to the elegant part of this design: rather than using a microcontroller to drive these seven lines we use a simple l 2 C bus port expander device offering eight I/O pins. This even leaves us one spare output which we can use to switch the LCD's backlight (or any other LED) on and off. We selected the PCF8574, which is available in 88 elektor - 7-8/2009 COMPONENT LIST Resistors PI = 5kQ, SMD (MuratcD R2,R3,R4 = lk08, SMD 0805 R5 = 39 Q, SMD 0805 (see text) Capacitors C1,C2= lOOnF, SMD 0805 C3 = 10)jF 16V, SMD (Vishay), diam. 4mm Semiconductors ICl = PCF8574 (PCF8574A) (see text) T1 = BC807, SMD SOT23 Miscellaneous LCD with HD44780 compatible controller K1 = 4-way SIL pinheader, lead pitch 0.1" (2.54mm) K2 = RJ11 socket, PCB mount K3 = solder islands J1,J2 = 2-way pinheader with jumper, 0.1' lead pitch 20-way pinheader, 0.1" pitch, for LCD connection PCB #080525-1 two variants. The variants differ in the regions of the l 2 C address space to which they can be configured to respond: see [2]. As shown the circuit is arranged so that the device responds to he highest address in its range: in the case of the PCF8574 this address is 0x4E and in the case of the PCF8574A the address is 0x7E. Using these two chips it is possible to make two display modules that can be con- nected to the same l 2 C bus simultaneously without address conflict and without any modifications to the circuit. If it is desired to use one of the other seven possible device addresses (for example if there is a conflict with another l 2 C device on the same bus) the wiring of the address bits (pins 1 to 3) needs to be changed appropriately. The circuit itself is straightforward. The signals from the port expander are taken directly to the pins of the LCD panel, with the exception of output P0 which controls the backlight via PNP driver transistor T1 . The value of R5 must be chosen according to the current rating of the backlight, which can be determined from the LCD panel's datasheet. The value of 39 Q shown is suitable for a typ- ical one-line panel with a rated LED current of 30 mA. Preset PI is used to adjust the dis- play contrast: frequently the display is only visible over a narrow range of contrast set- tings. Jumpers J1 and J2 enable the standard pull-up resistors on the SCL and SDA lines: there should only be one pair of such pull- up resistors over the whole bus. The printed circuit board offers a range of possibilities for connection to the bus: header K1, RJ11 socket K2 and solder pads K3. To simplify using the display the author has written driver software in C, suitable for use with AVR microcontrollers. As usual this is available from the Elektor web page for this article [1] and can of course be modified to suit your own requirements. The software is divided into three parts as follows. 1) l 2 C functions (may be modified to suit particular AVR microcontrollers) • i2clnit initialise l 2 C master • i2cCheck • i2cSend • i2cReceive test whether a slave is responding send data over the l 2 C bus read data over the l 2 C bus 2) Low-level display functions (not normally used in applications) • whNibb send data nibble to display: call twice to send a byte • rdsyB read status byte from display (for example, to determine if the display is busy) • cntrB send control byte to display (for example, to shift the display left or right) • dataB send data byte to display • wBusy test whether display is busy Control byte constants (for use with 'cntrB') • dshr ObOOOIIlOO // shift display one position to the right • dshl ObOOOIIOOO // shift display one position to the left • curon oboooomo //cursor on • curoff ObOOOOIlOO //cursor off • curblk ObOOOOl 111 //cursor blinks 3) User-level display functions (for use in applications) • Ddisp write character at current cursor position • DClear clear display • Dpos set cursor position • Dinit initialise display • DBcd2 output a two-digit BCD value • DHexByte output a byte in hexadecimal • DWord output an unsigned 16-bit value • DLong output an unsigned 31-bit value • Dint output a signed 16-bit value The user-level functions can be changed as required without needing to know the low-level details of how the display is driven. ( 080525 - 1 ) Internet Links [1 www.elektor.com/080525 [2] www.nxp. com/acrobat_download/datasheets/PCF8574_4.pdf Downloads 080525-1 : PCB layout (.pdf), from [1] 080525-11: source code files, from [1] 7-8/2009 - elektor 89 M FM Audio Transmitter Design: Mathieu Coustans (France) When the author started thinking about this project he had a simple VHF FM transmit- ter in mind that could be used to play audio files from an MP3 player or computer on a standard VHF FM radio. The circuit shouldn't use any coils that would have to be wound at home, as is often the case with other FM transmitter designs, because it would add an unwanted level of complexity to the project. Such an FM transmitter can be used to listen to your own music throughout your home. There is also an advantage when you use this transmitter in the car, as there is no need for a separate input to the car stereo to play back the music files from your MP3 player. To keep the circuit simple as well as compact, it was decided to use a chip made by Maxim Integrated Products, the MAX2606 [1]. This 1C from the MAX2605-MAX2609 series has been specifically designed for low-noise RF applications with a fixed frequency. The VCO (Voltage Controlled Oscillator) in this 1C uses a Colpitts oscillator circuit. The variable-capac- itance (varicap) diode and feedback capaci- tors for the tuning have also been integrated on this chip, so that you only need an exter- nal inductor to fix the central oscillator fre- quency. It is possible to fine-tune the fre- quency by varying the voltage to the vari- cap. Not much is demanded of the inductor, a type with a relatively low Q factor (35 to 40) is sufficient according to Maxim. The supply voltage to the 1C should be between 2.7 and 5.5 V, the current consumption is between 2 and 4 mA. With values like these it seemed a good idea to supply the circuit with power from a USB port. A common-mode choke is connected in series with the USB connections in order to avoid interference between the circuit and the PC supply. There is not much else to the circuit. The stereo signal con- nected to K1 is combined via R1 and R2 and is then passed via volume control PI to the Tune input of IC1, where it causes the carrier wave to be frequency modulated. Filter R6/C7 is used to restrict the bandwidth of the audio signal. The setting of the frequency (across the whole VHF FM broadcast band) is done with P2, which is connected to the 5 V sup- ply voltage. Specifications • Easy to build thanks to the use of a MAX2606 • Can be powered from a USB port on a computer • Current consumption of just 2 to 4 mA, supply voltage of 2.7 to 5.5 V • Can be expanded with a pre-emphasis circuit The PCB designed in the Elektor Labs uses resistors and capacitors with 0805 SMD packaging. The size of the board is only 41.2 x 17.9 mm, which is practically dongle-sized. For the aerial an almost straight copper track has been placed at the edge of the board. In practice we achieved a range of about 6 metres (18 feet) with this. There is also room for a 5-way SIL header on the board. Here we find the inputs to the 3.5 mm jack plug, the input to PI and the supply voltage. The latter permits the circuit to be powered independently from the mains supply, via for example three AA batteries or a Lithium but- ton cell. Inductor LI in the prototype is a type made by Murata that has a fairly high Q fac- tor: minimum 60 at 100 MHz. Take care when you solder filter choke L2, since the connections on both sides are very close together. The supply voltage is con- nected to this, so make sure that you don't short out the USB supply! Use a resistance meter to check that there is no short between the two supply connectors before connect- ing the circuit to a USB port on a computer or to the batteries. PI has the opposite effect to what you would expect (clockwise reduces the vol- ume), because this made the board layout much easier. The deviation and audio band- width varies with the setting of PI. The max- imum sensitivity of the audio input is fairly 2n2 080727 - 11 90 elektor - 7-8/2009 COMPONENT LIST Resistors (all SMD 0805} R1,R2 = 22kO R3 = 4kQ7 R4,R5 = IkO R6 = 270Q PI = 10kQ preset, SMD (TS53YJ103MR10 Vishay Sfernice, Farnell # 1557933) P2 = lOOkQ preset, SMD(TS53YJ104MR10 Vishay Sfernice, Farnell # 1557934) Capacitors (all SMD 0805} C1,C2,C5 = 4pF7 10V C3,C8 = lOOnF p 2 R4 -ANTI C4 Cl R5 C3 l L1 l i vo ] I u I I C7 C8 R 6 C4,C7 = 2nF2 C6 = 470nF Inductors LI = 390 nF, SMD 1206 (LQH31HNR39K03L Murata, Farnell# 1515418) L2 = 2200Q @ 100MHz, SMD, common-mode choke, 1206 type(DLW31SN222SQ2L Murata, Farnell # 1515599) Semiconductors IC1 = MAX2606EUT+, SMD SOT23-6 (Maxim Integrated Products) Miscellaneous K1 = 3.5mm stereo audio jack SMD (SJ1-3513-SMT CUI Inc, DIGI-Key # CP1-3513SJCT-ND) K2 = 5-pin header (only required in combination wsith 090305-1 pre-emphasis circuit) K3 = USB connector type A, SMD (2410 07 Lumberg, Farnell# 1308875) large. With PI set to its maximum level, a stereo input of 10 mV rms is sufficient for the sound on the radio to remain clear. This also depends on the setting of the VCO. With a higher tuning voltage the input signal may be almost twice as large (see VCO tuning curve in the data sheet). Above that level some audible distortion becomes appar- ent. If the attenuation can't be easily set by PI, you can increase the values of R1 and R2 without any problems. Measurements with an RF analyzer showed that the third harmonic had a strong pres- ence in the transmitted spectrum (about 10 dB below the fundamental frequency). Servo Driver Gert Baars (The Netherlands) When it comes to driving a servo you typi- cally have to send a PWM signal to the servo input. The frequency of this signal is about 50 Hz and the duty cycle is variable. The duty cycle is usually between about 5 and 10%, corresponding with a pulse width of about 1 to 2 ms. The conversion of a resistance value into a PWM signal is fairly straightforward when a variable RC time constant circuit is used. Converting a voltage into a PWM signal is a bit more difficult, but it does offer some useful advantages. When the position of a servo can be control- led via a voltage, it can be implemented via a potentiometer acting as a voltage divider. However, you could also use the output of a sensor such as a Hall sensor, an LDR or an NTC. That way you could easily create a feed- back loop that takes account of the position, light intensity or the temperature, and use this to control the servo. This can in turn be used to open or close a gas or water valve, for example. The circuit can therefore be said to This should really have been much lower. With a low-impedance source connected to both inputs the bandwidth varies from 13.1 kHz (PI at maximum) to 57 kHz (with the wiper of PI set to 1/1 0). In this circuit the pre-emphasis of the input is missing. Radios in Europe have a built-in de-emphasis network of 50 ps (75 ps in the US). The sound from the radio will therefore sound noticeably muffled. To correct this, and also to stop a stereo receiver from mistakenly reacting to a 19 kHz component in the audio signal, an enhancement circuit Is published elsewhere in this issue (Pre-emphasis for FM Transmitter, also with a PCB). Notice. The use of a VHF FM transmit- ter, even a low power device like the one described here, is subject to radio regula- tions and may not be legal in all countries. ( 080727 ) Internet Links [1] http://datasheets.maxim-ic.com/en/ds/MAX2605- MAX2609.pdf [2] www.elektor.com/080727 Download 080727-1 PCB layout (.pdf), from www.elektor.com/080727 M 7-8/2009 - eleklor 91 be reasonably versatile. There are special purpose PWM modula- tor ICs available, but it's just as easy to use a quad op amp such as an LM324. In the cir- cuit op amp C is configured to output a bias signal of half the supply voltage. Op amp D is set up as a square-wave oscillator, with its frequency set to about 50 Hz, which is the fre- quency required by the servo. The duty cycle is fixed and set to a value slightly higher than the maximum 10%. This is followed by an integrator that changes the waveform of the pulse into a triangular form. Op amp B is configured as a compara- tor that compares this triangular wave with the DC voltage L/ jn . The output of the compa- rator is a PWM signal that is suitable to drive the servo directly. The frequency is about 50 Hz and the duty cycle can be varied from just under 5% to a good 10% when L/ in var- ies from 0.5 to 4 V. The servo, an RS-2 in our prototype, reacts to this with an angular rota- tion of about 200 degrees. The transfer func- tion in this case is therefore 200 / (4-0.5) = 57 degrees per volt. ( 090046 ) Chill Out Loud +3V Andrew Denham (United Kingdom) Everyone knows that when the refrigerator door is casually closed it sometimes bounces open again just a little. Enough to put the fridge light on, but that's often un-noticeable even at night unless one looks closely. After a day out, you may come home to sour milk and dodgy chicken. After several mornings with debatable milk, the author decided that some- thing would have to be done, and came up with this little gizmo. The light in his fridge always comes on even with a 2 mm door open- ing, so that's a promising place to start. The TEMT6000 phototransistor device from Vishay will 'see' vis- ible light, and is both cheap and readily available. It has negligible dark current and can sink a few pA happily. Since a battery pow- ered device is required, the cur- rent for the entire circuit has to be as low as possible. A PIC with 'sleep' mode is a good choice, and the 12F629 fits the bill nicely: small, cheap, easily obtained, with an internal RC oscillator on board, and up to five I/O pins as well. According to the PIC12F629 data- sheet [1] all pins have to be set as inputs and pulled high for best low power operation, and every peripheral in use will add some drain. Since the unit is permanently powered from a bat- tery, there is no need for brown-out protec- tion. No A/D or comparators are required, and no watchdog timer either, allowing the lowest power settings in Sleep mode to be exploited. Typical current here is shown as 1 .2 nA with a guaranteed maximum of 770 nA at a 3 V supply, reducing to 700 nA at 2 V. The type CR2032/1 HF Lithium cell has a rated capacity of 230 mAh and a nominal voltage of 3 V [2]. On this basis with the typical cur- rent in sleep mode the battery would last over 250 years, or effectively for its shelf life, so a CR2032 with tags is worth soldering in to a PCB. Even at the maximum Sleep cur- rent, it would last for over 30 years — cer- tainly longer than the fridge! One advantage of a Lithium battery is its long shelf life, and an ability to deliver power at low temperatures. An obvious choice to make a squawk is a piezo sounder, again cheap and easily obtained. This can be driven from the PIC directly across two ports and will withstand 3 V p _ p drive easily. After some testing, a Kingstate KPEG827 [3] proved a worthy candidate. It makes sufficient racket at 3 V drive from about 2.0 kHz to about 4.5 kHz. The PIC program was developed using MikroElektronika products only: a fully paid up MikroBasic compiler and the BigPIC 4 board. However the final program is so small that it can be compiled using the free version of MikroBa- sic (free up to 2 K of code, down- load at [4]). For the simple reason of ease, the PIC used is the 8-pin DIL version. This can be re-programmed easily using a simple DIL socket adapter. ICP is OK if you have to use SMD but the socket takes up a lot of room and negates the purpose of SMD in the first place on a very small PCB. I used the PicFlash2 programmer again from MikroE, but could have used the on-board EasyPIC4 programmer. The source code used is available free from the Elektor website [5]. The timer will work with anything that can pull the GPIO.3 input Low and hold it Low, so could be used with bi-metallic tem- peratures sensor, or the software adapted to read a One-Wire temperature sensor. It could also be used to sense over- or under-voltage etc. with some adaptation. The delay before the alarm sounds is adjustable from about 1 to 255 seconds in software. One word of warning: there are many PIC pro- 92 elektor - 7-8/2009 grammers out there. If you use other than the MikroE programmer with the code from the Elektor website, make certain that the PIC oscillator configuration is correct. Not all software reads the Configuration correctly; it needs to be set for INT RC OSC, with GPIO.4 and GPIO.5 as I/O. Anything else will stop the oscillator and may damage the PIC! Some programmers need these parameters to be set manually before blowing the chip. In case of doubt, consult the source code listing. After some tweaking with the port settings, the sample chip consumed an estimated 0.02 pA in Sleep mode. Once triggered the unit consumes about 500 pA for the timer period of 1 minute, then about double that once the sounder is operating. This is well under the maximum current for the cell used (10 mA max. pulsed) and would bleat for about 10 days with a fresh battery, which hopefully will never happen. With a fridge opened say 20 times a day for less than a min- ute, the battery life expectancy reduces to about 9 years, still a reasonable longevity. The photograph shows a prototype built on a small piece of perfboard by Elektor Labs. Here the ambient light sensor is a type TEPT5600 (which looks like a UV LED). As opposed to TEMT6000, the TEPT5600 has to be pointed directly to the light source due to its narrower Viewing angle'. It also requires the value of R1 to be doubled (approximately). Even on perfboard the circuit is compact enough to be fitted in a small ABS case, pref- erably one with a battery compartment because that's the ideal place for the sounder. A small hole in the end should allow the sen- sor to 'see' the light. This hole was filled with clear epoxy resin to act as a window with- out allowing too much moisture into the case. The latter was achieved by fixing tape over the inside then filling the hole flush. It was then allowed to set whilst the box was fixed upright. The circuit board may be fixed in place with a little hot melt glue. The unit could be mounted to the fridge wall using double-sided adhesive foam strip or Velcro, but space allowing it may equally sit on the shelf. To start the microcontroller for the first time, or when the battery is replaced, the fridge door should be closed or the sensor covered. Once the sensor detects light, it takes 60 sec- onds before the alarm sounds. When in the fridge with the door closed (or the sen- sor covered) the unit goes back to sleep... peace! Of course the fridge does have to have a light that works or the unit will think it is in the dark all the time. ( 080700 - 1 ) Internet Links [1] http://ww1.microchip.com/downloads/en/ devicedoc/41 1 90c.pdf [2] www.panasonic.com/industrial/battery/oem/ images/pdf/Panasonic_Lithium_CR2032_CR2330.pdf [3] www.farnell.com/datasheets/1 6396.pdf [4] www.mikroe.com [5] www.elektor.com/080700 Downloads & Products Programmed Controller 080700-41: programmed PIC12F629 Software 080700-11.zip: MikroBasic source code and hex files. Location: www.elektor.com/080700 Dimmable Aquarium Light M with Simulated Sunrise and Sunset Jurgen Ollig (Germany) Electronic ballasts (EBs) for flu- orescent lamps, also known as electronic control gear (ECG), have advantages over their conven- tional cousins: higher efficiency, flicker-free start-up, no 50 Hz (60 Hz) flicker and longer tube life. Moreover, they allow the light to be dimmed. Suitable EBs with a 1- 10 V analogue control interface are available from all the usual man- ufacturers, including Osram and Philips. An internet search for 'dimmable EB' will turn up a large number of on-line sales outlets for the devices. For the purposes of this circuit EBs with a digital interface (known as DALI, for Digital Addressable Lighting Inter- face) are not suitable. Osram provides an excellent technical description of the 1-10 V interface on their website at [1]. The interface provides an interference-proof DC voltage of up to 10 V, which, when loaded, delivers an essentially constant current of 0.6 mA: in other words, it is a constant current source with an open-cir- cuit voltage of 10 V. If a resistor is connected across the interface then the lower its value, the lower will be the voltage across it, and this controls the dimming of the connected lamp. When the control input is open circuit and the voltage across it is 10 V, the lamp is driven at full brightness (100 % of nominal power). If the control input is shorted the control gear dims the lamp to 3 % of nominal power. Between 3 % and 100 % the behav- iour of the controller is logarithmic. The very simple circuit described here to drive the interface has several features that will be of particular interest to aquarium owners. The circuit is connected across the control input of the EB and there- fore the control voltage appears across it. The brightness of the tube can be adjusted using PI. SI allows electrolytic capacitor Cl to be connected across PI : the charge current (0.6 mA) is very small and the capacitor very large (1 0000 pF) and so it charges very slowly. This means that the voltage across it, and hence the brightness of the fluorescent tube, will increase only slowly. The larger the value of Cl, the slower the rate of brightness increase; with the suggested value the sim- ulated sunrise takes around 12 minutes to complete. As can be seen, the circuit does not need its own power supply. When the EB is switched off Cl discharges into PI (assum- ing SI is closed); when it is next switched on the brightness of the tube will rise slowly as before. An optional extra is the circuit consisting of relay RE1 and resistor R1. If the contacts of 7-8/2009 - elektor 93 RE1 close Cl will be slowly discharged into R1. The control voltage will fall gradually and the tube will slowly dim. The larger the value of R1, the slower the simulated sunset will be. When the contacts of RE1 are closed the value of R1 will also affect the maximum brightness that can be achieved by adjusting PI: the greater the value of R1, the higher the maximum brightness. One possible arrangement is to plug the aquarium light into one timeswitch and drive RE1 from a mains adaptor plugged into a sec- ond timeswitch. The relay contact is made to close say 30 minutes before the first times- witch turns the aquarium light off. When the simulated sunset is complete the relay con- tact can be allowed to open again. ( 090025 - 1 ) Internet Link [1] http://www.osram.co.uk/_global/pdf/Professional/ ECG_%26_LMS/ECG_for_FL_and_CFL/QUICKTRONIC_ DIM_Technical_Guide130T003GB.pdf Audio Source Enhancer Thorsten Steurich (Germany) Vinyl or CD: which has the better sound? It's a question still hotly debated among audi- ophiles everywhere. We will try to shed a lit- tle light on what lies behind the question and look at a simple circuit that can significantly enhance the sound from a CD player. Sometimes, on first hearing a new low- to mid-range CD player, the sound is not alto- gether convincing when compared to a record player. It is worth looking at the recording and replay processes as a whole for both CDs and records to see why this might be. Assuming that we start from the same source, or master recording, of a given piece of music, the differences are broadly as follows. Records and CDs use very different record- ing technologies. For records the signal first undergoes pre-emphasis similar to that used in FM radio, where the higher frequency components of the signal are amplified. The resulting signal is cut into the lacquer master disc that will be used for pressing. Unlike CD manufacture, this is an entirely analogue process, and it intro- duces a phase shift into the signal. To com- pensate for the pre-emphasis the preampli- fier in a record player includes a de-empha- sis (or 'RIAA') filter which attenuates the higher frequency components. The pur- pose of pre-emphasis is to improve the overall signal-to-noise ratio of the signal as played back, reducing hiss and crackle. De- emphasis introduces further phase shifts, and as a result the final signal is rather dif- ferent from that produced by a CD player. The processing involved in CD manufacture and playback can be entirely digital (in the case of'DDD' recordings) and phase errors are reduced practically to zero. The circuit shown here uses a quad opamp (two opamps per channel) to produce 'record- like' phase shifts. In the author's experience low- and mid-range CD players tend to have greatly attenuated output at higher frequen- cies, and the circuit therefore also offers the facility to boost these components to taste. The value of capacitors C8 and C14 may be anywhere between 100 pF and 10 nF accord- ing to the frequency response desired. At the low-frequency end the response is more than adequate, thanks to the large cou- pling capacitors used. The circuit also func- tions as a buffer or impedance converter, which can help to reduce the effect of cable capacitances. With CD players that have an output impedance of 1 kO or more the differ- ence between cheap cables and more expen- sive low-capacitance cables can be noticea- ble. This circuit has an output impedance of just 100 O and so cheaper cables should nor- mally be more than adequate. The circuit can of course also be used with other digital audio sources such as minidisc players, hard disk recorders, DAB tuners, dig- ital terrestrial and satellite television receiv- ers and so on. The supply voltage can be any- where from 1 0 V to 30 V. It will often be possi- 94 elektor - 7-8/2009 CD ble to take power from the CD player's own supply; if not, a separate AC power adaptor can be used. The output signal for each channel is inverted (i.e., is subjected to a 180 degree phase shift) by the second opamp (IC1.B and IC1 .D). This does not affect the operation of the circuit. By changing the value of feedback resistors R4 (for IC1.B) and R12 (for IC1.D) the overall gain of the circuit can be adjusted so that the output level matches that of other components in the audio system. ( 081083 - 1 ) Doubling Up with the PR4401/02 Leo Szumylowycz (Germany) Among the many interesting applications for the PR4401/02 devices from Prema, some have already appeared in the 2008 edition of Ele- ktor Summer Circuits. Over and above their unbeatable performance, dependable operating range from 0.8 V upwards and minimal reliance on peripheral components all we might ask for might be greater out- put current, in order to be able to fully exploit a 4-chip LED with 80 mA. It would be handy too if one could replace the 9 V 'block' batteries used in the more sophisticated LCD multimeters. With the fully tested circuit presented here both problems can now be eliminated. In the schematic shown two of these ICs are connected in parallel via diodes to a single charge capacitor. If the need arises you can connect even more of these ICs in parallel in the same way. The value of inductance required is calculated in the same way as for standard applications of the 1C; 10 pH for the PR4401 with a current of 20 mA and 4.7 pH for the PR4402 with a current of 40 mA. To power an 80 mA LED with a single 1 .5 V battery the circuit shown needs to be equipped with PR4402s and 4.7 pH inductors. If you feel like constructing the entire project with SMDs, you will need SMD tantalum electrolytics (4.7 pF, 35 V) of style 'A' for Cl and C2 plus CD ''V'-MwbI Driving your loudspeakers - to a higher end morel Visit our website for more details on our new program EUROPEAN DISTRIBUTOR tel. +31 (0)595 49 17 48 fax +3 1 (0)595 49 1 9 46 info@eltim.eu LT A LJD/O www.eltim.eu SMD inductors such as Murata LQH3C-4.7pH for LI and L2 (available from RS Components, Farnell and Anglia Components). ( 090129 - 1 ) Internet Link www.prema.com/pdf/ +0V8...+1 V8 7-8/2009 - elektor 95 M Pre-emphasis for FM Transmitter Ton Giesberts (Elektor Labs) Specifications • Correction network for FM Transmitter 080727 • Also includes a 19-kHz filter • Current consumption of 3 mA This circuit was specially designed to be used with the FM Audio Transmitter found else- where in this issue, but it can also be useful as an addition to other transmitters. The circuit uses a dual opamp. The first opamp (IC1A) functions as a mixer and a buffer for the following correction net- work. The input sensitivity can be adjusted with the help of R3 (a lower value reduces the sensitivity). The 50 ps correction for the pre-emphasis is carried out by C5 and R6. IC1 B buffers the signal before it is fed to the transmitter via K1. Since the FM transmitter is a mono version, a 19 kHz filter has been included to prevent a stereo FM receiver from mistakenly switching to stereo mode due to the presence of 19 kHz components in the received signal. Any sig- nals around 19 kHz are blocked with the help of a simple tuned circuit (L1/C4). R4 ensures that the Q isn't too large. Due to tolerances you may find that the frequency can deviate from 19 kHz (in our prototype the resonance frequency was closer to 20 kHz). In view of the value of the inductor, a through-hole version has been used for this (see component list). Without the parallel circuit the crossover point of the correction network is about 16.7 kHz. This is more than enough for audio via VHF FM. The addition of the parallel cir- cuit causes the amplitude around 10 kHz to increase a little, and the -3 dB point is then reached at 13.5 kHz. In the prototype this cut- off point was about 1 kHz higher due to com- ponent tolerances. The board designed for this circuit has been kept as small as possible through the use of SMDs for most components. The dimensions of the FM transmitter board also played a part here. To make it easier to connect this circuit to the transmitter board, a connector was included on this board. The supply voltage and audio signals are carried via this connec- tor. The board has been designed in such a as aerial and connected to the transmitter board (it just so happens there is a via next to C4). To measure the effect of the pre-empha- sis circuit we first measured the frequency response of the output of a small radio. The way that it can either be mounted behind the FM transmitter or alongside it. When the pre-emphasis board is used R1 and R2 should be removed from the transmitter board. When the circuit is mounted behind the transmitter board it was found that the FM signal strength was clearly reduced, so it would be better if a length of wire was used result of this can be seen in the graph (1 = without pre-emphasis, 2 = with pre-empha- sis). It can be clearly seen that the higher fre- quency components are attenuated by the de-emphasis filter in the radio. When the pre- emphasis circuit is connected to the transmit- ter the result is an almost flat response above 1 kHz. The 'bump' around 100 Hz is caused by a type of bass-boost in the radio to improve COMPONENT LIST C2,C8 = lOOnF C3,C6 = 47pF C4 = 2nF2 Resistors (all SMD 0805) R1,R2 = 22kfl C5 = 2nF7 R3 = 10kQ Inductors R4 = 100Q LI = 33mH, e.g. 22R336C Murata Power Solutions R5,R7 = 15kQ (24kQ for 75 \is) R6 = 3kQ3 (3kQ6 for 75 \is) (Farnell# 1077046) R8, R9 = lOOkQ Capacitors C1,C7 = 4pF7 10V Semiconductors IC1 =TLC082CD S08 (Farnell # 8453713) 96 elektor - 7-8/2009 the quality of the sound. The low cut-off point has risen slightly due to the inclusion of two extra coupling capacitors in the pre- emphasis circuit, but in practice this will be hardly noticeable. The current consumption of the transmitter is increased by this circuit from 2 to just over 5 mA. The component values in the circuit diagram are for 50 ps pre-emphasis. For adaptations to 75 ps as used in the USA and other coun- tries, please refer to the parts list. ( 090305 ) Download 090305-1: PCB layout (.pdf), from www.elektor. com/090305 Sensitive Audio Michiel Ter Burg (The Netherlands) As a follow-up to the simple audio power meter described in [1], the author has devel- oped a more sensitive version. In practice, you rarely use more than 1 watt of audio power in a normal living-room environment. The only time most people use more is at a party when they want to show how loud their stereo system is, in which case peaks of more than 10W are not uncommon. With this circuit, the dual LED starts to light up green at around 0.1 watt into 8 ohms (0.2 watt into 4 ohms). Naturally, this depends on the specific type of LED that is used. Here it is essential to use a low-current type. The capaci- tor is first charged via D1 and then discharged Heino Peters (The Netherlands) Many bathrooms are fitted with a fan to vent excess humidity while someone is shower- ing. This fan can be connected to the light switch, but then it runs even if you only want to brush your teeth. A better solution is to equip the fan with a humidity sensor. A disad- vantage of this approach is that by the time the humidity sensor switches on the fan, the room is already too humid. Consequently, we decided to build a circuit that operates by sensing the temperature of the hot water line to the shower. The fan runs as soon as the water line becomes hot. It con- Power Meter via the green LED. This voltage-doubler effect increases the sensitivity of the circuit. Above a tinues to run for a few minutes after the line cools down, so that you have considerably fewer problems with humidity in the bath- room without having the fan run for no rea- son. Naturally, this is only possible if you can fit a temperature sensor somewhere on the hot water line and the line does not become warm if hot water is used somewhere else. We use an LM335 as the temperature sensor. It generates an output voltage of 10 mV per Kelvin. The output voltage is 3.03 V at 30 °C, 3.13 V at 40 °C, 3.23 V at 50 °C, and so on. We want to have the fan switch on at a tem- perature somewhere between 40 and 50 °C (approx. 100-150 °F). To do this accurately, M level of 1 watt, the transistor limits the current through the green LED and the red LED con- ducts enough to produce an orange hue. The red colour predominates above 5 watts. Of course, you can also use two separate, 'normal' LEDs. However, this arrangement cannot generate an orange hue. For any test- ing that may be necessary, you should use a generator with a DC-coupled output. If there is a capacitor in the output path, it can cause misleading results. ( 090203 - 1 ) Reference [1] Simple Audio Power Meter, Elektor July & August 2008. M we first use the opamps in IC2 to improve the control range. Otherwise we would have an unstable circuit because the voltage dif- ferences at the output of IC1 are relatively small. IC2a subtracts a voltage of exactly 3.0 V from the output voltage of IC1 . It uses Zener diode D1 for this purpose, so this is not depend- ent on the value of the supply voltage. The value of R2 must be selected according to the actual supply voltage so that the cur- rent through D1 is approximately 5 mA. It is 600 Q with a 6-V supply (560 Q is also okay), or 2400 Q (2.2 kQ) with a 15-V supply. If you have to choose between two values, use the lower value. Bathroom Fan Controller 7-8/2009 - elektor 97 +6V...+15V IC2b amplifies the output voltage of IC2a by a factor of 16 ((R7 + R8) -s- R8). As a result, the voltage at the output of IC2b is 0.48 V at 30 °C, 2.08 V at 40 °C (104 °F), and 3.68 V at 50 °C (122 °F). Comparator IC3a compares this voltage to a reference voltage set by PI . Due to variations resulting from the tolerances of the resistor values, the setting of PI is best determined experimentally. A voltage of 2.5 V on the wiper should be a good starting point (in theory, this corresponds to 42.6 °C). When the water line is warm enough, the output of IC3 goes Low. R10 provides hysteresis at the output of IC3a by pulling the voltage on the wiper of the setting potentiometer down a bit when the output of IC3a goes Low. IC3b acts as an inverter so that relay Rel is energised via T1, which causes the fan to start running. After the water line cools down, the relay is de- energised and the fan stops. If this happens too quickly, you can reduce the value of R11 (to 33 kQ, for example). This increases the hysteresis. The circuit does not draw much current, and the supply voltage is non-critical. A charging adapter from a discarded mobile phone can thus be used to power the circuit. If the sup- ply voltage drops slightly when the relay is energised, this will not create any problem. In this case the voltage on the wiper of PI will also drop slightly, which provides a bit more hysteresis on IC3a. ( 090078 - 1 ) Backlight Delay Clemens Valens (Elektor France) Vcc Lots of devices are fitted with a liquid crystal display (LCD). Now LCD implies backlighting — that rather useful option that enables us to read the message being dis- played! For devices where there's no need to read the display con- tinuously, the backlight doesn't need to stay lit up all the time — several seconds is often all you need to read the display. This saves a little power and lengthens the life of the backlight. Devices fitted with an LCD also have a processor, and so it's possible to employ a function to control the backlight directly from within the processor software. But some- times it's not possible to imple- ment this sort of function within the microcontroller, because all the control- don't have the source codes or tools needed R1+R2 and ler's pins are already in use, or because you to modify the software. The circuit described tons. Than here has been designed for just such cases. A device using an LCD usually has at least one button that, in most cases, pulls one of the microcontroller inputs down to 0 V when it is pressed. If no such button exists, one can always be added. We can use the signal from this button to control the backlight. As soon as the button is pressed, the backlight is acti- vated, then extinguished a few seconds later by the timer. Using an OR gate, it's possible to use several different buttons to trig- ger the timer. It doesn't take many components to build a timer like this. The OR gate consists of a pull-up resistor as many diodes as there are but- ks to these diodes, transistor T1 98 elektor - 7-8/2009 conducts while the button is pressed, and hence capacitor Cl is charged, the MOSFET T2 conducts, and the backlight comes on. Because R3 has a very low value, capacitor Cl charges very rapidly, so even a very brief press of one of the buttons is enough to trig- ger the timer. Once the button is released, T1 turns off, and Cl then discharges slowly through R4 alone, since T2 has a very high input impedance. When T2's gate voltage falls low enough, it turns off and the back- light goes out. The time the backlight stays lit after all the buttons have been released is roughly R4 (O) x Cl (F) seconds. Of course, this circuit can be used for other applications too, and can be used to switch things other than an LED — for example, a relay. The value of R5 depends on the load being switched. For an LED running off a 5 V supply, a value of around 300 O will be about right. ( 090454 - 1 ) Power On Indicator ©1 K1 D1...D6 = FR606/PR6006 K2 j ~© 1 H D H D2 H D3 f D4 |^D5 |^D6 R1 Cl & lOOu 10V T D8 BAT85 D7 BAT85 Q~ — | ^ L© ■OV+ C2 lOOOu 16V < > < > < > • R2 R3 R4 R5 \ ■OV+ BC550C BC550C 090400 - 11 Ton Giesberts (Elektor Labs) Some types of electronic equipment do not provide any indication that they are actually on when they are switched on. This situation can occur when the back- light of a display is switched off. In addi- tion, the otherwise mandatory mains power indicator is not required with equipment that consumes less than 10 watts. As a result, you can easily forget to switch off such equipment. If you want to know whether equipment is still draw- ing power from the mains, or if you want to have an indication that the equipment is switched on without having to mod- ify the equipment, this circuit provides a solution. One way to detect AC power current and generate a reasonably constant voltage independent of the load is to connect a string of diodes wired in reverse paral- lel in series with one of the AC supply leads. Here we selected diodes rated at 6 A that can handle a non-repetitive peak current of 200 A. The peak current rating is important in connection with switch-on currents. An advantage of the selected diodes is that their voltage drop increases at high currents (to 1.2 V at 6 A). This means that you can roughly estimate the power consumption from the brightness of the LED (at very low power levels). The voltage across the diodes serves as the supply voltage for the LED driver. To increase the sensitivity of the circuit, a cascade circuit (voltage doubler) consist- ing of Cl, D7, D8 and C2 is used to double the voltage from D1-D6. Another benefit of this arrangement is that both halve- waves of the AC current are used. We use Schottky diodes in the cascade circuit to minimise the voltage losses. The LED driver is designed to operate the LED in blinking mode. This increases the amount of current that can flow though the LED when it is on, so the brightness is adequate even with small loads. We chose a duty cycle of approximately 5 seconds off and 0.5 second on. If we assume a current of 2 mA for good brightness with a low-current LED and we can tolerate a 1-V drop in the supply voltage, the smoothing capacitor (C2) must have a value of 1000 pF. We use an astable multivibrator built around two transistors to implement a high-efficiency LED flasher. It is dimen- sioned to minimise the drive current of the transistors. The average current con- sumption is approximately 0.5 mA with a supply voltage of 3 V (2.7 mA when the LED is on; 0.2 mA when it is off). C4 and R4 determine the on time of the LED (0.5 to 0.6 s, depending on the supply volt- age). The LED off time is determined by C3 and R3 and is slightly less than 5 sec- onds. The theoretical value is R x C x In2, but the actual value differs slightly due to the low supply voltage and the selected component values. Diodes D1-D6 do not have to be special high-voltage diodes; the reverse volt- age is only a couple of volts here due the reverse-parallel arrangement. This voltage drop is negligible compared to the value of the mains voltage. The only thing you have to pay attention to is the maximum load. Diodes with a higher current rating must be used above 1 kW. In addition, the diodes may require cool- ing at such high power levels. Measurements on D1-D6 indicate that the voltage drop across each diode is approximately 0.4 V at a current of 1 mA. Our aim was to have the circuit give a reasonable indication at current levels of 1 mA and higher, and we succeeded nicely. However, it is essential to use a good low-current LED. Caution: the entire circuit is at AC power potential. Never work on the cir- cuit with the mains cable plugged in. The best enclosure for the circuit is a small, translucent box with the same colour as the LED. Use reliable strain reliefs for the mains cables entering and leaving the box (connected to a junction box, for example). The LED insulation does not meet the requirements of any defined insu- lation class, so it must be fitted such that it cannot be touched, which means it cannot protrude from the enclosure. ( 090400 - 1 ) 7-8/2009 - elektor 99 Two TV Sets on a Single Receiver Heino Peters (The Nether- lands) With the advent of dig- ital television, it's often necessary to use a sepa- rate receiver. If you have several television sets in your house, you have to buy a digital receiver (and accompanying sub- scription) for each set. The solution described here lets you watch tel- evision in two or more places in your home using a single digital receiver, while allowing the digital receiver to be controlled from both locations. The circuit needed for this is powered from one of the two television sets (see Figure 1). You'll need a length of four-way shielded cable (such as Conrad Electron- ics # 606502) for the con- nection between the dig- ital receiver and the sec- ond TV set. Two shielded conductors are used to transmit the audio sig- nals (L and R) from the receiver to the second TV set, another one is used to transmit the video signal, and the last one is used to transmit the remote control signal from the remote control for the second TV set to the digital receiver located next to the first TV set. The infrared sensor of the second TV set receives the sig- nal from the remote control unit for the dig- ital receiver and sends it via a small circuit to an IR LED aimed at the infrared sensor of the digital receiver near the first TV set. With this arrangement, it's convenient to buy a second (programmable) remote control unit so you don't have to carry the original remote con- trol unit of the digital receiver back and forth all the time. Most digital receivers have two SCART con- nectors for connecting a television set and a video recorder. The second SCART connector can be used quite nicely for the signals to be sent to the second TV set (see the connec- tion diagram in Figure 3). If this connector is already in use, you can always take the audio and video signals from the Cinch connectors (if present). The circuit necessary for converting the infra- red signal received by the second TV set into a new signal for driving the infrared LED at the digital receiver location is shown in Figure 2). The infrared signal from the remote control unit consists of short pulse trains of modulated infra- red light. The modulation frequency varies from one brand to the next and lies in the range of 30 to 56 kHz (B&O, different as always, uses 455 kHz). Fre- quencies in the 36-40 kHz range are most often used in practice. The modu- lation frequency of an infrared sensor is usu- ally indicated in its type number. For example, the TSOP1736 responds to IR light modulated at 36 kHz, the TSOP1738 likes 38 kHz, and so on. Figure4 shows a few IR receivers and their pinouts. Infrared sensors also have adequate sen- sitivity to other frequen- cies close to their design frequency. Consequently, we assume a modula- tion frequency of 38 kHz here, which covers the full range from 36 to 40 kHz. The IR receiver demodu- lates the infrared signal. The demodulated signal forms the input to our circuit, which uses it to generate a new modulated signal for the IR LED located next to the digital receiver. The author opened up his second TV set (watch out for possible sources of high volt- age inside the set!) in order to use the set's built-in IR receiver and tap off power for the modulator circuit. However, you can also fit the circuit with its own IR receiver and use a separate power supply (AC mains adapter). The output signal of the IR receiver is used to trigger an astable multivibrator built around our old friend, a 555 timer 1C. The data line of the IR sensor is High in the quiescent state and goes Low when it receives an modu- lated IR signal. As the Reset input of the 555 responds to an active-low signal, an inverter is built around T1, R2 and R3.The modulation 100 elektor - 7-8/2009 (* TSOP1736 SFH506 TFMS5360 TSOP1836 TSOP4836 SFH505A PIC12043S IS1U60 NJL61H380 SFH5110 ® «0 frequency for IR LED D2 is set to approxi- mately 38 kHz by PI, R1 and Cl. Diode D1 allows the duty cycle of the output sig- nal to be less than 50%, which cannot be achieved otherwise. The rise time of the oscillator signal on the Threshold input of the 555 is set by PI and Cl, while the fall time is set by R1 and Cl. The ratio of PI to R1 determines the duty cycle, which is approximately 30% in this case. With a 5-V supply voltage, PI is set to 1 kO, but it must reduced to a lower value (around 500 Q) with a lower sup- (period: 26.3 ps). To generate a test signal at ply voltage. If possible, use an oscilloscope the 555 output, temporarily connect the cir- to adjust the oscillator frequency to 38 kHz cuit input to ground. + + 090077 - 14 Place IR LED D2 in front of the dig- ital receiver so it shines on the receiv- er's IR sensor. Use the screen of the fourth shielded conductor of the cable between the receiver and TV2 for the negative lead of D2. Resistor R4 is dimensioned for a current of around 100 mA through the IR LED. If you use a 3.3-V supply voltage, R4 must be reduced to 3.3 Q. You can also use this circuit for the remote control of audio or video equip- ment located inside a closed cabinet. ( 090077 - 1 ) Tester for Inductive Sensors +9V Hugo Stiers (Belgium) This tester uses a LED to indicate whether an inductive sensor is gen- erating a signal. It can be used to test the inductive sensors used in ABS and EBS systems in cars, with engine cam- shafts and flywheels, and so on. The circuit is built around an LM358 dual opamp 1C. The weak signal com- ing from the sensor (when the wheel is turning slowly, for example) is an AC voltage. The first opamp, which is wired here as an inverting ampli- fier, amplifies the negative half-cycles of this signal by a factor of 820. The second opamp is wired as a compa- rator and causes the red LED to blink regularly. In order to judge the quality of the signal from the sensor, you must turn the wheel very slowly. If the red LED blinks, this means that the sensor is generating a signal and the distance between the sensor and the pole wheel (gear wheel) is set correctly. If the dis- tance (air gap) is too large, the sensor will not generate a signal when the wheel is turned slowly, with the result that the LED will remain dark, but it will generate a signal if the wheel is turned faster and the LED will thus start blinking. Irregularities in the blinking rate can be caused by dirt on the sensor or damage to the pole wheel (gear wheel). If you connect an oscilloscope to the LED with the engine running, you will see a square- wave signal with a pattern matching the teeth of the gear wheel, with a fre- quency equal to the frequency of the AC signal generated by the sensor. You can also use this tester to check the polarity of the connecting leads. To do this, first dismount the sensor and then move it away from a metal- lic object. The LED will go on or off while the sensor is moving. If you now reverse the lead connections, the LED should do exactly the opposite as before when the sensor is moved the same way. The circuit has been tested extensively in several workshops on various vehi- cles, and it works faultlessly. The author has also connected the tester to sensors on running engines, such as the cam- shaft and flywheel sensors of a Volvo truck (D13 A engine). With the camshaft sensor, the LED blinks when the engine is being cranked for starting, but once the engine starts run- ning you can't see the LED blinking any more due to the high blinking rate. ( 0903161 - 1 ) USB Radio Terminal M Rainer Schuster (Germany) In the January 2009 issue of Elektor we saw how straightforward it is to connect a low- cost RFM1 2 868 MHz ISM (licence-free) radio module to an ATmega microcontroller. Sim- ple example listings in BASCOM demon- strated how to communicate data using the modules [1]. The 'USB radio terminal' circuit described here connects an RFM12 radio module to the R8C/13 microcontroller board used in the 'Transistor Curve Tracer' project described in the February 2009 issue [2]. The populated board, complete with USB interface connec- 7-8/2009 - elektor 101 tor, is available from the Elektor shop. The circuit can be used to transfer data (for example from a PC terminal emulator pro- gram) wirelessly to another microcontroller and vice versa. Of course, the remote micro- controller also needs to be equipped with a radio module. As ready-made and tested boards are avail- able (even the radio module is available from Elektor [3]) building the circuit does not present any great difficulty. All that is neces- sary is to connect a total of six pins of K1 on the R8C/13 microcontroller board to pins on the radio module. The 5 V and ground pins are connected directly to their namesakes so that the radio module draws its power from the microcontroller board. The SPI port on the radio module is driven from port pins P1.0 to PI. 3 on the microcontroller: see the 'circuit diagram'. The microcontroller module will receive its power over the USB cable when it is con- nected to a PC. The author has written R8C firmware in C, available for download in source or hex for- mat from the Elektor website. The C source can be edited and compiled using the 'High Performance Embedded Workshop' IDE by Renesas [2], and further information is avail- able from the R8C pages of the Elektor web- site [4]. The Motorola hex file can be down- loaded over the USB port using the Flash Development Toolkit [2] [4]. To enter pro- gramming mode jumper JP1 must be fitted on the microcontroller board and the reset button pressed briefly. After programming is complete, don't forget to remove the jumper and press the reset button again. The firmware mostly consists of the BASCOM routines written by Burkhard Kainka [1], mod- ified and converted into C. Extra functions have been added to handle the UART1 inter- face, which is connected to the USB interface chip. On the transmit side, the program waits for characters to arrive over the USB port and stores them in an intermediate buffer. When Going for Gold Joseph Kopff (France) The title refers to a popular TV game show where the contestants each have a big but- ton. The gameshow host asks a question and the first contestant to press their but- ton makes an illuminated indicator light up on their desk. The other contestants' buttons are automatically inhibited, so that everyone can see who was the first contestant to press the sequence is received the line of characters is sent to the radio module transmitter using a special protocol. On the receive side, the program waits for characters from the radio module receiver. When the control code ('start of text', 0x02) is received, the subsequent characters are buffered until the stop code ('end of text', 0x03) is received. The transmitted message includes a trailing checksum, so the complete sequence of characters is . If the check- sum is correct, it, along with the and characters, is discarded, is appended, and the resulting string sent out over the USB port to the PC. Of course, strings and commands can be sent over the radio link to other applications. In some cases the protocol will have to be adapted. In particular, because of the limited available RAM on the R8C/13 (1 kB) the inter- mediate buffer is only 200 bytes long. This should be adequate for most uses. their button, and so is allowed to answer the question. The project described here shows how to build a similar sort of refereeing device yourself, using simple resources and without needing a microcontroller, which is pretty rare these days! The basic circuit is for just two contestants, but the modular design means it can easily be expanded. As configured, the software uses a data trans- fer rate of 9600 baud with 8 data bits, 1 stop bit, no parity and no handshake. The terminal program (for example, Hyperterminal) must be configured to match these settings. ( 090372 - 1 ) Internet Links [1] www.elektor.com/071125 [2] www.elektor.com/080068 [3] www.elektor.com/090372 [4] www.elektor.com/service/r8c-information.78378. lynkx Products 071125-71: 868 MHz radio module, populated and tested, available via [3] 080068-91: R8C microcontroller board, populated and tested, available via [3] Download 090372-11: source code and hex files, from [3] M The diagram shows three buttons: S2 and S3 are the buttons for the two contestants, SI is the button for the host, which allows them to reset the circuit before each fresh question. The 'brains' of the circuit is IC1, a 4013 dual D- type flip-flop, of which only the Set and Reset inputs are used here. This circuit can handle quite a wide supply voltage range, from 3 to 15 V, and so the project can easily be run off 102 elektor - 7-8/2009 a 4.5 V battery pack (the power consumption is minimal). IC1 is armed by pressing SI (reset). In this state, the non-inverting outputs (pins 1 and 13) are at 0 and the inverting outputs (pins 12 and 12) are at 1. Hence line A is pulled high by R1, since diodes D2 and D4 are not biased on. If contestant 1 presses button S2, the non-inverting output of flip-flop ICIa goes to logic 1, and LED D1 lights via T1 to indi- cate that contestant 1 has pressed the but- ton. At the same time, the flip-flop's invert- ing output goes to logic 0, making diode D2 conduct. Line A is now pulled down to 0, and consequently contestant 2's button S3 can no longer trigger the second flip-flop. The reverse happens if it is contestant 2 who presses their button S3 first. The circuit can be extended to 4 or 6 contest- ants (or even more) by adding a second or third (or more) 4013 1C. All you have to do is repeat the circuit (minus R1, R2, and SI) and +4V5 +V DD connect to the A, B, Vdd, and 0 V lines on the (O8ii83-o right-hand side. Cut-rate Motorbike Alarm M T.A. Babu (India) Motorbikes are often a target for thieves. Here is an alarm that's loud, cheap and simple to build. Arming and disarming the alarm is done with a hidden switch, SI . This tiny circuit does not unduly load the battery, as it draws very little current in the standby condition. To activate the alarm, turn or press the hid- den switch SI to the 'on' position. If anyone attempts to start the motorbike, +12 volts from the ignition switch (connected to 'B') causes transistor T1 to conduct and switch on T2. The siren (LSI) then sounds for about 20 seconds, the period being determined by FET T3 wired as a monostable timer. The siren is a high-power ready-made piezo horn of the self-oscillating type. Another piezoelectric component in the cir- cuit has a different purpose — Bzl detects attempts to tamper with the vehicle, or move it without starting the engine. The piezo trans- ducer element should be mounted in such a way as to faithfully pick up vibration from the motorbike frame due to tampering. One set of contacts on relay RE1 is used to effectively disconnect the ignition coil to pre- vent the bike from functioning when some- one tries to steal it. Usually, there is a wire running from the alternator (point A) to the ignition coil (TR1), which has to be routed through the N/C (normally closed) contact of the relay. The hidden switch SI is prefer- ably a miniature type or its electrical equiv- alent. To deactivate the alarm, the hidden switch should be flipped to the 'off' position to disable the movement sensor and the siren driver/timer circuit when the ignition key is turned... by the lawful owner! (090338-1) 7-8/2009 - elektor 103 Digital Sweep and Sinewave Generator M with direct frequency entry Wilfried Watzig (Germany) The Parallax SX28-based 'Fre- quency Response Sweep Oscilla- tor' project published in the April 2008 issue of Elektor inspired the author to develop a similar circuit based on the ATmega48 microcon- troller. As it turns out, the ATmega- based circuit is nearly as capable as the original. An important characteristic of the design is the maximum direct dig- ital synthesis (DDS) sample rate that can be achieved when gen- erating a sinewave. The specifica- tions are comparable: SX28 design: f DDS = 50 MHz / 28 cycles = 1.78 MHz ATmega48 design: ^dds = 25 MHz / 18 cycles = 1.39 MHz At 25 MHz, the ATmega48 is some- what overclocked in this circuit. The maximum specified clock fre- quency according to the datasheet is 20 MHz. In sinewave generation mode the desired In practice, however, this does not seem to frequency is entered directly on the keypad lead to problems. The other important part of the cir- cuit is the digital-to-analogue con- verter (DAC) connected to Port D of the microcontroller. This takes the form of an R-2R network and can approximate a sinewave with a sample rate of 1 .39 MHz. The dig- ital values are read from a look-up table. A passive sixth-order Butter- worth low-pass filter with a cor- ner frequency of 500 kHz is used to smooth the DAC output. This is particularly necessary at higher frequencies. The user interface is principally provided via a twelve-button tel- ephone-style keypad. In sweep mode the four rows of buttons (1-2-3, 4-5-6, 7-8-9 and *-0-#) are used to adjust the marker fre- quency up and down in coarse or fine steps. in Hertz. For example, to enter 12 kHz, type Characteristics Digital sweep function: • Frequency ranges: 100 Hz to 100 000 Hz or 50 Hz to 15 000 Hz, • logarithmic scale with 256 steps • 2 sweep rates: 0.2 ms or 0.4 ms per frequency value (phase accumulator increment value changed every 0.2 ms or 0.4 Outputs in sweep mode: • sine output • marker frequency (rectangular wave) • marker position pulse • trigger pulse at start of each sweep Digital sinewave operation: • Direct frequency entry in Hertz via keypad • Format: '*' = start of entry digit(s) 0 to 9 '#' = end of entry, start sinewave generator Outputs in sinewave mode: • sine output (0 V pp to 4.5 V pp ) • frequency/marker pulse (rectangular wave) ms) The main features of the unit are listed in the text box, and the func- tions of switches SI to S3 are given in Table 1. The digital outputs on Port B are protected from short circuits by series resistors. The amplitude of the sinewave out- put can be set between 0 V pp and 4.5 V pp using PI. The ATmega48 chip can be pro- grammed using the 10-way ISP interface connector provided. The firmware for this project was writ- ten in assembler using the Atmel AVR Studio 4 development sys- tem, version 4.14. The project files (source code and hex) are avail- able for free download from the Elektor website [1]. The zip file also includes a screenshot showing the fuse settings required for the microcontroller in AVR Studio 4. As an alternative to the program-it- yourself route, ready-programmed microcontrollers are available from the Elektor Shop. ( 080577 - 1 ) Internet Link '*12000#'. The usable frequency range runs from around 10 Hz to 500 kHz. In order to ensure that a clean out- put signal is produced the timer interrupt is disabled during sine- wave generation. If a button is pressed a pin change interrupt is triggered which enables the timer so that a new frequency value can be entered. The sinewave frequency accuracy and stability are determined by the quality of the 25 MHz crystal. There may also be a small error in absolute frequency resulting from rounding errors in the calculation of the DDS phase accumulator increment value. The DDS phase accumulator incre- ment value is derived from a set of values stored in a look-up table: increment = freq * 2 24 * cycles / f osc for freq = 2 k , k = 0 to 19. The total increment value is calculated to 24 bits of precision. 104 elektor - 7-8/2009 [1] www.elektor.com/080577 Downloads and products 080577-41: ready-programmed ATmega48 microcontroller 080577-1 1 : source code and hex files, from www. elektor.com/080577 Table 1 . Function of switches SI to S3 Open Closed SI (frequency sweep range) 50 Hz to 15 kHz 100 Hz to 100 kHz S2 (sweep rate) 0.2 ms 0.4 ms S3 (sinewave/sweep output) sinewave output sweep output + + Marker Frequency Sweep Trigger Wobbulator/ Wobbulator Frequency Sine wave gen. rate range 080577-11 Guitar Amplifier PSU Malcolm Watts (New Zealand) Tubes (thermionic valves) have never departed from the amplified instru- ment scene and the majority of gui- tarists, including very young ones, wouldn't use anything else. Some die- hards think that the H.T. (high tension) rectifier should also be a piece of glass- ware and some manufacturers are still producing amplifiers incorporating one. The nett effect is really that a rec- tifier tube acts as a relatively effective heat-dissipating resistor, causing the HT rail to sag as output signal loading increases, generating a compressive characteristic which is fundamentally added distortion ('crunch'). The traditional arrangement uses a cen- tre-tapped HT winding on the power transformer but this has a number of drawbacks for an adequately rated core size including increased voltage stress, small wire size and a poor utilisation of the available winding window. The example arrangement shown here reduces both of these problems and for a given core increases the current deliv- ery capability of the winding by allow- ing the use of a heavier wire gauge. Nor- mally some resistance is added in series to each anode to limit peak cathode current to minimise cathode-stripping during the high current pulses deliv- ered to the input filter capacitor at each voltage peak. Even if one includes such resistance (and a single resistor in series with the cathode or winding achieves 7-8/2009 - elektor 105 the same end albeit with double the device dissipation) the benefits to the transformer of reduced voltage stress and increased wire insulation thickness (which scales with wire diameter) along with decreased heating in the windings, are obvious. Alternatively, a smaller winding window (reduced core size) may be employed with- out diminishing power-handling capacity. The circuit shown here should is typically intended for the amplifier preamp and phase splitter stages. Due to the use of the EZ81 (6CA4) tube its maximum output current is about 100 mA. Higher currents call for a more powerful rectifier tube and diodes to match. ( 081067 - 1 ) Acoustic Distress Beacon M Werner Ludwig (Germany) An ELT (Emergency Locator Transmitter, also known as a distress beacon) is an emergency radio transmitter that is activated either man- ually or automatically by a crash sensor to aid the detection and location of aircraft in dis- tress. This acoustic ELT project is intended for radio-control (RC) model aircraft, which every now and then decide to go their own way and disappear into the undergrowth. The audio locating device described here enables model aircraft that have landed 'off limits' to be found again and employs its own independent power supply. The small cam- era battery shown in the circuit activates an acoustic sounder when radio contact is lost and produces a short signal tone (bleep) every ten seconds for more than 25 hours. Current consumption in standby and pas- sive (with jumper J1 set) modes is negligible. The timing generator for the alarm tone is the Schmitt trigger AND-gate IC1 .B; its asym- metric duty cycle drives a 5 V DC sounder via MOSFET transistor T1 . All the time that the RC receiver output is delivering positive pulses, the oscillator is blocked by IC1.A and diode D1. Setting jumper J1 parallel to C2 also disa- bles the oscillator and serves to 'disarm' the distress beacon. ( 090037 - 1 ) Internet Link http://en.wikipedia.org/wiki/Emergency_Position- lndicating_Radio_Beacon Measuring Milliohms with a Multimeter Klaus Bertholdt (Germany) Low values of resistance can be troublesome especially when large currents flow through them. A current of, say, 10 A passing through a terminal with a contact resistance of 50 mO will produce a voltage difference of 0.5 V.This resulting power loss of five watts is dissipated in the termination and can give rise to a dangerously high temperature which may degrade insulation around the wires. Measuring low values of resistance is not easy. Low cost multimeters do not include a milliohm measurement range and special- ist equipment is expensive. The simple cir- cuit described here allows milliohm meas- urements to be made safely on a standard multimeter. The circuit consists of little more than a 6 V voltage regulator and a mains adapter capable of supplying around 300 mA at 9 to 12 V. The circuit supplies a fixed cur- rent output of 100 mA or 10 mA selected by switch SI . This con- nects either the 60 O or 600 Q resistor into the constant current generator circuit. The resistor values are produced by parallel- ing two identical resistors; 120 Q and 1.2 kO from the E12 stand- ard resistor range. Two test leads with probes are used to deliver current to the test resistance. The resultant voltage drop is measured by the multimeter (Ml). With the 106 elektor - 7-8/2009 test current set tolOO mA a measurement of 1 mV indicates a resistance of 10 mQ. At 10 mA (with SI in the position shown in the diagram) a measurement of 1 mV indicates a resistance of 100 mO while 0.1 mV is equal to 1 mO. Diode D1 protects the meter from too high an input voltage. With the voltmeter connected as shown in the diagram it measures not only the voltage drop across R x but also that produced by the resistance of the test leads, and probes. To make a true measurement, first touch the probes close together on the same lead of the test resistance and note the reading, now place the probes across the test resistance and note the reading again. The first read- ing measures just the test leads and probes while the second includes the resistance R x . Subtract the first measurement from the sec- ond to get the value of R x . The accuracy of the measurements are influ- enced by the contact resistance of switch SI, the precision of resistors R1 to R4, the 6 V supply level and of course the accuracy of the measuring voltmeter. For optimum decoupling Cl should be fitted as close as possible to pinl of IC1. An addi- tional electrolytic capacitor of around 500 pF can be used at the input to the circuit if the input voltage from the AC power adapter exhibits excessive ripple. ( 080851 ) Snail Mail Detector Philippe Temporelli (France) Since his letter-box is outdoors and quite some way from the house, the author was looking for a simple means of knowing if the postman had been without having to go outside (contrary to popular belief, the weather isn't always fine in the South of France). Circuits for this kind of 'remote detection' come up reg- ularly, but always involve run- ning cables between the letter- box and the detection circuit in the house. Seeking to avoid run- ning any extra cables, the author had the idea of using the exist- ing cables going to the doorbell, conveniently located adjacent to his letter-box. The letter-box has two doors: one on the street side for the postman, and one on the gar- den side for collecting the post. A microswitch is fitted to the street-side door, to light an indi- cator in the house showing that the postman has been. A second microswitch is fitted to the door on the garden side, to turn off the indicator once the post has been collected. The only diffi- culty then remains to connect these detectors to a remote cir- cuit in the house that remem- bers whether the postman's been or not. The idea was to use the alternat- ing half-cycles of the AC signal on the cable going to the door- bell to transmit the informa- tion, according to the following logic: - Both half-cycles present: no change in the status of the mail detector. - An interruption (even brief) of one half-cycle: indicator lights permanently. - An interruption (even brief) of the other half-cycle: the indica- tor goes out. Note that the signal is tapped off across the doorbell coil via R6 and the pair of diodes connected in inverse-parallel (to limit the signal, particularly when the bell is rung). The signal is then filtered by R2/C1, before being used by IC1, which is wired as a comparator with hysteresis. The trigger threshold is adjusted by PI, using a pair of inverse-paral- lel diodes as a voltage reference (positive or negative according to the output state): For the detection to work, there has to be continuity in the bell- push circuit — this is generally ensured by the little lamp illumi- nating the bell-push. Resistor R1 is added just in case the lamp is blown or not present. To keep things simple, the cir- cuit is powered directly from the doorbell transformer itself (230 V / 8 V). The author managed to fit the little circuit within the door- bell unit, with the LED poking through a hole in the casing so it is readily visible in the hall of his house. ( 090481 - 1 ) 7-8/2009 - elektor 107 DMX Transmitter M Gerald Weis (Austria) Lighting effects are always popular at special events, whether large or small. For example, a spotlight with a moving head can be used to project a company logo or other image on the wall or ceiling. These special-effect light sources are controlled by the widely use DMX protocol [1], for which many PC-based programs are available. However, providing some sort of PC and setting up the USB and DMX hardware involves a certain amount of extra effort and expense. Consequently, the because the MSP430 has an internal oscillator. If you use the internal oscillator, it's important to adjust the frequency precisely using resis- tor R6 = R osc (also shown in the schematic diagram). The microcontroller data sheet [3] lists the appropriate values. To check the fre- quency of the internal oscillator, it should be fed out to an I/O pin and measured. A LED that indicates that the transmitter is operating is driven via port pin P2.0. Exten- sive information on the DMX driver (IC3) and its circuitry is available on the Web [4]. As with every project, this one also has room for improvement. If you use the internal oscil- lator of the MSP430, the DMX bus may not operate at the right speed if the temperature changes. However, this could be compen- sated by measuring the temperature with the temperature diode in the MPS340 and mak- ing suitable adjustments. A display would also be a nice addition. Anyone who is inter- ested in expanding on the current design is welcome to contact the author [7]. ( 081158 - 1 ) author built a small stand-alone DMX trans- mitter that can easily be configured using three buttons. The entire circuit is based on a Texas Instru- ments MSP430F2112 microcontroller, along with an SN65HVD10QD RS485 transceiver 1C from the same manufacturer (note: both ICs can be obtained from Tl as samples). In addition, it requires a small circuit board, a female XLR connector, three pushbutton switches, and a few resistors and capacitors. The circuitry around the MSP430 (including the JTAG port) is standard. More information about the microcontroller is available on the Web [2]. The schematic diagram shows a quartz crystal, but it can be omitted if desired The author wrote the firmware for the micro- controller, which must be adapted to the actual DMX device that is used. The author's C source file for this project can be down- loaded from the Elektor website [5]. IAR Kick- start Edition, which can also be downloaded from the Elektor website [6], can be used as the development environment. The code for initialising the serial interface is also shown on the Tl website. The program transmits 25 DMX channels at once. Inter- rupts are used to handle pushbutton input and transmit the DMX data. In the author's example software, one button is configured for the tilt motion of the Futurelight MH-640 moving head unit, while the other two but- tons are unused. Internet Links [1] http://en.wikipedia.org/wiki/DMX512-A [2] www.ti.com [3] http://focus.ti.com/lit/ds/symlink/msp430f2112.pdf [4] http://focus.ti.com/docs/prod/folders/print/ sn65hvd10.html [5] www.elektor.com/081158 [6] www.elektor.com/081041 [7] hihi85@gmx.at Download Software 081158-11: source code files, from [1] elektor - 7-8/2009 QUASAR electronics Quasar Electronics Limit' PO Box 6935, Bishops Stc CM23 4WP, Tel: 08717 1 Fax: 07092 United Kingdd [77168 03496 E-mail: sales@quasarele Web: www.quasarelectrc ed rtford m ctronics.com nics.com (EU) - £8.95; R^st of World - £ nline for reduced price UK Pd & Packing Options (Up to 0.5 Delivery - £4.95; UK Mainland Postage 3-7 Day Europe !Order We accept all major cr^dit/debit cards to Quas Please ;ar Electronics, visit our online projects, modules and Prices include shop now for c| publications Credit Card UK Standard ery - £9.95; Kg) ( j i - j - li-l C I IiaU.OiAfcF.t-llfL.EITUXUll NW. h-P.1l l"Hl-l IhM I-J ■ I ¥ nurve no j^Drk c- i_l_c XGS Cwtn&lrtr- .J" StFi^AVR. IS? N^ir Prn^Mnme- ^•SV Fwmr $jppty A/V Cah:e-.>^ , PC ^en-a! t\:rt L-u KtiTa frnnYK-tei. ov&^ew. “ / LCH Mkrg« 5D OH * Adhpifr u jBoiaif^! e Connote Dc^kn.. and M-arr- 1 ■ ■ a SU* l - - ' m ±_m B I < *■ ae J" S rin hiri j WWW.XGAME S T AXLQjy..j: Prototype & small series PCB specialists EURO CIRCUITS v>c» P r ° PCB Instant online pricing and ordering Low order-pooling prices - 1-8 layers Full options service On demand - 1-16 layers Deliveries from 2 days Stencil service PROTD Call us: 020 8816 7005 Email: euro@eurocircuits.com www.eurocircuits.com - 2 boards in 2, 3 or 5 days - No tooling charge |- Low PCB-Proto prices E.g. 2 x 100 x 80 mm: 2 layers 38.12C each* 4 layers 77.23C each* I- Immediate online ordering |- No minimum order charge ^excluding transport and VAT r Elektor SMT Oven Multi-purpose and indispensable to professional and enthusiast Selected, tested & certified by Elektor Including Elektor-produced user manual voucher ana Kit Starter 5 1 1 £l00/€ worth FREE totally with yoor oven Fully menu controlled Art. # 080663-91 • Price: £962.00 • € 1195.00 • US $1665.00 (Excl. VAT) SMT Expert Tip: Double-sided Soldering Demovideos available on the Elektor website Ideal for R&D laboratories, schools, small companies and... electronics enthusiasts Product support from Elektor Customer Services lektor SHOP Main technical specifications Line voltage: 230 V AC / 1 650 W Line frequency: 50-60 Hz Size: 418x372x250 mm (16. 5 x 14. 6 x 10 inch) Weight: 1 6.7 kg (net) Effective PCB area: 280 x 280 mm (11x11 inch) V J Further information and ordering atwww.elektor.com/smtoven ■ iirp i j 7-8/2009 - elektor 113 M Improved Hybrid HeadPhone Amplifier Tuck Choy, PhD (Singapore) Jeff Macaulay's excellent single valve ECC82/ 12AU7 'Hybrid Headphone Amp' (HHA) pub- lished in [1] spurred the author to implement some modifications culminating mainly in an additional input preamp. The resulting project was then slightly reworked in the Elektor Audio Labs and the result is shown here, along with a PCB design to Elektor standards. Specifications • Warm up time: min. 30 minutes • Load impedance: 33 Q • Supply voltage: 12.1 VDC • Current consumption: 235 mA • Gain (33 Q load): 4.5 • Max. output voltage: 730 mV (THD = 3%, clipping audible) • THD + N: 0.13 % (1 mW/1 kHz/B = 80 kHz) • S/N: 87 dB (ref. 1 mW, B = 22 kHz) • Bandwidth: 17 Hz - 3.5 MHz (at 1 mW) • Output impedance: 2 Q • DC output voltage: 1 mV (33 Q load) 3 mV (150 Q load) D2 ©- P - M T 12V O-p- 1N4004 T5 BC517 R7 £ ^ IS fioou L_ _hsv 0 ol col LOl 0 ci ° Hh 10u IR * 0 P-l T10 o BC550C,, II J -Jj 9 R17 a BC550C R20 8k06 Cl 2u2 R6 TR4 lOOOu C5 25 V ^JT4 r€> T3 BC517 D1 I °T2 R21 R 19_ 33k 2200u 25V R5 ^ J 1 2x BC550C R 8 10k I C2 lOOn R1 C3 R2 R3 lOOu <> • 25V BD139 ^00n R12 TR14 VI ECC82 12AU7 |R9 R11 RIO 25V D3 T12 T8 C6 II 2u2 Q> "i S| ^ T-l 4, -L 2! q: O | CO | LO BC517 C9 T6 L^ G> m. C8 lOOu « ( ► R13 P P 2x BC550C R 15 10k 2200u 25V BC550C 100u 25V C12 0 R22 BC550C R26 8k06 R27 111 — ^ L ,c®1 R2^ 33k R23 a P 080310 - 11 114 elektor - 7-8/2009 The original HHA was designed for line inputs of the order of 1 V rms and an output imped- ance of about 35 ohms. Unfortunately there do not seem to be hard and fast international standards for headphone output levels or impedances. Higher end headphones such as the AKG type K601 (impedance 125 ohms) and K701 (impedance 62 ohms), coupled a hi- fi preamplifier system like the author's Rega Mira (which supplies only 600 mV rms out) resulted in a compromised dynamic range and low loudness performance especially on older CD recordings. Initial experiments with modifying the BC517 Darlington output of the HHA were rather unsuccessful. The low anode current from the valve requires this specialized gain stage and any efforts to boost the output seems to modify the system from a valve based amplifier into a transistor one and the result- ing audio performance was also not encour- aging. The main problem with the original HHA is both its strength and weakness, as the unity-gain valve cathode follower does not offer any voltage gain in the first place. The low noise and distortion due to the valve is no doubt offered by its low anode voltage and hence low noise and distortion characteristics. Referring to the circuit diagram in Figure 1 a Measurement data Voltages measured w.r.t. circuit ground T1/T6 base 0.7 V T2/T7 base 1.4V T3/T8 base 3.8 V T3/T8 Emitter 2.8 V ECC82 grid 4 V T10/T12 Emitter 6.2 V T9/T11Base 0.67 V ECC82 anodes 10V ECC82 pin 5 9.4 V D2 (across device) 0.8 V T5 VCE 1.3 V R6/R14 (across device) 6.85 V the Specifications listed here were obtained with feedback in place. Without feedback, the outputs carry no direct voltage. The negative feedback feature was found quite useful such as with the AKG K701 to further boost performance, but this is a rather sub- jective feature you might like to experiment with for yourself. Capacitor Cl (C6) gives the circuit a reasonable specification for its low- frequency roll-off. In the prototype of the amplifier, the ECC82/ 12AU7 required about 15 minutes of warming from the project webpage. You'll notice that the solder side of the board has large copper fill areas to maximise the ground plane sur- face, which helps to keep noise and all sorts of interference down to a minimum. The valve socket has a rather spacious footprint as well as large holes to allow sockets from different suppliers to be used. ( 080310 - 1 ) Component List Resistors R1,R8,R9,R15 = 10kQ R2,R4,R10,R12 = 91kQ (E96: 90kQ9) R3,R11 = 15kQ R5,R13 = 22Q R6,R14,R16 / R17,R22 / R23 = IkQ R7 = 39kQ R18,R21,R24,R27 = 560Q R19,R25 = 33kQ R20,R26 = 8kQ06 Capacitors C1,C6 = 2pF2 100V, lead pitch 22.5mm (WxL = 10 x 26 mm abs. max.) C10,C12 = lOpF 63 V, lead pitch 22.5mm (WxL = 10 x 26 mm abs. max.) C2,C7 = lOOnF, MKT, lead pitch 5mm or 7.5mm C3,C8, 01,03 = lOOpF 25V, lead pitch 2.5mm, diam. 8.5 mm max. C4,C9 = 2200pF 25 V, lead pitch 7.5mm, diam. 18mm max. C5 = 1000 pF 25 V, lead pitch 5mm, diam. 10 mm max. Semiconductors D1,D3 = red LED D2 = 1N4004 T 1 ,T2,T 6,T7,T9,T 1 0,T 1 1 ,T1 2 = BC550C T3,T5,T8 = BC517 T4 = BD139 Miscellaneous VI = ECC82 or 12AU7 9-pin ('Noval') PCB mount socket, e.g. Conrad Electronics # 120529 PCB, # 080310-1 from www.thepcbshop.com stereo amp is shown, as opposed to a mono- block for the original HHA. The hunt for a suitable input voltage amplifier to slightly boost the voltage gain resulted in the use of a dual BC550C inverting shunt feedback amplifier with a voltage gain of about 8. Being an inverting amplifier it conveniently allows some negative feedback (about 3%) to be introduced using 33 kO resistor R19 (R25). The feedback causes a direct voltage of a few millivolts at the amplifier outputs, and up before normal operation was obtained. This is due to the relatively low heater volt- age of about 9.4 V from the BD139 series pass element. The functions of T5/C5 and T4 are explained in some depth in the original article. The single-sided circuit board design shown in Figure 2 allows a stereo amplifier to be built. The copper track layout for making your own PCB can be downloaded free of charge Reference [1] Hybrid Headphone Amp, Elektor July & August 2006; www.elektor.com/050347 Downloads & Products PCB design No. 080310-1 (.pdf) at www.elektor.com/080310 7-8/2009 - elektor 115 Braitenberg Robot M Abraham Vreugdenhil (The Netherlands) In 1984 Valentino Braitenberg published a nice demonstra- tion to show the behaviour of robots. The question is: what IS behaviour or what do we THINK behaviour is. This dem- onstration uses simple robotic vehicles, each of which con- tains a very simple program. Each robotic vehicle has two driven wheels and two light sensors at the front. These sensors look towards the front and each drive a motor. The robots also have a bumper to sense whether they have hit anything. This can be either a wall or another robot. Now, in the simplest form of the robotic vehicle, the left front light sensor is connected with the right rear wheel. Likewise the right front light sensor is connected to the left rear wheel. If we now place the robotic vehicle in a space with a light source, the robotic vehicle will move towards the light source. There are, however, also vehicles where the left front sensor is connected to the left rear wheel and the right front sensor to the right rear wheel. Such a robotic vehicle will avoid a light source instead. Now, suppose you have multiple light sources which are repeatedly turned on and off, as well as mul- tiple robotic vehicles with different behav- iours, what will happen? You will first see that all the light seekers go towards the light source and all the light avoiders move away. When the light sources subsequently move, all the robots will spring into action and this results in new activity. If you're an outsider or you do not know in advance what sort of program is contained in the robotic vehicles, then it is nice to discuss what is happening here. People have the tendency to attribute various kinds of human behaviour to certain devices and robots. This one is 'aggressive', the other 'evasive' or passive. Whole discus- sions are started based on a few robotic vehi- cles driving around with each ultimately con- taining a very simple program. Perhaps this says more about the method of thinking or the behaviour of the spectators then it does about the behaviour of the robotic vehicles themselves. How can this experiment be repeated in a simple way? You need a number of small and cheap robots that can easily be programmed and changed to suit your needs. A few years ago the company Arexx [2] introduced a trim robot construction kit onto the market, the Asuro. This robot is available from Conrad Electronics [3], among others. The Asuro con- tains an Atmel ATmega processor with a built- in hex loader. You can write programs for the Asuro in C or (simpler) in Bascom [4]. Using an IR interface (with the supplied RS232 IR trans- ceiver) the hex program can be sent to the Asuro. A USB IR transceiver is also available. The Asuro also has an experimenting board available. Here the board is used for three purposes. You connect two bumper sup- ports, mount two light sensors and finally add a piezo-element (according to Figure 1). For the light sensors on the experimenting board you use the two IR diodes normally mounted underneath the Asuro (these are T9 and T10). Fit these with a little plastic tube. On the expansion board you use the con- nections for the red LED Dll to connect the piezo element. To distinguish between the different robotic vehicles you give each a dif- ferent colour by wrapping the battery com- partment in paper of different colours. You can also give each robotic vehicle an unique number internally. While driving around the robots can continuously transmit their behav- iour, i.e. decisions via the IR transceiver. If you mount an IR transceiver above the 'playing field' you can follow everything the robots 'do' on the computer. The program, written by the author for this purpose, can be downloaded from the Ele- ktor website [1]. A general overview of what the pro- gram does is given here. After it starts up it first waits for a second in the I NIT routine. If a bumper is pushed during this time, the light seeking behav- iour is activated. If the bumper is not pushed then the behav- iour will be light avoiding. After a short beep it waits to check whether the number of the robot has be changed or not. This is done by pushing the bumper a number of times. If not, the EEPROM is checked to see if it already contains a number. If a valid entry is found then that number will be used, oth- erwise the number 10 is used. The main loop consists of three parts: a bumper part (A), a light avoiding/seeking part (B) and a random component (C). The program is written in Bascom AVR. For more information refer to the program list- ing (download # 090348-11). The Bascom AVR generated hex file is transferred to the Asuro using the Flash.exe program supplied with the Asuro. You can then start again, deter- mine the behaviour by pushing the bumper, followed by entering a number by pushing the bumper a few times and the Braitenberg- Vehicle is on its way. Get ready for long dis- cussions on what these robots are doing and what behaviour is taking place. To produce the random light changes on the playing field, the author designed a circuit with a 98C2051 and a few solid-state relays, which ensures that four incandescent lamps at the side of the playing field light up in dif- ferent combinations every 25 seconds. This effect ensures that the robotic vehicles will continue to search and avoid. ( 090348 - 1 ) Internet Links [1] www.elektor.com/090348 [2] www.arexx.com [3] www.conrad-int.com [4] www.mcselec.com Download Software 090348-11: Bascom and hex file, from [1] 116 elektor - 7-8/2009 ^ New processor board, increased software capabilities and mechanical upgrades Upgrade your Profiler to a PRO milling machine with: New 3D controller Requested by many and now available! ColiDrive The control software has been expanded with quite a few new options. New Z-axis with floating head More stable and easier to mount and calibrate. Professional engraving head With this head the milling depth can be set very accurately! r-llektor L_3shop Order now: 3D controller-board (assembled and tested) £339.00 / US $494.00 / € 380.00 incl. ColiDrive en ColiLiner update New Z-axis with floating head (assembled) £404.00 / US $590.00 / €454.00 Professional grade engraving head £263.00 / US $384.00 / € 295.00 Prices include VAT, exclude postage and packing. Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 Profiler Pro More information, demo video and ordering at www.elektor.com/profilerpro Completely updated The program package consists of eight databanks covering ICs, transistors, diodes and optocouplers. A further eleven applications cover the calculation of, for example, zener diode series resistors, voltage regulators, voltage dividers and AMV's. A colour band decoder is included for determining resistor and inductor values. Each databank contains the following on (almost) any component: enclosure drawing, pin connections, tech- ISBN 978-90-5381-159-7 £24.90 • US $39.50 Elektor's Components Database 5 nical data (as far as known). Also included is a search engine acting on user supplied parameters. The ECD gives you easy access to design data for over 5,400 ICs, more than 35,800 transistors, FETs, thyristors and triacs, just under 25,000 diodes and 1 ,800 opto- couplers. All databank applications are fully interactive, allowing the user to add, edit and complete component data. This CD-ROM is a must-have for all electronics enthusiasts! “Jlektor SHOP Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 L Further information and ordering at www.elektor.com/shop M J 7-8/2009 - elektor 117 An E-Blocks IR RC5 Decoder Jose Basilio Carvalho (Portugal) The infrared (IR) decoder described here was designed to enable an E-Blocks development system [1] to process com- mands from RC5 (compatible) remote controls typically used for Philips audio/ video equipment. The E-blocks comple- ment consists of 1 x PICmicro USB Multiprogrammer EB- 006 with 4 MHzxtal; 1 x EB-007 (8 push to make switches) con- nected to PORTC; 1 x EB-005 imitation LCD board (16x4) con- nected to PORTA; 1 x EB-004 LED board or 8-Relay board connected to PORTD; 1 x EB-004 LED board connected to PORTE (or just one LED and a 470 O resis- tor on RE1). +5V Tr2 R3 H 22k h - R4 - — | 100R |- 3 1 1 - R5 ~ — | 100R [ — Q SUB-D9 ^ 6 S2 H 47u 16V 2 IC1 + * si 6 H TSOP1736 TSOP1736 080996 - 1 1 The original EB-005 E-Block has a 16x2 LCD. For the purpose of this project, an EB-005 was reverse-engineered and rep- licated on prototyping board and wired to accommodate a 4x16 LCD. The home made board has a SIL socket strip that also accepts 16x1 and 16x2 LCDs, all of which were found to be pin compatible. Photos of the author's DYI EB-005 are available at [2]. The proposed IR decoder board is connected to PORTB. Once fully debugged and tested in terms of hardware and software, an E-blocks system may be 'undressed' and replicated as a stand-alone circuit with just the basic elements and running firmware. In most cases, the circuit boils down to no more than a (PIC) micro with some I/O devices around it like switches, sensors, relays and LEDs. If changes or extensions are required, you build up the E-blocks con- stellation again, do whatever is neces- sary to get it all to work, save the new .fcf and make the system blow a fresh PIC for inserting into the stand-alone system. Here the PIC16F877microcontroller runs at 4 MHz to decode signals matching the Philips RC5 protocol. The complete E-Blocks layout can be used to test remote controls with suspected faults, and to switch 8 devices using a 'known good' control. The address and command decimal values appear on a 16x4 LCD display. The decoder proper (Fig- ure 1) is just a standard application circuit of the TSOP1736 IR decoder 1C with some com- ponents around it for connectivity with the E- blocks PORTA (based on sub-D connectors). Keys 1 to 8 of the remote are used to control * " 3 i 5 ■ " jPB 3r vv. nu if* C'.t vj hi 4 uPDRl D7 K D5 D4 D3 D 2 C7 Cfc C5 C4 -3Hi- -A- -3^3- -4 Bin® ^ Mira ^ ■ C eight bits of PORTD individually, switching on or off any AC or DC devices by way of an 8- way relay board or similar. The Standby key is used to switch all eight outputs on and off. There are also eight push-to-make switches to manually toggle the state of any output. By pressing switch 1 and 2 at the same time you switch all outputs on or off. The state of the outputs is shown on the LC display. Bits 6 and 7 of PORTB are used to select the address mode of the output control; 00 =TV, 01 = VCR, After a successful IR decoding, the 'ir_dec' macro calls the 'output' macro. Inside the 'output' macro the display shows address and command values in decimal notation, compares 'adr' and 'mode' variables to validate the device mode used, and sends the value of the 'cmd' variable to PORTD, displaying the output state in binary. A blinking LED on the RE1 pin reveals the activity of any non-RC5 remote con- trols (like Sony, Panasonic, etc.). The main loop also calls the 'sw_key' macro to read PORTC switches to control the PORTD outputs manually. ( 080996 - 1 ) Internet Links [1] www.elektor.com/eblocks [2] www.elektor.com/080996 Downloads Software 080996-1 1 .zip: Flowcode (.fcf) file, from www.elektor. com/080996 Supplementary Information 080996-12.zip: Photos of DIY EB-005, from www.ele- ktor.com/080996 10 = SAT, 11 = Hi-Fi. The program was designed with Flow- code, the graphical software design util- ity for E-blocks. A part of it is shown in Figure 2. The resulting .fcf file is availa- ble free of charge from the Elektor web- site [2]. The main flowchart allocates the LC dis- play to PORTA, initialises ports, reads the state of bits 6 and 7 into variable 'mode', enables RB0/INT interrupts and starts a loop. A 1 to 0 transition on the RB0/INT pin will call the 'start' macro, which is only used to set a variable and call the 'ir_dec' macro. Inside the 'ir_dec' macro, some delays are present to read RB0 near the end of the SI bit, as well as during the start and second half of the S2 bit. If they are '010', the sig- nal is recognised as coming from a valid RC5 remote control. Some more delays effectively skip the toggle bit (not used here) and start to read the five address bits and six command bits into the 'adr' and 'cmd' variables respectively. Dur- ing the 'ir_dec' macro, 14 300-ps pulses are generated on the RE0 pin to enable an oscilloscope to show detailed timing of the RC5 preamble and address/com- mand bits. 118 elektor - 7-8/2009 PLA-UK-1 ht-er^et Things of the past ■ , ' Elektor is now & tomorrow Secure a head start in electronics . -i vJe\c or ° e -c 3-in- 1 rt \aV®^ ^VfiB *AP 3 P m 3 °- with a subscription! [ Advantages to subscribers o Cheaper than 1 1 issues from the newsstand With every issue subscribers get up to 40% discount on selected Elektor products As a welcome gift you get a free 2GB MP3 player worth £31 .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.com/subs • Tel. +44 (0) 20 8261 4509 Or use the subscription order form near the end of the magazine. Remote Control for Network Devices M 090096 - 1 1 Werner Rabl (Germany) Many devices connected to a local area net- work (LAN) are left on continuously, even when they are not needed, including DSL and cable modems, routers, wireless access points, networked hard drives, printer serv- ers and printers. The power consumption of all these devices can add up to a considerable fraction of one's electricity bill. With the sim- ple circuit described here we can ensure that all these devices are only powered up when at least one selected host device (such as a PC or a streaming media client) is turned on. We insert a relay in the mains supply to the devices whose power is to be switched, along with a driver circuit controlled from the host device over a two-wire bus. Optocouplers provide galvanic isolation. One way to imple- ment the bus is to use the spare pair of con- ductors that is often available in the existing LAN cable. The circuit diagram shows an example con- figuration where there are two controlling host devices (a streaming media client and a PC) and three network devices (a DSL router, a networked hard drive and a networked printer). We will assume that all the media files are held on the networked hard drive. The DSL router (to provide an internet con- nection) and the hard drive are to be pow- ered up when either the PC or the media cli- ent is powered up; the printer only when the PC is powered up. We can think of the devices as being in two groups, the first group consisting of the DSL router and the hard drive, the second just the printer. An optocoupler is powered from each of the controlling host devices: these ensure that the devices are isolated from one another and from the rest of the circuit. The relay cir- cuit, located close to the networked devices, is controlled from the outputs of the opto- couplers. The relay circuits are powered from (efficient) mains adaptors: modified mobile phone chargers do an admirable job. In the circuit shown a 5 V supply from the controlling devices is used to drive each opto- coupler. Host 1 (the streaming client) drives optocoupler IC1, host 2 (the PC) drives opto- couplers IC2 and IC3. Optocouplers IC1 and IC2 both control the networked devices in group 1: networked device 1 is the DSL router, switched by relay RE1, and networked device 2 is the hard drive, switched by relay RE2. Optocoupler IC3 controls the networked device in group 2, namely the printer. This is switched by relay RE3. The connections between the optocouplers and the relay stages can be thought of as a kind of bus for each group of devices. The devices in a given group can be switched on by simply shorting its bus, and this gives an easy way to test the set-up. Resistors R2, R6 and RIO at the collectors of the transistors in the optocouplers protect them in case power should accidentally be applied to the bus. The supply voltages VI and V2 shown in the example circuit diagram are derived from the mains adaptors as mentioned above and are used to power the relays. We have assumed that the networked hard drive and the printer are located near to one another, and so it is possible to use a single mains adaptor to provide both voltages. Another possibility would be to add a third wire to the bus to carry power: this would allow all relays, wher- ever they were located, to be powered from a single supply. It is worth noting that network attached stor- age (NAS) devices such as networked hard drives normally require an orderly shutdown process before power is removed. Devices that use Ximeta's NDAS technology do not suffer from this problem. ( 090096 - 1 ) 120 elektor - 7-8/2009 Automatic Bicycle Light +3V O £ Ludwig Libertin (Austria) This automatic bicycle light makes cycling in the dark much easier (although you still need to pedal of course). The circuit takes the ambient light level into account and only turns on the light when it becomes dark. The light is turned off when no cycling has taken place for over a minute or if it becomes light again. The biggest advantage of this circuit is that it has no man- ual controls. This way you can never 'forget' to turn the light on or off. This makes it ideal for children and those of a forgetful disposition. To detect when the bicycle is used (in other words, when the wheels turn), the circuit uses a reed switch (SI), mounted on the frame close to the wheel. A small magnet is fixed to the spokes (similar to that used with most bicycle speedometers), which closes the reed switch once for every revolution of the wheel. Whilst the wheel turns, pulses are fed to the base of T1 via Cl. This charges a small elec- trolytic capacitor (C2). When it is dark enough and the LDR there- fore has a high resistance, T2 starts conducting and the lamp is turned on. With every revolu- tion of the wheel C2 is charged up again. The charge in C2 ensures that T2 keeps conducting for about a minute after the wheel stops turning. Almost any type of light can be connected to the output of the circuit. With a supply voltage of 3V the quiescent current when the reed switch is open is just 0.14 pA. When the magnet happens to be in a position such that SI is closed, the current is 3 pA. In either case there is no problem using bat- teries to supply the circuit. The supply voltage can be anywhere from 3 to 12 V, depending on the type of lamp that is connected. Since it is likely that the circuit will be mounted inside a bicy- cle light it is important to keep an eye on its dimensions. The board has therefore been kept very compact and use has been made of SMD components. Most of them come in an 0805 pack- age. C2 comes in a so-called chip version. The board is sin- gle-sided with the top also act- ing as the solder side. The print outline for the LDR (R5) isn't exactly the same as that of the outline of the LDR men- tioned in the component list. The outline is more a general one because there is quite a variety of different LDR packages on the market. It is therefore possible to use another type of LDR, if for example the light threshold isn't quite right. The LDR may also be mounted on the other side of the board, but that depends on how the board is mounted inside the light. BT1 3V 5 I N I S | STS6NF20V 090102 - 11 For the MOSFET there are also many alternatives available, such as the FDS6064N3 made by Fairchild, the SI4864DY made by Vishay Siliconix, the IRF7404 made by IRF or the NTMS4N01R2G made by ONSEMI. The reed switch also comes in many different shapes and sizes; some of them are even waterproof and come with the wires already attached. For the supply connection and the connection to the lamp you can either use PCB pins or sol- der the wires directly onto the board. The soldered ends of the pins can be shortened slightly so that they don't stick out from the bottom of the board. This reduces the chance of shorts with any metal parts of the light. Do take care when you use a dynamo to power the circuit — the alternating voltage must first be rectified! The same applies to hub dynamos, which often also output an alternating voltage. COMPONENT LIST Resistors R1 = IMG (SMD 0805) R2,R4 = lOOkQ (SMD 0805) R3,R6 = lkQ (SMD 0805) R5 = LDR e.g. FW150 Conrad Electronics # 183547 Capacitors Cl = lpF 16V (SMD 0805) C2 = 10piF 16V (SMD chip type) C3 = lOOnF (SMD 0805) Semiconductors T1 = BC807 (SMDSOT23) T2 = STS6NF20V (SMD S08) Miscellaneous SI = reed switch (not on board) + 2-way right angle pinheader BT1 = 3-1 2V (see text) Please Note. Bicycle lighting is subject to legal restrictions, traffic laws and, additionally in some countries, type approval. ( 090102 - 1 ) Download 090102-1 PCB layout (.pdf), from www. elektor.com/090102 7-8/2009 - elektor 121 PC Power Saver Wolfgang Gscheidle (Germany) This circuit is designed to help minimise the quiescent power consumption of PCs and notebooks, using just our old friend the 555 timer and a relay as the main components. The circuit itself dissipates around 0.5 W in oper- ation (that is, when the connected PC is on); when switched off (with the relay not ener- gised) the total power draw is precisely zero. A prerequisite for the circuit is a PC or note book with a USB or PS/2 keyboard socket that is powered only when the PC is on. The power saver can be used to switch PCs or even whole multi-way exten- sion leads. The unit can be built into an ordinary mains adap- tor (which must have an earth pin!) as the photograph of the author's prototype shows. The PC is plugged in to the socket at the output of the power saver unit, and an extra connection is made to the control input of the unit from a PS/2 (keyboard or mouse) socket or USB port. Only the 5 V supply line of the interface is used. When button SI on the power saver is pressed the unit turns on, and the monostable formed by the 555 timer is triggered via the network composed by R4 and C7. This drives relay RE1, whose con- tacts close. The connected PC is now tenta- tively powered up via the relay for a period determined by PI (approximately in the range from 5 s to 10 s). If, during this interval, the PC fails to indicate that it is alive by supplying 5 V from its USB or PS/2 connector (that is, if you do not switch it on), the monostable period will expire, the relay will drop out and any connected device will be powered down. No further current will be drawn from the supply, and, of course, it will not be possible to turn the PC on. When- ever you want to turn the PC on, you must always press the button on the power saver shortly beforehand. If, however, 5 V is delivered by the PC to the input of optocoupler IC2 before the monos- table times out (which will be the case if the PC is switched on during that period), the transistor in the optocoupler will conduct and discharge capacitor C6. The monostable will now remain triggered and the relay will remain energised until the PC is switched off and power disappears from its USB or PS/2 interface. Then, after the monostable time period expires, the relay will drop out and the power saver will disconnect itself from the mains. There is no need to switch anything else off: just shut down the system and the power saver will take care of the rest. It is also possible to leave the machine as it updates its software, and the power saver will do its job shortly after the machine shuts down. Power for the unit itself is obtained using a simple supply circuit based around a minia- ture transformer. Alternatively, a 12 V mains adaptor can be used, as long as a relay with a 12 V coil voltage is used for RE1. In his proto- type the author used a relay with a 24 V coil connected as shown directly to the positive side of reservoir capacitor C2, the 555 being powered from 12 V regulated from that sup- ply using R1 and D1. A fixed resistor can of course be used in place of PI if desired. If the adjustment range of PI is not sufficient (for example if the PC powers up very slowly) the monostable period can be increased by using a larger capacitor at C6. The relay must have at least two normally- open (or changeover) contacts rated at at least 8 A. The contact in parallel with SI is used to supply power to the device itself, and the other contact carries all the current for the connected PC or for the extension lead to which the PC and peripherals are connected. Pushbutton SI must be rated for 230 VAC (US: 120 VAC) operation: this is no place to make economies. The coil current for the relay flows through LED D5, which must therefore be a 20 mA type. If a low-current LED is used, a 120 O resistor can be connected in paral- lel with it to carry the remaining current. The Fujitsu FTR-F1CL024R relay used in the author's prototype has a rated coil current of 16.7 mA. Optocoupler IC2 provides isolation between the circuit and the PC, and is protected from reverse polarity connection by diode D4. The power saver should be built into an insu- lated enclosure and great care should be taken to ensure that there is proper isolation between components and wires carrying the mains voltage and the other parts of the cir- cuit. In particular, the connection to the PC and associated components (R6, C5, D4 and IC2) should be carefully arranged with at least a 6 mm gap between them and any part of the circuit at mains potential. ( 080581 - 1 ) 122 elektor - 7-8/2009 DVD LED Toolbox More than 100 Elektor articles included! Th is DVD-ROM contains carefully- sorted comprehensive technical documentation (optical properties, electrical characteristics, mounting, life expectancy, etc.) about and around LEDs. For standard models (through-hole, SMD), and for a selection of LED modules (ribbons, light bars, bargraphs, and other LED clusters), this DVD gathers together data sheets from all the manufacturers, application notes, design guides, white papers and so on. It offers several hundred drivers for powering and controlling LEDs in different configurations (buck, boost, charge pump, constant current, and so on), along with ready-to-use modules (power supply units, DMX controllers, dimmers, etc.). In addition to optical systems, light detectors, hardware, etc., this DVD also addresses the main shortcoming of power LEDs: heating. ■Mlektor ISHOP Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 Further information and ordering at www.elektor.com/shop ll Index of Advertisers Allendale Electronics www.pcb-soldering.co.uk 79 APD, Showcase www.apdanglia.org.uk 127 Avit Research, Showcase www.avitresearch.co.uk 126 Bitscope Designs www.bitscope.com 2 Black Robotics, Showcase www.blackrobotics.com 126 ByVac, Showcase www.byvac.com 126 C S Technology Ltd, Showcase www.cstechnology.co.uk 126 Decibit Co. Ltd, Showcase www.decibit.com 126 Designer Systems, Showcase www.designersystems.co.uk 126 EasyDAQ, Showcase www.easydag.biz 126 Easysync, Showcase www.easysync.co.uk 126 Elnec, Showcase www.elnec.com 126 Eltim Audio www.eltim.eu 95 Euro circuits www.eurocircuits.com 113 First Technology Transfer Ltd, Showcase . . www.ftt.co.uk 126 FlexiPanel Ltd, Showcase www.flexipanel.com 126 Future Technology Devices, Showcase. . . . www.ftdichip.com 37 ,126 Good Will Instruments www.gwinstek.com 8 Flameg, Showcase www.hameg.com 126 FlexWax Ltd, Showcase www.hexwax.com 126 Labcenter www.labcenter.com. 136 London Electronics College, Showcase . . . www.lec.org.uk 126 MikroElektronika www.mikroe.com 3, 25, 65 MQP Electronics, Showcase www.mgp.com 127 Netronics, Showcase www.cananalyser.co.uk 127 Newbury Electronics www.newburyelectronics.co.uk 113 Nurve Networks www.xgamestation.com 113 Paltronix. www.paltronix.com 9 Parallax www.parallax.com. PCBCORE www.pcbcore.com 87 47 Peak Electronic Design www.peakelec.co.uk 135 Pico www.picotech. com/scope 1019. Quasar Electronics www.guasarelectronics.com . . . 55 Robot Electronics, Showcase www.robot-electronics.co.uk. 109 127 Lcdmod Kit, Showcase www.lcdmodkit.com 126 Robotiq, Showcase www.robotiq.co.uk 127 Showcase 126, 127 USB Instruments, Showcase www.usb-instruments.com 127 Virtins Technology, Showcase www.virtins.com 127 Advertising space for the issue of 24 September 2009 may be reserved not later than 25 August 2009 with Fluson International Media - Cambridge House - Gogmore Lane - Chertsey, Surrey KT16 9AP - England - Telephone 01932 564 999 - Fax 01932 564 998 - e-mail: r.elgar@husonmedia.com to whom all correspondence, copy instructions and artwork should be addressed. 7-8/2009 - elektor 123 INFOTAINMENT PUZZLE Hexamurai — Who'll be the one to beat it? Game designer: Claude Ghyselen (France) Following our usual tradition, we're offering you an outsize game in this double issue. Hiding behind what looks like a pretty col- oured flower lurks a fearsome Hexadoku Samurai, or Hexamu- rai for short. Those who enjoy Hexadoku (and modern art) are bound to appreciate this grid that goes beyond tough. And in the (unlikely) event you can't manage to solve it, at least you'll always be able to hang it on the wall. The Hexamurai is a Hexadoku grid based on the Samurai model, i.e. 4 standard Hexadoku grids linked to a fifth one in the middle. But unlike a normal Samurai game, the Hexamurai doesn't let you solve each of the grids separately — you have to solve them all together, obeying the Hexadoku rules for each grid in turn. The instructions for solving this puzzle are the same as for a standard Sudoku (with a few modifications!) Like Hexadoku, Hexamurai uses the figures of the hexadecimal sys- tem, namely 0 to F. Fill in the grid in such a way that all the hexadecimal figures from 0 to F (0-9 and A-F) are used once and only once in each row, column, and square of 4x4 boxes (identified by different colours) of a sub-Hex- adoku (identified by a thicker line). Certain figures are already entered D 2 5 3 4 8 2 F 4 F 0 A 4 0 B 6 2 A 5 E 6 8 6 D 1 F D 0 A 1 B 5 F D A 8 B 8 B A D 8 6 8 8 0 B 0 6 6 B D 0 8 6 4 9 5 8 2 3 8 9 3 2 Q 3 4 E 8 9 2 8 0 B 3 D F 5 1 A 6 8 E 6 3 A D 0 D 6 D 5 C F B E is E 8 F 5 8 5 E C 9 8 D A D 6 A 6 0 A B A 0 A B 6 A 6 D D A D 6 8 D D D 8 A 8 A D A B 0 6 B 8 7 3 B B 8 D 9 6 B D 0 5 4 8 E 6 0 124 elektor - 7-8/2009 into the grid, defining the start- ing point for you. If you can solve this puzzle, there are some nice prizes to be won. All you have to do is send us the five figures in yellow, reading from top to bottom. The puzzle is also available as a free download from the Elektor website. Solve Hexamurai and win! Correct solutions received from the entire Elektor readership automatically enter a prize draw for an E-blocks Starter Kit Profes- sional worth £ 300 / € 375 (rrp) and three Elektor Electronics SHOP Vouchers worth £ 40.00 / € 50.00. We believe these prizes should encourage all our readers to participate! Participate! Please send your solution (the numbers in the grey boxes) by email to hexadoku@elektor.com Alternatively, by fax or post to: Elektor Hexadoku c/o Regus Brentford 1000, Great West Road Brentford TW8 9HH United Kingdom. Fax (+44) 208 2614447 The closing date is 1 September 2009. The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. Prize winners The solution of the May 2009 Hexadoku is: 857C9. The E-blocks Starter Kit Professional goes to: Marcel Delomenede (France). An Elektor SHOP voucher goes to: Adrian Bradshaw Subject: hexamurai 07-2009 (please copy (UK); Thomas Raith (Germany); Heinz- exactly). Dieter Richter (Germany). 6 8 1 0 7 D 4 5 B 2 E 3 A C 9 F D C 9 F 8 B 0 3 4 5 A 1 7 2 6 E 2 A 3 5 E F C 9 0 8 7 6 B D 1 4 B 4 7 E 2 A 6 1 F D C 9 8 3 0 5 E 5 4 D 0 7 2 A 3 9 1 B 6 8 F C 7 2 F 8 C 6 3 E A 0 5 4 9 B D 1 0 6 B C 9 4 1 F 8 7 D E 3 5 2 A 1 3 A 9 B 8 5 D 2 6 F C 0 E 4 7 9 E 8 B 4 1 A 2 5 F 6 D C 0 7 3 A 1 C 4 3 0 D 7 E B 8 2 F 9 5 6 F 0 D 3 5 C E 6 1 A 9 7 2 4 8 B 5 7 2 6 F 9 8 B C 3 4 0 E 1 A D 8 9 E 2 1 5 7 C 6 4 B A D F 3 0 4 D 5 7 A 3 B 8 9 C 0 F 1 6 E 2 C F 6 1 D 2 9 0 7 E 3 5 4 A B 8 3 B 0 A 6 E F 4 D 1 2 8 5 7 C 9 Include with your solution: full name and Congratulations everybody! street address. ( 081169 - 1 ) See your project in print! Elektor magazine is looking for Technical Authors/Design Engineers If you have an innovative or original project you'd like to share with Elektor's 1 40 k+ readership and the electronics community v" above average skills in designing electronic circuits experience in writing electronics-related software basic skills in complementing your hardware or software with explanatory text a PC, email and Internet access for efficient communications with Elektor's centrally located team of editors and technicians then don't hesitate to contact us for exciting opportunities to get your project or feature article published . Our Author Guidelines are at: www.elektor.com/authors. Elektor Jan Buiting MA, Editor Regus Brentford \ 1 000 Great West Road, Brentford TW8 9HH, United Kingdom Email: editor@eiektor.com 7-8/2009 - elektor 125 ELEKTOR SHOWCASE To book your showcase space contact Huson International Media Tel. 0044 (0) 1 932 564999 AVIT RESEARCH www.avitresearch.co.uk USB has never been so simple... with our USB to Microcontroller Interface cable. Appears just like a serial port to both PC and Microcontroller, for really easy USB connection to your projects, or replacement of existing RS232 interfaces. See our webpage for more details. From £10.00. BLACK ROBOTICS www.blackrobotics.com Robot platforms and brains for research, hobby and education. • Make your robot talk! • TalkBotBrain is open-source • Free robot speech software • Robot humanisation technology • Mandibot Gripper Robot ByVac www.byvac.com • USB to I2C • Microcontrollers • Forth • Serial Devices C S TECHNOLOGY LTD www.cstechnology.co.uk Low cost PIC prototyping kits, PCB's and components, DTMF decoder kits, CTCSS, FFSK, GPS/GSM, radio equipment and manuals. PCB design and PIC program development. DECIBIT CO.LTD, www.decibit.com • Development Kit 2.4 GHz • Transceiver nRF24L01 • AVR MCU ATmega168 DESIGNER SYSTEMS http://www.designersystems.co.uk Professional product development services. • Marine (Security, Tracking, Monitoring & control) • Automotive (AV, Tracking, Gadget, Monitoring & control) • Industrial (Safety systems, Monitoring over Ethernet) • Telecoms (PSTN handsets, GSM/GPRS) • Audiovisual ((HD)DVD accessories & controllers) Tel: +44 (0)1872 223306 EASYDAQ ■ U ” piV.Xn' I B U . A 1 . www.easydaq.biz p — • USB powered, 4 relays + 4 DIO channels • Will switch 240VAC @ 1 0 a • Screw terminal access • LabVIEW, VB, VC • Free shipping • From £38 Design & supply of USB, USB Wireless, Ethernet & Serial, DAQ, Relay & DIO card products. info@easydaq.biz 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. 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 Instruments A Rohde & Schwarz Company 0 Oscilloscopes 0 Power Supplies 0 Radio Frequency Measuring Instruments 0 Programmable Measuring Instruments Great Value in Test & Measurement www.hameg.com HEXWAX LTD www.hexwax.com World leaders in Driver-Free USB ICs: • USB-UART/SPI/I2C bridges • TEAleaf-USB authentication dongles • expandlO-USB I/O USB expander • USB-FileSys flash drive with SPI interface • USB-DAQ data logging flash drive te-duiatagy http://www.ftt.co.uk • Training and Consulting for IT, Embedded and Real Time Systems • Assembler, C, C++ (all levels) • 8, 16 and 32 bit microcontrollers • Microchip, ARM, Renesas,TI, Freescale • CMX, uCOSII, FreeRTOS, Linux operating systems • Ethernet, CAN, USB, TCP/IP, Zigbee, Bluetooth programming 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 GCEs). Also Technical Management and Languages. |K FLEXIPANEL LTD www.flexipanel.com TEAclippers - the smallest PIC programmers in the world, from £20 each: • Per-copy firmware sales • Firmware programming & archiving • In-the-field firmware updates • Protection from design theft by subcontractors LCDMOD KIT http://www.lcdmodkit.com Worldwide On-line retailer • Electronics components • SMT chip components • USB interface LCD • Kits & Accessories • PC modding parts • LCD modules 126 elektor - 7-8/2009 products and services directory www. elektor. com 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 RFID COMPONENTS http/www.apdanglia.org.uk For DIY, OEM's & Experimenters • EM4100 Cards .99 p (Prices inc vat) • Keyfobs £1 .09 • R/W Keyfobs £1 .65 • RFID Coils £2.95 • RFID PCB with RS232 port • RFID IC’s EM4095 - U2270B • microRFID module (similar to Core ID12) • Free Reader download - Technical pages Order online 24 hrs - Tel: 01 244 520684 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 ROBOTIQ http://www.robotiq.co.uk Build your own Robot! Fun for the whole family! • MeccanoTM Compatible • Computer Control • Radio Control • Tank Treads • Hydraulics Internet Technical Bookshop, 1-3 Fairlands House, North Street, Carshalton, Surrey SM5 2HW email: sales@robotiq.co.uk Tel: 020 8669 0769 www. elektor. com 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. CANDO - CAN BUS ANALYSER http://www.cananalyser.co.uk • USB to CAN bus interface • USB powered • FREE CAN bus analyser • Receive, transmit & log. CAN messages • IS011898 & CAN 2.0a/2.0b compliant • Rugged IP67 version available ® ranks SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business, Showcase - a permanent feature of the magazine where you will be able to showcase your products and services. For just £242 + VAT (£22 per issue for eleven issues) Elektor will publish your company name, website address and a 30-word description For £363 + VAT for the year (£33 per issue for eleven issues) we will publish the above plus run a 3cm deep full colour image - e.g. a product shot, a screen shot from your site, a company logo - your choice Places are limited and spaces will go on a strictly first come, first served basis. So-please fax back your order today! _ n I wish to promote my company, please book my space: • Text insertion only for £242 + VAT • Text and photo for £363 + VAT NAME: ORGANISATION: JOB TITLE: ADDRESS: TEL: PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 00-44-(0)1932 564998 COMPANY NAME WEB ADDRESS 30- WORD DESCRIPTION 7-8/2009 - elektor 127 BOOKS, CD-ROMs, DVDs, KITS & MODULES lektor Pi 1 i I Ml A world of electronics Creative solutions for all areas of electronics 310 Circuits The 30x series of Summer Circuit compilation books have been bestsellers for many years. The 1 1th volume is available now! 310 circuits, tips and design ideas in one book form a treasure trove for every area of electronics: audio and video, hobby and modelling, RF techniques, home and garden, test and measurement, microcontrollers, computer hardware and software, power supplies and chargers - plus of course everything else that does not seem to belong in any of these categories. 310 Circuits for the first time has a section exclusively on robots and robotics. This book contains many complete solutions as well as useful starting points for your own projects. Both categories and anything in between represent a veritable fountain of inspiration for cultivating your own ideas and learning about electronics. This is a must-have book for every creative electronics enthusiast, be it professional, enthusiast or student. 544 pages • ISBN 978-0-905705-78-1 • £29.90 • US$45.00 Bring your microcontroller to life Artificial Intelligence This book contains 23 special and excit- ing artificial intelligence machine-lear- ning projects, for microcontroller and PC. Learn howto set up a neural network in a microcontroller, and howto make the net- work self-learning. Or discover how you can breed robots, and how changing a fitness function results in a totally diffe- rent behavior. Several artificial intelli- gence techniques are discussed: expert system, neural network, subsumption, emerging behavior, genetic algorithm, cellular automata, roulette brains etc. 256 pages • ISBN 978-0-905705-77-4 £32.00 • US $46.00 Connect your mouse into new embedded applications Mouse Interfacing This book describes in-depth howto con- nect the mouse into new embedded appli- cations. It details the two main interface methods, PS/2 and USB, and offers appli- cations guidance with hardware and soft- ware examples plus tips on interfacing the mouse to typical microcontrollers. A wide range of topics is explored, including USB descriptors, a four-channel, millivolt-preci- sion voltage reference all with fully docu- mented source-code. 256 pages • ISBN 978-0-905705-74-3 £26.50 • US $53.00 v ; \ j Prices and item descriptions subject to change. E. & O.E 128 elektor - 7-8/2009 Learn by doing C Programming for Embedded Microcontrollers If you would like to learn the C Program- ming language to program microcon- trollers, then this book is for you. No pro- gramming experience is necessary! You'll start learning to program from the very first chapter with simple programs and slowly build from there. Initially, you pro- gram on the PC only, so no need for de- dicated hardware. This book uses only free or open source software and sample pro- grams and exercises can be downloaded from the Internet. 324 pages • ISBN 978-0-905705-80-4 £32.50 • US $52.00 j) llt frtl ■ li £in-#Bp ifij 45 projects for PIC, AVR and ARM Microcontroller Systems Engineering This book covers 45 exciting and fun Flow- code projects for PIC, AVR and ARM microcontrollers. Each project has a clear description of both hardware and software with pictures and diagrams, which explain not just how things are done but also why. As you go along the projects increase in difficulty and the new concepts are ex- plained. You can use it as a projects book, and build the projects for your own use. Or you can use it as a study guide. 329 pages • ISBN 978-0-905705-75-0 £29.00 • US $52.00 Learn more about C# programming and .NET C# 2008 and .NET programming for Electronic Engineers This book is aimed at Engineers and Scientists who want to learn about the .NET environment and C# programming or who have an interest in interfacing hardware to a PC. The book covers the Visual Studio 2008 development environ- ment, the .NET framework and C# pro- gramming language from data types and program flow to more advanced concepts including object oriented programming. It continues with program debugging, file handling, databases, internet communi- cation and plotting before moving to hard- ware interfacing using serial and parallel ports and the USB port. It includes a hard- ware design for a simple oscilloscope us- ing a parallel port and interfacing to analogue and digital I/O using the USB port. This book is complete with many pro- gram examples, self assessment exercises and references to supporting videos. 240 pages • ISBN 978-0-905705-81-1 £29.50 • US $44.50 J More information on the Elektor Website: www.elektor.com Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 Email: sales@elektor.com Incl. searchable i-TRIXX archive DVD i-TRIXX Freeware Collection 2009 This DVD contains 100 nifty freeware applications, tools and utilities for the Win- dows PC. And as a free extra, it contains the full and searchable (!) i-TRIXX archive, with all the editions up until week 8 of 2009 from i-TRIXX, the e-magazine pub- lished by Elektor. Do you feel the need for a decent and reliable antivirus program? A bandwidth monitor which keeps track of your current up and download rate? An application for recording, editing and con- verting video to any conceivable format? Anonymous surfing from any internet access point from a USB stick? Checking, optimizing and cleaning up your com- puter? Keeping track of your privacy? You can expect that and much more in the i-TRIXX Freeware Collection 2009. ISBN 978-90-5381-244-0 • £27.50 • US$39.50 Completely updated Elektor's Components Database 5 The program package consists of eight databanks covering ICs, germanium and silicon transistors, FETs, diodes, thyristors, triacs and optocouplers. A further eleven applications cover the calculation of, forex- ample, LED series droppers, zener diode series resistors, voltage regulators and AMVs. A colour band decoder is included for determining resistor and inductor val- ues. ECD 4 gives instant access to data on more than 69,000 components. All data- bank applications are fully interactive, al- lowing the user to add, edit and complete component data. This CD-ROM is a must- have for all electronics enthusiasts. ISBN 978-90-5381-159-7 • £24.90 • US$39.50 \ j 7-8/2009 - elektor 129 BOOKS, CD-ROMs, DVDs, KITS & MODULES See the light on Solid State Lighting DVD LED Toolbox This DVD-ROM contains carefully- sorted comprehensive technical documentation about and around LEDs. For standard models, and for a selection of LED mod- ules, this Toolbox gathers together data sheets from all the manufacturers, appli- cation notes, design guides, white papers and so on. It offers several hundred dri- vers for powering and controlling LEDs in different configurations, along with ready-to-use modules (power supply units, DMX controllers, dimmers, etc.). In addition to optical systems, light detec- tors, hardware, etc., this DVD also ad- dresses the main shortcoming of power LEDs: heating. Of course, this DVD con- tains several Elektor articles (more than 1 00) on the subject of LEDs. ISBN 978-90-538 1-245-7 • £28.50 • US $54.00 All articles published in 2008 DVD Elektor 2008 This DVD-ROM contains all editorial arti- cles published in Volume 2008 of the English, Spanish, Dutch, French and Ger- man editions of Elektor magazine. Using Adobe Reader, articles are presented in the same layout as originally found in the magazine. The DVD is packed with features including a powerful search en- gine and the possibility to edit PCB layouts with a graphics program, or printing hard copy at printer resolution. ISBN 978-90-5381-235-8 • £17.50 • US $35.00 Experimenting with the JVISP430 (May 2009) All the big electronics manufacturers su- pply microcontrollers offering a wide ran- ge of functions. Texas Instruments supplies handy USB evaluation sticks with related software for its low-cost MSP430 contro- llers. Unfortunately the I/O facilities are somewhat limited. These can be substan- tially enhanced with the help of the Elektor MSP430 board. PCB, populated and tested Art.# 080558-91 • £35.00 • US $55.00 Tl eZ430-F20 1 3 Evaluation Kit Art.# 080558-91 • £24.50 • US $35.00 Automotive CAN controller (April 2009) Since cars contain an ever increasing amount of electronics, students learning about motor vehicle technology also need to know more about electronics and mi- crocontrollers. In collaboration with the Timloto o.s. Foundation in the Nether- lands, Elektor designed a special control- ler PCB, which will be used in schools in several countries for teaching students about automotive technologies. But it can also be used for other applications, of course. The heart of this board is an Atmel AT90CAN32 with a fast RISC core. Kit of parts, incl. PCB with SMDs prefitted Art.# 080671-91 • £52.00 • US$79.00 The 32-bit Machine (April 2009) With this attractively priced starter kit you get everything you need for your first hands- on experiments with the new R32C/ 1 1 1 32-bit microcontroller. The power sup- ply is drawn from your computer via the USB connection, which simplifies things rather nicely. The starter kit consists of an R32C carrier board (a microcontroller module equipped with the R32C/1 1 1 chip) and a software CD-ROM containing the necessary development tools. As with the earlier R8C/1 3 'Tom Thumb' project in Elektor Electronics (November 2005 through March 2006), the R32C carrier board is an in-house-development of Glyn, an authorised distributor for Renesas in Germany. R32C/1 1 1 Starterkit (32-bit-Controller- board & CD-ROM) Art.# 080928-91 • £27.00 • US$42.50 M16C TinyBrick (March 2009) A TinyBrick is a small self-contained mi- crocontroller module fitted with a power- ful Renesas 1 6-bit Ml 6C microcontroller. A BASIC interpreter is installed in the module to simplify software develop- ment. Beginners will find it an ideal start- ing out point while more experienced users will appreciate its power and con- venience. With this evaluation board (to- gether with a TinyBrick) you can build an intruder alarm that sends SMS texts. Kit of parts incl. TinyBrick-PCB with SMD parts and microntroller premounted plus all other parts Art.# 08071 9-91 *£54.00 * US$87.50 y v y v Prices and item descriptions subject to change. E. & O.E 130 elektor - 7-8/2009 ■\ July/August 2009 (No. 391) £ US $ + + + Product Shortlist July/August: See www.elektor.com + + + June 2009 (No. 390) Campsite AC Monitor 06031 6-1 Printed circuit board 21 .50 30.00 ATM18 = RFID Savvy 08091 0-91 .... PCB, partly populated PCB populated with all SMDs 1 6.50 26.00 May 2009 (No. 389) Experimenting with the MSP430 080558-91 ....PCB, populated and tested 35.00 55.00 080558-92 ....Tl eZ430-F201 3 Evaluation Kit 24.50 35.00 RGB LED Driver 080178-41 ....Programmed controller 8.90 13.75 April 2009 (No. 388) The 32-bit Machine 080928-91 .... R32C/1 1 1 Starterkit (32-bit-Controllerboard & CD-ROM) 27.00 42.50 Automotive CAN Controller 080671 -91 .... Kit of parts, incl. PCB with SMDs prefitted 52.00 79.00 Automatic Running-in Bench 080253-71 .... Kit of parts incl. PCB-1 with SMDs prefitted 1 85.00 270.00 090146-91 ....ARMee plug-in board mk. II 50.00 74.00 March 2009 (No. 387) M16C TinyBrick 08071 9-91 .... Kit of parts: TinyBrick-PCB with SMD parts and microntroller premounted; plus all other parts 54.00 87.50 February 2009 (No. 386) Model Coach Lighting Decoder 080689-1 .. ....PCB, long (1 = 230 mm) 7.30.... ....10.95 080689-2.. ....PCB, medium (1 = 190mm) 7.30.... ....10.95 080689-3.. ....PCB, short (1 = 110mm) 5.80.... 8.95 080689-41 .... PIC12F683, programmed 6.20.... 9.50 Transistor Curve Tracer 080068-1 .. ....Main PCB 26.50.... ....42.00 080068-91 ....PCB, populated and tested 55.00.... ....82.50 January 2009 (No. 385) Radio for Microcontrollers 071125-71 ....868 MHz module 7.20 9.95 ATM18on the Air 071125-71 ....868 MHz module 7.20 9.95 Meeting Cost Timer 080396-41 ....ATmegal 68, programmed 8.50 12.50 Capacitive Sensing and the Water Cooler 080875-91 ....Touch Sensing Buttons Evaluation kit 27.50 39.95 080875-92 ....Touch Sensing Slider Evaluation kit 27.50 39.95 Three-Dimensional Light Source 080355-1 Printed circuit board 24.90 39.90 Moving up to 32 Bit 080632-91 .... ECRM40 module 32.00 46.50 December 2008 (No. 384) PLDM 071 1 29-1 Printed circuit board 5.80 9.50 Hi-fi Wireless Headset 080647-1 Printed circuit board: Transmitter 7.90 15.80 080647-2 Printed circuit board : Receiver 7.90 1 5.80 LED Top with Special Effects 080678-71 .... Kit of parts incl. SMD-stuffed PCB and programmed controller 42.00 59.00 Bestsellers i C# 2008 and .NET programming ISBN 978-0-905705-81-1 £29.50. US $44.50 2 C Programming for Embedded Microcontrollers ISBN 978-0-905705-80-4 £32.50. US $52.00 o od o Artificial Intelligence ISBN 978-0-905705-77-4 £32.00. US $46.00 Microcontroller Systems Engineering ISBN 978-0-905705-75-0 £29.00. US $52.00 Mouse Interfacing ISBN 978-0-905705-74-3 E26.50.....US $53.00 ECD 5 ISBN 978-90-5381-159-7. £24.90. US$39.50 DVD i-TRIXX Freeware Collection ISBN 978-90-5381-244-0 E27.50.....US $39.50 DVD Elektor 2008 ISBN 978-90-5381-235-8 £1 7.50.....US $35.00 DVD LED Toolbox ISBN 978-90-5381-245-7 £28.50. US $54.00 DVD Elektor 1990 through 11999 ISBN 978-0-905705-76-7 £1 7.50.....US $35.00 MSP430 : PCB, populated and tested Art. # 080558-91 £35.00 .....US $55.00 MSP430 : Tl eZ430-F2013 Evaluation Kit Art. # 080558-91 E24.50.....US $35.00 The 32-bit Machine Art. # 080928-91 £27.00 .....US $42.50 Automotive CAN controller Art. # 080671-91 £52.00. US $79.00 LED Top with Special Effects Art. # 080678-71 £42.00.... US $59.00 Order quickly and securely through www.elektor.com/shop or use the Order Form near the end of the magazine! Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH * United Kingdom Tel. +44 20 8261 4509 Fax +44 20 8261 4447 Email: sales@elektor.com 7-8/2009 - elektor 131 INFO & MARKET COMING ATTRACTIONS NEXT MONTH IN ELEKTOR GPS Datalogger There are plenty of projects that deal with GPS and microcontrollers, many of which covering navi- gation only. But what if you wanted to log the path of a bike or car trip? Sure, you could export the data for processing into some other application that does this, but you could also make use of a very popular application called Google™ Earth. This is made possible by the combination of a GPS module, a BASIC Stamp® microcontroller module , a Parallax Memory Stick Datalogger and some clever software enabling GPS coordinates to be stored as a KML file on an ordinary USB memory stick — and read back on your PC. New: E-Labs Inside Starting this September Elektor Labs, the hub & foundry of all technical wizardry you can read about every month in Elektor will occupy the centre four pages of the magazine. There we will cover all issues our laboratory workers first fuss about and then care to make public like equipment reviews, tips and tools of the trade and techno talk. For the first instalment the intention is to report on practical experience with a new Yokogawa oscilloscope our lab guys got on loan for a month or was it a bit longer. What did they like and dislike about the instrument? Read all about it in the next issue of Elektor. ATM 18 Mini Chess Computer The Elektor ATM1 8 microcontroller system can be used to make a surprisingly simple and effective chess computer. The only additional hardware required is a few low-cost pushbut- tons. The software for the project is written in C, and it was far from an easy task to fit the program in the 8 kB of program memory offered by the ATmega88. Article titles and magazine contents subject to change, please check 'Magazine' on www.elektor.com The September 2009 issue comes on sale on Thursday 20 August 2009 (UK distribution only). UK mainland subscribers will receive the issue between 15 and 18 August 2009. w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektor. Elektor 33 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 downloads, circuit boards, programmed ICs and corrections and updates if applicable. Complete magazine issues may also be downloaded. In the Elektor Shop you'll find all other products sold by the publishers, like CD-ROMs, kits and books. A powerful search function allows you to search for items and references across the entire website. 1 ktO electro worldwide \ \ W? NAT KJNA1 INI T FtUMLNIl V r ■ Horn?- Newr; Kagnzmn flhnci Sii’n^crJjr now Forum Srrvino r-w™ — Sh.fist ar> - Informative tvtetei V p - Also on the Elektor website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Surveys and polls • FAQ, Author Guidelines and Contact Fret; RcrtcaHaa REK. I 72D3 included wflh -embedded Linux workshop BLUE ThiM'.evel pojvtr .Ad y*> Aii -i u oi![ u baft Lip rauie pt'niir cc l£ L. CllEr r'-'- ■ C vsi E-Sd' CSii vunp 0 V v CftiUvCl-ftdHt ft Ttf r-HUfip V*C*T rfCn'ilmlieii. W MAgjimeiL W CJ'fert ItfUkB* OWl* M- Skib«rl0U$hf. hwnlmRf ElaUqr Formula Phmnl* Bunr r E rklu' knr JDD'J r'j JW? June t&n 39n«i»»tlc6’ Tw dnwrfoacjUc ■cnibn ret onl? »i'k p«u brr+ it but A>f « trtCrt foil w|iHnr> [-]paper Kulli 1 1 1 1 r |Hi lie null imlnprrrinhir It- prcluslofial and fifth un 4 ft 1111 Free SHTTmIi wiUh every even V LIS H [i r ii y r n mmn h Ir ruiml • CP POM) S3 lubtaibwi only . A atrihing ^adgit ; .Prafilar Pro NEW ■DdK CJ ZUM nml .KFTT lur F"n Irimi: Enqine-ers E* Dacwjrt and free F&P 1 SLpin Lha 1I“U I up "n iln-j- .iv pruyrnrmnrd brail ilpyr.iiip yiiur Mi nfilni Id m MR'] rnilknq mnrh rr 1 132 elektor - 7-8/2009 Description Price each Qty. Total Order Code 310 Circuits (223 i £ 29.90 C# 2008 and .NET programming for Electronic Engineers 1 £ 29.50 C Programming for Embedded Microcontrollers £03 i £ 32.50 DVD LED Toolbox £03 ! £ 28.50 CD-ROM ECD 5 [ £ 24.90 1 Free Elektor Catalogue 2009 Prices and item descriptions subject to change. The publishers reserve the right to change prices without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Sub-total P&P Total paid Name METHOD OF PAYMENT (see reverse before ticking as appropriate) □ □ □ □ Bank transfer Cheque (UK-resident customers ONLY) Giro transfer n emrjicp, c jH ■YilJLPljr? Expiry date: Verification code: Please send this order form to* (see reverse for conditions) Elektor Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Address + Post code Tel. Email Date - - Signature EL07/08 Yes, I am taking out an annual subscription to Elektor and receive a free 2GB MP3 player*. I would like: I I Standard Subscription (11 issues) Subscription-Plus (11 issues plus the Elektor Volume 2009 CD-ROM) * Offer available to Subscribers who have not held a subscription to Elektor during the last 12 months. Offer subject to availability. See reverse for rates and conditions. Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com sales@elektor.com *USA and Canada residents should use $ prices, and send the order form to: Elektor US PO Box 876 Peterborough NH 03458-0876 Phone: 603-924-9464 Fax: 603-924-9467 E-mail: custservus@elektor.com METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer | Cheque (UK-resident customers ONLY) □ Giro transfer □ Ttf&r □ Expiry date: Name Address + Post code Verification code: Please send this order form to Elektor Tel. Email Date - - Signature Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com subscriptions@elektor.com EL07/08 ORDERING INSTRUCTIONS, P&P CHARGES All orders, except for subscriptions (for which see below), must be sent BY POST or FAX to our Brentford address using the Order Form overleaf. Online ordering; www.elektor.com/shop Readers in the USA and Canada should send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Elektor US for applicable P&P charges. Please allow 4-6 weeks for delivery. Orders placed on our Brentford office must include P&P charges (Priority or Standard) as follows: Europe: £6.00 (Standard) or £7.00 (Priority) Outside Europe: £9.00 (Standard) or £11.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 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. 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. 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 and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in this magazine. If difficulties in the supply of components are envisaged, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not 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 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 in writing. Such written permission must also be obtained before any part of these publications is stored in a retrieval system of any nature. Notwithstanding the above, printed-circuit boards may be produced for private and personal use without prior permission. Limitation of liability Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in connexion with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser any money paid in respect of the goods. Law Any question relating to the supply of goods and services by Elektor shall be determined in all respects by the laws of England. January 2009 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION Standard Plus United Kingdom £49.00 £58.00 Surface Mail Rest of the World £63.00 £72.00 Airmail Rest of the World £79.00 £88.00 USA £64.95 See www.elektor-usa.com Canada £75.95 for special offers HOWTO PAY Bank transfer into account no. 40209520 held by Elektor Electronics, 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. 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 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 and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL- protected for your security. SUBSCRIPTION CONDITIONS The standard subscription order period is twelve months. If a permanent change of address during the subscription period means that copies have to be despatched by a more expensive service, no extra charge will be made. Conversely, no refund will be made, nor expiry date extended, if a change of address allows the use of a cheaper service. Student applications, which qualify for a 20% (twenty per cent) reduction in current rates, must be supported by evidence of stu- dentship signed by the head of the college, school or university faculty. A standard Student Subscription costs £39.20, a Student Subscription-Plus costs £48.20 (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 2009 M/jQ ru/nousj AUu2 British Lkisi'jned. British iMad-j electronic design Atlas LCR - Model LCR40 Passive Component Analyser £77.31 inc VAT (E67.23+VAT) Feature Summary • Automatically identify and measure inductors, capacitors and resistors. • Automatic frequency selection: DC, 1kHz, 15kHz and 200kHz. • Complete with battery, probes and user guide. • Polarity free, connect any way round. • Range of different probes available including SMD tweezers, crocs and double jaw clutch grabbers. Probes included £53.83 inc VAT (£46.81 +VAT) Atlas DCA - Model DCA55 Semiconductor Component Analyser Feature Summary • Connect your components any way round! Now with premium probes! • Automatic component identification. • Automatic pinout identification, it tells you which lead is which! • Supports Bipolar transistors, darlingtons, MOSFETs, diodes, LEDs and more. • Measures transistor gain, leakage current, MOSFET gate threshold, semiconductor junction characteristics and much more. • Identifies special component features such as fly-wheel diodes on transistors or base-emitter shunt resistors. Atlas SCR - Model SCR100 Triac and Thyristor Analyser £96.90 inc VAT (E84.26+VAT) Feature Summary • Connect your Triac or Thyristor any way round. • Automatic part identification and display of pinout. • Categorises gate sensitivity from lOOuAto 100mA. • Load test conditions regulated at 12V, 100mA, even for a dying battery. • Measures gate voltage drop. • Long life alkaline battery supplied. • Supplied with premium probes. Ideal for TO220, T03 and even bolt styles. Atlas ESR - Model ESR60 ESR and Capacitance Analyser Feature Summary • Measure capacitance and ESR. • Resolution down to 0.01 ohms. • Analyses at industry standard of 1 00kHz. • Capable of In-Circuit testing. • Polarity free, connect any way round. • Protected against highly charged capacitors. • Great for short-circuit tracing too. £87.10 inc VAT (E75.74+VAT) Features our unique constant power controlled discharge function: You save over £20! Atlas Star Pack - ATPK2 LCR and DCA + Case £124.99 inc VAT (E108.69+VAT) Feature Summary • Atlas LCR Passive Component Analyser. • Atlas DCA Semiconductor Component Analyser. • Fitted batteries plus spare battery. • Premium padded carry case. • User guides included. Igonta Peak Slasji p» fc Road House, '//esi Road, EJu.tion "Tel. U 70t)l2 A Wed; Mww.did» Mja s.sdJuk JEu| lease add £2.00 towards UK postage tact us for Pversel3SricirI|j“or ordetfoanline. IPrices correHtit 5HF, UK o.uk The latest version of the Proteus Design Suite harnesses the power of your computer’s graphics card to provide lightning fast performance. Together with unique transparency options it’s now easier than ever to navigate and understand large, multi-layer boards. PROTEUS DESIGN SUITE ■ Hardware Accelerated Performance. ■ Unique Thru-View™ Board Transparency. ■ Over 35k Schematic & PCB library parts. ■ Integrated Shape Based Auto-router. ■ Flexible Design Rule Management. ■ Polygonal and Split Power Plane Support. ■ Board Autoplacement & Gateswap Optimiser. ■ Direct CADCAM, ODB++ & PDF Output. ■ Integrated 3D Viewer with 3DS and DXF export. ■ Mixed Mode SPICE Simulation Engine. ■ Co-Simulation of PIC, AVR, 8051 and ARM7. ■ Direct Technical Support at no additional cost. All levels of the Proteus Design Suite include a world class, fully integrated shape-based autorouter at no additional cost - prices start from just £150 exc. VAT & delivery www.labcenter.cam Electronics Labcenter Electronics Ltd. 53-55 Main Street, Grassington, North Yorks. BD23 5AA. Registered in England 4692454 Tel: +44 (0)1756 753440, Email: info@labcenter.com Visit our website or phone 01756 753440 for more details