February 2012 AUS$ 14.90 - NZ$17.90 - SAR 105.95 " NOK102 £4.90 A Serial for Android Bit-banging the FTDI-USB Module unravelled and applied to a keyless entry control pane www.elektor.com esJ Para Transmission e£i * m EclElchler Liifia-ib Jar: 0 ■ Kb j* j ' VL* JF*. ■ , _Vj4 3 r ami Remove all Cals C=SpF Select node Period mil ip im ♦.c cha 1 u Pico C-PI a Pico c- Our ‘small-C’ meter upgraded in two i ways Emergency Generator Load Meter * No-break AC power for your home 770268 451 73 0 2 9 DIGILEN ANALOG IN ROUES isiusn siij $! ilti ^ 33# !s£ ^ s£i *3*J DESIGNSPARK DesignSpark chipKIT" Challenge Have you entered the DesignSpark chipKIT™ Challenge yet? Visit www.chipkitchallenge.com today to join the fun! When you submit a proposal for an energy-efficient design, your project will automatically be considered for a chipKIT™ Community Choice Award.* In February, participants of the chipKIT™ Challenge will have the opportunity to vote on what project they think is the best. If your project receives the most votes, you will win a $1 00 voucher for RS Components/Allied Electronics and a free digital subscription to Circuit Cellar and Elektor magazines! Register your project at www.chipkitchallenge.com to participate. Visit www.chipkitchallenge.com for complete rules and details. Participation in the Community Choice Awards does not increase your chances of winning the Grand Prize with your Final Project(s) submission. The deadline for Final Project submissions is March 27, 2012. See website for more information. IN ASSOCIATION WITH: Glektor M ^ Microchip m CIRCUIT CELLAR 4-JOl: ELf C'AQMCS DIGILENT 3ETOND THEORY" DesignSpark ctiipKIT" Challenge chipKIT™ is a registered trademark of Microchip Technology Inc. Max32™ is a registered trademark of Digilent, Inc. compilers We really believe in the freedom of choice. Experience the powerful mikroC, mikroBasic and mikroPascal compilers for ARM® Cortex Tm -MB microcontrollers. Intuitive IDE makes your development easy, and settings seamless. Over 500 library functions with examples and a comprehensive help file will help you get your project done quickly. Compilers feature smart data types and mighty SSA optimization which increases execution speed and reduces the code size by 20-40%. Pay only once for the compiler of your choice and we will give you Free support and Free upgrades until the end of the product lifetime. There are no other ARM® compilers on the market that offer so much at such a price. It's the best value for money. You will have a strong and reliable ally in development. © starting at >199 00 mikroC PRO for ARM strong ally. Mikrollektronika DEVELOPMENT TOOLS I COMPILERS I BOOKS GET IT NOW www.mikroe.com All things considered but measured first It’s been noted frequently that elec- tronic circuits are getting increasingly complex in design and have a bad tendency to attract microprocessors for no apparent reason. It seems logical because micros enable the amount of hardware to be reduced drastically while still offering flexibility in terms of functionality of the circuit — in other words, you just program in what you think you might need. No soldering, no parts purchasing. Great, electronics gone all digital! Just deal with ones and zeroes, no problems with analogue signals that vary in level just by pointing at a PCB track. Tough luck. Any digital circuit that somehow needs to communicate with the outside world, is again using analogue signals. It’s because our real world simply isn’t digital — in between all kinds of extre- mes like ‘on’ and ‘off’, ‘all* and ‘nothing’, ‘hot’ and ‘cold’, ’dark’ and ‘light’, there’s a whole range of gradations (well, with a few exceptions). So what does a digital circuit do to communicate with the real world? The analogue value measured by a sensor is first translated into a digital value (by an A/D converter) before it can be proces- sed by digital electronics. Likewise, at the output of the circuit it is often neces- sary to convert digital back to analogue, usually with the help of a D/A converter ora PWM control. These considerations were spurred by the very contents of this February 2012 edition, which contains several projects that seem to happily combine the analogue and digital realms. Fine examples are the new software for the enhanced Pico C meter, the interface for wideband lambda probe, and the dynamics processor discussed in the Audio DSP Course. The above ADC-digi- tal-DAC method applies to all of these, and more. Never disregard the analogue bits in your digital circuit — although not MSB, they’re still highly significant. Enjoy reading this edition, Jan Buiting, Managing Editor 6 Colophon Who’s who at Elektor. 8 News & New Products A monthly roundup of all the latest in electronics land. 12 DesignSpark chipKIT™ Design Challenge A global electronics design competition brought to you by Circuit Cellar, Elektor and RS Components. 13 From Breadboard to PCB From now on, Elektor PCB Service is the one-stop shop for printed circuit boards 14 AndroPod (1) This Elektor-developed board addsTTL and RS485 connectivity to your Android smartphone ortablet. 22 Pico C-Plus and Pico C-Super New software has been developed for the Elektor Pico C meter, giving it a vastly extended capacitance range as well as some extra features like a frequency meter. 28 .Net-MF for Electronics Engineers Microsoft’s new platform fori6-, 3-2 and 64-bit system is off to a promising start, mostly due to a number of FEZ modules. We looked at four of these. 32 Wideband Lambda probe Interface (2) This month we look at the protocol used by the probe to communicate with a computer or microcontroller. 36 PicoScope 2205-MSO Grilled A review of the latest sub £400 mixed signal oscilloscope from Pico Technology. 38 Eclipse Sensor This instrument was specifically developed to measure sky brightness during a (partial) solar eclipse. 43 E-Labs Inside: leading down to zero How one of our editors won a soldering contest by accident. 44 The many faces of Elektor A photo impression of activities and visitors at the Elektor Live! 2011 event. 4 02-2012 elektor CONTENTS 14 AndroPod (1) Up to now it has been rather difficult to connect Android-based smartphones and tablets to external circuitry enabling us electronics folks to access signals for control purposes. Elektor’s very own AndroPod interface board, which adds a serial TTL port and an RS485 port to the picture, changes this situation. 22 Pico C-Plus and Pico C-Super Two new versions were developed of the software for Elektor’s famous ‘Pico C’ capacitance meter. Version ‘Pico C-Plus’ includes a signal generator function as well as capacitance measurement and a simple period measurement function based on the TLC555 oscillator. The second version, ‘Pico C-Super’, adds a fre- quency counter and implements a full blown period counter. 28 .Net-MF for Electronics Engineers The advantage of Microsoft’s ‘dot-net’ platform is the application source code compatibility between different processors., allowing the same source code to run equally well on a module using an NXP, Renesas, Atmel, etc. microcontrol- ler and on a Windows, Mac or Linux PC computer using Mono, the multi-plat- form open-source version of dot-net. 67 Bit-banging the FTDI-USB Module This article describes the electrical design and software requirements for a key- less entry control panel comprised of a numeric entry pad, an LCD display, relay contacts for unlocking a door and a USB interface. Even though this writing will delve into the inner workings of FTDI’s FT2232H and its Bit-bang Mode, under- standing the technology will require neitheran in-depth knowledge of USB nor the use of a microcontroller! Volume 38 February 2012 no. 422 46 E-Labs Inside: chipKIT Max32 homework Unexpected hiccups at a recent chipKIT Design Challenge presentation turn out quite useful for everyone. 48 Electronics for Starters (2) This month’s course instalment deals with transistors and their basic configurations in amplifier circuits. 52 Audio DSP Course (8) In this final instalment our DSP unit is configured and programmed to act as a digital dynamics processor. 60 A Benchmark for Microcontroller Development Kits Is it possible to put numbers to the ease of setting up a microcontroller development kit to flash an LED? We think it is and have devised the [hW] unit for the purpose! 64 Emergency Load Generator Meter When the AC power grid is down, this circuit tells you just far you can push your emergency load generator in terms of amps out. 67 Bit-banging the FTDI-USB Module Little-seen bit programming of FTDI’s FT223H module eventually culminates in the design of a keyless entry control panel. 70 ROBBI the Robot This cheerful looking robot head is animated by a PIC microcontroller. 72 Hexadoku Elektor’s monthly puzzle with an electronics touch. 74 Retronics: Elektor ‘Consonant* Control Preamplifier (1978) Series Editor: Jan Buiting 77 Gerard’s Columns: The Money Dance The monthly contribution from our US columnist Gerard Fonte. 84 Coming Attractions Next month in Elektor magazine. elektor 02-2012 5 ELEKTOR The Team Managing Editor: International Editorial Staff: Design staff: Membership Manager: Graphic Design & Prepress: Online Manager: Managing Director: Jan Buiting (editor@elektor.com) Harry Baggen, Thijs Beckers, Eduardo Corral, Wisse Hettinga, Denis Meyer, Jens Nickel, Clemens Valens Thijs Beckers, Ton Giesberts, Luc Lemmens, Raymond Vermeulen, Jan Visser, Christian Vossen Raoul Morreau Giel Dols, Jeanine Opreij, Mart Schroijen Carlo van Nistelrooy Don Akkermans The Network Tech the Future explores the solutions for a sustainable future provided by technology, creativity and science. CIRCUIT CELLAR i hi f ouk' -• ! '-'v-! -:.i : ; l : ihonics l isSit.l i ki»C m "fwation VOICED COIL Our international teams United Kingdom Wisse Hettinga +31(0)464389428 w.hettinga@elektor.com Spain Eduardo Corral +34 91101 9395 e.corral@elektor.es India Sunil D. Malekar +9 1 9833168815 ts@elektor.in USA Hugo Vanhaecke +1 860-875-2199 h.vanhaecke@elektor.com Italy Mauriziodel Corso +39 2.66504755 m.delcorso@inware.it Russia Nataliya Melnikova 8107(965)3953336 nataliya-m-larionova@yandex.ru Germany Ferdinand te Walvaart +31 46 4389417 f.tewalvaart@elektor.de Sweden Wisse Hettinga +31 46 4389428 w.hettinga@elektor.com Turkey Zeynep Koksal +90532 2774826 zkoksal@beti.com.tr U France Denis Meyer +31 46 4389435 d.meyer@elektor.fr Brazil Joao Martins +551141950363 joao.martins@editorialbolina.com South Africa Johan Dijk +27 78 2330 694 / +31 6 109 31 926 j.dijk@elektor.com Netherlands Harry Baggen +31 46 4389429 h.baggen@elektor.nl Portugal Joao Martins +351 21413-1600 joao.martins@editorialbolina.com China Cees Baay +86 21 6445 2811 CeesBaay@gmail.com Volume 38, Number 422, February 2012 ISSN 1757-0875 Publishers: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 www.elektor.com The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor is published 11 times a year with a double issue for July & August. 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 Email: subscriptions@elektor.com Rates and terms are given on the Subscription Order Form. Head Office: Elektor International Media b.v. P.O.Box 11 NL-6114-ZG Susteren The Netherlands. Telephone: (+31) 46 4389444, Fax: (+31) 46 4370161 Distribution: Seymour, 2 East Poultry Street, London ECiA, England. Telephone:+44 207 429 4073 UK Advertising: Elektor International Media b.v. P.O.Box 11 NL-6114-ZG Susteren The Netherlands. 6 02-2012 elektor ELEKTOR Membership Counter We now have members in Not a member yet? Sign up at www.elektor.com/subs countries. Supporting Companies tech.co.uk. I III 11 EaarSYKC* 'LNECi EzPCB o FlexiPanel AudioXpress www.cc-webshop.com BAEC, Showcase www.baec.tripod.com Beta Layout www.beta-layout.com CS Technology, showcase www. cstech.co. uk/picdemo DesignSpark chipKIT™ Challenge www. chipkitchallenge. com 2 Easysync, showcase www.easysync-ltd.com 78 Elnec, Showcase www.elnec.com 78 Eurocircuits www.elektorpcbservice.com 35 EzPCB www.siliconray.com 65 First Technology Transfer, Showcase www.ftt.co.uk 78 Flexipanel, showcase www.flexipanel.com 78 FTD1 Future Technology Devices, Showcase £hip www.ftdichip.com 78 Hameg, showcase 47 burinaaMb www.hameg.com 78 78 O HexWax, Showcase www. hexwax. com 78 59 K. Jaoraftac : Jackaltec www.jackaltec.com Labcenter www.labcenter.com 9 78 PH 88 MaxBotix 0 Maxbotix, Showcase www. maxbotix. com . MikroElektronika www.mikroe.com . . 79 Minty Geek, showcase www.mintygeek.com 78 > Pico Technology www. picoscopemso. com/ 125 31 H m 1 1 ' Pi ' i a Elf kiw PCB Ee-rvLce- The Elcktor PC0 Service was originally launched In 2009, and since then more then 3000 users were registered, Elcktor and Euroclrcults decided to extend their service to the Elcktor community. W| *HV ■ l** BMW i (f £ n> pi-i i ue , ra ‘h i K) . ? :jj|J ■ hG -v c'a-prl ir m Me- rtk*. F A WU ■ ^ if PTH :rv‘--::r>v cr!>:-i I 1 LV19WS HV T« 1 T( zr+ -,•••>• Sii ^ L* ¥ Qt* 1 * < 3CHH cinwr r Wtnirt^i. «.»«■: uim^ 1 ,vstnM-i w « KwtrFi ■■ n m^i-h ■ -.L K1 >-[0 D1 ►I 1N4004 7805 $ ♦ Cl lOu 63V +5V O C2 lOOn R1 0 1 % _7 6 8 Js T lOOn 20 VCC R DIS IC2 THR OUT TLC555 TR CV GND C7 220p 1 % 1 C4 lOOn SI H CALIBRATE 0 K3 R3_ 100R BAT85 8 _9 11 2x16 to Q |> t/3 Q _l t/3 > > > Dd 2 < O + i o a OT-NtOTtmiosiuiiJ OOOOOOOO—l—l Nn^inioscomo PA2/RESET PDO (RxD) VCC |Q3 (AINO) PBO (AINI)PBI PD1 (TxD) (OCOA) PB2 PD2 (INTO) (OC1A) PB3 PD3 (INTI) (OC1B) PB4 PD4 (TO) (MOSI/SDA) PB5 PD5 (OCOB/T1) (MISO) PB6 PD6 (ICP) (UCSK/SCL) PB7 ATtiny2313 XTAL2 XTAL1 GND 4 XI 5 10 H h > C5 20MHz C6 15p — < i — < 15p > 12 13 14 15 16 17 18 19 D3 3 BAT85 ~r R2 BAT85 D5 R4 100R BAT85 l cn co -n- in co K4 ♦ 100687- 11 Figure 1 . Circuit diagram of Pico C-Super, incorporating changes to the original design from April 201 1 . We now have extended capacitance range (up to 500 nF), a signal generator, a frequency counter, and a period meter — software-wise, it’s all crammed into a single ATtiny231 3 micro! ToDo for Pico C-Plus • (Re)program the ATtiny2313 with PicoC- Plus.hex and PicoC-Plus.eep (EEPROM contains basic table for signal genera- tion), or order a ready programmed microcontroller# 1 10687-41 from Elektor [2]. • Use pin 15 (OC1A) of the 2313 for signal output. • Use short presses of the switch to move through the menus and a long press (>2 sec) to accept the displayed option or to exit from any mode. Pico C-Super: minor surgery, or a new board if you want the little instrument originally called Pico C (1 ) to have the extended capacitance range of Pico C-Plus; (2) to have the signal generator of Pico C-Plus; (3) to act as a frequency counter (4) to act as a period meter rem in other words, to make full use of the extended software version called Pico C-Super then some pins of the pins of the 2313 need to be freed up! else stick to Pico C-Plus or even happily continue using the original Pico C! Programming aside, this is because pin 8 of the 2313 (TO input) is used as an out- put in the published version to control the TLC555. But in the extended software ver- sion Pico C-Super, this pin is used as an input for frequency measurement and the TLC555 Reset pin is connected permanently to 5 V. A change is also required to split pins 6 & 7 24 02-2012 elektor TEST & MEASUREMENT as the revised versions use INTI for capaci- tance measurement and INTO for external period. Without changes the period func- tion shows the period of the 555 oscillator. ToDo for Pico C-Super To get the frequency counter and period measurement functions working requires two cuts and three wire links on the origi- nal Pico C board: • cut track between IC2 pin 4 and IC3 pin 8. (Frees up TO input) • connect IC2 pin 4 to IC2 pin 8. (Leaves IC2 running permanently — RST tied to +5 V) • connect IC3 pin 8 to input socket. (Input to TO) • cut track between IC3 pins 6 & 7. (Frees up INTO — used for external Period) • connect IC3 pin 8 to IC3 pin 6. (External input to INTO) The changes are reflected in the circuit diagram shown in Figure 1. Diodes have been added for input protection. The PCB incorporating the above changes carries item number 1 1 0687-1 . For the conveni- ence of readers new to the Pico C Saga the PCB silk screen is shown in Figure 2; the PCB artwork file may be downloaded free from [2] and the ready-programmed con- troller for Pico C-Super is available as item #110687-42. What else? The parts list, of course, and the actual construction but that should not present problems as only through-hole components are involved and a single-side circuit board. One word of caution though: check and double check the pin number- ing of the LCD you are using - the sche- matic shows a circuit symbol only, not the physical shape or actual pin arrangement. Some results First, a word of caution. The reworked meter is extremely sensitive on the lOOx range and the presence of a hand is detect- able at a range of about 5 cms (2 in.). So for best results I have activated the switch by using a pot trimmer during calibration to avoid errors from hand capacitance. For your amusement, a photo of my pro- totype with a 1. 6-5.0 pF variable capaci- tor is shown in Figure 3. The capacitance will start to increase when a hand is placed about 5 cms away and rises to about 5 pF when the wire is gripped between two fin- gers. Note the wire is 1 0 cms (4 in.) long and attached to the ‘live’ pin of the input. Is it an COMPONENT LIST (PicoC -Super version only) Resistors ri =^w\a^%o R2 = 5.6£l 5% R3,R4 = 100£1 5% PI = 1 0k Q 20%, preset Capacitors Cl = IOjiF, 63V, lead spacing 2.5mm C2,C3,C4 = 1 0OnF 50V ceramic, lead spacing 0.2” (5.08mm) C5,C6 = 1 5pF 1 00V 5%, ceramic, lead spacing 0.2” (5.08mm) C7 = 220pF 63V 1%, polystyrene, lead spacing 7.1 8mm Semiconductors D1 = 1N4004 D2-D5 = BAT85 IC1 = 7805 IC2= TLC555 IC3 = ATtiny2313, programmed, Elektor# 1 10687-42* Miscellaneous JP1 ,K2,K3,I<4 = 2-pin pinheader, straight, lead pitch 0.1” (2.54mm) JP1 =jumper 0.1” (2.54mm) K1 = 2-way PCB screw terminal block, lead pitch 5mm K2,K3,K4 = 2-way socket, straight, lead pitch 0.1” (2.54mm) LCD1 = LCD, 2x1 6 (TCI 602C-01 YA0_A00), Elektor# 1 20061-71 *. Check pinout when using any other device. LCD1 socket = 1 6-way SIL, lead spacing 0.1 ” (2.54mm), right angled LCD1 plug = 16-pin pinheader, lead spacing 0.1 ” (2.54mm), right angled SI = pushbutton, SPNO, tactile feedback, 6mm XI = 20MHz quartz crystal, C L = 1 8pF, 50ppm PCB# 1 10687-1 * * ordering details at www.elektor. com/110687 Figure 2. Component side of the reworked PCB for Pico C-Super, i.e. the version with all the bells & whistles. If you want to make the board yourself, the full artwork may be downloaded from [2]. elektor 02-2012 25 TEST & MEASUREMENT Compromises in the oriqinal Bascom code The published software declares the period as a long variable, which in this case is 32-bit signed — a maximum of 2.1 47 x 1 0 9 . The critical step in the arithmetic requires the period (24 bits) to be multiplied by the value of reference capacitor in tenths of a pF, so by 1 0,000 which is just over 13 bits. That requires a result which is 24+13 = 37 bits, and as one bit of a long variable is the sign that only leaves Bascom with 31 bits and the critical multiplication step can cause an arithmetic overflow. The original software deals with this problem firstly by dividing the 25 bits read from the concatenated counters by a factor of 8 in the ‘Measure-old routine and so reducing the reading to 22 bits. A second compromise is made in the calculation by the statement: aerial or a capacitor, what do you think? You will also see in the photo that a 4 x 20 LCD is being used, which has been invaluable in providing space for diagnostic messages during software development. If Period <=214748 Then 'do calculation' Else 'error' This limits the period to values which won’t cause the subsequent multiplication to overflow, but also puts an artificial limit on the maximum value of capacitor that can be measured. Figure 3. It is any good? The author’s prototype gets ‘grilled’ for accuracy using an array of capacitors and test fixtures. Note the use of a 4x20 LCD, which turned out very useful for diagnostic purposes. Counts per dF! The base oscillator frequency of 3.2 kHz is equivalent to a count of 20 MHz /3.2l v— ■***« P Hurt* ML torfcmn Aura FIT ihfe'r# r □ C-i-a V^Wi Xc-:-fe Mura ♦ FUhaiuhAdin AurfC# m’HhMpHBC IH.IIWU. AiL-k .Uri IRiH 1 WU vrfhwtarh'vn- UCi Figure 3. The window that lets you start a new .Net-MF project for the FEZ Domino board. .xl.B vi Lie idine: .iti| MlirwcttrSOT: i-x'.f uLEmcff'.vcTJV'&irTj i V* - hi Pr«!*nf [ [. -j ! 1 1 . L L xlna i □ 1I-: fki+U >H»4n | H Blink tev’-J LID tool « l»Ek»; Lrt - ■ CiJ . I LrJITiTt'.: khlli c ff itrip E ir 'll vlLLiftrcandti '■ r» (-»!•! iTdltKv ■ JtB .in'- tlr! iMlllll I 6 - Jj| Software Even though in this article we are using an FEZ Domino module (the red board in the photo at the start of the article), all the procedures described are still valid when using the other modules. You just have to load the correct module’s .Net libraries and if necessary adapt the syntax for the method for accessing the physical resource. Let’s get down to business! • Download Visual C# Express and install it onto a computer (www.microsoft.com/express/downloads/#2010-Visual-CS) • Download and install the SDK .Net Micro Framework 4.1 (www. microsoft.com/downloads/details. aspx?displaylang=en&Family ID=cff5a7b7-c21 c-41 27-ac65-551 6384da3a0) • Download and install the .Net libraries for the module used (for the FEZ family www.ghielectronics.com/downloads/NETMF/ GHI%20NETMF%20v4.1%20SDK.zip) • A free terminal may be useful for updating the firmware, for example Tera Term (http://ttssh2.sourceforge.jp/) • If necessary, install the USB drivers for communication with the module (for the FEZ family you’ll find them here: www.ghielec- tronics.com/downloads/NETMF/GHI%20NETMF%20USB%20 Drivers%2032-Bit.zip) Run Visual C# Express, click on File > New projects (Figure 3). Select the module type, give the application a name (Figure 4) and you’re off! Now, plug in the FEZ Domino module using its USB cable, and change the Transport under Project/Properties (Figure 5). If USBizi appears, all is well; if not, install the USB drivers or change the cable. Close Properties and press F5 — the program is compiled, deployed into the module, the module is re-booted automatically, and... the LED flashes! By left-clicking with your mouse in the grey column to the left of one of the program lines, you can add a breakpoint and step through the program (using F1 1 ) from this point onwards. You can then see the statuses of the variables in the Locals window and even modify them! Figure 4. Not quite C, nor C++ — this is C#. Connoisseurs will note the multi-tasking nature thanks to the ‘Thread’ commands. Note too the ‘OutputPort’-type declaration of the LED object. Last word .Net-MF undoubtedly simplifies writing and debugging a microcon- troller project, but it’s down to you to learn how to program in C#. 30 02-2012 elektor E QJ is) - 4 — 1 i — CD > TD < To encourage you, remember that C# is pronounced “see sharp” - an accidental pun by Microsoft. Remember too that there are loads of examples of C# code at [7], for example, and elsewhere on the Internet. Happy project making! All Internet links in this article are available on the article's web page [8], which will avoid your having to copy them out by hand. ( 120033 ) It#, y t-iM.ih d 4 Grt Ty|tr lr tm&rate 1 ■- On Interrupt ltlOT Orrt rfas-i v Reid * TflStmB v Wffi* — By typing the name of an object followed by (here we go again with ‘dot’!), you can display the object’s methods and properties. riiirp'-il-Pfirr ltd « rim niifpiifP.nrTf(rjpij H PLin JjFF? Ln.rHgHf.il -I'fDj Ird'ifaTrJj 1 1 ur purport iouiputPofc[Cpu.Pr portld, bool ihImIgimb) Win S If (triif'} f When you hover the mouse over the text, the expression types can be displayed as here for OutputPort. Internet Links [1 ] Gadgeteer: www.netmf.com/gadgeteer/ [2] Mono: www.mono-project.com [3] Porting kit: www.microsoft.com/downloads/en/de- tails.aspx?FamilylD=CCDD5EAC-04B1-4ECB-BAD9- 3AC78FB0452B&displaylang=en [4] Netduino: www.netduino.com [5] GHI Electronics: www.ghielectronics.com [ 6 ] NKC Electronics: http://store.nkcelectronics.com/nkc-ethernet- shield-diy-kit-without-wiz81 2mj-mod81 2.html [7] TinyClr: http://tinyclr.com/ [ 8 ] This article: www.elektor.com/ 1 20033 THE NEW PICOSCOPE 2205 MSO MIXED SIGNAL OSCILLOSCOPE GREAT VALUE. PORTABLE. HIGH END FEATURES AS STANDARD AND EASY TO USE Think Logically... Trlggc- modes Price www.picoscopemso.com /125 Channel* Resolution! Bandwidth DigiLAl frequency Sampling r.ite 2 Analog, 16 Dlglta 3 bit Analog 25 MHz, Digital 100 MHz combined 200 MS/s Edge, Window, Pu se width. Window pulse width, Dropout, Wndow drop-out, Interval* Runt p Jse, Digital, Logc £349 l ethnology elektor 02-2012 3i TEST AND MEASUREMENT Wideband Lambda Probe Interface (2) Measure, control and diagnose using the PC seria interface By Sebastian Knodler (Germany) In the last issue we described the interface board for a wideband lambda probe. This versatile board can be used in stand-alone mode or more conveniently from the comfort of a PC or laptop using its serial interface port. When used together with a computer the interface has access to the diagnostic features of the CJ125 lambda probe interface chip and allows measured values and operating conditions to be stored for analysis later on. The interface board is set-up and controlled using a simple set of commands. Last month we took a look at the operating principle and circuit of this lambda probe interface design [1] and its operation in stand-alone mode. Included in the circuit is a TTL/RS232 interface chip giving it the capability of communication with a PC fit- ted with this type of serial port. The com- munication protocol does not use any hand- shake signals so only three wires are needed (TXD, RXD and GND), connecting to the three pins of XI (see Figure 1 ). Should your PC not have an RS232 port then a stand- ard USB/RS232 adapter cable can be used, allowing communication via one of your PC’s spare USB ports. Data Before the serial interface can be used it will be necessary to set up the PC’s COM port (or virtual COM port). The configuration data is 1 1 5,200 baud, 8 data-bits, 1 stop- bit, no parity, no handshake. Once communication is established the lambda interface board sends data packets containing lambda measurement informa- tion at a rate of five per second. The rate can be changed to once per second and the data can be sent in an Excel compatible ‘.csv’ for- mat. The data packets have the following simple format, for example: Lambda: 250 Ref: 252 Bat: 505 Status: 32 CJ: 255 In MS Excel compatible mode the same val- ues are output as: 250;252;505;32;255 The first line or value in each data packet * Lambda ’ contains the digital value pro- duced from the 1 0-bit A/D conversion of the U A voltage from the CJ125. Using this value we can determine the pump cell current to calculate the exact value of lambda: Lambda x 5 P= ^X R shunt X 1023 Ap is the pump current amplification fac- tor (8 for rich and 1 7 for lean mixtures) and Rshunt is the 61 .9 £1 shunt resistor. Plugging in some typical values (Lambda: 250) and A p = 8 the pump cell current equates to: 250 x 5 / = = 0.0025A = 2.5mA p 8x61.9x1023 The second value in the data packet 'Ref* is a correction value as already mentioned in the first article, for the 5 V reference voltage used by the D/A converters. The value of Ref is derived from the equation: „ , 1.22x1023 Ret 5 1 .22 V (±1 %) is a precise reference voltage on ADC3 (Pin 26) of the AT mega8. Any devi- ation of Ref from its optimal value of 250 indicates that of the 5 V reference used by the A/D converters is inaccurate. It’s probably no surprise that ‘Batt’ is the digital value of the supply voltage U batt or U b . The voltage divider formed by R23/R24 32 02-2012 elektor TEST AND MEASUREMENT reduces its value so that it can be meas- ured by the A/D converter (ADC2, pin 25) of the ATmega8. If the value falls below 440 (=1 0.5 V) or rises above 670 (=1 6.0 V) the ATmega8 stops measurements and switches to standby mode. Status and CJ are values representing the microcontroller status register and the CJ1 25 diagnostics register. The status reg- ister bit definition is given in Table 1 . The ‘Watchdog’ bit indicates that a program failure has been detected and the program needs a clean restart. The CJ error bit indi- cates an error in the CJ1 25 which is specified in the CJ value byte. The CJ byte is the binary value of the 8-bit CJ125 diagnostics register. Table 2 indicates their bit assignments and Table 3 interprets the detected failure codes. When no errors are detected the CJ byte has the value of 255 i.e. all bits have the value ‘1 ’. When an error is detected the output X2 / Pin2 is driven high and the probe heater turned off to prevent over heating. The probe pump current is also turned off and measurement of the Nearn cell Rj is not valid so that the values of U R und U A are not usable. As the probe ages it tends to produce errors especially during the warm-up phase. The condition will generally resolve as the probe reaches operating temperature but an increasing occurrence of errors indicates that the probe is ready to be replaced. Commands The serial interface supports eight com- mands (Table 4) from an external PC and these are sent as a single character. The character’s ASCII code is sent so it’s impor- tant to make sure that only upper case char- acters are input. A command is terminated with a CR (carriage return, ASCII code 13) and only becomes active once the carriage return is received. A short description of each of the commands follows: C (Calibration Mode): The CJ1 25 is switched to calibration mode (see paragraph below). N (Normal Mode): The CJ1 25 supplies actual lambda readings (see paragraph above). LM4041 110728 - 11 Figure 1 . An external computer can send commands to the unit and receive X measurements and probe status information via the RS232 interface. Table 1 . Status register bit definition lntF.7 IntF.O Calibration mode Watchdog System ready SPI error Ubatt high Ubatt low Probe over- temperature CJ error Table 2 . CJ 125 diagnostic register CJF.7 CJF.O DIAHG DIAHD U/lp U/lp U N U n Vm Vm Table 3 . Interpretation of failure bits Failure bits DIAHG/DIAHD U/lp* Un, V m 00 Short circuit to ground Short circuit to ground 01 Heater not connected Low battery voltage 1 0 Short circuit to U Batt Short circuit to U Batt 1 1 No error No error elektor 02-2012 33 TEST AND MEASUREMENT Table 4. Table of commands Command Function C Calibration Mode N Normal Mode H Start measurements D End measurements F Fast transfer (5 Hz) S Slow transfer (1 Hz) T Cleartext mode E .csv mode (Excel compatible) Table 5. Percentage O2 concentration versus pump cell current 0 2 concentration 0.0% 3.0% 6.0% 8.29% 12.0% 20.9% Pump cell current 0.00 mA 0.34 mA 0.68 mA 0.95 mA 1 .40 mA 2.55 mA H (Start measurements): Turn on probe heater. The system will be ready to start measurements in approximately 30 s. D (End measurements): Turn off probe heater. F (Fast): Data packets sent at a rate of 5 per second. S (Slow): Data packets sent at a rate of 1 per second (the standard setting). T (Text): Data packets sent in text format (see paragraph above). E (Excel): Data packets sent in Excel format (see paragraph above). Figure 2. The relationship between oxygen concentration and pump cell current shows good linearity. Calibration The command ‘C’ puts the CJ125 in cali- bration mode. The has the same effect as pulling pin 1 of connector X4 to ground when the unit is used in stand-alone mode (described in the first instalment of this pro- ject). The circuit automatically performs a self calibration at switch on (when power is applied). A (re)calibration is only necessary if an extended period (> 24 h) of continuous measurement is underway. Accuracy The wideband lambda sensor type LSU4.2 together with the CJ125 interface chip achieve maximum accuracy when measur- ing lambda values close to X = 1 . At more extreme values i.e. lambda values around X = 1.7 accuracy can be expected to be within ±0.05, drifting by ±0.1 5 over the probe’s lifetime. At X = 1 .009 the error is much smaller quoted at ±0.006 increasing to just ±0.008 after 2000 operational hours. In order to accurately calculate the oxygen content of the exhaust gases it is necessary to establish a calibration curve (Figure 2) using the values given in the lambda probe data sheet (see Table 5). It is evident that the oxygen concentration shows a close linear relationship to the value of pump current l p . From this we derived in last month’s article the equation giving the oxygen concentration: 7+0.035 O = — 2 0.1221 The calculation requires oxygen to be pre- sent in the exhaust which implies a lean burn i.e. when there is excess air in the mix- ture. Different calibration data is required for accurate measurement of combustion produced by a rich mixture and also if the LSU4.9 type lambda probe is used. A more accurate calibration can be made by probe immersion in a specialist calibration gas (e.g. from the gas supplier BOC). (110728) Internet Link [1 ] www.elektor.com/ 1 1 0363 34 02-2012 elektor lektor Brought to you by Eurocircuits rvice The European reference for PCB prototypes and small series Speed up your design cycle and keep costs down using our fast, easy-access online PCB pooling services. We deliver: • Top quality PCBs at low pooling prices • Fast deliveries to suit your requirements • Comprehensive technology support • No set-up or tooling charges • No minimum order charge - order from 1 PCB • Online ordering without pre-payment • Stencil service PCB proto - dedicated engineering prototype service , fast and low-cost • 1 or 2 PCBs in 2, 3, 5 or 7 working days • DRC-checked and fully finished with 2 soldermasks and 1 legend, 150|jnn technology • 1 x 100 x 80mm in 7WD - 2 layer 47,02 € - 4 layer 95,52 € • 2 x 100 x 80mm in 7WD - 2 layer 36,89 € each - 4 layer 74,76 € each Prices quoted include 2 1 % Belgian VAT but exclude transport costs STANDARD pool - the widest range of pooling options in Europe • 1-8 layers 150pm technology PCBs • from 2 working days TECH pool - all the benefits of pooling for high-density PCBs • 2-8 layers 100pm technology PCBs • from 4 working days IMS pool - aluminium-backed PCBs for high heat-dissipation (LED) applications • Single layer Insulated Metal Substrate PCBs • 1.5mm aluminium base with 75|jm thermally conductive dielectric and 35pm Cu foil • from 3 working days On demand - multi-option non-pooling service for specialist needs • 1-16 layers down to 90pm technology • RF and high Tg materials • from 2 working days www.elektorPCBservice.com REVIEW PicoScope 2205-MSO Grilled By Thijs Beckers and Jan Buiting (Elektor UK /US Editorial) A mixed signal oscilloscope (MSO) combines an oscilloscope with a logic analyser, their readouts appearing on a single screen if desired. When we saw Pico Technology’s [1 ] entry level MSO type 2205 announced as “priced under £350” (for the oscilloscope only) we thought we’d better request a sample for reviewing in and around the Elektor Labs. We received the full kit that’s advertised at £399, .i.e. comprising the instrument proper, a pair of xl /xl 0 passive probes, a Connect Device Select a louts Inmtiisht beta* ll you plugin a Mw iirote iVw t ihtu Jrf Appeal n Ihe !•:( PiCfiSiOC* 2205 r^EO. ARti 0 tyft 3 & neb jij FtofnthUH I O _f _} UinWE lj - rMt Ij'lL Iiw.'J TJ- UiHl^,^**H***, o 5V O ORBO LUX_Z -> FREQ I GND C5 lOOn 3V3 5V Figure 7. This shows one of the five TSL230 light sensors. The address pins of all the sensors are connected in parallel to a simplify the control. Figure 8. Forthe SD card there is a bidirectional voltage converter from 3.3 to 5 V. Auto-ranging As already mentioned, the amount of sun- light/sky brightness has to be measured with a large dynamic range. Normally a fre- quency measurement has a limited resolu- tion. The processor also imposes limits on these frequencies. The programmable sen- sitivity scales of theTSL230 offer a solution in this case. This is also the most important reasons why this sensor 1C was selected. The datasheet for the TSL230 shows that four pins are required for addressing the sensitivity scale (Table 3). This allows for a lot of possibilities. In the circuit all these pins are connected in parallel (see Figure 7), so that all sensors react at the same time to a change in setting. This drastically reduces the number of connecting wires to the sen- sor unit, but even more important is that the software in the PIC can be kept relatively simple, which benefits the measuring speed and the size of the program. The only disad- vantage is a relatively large rounding of the measuring values of one or more channels when there is a large difference in light level between them. Important are the limit values for each TSL230. These are fixed and have a lower limit of 200 Hz and an upper limit of 4 kHz. If during a measuring cycle one of the sen- sors exceeds a limit value then the instru- ment will switch to a difference sensitivity scale during the dead time (after the final measurement of the five light sensors). This therefore happens for all sensors simultaneously. Card reader An SD-card operates at a voltage of 3.3 V. Because the instrument operates at a 5-V power supply voltage there is the necessity for a bidirectional voltage converter. For this purpose the principle of the level trans- lator (MAX 3002) is copied from the E-block EB037 from Matrix Multimedia (see partial schematic Figure 8). Note that this 1C is only available in a TSSOP package. Soldering the 20 pins with a pin pitch of 0.65 mm (!) does require some practice. In this way the measurements can be directly stored on an SD card (it is impor- tant to note that the file system format is FAT16). This uses the Flowcode4 macro ‘PIC_FAT1 6.c’ (make sure that this is ver- sion 020710 or later). SD card detection takes place when the but- ton ‘I NIT CARD’ is pushed. If a card is pre- sent a new file name is automatically gen- erated to log the information. The file name is ‘ed_#.txt’, where # is the sequence num- ber that is stored in the EEPROM of the pro- cessor. This number is automatically incre- mented after each initialisation of the SD- card (after 255 follows 0, etc.). Measuring protocol The format of the data stored on the SD card is as follows. For example, after some time: Eclipse data: 4298 1701 2429 3488 0 6.14 190 144 124 217 170 2429 3488 0 14.15 1948 1473 1296 2191 1724 2429 3488 0 22.15... The file always begins with the key word ‘Eclipse data:’ (for recognition by the data processing software). Subsequently the measured values are written, separated by a space. The synchronisation of each series begins with a ‘floating’ point number: The value before the point is the measuring time in whole seconds. The value after the point is the code value for the autoranging. This is then followed by the eight countervalues elektor 02-2012 4i TEST & MEASUREMENT Figure 9. Overview of the operation and readout at the front of the control unit. from the sensors, and so on. Operation After the unit is switched on a short intro is displayed. This briefly shows the details of the owner (to improve the chance of recov- ering the unit after loss or theft). This can of course be changed by suitably modifying the Flowcode program. After this the measurements start automat- ically (see Figure 9). Meaning: - Lux_W: Sensor measuring value (coun- ter value) (in this case the western light sensor) -Time: Number of elapsed seconds of meas- uring time (in this case 477 s) - Sens: Sensitivity indicator for the light sensors (A = lowest sensitivity, E = highest sensitivity) When the instrument is turned on and after the intro, the yellow LED (‘Card Idle’) will light up to indicate that the SD card has not yet been initialised. During this time the sensor is carrying out measurements, but the results are not yet stored. With the button ‘START/ERASE’ the meas- urements will now start to be logged. The measuring timer then starts at 0 sec- Figure 1 0. Example graph during a sunrise. onds. The button ‘STOP/CANCEL’ ends the logging. Battery condition management For battery powered devices such as this one, it is important to know what the con- dition of the battery is (after all, the meas- urements during a total solar eclipse cannot be repeated). That is why it would be nice to know whether there is sufficient voltage to make measurements for the next few hours without any problems. There is a red LED on the front panel to indicate the bat- tery condition. Another aspect concerns the error free operation of the data logging system. For this it is very important that at all times the voltage is guaranteed to be correct when writing to the SD card. In this way the pro- cessor ensures that no write operation can be carried out when the battery voltage is too low. The voltage level of the battery is measured continuously with the following divisions: U batt >5.6 LED off Sufficient voltage 5-6>U batt >5.3 LED flashing Sufficient, but be watchful 5-3 > U batt >5.1 LED on Insufficient: Init card not possible Ubatt <5-1 LED on Insufficient: Run- ning log stops Table 4. Upcoming total solar eclipses 14 November 201 2 Southern part of the Pacific 3 November 2013 Central Africa 29 March 201 5 N. Atlantic Ocean and Spitsbergen 1 9 March 2016 Indonesia 21 August 2017 United States 7 http:/ /home. l Examples -> ^Communication -> Dimmer) does not work with the LED mounted on the Max32 board, and then modify the sketch so that it would work. The answer to the first question seems easy enough: the LED is not connected to the right pin (duh!). Indeed, the example expects an LED on pin 9 whereas the LED on the Max32 board is connected to pin 1 3. However, when you naively change the pin number in the software it still doesn’t work. The reason for this is that the sketch uses analogWrite to set the brightness of the LED and, in contrast to what you may expect from its name, this function uses PWM to emulate an analogue output. Of course the PIC32 features hardware PWM functions, but the outputs are not routed to pin 1 3 of the Max32, so analogWrite simply he first checked whether the original sketch worked as intended, i.e. with an LED on pin 9. Then he went on to improve this sketch by adding support for an RGB LED, and finally he implemented a software PWM function to emulate analogWrite on pins that do not have hardware PWM capability. With this function it is possible to control the brightness of the on-board LED. Problem solved. Note that the resolution of this function is a bit crude, but the general principle will be clear. Now I would have given Martin an A+ for his work, if only he had used the correct example. Instead, he based his work on the example ‘Fading’ (File -> Examples -> Analog -> Fading), which is very similar, but does not include serial port communication to manually control the brightness. But then again, since he has been the only one to actually do his homework, tell me about it and provide video proof of his work so far, he earns top marks anyway. Well done, Martin: A+ 4U! You can download Martin’s code and videos from www.elektor.com/ 1 1 071 5. And remember: you have until March 27 2012, 18.00 GMT (13.00 EST) to submit your DesignSpark chipKIT Challenge project at chipkitchallenge.com and maybe win up to $5000 in cash! (110715) 46 02-2012 elektor Do your electronics speak to you? Are the words audio ' , "vacuum tubes" and "speaker technology" music to your ears? Then you should be reading audioXpress! Recently acquired by The Elektor Group, audioXpress has been providing engineers with incredible audio insight, inspiration and design ideas for over a decade. If you're an audio enthusiast who enjoys speaker building and amp design, or if you're interested in learning about tubes, driver or a combination of both for maximum accessibility. Subscribe to audioXpress at www.cc-webshop.com today! Audi amotci Lou ds pea *4? v- ^ 'ft. rfo* i< j SjtiLfi ll'-an over, this 7 1 ^ i *vn*yrhirg you rad to ijii'un now mtiutitt Krippfllamt ^ J '-' 1 '-Iil'PI'C on auttapejher voicing V' ..! . r r.o* iMSucfcs w ppoa anat i h;,p!^ on autf speaker voicing ■ e&l ig and crossover changes. a mw 1 Stipe complex yijlh -ftrifuinrw; &vi)f ICQ adflriifina fg j 1^ ii sal of oudsooakor design « A 39 £ vuluot What will you find in audioXpress ? • In-depth interviews with audio industry luminaries • Recurring columns by top experts on speaker building, driver testing, and amp construction Accessible engineering articles presenting inventive, real-world audio electronics applications and projects Thorough and honest reviews about products that will bring your audio experiences to new levels Yours today for just & Jhis honk, and snai |eurprodui Cl testing, and vintage audio, then audioXpress is the magazine for you! COURSE Electronics for Starters (2) Transistors in action winning a nice prize. Transistors can easily be regarded as one of the most significant technological inven- tions ever. Many aspects of modern eve- ryday live — including computers, mobile phones and the Internet — would be impos- sible without them. In the 1 950s these small semiconductor components started dis- placing vacuum valves, which had played a dominant role up to then. Germanium tran- sistors were the first to become popular, fol- lowed later by bipolar silicon transistors and even later by field-effect transistors. Tech- nological progress in this area was acceler- ated by the invention of integrated circuits (ICs), which contain a large number of tran- sistors in a single package. However, you By Burkhard Kainka (Germany) Electronic devices are becoming more and more complex, which makes it increasingly difficult for beginners to get up to speed. In this series we therefore aim to get back to basics. In this instalment we present some interesting experiments with transistors. We also have a quiz for you, with the chance of can implement a wide variety of functions with a single discrete transistor, as we demonstrate in this instalment. First experiments Start by building the circuit shown in Fig- ure 1 , for example on an Elektor Elex board (see elektor.com/ 1 20002). This allows you to use the same board for several experi- ments and utilise the through tracks for power and ground rails. A 9-V battery provides a convenient source of power. It doesn’t need to be fully charged - for example, a battery retired from service in a smoke detector will do nicely. A weak battery actually has the advantage that if something goes wrong, it can’t supply enough current to cause any- thing to go up in smoke. Now let’s try a set of simple experiments: 1. When contacts A and B are not con- nected, the LED should remain dark. 2. Connect A and B together. The LED should light up brightly. 3. Bridge A and B with a wet finger. The LED should light up more or less dimly. 4. Leave A and B open, and see what hap- pens when you short the emitter (E) and col- lector (C) leads of the transistor together. The LED should light up brightly. 5. Connect A and B again (the LED should be lit), and then short the base lead (B) to ground. The LED should go dark. Figure 1 . Our first experimental setup. Figure 2. Basic current gain circuit. Figure 3. A PNP transistor in a common-emitter circuit. 48 02-2012 elektor COURSE Figure 4. A transistor configured as an inverter. This set of experiments illustrates the basic operating principle of a transistor: a small base current (between the base and the emitter) controls a larger collector current (between the collector and the emitter). We say that the base current is amplified, and roughly speaking, we can regard the amplification factor (or gain) as constant. The widely used BC547B transistor has a gain of approximately 300, which means that the collector current is a factor of 300 greater than the base current (Figure 2). However, this is only true if it is not limited to a smaller value by a collector resistor (as in the circuit shown in Figure 1 ). Circuit design In order to design a transistor circuit, you first need to know exactly what you want to achieve. a) Should the transistor operate as a switch and be either fully off (cut off) or fully on (conducting)? b) Or should the transistor operate as an analogue gain stage and allow more or less current to flow? You have already tried both options in the initial set of experiments. When contacts A and B are joined together, the transistor is driven fully into conduction (switched on), although it has more internal resistance in this state than a real switch with two metal- lic contacts. As a result, there is always a small voltage drop between the emitter and the collector. With the wet finger exper- iment you were in the analogue camp, and you may have noticed that the brightness of the LED depends on how hard you press your finger against the contacts. The choice of liquid also plays a role here - for example, cola yields more current than tea, due to the acids in the cola. Figure 5. Delayed switch-off. One of the difficulties in designing tran- sistor circuits is that you do not know the exact gain of the transistor. Unlike resis- tors, which are readily available with a tol- erance of 1 %, it is very difficult to manufac- ture transistors to tight tolerances. The gain in particular shows a considerable range of variation. In the case of the BC547, the gains of individual devices in a new fabrication batch can lie anywhere between 1 1 0 to 800. These new devices are measured by auto- mated equipment and sorted into the three gain groups A, B and C (see the ‘TUP/TUN’ inset). The range of gains in these three groups is still fairly large, which is simply a fact of life for circuit designers. They must design their circuits to work properly with every transistor in the selected group. This sometimes requires a bit of calculation; in many cases just trying it out is not enough. Now let’s have a look at the circuit shown in Figure 3. A PNP transistor operates in the same way as an NPN transistor, but it has the opposite polarity. This means that the emitter is connected to the positive termi- nal of the battery. This circuit has an addi- tional LED in the base circuit. It is intended to show that the base current is much lower than the collector current, which is why the light from the green LED is very dim. Inverter From high to low, from on to off: inverters perform a very simple task in the world of computers and microcontrollers. However, a transistor can do this just as well. Up to now we have been using our transistor as a sort of controlled switch: if you switch on the base current, the transistor switches on the load current. But you can also reverse (invert) the switching function with a tran- sistor. Figure 4 shows a simple inverter cir- Glory days of TUP and TUN There are so many different types of tran- sistors that it can be difficult to decide which one to use. In the distant past Elek- tor used the designations ‘TUP’ (transis- tor universal PNP) and ‘TUN’ (transistor universal NPN), but in those days it was possible to buy unmarked transistors a bit cheaper than marked ones, and ‘TUN’ simply meant any type of general- purpose small-signal NPN transistor. Nowadays you are well advised to use the BC547B; it almost always fits and is a sort of modern TUN. You should actually have a bag of them on hand, and it won’t make a big dent in your budget. For the TUP the natural choice is the BC557B. The key BC547B specs are: Maximum collector voltage: 45 V Maximum collector current: 1 00 mA Current gain: 200 to 450 (290 typical) The BC547A has a current gain of 1 1 0 to 220 (180 typical), and the BC547Chasa current gain of 420 to 800 (520 typical). If you examine the current gain curves in more detail, you will see that the current gain of a transistor is fairly constant only at moderate collector currents; it drops significantly at relatively high and low current levels. cuit. Here the LED lights up when the switch is closed and goes dark when the switch is open. The reason for this is that when the switch is closed, the base circuit is closed through the LED and a current flows into the base. This causes the transistor to conduct, and it shorts out the voltage over the red LED. If you measure the voltage between the collector and the emitter, you will find that it is around 1 00 mV. At this low voltage the current through the LED is virtually nil, so it remains dark. Delayed switch-off circuit The current gain of a transistor can be used to extend the discharge time of a capacitor. elektor 02-2012 49 COURSE Microcontroller time switch Modern time switches are built around mi- crocontrollers. This allows them to achieve high precision without calibration. RC tim- ing circuits have evidently had their day, but there’s one thing a microcontroller cannot do: switch high currents. For this you need a transistor. A simple NPN transistor makes a suitable power driver for switching exter- nal loads. It gives the relatively lightweight microcontroller port more muscle. A popu- lar choice for this task is the BC337, which can switch up to 800 mA. The figure shows a time clock circuit where the current that must be switched by the microcontroller is less than 5 mA. The transistor amplifies the port current enough to switch an incandes- cent lamp. It also provides level shifting, since the microcontroller operates at 5 V and the lamp operates at 1 2 V. The small BASCOM example program implements a time switch. The timeout (1 minute) starts counting down after the button is pressed. Unlike the analogue circuit in Figure 5 of the main text, press- ing the button again during the timeout interval does not prolong the timeout. Flow should the code be modified to enable retriggering? The circuit shown in Figure 5 has a 1 00 jiF electrolytic capacitor serving as a stor- age capacitor. It charges quickly when you press the pushbutton, and after the button is released it supplies a base current to the transistor. The high resistance of the base resistor results in a time constant of around 1 0 seconds. After this interval the base cur- rent is no longer strong enough to drive the transistor into full conduction. The time constant of an RC network is the time required for the capacitor to dis- charge to the point where its voltage is a factor of 1 /e (1 /2.718...) of the initial volt- age (36.8%). The time constant can be calculated using a simple formula: Time constant = resistance x capacitance t = RxC t= 100 k£lx 100 pF t= 10 s As it happens, you can still detect a faint light after one minute. The LED actually continues to emit light for a relatively long , Timer 60 s $regfile = „ attinyl3 . dat " $crystal = 1200000 Config Portb . 4 = Output Portb .3=1 , Pullup Do Do Loop Until Pinb.3 = 0 Portb .4=1 Waitms 60000 Portb .4=0 Loop End time, but the current drops to such a low level that the light is no longer visible. If you prefer to implement a time switch with a microcontroller, see the ‘Microcon- trollertime switch’ inset. Twilight switch In the circuit shown in Figure 6 we use a light dependent resistor (LDR) as a light sensor. This component has a light-sensi- tive resistive layer made from cadmium sulphide (CdS). Its resistance depends on the intensity of the incident light, ranging from approximately 100 Q in full sunlight to over 1 in the dark. The resistance at an illumination level of around 1 000 lux (equivalent to a well illuminated workplace) is approximately 1 I<£1. The combination of the variable resistance of the LDR and the fixed resistance of the 100 k£l resistor forms a voltage divider. The transistor is cut off when the voltage between the base and the emitter ( U BE ), which is taken from the voltage divider junction, is too low. In simplified terms, we can say that this circuit has a switching Figure 6. A twilight switch. threshold of approximately 0.6 V. This value applies to all silicon transistors and results from the well known diode characteristic curve. Try out this circuit with various light levels to see how it behaves. The LED is switched off when the light level at the sensor is high and switched on when the light level is low. You should see fairly abrupt switching at a certain threshold light level. The range of light levels for which the transistor is in the partially conducting state is small. Darlington circuit The gains of a pair of transistors can be mul- tiplied by using the amplified current from the first transistor as the base current for the second transistor, where it is further amplified (see Figure 7). If each of these transistors has a gain of 300, the Darlington pair has a gain of 90,000. This circuit can be driven into full conduction with a base lead resistance of 1 0 M Q, so it can be used effec- tively as a touch switch with two bare wires touched by two fingers. Moistening your Figure 7. A Darlington pair. 50 02-2012 elektor COURSE Figure 8. A triple Darlington. fingers is no longer necessary; even dry skin allows enough current to flow to drive the circuit fully on. The additional 1 00 k£l resis- tor protects the transistors against exces- sive base current, which would otherwise flow if the two wires were shorted together. An extension of the Darlington circuit to three transistors (Figure 8) can be used for interesting experiments with static charge detection. To see this, try sliding you feet on the floor while touching the base lead of this Darlington circuit with one finger. Depending on the nature of the floor and the material of your shoe soles, this will pro- duce more or less strong charge displace- ments that are made visible by flickering of the LED. In many cases simply approaching the input terminal without actually touch- ing it is enough to cause the LED to light up. Using a LED as a photodiode In addition to emitting light, LEDs can be used as sensors for ambient light. In princi- ple no current flows through a diode when Figure 9. Amplifying the reverse current of an LED. The following circuit is built around a pair of transistors with opposite polarity (NPN and PNP). This is what is called a complemen- tary Darlington circuit. 1 ) How would you classify the operation of this circuit? A) A useless circuit; the LED will never light up B) Touching the contact switches the LED off C) A touch switch with time delay 1 9 0 : s s /S7 "H 10M E-fk ) BC557B “ BC547B 1u ( » < — 2) What current gain can you expect? D) Approximately 1 00,000 E) Approximately 5,000 F) Approximately 900 3) What are the potential advantages of a complementary Darlington circuit compared with a normal Darlington circuit with two NPN transistors? G) Higher current gain H) Lower input voltage I) Lower collector-emitter voltage in the fully on state If you send us the correct answers, you have a chance of winning a Minty Geek Electronics 1 01 Kit. Send you answer code (composed of a series of three letters corresponding to your select- ed answers) by e-mail to basics@elektor . com. Please enter only the answer code in the Subject line of your email. The deadline for sending answers is February 28, 201 2. All decisions are final. Employees of the publishing companies forming part of the Elektor International Media group of companies and their family member are not eligible to participate. it is reverse biased, but in fact you can meas- ure a very small reverse current in the range of a few nanoamperes, which is low enough to be ignored in most cases. However, the high gain of the Darlington circuit allows you to perform experiments with extremely low currents such as this. For instance, the reverse current of an LED depends on the light level, which means that an LED acts as a sort of photodiode. We can use our Dar- lington circuit to amplify the extremely small reverse current to the level needed to light up the second LED. In such exper- iments you should bear in mind that the rated reverse voltage of an LED is much less than that of a normal diode. The maximum reverse voltage of LEDs is usually specified as 5 V on the data sheets, but the voltage on the LED in our circuit is approximately 8 V. In fact most red, yellow and green LEDs can withstand significantly higher reverse volt- ages before entering the breakdown region, although the reverse breakdown voltages of white and blue LEDs are very low. In any case, the 1 00 l<£2 resistor protects the LED against serious damage. No matter whether you are a beginner or an old hand, you should now have a look at our Quiz in the inset. If you send us the right answers by e-mail, you have a chance of winning an Elektor voucher. ( 120002 - 1 ) elektor 02-2012 5i DSP COURSE Audio DSP Course (8) Part 8: Digital dynamics processor There is a big discrepancy between the dynamic range of a live performance and the dynamic range that can be reproduced by ordinary playback equipment. This is particularly the case with orchestral music, both ‘big band’ and classical. We can address this problem by artificially reducing the dynamic range of the signal, or, as it is picturesquely termed, ‘compressing’ the music. The device that does this job is called a dynamics processor, and it can be configured so that the compression characteristics are easily reproducible. The practically unlimited storage for audio signals offered by digital technology gives it a significant advantage over analogue technology in this application. In this article we look at how our DSP board can be made into a digital dynamics processor. By Alexander Potchinkov (Germany) The dynamic range of a live music perfor- mance that can be captured using a good- quality microphone is often greater than the rest of the signal chain can cope with. By ‘dynamic range’ we mean the difference between the maximum and minimum sig- nal levels encountered within a particu- lar period of time. In the analogue era the weakest link in the electro-acoustic signal chain was typically the recording medium, be it vinyl record or magnetic tape. An LP with a dynamic range of perhaps 40 dB can hardly be expected to preserve every nuance of an orchestral performance with a dynamic range of perhaps 70 dB or even 80 dB. Assuming that we do not want to introduce distortion in the louder pas- sages, the quieter passages will inevitably sink below the noise inherent in the record- ing medium. Another example is the piped music used to entertain visitors to shopping centres or eateries. In such environments only a very narrow dynamic range can be used, considerably less than 40 dB, as the aim is gently to encourage consumption rather than to cause customers to strain their ears to hear the music or plug their ears to avoid it. In both these examples we need to reduce the dynamic range of the recording, for which we need a dynamics processor, also known in studios as an ‘AGC (automatic gain control) amplifier’. Com- pressing the dynamic range need not neces- sarily lead to an undue loss in audio quality: for example, the most important aspect of a scream is not its volume but the spectral character of the voice. So a horror film on the television will not necessarily result in visits from solicitous neighbours! Signal processing in the dynamics processor An AGC amplifier adjusts its gain and/or attenuation in a defined way in response to the level of its input signal. The exam- ple structure in Figure 1 shows two signal paths: the ‘signal chains’ for the left and right channels (‘L’ and ‘R’), shown in red, in which the gain can be adjusted and per- haps an adjustable delay introduced, and the ‘side chain’, shown in black, where the required gain is determined. The side chain has two main elements: • The ‘level processor’, a static or time- invariant system where the required gain factor is derived from the level of the input signal. It includes assessing the input level and applying a given charac- teristic curve that specifies the relation- ship between input level and applied gain. • A time-dependent unit that determines the dynamic response of the device: in other words, how the device responds overtime to a rising or falling input level. The time constants correspond- ing to these two situations are conven- tionally called the ‘attack time’ and the ‘decay time’ respectively. The level processor is the most complex part of a dynamics processor, and typically has four characteristics that can be com- bined with one another: • A ‘limiter’ function which limits the out- put level to a preset value. This can be used to help prevent overload of sensi- tive components such as tweeters. 52 02-2012 elektor DSP COURSE ‘compressor’ func- tion which reduces the dynamic range of the signal above a preset threshold value by a given factor (the ‘compression ratio’) by applying a level-dependent gain reduction. An ‘expander’ function, which is the inverse of the compressor function. A ‘noise gate’ function which mutes sig- nals with a level below a preset thresh- old. A noise gate can be used to sup- press background noise, passing only the useful parts of the signal that have a sufficiently high level. Figure 2 shows the details of the signal processing in the side chain along with the parameters involved. So as not to clutter the figure we have only shown the compressor function in the level processor and only one of the signal chains, and we have omitted the adjustment of overall output level. The first block is a peak value rectifier: readers will already be familiar with this from the article in this series describing the output level meter. The level processor includes converting the level to decibels, applying the characteristic curve, and converting back from decibels. The gain factor smooth- ing is shown as an exponential-decay filter, modified in this application to have hyster- esis and two different time constants. The following settings are available on the limiter, compressor and noise gate of our dynamics processor: • T n , the threshold of the noise gate; • T c , the threshold of the compressor, and R, its compression ratio; • T l , the threshold of the limiter; • the attack and decay times in the time- dependent unit; • overall gain to adjust the output level. Figure 3 shows the innards of the level pro- cessor implementing the compressor, noise gate and limiter functions. The output from the figure is the value P g , which is the gain g expressed in decibels (that is, on a loga- rithmic scale). The value P g is the minimum of the three gain values P gN , P gC and P gL , which are independently computed by the I Side-Chain Peak-Value Rectifier with Time Unit Level Computation Static Level Processor Gain-Factor Computation ln L o ►- + j-K X HP-Filter adjustable Signal Delay Signal Chain L HXj-HXj — oOut L Output Level 0.5 — ' „ W adjustable Signal Delay Signal Chain R w w H X ) — oOut, Figure 1 . Block diagram of the signal processing inside the two-channel dynamics processor. X Figure 2. Digital processing carried out to implement the compressor function. noise gate, the compressor and the limiter respectively. We have also included an adjustable sig- nal delay, which allows the unit to be used as a transient limiter. The delay allows the unit to anticipate required gain changes (at the price of adding an overall delay to the signal) and can considerably reduce the distortion introduced by the dynam- ics processing. Gain adjustments can be made smoothly rather than suddenly, just as an experienced sound engineer familiar with the loud and quiet passages of a piece would do at the mixing desk. The last stage in the signal processing chain is the output level unit which can compen- elektor 02-2012 53 DSP COURSE Figure 3. Digital processing carried out in the level processor to implement the compressor, limiter and noise gate functions. sate for any overall attenuation in the level processor. For example, let us suppose that the compressor threshold level T c is set to -40 dB, the compression ratio R is 4, and the limiter is disabled by setting its thresh- old level T l to 0 dB. Then as the input level varies from P x = -40 dB to P x = 0 dB (a range A P x of 40 dB) the output level will only vary from P y = -40 dB to P y = -30 dB, a range A P y of 1 0 dB (by definition R = AP y /AP x = 4). The maximum output level is thus P y = -30 dB and is achieved when the input level P x is 0 dB. This is the overall attenuation of the level processor, which can be compensated for by the output level unit. Here we would set the gain of the output level unit to at most 30 dB if we want to ensure that the output cannot be overdriven. The example shows that the required output gain can be calculated, but more often it is set by ear. The DSP program allows output gain set- tings in twenty-one steps of 3 dBfrom 0 dB to 60 dB. Figures 4 and 5 show two examples of the compressor in action. The middle plot in Figure 4 shows an input signal that is zero except for two sinewaves, one with an amplitude less than the compressor thresh- old and one with an amplitude above that threshold. The upper plot shows the gain factor g. During the high-amplitude burst we have g < 1 , while during the low-ampli- tude periods g returns to 1 as determined by the decay characteristic. An inherent problem in this kind of dynamics process- ing is illustrated in the lower plot. Because the gain is not reduced instantly at the beginning of the high-amplitude burst (the response time depending on the attack characteristic) there is a brief period when the output is overdriven. The best way to avoid this problem is to use the delay facil- ity in the signal chain. Figure 5 shows the compressor operating on a piece of music. Again the middle plot shows the uncompressed input signal and the upper plot shows the gain factor. The input amplitude is relatively high and so the gain is reduced in accordance with the com- pressor’s settings. The lower plot shows the output signal. It is easy to see that the qui- eter parts of the music have been amplified (or, more precisely, that the louder parts What qoes on inside the level processor We will look below at the calculations that the level processor car- ries out, using the default parameter settings as an example. These values are given elsewhere in this article. We introduce a new vari- able, the so-called ‘compressor slope’ 5=1-1 //?, which in the de- fault situation gives us 5 = 1 /2. We write P x for the input signal level, P y for the output signal level and P g = P y -P x for the amplification in the gain stage. In our example the characteristic curve of the dynamics processor consists of four segments. One of the dynamics processing func- tions is active in each of three of these segments. In the fourth of these segments the input and output levels are equal: the dynamics processor is not active. 1 . P x < T n . The noise gate is active. In this region the input signal is suppressed and Py ~ PgN “ -oo. in practice we just choose a very high degree of attenuation for P gN , say P gN = -90 dB, which is enough to ensure that the output is muted. 2. T N < P x < T c . Dynamics processing not active. P y = P x and hence P g = 0dB. 3. T c < P x < r L . The compressor is active. In this region the dynamic range of the input level is compressed by the compression ratio R = 2. More precisely, we calculate the output level using Py = T C + (Px - Tc)/* and the gain is given by PgC ~ Py “ Px = T c + (P x - TcP - Px = 7c(1-1/R) + P x (1/R-1) = ST C - S P x = S(T C -P X ). 4. I L < P x . The limiter is active. In this region the output level is set 54 02-2012 elektor DSP COURSE Figure 4. Testing the compressor with a tone burst signal. Figure 5. Operation of the compressor on a music signal. have been attenuated and then overall gain has been applied to compensate) and why the device is called a ‘compressor’. The effect is to increase the perceived loudness of the music: put more technically, the ratio between the peak amplitude and the RMS amplitude has been reduced and so for a given peak output level the signal contains more power. Interested readers can find out a great deal more about this by conducting an internet search for ‘loudness war’: you may be surprised to discover how ubiqui- tous dynamics processing is. Subroutines in the audio loop The DSP program that implements the dynamics processing functions consists of four subroutines called from the audio loop, as shown in Figure 6. The top four subrou- tines comprise the side chain, and the last subroutine comprises the two signal chains. The subroutine Signalconditioning prepares the input signal for the side chain. Here we need to bear in mind that a two- channel dynamics processor for use on ste- reo signals must have only one common side chain, in order to ensure that the com- pressor does not disturb the balance of the signal by applying a different gain to each channel. Forthis reason the side chain is fed by the sum of the two channels. It is possi- ble that doing this could lead the system to miss a peak if the two channels happened to cancel at that point. One way to avoid this would be to take the maximum over the two channels rather than their sum. It is also a good idea, especially when recording from a microphone, to add a switchable high- pass filter to exclude low-frequency signals from the side chain. This feature is called a to the limiter threshold value: P y = T L . The required gain is thus Pgl = T l -P x . Figure 7. Input versus output level and gain with default settings applied. The final applied gain P g is calculated from the three gains given above using the formula P g = min(P gN , P gC , P gL ). The multiplicative factor g that is to be applied to the signal is then given by g = 1 0 (Pg/ 20 ). It can be seen that the output level can only lie in the region -70 dB < P y < -30 dB, giving an overall output dynamic range of 40 dB = T l - T N . So, for example, the dynamics processor can com- press an input range of 90 dB to an output range of 40 dB with its default settings. Figure 7 shows plots of input level P x against output level P y and gain P g . The effect of the output level compensation is to raise these red curves: for example, we can see that the maximum output level Pymax = 0 dB can be obtained by applying an extra output gain of 30 dB, equal to the limiter threshold value. elektor 02-2012 55 DSP COURSE Figure 6. Subroutines and signals in the audio loop. ‘de-esser’ because it helps atten- uate sibilant (‘s’-like) sounds in speech, which are often promi- nent in recordings made with the microphone close to the mouth. The subroutine includes the code to sum the two input channels and halve the result, as well as a switchable high-pass filter with cutoff frequencies of 1 kHz, 2 kHz and 4 kHz. A param- eter is used to enable or disable the filter and to select its cutoff frequency. The subroutine PeakValu- eRectif ier was described in the level meter article previously in this series. In this case we use the peak value rectifier and time- dependent unit on only one channel. The subroutine reads the signal Cond and outputs the signal Rectified. The param- eters Alpha, Beta and Alpha- Beta have the same meanings as in the level meter. The subroutine LevelProces - sor contains the main signal processing functions of the dynamics processor. It can be divided into three stages: • extracting a logarithm to calculate the level P x ; • applying the static characteristic curve by comparing P x against the threshold values T n , T c and T L and thence comput- ing the decibel gain P g ; • computing an antilogarithm to calcu- late the gain factor g from the decibel gain P g . The subroutine takes as its input the sig- nal Rectified and its output is the sig- nal Gain, which represents the gain fac- tor g. There is a total of four parameters called MinusTL, MinusTC, PlusTN and MinusSC, which jointly determine the characteristics of the level processor. The first three of these correspond to the three scaled threshold values T L , T c and T N , while the fourth is related to the compression ratio R by 5= 1-1 /ft. The scalings used in the logarithm calculation were described in the previous article in this series. The logarithm calculation corresponds to that employed in the level meter, the second example DSP application in this series. The computation that implements the response curve is a little trickier. There are three conditions to evaluate first, one for each of the three threshold values that determine the operation of the unit. We will assume in what follows that the thresh- olds are in order T N < T c < T L : this is how the unit will be used in practice. In other words, the threshold for the noise gate is lower than that for the compressor, which is in turn lower than that for the limiter. The incoming level P x is compared against the three values, and three candidate gains are calculated. • Is the input level below the noise gate threshold (P x < T N )? If so, the noise gate is active and the noise gate gain P gN is set to a very high attenuation, such as -90 dB. • Is the input level above the compressor threshold (P x > T c )? If so, the compressor is active and the compressor gain P gC is computed from the threshold value, the input level and the compression ratio. • Is the input level above the limiter threshold (P x > T L )? If so, the limiter is active and the limiter gain P gL is set such that the sum of the gain and the input level is equal to the limiter threshold. In each case, if a particular con- dition is not satisfied the cor- responding gain value is set to zero. The last part of this pro- cess is to take the minimum of the three gain values (that is, the greatest attenuation ratio) that we have calculated. The result, which can be zero if none of the above three conditions is satis- fied, determines the final out- put of the level processor. The last step is to convert the deci- bel gain value to a multiplicative value g , which entails computing an antilogarithm. Here we again use an interpolating polynomial to approximate the exponential function, in the same way as we evaluated the sine and logarithm functions in previous articles in this series. The subroutine GainSmoother accepts the signal Gain as its input and produces the signal SmoothGain as its output. The routine smooths the fluctuations of the gain factor over time. As you might expect, it is not desirable to have the gain value change abruptly (a ‘twitchy finger’ on the mixing desk!). As well as smoothing the value, the subroutine also applies hysteresis with an adjustable threshold: this means that suf- ficiently minor fluctuations in gain value are ignored altogether. The subroutine has two parameters, called Gamma and Delta. These affect the attack and decay response of the smoother. The subroutine DelayAndGain handles the two signal chains. It accepts the signals inL/R and SmoothGain as inputs and pro- duces the output signals OutL/R. There are three stages of processing, each of which is applied to the two channels independently: 56 02-2012 elektor Table 1 . Integer DSP program parameters and their default values DSP program parameter Valid range Word length Alignment Default value HpFilter [0,1, 2, 3] 24 right-aligned 0 Delay [0,1 511] 24 right-aligned 128 HubPlus6dB [0,1 10] 24 right-aligned 4 HubMinus3dB [0,1] 24 right-aligned 0 Table 2 . Fractional DSP program parameters and their default values Parameters and default values DSP program parameters Calculation of DSP program parameters Default values of DSP program parameters T L = -30 dB, T c =-40 dB MinusTL -T l /1 92,6592 0.2076205 T N = -70dB, R=2, MinusTC -T c /1 92,6592 0.1557153 t A = 1 0 ms, t R = 1 00 ms, PlusTN T n /1 92,6592 -0.36333588 n A = 480, n R = 4800 MinusSC 5=1-1 /R 0.5 Alpha a=0,42340/nR)-0,6498440/nA) 0.00036018 Beta P=1-0,42340/nR) 0.00023982 AlphaBeta (X|5=P/a 0.6658 Gamma r 1-exp(-2.2*T/t A ) 0.0046 Delta 8=1-exp(-2.2*T/ t R ) 0.000458 Hysterese value set directly 0.001 • an adjustable signal delay in each signal chain; • dynamic gain adjustment; • final output level adjustment. A circular buffer is used to implement the signal delay, with a maximum configurable delay of 51 2 sample times. At a sample rate of f s = 48 kHz the minimum possible delay is 1 /f s = 20.83 (is and the maximum possi- ble delay is 51 2/f s = 1 0.7 ms. The dynamic gain adjustment stage multiplies the sig- nal by the computed gain factor. The final output level adjustment stage allows any overall gain loss in the dynamics proces- sor to be compensated for in steps of 3 dB. Two parameters control this compensation: HubPlus6dB allows adjustment in eleven steps of 6 dB each, and the parameter Hub- Minus3dB can be used to reduce the gain by an additional 3 dB. Using these two parameters in combination allows any com- pensation in 3 dB steps between 0 dB and 60 dB. For example, if we set HubPlus6dB to 4 and HubMinus3dB to 0 the total gain compensation will be 24 dB; if we set Hub- Plus6dB to 6 and HubMinus3dB to 1 the total gain compensation will be 33 dB. Parameter default values With the default values of the parameters all three parts of the dynamic response can come into play. When the input level is below the value T N = -70dB the noise gate is active; above an input level of T c = -40 dB the compressor comes into operation with a compression ratio of R = 2, and above an input level of T L = -30 dB the limiter operates. To calculate the time constant parameters we go via a couple of inter- mediate values. We start from the sam- ple rate f s = 48 kHz, or the sample period T = 1 / f s . Then for a desired attack time t A we compute n A = round(48000/t A ) and likewise for the decay time t D we compute n D = round(48000/t D ), so that n A and n D represent the times in units of the sample period. For the default values t A = 1 0 ms and t D = 100 ms we obtain n A = 480 and n D = 4800. From these results we can set the DSP parameters. The calculations and the default values themselves are collected in Table 1 and Table 2. Further parameters are used to set the out- put gain compensation and the character- istics of the high-pass filter. The default values of the output gain compensation parameters are HubPlus6dB being equal to 4 and HubMinus3dB being equal to 0, which results in an output gain compensa- tion of 24 dB. Note that as the default value for the limiter threshold is T L = -30 dB, the maximum output level P y is bounded. With the output gain compensation set as above, the maximum value for P y is -6 dBFS, which is achieved when the input is on the point of being overdriven (P x = 0 dBFS). The default parameter setting for the high-pass filter is elektor 02-2012 57 DSP COURSE Table 3 . Testing the dynamics processor Level P x in dBFS -90 -80 -70 -60 -50 -40 -30 -20 -10 0 Level P y in dBFS, output gain 0 dB <-90 <-90 -70 -60 -50 -40 -35 -30 -30 -30 Level P y in dBFS, output gain 24 dB <-90 <-90 -46 -36 -26 -16 -11 -6 -6 -6 Table 4 . Program files required for the dynamics processor DynaProc . asm Main code LogCoef . tab Logarithm approximation polynomial coefficients ExpoCoef . tab Exponential approximation polynomial coefficients Sidechain Filter. tab Side chain filter coefficients src43 92 . tab Byte sequence for configuring the SRC ivt . asm Interrupt vector table entries, audio interrupts esai4r2t . asm Audio interrupt service routine, four input channels and two output channels mioequ . asm Handy names for the DSP I/O addresses for HpFilter to be equal to 0, which disa- bles it. The default signal delay value is for Delay to be equal to 1 28, which results in an overall delay of 1 2 8/f s , or approximately 2.7 ms. Because of the large number of configurable units that make up the dynamics processor there is a grand total of fourteen parame- ters. These include MinusTC and MinusSC, which have a considerable effect on the pro- cessing as well as parameters such as Gamma and Hysterese, which have a more sub- tle effect. Moderate adjustments to these latter parameters will affect the ‘feel’ of the sound rather than having a specific audible effect. There is plenty of room for readers to experiment here: one interesting line to pursue would be to use the FFT function in a waveform editor to investigate the relation- ship between the level of distortion intro- duced by the processor and the signal delay used (parameter Delay). Testing the dynamics processor The best way to test the dynamics pro- cessor is to apply a digital 1 kHz sinewave with an adjustable amplitude to the digital input of the DSP board. We will express the amplitude of the sinewave relative to digi- tal full scale, that is, in dBFS. In the top row of Table 3 we have a range of values for the input signal level P x from -90 dBFS to 0 dBFS in steps of 10 dBFS. The second and third rows of the table show the correspond- ing values of the output level P y : to make things clearer the second row shows the results with an output gain compensation of 0 dB, while the third row gives the results with the default gain of 24 dB. The different dynamic behaviours of the unit are shown by different colours in the table: black for when the noise gate is in operation, blue for the neutral range, green for when the compressor is in action and red for when the limiter comes into play. When the out- put level is zero the actual audible result will depend on the next stage in the system: in some cases a small amount of dither noise is added. The time-dependent unit can be tested using tone bursts, which can be cre- ated using a waveform editor. These signals are also useful fortesting the adjustable sig- nal delay feature. The DSP code and ideas for extending the project Table 4 lists the software components of this project. In addition to files that we have previously used in other projects and test programs in this series, we have the main assembler code file DynaProc . asm, the file LogCoef . tab which contains the pol- ynomial coefficients for the logarithm func- tion approximation, the file ExpoCoef . tab which contains the polynomial coeffi- cients for the exponential function approxi- mation, and the file Sidechain Filter . tab with the coefficients for the switchable high-pass filter in the side chain. Finally, a couple of ideas for taking this pro- ject further. One simple idea would be to allow the output gain compensation to be adjusted in steps of 1 dB rather than 3 dB. Even more user-friendly would be an ‘auto- matic gain’ function that sets this param- eter automatically so that whatever values were chosen for the other parameters, the maximum output level is always P y = 0 dBFS. This can be done by driving the level pro- cessor with a full-scale test signal with P x = 0 dBFS once during initialisation and computing the required gain compensation from the observed output level. With that we bring our DSP course to a close. We hope that you have learned a lot on the way and that the three example applications have given you a glimpse of the range of possibilities that a DSP has to offer. All being well we will be presenting further complete projects based on this DSP board in the near future. (120072) 58 02-2012 elektor LAYOUT *&**""' j ^ wail ^h-pMUom , ir , t ofdcr -^pnnf <* ^.pito-po^ Free Phone UK: 0800 389 8560 sales(?pcb-pool.com All registered brands remain the registered trademarks of the respective manufacturer ! p zadl O&G Atimm U esigner m (ddeiHt G- ' phJGrwja PROTEUS - matwkM • ■ ■ ■ !HITRU*1EHn D RS 274 X Eas-v-PG PUL50NIK www.beta-layout.com Elektor OSPV L Open Source Personal Vehicle Last year we launched the Elektor Wheelie, a self-balancing personal transport device. Our new Elektor OSPV is based on the same concept, but with the difference that it’s for indoors, it’s easy to steer, it’s light and foldable and... it’s open source. You can configure or modify it to suit your wishes! The OSPV is primarily intended for moving people, but it doesn’t have to be limited to that. A variety of other uses are conceivable, ranging from an electric wheelbarrow to a handy motorised shopping cart. This is where the advantages of the open source approach come to the fore! Elektor Important specifications: • Size: 1 20x47x47 cm / 47.2x1 8.5x1 8.5 inch (HxWxD) Weight: 25 kg (25lbs) Maximum load: 90 kg (200 lbs) Motors: DC 2 x 200 W Wheels: Polyurethane, 1 4 cm dia. (5.5 inch) Drive train: HDT toothed belt Max. speed: 1 5 km/h (9.3 mph) Range: 8 km (5 miles) The kit comprises two 200-watt DC drive motors, two 1 2-V lead-acid AGM batteries, battery charger, two wheels Polyurethane 14 cm wheels, casing, control lever and fully assembled and tested control board with sensor board. Further information and ordering at www.elektor.com/ospv REVIEW A Benchmark for Microcontroller Development Kits Putting numbers to ease of use or time wasted Like it or not but microcontrollers, or ‘embedded electronics’ as some like to put it, are hotter than ever. You need a lot of fingers to count all microcontroller (MCU) manufacturers active in the market, and trying to count all their micros is unworkable. In order to get you, the end user, to actually use MCUs, their manufacturers produce all sorts of development and evaluation tools to show off their products and highlight selected features. By Clemens Valens (Elektor France Editorial) It’s not just the chip producers who offer such boards, but also com- ponent distributors, compiler builders, independent developers and companies are doing the same. Hey, even the people at Elektor develop dev kits! The result is a huge amount of tools from which the end user is supposed to pick the one that suits his needs best — an almost impossible job. This is where we at Elektor come in, as we feel we can help end users by reviewing some of those kits. We cannot review them all for sev- eral obvious reasons, but when we come across a kit that seems interesting to us, we will not hesitate to tell you about it. Dev kit manufacturers of course know this and sometimes they try to push their luck a bit by sending us kits that they hope we will review. Therefore, some time ago, I was not surprised when Ernst Krempel- sauer, my Austrian colleague living in Germany and working in the Netherlands, asked me if I was interested in reviewing the TMS570 MCU Development Kit [1 ] from Texas Instruments (Tl). This is a kit for playing with Tl’s TMS570LS2021 6 ARM Cortex-R4F microcon- troller that’s advertised as specially suited for real-time applications. When I looked at the kit as pictured on the product page on the Tl web site I was interested straight away. It is an attractive large main board from Keil with a TFT display on it and many connectors lin- ing the edges. A smaller Tl microcontroller board is plugged onto the main board. When the review sample of the kit arrived, it turned out to be not exactly what I had expected, as it was just a large USB stick [2]. The stick is so large because otherwise the MCU in its 144-pin LQFP package could not be fitted on it. It came in one of those CD/DVD boxes familiar from Tl and besides the stick it contained a mini flash- light, a DVD, a USB extension cable and an installation instruction flyer. The installation instructions were simple: insert the DVD and do a full install. So I did. I wrote down the amount of free disk space before launching the install, and the time: 9:20. More than 30 minutes and 95 (really!) mouse clicks later the installation was complete. Looking at the free disk space left over I noticed that this demo had used a whopping 7 GB! By comparison, my Windows XP Pro folder contains 9 GB. To be totally honest, I did this installation twice. The first time I ran it while trying to do other things, but when the number of mouse clicks and the amazing number of pop-up windows started to bug me I decided to redo the installation and count and measure the Figure 1 . The TMS570 Microcontroller Development Stick kit we sadly have no use for, but maybe you do. For a chance to win it, simply enter our MCU dev kit benchmark prize draw. (Photo: Texas Instruments) above mentioned ‘parameters’. Naturally I now was anxious to see the demos, as well as curious to discover just what a USB stick with a handful of LEDs and a 5 cm 2 MCU on it supported by 7 GB of software, had to offer! Connect- ing the stick to my PC worked fine, it was recognized immediately, 6 o 02-2012 elektor REVIEW ^1 utodhswfc ■ Microsoft VteuaJ C++ Toot* ZDtn i £3 SyriffOtf? ► I Oil || C'.TLl' ■!.!. 1 3 CW6WS&-«-lO.»KS^ * rj f'djj im r (jnjffrx * l-f T^jJiVm t j£3 IK L.H.03,23 * U"ET avwmWei * H$*£.CC - * ) ngpF Lv*i v.l . Si ( rtf F DH fll i • iwHFtoti^.WCOFFCartLJ * 5T5 BEOS 6. 3L. 04, £7 * I t»*tCy MCU '- The Elektor Electronic Toolbox Elektor now offers an App you cannot afford to miss on your iPhone, iPod Touch or iPad. The Elektor Electronic Toolbox is a collection of no fewer than 28 electronic tools that can be picked from a comprehensive set of icons! Highlights: - Databases for Transistors, FETs, Triacs, Thyristors, Diodes and ICs - NE555 circuit design - An Ohms Law calculator - Schematic Diagrams - Number base converter - LED / resistor calculation - R/Land BJT calculations - And more Resislors 471HQ 4 ' kQ Now available from the Apple iTunes Store trjusfs5.99|€4£9i Further information at www.elektor.com /.app elektor 02-2012 65 TEST & MEASUREMENT 230V 50Hz 240V 60Hz Figure 3a and b. Alternative configurations of the CT for different power systems. The CT secondary is hard-wired to a plastic rectifier/surge limiter box I designed for this project. The CT secondary wiring is twisted to minimize stray magnetic fields. The components are mounted on a small piece of prototyping pc board. The secondary current is full-wave rectified by four Schottky diodes, D1 -D4. D5, a 1 N5907 transient voltage suppressor (TVS), limits the CT secondary voltage in case the two-conductor wiring to the load meter burden resistor on the main floor is accidentally opened. The CT is a current source, so the secondary can be safely short- circuited, but it does not like to see an open circuit. The secondary voltage will be multiplied by the turns ratio times the voltage drop in the length of the primary wires inside the core aperture. Since the silicon iron core has a high magnetic permeability, the drop in the primary side is significant at higher loads and the open-circuit secondary voltage could be lethal. The 1 00 nF capacitor (Cl ) filters any voltage spikes that might occur on the CT secondary signal. The 1 .50 Ohms CT load resistor (R1 ) across which the load meter signal is generated is located in the main floor wall plate right at the BNC connector (I modified a standard 75 O F-video jack wall plate). Since this is a low voltage application, code allows us to use an open-back ‘new work’ electrical box inside the wall to mount the wall plate. This BNC jack will not be confused for any other common household signal connector (RCA, F-video, Rj-44 telephone, Ethernet, etc). Measuring I selected a 0-100 mA DC analogue panel meter for our remote power indicator, which I calibrated to show 0-1 00% load from the generator. I used a sloped-front aluminium enclosure for this load meter (see introductory photograph). The enclosure contains a BNC input connector, the load meter and a resistor, R ca |, located directly across the load meter terminals. The load meter is connected to the wall plate by a short BNC cable. Since the CT is a current source, the voltage drop across the full-wave rectifiers and the wiring to the first floor wall plate will not create any error at the load meter. R ca i allows for fine calibration of the load meter to be equivalent to the 2500 W full load from the generator at 1 00 mA full scale. I made use of an EM-100 electronic energy meter to verify the calibration, using two toaster ovens as loads. I used 63.4 £1 for R^i (this is only about a 2% correction... we engineers can get quite tweaky at times). I added red marker to the meter scale in the area above 1 00% to show when the generator is in its surge current- limit mode. The voltage across the 1.50 Q resistor in the wall plate is approximately 233 mV DC at 2800 W. The fixed drop across each rectifier is 300 mV (600 mV total per half-cycle), and the voltage drop across the total of 80 feet (24 meters) AWG-1 6 (1 .3 mm 2 ) interconnect wire is 50 mV. Thus the CT secondary voltage is only 883 mV, or 1 37 mVA at 2800 W. This is well below the 5 VA rating of the CT. The load meter can be disconnected from the wall plate at any time without any adverse effect on the CT, since load resistor R1 is located inside the wall plate. Changes for 240 V 230 V grids In order to make the system suitable for other power systems, I have sketched up two additional configurations, one for a North American 240 V system and one for a European 230 V system. The CT secondary connection remains as shown in Figure 2. The value of load resistor R1 as well as R ca | may have to be adjusted to match the different voltages. Since the North American AC grid has split 1 20/240 V ac lines, the phase currents (shown as h and l 2 in Figure 3a) are not only out- of-phase, but are also likely not equal. As a result, one of the phase wires must enter the CT aperture from the opposing side in order to sum rather than cancel the out-of-phase currents. With the European 230 V AC balanced centre-earth connection (Figure 3b) the h and l 2 currents are always equal and opposite. The CT may be connected like the North American 240 V AC AC power connection in Figure 3a, or alternatively only one of the two power conductors can pass through the CT aperture as shown in Figure 3b. The CT secondary current of Figure 3b will be half that of the Figure 3a connection, so load resistor R1 may have to be increased in order to reach full scale on the percent load meter. (110736) 66 02-2012 elektor MICROPROCESSORS Bit-banging the FTDI-USB Module Taking advantage of little-known features of FTDI’s USB ICs By Don Powrie (USA) This article describes the electrical design and software requirements for a keyless entry control panel comprised of a numeric entry pad, an LCD display, relay contacts for unlocking a door and a USB interface. Even though this writing will delve into the inner workings of FTDI’s FT2232H and its Bit-Bang Mode, understanding the technology will require neither an in-depth knowledge of USB nor the use of a microcontroller! I’ll begin with the assumption that the reader is already somewhat familiar with FTDI’s line of easy-to-use USB ICs before diving into a couple of their lesser-known characteristics. If you haven’t been exposed yet to these devices, then I might suggest boning upon their capabilities and applica- tions by reviewing some of my earlier pub- lications at [1]. Returning to the project, all user software will reside in a single application on the host PC, and the only ICs used in this design are the FT2232H and a couple simple logic gates. The FTDI module used is available for purchase from DigiKey, Mouser Electronics and FTDI’s other distributors. Bit-bang basics Once the USB drivers have been loaded onto the PC and the port is open to the USB module (I used the DLP-USB1 232H to make assembly easier), the Bit-Bang Mode can be enabled. The VC++ source code for this project is available for download from the project webpage [2]. The D2XX command for enabling the Bit-Bang Mode is FT_STA- TUS status = FT_SetBitMode(m_ftHandle, 0x01 , 0x01 ) where the handle is returned from the call to open the port, the second parameter is used to select which of the eight data lines are inputs or outputs and the third parameter is the initial high/low state for the lines configured as outputs. To read the high/low state of the 10 lines that are configured as inputs, you would use the FT_GetBitMode(m_ftHandle, &data) function. The ‘data’ parameter points to the current state of the inputs. The impor- tant thing to keep in mind is that this func- tion returns the instantaneous state of the inputs. Conversely, data that is written to the module (using the FT_Write() func- tion) does not immediately appear on the output pins. Instead, the data appears at a preselected update rate. If the update (or baud) rate is currently set to 9600 and you send multiple bytes of data all at once, then each byte will automatically appear on the output Lines — one at a time — every 1 04 ps until all bytes have been issued. FTDI’s USB chips have always been able to do this. However, with the introduction of their new high-speed chips, the update rate can now be accurately controlled, and up to 8 serial streams can now be generated at precise baud rates to drive serial devices at stable baud rates. For example, the follow- ing code will set the update rate to the baud rate required by the LCD module and the TTL serial interface that I utilized in this project: elektor 02-2012 67 MICROPROCESSORS div = 0x8c3 0 ; //35888 decimal for 19200 baud to LCD with 0.6% error status = FT SetDivisor(m ftHandle, div); Note that the serial data can only be clocked * *out* * at a controlled rate. Unfortunately, no serial reply data can be clocked back in on an input line. You would have to use the second channel of the USB 1C to receive return data; but that’s OK for this project since we are only driving an LCD display (Crystalfontz America part # CFA632-YFB- KS) with TTL serial data, and we don’t care about return data. Now that we have eight controllable I/O lines that can also clock out TTL serial data at controlled baud rates, the platform is set for our project. One 8-bit variable The host app keeps track of all inputs and outputs, including the serial data stream to the LCD, using a single 8-bit variable. To read the high/low state of an 10 line configured as an input, you would call the FT_GetBitMode() function and mask the return variable so that you can look at a single bit. To change the high/low state of an output, you should first update the state of the bit in question in the 8-bit vari- able and then write out the byte. So far so good... but what if you want to send a serial data stream of 200 bytes on +5V Figure 1 . The DLP-USB1 232H module after being suitably bit-banged acts as the controlling element of a code lock. 68 02-2012 elektor MICROPROCESSORS one of the eight I/O lines without affecting the other seven? That’s right; you build a 1 ,600-byte buffer where each byte has only one bit that gets changed according to the next bit that is to be clocked out serially at the next timer tick, and then you send the entire buffer with the FT_Write() function all at once. Tedious? Yes! But computers love doing tedious tasks, and you only have to write the software once for clocking out long serial strings. Figure 2. Component side layout of the circuit board designed for the code lock (here at 80% of its true size). The Gerber files may be downloaded from the Elektor website [2]. Hardware For the following, refer to the electrical schematic shown in Figure 1 . To scan the 1 2 keys in the numeric entry pad using seven of the eight available I/O lines; you just drive the DB4, DB5, DB6 or DB7 ‘row’ lines low (one at a time) and look at the state of the three ‘column’ lines connected to DB1 , DB2 and DB3. If a switch is pressed, then the cor- responding column reports a low level on its I/O input line. DBO controls whether the host is reading the keyboard or driving the LCD display, relay or beeper ‘devices’. When DBO is logic High, the OR gates all block data from driv- ing these devices. When Low, the keyboard is ignored, and data can be written to these devices via DB4 through DB7. By now you have probably surmised that holding a keyboard switch down will dis- able the host’s ability to write to one or more of the devices. You can get around this somewhat by waiting in the host app for each key press to be released before proceeding. There is almost always a way to break a design if you go looking for one, but then this system is designed to keep someone out of a locked area. If they hold a key pressed, then they’re definitely not get- ting in. The Gerber files for making the circuit board for the project may be downloaded free from [2]. The component mounting plan appears in Figure 2. Bit-Bang++...+? At first I was tempted to present a project in which the hardware was comprised of eight TTL serial LCD displays all connected to a host PC using just the eight I/O lines and the Bit-Bang Mode. That would have worked fine, but it really didn’t present much of a challenge. It would also have been more expensive. The Bit-Bang Mode can also be used for more mundane tasks like control- ling eight relays or simple digital I/O. More adventurous types can try controlling mul- tiple SPI devices such as A/D and DACs. I guess the primary take-away from this article is that you don’t necessarily need a microcontroller — and its associated firm- ware development — in order to use the USB interface to control the world around you. The Bit-Bang Mode can be a perfect low-cost solution for systems requiring only host-side software to connect to the envi- ronment outside of a PC. (110561) Internet Links [1] www.dlpdesign.com/pub.shtml [2] www.elektor.com/ 1 10561 Advertisement Take out a free subscription to E-weekly now Do you want to stay up to date with electronics and information technology? Always looking for useful hints, tips and interesting offers? Subscribe now to E-weekly, the free Elektor Newsletter. Huy rfii IjfaJU yiHir hwa i-Jnlml %Aiiinii *■ -ft* 'P-» ■ % P -«wi !*-*■ I" P-PIt Jr-S l¥W ■ *i‘ j-w, PHB'll hrP li-ii- J -rt- ChfiHFM* It DcSHJFl bil ¥ 1 I»t-**4ih 1 1 In* HI Your benefits: The latest news on electronics in your own mailbox each Friday Free access to the News Archive on the Elektor website You’re authorized to post replies and new topics in our forum Register today on www.elektor.com/newsletter elektor 02-2012 69 READERS' PROJECTS ROBBI the Robot A PIC animated robot head By Walter Trojan (Germany) The field of electronics has enormous potential to fascinate young minds and it is not always necessary to splash the cash on expensive games consoles. This project is an example of what can be achieved with very little outlay. It was shortly before Christmas when I got a visit from my grandson. After some excitement about what Santa may be bringing it turned out that what would really please him would be a robot head that could move, blink, and make sounds. Of course if it could detect and follow a light source then so much the better. Before work had even begun his name had been chosen; meet ROBBI. The KISS principle No problem, I thought as I rummaged through a junk box, I can usually find enough in here to at least make a start on a new pro- ject. I found a servo salvaged from an old radio-controlled model, a few other components and a PIC1 2F683. This 8-pin microcontroller has a built-in PWM module which could easily be used to produce ROBBI’s sounds but with just five I/O pins remaining there may not be enough for all the other necessary functions. This was going to be a challenge. For the mechanical design of ROBBI we have stuck to the ‘Keep It Simple, Stupid!’ principle: ROBBI’s head is just a cardboard box fashioned to look like a robot head. Two holes are made at the front for the eyes with LEDs glued in place. Two flat washers and a couple of rubber 0 rings were added for effect (see photo). A small loudspeaker is installed behind the mouth with cut-outs in the cardboard to give vent to the sound. The ‘ear studs’ are photo transistors which detect light sources to the left and right. The servo body is fixed to a wooden board with the servo arm attached to the head. A length of 6-way ribbon cable terminated with a female header (l<2) connects the head electron- ics to the controller board. PIC tricks The complete controller PCB is fitted to the rear of a four cell AAA battery holder which powers the unit. The batteries can either be alkaline primary cells or NiMH rechargeables. Four fresh alkaline cells produces a voltage just slightly too high for the PIC used in this circuit (Figure 1 ). Two series connected 1 N4001 diodes introduces a voltage drop to keep supply below the suggested maximum. For use with NiMH cells (which produce a slightly lower voltage) a jumper at J1 is installed which shorts out the diodes and supplies full battery voltage to the circuit. The PIC microcontroller is clocked from its internal 4 MHz oscillator and uses four I/O signals to control all of the robot head functions: For the majority of the time GPO and GP1 are used as digital outputs to supply 20 mA to the two LED ‘eyes’. Periodically the software reconfigures them as inputs to read the collector voltage of the two phototransistors. When there is very little or no light present the phototransistor will not be conducting so its collector voltage will be the forward voltage drop across the blue LED (2.7 V approx). The relatively high values of resistors R8/R9 and R1 0/R1 1 limit cur- rent through the LEDs to just 0.2 mA so for this short period they will not emit any light. With increasing light levels the phototransistor begins conducting, pulling the voltage at its collector to some point between 2.7 V and 0 V. The two voltage levels are measured by pins GPO and GP1 . The voltage difference is used to control the direction that the head faces. The phototransistor recommended here for T2 and T3 is the BP1 03BF which has good sensitivity and with a daylight filter is ideal for detecting light from a flashlight. GP2 is configured as a PWM output to send audible tones to the speaker. Transistor T1 is a buffer to drive the loudspeaker and resis- tor R3 reduces the sound volume to an acceptable level. GP3 is the reset input with an RC network formed by R2-C2 and activated by pushbutton S2. GP5 drives the servo control input with a pulse every 20 ms. The pulse width can vary from 1 to 2 ms and defines the position of the servo output arm. Note. Readers’ Projects are reproduced based on information supplied by the author(s) only. The use ofElektor style schematics and other illustrations in this article does not imply the project having passed Elektor Labs for replication to verify claimed operation. 70 02-2012 elektor READERS 1 PROJECTS GP4 drives the ‘heartbeat’ LED (LED 1 ) which pulses once a second to simulate ROBBI’s heart. Light and sound ROBBI’s behaviour is all programmed into firmware and took far longer to implement than it did to develop the hardware. In the situ- ation when ROBBI has not detected a light source he enters standby mode with his head moving slowly from left to right, his eyes light- ing up in different sequences and occasionally letting out a squeal. During this mode he is constantly looking for a light source and responds when one is detected by turning his head towards it. The author tackled the software design using a conventional ‘main loop’ together with many sub-routines. Timer 1 is programmed to generate an interrupt every 20 ms, the interrupt service routine takes care of all the active components. The servo arm position is proportional to the width of a pulse sent to the servo every 20 ms. A pulse width of 1 .5 ms moves the servo arm to its centre position. A pulse width of 1 .0 ms drives it to one end of its travel and 2.0 ms drives it to the other. Under software control the LEDs produce five different effects: off, constantly on, slow flashing, fast flashing and sparkle. Likewise for the sound generator there are five effects: sound off, middle- pitched tone (rising quickly), high-pitched tone (falling quickly), high-pitched tone (falling slowly) and low-pitched tone (rising slowly). The tones are produced by re-writing parameters to the PWM reg- ister to continually update the period length. The main loop checks for any light source. When light is detected ROBBI is switched to ‘follow-me’ mode turning his head to the light source and tracking it if it moves. When the light goes out ROBBI turns, blinks and lets out a squeal as described above. The movement sequences are not fixed in the program code but are stored as parameters in a two-dimensional table. Each line contains a description of ROBBIs next set of actions: < Time duration in 20 ms ticks, servo target position, speed, left LED, right LED, sound > As an example: < 200, 1 00, 2, 4, 1 , 3 > The first value indicates a time period of 200 ticks which equates to 200 x 20 ms = 4 s. In this time the servo needs to travel from its current position to the leftmost position (1 00 x 1 0 ps = 1 .0 ms) the next value 2 indicates that each servo pulse width will be reduced by 2 ps (this is a slow movement). The left LED is driven in sparkle mode (effect number 4) and the right LED is continuously on (effect number 1 ). The last parameter indicates a falling high-pitched tone. Once the last line of the action table has been completed the pro- gram loops back to point to the first line again. This movement table makes it easy to alter and experiment with ROBBI’s behaviour. The firmware has been written in Pascal and is approximately 600 lines in length. The Mikroelektronika Pascal pro compiler version 4.6 was used to generate the hex file but the newer version 5.2 should The project consists of a control circuit using a PIC microcontroller together with sensors and a model servo actuator, a loudspeaker, two LEDs and two phototransistors. also compile the code without problems. The size of the resulting hex file is only 1 .5 KB which puts it under the 2.0 KB limit for the free demo version of the compiler. This zero-cost option provides a good introduction to software development, ideal for use by school groups and computer clubs. As usual the source and hex file are available for free download from the Elektor project web page [1 ]. ROBBI can also be seen on the Elektor YouTube channel [2] starring in his own video. And it came to pass... ...that the grandson was pleased with the author’s work and the author was relieved that he had managed to squeeze all the func- tions into the tiny microcontroller. No doubt a bigger microcon- troller would allow interface to more sophisticated peripheral chips like for example the ISD4002 speech chip which would then give ROBBI the power of speech. When my grandson learns of this it will be time to embark on phase 2 of ROBBI’s development. (110078) Internet Links [1 ] www.elektor.com/ 1 1 0078 [2] www.youtube.com/user/ElektorlM elektor 02-2012 71 INFOTAINMENT Hexadoku Puzzle with an electronics touch If you don’t fancy clearing snow, defrosting water pipes, chopping wood or walking the dog, Hexadoku is the perfect excuse to stay indoors. Simply enter the right numbers in the puzzle below. Next, send the ones in the grey boxes to us and you automatically enter the prize draw for one of four Elektor Shop vouchers. Have fun! The instructions for this puzzle are straightforward. Fully geared to electronics fans and programmers, the Hexadoku puzzle employs the hexadecimal range 0 through F. In the diagram composed of 16x16 boxes, enter numbers such that all hexadecimal numbers 0 through F (that’s 0-9 and A-F) occur once only in each row, once Solve Hexadoku and win! Correct solutions received from the entire Elektor readership automati- cally enter a prize draw for one Elektor Shop voucher worth £ 80.00 and three Elektor Shop Vouchers worth £ 40.00 each, which should encourage all Elektor readers to participate. in each column and in each of the 4x4 boxes (marked by the thicker black lines). A number of clues are given in the puzzle and these determine the start situation. Correct entries received enter a draw for a main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. Participate! Before March 1 , 201 2, send your solution (the numbers in the grey boxes) by email, fax or post to Elektor Hexadoku - 1000, Great West Road - Brentford TW8 9HH United Kingdom. Fax (+44) 208 2614447 Email: hexadoku@elektor.com Prize winners The solution of the December 201 1 Hexadoku is: 35C24. The Elektor £80.00 voucher has been awarded to Eugene Stemple (USA). The Elektor £40.00 vouchers have been awarded to Reinhard Rindt (Germany), Arno Habermann (The Netherlands) and Francisco Perez Cortes (Spain). Congratulations everyone! C 1 6 A 4 B E 7 4 5 3 C 6 F 2 4 9 3 1 A 6 E C 8 0 7 9 5 3 4 F 2 0 C i 3 7 9 4 C 6 E F 5 7 1 5 4 8 9 5 A B 0 C 2 3 4 c F 8 4 D 7 C A 1 A 4 6 0 8 4 B 6 2 F 1 D 5 2 c 4 1 B 8 7 E 9 7 0 8 \ 3 [a 9 F 1 D 0 6 8 F 5 7 2 4 C 3 8 1 D F 6 7 3 C A 4 B 0 9 E 5 2 C 2 6 E 5 9 B 1 8 7 D 3 0 A F 4 A 7 4 9 8 0 F 2 1 C E 5 3 6 B D B 3 5 0 E A D 4 F 2 6 9 C 1 7 8 E 8 A D 7 B 6 F 3 5 C 2 4 9 0 1 0 F 7 B 1 2 E D 9 6 4 A 5 3 8 C 1 4 9 2 3 8 C 5 7 B 0 E A F D 6 3 5 C 6 0 4 9 A D 8 F 1 E 7 2 B 9 B 1 3 A C 8 6 0 D 5 7 2 4 E F D 0 2 8 4 F 1 7 E 9 3 6 B 5 C A 4 6 F 5 9 E 0 3 C A 2 B D 8 1 7 7 A E C D 5 2 B 4 F 1 8 6 0 9 3 F 9 3 A B D 4 8 5 E 7 C 1 2 6 0 5 D 8 1 C 6 7 9 2 0 A 4 F B 3 E 2 E B 4 F 1 5 0 6 3 8 D 7 C A 9 6 C 0 7 2 3 A E B 1 9 F 8 D 4 5 The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. 72 02-2012 elektor Elektor Academy Webinars in partnership with element14 Elektor Academy and elements have teamed up to bring you a series of five exclusive webinars covering block- buster projects from recent editions of Elektor magazine. Participation in these webinars is COMPLETELY FREE! All you need to do is register at www.elektor.com/webinars . Webinar Programme: The Making of an Improved Radiation Meter Date: Thursday February 16, 2012 Time: 15:00 GMT (16:00 CET) Presenter: Thijs Beckers (Elektor) This webinar covers the design history and ins and outs of Elektor’s highly successful Improved Radiation Meter published in the November 2011 edition. This low-cost and all do- it-yourself instrument is able to detect different types of radiation like alpha, beta and gamma using ‘sensors’ you never thought of as suitable for this kind of application. You can look forward to a lively and highly topical webinar on a guaranteed ‘experimentalicious’ circuit! Webinar Archive: Now available to view on demand at www.element14.com/webinars Here comes The Elektor Bus! Presenter: Jens Nickel (Elektor) Many Elektor readers have actively participated in designing what’s now known as the Elektor Bus. Elektor editor Jens not only tells the story of how it all came about, but also delve into protocols, bus conflicts and hardware considerations. Let’s Build a Chaos Generator Presenters: Maarten Ambaum and R. Giles Harrison (Reading University) Join us in this webinar to look at the making of the Chaos Generator project published in the September and October 201 1 editions of Elektor. Get out your opamps, wipe your monitor and glasses and turn up the volume loud! E-Blocks, Twitter and the Sailing Club Presenters: Ben Rowland and John Dobson (Matrix Multimedia) E-blocks are small circuit boards containing a block of electronics that you would typically find in an electronic or embedded system. In this webinar Ben and John demonstrate rapid prototyping of an E-Blocks configuration capable of automatically sending Twitter messa- ges to members of a sailing club. Platino - an ultra-versatile platform for AVR microcontroller circuits Presenter: Clemens Valens (Elektor) Many microcontroller applications share a common architecture: an LCD, a few pushbut- tons and some interface circuitry to talk to the real world. Platino offers a flexible through- hole design for such systems based on the popular AVR microcontrollers from Atmel. Platino supports all 28 and 40 pin AVR devices, several types of LCD and has a flexible pushbutton and/or rotary encoder configuration. e I e k r3 ACADEMY the school of electronics elementiu www. element 1 4. com Places are limited. REGISTER NOW at www.elektor.com/webin i RETRONICS Elektor ‘Consonant’ Control Preamplifier (1978) By Jan Buiting (Elektor UK/US Editorial) This month’s story starts at Elektor Live! on November 26, 201 1 and goes back all the way to 1 978. Bear with me. A high ranking Philips official called Henk van Houten got invited to the Elektor Live! event held in Eindhoven, The Netherlands. Mr van Houten, Executive President & General Manager Philips Research duly arrived and actually got a tour of the exhibition floors (‘rings’) Elektor track record spanning a measly five years, was unable to help Henk right there and then by naming the project. When the interview footage was up for editing, two not so high ranking editors, Harry Baggen and myself, started rummaging the Elektor magazine archives to locate the project and enable our cameraman Patrick to insert a running caption showing the proper name and date of publication in Elektor magazine. Harry was successful first — mainly triggered by the mention of a stereo width expander he was able to identify the project as the ‘Consonant’ IMI in the Evoluon building, a pinnacle of technical and architectural innovation in 1966 when Philips ruled Holland in terms of electronics. The building that looks like a flying saucer certainly merits Googling. Slightly unnerving to the two Elektor managers showing Mr van Houten around the event, their guest started to talk real- life electronics like soldering, 2N3055’s and PCB drilling, rather than high brow marketing and commercial lingo. When he got interviewed [1] by Elektor Editor in Chief Wisse Hettinga, Henk turned out to be an avid Elektor reader from the olden days, happily recalling his student days spent building audio and radio projects. At one point in the interview he could not recall the name of ”an old Elektor audio project with a huge PCB like so” [moving hands approx, a foot apart] “it was something to do with stereo width expansion, can’t remember the exact details but it was a great project”. Wisse, normally a confident interviewer but with an control preamplifier from 1978. Normally, that would have concluded the matter but after a short visit to Elektor House’s attic I returned to my desk with a full- blown prototype of the Consonant in my hands. The first thing I noticed was that it was indeed about a foot wide, all because of a large circuit board secured behind the front panel. The unit looked so professional, younger colleagues and passers-by said it was “something Sanyo/Kenwood/Sony from the 80s, no?” Remarkably, the article on the Consonant was published in a Summer Circuits edition of Elektor, all 1 0 pages of it, cheerfully amidst much simpler projects of the “NE555 electronic doorbell” and “shoo-dog” variety typically covering half a page at the most. The name ‘Consonant’ follows a tradition in the 1 970s at Elektor and other electronics publishing houses to give audio equipment names related to music like ‘Crescendo’, ‘Prelude’, ‘Stentor’, ‘Fidelio’ etc. Full marks to the then designers and editors it would appear, but the Retronics is a monthly column covering vintage electronics including legendary Elektor designs. Contributions, suggestions and reguests are welcomed ; please send an email to editor@elektor.com 74 02-2012 elektor RETRONICS name ‘Consonant’ has unexpected deep layers! In terms of music, ‘Consonant’ is desirable as you don’t wantto hear any ‘dissonance’ now do you? As such, the name is highly original and perfectly in line with a fine tradition. There is a hint of a linguistic issue though, the Latin preposition ‘con’ meaning ‘along’, and the verb ‘sonare’, ‘to sound’. Apart from English-speaking readers viewing upon ‘consonant’ as the direct antonym of ‘vowel’ and thus missing the musical context, Grammar School boys might object further that anything ‘sounding along’ with the original sound (like noise, hum, rattle, rumble, DeutscheWelle and what have you) is highly undesirable and a far cry from “high fidelity”. I have to say the 1 978 article is boring straight from the beginning when we are told in very unmusical terms: The principal considerations which governed the design of the Consonant were that: 1. The performance and facilities offered should be comparable with those provided by the best commercial designs. 2. The circuit should be simple to construct and should use readily available components. 3. The controls should be laid out in a clear and logical fashion for ease of operation. On a positive note and using starched language too, you can only “ admit to all of the above reguirements having been satisfied largely if not fully.” Nowhere does Elektor sing its own praises about the project — all descriptions of the excellent performance of the preamp are factual, dryly technical, and in modest terms. Nowhere did I find those horrible woolly terms the audio fraternity have a habit of using when extolling on audio equipment. The circuit diagram probably fell victim to non-technical page layout staff as it looks horizontally crushed on the page compared to the construction drawings and the performance graphs taken with a Bruel & Kjaer recorder (long since gone). The schematic of the Consonant is reproduced here for old time’s sake, along with the specifications. Back to the technology, the stereo width control that started all this gets activated when S4 is closed. A ‘wide’ stereo image was considered desirable at the time and was also used sometimes to “further enhance” older recordings remastered from originally monaural material. Undoubtedly the effect was used at the time to make a cramped room like student’s digs “sound larger”. Today, the effect is popular among young rock bands like Bloc Party and Editors whose guitar riffs seem to sprawl wide from the PA towers and across the field at live gigs. Elektor Consonant specifications Frequency response: Max. output voltage: Nominal output voltage: Signal-to-Noise ratio: Overload margin: Total harmonic distortion: 20 Hz - 50 kHz (+0 dB, -3dB) 3.5V (10V ) rms ' pp' 440 mV rms >72 dB for 440 mV out rms >1 5 dB above 440 mV out rms approx. 0.04% (for 440 mV out) Channel separation: Dynamic range: Output noise level: Filters: Rumble filter: Scratch filter: >50 dB (at 1 kHz) > 90 dB approx. 0.1 mV 60 Hz (-3 dB), 1 2 dB / octave 1 0 kHz (-3 dB), 1 2 dB / octave elektor 02-2012 75 RETRONICS In the Consonant, the left and right channels are linked via R35 and pot P3. The fixed resistor, the article says, joins the emitters of T4 and T4’ and thus effectively converts these two stages into a differential amplifier. The signal appearing at the collector of T4 now represents (L-kR), where k is a constant determined by the circuit parameters. The minus explains the antiphase contribution from the right channel. Likewise the right channel mathematically will consist of (R-/d_). The upshot is that the antiphase signals make the sound from the ‘opposite’ channel appear even further removed in space, creating an impression of image widening so desirable at the time, if only to fool your ears or your impress your guests. Towards the end of the 1970s it was still fashionable to build one’s own audio gear at a fraction of the price of commercial units — and show it off. The terms ‘nerd’ and ‘geek’ did not exist yet, and ‘hobbyist’ had a positive ring. It was also contemporary to have everything on a single PCB including pots and switches, all to avoid cumbersome wires susceptible to picking up noise. One problem lurked though: the pot bodies had to be isolated from the front panel to avoid earth loops. This bit of information was shared with the readers in a lengthy Missing Link published in the February 1 979 edition. The artwork of the huge, single-sided printed circuit board (370 x 90 mm), i.e. the copper track layout and component mounting plan, was printed in the centrefold of the magazine to avoid any risk of vertical misalignment between facing pages not cut from the same folio sheet at the printers. Home PCB etching and drilling was a big thing at that time and many must have gone through the trouble of actually lifting the pages from their precious magazines to enable the PCB track layout to be transferred to copper clad board. The stylish black front fascia designed for the Consonant was also printed but not at full scale as it was impossible to fit even on a spread (double A4 pages). The Consonant shown here worked after restoring two broken solder joints between tantalum caps and the legs of a voltage regulator screwed to the bottom plate. The case also contained the Preconsonant disc player preamp published in the same edition as the Consonant (AbsFab marketing!). I will not be tempted to word the sonic qualities of the Consonant other than saying that its noise contribution is inaudible at all volume levels I consider normal for my living room. I found no need to turn the tone controls from their ‘flat’ positions, so no Baxandallizing for me. The stereo widener I found very artificially sounding and even turned up a little gave me a headache when playing an LP record like Mike Oldfield’s Tubular Bells. These days I have a spacious living room— come to think of it, it’s infinitely larger and wider than in 1 978 when I had none to speak of, and no money either to afford a Consonant. (110718) To celebrate the resurfacing of the Consonant, a scanned copy of the original article from ElektorJuly& August 1978 may be downloaded free of charge [2]. Regrettably parts, circuit boards or tech support are no longer available for the project. Internet References [1] video: ElektorIM (sic) channel on www.youtube.com [2] www.elektor.com/ 1 10718 7 b 02-2012 elektor GERARD’S COLUMNS The Money Dance By Gerard Fonte(USA) Competition There are those that view commerce as a battle to win or lose. We’re the good guys and they’re the bad guys. If we get what we want, we win! It’s just human nature to desire the most for the least. In the short term, that’s good. And, if you’re buying or selling a house, you aren’t likely to get much repeat business (assuming you’re not a builder). So, pushing for every dollar makes sense. But if you are buying or selling lots of somethings, like parts for your product, or your product itself, this attitude is simply wrong. Commerce is a symbiotic relationship. Done properly, both parties benefit to this dance. It’s not win/lose, it’s win/win. You get something you need (product or money) for giving something you have (product or money). That’s what free-enterprise is all about. The important thing here is to be reasonable. Both sides want a good product for a good price. Both sides benefit when there’s a good product sold at a good price. This is another way of saying that there is a balance of needs. The need for a product balances the need for money. When this balance is upset, problems occur. If you demand too high a price for your product, it won’t sell. You just drive your sales to your competitors or people will make due without. This is pretty obvious. If you negotiate too Iowa price for the parts you need to build your product, that’s bad too. But, it’s not as obvious. Suppose you shop around for a part that typically costs $5 (at volume) and you find a manufacturer that sells them for $4. You negotiate real hard and get them to lower their price to $3 for a large volume of parts. That’s good for you. But it’s bad for them. They now have a much lower profit margin and are at risk for financial distress. If other customers find out that they’re selling parts at $3, they’ll want that price, too. That’s more financial stress. If the manufacturer gets into a bad financial situation, they are going to sell their parts to the people that will pay the original $4. And you’ll find that they simply “can’t produce” the volume you need. There’s no utility in getting a great price for a product, if there is no product. And, finally, companies that sell their product too cheaply, generally go out of business. This leaves you without any parts at all. You now have to pay $5 for your components because you drove the $4 vendor out of business. (Note: this is NOT an unusual scenario. Very large volume buyers can and do force some companies to make bad financial decisions that result in bankruptcy. The lure of guaranteed high-volume sales is a difficult temptation to resist.) Lowest Price Of course, if you’re just a buyer for a small company, you generally don’t negotiate price too often, so the lowest price is always the best, isn’t it? The answer is no. There are many factors to consider other than price alone. There’s delivery. If you production line is stopped because you can’t get a part, your company suffers and the company president gets angry. There’s quality. Many times “equivalent” parts are available from different sources (like resistors and capacitors, for example). If one manufacturer has fewer failures, it may be worthwhile to pay extra for that. Improving reliability reduces product returns and may offset the higher initial part cost which saves money in the long run (And, improved reliability makes customers happy and encourages repeat sales). Having multiple sources of parts is always useful. Placing an occasional order for a slightly more expensive part is a kind of insurance in case something happens to your main vendor. Even being an occasional customer carries some influence should a special need arise. And there are intangible reasons to buy something at a higher cost. The manufacturer may be local. The manufacturer may be a customer, as well. There may be some name recognition associated with the particular part (“Intel Inside”). In all of these cases you are buying something for the added cost. If you are getting a good price for these extras, then it’s good for you. Negative Profit The opposite of buying a higher-priced product is to sell one below your cost to manufacture it. Surprisingly, this is fairly common. Stores have special “loss-leader” products at ridiculous prices to get you into the store. They know a certain percentage of people will buy additional products and that will offset their negative profits. And then there are the “free” printers, or telephones, or TV converters that lock you into buying a particular accessory or service. The manufacturers make their money on the continued sales of these high-mark-up items. Overtime, these “free” products can be very expensive. The Bottom Line All of this discussion returns back to the money dance. Every monetary transaction is a give and take — quite literally. You give something and take something in return. You give 40 hours of work to get a paycheck. You spend your paycheck to pay rent or a mortgage, to buy food and clothing and to pay taxes. Money comes in and money goes out. It circulates constantly, as you do on the dance floor. Sometimes you lead and sometimes you follow. It is critical that the partners respect each other and balance each other’s needs. It’s human nature to want to take as much as you can. But it’s not the smart thing to do. And, of course, the larger the scale the more important the balance is. Companies and unions are not really enemies. But when negotiating, both sides naturally want to lead. It often becomes a power struggle, and the symmetry of business is lost (Political parties are not enemies, either). Deliberately trying to unbalance the scales of commerce is like slaying the golden goose. It’s short-sighted, non-productive and ends up being very costly. (120060) elektor 02-2012 77 ELEKTOR SHOWCASE To book your showcase space contact Elektor International Media Tel. 0031 (0) A E 4389444 Fax 0031 (0) 46 4370161 BRITISH AMATEUR ELECTRONICS CLUB ARCHIVE http://baec.tripod.com/ The British Amateur Electronics Club Archive Website. Archives from 1 40+ Newsletters from 1966-2002. Currently have interesting and useful selected articles from 21 Newsletters. Also a section about built electronics projects with schematics and photos. Plus useful info., downloads and links. NO ADVERTS! PIC demo kit • Demonstration • Development • Building block Kit price including LCD £20 or assembled £35 + p&p www.cstech.co.uk/picdemo Open source examples in C and Assembler Includes: PIC16F1827, Temperature sensor, RS232, LCD display, Analogue input, 5V regulator EASYSYNC LTD. www.easysync-ltd.com/ Supplier of communications instrumentation products wi expertise in serial connectivity solutions based on USB, CAN and RS232/RS422/ RS485 interfaces. • USB to Serial RS232/RS422/RS485 converter cables. • CANbus solutions • Ethernet to Serial Adapters or to USB hubs. • USB based Logic Analysers, Oscilloscopes & Data Loggers. • OEM & ODM design services. ELNEC www.elnec.com Europe’s leading device ^ programmers manufacturer: • reliable HW: 3 years warranty for most programmers • support over 65.000 devices • free SW updates • SW release: few times a week • excellent technical support: Algorithms On Request, On Demand SW • all products at stock / fast delivery Technology Transfer Ltd. FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk • Training and Consulting First 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 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 FLEXIPANEL LTD www.flexipanel.com TEAclippers - the smallest PIC programmers in the world, from £20 each: • Per-copy firmware sales • Firmware programming & archiving • In-the-field firmware updates • Protection from design theft by subcontractors FUTURE TECHNOLOGY DEVICES INTERNATIONAL LTD. www.ftdichip.com FTDI specialise in USB silicon, hardware and software solutions. • USB WHQL complaint drivers. • USB host and slave solutions. • Free firmware development tools. • USB IC’s, modules, cables and . turnkey custom solutions. ^ • World renowned FOC application support. USB MADE EASY TO BOOK YOUR SHOWCASE SPACE CONTACT ELEKTOR INTERNATIONAL MEDIA Tel. 0031 (0) 46 4389444 Fax 0031 (0) 46 43701 61 SCOPES and more Instruments A Rohde &Schwarz Company www.hameg.com Great Value in TEST & MEASUREMENT satisfy your inner geek minty geek a fresh approach Coot portable electronic projects and kits www.mintygeek.com WWW. elektor. com 78 02-2012 elektor products and services directory MaxSonar Ultrasonic Range Finder X L-M a xS ona r-EZ * Beam pattern choice * High acoustic power * Real-time calibration * 39.95USD / unit MaxSonar*WRC iP67 * Compact packaging 4 Quality narrow beam * 09.95USD/ unit www .active-ro hot . co. u k www .cool com pon en ts .co .uk www .ocean control s.com . au www.maxbotix.com 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 TO BOOK YOUR SHOWCASE SPACE CONTACT ELEKTOR INTERNATIONAL MEDIA Tel. 0031 (0) 46 4389444 Fax 0031 (0) 46 43701 61 * 4*3 S': ROBOTIQ http://www.robotiq.co.uk Build your own Robot! Fun for the whole family! Now, available in time for X-mas • Arduino Starter Kits *NEW!!* • Lego NXT Mindstorms • Affordable Embedded Linux Boards • Vex Robotics (kits and components) • POB Robots (kits and components) email: sales@robotiq.co.uk Tel: 020 8669 0769 IP for DSP TYDER http://www.tyder.com • ONEoverT Digital Filter Design Software (Full version for only £30) • Design FIRs, HRs, NCOs, FFTs for DSPs and FPGAs • VHDL Code Generators • Makes DSP design simple • Download demos from website mown dsPIC/PIC24-Bundle Advantageous hardware/software solution for rapid project development This solution is perfect for anyone wanting to develop systems based around Microchip’s powerful 16 bit core products. The pack is supplied with a dsPIC30F2011 device, and is fully compatible with the full range of E-block boards and accessories. Datasheets on each individual item are available separately. Contents: • Flowcode 4 for dsPIC/PIC24 (Professional Version) • USB dsPIC/PIC24 Microcontroller Multiprogrammer • LCD Board • LED Board m • Switch Board • Plug top power supply • USB cable Bundle Price: Only £299.00 Order now at www.elektor.com/dspic-bundle 15% DISCOUNT to the sum of the individual parts! elektor 02-2012 79 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES Going Strong A world of electronics from a single shop! Limited Period Offer for Elektor Subscriber 1 5% DISCOUNT eiektpncpmilebrui WWW Using lekto Get going with Verilog Hardware Description Language Microprocessor Design using Verilog HDL If you have the right tools, designing a microprocessor shouldn’t be complicated. The Verilog hardware description language (HDL) is one such tool. It can enable you to depict, simulate, and synthesize an electronic design, and thus increase your productivity by reducing the overall work- load associated with a given project. This book is a practical guide to processor design in the real world. It presents the Verilog HDL in an easily digestible fashion and serves as a thorough introduction about reducing a computer architecture and instruction setto practice. You’re led through the microprocessor design process from the start to finish, and essential topics ranging from writing in Verilog to debugging and testing are laid bare. 340 pages • 978-0-96301 33-5-4* £27.90 • US$45.00 Vanmt Hmp# 0 laM " LaWorX 1 LabWorX: Straight from the Lab to your Brain Mastering the l 2 C Bus Mastering the l 2 C Bus is the first book in the LabWorX collection. It takes you on an exploratory journey of the l 2 C Bus and its applications. Besides the Bus protocol plenty of attention is given to the practical applications and designing a solid system. The most common l 2 C compatible chip classes are covered in detail. Two experi- mentation boards are available that allow for rapid prototype development. These are completed by a USB to l 2 C probe and a software framework to control l 2 C devices from your computer. 248 pages • ISBN 978-0-905705-98-9 £29.50 • US$47.60 □ ■ 0 Utter Talk with your computer Design your own PC Voice Control System This book guides you through practical speech recognition, speech annunciation and control of really useful peripherals. It details a project which will enable you to instruct your computer using your voice and get it to control electrical devices, tell you the time, checkyour share values, get the weather forecast, etc. and speak it all back to you in a natural human voice. If you are interested in the practical techno- logy of interfacing with machines using voice, then this book is your guide! 216 pages • ISBN 978-1-907920-07-3 £29.50 • US$47.60 8 o Prices and item descriptions subject to change. E. & O.E 02-2012 elektor Books Controller Area Network Projects Free mikroC compiler CD-ROM included Controller Area Network Projects The aim of the book is to teach you the basic principles of CAN networks and in addition the development of microcon- troller based projects using the CAN bus. You will learn howto design microcontrol- ler based CAN bus nodes, build a CAN bus, develop high-level programs, and then exchange data in real-time over the bus. You will also learn howto build microcon- troller hardware and interface it to LEDs, LCDs, and A/D converters. 260 pages • ISBN 978-1-907920-04-2 £29.50 • US$47.60 311 Circuits Creative solutions for all areas of electronics 31 1 Circuits 31 1 Circuits is the twelfth volume in Elek- tor’s renowned 30x series. This book con- tains circuits, design ideas, tips and tricks from all areas of electronics: audio & video, computers & microcontrollers, radio, hob- by & modelling, home & garden, power supplies & batteries, test & measurement, software, not forgetting a section ‘miscel- laneous’ for everything that doesn’t fit in one of the other categories. 31 1 Circuits of- fers many complete solutions as well as useful starting points for your own projects. 420 pages • ISBN 978-1-907920-08-0 £29.50 • US$47.60 Design your pwn IT i 1 IT* TZ P T ” " j | l / —r / L. — ■ > Lr J JV -J J. Enhanced second edition: 180 new pages Design your own Embedded Linux Control Centre on a PC The main system described in this book re- uses an old PC, a wireless mains outlet with three switches and one controller, and a USB webcam. All this is linked together by Linux. This book will serve up the basics of setting upa Linuxenvironment- including a software development environment - so it can be used as a control centre. The book will also guide you through the necessary setup and configuration of a Webserver, which will be the interface to your very own home control centre. New edition enhance- ments include details of extending the ca- pabilities of your control center with ports for a mobile phone (for SMS messaging) and the Elektor “thermo snake” for low- cost networked real-time thermal moni- toring of your house and outbuildings. Now you can additionally also send all kinds of useful temperature and sensor warnings to a mobile phone. All software needed will be available at the Elektor website. 41 6 pages • ISBN 978-1-907920-02-8 £34.50 • US$55.70 Y 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: order@elektor.com L u 1 1 0 issues, more than 2,1 00 articles dvd Elektor 1990 through 1999 This DVD-ROM contains the full range of 1990-1 999 volumes (all 1 10 issues) of Elek- tor Electronics magazine (PDF). The more than 2,1 00 separate articles have been clas- sified chronologically by their dates of pub- lication (month/year), but are also listed alphabetically by topic. A comprehensive in- dex enables you to search the entire DVD. ISBN 978-0-905705-76-7 £69.00 • US$111.30 RFID, NFC, Zigbee, GPS and more dvd Wireless Toolbox On this DVD-ROM you’ll find a number of technical documents and tools that will en- able you to add wireless data exchange to your electronics systems. The choice of equipment depends on the transmission distance: a few centimetres using Near Field Communication (NFC) or Radio Frequency Identification (RFID), tens of metres with the Bluetooth, Wi-Fi or ZigBee systems, or indeed thousands of kilometres using a module for receiving GPS data. The DVD contains technical documentation (spec, sheets, application notes, user guides, etc.) on various devices according to the frequency and/or protocol used. All of the documents are PDF files (in English). ISBN 978-90-5381 -268-6 £28.50 • US $46.00 elektor 02-2012 81 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES More than 70,000 components cd Elektor’s Components Database 6 This CD-ROM gives you easy access to de- sign data for over 7,800 ICs, more than 35,600 transistors, FETs, thyristors and tri- acs,justunder25,000diodesand 1 ,800 op- tocouplers. The program package consists of eight databanks covering ICs, transistors, diodes and optocouplers. A further eleven applications cover the calculation of, for ex- ample, zener diode series resistors, voltage regulators, voltage dividers and AMV’s. A colour band decoder is included for deter- mining resistor and inductor values. All da- tabank applications are fully interactive, allowing the userto add, edit and complete component data. ISBN 978-90-5381 -258-7 £24.90 • US $40.20 For alpha, beta and gamma radiation Improved Radiation Meter (November 201 1) This device can be used with different sen- sors to measure gamma and alpha radiation. It is particularly suitable for long-term meas- urements and for examining weakly radio- active samples. The photodiode has a smaller sensitive area than a Geiger-Mtiller tube and so has a lower background count rate, which in turn means that the radia- tion from a small sample is easier to de- tect against the background. A further advantage of a semiconductor sensor is that is offers the possibility of measuring the energy of each particle . -2 regels Kit of parts incl. display and programmed controller Circuits, ideas, tips and tricks from Elektor cd 1001 Circuits This CD-ROM contains more than 1 000 cir- cuits, ideas, tips and tricks from the Sum- mer Circuits issues 2001 -201 0 of Elektor, supplemented with various other small projects, including all circuit diagrams, descriptions, component lists and full- sized layouts. The articles are grouped alphabetically in nine different sections: audio & video, computer & microcontrol- ler, hobby & modelling, home & garden, high frequency, power supply, robotics, test & measurement and of course a sec- tion miscellaneous for everything that didn’t fit in one of the other sections. ISBN 978-1 -907920-06-6 £34.50 • US $55.70 Art.# 11 0538-71 • £35.50 • $57.30 USB Long-Term Weather Logger (September 201 1) This stand-alone data logger displays pressure, temperature and humidity rea- dings generated by l 2 C bus sensors on an LCD panel, and can run for six to eight weeks on three AA batteries. The stored readings can be read out over USB and plotted on a PC using gnuplot. Digital sensor modules keep the hardware sim- ple and no calibration is required. Kit of parts incl. PCB, controller , humidity sensor and air pressure sensor modules Art.# 100888-73 • £31.10 • US$50.20 FT232R USB/ Serial Bridge/BOB (September 201 1) You’ll be surprised first and foremost by the size of this USB/serial converter - no larger than the moulded plug on a USB ca- ble! And you’re also bound to appreciate thatfactthat it’s practical, quickto imple- ment, reusable, and multi-platform - and yet for all that, not too expensive! Maybe you don’t think much of the various com- mercially-available FT232R-based mo- dules. Too expensive, too bulky, badly designed, ... That’s why this project got designed in the form of a breakout board (BOB). PCB, assembled and tested Art.# 11 0553-91 • £12.90 • US$20.90 Audio DSP Course (September 201 1) This DSP board is the platform for the applications described in our Audio DSP Course. It is also intended to enable you to develop your own initial digital audio signal processing applications. The DSP board can be used stand-alone as is, and even though it is an ideal learning plat- form, with its 24-bit signal processing capability for sampling rates up to 1 92 kHz and its high-performance inter- faces, it is also suitable for applications with very stringent quality requirements for both signal to noise ratio and DSP computing power. Populated and tested DSP board Art.# 11 0001 -91 • £115.70 • US$186.70 v y 82 Prices and item descriptions subject to change. E. &O.E 02-2012 elektor V February 201 2 (No. 422) £ US$ + + + Product Shortlist February: See www.elektor.com + + + January 201 2 (No. 421 ) Wideband Lambda Probe Interface 1 1 0363-41 .... Programmed controller ATMEGA8-1 6AU 8.85... ....14.30 Audio DSP Course (7) 1 1 0002-71 .... Printed circuit board partly populated with SMD’s . ...44.50... ....71.80 Grid Frequency Monitor 110461-41 .... Programmed controller AT89C2051-24PU, for 50 HZ areas (Europe) 8.85... ....14.30 110461-42 .... Programmed controller AT89C2051-24PU, for 60 Hz areas (USA) 8.85... ....14.30 Here comes the Bus! (1 1 ) 110258-1 Experimental Node Board 5.30... 8.60 1 1 0258-1 C3 .. 3 pcs Experimental Node Board ...11.50... ....18.60 1 1 0258-91 .... USB/RS485-Converter, ready made module ...22.20... ....35.90 Time / Interval Meter with ATtiny 080876-41 .... Programmed ATtiny231 3 7.70... ....12.60 December 2011 (No. 420) Here comes the Bus! (1 0) 110258-1 Experimental Node board 5.30... 8.60 1 1 0258-1 C3 .. 3 pcs Experimental Node board ...11.50... ....18.60 1 1 0258-91 .... USB/RS485 Converter, ready made module ...22.20... ....35.90 USB Data Logger 110409-1 Printed circuit board 9.75... ....15.70 1 1 0409-41 .... Programmed controller PIC24FJ64GB002-l/sp dil-28s1 3.30... ....21.40 November 2011 (No. 41 9) Improved Radiation Meter 1 1 0538-41 .... Programmed controller ATmega88PA-PU 9.35... ....15.10 110538-71 .... Kit of parts incl. display and programmed controller ...35.50... ....57.30 Simple Bat Detector 110550-1 PCB, bare 8.85... ....14.30 OnCE/JTAG Interface 1 1 0534-91 .... Programmer board, assembled and tested ...35.60... ....57.30 Here comes the Bus! (9) 110258-1 Experimental Node board 5.30... 8.60 1 1 0258-1 C3 .. Printed circuit board 3x print Experimental Node .. ...11.50... ....18.60 1 1 0258-91 .... USB/RS485 Converter, ready made module ...22.20... ....35.90 Dual Linear PSU for Model Aircraft 081064-1 Printed circuit board ...14.50... ....23.80 October 2011 (No. 41 8) Versatile Board for AVR Microcontroller Circuits 100892-1 Printed circuit board ...11.55... ....18.70 Audio DSP Course (4) 1 1 0001-91 .... PCB, populated and tested DSP board 115.70... ..186.70 1 1 0001-92 .... Bundle DSP board (1 1 0001 -92) with Programmer (1 1 0534-91 ) .133.50... ..215.00 Here comes the Bus! (8) 110258-1 Experimental Node board 5.30... 8.60 1 1 0258-1 C3 .. Printed circuit board Experimental Nodes (3 PCBs). ...11.50... ....18.60 1 1 0258-91 .... USB/RS485 Converter, ready made module ...22.20... ....35.90 September 2011 (No. 41 7) eC-Reflow-Mate 100447-91 .... Professional SMT reflow oven 2170. 00. ..3495. 00 USB Long-Term Weather Logger 100888-1 Printed circuit board ...16.00 .. ....25.90 1 00888-41 .... Programmed controller ATMEGA88-20PU 8.85 .. ....14.30 100888-71 ....HH10D humidity sensormodule 7.10... ....11.50 100888-72 .... HP03SA air pressure sensor module 5.75... 9.30 100888-73 .... Kit of parts incl. PCB, controller, humidity sensor and air pressure sensor modules ...31.10... ....50.20 Bestsellers 31 1 Circuits ^ i^RMQ78-i-Qn7Q7n-n8-n r?Q i;n nc<47£n B 2 3 i/> o ! o CO o 5 O Q£ 2 D D U 6 O 4 |sQ 1 2 3 4 5 od V/) 31 1 Circuits ISBN 978-1 -907920-08-0.... £29.50 US $47.60 Controller Area Network Projects ISBN 978-1 -907920-04-2 .... £29.50 US $47.60 Mastering the l 2 C Bus ISBN 978-0-905705-98-9.... £29.50 US $47.60 Design your own PC Voice Control System ISBN 978-1 -907920-07-3 .... £29.50 US $47.60 Linux - PC-based measurement electronics ISBN 978-1 -907920-03-5 .... £29.50 US $47.60 CD 1001 Circuits ISBN 978-1 -907920-06-6.... £34.50 US $55.70 CD Elektor’s Components Database 6 ISBN 978-90-5381 -258-7 .... £24.90 US $40.20 DVD Elektor 2010 ISBN 978-90-5381 -267-9.... £23.50 US $37.90 DVD Elektor 1 990 through 1 999 ISBN 978-0-905705-76-7 .... £69.00 ...US $1 1 1 .30 CD ATM1 8 Collection ISBN 978-0-905705-92-7.... £24.50 US $39.60 Improved Radiation Meter Art. # 1 1 0538-71 £35.50 US $57.30 FT232R USB/Serial Bridge/BOB Art. # 1 1 0553-91 £1 2.90 US $20.90 Audio DSP Board + Programmer Art. # 1 1 0001 -92 £1 33.50 ...US $21 5.00 USB Long-Term Weather Logger Art. # 1 00888-73 £31.10 US $50.20 Here comes the Bus! Art. # 1 1 0258-91 £22.20 US $35.90^ Order quickly and securely through www.elektor.com/shop or use the Order Form near the end of the magazine! Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH • United Kingdom Tel. +44 20 8261 4509 Fax +44 20 8261 4447 Email: order@elektor.com elektor 02-2012 83 COMING ATTRACTIONS NEXT MONTH IN ELEKTOR PC Fan Control To enable all fans inside a PC to be controlled in safe and flexible ways, a circuit was designed that provides extensive capabilities. It allows up to six PWM fans to be controlled simultaneously, with the rotation speed of each fan measured individually by reading its tacho signal. An existing fan control on the PC motherboard (like the CPU cooler) can be used as a signal source for controlling the fans connected. The circuit can operate autono- mously when configured using USB, but it’s also possible to control and monitor it via USB. Software Defined Radio with AVRs Next month we kick off a new series showing how Atmel AVR microprocessors can be used for digital signal processing (DSP). A total of three circuits board gets proposed. The first includes a signal generator based on an ATtiny23i3, the second board contains a complete SDR receiver with display and serial interface, and the third PCB is used to construct an active antenna. In total, more than 20 experiments can be done with these boards. All software was created with the WINAVR GCC Compiler in AVR Studio, and of course it’s available on the Elektor website for your own experiments. LED Touch Panel Today, almost every cellphone or tablet computer has a touchscreen. There are several ways to implement a touch screen, ranging from a resistor array with a plastic film using a capacitive grid etched on to the screen, right up to a camera device that tracks your finger movements. However, there are other touch screens with a configuration you wouldn’t think of straight away. This article describes a touch screen for home or lab construction, with an 8 x 8 matrix of LEDs determining the presence of your finger by alternately trans- mitting and receiving and so determine which LED is covered by the finger. Article titles and magazine contents subject to change; please check the Magazine tab on www.elektor.com Elektor UK/European March 2012 edition: on sale February 7 6, 2012. Elektor USA March 2012 edition: published February 73, 2072. w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektor.com wv Elektor on the web Tg*ljrp All magazine articles back to volume 2000 are available individually in pdf format against e-credits. Article summaries and compo- nent lists (if applicable) can be instantly viewed to help you positively identify an article. Article related items and resources are also shown, including software downloads, hyperlinks, circuit boards, programmed ICs and corrections and updates if applicable. In the Elektor Shop you’ll find all other products sold by the publishers, like CD-ROMs, DVDs, kits, modules, equipment, tools and books. A powerful search function allows you to EAGLE PCB Software I iHna Lj^ari I rldir fcuuKutir. New rcatupcs lor unique i legibility wm > and prod uctivity nq* search for items and references across the entire website. Also on the Elektor website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Time limited offers • FAQ, Author Guidelines and Contact I - Ohc 4 tfi in «ptK \ vi M rattvCttCMi w 4 m 1 “jdJn v Otiii M r-tviii u "it 1 UYr pr=4uc.Vfr" Mtb bI jfuvl Cr-ti H'-I G^tfU-p Nra £14 LNJki .c«tt jlmlAinfi (UltymiH Inpl ft™ wvK'.jLhiil PHI ynii thj *r,;f IH.t ■ptu, i PJnli' it V Wigi-I.rui j DrttH "-CM 1 u £iAMi ulwrri HEW |L*J 4 nr PwJi-nv Diilvncp Ivnirrg Cwrtn * 1 * n Wi p Pi i 4D C SO niKCOUMT fit MitrrcontrclkrSi U,»r.. |Q Atibacribw «nhp v D n i“i H Eivklar 1 ! CompcncnLi □riisbuiE i .’tr4k Ihri.'-i 3 Ll/I r.*, pt^pngl! J All Tbu Manl flw Chrlvljn Loo'aimji t nr Iw.i'r JifcKwl P k jn « ^arr Q ErfUr* y&w EiViwI nMI-csa I I'lmor t-icdu m I a* bujcunCk C! In 2d h-rfutl* In chmfiK 84 02-20i2e lektor Description Price each Qty. Total Order Code Microprocessor Design using Verilog HDL £27.90 31 1 Circuits £29.50 Design your own PC Voice Control System £29.50 Controller Area Network Projects £29.50 LabWorX - Mastering the l 2 C Bus £29.50 CD 1001 Circuits £34.50 Sub-total P&P Prices and item descriptions subject to change. The publishers reserve the right to change prices without prior notification. Prices and item descriptions Total paid shown here supersede those in previous issues. E. & O.E. Name Address + Post code METHOD OF PAYMENT (see reverse before ticking as appropriate) □ Bank transfer | Cheque (UK-resident customers ONLY) n visa □ EUROCARD MasterCard Expiry date: Verification code: Please send this order form to* (see reverse for conditions) Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com order@elektor.com Tel. Email Date Signature EL02 *USA and Canada residents should use $ prices, and send the order form to: Elektor US 4 Park Street Vernon CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: order@elektor.com Yes, I am taking out an annual subscription to Elektor and receive the E-book Microcontroller Basics totally free! (Please fill in your emailaddress below) I would like: Standard Subscription (1 1 issues) I I Subscription-Plus (1 1 issues plus the Elektor Volume 201 1 DVD-ROM + exclusive access to www.elektor-plus.com ) * Offer available to Subscribers who have not held a subscription to Elektor during the last 12 months. Offer subject to availability. See reverse for rates and conditions. METHOD OF PAYMENT (see reverse before ticking as appropriate) □ Bank transfer j Cheque (UK-resident customers ONLY) n visa □ EUROCARD MasterCard Expiry date: Verification code: Please send this order form to Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www. e I e kto r. co m service@elektor.com ORDERING INSTRUCTIONS, P&P CHARGES All orders, except for subscriptions (for which see below), must be sent BY POST or FAX to our Brentford address using the Order Form overleaf. Online ordering: www.elektor.com/shop Readers in the USA and Canada should send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Elektor US for applicable P&P charges. Please allow 4-6 weeks for delivery. Orders placed on our Brentford office must include P&P charges (Priority or Standard) as follows: Europe: £6.00 (Standard) or £7.00 (Priority) Outside Europe: £9.00 (Standard) or £1 1 .00 (Priority) HOW TO PAY All orders must be accompanied by the full payment, including postage and packing charges as stated above or advised by Customer Services staff. Bank transfer into account no. 4027021 1 held by Elektor International Media BV with The Royal Bank of Scotland, London. IBAN: GB96 ABNA 4050 3040 2702 1 1 . BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. GCredit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in this magazine. If difficulties in the supply of components are envisaged, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not guaran- tee this time scale for all orders. Returns Faulty goods or goods sent in error may be returned for replacement or refund, but not before obtaining our consent. All goods returned should be packed securely in a padded bag or box, enclosing a covering letter stating the dispatch note number. If the goods are returned because of a mistake on our part, we will refund the return postage. Damaged goods Claims for damaged goods must be received at our Brentford office within 10-days (UK); 14-days (Europe) or 21 -days (all other countries). Cancelled orders All cancelled orders will be subject to a 1 0% handling charge with a minimum charge of £5.00. Patents Patent protection may exist in respect of circuits, devices, components, and so on, described in our books and magazines. Elektor does not accept responsi- bility or liability for failing to identify such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, diskettes and software carriers published in our books and magazines (other than in third-party adver- tisements) are copyright and may not be reproduced or transmitted in any form or by any means, including photocopying and recording, in whole or in part, without the prior permission of Elektor in writing. Such written permission must also be obtained before any part of these publications is stored in a retrieval system of any nature. Notwithstanding the above, printed-circuit boards may be produced for private and personal use without prior permission. Limitation of liability Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in connexion with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser any money paid in respect of the goods. Law Any question relating to the supply of goods and services by Elektor shall be determined in all respects by the laws of England. January 2012 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION United Kingdom & Ireland Standard £54.00 Plus £66.50 Surface Mail Rest of the World £68.50 £81.00 Airmail Rest of the World £86.00 £98.50 USA & Canada | Seewww.elektor.com/usaforspecialoffers | HOW TO PAY Bank transfer into account no. 4027021 1 held by Elektor International Media BV with The Royal Bank of Scotland, London. IBAN: GB96 ABNA 4050 3040 2702 1 1 . BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident cus- tomers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. SUBSCRIPTION CONDITIONS The standard subscription order period is twelve months. If a permanent change of address during the subscription period means that copies have to be despatched by a more expensive service, no extra charge will be made. Conversely, no refund will be made, nor expiry date extended, if a change of address allows the use of a cheaper service. Student applications, which qualify for a 20% (twenty per cent) reduction in current rates, must be supported by evidence of studentship signed by the head of the college, school or university faculty. A standard Student Subscription costs £43.20, a Student Subscription-Plus costs £55.70 (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 2012 :::c355‘* '3::a:cc atctcccc ccceecec :ccc:ccf fcgccccc i B ^ \r= ;::ccct ‘C8CCCC 3f aoaacc JCfl8C3CC CCCC3G5 3 id 3 C C 3 G C 3 2Jekt « ■ i 1 * J — „ ps«£s& - ! W + 1& I m 'ektor ~ &4 Confident reading: on paper * Contemporao, & innovate reartnn - on PC, notebook or fabtet “ 9 Read Elektor with the cut-rate PLUS subscription! Subscribe now or upgrade: www.elektor.com/subs W - WITH PROTEUS PCS DESIGN Our completely new manual router makes placing tracks quick and intuitive. During track placement the route will follow the mouse wherever possible and will intelligently move around obstacles while obeying the design rules. All versions of Proteus also include an integrated world class shape based auto-router as standard. PROTEUS DESIGN SUITE Features: ■ Hardware Accelerated Performance. ■ Board Autoplacement & Gateswap Optimiser. ■ Unique Thru-View™ Board Transparency. ■ Direct CADCAM, ODB++, IDF & PDF Output. . Over 35k Schematic & PCB library parts. ■ Integrated 3D Viewer with 3DS and DXF export. ■ Integrated Shape Based Auto-router. ■ Mixed Mode SPICE Simulation Engine. ■ Flexible Design Rule Management. ■ Co-Simulation of PIC, AVR, 8051 and ARM7. ■ Polygonal and Split Power Plane Support. ■ Direct Technical Support at no additional cost. Prices start from just £150 exc. VAT & delivery www.labcenter.com 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