www.elektor-magazine.com magazine July & August 2013 | £ 7.90 PROJECT GENERATOR EDITION X-TREME INRUSH CURRENT LIMITER ANDROID ELEKTOR CARDIO- SCOPE PACKED WITH NEW SMARTPHONE A/v REMOTE CONTROL 9 770268 451 968 AMBIENCE LIGHTING CONTROLLER IC3 (c> ELEKTOR 110188-1 70 cms WIDEBAND FM EXCITER The world's first digitally enhanced power analog controller New analog-based power management controller with integrated microcontroller POWER OtfiG-F r-Ty Crioi •*1*5 ff Microchip MCPiqih Digitally Enhanced Power Analog ■ u AV Microchi iti c ] MCPS7XXX mosfet Combine the flexibility and l 2 C communication of digital DC/DC power conversion, with the speed, performance and resolution of analog-based control, by using Microchip's new MCP19111 power management controller. The MCP19111 is a new hybrid, mixed-signal controller which combines analog and digital power management into a single chip. By integrating an analog-based PWM controller, a Flash-based 8-bit PIC® microcontroller, and MOSFET drivers for synchronous, step-down applications, the MCP19111 enables configurable, high-efficiency power conversion. With transient performance of analog power conversion, the MCP19111 eliminates the need for a high-MIPS microcontroller or a high-speed A/D converter, minimising solution costand power consumption. To support even higher efficiency, the MCP19111 can be used to drive Microchip's latest MCP87xxx high-speed, SMPS-optimised MOSFETs. These logic-level 25V MOSFETs offer a low Figure of Merit (FOM) with on-state resistance from 1.8 mO to 13 mO to deliver higher DC/DC power conversion efficiency. GET STARTED IN 3 EASY STEPS: 1. Evaluate the MCP19111 using the low-cost ADM00397 board 2. Combine with SMPS-optimised MCP87xxx MOSFETs 3. Customise DC/DC conversion to match your application For more information, go to: www.microchip.com/get/eumcp19111 Q Microchip Microcontrollers • Digital Signal Controllers • Analog • Memory • Wireless The Microchip name and logo, and MPLAB are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. All other trademarks mentioned herein are the property of their respective companies. ©2013 MicrochipTechnology Inc. All rights reserved. DS25169A. ME1058Eng02.13 THINK DISPLAY DESIGN IS DIFFICULT? n FTDI Chip Unparalleled Value in Embedded Display Technology • Complex graphics made easy • Elimination of expensive frame buffer memory • Object orientated design methodology • Allows low cost uC WATCH EVE DEMOS ONLINE Bs£B See how easy display development can be with EVE, visit www.ftdichip.com Contents Project Generator 8 Android ElektorCardi^fscope ( 1 ) Wireless, button-free: Bluetooth & touch screen 18 Step Exercises A stepper motor driver for the ElektorBus 26 Wideband 70-cms FM Exciter with 130 mW output power 34 Smartphone A/V Remote Control Transmitter plus App for Android devices 42 Ambience Lighting Controller Setting the mood with RGB LEDs 48 PWM Step Up Converter Get up, stand up... 52 Charge-a-Phone on NiMH with the Elektor USB Power Pack 56 Big Amps DC Motor Driver 58 X-Treme Inrush Current Limiter A controlled start for Big Electrolytics & Co. 62 Acoustic Spirit Level / Tilt Alarm An ATtiny45 design with many uses 64 2-Wire Interface 3.0 A new approach to an earlier problem 68 Accurate Universal Measure- ment Interface Accuracy— quite simply 70 Solar-Powered Night Light with Li-ion Backup Solar energy powers an LED in night time hours 72 CDI Ignition For Spartamet and Saxonette mopeds Better spark— better mpg for a two stroke motor 74 Simple Servo Tester Basic test gear for modelers 76 Slow-Start Stabilizer Clean supply voltage but with a delay 78 8x Relays— and Much More Expansion modules for Linux and other controller boards 82 Store it Quickly 2.0 A new approach to an earlier problem 4 | July & August 2013 | www.elektor-magazine.com Volume 39 No. 439 & 440 July & August 2013 84 Another Look at Some Speci- fic Points of the 500 ppm LCR Meter The luxury of precision within everyone's reach 90 Spot the Difference Arduino Uno vs. GR Sakura FULL 92 Wideband Wien Oscillator with Single-Gang Pot Avoiding the costly and rare 2-gang log pot 94 4 Amps Photovoltaic Charge Controller Designed front to end for minimum losses between PV panel and battery 96 Starting a Schematic Design Neil Gruending's second article on getting started with DesignSpark Labs 98 Celebrate! 5 Kmembers on elektor-labs.com 99 SMD Desoldering Tip Bend some copper wire in shape • Industry 100 Professional PCB Manufacturing How your four-layer PCB gets produced at Elektor PCB Service 106 News & New Products • Tech the Future 110 Care Robots The future of health care • Magazine 114 Retronics Philips PR9150/PR9151 Surface Roughness Testers Series Editor: Jan Buiting 120 Hexadoku Elektor's monthly puzzle with an electronics touch 122 Gerard's Columns: Penny Wise and Pound Foolish A column or two from our columnist Gerard Fonte 130 Next month in Elektor A sneak preview of articles on the Elektor publication schedule www.elektor-magazine.com | July & August 2013 | 5 Community Volume 39, Number 438, June 2013 ISSN 1757-0875 Publishers: Elektor International Media, 78 York Street, London W1H 1DP, United Kingdom. Tel. +44 (0)20 7692 8344 www.elektor.com The magazine is available from newsagents, bookshops and electronics retail outlets, or by membership. Elektor is published 10 times a year with a double issue for Januan/ & Februan/ and July & August. Memberships: Elektor International Media, 78 York Street, London W1H 1DP, United Kingdom. Tel. +44 (0)20 7692 8344 Internet: www.elektor.com/member Email: service@elektor.com Head Office: Elektor International Media b.v. P.O. Box 11 6114 ZG Susteren The Netherlands. Telephone: +31 (0)46 4389444 Fax: +31 (0)46 4370161 Distribution: Seymour, 2 East Poultry Street, London EC1A, England. Telephone:+44 (0)20 7429 4073 UK Advertising: Elektor International Media b.v. P.O. Box 11 6114 ZG Susteren The Netherlands. Telephone: +31 (0)46 43 89 444 Fax: +31 (0)46 43 70 161 Email: j.dijk@elektor.com Internet: www.elektor.com/advertising Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photographs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software carriers and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopying, scanning and recording, in whole or in part without prior written permission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may exist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publisher to alter the text and design, and to use the contents in other Elektor International Media publications and activities. The Publishers cannot guarantee to return any material submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2013 Printed in the Netherlands A Case for Boards Looking at our readers' main interests, PCB design and production rank pretty high. Elektor PCBs are famous the world over not just for their quality, but also their consistent look and feel. How did that come about? Here at Elektor, the change from manual artwork design using masking tape and pho- tographic reproduction techniques to a 100 % PC-driven process was gradual, and took place in the early 1990s. The use of a PC to draw a schematic and then run a PCB design program was not forced or even suggested by the publishers at the time. Back then, some of the younger lab designers boldly set out to discover the advantages of the PC route, eventually supplying files instead of drawings to their colleagues in the PCB design department. Oth- ers stuck to pencil, paper and rubber with equally good results particularly in RF and space critical designs. No matter how the final artwork got produced, Elektor never actually mass-produced their circuit boards— this was always farmed out to PCB manufacturers. We did, however, handle the storage and packaging of what must have amounted to hundreds of thousands of those blue and green boards. Also, to this day Elektor Labs have their own PCB etching and drilling facilities. The equipment is used to make prototypes and one-offs of any board, single or double sided, TH or SMD. I do recall the excitement in the lab and editorial offices about 20 years ago when a parcel arrived containing 500 or so boards for a recently published project. At last, the proud designer was able to see the fruit of his design efforts. More importantly however, readers all over the world were able to construct circuits on superbly produced circuit boards with a component overlay and silk screen finish! Today, there is still the satisfaction not only of publishing these wonderful designs and getting response from you, but also of holding a perfectly machined printed circuit board with an Elektor production number printed to aid identification. Jan Buiting, Managing Editor 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, Tim Uiterwijk, Clemens Valens, Jan Visser Raoul Morreau Giel Dols, Jeanine Opreij, Mart Schroijen Danielle Mertens Don Akkermans 6 July & August 2013 www.elektor-magazine.com Our network United Kingdom Wisse Hettinga +31 ( 0)46 4389428 w.hettinga@elektor.com USA Hugo Vanhaecke + 1 860 - 875-2199 h.vanhaecke@elektor.com Germany Ferdinand te Walvaart +49 241 88 909-17 f.tewalvaart@elektor.de ■ France Denis Meyer +31 46 4389435 d.meyer@elektor.fr Netherlands Harry Baggen +31 46 4389429 h.baggen@elektor.nl Spain Eduardo Corral +34 91 101 93 95 e.corral@elektor.es Italy Maurizio del Corso +39 2.66504755 m.delcorso@inware.it Sweden Wisse Hettinga +31 46 4389428 w.hettinga@elektor.com i Brazil Joao Martins +55 11 4195 0363 joao.martins@editorialbolina.com Portugal Joao Martins +351 21413-1600 joao.martins@editorialbolina.com India Sunil D. Malekar +91 9833168815 ts@elektor.in Russia Nataliya Melnikova +7 ( 965 ) 395 33 36 Elektor. Russia@gmail.com Turkey Zeynep Koksal +90 532 277 48 26 zkoksal@beti.com.tr South Africa Johan Dijk +31 6 1589 4245 j.dijk@elektor.com China Cees Baay +86 21 6445 2811 CeesBaay@gmail.com Connects you to Supporting Companies ARM ARM , Inc www. arm. com/ds5 41 FTDI www.ftdichip.com 3 Audi oXpr ess www. audioama teur. com 113 Intelligent Soc s.l. www. soclutions. com 75 Beta Layout www.pcb-pool. com 33 Labcenter www. labcenter. com. 132 # k'yii&Ti'V.: Amenta Crystalfontz www. crystalfontz. com 77 ^Microchip Microchip www.microchip.com/get/eumcpl9111 ... .2 Customer Computer Service www.ccsinfo.com/elektor . . . 121 picu Pico Technology www. pi cotech. com/PS21 8 131 Earth Computer Technologies www.earthlcd.com/ezlcd-304 25 RF Consultant www. rf-consultant. com 47 Elprotroriic Elprotronic www. elprotronic. com 77 Schaeffer AG www. schaeffer-ag. de. 75 ElTliiXli-, inc Ed i*’*!" .t EMAC www.emacinc.com/panel_pc/ppc_e4+.htm. . 83 53 TctfPiwtoErc 3 Technologic Systems www.embeddedarm. com/ad. php?ad=42 . . 66 Eurocircuits www. elektorpcbservice. com 89 WIZnet www. wiznettechnology. com 17 Not a supporting company yet? Contact Johan Dijk (j.dijk@elektor.com, +27 78 2330 694) to reserve your own space for the next edition of our members' magazine www.elektor-magazine.com July & August 2013 7 •Projects Android Eiektorcardivscope Wireless, button-free: Bluetooth & touch screen The title says it all— this article describes an electrocardioscope you can build your- self, using an Android tablet or smartphone as a wireless terminal for viewing the electrocardiograms. The project involves skillfully combining a small PIC interface to control an analog input stage with a great deal of software. 8 July & August 2013 www.elektor-magazine.com Cardioscope Technical Specifications • Interface for Android phones or tablets with Bluetooth • Simultaneous or individual scrolling display of the three standard leads (DI, DII, and Dill) and the three enhanced leads (aVR, aVL, and aVF) • Adapts automatically to screen resolution • Measures and displays cardiac rhythm • Audible heartbeat indication • Scrolling speeds: 250/125/62.5 and 31.25 pixels per second • Display gain: xl xl.2 xl.5 x2 x3 and xlO • Full-scale sensitivity: 3.2 mV. 10-bit conversion • Sampling frequency: 2 kHz Common-mode rejection: > 100 dB Max. contact voltage: ± 150 mV Auto-adaptive alignment time constant Frequency response: 0.005 Hz to 170 Hz Dynamic trace memory: 10 minutes ECG recording in flash memory (10 min) Periodic injection of 1 mV/2 Hz calibration signal Powered by 2 no. 1.5 V primary or 1.2 V rechargeable cells Constant display of battery voltage Current consumption: 50 mA (standby: <4 |JA) Battery life: 15 hours (1 Ah cells) Inexpensive When Elektor published an electrocardioscope based on a GameBoy games console back in 2006, the little Android robot didn't yet exist— or was at an embryonic stage at most. Seven years on, a vast number of applications are using it; at the time of publication, there are over 900 million Android devices in circulation. Each day, new horizons are opening up for the little green fellow. Elektor is happy to be contrib- uting to this saga that's only just beginning with an application that's instructive, fascinating, and potentially useful to everyone: perform your own www.elektor-magazine.com | July & August 2013 9 •Projects Figure 1. Correspondence between the electrical activity detected and the phase of a cardiac cycle. L R ventricular contraction 120107 - 12 electrocardiograms on your smartphone or tablet! This physiological exploratory accessory consists of a single (very small) board 5.5 x 10 cm (2.2 x 4 inches) carrying the analog and digital sections of the circuit. Our ECG interface is available in The computing part is quite substantial, so we don't intend going through the source code in detail; but to encourage you to approach it, cus- tomize it, or even improve it, we're going to be describing the software functions. To help us do this, you'll find the identifiers used in the dia- grams in the source code. The complete MPLAB and Android project files are available on the Elektor website. Medical imaging and electronics The Elektor electrocardioscope makes use of the process invented by Willem Einthoven (see Elek- tor October 2006 [1]), which involves exploring cardiac function using the image of the elec- trical phenomena produced during the cardiac cycle. The heart is an autonomous muscle— the only one not controlled by the brain. The sinus node, located in the right-hand atrium, triggers the nerve impulses that control the heart mus- cles. These contract (depolarization) and relax (polarization) to pump the blood. The contraction is caused by a change in the electrical polarity of the cell membranes. During the relaxation Record and view your own electrocardiograms on your smartphone or tablet! the form of a ready-to-use module to which you just have to add four electrodes and an Android application for smartphone or tablet; there's no physical connection between this terminal and the interface, as it uses Bluetooth communica- tion! As you'd expect for a modern device, this one has only very few adjustments (three pre- sets in all) or controls (3 buttons). Clearly, it's the software that does all the work. We're going to be describing it in at least two articles: • the electronics: our favorite field, • the program running on the PIC24 microcon- troller, written in C under MPLAB (free IDE and compiler from Microchip), • the Android application, written in Java using Google's SDK, • building the interface, to be fitted in a small case the size of a smartphone. phases, the electrical charges are balanced again before a new stimulus comes along. The resulting potentials are transmitted as far as the surface of the skin, where they can be detected using skin electrodes. With appropriate positioning of these electrodes, a cardiologist is able to deduce the mechanical behavior (and possible dysfunctioning!) of the heart by analyzing its electrical activity [2]. Figure 1 shows the relationship between the electrical activity detected and the phase of a cardiac cycle: • P wave: contraction of the atria: the blood from the veins is forced into the ventricles. • QRS complex: contraction of the ventricles: the blood from the ventricles is driven into the arteries. These two waves are what cause the "lub- dub" sound of the heartbeat. 10 | July & August 2013 www.elektor-magazine.com Cardioscope • T wave: repolarization of the ventricles: the ventricle muscles go back to their resting state. The positions of the four electrodes, one on each wrist and ankle, are shown in Figure 2, which also describes the leads displayed by the device. The limb leads are positioned on the inner face of the wrists and ankles. They explore the car- diac field in a frontal plane (Figures 2a & 2b). These three leads form Einthoven's equilateral triangle, the polarities being such that DIII=DII- DI. Replotting the DI, DII, and Dill axes to the center of the triangle makes it possible to con- struct a system of co-ordinates (known as Bai- ley's hexaxial system), which is useful in calcu- lating the activation vector in the frontal plane (Figure 2c). The six leads represent the cardiac activity according to these six axes. Analyzing them makes it possible to establish a diagnosis. The three active electrodes LA (Left Arm), RA (Right Arm), and LL (Left Leg) detect the DI and DII leads; the fourth, RL, is used to set the qui- escent voltage of the other three. The interface electronics amplify the emfs picked up by leads I and II to produce the DI and II signals needed to produce electrocardiograms. These voltages are converted into digital quan- tities before being transmitted via Bluetooth to the Android terminal. The application calculates the missing leads (Dill, aVR, aVL, and aVF) from DI and DII (formulae in Figure 2b) and displays these. The screenshots illustrating this article leave us in no doubt whatsoever: the signals are excellent and the noise low, as are residual powerline frequency components. Analog electronics The analog section of our ECG has the task of amplifying the two very weak voltages picked up between, on the one hand, active electrodes LA and RA, and LL and RA on the other. These are the DI and DII leads (Figure 2). To obtain adequate dynamic range after the 10-bit A/D conversion, we need a gain of 1,000 (i.e. 60 dB). This is combined with two other essential func- tions: compensation for the electrodes' DC con- tact voltages (which can exceed 100 mV, i.e. 100 times the amplitude of the wanted signals) and rejecting the powerline frequency (60 Hz or 50 Hz). We'll come back to this later. Figure 2a. Standard bipolar leads. Figure 2b. Standard unipolar leads or enhanced leads. Figure 2c. Co-ordinates system used for calculating the leads. The human body and the electrode connecting leads are considerably influenced by the strong voltages or voltage differences with respect to ground on the electrical wiring of the surround- www.elektor-magazine.com | July & August 2013 11 •Projects Fl: R18, 19, 20, 23, Dl, D2 F2: IC9 F3.1: IC4A - IC4B, R53, 54, 55 F3.2: IC3A - IC3B, R57, 58, 56, P3 F4.1: IC5A, R49, 40, 47, 50, PI F4.2: IC6A, R51, 39, 48, 52, P2 F5.1: IC10, R35, 36 C23, R25, 26, 27, 28, IC5B, C25 F5.2 : ICU, R37, 38 C24, R29, 30, 31, 32, IC6B, C26 F6.1: IC8A, R46, 44, 45, 33 C30, C29, C21 F6.2: IC8B, R41, 42, 43, 34 C28, C27, C22 F7: R62, 59, 60, 61 F8: IC7A, C17, R24 CAL Al Bl Dl Dll All Bll Figure 3. ing space. Despite the 60 / 50 Hz frequency, Function diagram of the mutual capacitance, even though it is very low, analog section. causes a relatively high voltage (often over 1 V) to be present on the skin with respect to ground. At first sight, it would seem difficult to isolate the wanted signal, as its amplitude is 1,000 times lower than that of the spurious signal! What's more, the frequency of 60 / 50 Hz falls within the wanted spectrum; so filtering is no use. Given the wavelength at 50 Hz (6,000 km!), we can accept that, as the skin is conductive, every point on the epidermis is at the same voltage as all the others. Thus as far as the electrodes are concerned, this is a common-mode voltage. In this case, the solution becomes obvious: a dif- ferential instrumentation amplifier with an adequate common-mode rejection ration (CMRR): CMRR > ECG \ dB + s_ N dB where S P is the amplitude of the spurious sig- nal: 1 V; S ECG is the ECG amplitude: 1 mV; S/N is the signal-to-noise ratio: 40 dB required. i.e. CMRR > 60+40 = 100 dB In addition, the amplifier needs to have very high input impedance (>10 Mft) and low offset volt- age. It's very tempting to use a specialized inte- grated circuit for this (e.g. the ADS1294 from TI). But it is also possible, without any concessions in terms of quality, to build a differential ampli- fier using standard TLC2252 operational amplifi- ers (op-amps), a low-power rail-to-rail type (for dynamic range) with low noise. Its cut-off fre- quency and slew rate are only modest— but more than enough for an ECG signal. The major (but acceptable) concession in this choice is the pre- set resistor to optimize the CMRR, which cannot be dispensed with. Functions of the analog section Before looking in detail at the ECG interface cir- cuit, let's examine its structure (Figure 3) and functions. The four electrodes are connected to the inputs RA (right arm), LA (left arm), LL (left leg), and RL (right leg). As the electrocardiograph is sometimes use in conjunction with a defibril- lator, it needs to be protected against the high voltages produced by this type of device: this is the job of function Fl. Under normal conditions, this function's output voltages are equal to its input voltages. The protection only comes into operation if the voltages measured exceed the level of the supply rails, i.e. ±3.3 V. The multiplexing function F2 lets us replace the RA, LA, and LL signals by a P2HZ calibration sig- nal with an amplitude of 1 mV and a frequency of 2 Hz. The multiplexer is activated on request once a minute for 10 s in order to observe the calibration signal on the screen. When estab- lishing a diagnosis, the calibration signal gives an amplitude reference for the ECGs measured. The instrumentation amplifier is formed by func- tions F3 and F4. Function F6 is a 2 nd order low- pass filter with a characteristic frequency of 170 Hz and damping factor m = 0.71 (Butter- worth). This attenuates all the components out- side the wanted frequency spectrum and serves as an anti-aliasing filter for the following ADC (Analog/Digital Converter). The overall gain is obtained as follows: AD3 = 21x, AD4 = lx, and A6 = 49x. The gain ref- erence corresponds to the reference of the func- tions: AD3 is the differential amplifier of F3 (F3.1 or F3.2), and so on. In line with our objectives, the total gain is 1029x. The gain in the first two stages is relatively low in order to increase the effectiveness of the auto-zero function. The other functions (F5, F7, and F8) support the instrumentation amplifier to ensure proper opera- 12 | July & August 2013 www.elektor-magazine.com Cardioscope tion. The operational amplifiers are powered at between -3.3 V and +3.3 V. The ideal quiescent voltage for each of their three terminals is 0 V. The RL electrode sets the average voltage (qui- escent point) for the active electrodes via func- tions F7 and F8. It is shown that the F7 output voltage is equal to the average of the RA, LA, and LL voltages. This is compared by F8 with the 0 V set point, and the amplified error voltage produces the voltage of the RL electrode. As no current flows in the electrodes, the RA, LA, and LL voltages are equal to that on RL (to within a few mV). In this way, we create a real servo loop through the skin: the average of the active electrode voltages is maintained equal to the set point of 0 V. That's what we were aiming for: the input amplifiers' quiescent voltages are correct, without impairing their intrinsic input impedance. In addition, a natural but highly inconvenient phenomenon appears when the electrodes are fitted: a contact emf is generated between the skin and the metal of the electrode. This micro- battery is very weak (a few tens of mV) but is not eliminated by the instrumentation amplifier. Quite the reverse: it is amplified! Functions F7 and F8 partially reduce this phe- nomenon, but the offsets between the + and - outputs of F3.1 and F3.2 can still reach several volts. These offsets are compensated by func- tions F5.1 and F5.2, to avoid saturation in the F4.1, F4.2, F6.1, and F6.2 stages. Figure 4a. F5.1 and F5.2 compare the average values of Analog schematic. www.elektor-magazine.com | July & August 2013 13 •Projects Figure 4b. Digital and power supply schematic. K2 MCLR +3V3 GND EMUD1 EMUC1 NC R1 .J- SI n RESET . HSMC-A461-V00M1 C3 R2 CAL /“ /“ to analog schematic Dll J L3 LL LL O cr LU 12 < 3 30R@100MHz 5 o CL 30R@100MHz * HSMC-A461-V00M1 P2HZ 10 12 VDD VDD MCLR |C1 RB15/RP15/AN9 RB0/PGD1/EMUD1/RP0 RB14/PMWR/RP14/AN10 RB1/PGC1/EMUC1/RP1 RB2/RP2/SDA2/AN4 RB3/RP3/SCL2/AN5 RB4/RP4/PMBE RB13/PMRD/RP13/AN11 RB12/PMD0/RP12/AN12 RB11/PMD1/RP11/TMS RB10/PMD2/RP10/TDI RB9/PMD3/SDA1/RP9/TDO PIC24FJ32GA002 RA0/AN0 RB8/PMD4/SCL1/RP8/TCK RA1/AN1 26 25 BII 24 All 23 STATUS 22 BI 21 AI RA2/CLKI/OSCI RA3/CLKO/OSCO/PMAO RA4/T1CK/PMA1 DISVREG VSS RB7/PMD5/INT0/RP7 RB6/PMD6/ASCL1/RP6 RB5/PMD7/RP5/ASDA1 VSS VCAP/VDDCORE 19 lOu I 6V3 I lOOn I • 25V \ 18 \ txN 17 RX 16 RESET 15 14 SETBAUD 8 27 lOu 6V3 R9 lk RIO lk Rll 15 11 VCC MODI PI02 SPLMOSI PCMJN SPI_CLK PCMOUT SPI MISO UART_TX SPLCSB PI05 UART^RX PI03 RN42 RESET USB_D- PI06 USB_D+ PI07 PCM CLK UART CTS PCM SYNC UART RTS PI04 O «H o o o Z Z O O O <0.0. o o o o O. CL < 12 28 n j S3 N RESET BT the SI and SII signals with a fixed reference. The error voltage is integrated using a time constant selected using AI and BI (All and BII respectively for the II channel) to derive the DC offset volt- age applied to F4.1 and F4.2. This offset is found on SI and SII. The servo loop thus formed con- stantly maintains the average values of SI and SII at their respective set points. Heart of the circuit You'll easily be able to find all these function on the diagram for the analog circuit (Figure 4a). The four electrodes are connected to Kl. Resistors R18, R19, R20, R23, and the integrated diodes in D1 and D2 form the FI protection function. The multiplexing function F2 is performed by the analog multiplexer IC9 (4053). The differential amplification for each channel (F3 and F4) is achieved using the classic instru- mentation amplifier configuration: F3.1 = IC4A + IC4B and F3.2 = IC3A + IC3B, along with F4.1 = IC5A and F4.2 = IC6A. The DII channel gain is adjustable by P3 to com- pensate for the difference from the other chan- nel. Even a small difference in gain would have a noticeable effect on the calculations for the other leads. Presets PI and P2 let us optimize the common- mode rejection for each amplifier. The F4 stages include a negative feedback loop via (in the DI channel, for example) multiplexer IC10, one of the resistors R25-R28 and op-amp IC5B wired as an integrator. This structure performs the F5.1 function and acts on the average voltage of DI via IC5A in such a way as to make it equal to the voltage set by the divider R35/R36 (and R37/R38 respectively for the DII channel). The time-constant for this loop is selected by a software function driving the multiplexer IC10 (and IC11 in the other channel) via the AI and BI signals: 14 | July & August 2013 www.elektor-magazine.com Cardioscope • T1 = R28-C25 = 0.47 s • T2 = R27-C25 = 2.2 s • T3 = R26-C25 = 10 s • T4= R25-C25 = 47 s When the electrodes are applied, the shortest time-constant is selected so as to reach the qui- escent point quickly. The time-constant is then increased as the anticipated quiescent point is approached, ending up at the value of 47 s, which will not interfere with the ECG signals. The quiescent voltages are different between the DI and DII channels in order to be suitable for the forms expected for each lead, thereby avoiding saturation in the following ADC while maintain- ing adequate dynamic range. The final stage in each channel (IC8a and b) forms a 2 nd -order low-pass filter. This has a cut-off frequency of 170 Hz and in-band gain of 34 dB. This is an anti-aliasing filter for the ADC, which uses a 2 kHz sampling frequency. This is followed by a l st -order low-pass filter formed by R33 and C21 with a cut-off frequency of 160 Hz. The attenuation of these two filters at the Nyquist frequency (1 kHz) is around 15 dB. Did you notice IC8 is powered between +3V3 and 0 V and not between +3V3 and -3V3 like the other op-amps? This is not a mistake: this arrangement protects the PIC24's analog input, which can't take negative voltages. Because of its high sensitivity, the analog sec- tion is very sensitive to interference of all kinds, in particular that produced by the digital section and the switch-mode power supply. The circuit layout has been carefully designed to keep these three sections well away from each other. In addi- tion to this, the networks R63/C32 and R64/C31 attenuate the residual ripple on the supply rails to the analog section. For the digital part of the circuit, the diagram (Figure 4b) is clear enough, we'll dispense with a block diagram. PIC24FJ32GA002 Out of Microchip's PIC24 variants, we've chosen the PIC24FJ32GA002, an entry-level type in a 28-pin SOIC package (Figure 4b). Its 8 MHz internal clock (no external components required) gives a power of 4 MIPS and 2 % accuracy, ade- quate for this application. At this frequency, the consumption of around 5.4 mA is reasonable for battery powering. RN-42 Bluetooth module The Roving Networks RN-42 (Figure 4b) is a compact, low-power, pre-qualified class 2 hybrid OEM Bluetooth module. (Roving Networks were recently acquired by Microchip, Ed.) The built-in antenna allows a range of about 70 feet (20 m). It supports, among others, the RFCOMM-SPP pro- tocol used in this application, at data rates up to 240 Kb/s. Here, we only use 16 Kb/s. The Serial Port Profile (SPP) makes it easy to establish a sort of wireless duplex asynchronous serial link. The RX and TX signals from the micro- controller's UART coupler are simply connected to their equivalents on the Bluetooth module. In this way, the sequences produced on TX in the asynchronous serial format are transferred trans- parently to the connected terminal. Conversely, messages sent from the Android terminal appear in the same format on RX. A few additional signals are used to control the module: the STATUS signal indicates the status of the Bluetooth link: Connected (1) or Broken (0) the RESET input allows the module to be initial- ized if necessary the PI07 input (SETBAUD) lets us select the transmission data rate: • 1 -► 9600 baud, • 0 -► 115.2 Kbaud The 1 kft resistors in series with these signals are in accordance with the manufacturer's I/O protection recommendations. LED D4 flashes to indicates the module status: 10 Hz: configuration in progress 2 Hz: initialization phase 1 Hz: the module can be identified steady: connection established. Powering For such a simple circuit, the structure of the power supply (Figure 4b) comprising IC13, IC12, Figure 4c. Photo of the Roving Networks (now Microchip) Bluetooth module used. www.elektor-magazine.com | July & August 2013 15 •Projects A project to your heart's content and IC2 is fairly complex, but it does guaran- tee a stabilized symmetrical voltage (±3.3 V) right down to the last drop of power available in the two 1.5 V AA cells or the pair of 1.2 V rechargeables. It is out of the question to power this sort of device from the powerline! MOS transistor Tl, associated with step-up device IC13, protects the electronics in the event of reversed battery polarity: R6 limits the current through IC13, Tl is turned off along with its inter- nal diode. The battery -ve is not connected to interface is well and truly powered down. The only consumption is that of IC13 and IC12 in standby, i.e. less than 4 pA. Pressing S2 takes IC13's /SHDN input high. Its GATE output turns Tl on with a voltage that is three times its supply voltage, thanks to an internal tripler. This makes it possible to drasti- cally reduce Tl's R 0N - The battery -ve is con- nected to GND. IC13's GDR output also goes high and enables IC12. This then produces the +3V3 voltage from the battery voltage. Inverter IC2 is now powered and in turn supplies the -3V3 rail. The interface is powered. The microcontroller then starts processing and must quickly follow the user's pressing S2 by setting the /PowerOff signal to High (1). Powering down is controlled from the Android terminal when the user exits the application: the /PowerOff signal is set to L. IC13 then goes into shutdown and sets its GDR output to 0 to inhibit IC12 and hence cut the power. The switching converters used make it possible to obtain an overall efficiency of nearly 90 % and will operate (but not for long) with low batteries down to 0.8 V. In the next issue of Elektor, we'll be present- ing the software, the Android application, and the board, together with how to implement the device. You'll see it's amazingly easy. 120107 GND and the ICs are protected, in particular IC12. When the polarity is correct, IC13 is powered cor- rectly. It is controlled by the microcontroller's / PowerOff signal. If the interface is powered down, the PIC24 is not powered and cannot apply a H to /PowerOff. Hence the /SHDN input is low, par- ticularly because of R14. IC13's GATE output is then low and Tl is turned off. However, its fly- back diode is conducting (the current consumed flows to GND via the battery -ve) and IC12 is powered. Under these conditions, IC13's GRD output is at 0, inhibiting the switching converter IC12, which as a result does not generate the 3V3 supply voltage. Hence inverter IC2 that sup- plies the -3V3 downstream doesn't operate. The Internet Links [1] GBECG article in Elektor October 2006, www. elektor.com/050280 [2] Course in cardiology: http://goo.gl/mSr20 [3] www.elektor.com/120107 [4] Android Apps, programming step by step, Stephan Schwark, www.elektor.com/android [5] Le Site du Zero www.siteduzero.com/informatique/tutoriels/ apprenez-a-programmer-en-java or http://goo.gl/OVZQY (in French) [6] author's own website: http://electronique. marcel.free.fr/ (in French) 16 | July & August 2013 www.elektor-magazine.com Embedded Connectivity Solution from WIZnet WIZnet’s patented Hardware TCP/IP technology has proven effectively in millions of net- work-enabled devices around the world, allowing users to easily add Ethernet connectivity to the devices with greater stability to ensure faster product release out to the market. Hardware TCP/IP Offload Technology - No TCP/IP S/W Stack Required - Small Memory Footprint - High Performance & Simple Design - Highly Secure against any attack - Live on Power-up - Best fit to OS-less Devices Applications - Remote Monitoring & Control - POS Terminal - Surveillance System Serial to Ethernet Module - Vending Machine - Security System - Meter Reading - Printer Hardware TCP/IP Chip iMCU (Internet MCU) Device Server - LED Display Board - Light Control - HVAC Control Drop-in Network Module Wizdrd of Embedded Networking For more information visit www.wiznettechnology.com sales_team@wiznettechnology.com •Projects Step Exercises By Ronald stN-e/ •Projects the other direction until the other switch is actu- ated. The number of steps between these two positions is recorded. The library function Step- perMotorCali brati on ( ) can now determine in which direction the motor turns in response to the direction signal being set low or high, and again this information is recorded. Once calibrated the motor can be moved to a given desired position within its range of move- ment using a value from 0 to 1023, which rep- resent the end positions. For example, the call StepperMotor_GotoMotorPosition(0, 512, 4); causes the motor to move to its mid-position at a rate of approximately 4 ms per step. Naturally we would like to be able to control the motor over the ElektorBus. It is easy enough to write an HTML control panel that runs in the ElektorBus browser on the PC, and as usual the same user interface can also be run on an Android smartphone or tablet [8] [9] . The HTML file can be found in the directory UIBus, and it can sim- ply be dragged from the download directory to the desktop. The rest of the procedure will be familiar: launch ElektorBusBrowser.exe, select the correct COM port, click on 'Connect' and fire up the scheduler. The HTML buttons cause Ele- COMPONENT LIST Resistors (default shape: 0805) R1 = 0 ft R2,R12,R15 = 39kft R3 = 680ft R4 = 100ft R5,R23 = lOOkft R6-R11 = 1.0ft (Vishay CRCW25121R00FKEG) R13,R19,R20 = lOkft R14 = 10ft R16,R18 = Oft (see text box) R17,R21 = not fitted (see text box) R22 = 120ft R24,R25 = lOkft, optional (see text box) R26 = 4.7kft PI = lOkft trimpot (POT4MM-2) R8 R 7 R 6 CIO R12 Cll R15 Rll R10 R9 R1 □ 41 • • • • K2 C • K3 C Stepper Motor • • • • K 6 [ K8 C Ref. □ A'2 A1 B2 B1 /£- ^ i : : : : : c? i C5 1 Ini 1 In2 IC2 + - Supply Motor K1 R4 R5 E D3 R17 • R1 6 • R18 4 4 ZC D2 • I Cl 5 R21 1 Cl 6 C8 R2 XI D4 R25 K 11 D5 • 1 — . PI R2^ • •— 1 o (J JPl :9 1 , n i CM 1 IDEI 1 1 1 S 1| • • I C6 IC3 • • • • CL CO C4 vo CM a IC1 ■o LI C3 I R13 JP2 0 Cl XI Cl 2 Cl 3 R3 I LED1 D1 L -i T1 14 D 6 C2 • • l— I I Cl 8 • Cl 8 SI ElektorBus (c) Elektor SMC VI .0 120509-1 www.mci.edu BUS B K5~ K4 K9 K7 Capacitors (default shape: 0805) Cl = 68pF 10V tantalum (AVX TPSB686K010R0600) C2 = 470pF 35V electrolytic (Panasonic EEEFK1V471AQ) C3,C5,C8,C12 = lOnF C4 = lOOOpF 50V electrolytic (Panasonic EEVFK1H102M) C6 = 68nF C7 = 220nF C9 = 5.6nF CIO, Cll = InF C13,C14,C17 = lOpF 6.3V (AVX TCJA106M006R0300) C15,C16 = lOOnF C18,C19 = 22pF Inductors LI = 47pH (744773147) Semiconductors D1 = B160-13-F, Schottky diode 1A / 60V D2,D3,D6 = Diode 1N4148 D4,D5 = BZX384-B5V1 5.1V zener diode T1 = BC849B, SOT-23 LED1 = LED, green (5988270107F) IC1 = LM2675M-5.0 IC2 = L6208D (S024) IC3 = ATmega328P-AU IC4 = LT1785CS8 Miscellaneous JP1 = 6-pin (2x3) pinheader, 0.1" pitch JP2,JP3 = pinheader, SIL, 0.1" pitch K1-K9 = PCB screw terminal block, 0.2" Rell = relay, SPDT, Omron G5LA145DC SI = pushbutton, Omron B3S-1000 XI = 16MHz quartz crystal, 50ppm, 16pF, Epson Toyocom FA-365 PCB 120509-1 24 | July & August 2013 www.elektor-magazine.com Stepper Motor Driver ktorBus messages to be sent from the PC to the stepper motor board, and the desired motor posi- tion can be sent as a 10-bit value on channel 0. In the firmware the ElektorBus library receives these messages and calls the function Process- PartQ. This processes the incoming message parts and then causes the motor to move the the desired position. As always this demonstration software is intended as motivation for further experimentation. A prac- tical application might be the automatic control of a roller or Venetian blind to maintain the level of ambient lighting in a room. We have previ- ously described hardware and software for an ElektorBus-based light sensor [6] [ 10] . In the next issue we will take things further with the long-awaited Xmega web server board, which also features an RS-485 interface and which will make an ideal basis for further ElektorBus applications. (120509) Internet Links [1] www.mci.edu [2] www.elektor.com/120509 [3] www.st.com/st-web-ui/static/active/en/ resource/technical/document/datasheet/ CD00002294.pdf [4] www.elektor.com/110258 [5] www.elektor.com/elektorbus [6] www.elektor.com/120668 [7] www.elektor.com/130154 [8] www.elektor.com/110405 [9] www.elektor.com/120097 [10] www.elektor.com/110428 Advertisement Supe r ^s vAtpIgWq ramM | T ^ret^ckagedi witht fonts^ jmages| macros, and [widgets We geeked out, so you don’thave to. Extensiveidocunientatiomlibrarv Smai1; v powenulj&^F0RD ABLE ! Optionalmanel=mountJbezel www.elektor-magazine.com | July & August 2013 25 •Projects Wideband 70-cms FM Exciter With 130 mW output power r & 1*6 ftVftit ii’* it* « - - tf KyM k * l 3 TP6«fc- Blldl IA - K m - - - - ■ ‘1 1 * * • By Sjef Verhoeven, PE5PVB (The Netherlands) Most amateur radio transmitters are not actually designed for transmitting wideband audio signals with high fidelity. However, the wideband 70-cms (430- 440 MHz) FM exciter described here is up to the task, with an audio bandwidth of 20 Hz to 100 kHz. Technical Data • Frequency range 430-440 MHz in 25 kHz steps • Audio bandwidth 20 Hz to 100 kHz • PLL lock time less than 1 s • Supply voltage 12-15 V • Current consumption approx. 250 mA at 130 mW RF output power Just about everyone has played with walkie- talkies at some time. They're nice for wireless conversations, but radio links of this sort suffer from poor sound quality and the fact that only one person at a time can talk. Licensed radio amateurs ('hams') have been communicating in this manner since the early days. With the right choice of equipment, frequency and antenna, radio amateurs can connect to each other all over the world in various ways. But what options are there if you want to estab- lish a connection with good sound quality? In this article we describe the design of a complete broadband FM audio exciter for the 430-440 MHz section of the 70 cms band (in the US, the band extends from 420-450 MHz). The output signal is not unlike you find in the VHF FM broadcast band, which means that the audio bandwidth is 26 | July & August 2013 www.elektor-magazine.com FM Exciter approximately 20 Hz to 100 kHz. Thanks to this large audio bandwidth, it is fairly easy to set up audio chat sessions with several transmitters and relatively low distortion. This is similar to Team- speak or other chat tools, but without jitter, codec distortion, echo and delay. With the right anten- nas, antenna height and possibly an amplifier, you can easily make QSO's (connections) over a distance of tens of miles, or even as much as 200 miles under the right weather conditions. An amateur radio license of the appropriate class is needed to operate this exciter. You can obtain this license from the relevant national or local authori- ties after passing a technical exam. The aim of this is to prove that you have sufficient theoretical knowledge to be able to operate radio transmit- ting equipment safely, in compliance with statu- tory provisions, and without causing interference. Among other things, this means that using this exciter as a transmitter to broadcast music for any- one who wants to listen is not permitted. The tech- nical exams for amateur radio licenses are usu- ally administered several times a year in various places. In many countries, volunteers provide ham radio training. In the US, see www.arrl.org/licens- ing-education-training. In the UK, http://rsgb.org/ main/faq/how-to-become-a-radio-amateur-faq/. You can use a scanner or a receiver with wideband FM capability to receive the signal. A downcon- verter, which converts the 430-440 MHz band to a different band such as 90-100 MHz, is often used for this purpose. This allows you to use an ordinary FM radio to listen to the signal. Schematic We opted for a Colpitts oscillator to generate the RF signal for the exciter. It is built around a dual- gate MOSFET (T2). This oscillator operates at the transmit frequency. In a Colpitts oscillator, the frequency is determined by a parallel resonant circuit consisting of a capacitive voltage divider and a coil. In this case capacitors C23 and C25 form the voltage divider and L4 is the coil. The coil consists of a short piece of thin coax cable, which essentially works the same way as a strip- line. Modulation due to mechanical vibration can be largely avoided by using relatively flexible cable, such as RG174. Feedback is necessary to make the circuit oscillate, and this is provided by resistor R25. Many Colpitts oscillator circuits use direct feedback without a resistor, but practical Construction Tips • Power the exciter from a clean supply voltage. Some switch-mode power supplies have frequency components on the output voltage that are directly audible as noise or whistles. A conventional power supply is always the best choice. • Use only ceramic capacitors, even for values above 1 pF. • Most resistor and capacitor packages are 0805, but a few are 1206. • If you make your own PCB, ensure that it has enough vias. This is particularly important in and around the RF section. • Use inductors without ferrite cores. This is especially important in the oscillator stage, since ferrite is a known cause of noise. • Fit the entire circuit in a sheet metal enclosure. The PCB layout is designed with standardized dimensions. • First prepare the sheet metal enclosure (holes for DC, audio and RF connectors). Then place the bare board in the enclosure and solder it all around on both sides. Fit the components only after the board has been fully mounted in the enclosure. www.elektor-magazine.com | July & August 2013 27 •Projects Figure 1. Schematic of the main circuit board with the microcontroller and RF section. 28 | July & August 2013 www.elektor-magazine.com FM Exciter experience shows that a bit of resistance makes the circuit more stable, with a cleaner frequency. Trimmer TR2 is provided to allow the oscillator to be adjusted to the desired frequency range. Diodes D3 and D4 are varicaps driven by a control voltage. This allows the frequency to be tuned electrically over a range of approximately 30 MHz. Since this is an FM exciter, we need to be able to modulate the frequency of the carrier signal according to the amplitude and frequency of the audio signal. This is done with the aid of varicap diode D2. Varying the voltage on this diode affects the capacitance of the LC circuit, which causes a frequency deviation. To keep the modulation as linear as possible, we opted to use differ- ent varicap diodes for tuning and modulation. To avoid excessive differences in modulation depth between low and high frequencies, the modula- tion varicap is biased by a high-impedance volt- age divider consisting of Rll and R12, with C12 added to improve stability. Inductor LI prevents excessive capacitive load from the modulation circuit, which could otherwise cause the oscilla- tor to stop working. Capacitor C14 provides HF decoupling for the modulation input and addi- tionally ensures that the upstream part of the modulation path does not affect the resonant frequency of the oscillator circuit. Finally, compo- nents C5, R4, R7, R8 and R9 provide (defeatable) pre-emphasis. If necessary, you can increase the value of R8 as desired to reduce the pre-empha- sis attenuation. The design is dimensioned for a pre-emphasis of 50 ps. A buffer stage at the output of the oscillator, which is also implemented using a dual-gate MOSFET (T3), keeps the loading of the oscilla- tor output as uniform as possible to maintain the stability of the RF signal. The RF signal, at a power level of approximately 1 mW, is attenuated slightly to provide a good match to the next amplifier stage. In recent years the market has been flooded with a large vari- ety of monolithic microwave integrated circuits (MMICs). These devices are specifically designed to amplify signals in the microwave frequency range. The main advantage of these ICs is that they make it easy to amplify RF signals without using tuned circuits. This avoids additional cir- cuit complexity, cuts down on board space, and considerably reduces the cost of the overall cir- LCDl 2x16 5 9 O O co O j in oHNn'tinosLULU >>>cco;lijqqqqqqciq_j_i CO Q IS CO Q _l CO I +5V si X -OiO- X C52 lOOn C53 lOOn C51 lOOn *"1 °°| ®| S| —r~ K1 3 LED2 LOCK oooooooooo OOOOOOOOOO ROTARY ENCODER 6 +5V +5V O R49 LED3 PWR 120267 - 12 cuit. For our design we chose MMICs from Avago Technologies, in part because they are a good fit with the circuit and in part because it's important to choose MMICs that are readily available. The first MMIC (IC3, type ADA4743) amplifies the RF signal to about 40 mW. This signal is attenuated and then fed to an MGA31189 (IC2). This MMIC has a rated output power of 250 mW. However, in this circuit we limit the supply voltage of IC2 to a maximum of 4.2 V (provided by the com- bination of T4 and T5), so the output power is a good deal lower— about 120 to 130 mW. This is a nice power level for driving a final amplifier, which in many cases will be an RF power module. Figure 2. The operator control section includes a rotary encoder and a 2xl6-character LCD module. A phase locked loop (PLL) is used here to set the desired frequency and keep it tuned precisely. This involves passing the transmit frequency through a frequency divider and comparing the output signal with a reference signal. If there is any difference, a control voltage tries to adjust the frequency to reduce the difference until the divided-down RF signal and the reference signal are in phase. In our circuit this control voltage is applied to varicap diodes (D3 and D4) after fil- tering by a loop filter. The loop filter is essential and must be dimensioned to keep the PLL from responding too fast. This is because the oscillator is frequency modulated, so the frequency var- ies according to the applied audio signal. If the PLL responds too fast, the sound quality of the www.elektor-magazine.com | July & August 2013 29 •Projects Figure 3. The main PCB has components fitted on both sides. modulated signal will be affected. It is therefore important to find a good balance between maxi- mum bandwidth (approximately 180 kHz) and fre- quency stability. In this circuit we use an SP5511 orTSA5511 (IC1) for the PLL. These devices are readily available and affordable. These PLL ICs were originally intended to be used in TV tuners (including satellite tuners). They are often seen in older-model television, video recorder or sat- ellite tuners. The smallest frequency increment this PLL can generate is 50 kHz with a 3.2 MHz crystal. However, what we want here is a step size of 25 kHz. This can easily be achieved by using the second harmonic of the RF signal as the input to the PLL. This signal is tapped off between IC3 and IC2 using inductive coupling. The PLL IC is controlled by a microcontroller (IC4, type PIC 16F628A) over an I 2 C bus. A major shortcoming of the PLL IC is that it generates crosstalk between the I 2 C bus and the charge pump and driver stages. This results in a tick- ing sound in the transmitted audio signal at the clock rate of the PC data. The author's intention was to be able to control not only the exciter but also the power amplifier (if used) or other hard- ware over the PC bus. The data for this, which in such case would not be intended for the PLL, would also be audible. In the present design this problem has been solved by placing an HEF4053 (IC5) between the PC bus and the PLL IC. When the data on the PC bus is not intended for the PLL, the PC link to the PLL is blocked. This is a very low-cost and effective solution. The exciter is controlled using a rotary encoder with a built-in pushbutton. Along with two LEDs and the display module (see Figure 2 for the schematic), it is located on a separate PCB which is connected to Kl. In operation, you simply select the transmit frequency and then press the rotary encoder to confirm the setting. The corresponding data is sent to the PLL IC, and the PLL status is read out. When the PLL indicates that the phase difference between the divided-down RF signal and the reference signal has been reduced to zero, this information is fed back to the micro- controller. The microcontroller then lights up LED2 (the PLL Lock indicator). It also switches on the supply voltage to the final MMIC, so that the exciter only outputs an RF signal when it is actually operating at the selected transmit fre- quency. The supply voltage of the final MMIC can be adjusted with potentiometer P3, which allows the output power to be reduced to any desired level down to approximately 1 mW. This makes the exciter suitable for use with a wide variety of final amplifiers. The eight-pin header CON2 can be used to connect a external device to be controlled by the microcontroller, such as a final amplifier. When the author began working on this design, he was not especially familiar with microcon- troller programming. He started off with the PIC Simulator IDE. This is a very simple software development environment that uses its own ver- sion of Basic. The nice thing about this software is that it includes a complete simulator, so you can fully simulate the software before loading 30 | July & August 2013 www.elektor-magazine.com FM Exciter it into a microcontroller. A drawback is the lim- ited calculation options. To avoid making thing too complicated, the author chose to work with two different counters. One of these counters handles the frequency readout, while the other provides the divisor. In other words, if you raise the transmit frequency on the display by 25 kHz, the counter setting for the divisor is increased by 1. At the lower and upper ends of the fre- quency band covered by the exciter (430 MHz and 440 MHz), the counter for the divisor is pre- set to a default value. All necessary information for this project (PCB layouts, components list, source code and hex code files for the microcontroller) is available on the Elektor website [1]. Operation The entire exciter is operated using a single rotary encoder with a built-in pushbutton. You select a new frequency by turning the encoder knob. When you do this, "TUNE" appears in the top left corner of the display. When you press the encoder knob, the new frequency is saved in memory and the exciter is tuned to this frequency. When the PLL is locked, the Lock LED lights up and the output stage is switched on. If the PLL cannot achieve lock, the Lock LED remains dark and the indication "PLLERR" is displayed. If the PLL does not receive any data over the I 2 C bus, the indi- cation "I2CERR" is displayed. In both cases the microcontroller will try to keep trying to config- ure the PLL until it achieves lock. Construction When building RF circuits, especially at relatively UHF, it is important to keep all connections as short as possible. The ground level should also be kept as 'cold' or 'earthy' as possible. That's why there are so many vias in the layout of the author's prototype PCB (shown at reduced scale in Figure 3). If you want to make your own PCB, it is very important to include these vias. The board is designed to be fitted in a sheet metal box measuring 74 x 148 mm, which is a commer- cially available size. The board must be soldered to the sheet metal of the box along all edges on both the top and the bottom sides. This provides an optimal ground connection. Fitting the board in a sheet-metal box and soldering it all around are very important. A DIY box made from PCB material is not suitable for this circuit. The construction procedure used by the author Figure 4. Along with the microcontroller and several headers, a length of coax cable acting as the oscillator coil is fitted on the bottom side of the board. is as follows. First clamp the bare board in the sheet-metal box and fit all necessary chassis components. An SMA chassis-mount connector is recommended for the antenna connection. If you use a bulkhead connector, it can easily be soldered to the sheet metal. This also eliminates the need for screws. The connectors for the sup- ply voltage and the audio input can be fitted in any desired location. A Cinch (RCA) chassis- mount connector is a good choice for the audio connection. All SMDs are located on one side of the board, while three pin headers, the coax stripline and the microcontroller are on the other side. Fig- ure 4 shows a detail view of the stripline. It con- sists of a length of flexible coax cable measur- ing 4 cm, with both ends soldered to the PCB. At one end the center conductor and the braid are joined together and soldered to the PCB. At the other end the braid must be divided in two and soldered to the ground plane as shown in the photo, with the center conductor soldered to the pad between these two points. After this you should assemble the circuit section by section. Start with the oscillator. Check that it oscillates in the 400-500 MHz range. You can use a frequency counter or a spectrum analyzer for this. Then fit the components for the buffer stage and the two MMIC amplifier stages. Pro- vide a temporary supply voltage connection for the final MMIC so that it also operates. Check the RF signal with an RF millivoltmeter or other suitable instrument. www.elektor-magazine.com | July & August 2013 31 •Projects Figure 5. The control board is fairly simple and easy to build. However, note that the 2xl0-pin header for the connection to the main board must be fitted on the rear side. If the RF portion works properly, you can then assemble the PLL and microcontroller portions of the circuit. Use an 18-pin socket for the micro- controller, and program the microcontroller before inserting it in the socket. The operator controls are located on a sepa- rated PCB as illustrated in Figure 5. Assembly of this board is straightforward. All components (except one) are fitted on the side with the com- ponent overlay. You can use a 16-pin header with a matching connector to connect the dis- play module. On the rear side of the board, fit a 20-pin header for connection to K1 on the main board with a 20-lead flat cable. Adjustment • Connect the exciter (with the display) to the supply voltage. Adjust P2 for the best display contrast. • Then adjust the frequency to 435 MHz. Using a ceramic or plastic trimmer tool, slowly rotate TR2 until the transmit frequency is 435 MHz. Measure the voltage at TP1 and turn TR2 until the measured voltage is approximately 6 V. Now you can use a fre- quency counter or spectrum analyzer to set the transmit frequency to exactly 435.0 MHz with TR1. • Then adjust P3 for maximum RF power. Next you have to adjust the notch frequency. A spectrum analyzer is necessary for this. Measure the second harmonic at 870 MHz and adjust TR3 for minimum power. If you do not have a spectrum analyzer, you can use an RF millivoltmeter and adjust TR3 for maximum output power. However, you should bear in mind that filtering will be sub- optimal in this case. This must be dealt with in the power amplifier connected after the exciter. • Check that the exciter works properly at both 430 MHz and 440 MHz. Fit a jumper in the pre-emphasis jumper position and con- nect an audio source, such as a CD player. Then adjust PI for optimal audio amplitude without distortion. The 70-cm FM exciter is now ready for use. We realize that some radio amateurs do not have a lot of experience with soldering SMDs by hand. If there is sufficient interest, the author is willing to assemble and adjust a number of boards at a reasonable price. If you are interested in this, please contact the author directly at [2]. ( 120267 - 1 ) Internet Links [1] www.elektor.com/120267 [2] pe5pvb@het-bar.net Adjustment Points PI Modulation depth (audio) P2 LCD contrast P3 Output power TR1 Fine tuning (reference oscillator) TR2 Coarse tuning (RF oscillator) TR3 Second harmonic filter notch frequency Test Points TP1 PLL control voltage TP2 Modulation signal after pre-emphasis TP3 Oscillator voltage (9 V) TP4 Driver stage voltage (5 V) TP5 Output stage voltage (0-4 V) TP6 PLL divider output frequency TP7 PLL reference frequency 32 | July & August 2013 www.elektor-magazine.com THE ORIGINAL SINCE 1994 PCB-pnnr The new standard ENIG instead of chem. tin for your PCB : : ti; I .! * 1 ■jiift *•>** . s, ••rif | IlilTlti tljl if a 0 m m \ 'I a*i» >*? k'-d www.pcb-pool.com At no additional charge! Highest quality surface: ENIG VI Multilayer Price reductions of up to 50 % for 2-5 multilayer circuit boards Beta LAYOUT create : electronics •Projects Smartphone A/V Control Transmitter plus App for Android devices Remote By Peter Zirngibl (Germany) (info@pezitec.com) The best types of universal remote controller come equipped with a large touch screen, just like the one on your Smartphone. So why not use your phone to con- trol all the A/V appliances at home? Armed with a Smartphone you can surf the Web, send emails, text, chat, download and listen to music, take and post photos and video clips, listen and view TV stations, navigate, place bets and yes, even make phone calls to anywhere on the globe. Tens of thousands of Apps are also avail- able to make the Smartphone the most universal, configurable control and communication device ever created. It is not surprising that there are also Apps which allow you to control the newer generation of home WLAN-equipped A/V equip- ment. The WLAN interface allows signals from the phone to be routed through to control the equipment directly without the need for addi- tional hardware. Older A/V equipment generally only have the more traditional IR remote control interface and Smartphones still have no built-in IR transmitter. 34 | July & August 2013 www.elektor-magazine.com Smartphone A/V Remote Control Jci ^ToOn PCO 14 f PCI 11 ' PC2 12 3V3 -O 3V3 O LD1 ~T~ •>1 «l | 10 „ O O a 0 0 IO 1 9 { 7 1 5 { 4 ; 0 0 dp I 2 I 1 f X X 0 g 1 SC39-11SURKWA LD2 ~T 1 10 O ° ° a 0 0 J 9 \ 7 IO ; 0 0 o dp 1 5 j 4 1 2 1 1 g I PCO 23 PCI 24 'PC2 25 'PC3 26 'SDA 1 27 'SCL 28 'reset 1 / PBO 14 'PBl 15 'PB2 16 'MOSI 17 'MISO 18 'SCK 19 ^Tc o o o o > > < o: < PCO (ADCO) PCI (ADC1) PC2 (ADC2) PC3 (ADC3) PC4 (ADC4/SDA) PC5 (ADC5/SCL) PC6 (RESET) PBO (ICP) PB1 (0C1A) PB2 (SS/OC1B) PB3 (MOSI/OC2) PB4 (MISO) PB5(SCK)^ § n O X IC3 PDO (RXD) PD1 (TXD) PD2 (INTO) PD3 (INTI) PD4 (XCK/TO) PD5 (Tl) PD6 (AINO) PD7 (AIN1) ATmega88-20PU < a E: O XI HfH C6 22 p X C5 "p JP2 SCK 3 'reset 5 BT TX PD2 5 PD3' 6 PD4-' 11 \ 12 13 SI S2 S3 h} h{ h; DOWN ENTER UP XI = 14.7456MHz +5V K2 RE1 <2) rz> i 0 0 J? TuOu 1 25V s PC3 1 s PBO _ 2 LI s PBl 4 s PB2 5 \ PD3 6 N. PD4 7 IC5 INI OUT1 IN2 OUT2 IN3 OUT3 IN4 OUT4 IN5 OUT5 IN6 OUT6 IN7 OUT7 IN8 § OUT8 D 18 2x TSAL6200 Jg" loTjTsv PD2 1 IC6 TSOP32236 3V3 O JP1 SCL SDA WP SCL O CJ > IC1 AO A1 SDA 24C512 A2 □ C2 lOOn ULN2803A K4 IC7 7805 +5V O D7 - i3_ 1 - fcA O 2 rW - 1N4001 CIO 100u 25V ❖ ♦ C13 lOOn IC8 LF33CV C14 lOOn C12 lOu 25V 0 4 C15 lOOn C16 lOOn 3V3 -O cn 10u 25V 120043 - 11 Figure 1. The high level of integration in the Bluetooth module reduces circuit complexity. The vital bit of kit missing here is an intelligent adapter that can on one side communicate with the phone using Bluetooth and on the other, transmit IR signals to control the A/V equipment. Intelligence, in this context generally means that a device has the ability to learn' a sequence of commands. This of course implies that a learn process is necessary. The adapter needs to know the particular variant of remote control that is in use and which button controls which feature of the controlled equipment. Simple, low cost uni- versal remote controllers are pre-programmed with thousands of different command sets for all the different makes of equipment. They are generally only able to control a few basic com- mands like PLAY or STOP. It is not possible to edit the commands and a learn function is only possible with the more expensive types of uni- versal remote controller. Some of the better types are able to execute macros which involve a sequence of commands (e.g. Watch a DVD = switch on DVD player, TV, AV receiver, then configure the correct video and audio channel). This procedure is also possible with the Bluetooth-IR adapter described here. The newer, better quality (and more pricey!) type of universal remote controllers can now be con- veniently programmed using a PC. To cut down on the software expenditure for this project we decided against this approach. In this design the adapter is programmed by reading the IR sig- nals directly from the original remote controller. www.elektor-magazine.com | July & August 2013 35 •Projects Figure 2. Block diagram of the BTM- 222 Bluetooth module. This means that the IR remote transmitter is placed in front of the IR adapter's receiver and the command transferred. How this is exactly accomplished will be covered in more detail later, first we will take a closer look at the hardware. Figure 3. A terminal program is used to set up the Bluetooth module to the displayed parameters. A radio-linked controller The circuit diagram given in Figure 1 indicates that there really isn't too much hardware used in the adapter design. It basically consists of a small Atmel type ATmega88 microcontroller together with some peripheral components: • A 24C512 EEPROM with 512 kBit memory and I2C interface to store the programmed codes. • An infrared receiver module type TSOP32236 • Two IR transmitter diodes type TSAL6200 driven by a ULN2803 driver chip. • A two character 7 segment display with an HC595 8-bit shift register to show the pro- grammed codes and program status. • Three pushbuttons UP, DOWN and ENTER, for programming and operating. • In-System-Programming interface Kl. • A relay with changeover contacts driven by the peripheral driver chip. • Voltage regulators for +5 V and 3.3 V You have probably seen all of these features many times before in many other circuits, however the real star of the show here is the BTM-222 Blue- tooth module from Rayson. A description of the module is contained in the data sheet [1]. The module is small, portable, easy to program and above all (around $10 a pop) affordable. In time, as we move to a more wireless future, all periph- erals will probably communicate using devices like this. The BTM-222 is a class 1 device giving it a range of up to 300 ft. As you can see from its block diagram in Figure 2 it includes many serial interfaces and from these the UART must be favorite for microcontroller communications. Data throughput of the UART (and the USB inter- face) in the BTM-222 is guaranteed at the full data rate of 921 Kbit/s. The BTM-222 UART used with a microcontroller requires hardly any additional components. The communication parameters are factory set to the standard 8N1 setting: • Baud rate 19,200 Baud • 8 data bits • No parity • 1 stop bit The microcontroller only needs to open the cor- responding UART channel. As required, param- eters and other properties of the module can be accessed using the so-called 'AT command' set of instructions. More information on this aspect is contained in the BTM-222 data sheet [1]. The settings are stored in an internal flash memory. The 'blue' core of the module is clocked by an internal 16 MHz oscillator. The output signal is 36 | July & August 2013 www.elektor-magazine.com Smartphone A/V Remote Control fed to a balun and then to an RF power ampli- fier producing a signal of +18 dBm at the aerial. For signal reception the BTM-222 switches the received signal to a low-noise amplifier block (LNA) followed by a band-pass filter to reduce out-of-band signal interference. The BTM-222 does not require any external aerial; a short length of PCB track can be used. Here we have used a short piece of wire. The module provides some status output signals: the data status (LED D5 on pin 11) and the con- nection link status (LED D6 on pin 13) are both used in the circuit. There is also an operating voltage status indicator output from pin 14 but we have not used it in this application. BTM222 set up Initially the Bluetooth module needs to be configured with the correct parameters. First remove jumpers JP2 and JP3 to disconnect com- munications with the microcontroller. Connect the BTM-222 to a PC using, for example a TTL- 232R cable from FTDI, connected to K3. The cable carries a 5 V line (connecting to pin 1 of K3) which must not be allowed to make contact with the BTM-222 supply (this is at 3.3 V, and its upper limit of 3.6 V must not be exceeded). It is therefore important to leave pin 1 of K3 unconnected and power the Bluetooth module from the board power supply. Run a terminal emulation program such Hyper- Terminal or Hterm on a PC (Figure 3), select a (virtual) COM port, to which the Bluetooth mod- ule is connected and use the serial port settings given above for the BTM-222 serial interface. Check to see if the module reacts to the ATI command; this should cause all the module set- tings to be dumped to the screen. If there is no response check that the 3.3 V supply, the COM port settings and the connections on K3 (TxD/ RxD switched?) are in order. If you are unsure of the module settings or maybe suspect that the BTM-222 is not operating correctly you can pull pin PI04 high for a minimum of three seconds to reset the module to its factory settings. Change the UART settings to 4800 Baud (ATL = 0), even parity (ATM = 2), no handshake flow control (ATC = 0). Adjust the terminal emulator settings after each parameter change. Finally you can change parameters such as the mod- ule name or the Bluetooth connection PIN code as you wish. Turn on the Smart phone (or other Android device), check that the BTM-222 has been detected and enter the PIN for the connection. When everything is in order turn the remote control unit off, disconnect the PC and place the two jumpers in positions JP2 and JP3. The Remote App Once the Remote_Control.APK App has been installed the Android Smart phone will be capable of remote control. Bring up the App to begin pair- ing with the BTM 222 module. Choose the Bluetooth device using SELECT DEVICE and use CONNECT to estab- lish a connection to the device. LED D6 lights up indicating that the mod- ule is connected to an Android device and D5 flashes when data is being received. The transmitted value (0 to 99) plus a line feed character tells the adapter which mem- ory location is referenced. In playback mode the command received from the Bluetooth module can be evaluated. The principle is really simple: '2/n' is received and the adapter jumps to memory position 2, and transmits the command stored in this position (in this case turning up the volume of device 1). Commands 73 and 74 do not pro- duce any IR signal but instead operate a relay. Command 73 closes the relay contacts for two seconds while command 74 toggles the relay contact state between off and on. Connector K2 provides connection to the contacts, allowing external equipment to be switched on and off. Figure 4 shows the App running in all its glory on a Smartphone. With the left/right arrows at the top you can choose between five different devices. For each device you can choose to enter a name in the text box and store it with the Save button. The name is retained so it appears Figure 4. How the remote control App looks on a Smartphone. www.elektor-magazine.com | July & August 2013 37 •Projects when the App is next started. In addition you can add a description to the functions 1 to 10. Press the EDIT button, choose the button to edit and enter the text. Press SAVE to store the text. This sequence is the same for every device. Camera, action! The controller software is divided into two parts; the programming mode and the operational mode. In programming mode the remote con- troller infrared command signals are recorded in the adapter memory in the following manner: First it is necessary to clear the serial EEPROM. This is accomplished by pressing all three but- tons simultaneously and applying power to the adapter. When the seven segment displays show dE (delete) the three buttons can be released. The complete erase process takes a few minutes before 0 0 is shown in the display. To record the commands in programming mode hold the ENTER button (pin PD6 to GND) before connecting the supply voltage. On the seven segment displays Pr should flash three times (Programming mode). Now find a memory posi- tion from 0 to 99 using the UP/DOWN buttons (pin PD5 and pin PD7) and select it using the ENTER button. The display will show the symbol - indicating its readiness. The remote controller can now be bought within 2 to 10 cm to the IR receiver and the required command button on the remote controller pressed once (once only!) Try to complete this process quickly to reduce the chance of recording some interference. The display should now show io . . as confirmation. Recording a macro is possible for each device, each macros can contain up to six commands. Macros are stored in the same way that single commands are stored. Figure 5. The circuit board layout. All of the user interface elements are located on the underside. COMPONENT LIST Resistors R1-R4,R6-R9,R13-R20 = 270ft R5,R25,R26 = lkft R10,R24 = lOkft R11,R12 = 4.7kft R21,R22 = 10ft R23 = 100ft Capacitors C1,C2,C3,C4,C7,C13,C14,C15,C16 = lOOnF C5,C6 = 22pF ceramic C8,C11,C12 = 10pF 25V radial C9,C10 = lOOpF 25V radial Semiconductors D1,D5,D6 = LED, red, 3mm, low current D2,D7 = 1N4001 D3,D4 = TSAL6200 (Vishay) 940nm IR transmitter diode LD1,LD2 = SC39-11SURKWA (King- bright) 7-segment-LED display, 10mm IC1 = CAT24C512LI-G (On Semiconductor) IC2,IC4 = 74HC595N IC3 = ATmega88-20PU (Atmel), pro- grammed, Elektor # 120043-41 [2] IC5 = ULN2803APG IC6 = TSOP32236IR (Vishay) 36kHz IR receiver IC7 = 7805 IC8 = LF33CV (STMicroectronics) Modi = BTM-222 (Rayson) Bluetooth module Miscellaneous XI = 14.7456MHz quartz crystal Rel = 6V SPDT relay (lx c/o contact), Finder 43.41.7.006.2000 S1,S2,S3 = tactile switch, SPNO, round 38 | July & August 2013 www.elektor-magazine.com Smartphone A/V Remote Control When the IR signals are recorded the pulse widths are stored as Unsigned integer Variables , buff- ered and then saved to the EEPROM. To pro- gram another command it is necessary during the confirmation display (io . flashing) to hold the ENTER button after programming to gener- ate a pC reset. With no other button pressed during reset the program automatically jumps into playback mode. Now using UP/DOWN buttons you can select the command you have just stored and press ENTER to transmit it over the IR diode to switch the A/V equipment. This will show if the command was correctly stored. On the PCB A PCB for the remote control adapter is available from the Elektor shop [2], where you can also order a preprogrammed microcontroller. Use this link to find the compiled App and the firmware source code. A look at the PCB layout should allay any fears for the home constructor; although the Bluetooth module has an SMD outline connec- tions are spaced at 1.25 mm and are relatively easy to solder by hand with a standard fine tipped iron. Correct placement of this module is impor- tant prior to soldering. Pin 1 can be identified by a small round dot on the metal screen (on the side by the aerial). This pin should be orien- tated near the PCI label on the PCB. The thick pads along the long sides and at the ends are at ground potential and connected to the module's continuous earth plane. Once the module has been soldered in position the other through-hole components can be fitted. It is recommended to mount the IC components JP1,JP2,JP3 = 2-pin pinheader with jumper K3 = 4-pin SIL connector K1 = 6-pin (2x3) pinheader K4 = low voltage adaptor socket, 2.1mm K2 = 3-pin PCB screw terminal block, pitch 5mm PCB 120043-1 [2] www.elektor-magazine.com | July & August 2013 39 •Projects Table 1. Assignment of memory position and function Function Device 1 2 3 4 5 MUTE 0 8 16 24 32 ON/OFF 1 9 17 25 33 VOL+ 2 10 17 26 34 VOL- 3 11 19 27 35 PRG+ 4 12 20 28 36 PRG- 5 13 21 29 37 AUX 6 14 22 30 38 MAKRO 7, 75-79 15, 80-84 23, 85-89 31,90-94 39, 95-99 Function 1 40 50 60 Function 2 41 51 61 Function 3 42 52 62 Function 4 43 53 63 Function 5 44 54 64 Function 6 45 55 65 70 Function 7 46 56 66 71 Function 8 47 57 67 72 Function 9 48 58 68 73 i) Function 10 49 59 69 74 2) 1) Relay on for 2 s 2) Toggle relay using sockets. Both seven segment displays, the three push buttons, D5 and D6 are fitted to the PCB underside. This leaves all the 'HID' devices on the same side of the board which makes it simpler to install into a case. A simple short length of cable is suitable as an aerial. According to the calculation at 2.4 GHz (13 cms band) the aerial should be around 3.1 cm (A/4), but the length is not too critical and for this application we only need relatively short range communication. The main thing to remember is that if the unit is fit- ted in a metal housing please ensure that the aerial extends outside the case. ( 120043 ) Internet Links [1] www.mikrocontroller.net/wikifiles/f/fc/ BTM222_DataSheet.pdf [2] www.elektor.com/120043 [3] http://appinventor.mit.edu 40 | July & August 2013 www.elektor-magazine.com Create and Innovate with ARM Tools Keil MDK-ARM ARM DS-5 DS-5™ Professional is a full featured software development solution for all ARM Powered® platforms. www.arm.com/ds5 MDK-ARM™ is the complete software development environment for ARM® Cortex®-M series microcontrollers. www.keil.com/mdk Rapid Prototyping for Microcontrollers. mbed.org mbed S +1 800 348 8051 ©ARM Ltd.AD387 | 06.13 •Projects Ambience Lighting Controller Setting the mood with RGB LEDs By Goswin Visschers (The Netherlands) Color LED strips are now available at low cost in all sorts of types and sizes. With the con- troller circuit described here, you can set your own colors and even configure and run complete lighting programs. The con- troller is battery powered, so it can be used in places where AC power is not readily available. This circuit was originally devel- oped to drive color LED strips from a well-known Swedish chain of home furnish- ing stores. These color LED strips come with a simple controller, which allows you to manually select a limited number of colors. This restriction stimulated the author to develop a DIY controller with more capabilities. The resulting 'ambience lighting con- troller' is suitable for all RGB LEDs and LED strips that can operate from a 12 V supply voltage with a series resistor for current limiting. In the author's intended application it was not possible to power the LED strips from the AC line, so the controller is designed to operate from a 12 V gel-cell battery. The basic features of the circuit are described in the inset. Schematic diagram As you can see from the schematic in Figure 1, the circuit is fairly simple. The author chose a PIC16F887 for the microcontroller on account of its integrated EEPROM (for convenient stor- age of lighting programs), extensive I/O capacity and integrated ADC. Although the PIC16F877A is more popular, a sibling device was selected for this application because its ADC configura- tion allows the ADC inputs on RAO and RA1 to be used without requiring any reference voltage input on RA2 or RA3. Here RC3 is connected to switch SI, which allows the battery charge state to be shown on the LCD module in two different ways. Connector K6 is the ICSP port for in-circuit programming of the microcontroller. The microcontroller is clocked at 20 MHz by crys- tal XI. This relatively high clock frequency is necessary because the clock signal is divided by 4 inside the microcontroller. The resulting 5 MHz signal is essential for the PWM control function implemented in software. The display module, a standard type with two lines of 16 characters (which is available in the Elektor Shop), is connected to port RB. If you use a different type of LCD, the polarity of the supply voltage for the backlight can be changed (if necessary) using jumpers in positions J1 and J2. Transistor T2 switches off the backlight after 10 seconds with no user input. The contrast can be adjusted with trimpot PI. Unlike most circuits 42 | July & August 2013 www.elektor-magazine.com LED Lighting Controller Features • Supply voltage range 11-15 V • Constant brightness over operating voltage range • LC display (2 lines of 16 characters) • Up to 13 user-definable colors with adjustable RGB values • Three user-definable lighting programs with 20 color changes. The maximum duration for each color is 255 s, and the maximum duration of the transition to the next color is also 255 s. Both times can be set in increments of 1 s. • Continuous operation with any one of the three defined programs • Acoustic alarm when the battery is discharged, with automatic switch-off of the LED strips • LED indicator for remaining battery charge • Built-in charging circuit for the battery, with automatic switchover to trickle charge • "Child lock" to prevent changes to color settings or programs • Optional remote control via RS232/USB converter Figure 1. Schematic diagram of the RGB lighting controller, which is built around a PIC16F887 microcontroller. F2 K1 3A15 F D1 R2 — ^1 — | 1R | 1N5400 5W 47 R 0W5 Power K7 +12V © 2AT D2 M 1N5400 12 V Battery IC1 ci 470u 16V LM7805 0 » C2 lOOn C3 ■ [ lOOn +5V 11 > > a. 2 o»HCNjcO'd-uocor^ CQCOCQCQCOCQQDCQ oooooooo +5V 0- & PI 10k 30 29 28 27 23 24 25 26 15p 31 O O O o o o K2 K3 K4 K5 K8 MOD-110533 DIL USB Serial Bridge Module -o CBUS4 +5V o- -o CBUS3 VCC10 o- o CBUS2 +3V3 o -o CBUS1 GND o- ■o CBUSO CTS o- -o RESET R1 o- -o DCD RXD o o DSR TXD o- -o DTR RTS o Elektor - 110533 USB 23 22 21 20 19 18 17 16 11 12 14 15 16 BACKLIGHT R21 0 © +5V +5V BC547 19 Submenu_2 BACK ENC3 _ O i o — W'oi- qMql Submenus ENTER X. ENC2 5 4 i i i i -io'V'o 1N4148 110406 - 11 www.elektor-magazine.com | July & August 2013 43 •Projects Figure 2. The operator controls and LCD are also mounted on the PCB. I with an LCD module, here the LCD is driven in 8-bit mode instead of 4-bit mode. This simply represents a design choice, since the microcon- troller has enough I/O pins available. The color intensity of the connected LEDs is deter- mined by pulse width modulation. Although the microcontroller has enough PWM outputs avail- able for this purpose, the author decided not to COMPONENT LIST Resistors R1 = 47ft 0.5W R2 = 1ft 5W R3,R5,R6,R8-R14,R16-R19 = lOkft R4,R7 = 3.9kft R15,R20,R21 = lkft R22 = 47ft PI = lOkft preset, horizontal Capacitors Cl = 470pF 16V radial C2,C3,C10 = lOOnF C4 = lOOpF 16V radial C5,C6 = 15pF C7 = 470nF C8,C9 = lpF 16V radial Semiconductors D1,D2 = 1N5400 D3,D4,D6 = 1N4148 T1,T2 = BC547B T3,T4,T5 = IRL540 (International Rectifier, Newark/ Farnell # 8651078) IC1 = LM7805 IC2 = PIC16F887, programmed, Elektor # 110406-41) D5 = LED, red, 3mm Miscellaneous XI = 20 MHz quartz crystal FI = fuse, 2AT (slow), with PCB mount holder F2 = fuse, 3.15AT (slow) with PCB mount holder BZ1 = active (DC) buzzer (with internal oscillator) RE1 = relay, 12V, 1 c/o contact @ 2A min. (e.g. Find- er 40.31.7.012.0000; Newark/Farnell # 1169158) MODI = Elektor USB-FT232R breakout-board (BOB) [ 1 ] S1,S2 = slide switch, angled pins, PCB mount (e.g. C&K OS102011MA1QN1; Newark/Farnell# 1201431) S3,S4,S5 = rotary encoder with integrated pushbut- ton (e.g. Alps EC12E2424407; Newark/Farnell # 1520813) K1,K7 = 2-pin PCB screw terminal block, 5mm lead pitch K2,K3,K4,K5 = 4-pin pinheader, 0.1" pitch K6 = 5-pin pinheader, 0.1" pitch LCD1 = LCD 2x16 characters, with backlighting (e.g. Elektor # 120061-71)) J 1,J2 = 3-pin pinheader with jumper, 0.1" pitch 40-pin DIL-socket for IC2 PCB 110406-1 [2] 44 | July & August 2013 www.elektor-magazine.com LED Lighting Controller use them in order to simplify the routing of the prototype circuit board. For this reason, the PWM function is programmed in software. The LEDs are driven by the power MOSFETs T3, T4 and T5, which are designed to operated from TTL-level signals. The RGB LED strips (maximum 4) are connected to connectors K2 to K5. Each of the MOSFETs can easily supply several amps with- out extra cooling. Bzl is a buzzer with a built-in oscillator, so you only need to apply the supply voltage to get a penetrating acoustic tone. The control elements consist of three rotary encoders with built-in pushbuttons. The RAO and RA1 leads of the microcontroller are used as A/D converter inputs. The RAO input measures the battery voltage, while the RA1 input detects whether a battery charger with a supply voltage above 14 V or so is connected. Voltage dividers R5/R4 and R6/R7 reduce the sensed volt- ages so they fall within the measuring range of the microcontroller. Capacitors C8 and C9 decou- ple any ripple voltage on the sense lines. The schematic also includes a serial to USB con- verter module (Elektor BOB, order no. 110553-91 [1]), which can be used for linking to a PC if so desired. The circuit can be controlled remotely using a number of commands in a terminal emu- lator program. For more information about this, see the user guide (free download [2]). The supply voltage is regulated by a conven- tional 7805 together with a few capacitors (IC1, C1-C4) and a diode (D2) for polarity protection. The value of fuse FI in the power supply stage depends on the load. A 2-A slow blow fuse should be adequate with 6.5-ft (2-meter) LED strips, but to be on the safe side you should measure the load current in the actual application. Nat- urally, you should do this with all colors set to maximum intensity. Connector K7 is the power input connector for a gel-cell battery, and an AC adapter with an output voltage of approximately 15 V at 2 A or more can be connected to Kl. Transistor T1 drives relay RE1, which in turn shorts out resistor R1 when the battery has to be charged. The relay type is not critical— as long as the contacts can switch 2 A and the coil voltage is 12 V. See "Operation" for more information about the relay. The circuit draws only 25 mA or so in operation, or approximately 50 mA with the backlight on. PCB Figure 2 shows the PCB layout designed at Elek- tor Labs for this lighting controller. Only leaded components are used, so board assembly is easy even if you don't have a lot of soldering experi- ence. All components are fitted on the side with the component overlay. Using flat-jawed pliers, bend the leads of the voltage regulator and the MOSFETs at a right angle before fitting them to the board, so that they lie flat on the board after they are soldered. These components do not need heat sinks for normal use. The microcontroller (optionally available prepro- grammed) should be fitted in a socket. If you want to use a serial link to a PC, you should install the Elektor USB FT232R breakout board. It can be fitted directly on the PCB, or you can use a pair of 9-pin SIL socket strips. Software The program for this circuit was written in ANSI C using MPLAB and compiled using a full-function Fli-Tech C compiler running in evaluation mode (45 day trial license). The "lite" version of this compiler is not suitable in this case because it does not provide sufficient optimization, with the result that the executable code is too large for the 8 KB of program memory in the microcon- troller. The source code and hex code, as well as the PCB layout, are available on the Elektor website [2] for free download. As usual, you can order a pre-programmed microcontroller in the Elektor Shop. The key component of the software is the inter- rupt service routine (ISR). This routine was opti- mized using the stopwatch function of MPLAB to minimize its execution time. The ISR is divided into several subroutines that can be executed every 100 ps, 5 ms, 100 ms or 1 s. The ISR is called every 100 ps, and it uses counters to ensure that the subroutines are exe- cuted at the previously mentioned intervals. To reduce memory usage, a counter was ini- tially used to determine the 1-ms and 100-ms intervals. A modulus calculation (which yields the remainder of a division operation) was per- formed each time the interrupt was called (every 100 ps), and if the remainder was zero, a 1 ms interval had expired. During debugging with the stopwatch function it turned out that this mod- ulus calculation took so much time that it would be better to use a second counter to determine the 1 ms intervals. www.elektor-magazine.com | July & August 2013 45 •Projects The automatic light level control works as follows. The nominal PWM clock frequency is 100 Hz at 11 V. If the battery voltage is higher than 11 V, the LEDs will be brighter if the duty cycle remains the same. If the duty cycle is adjusted accord- ing to the battery voltage, a new duty cycle has to be calculated for each color. A much simpler method is to leave the 'on' time the same and reduce the PWM clock frequency as the voltage rises. This means that the calculation only has to be performed once to obtain the same result. Listing 1 fade_step_red = current_red_value - next_red_value ; fade_step_green = current_green_value - next_green_value ; fade_step_blue = current_blue_value - next_blue_value ; fade_step_red = f ade_step_red * 100; fade_step_green = f ade_step_green * 100; fade_step_blue = f ade_step_blue * 100; fade_step_red = fade_step_red / fade_time; fade_step_green = f ade_step_green / fade_time; fade_step_blue = fade_step_blue / fade_time; Listing 2 tmp_red_value = fade_tmr * f ade_step_red ; tmp_green_value = fade_tmr * f ade_step_green ; tmp_blue_value = fade_tmr * fade_step_blue ; tmp_red_value = tmp_red_value / 100; tmp_green_value = tmp_green_value / 100; tmp_blue_value = tmp_blue_value / 100; red_value = next_red_value + tmp_red_value ; green_value = next_green_value + tmp_green_value ; blue_value = next_blue_value + tmp_blue_value ; The difference between PWM clock frequencies of 100 Hz and 90 Hz is not visually noticeable. Another bit of software that caused headaches for the programmer with the code for the color transitions. The calculation is very simple in prin- ciple: take the PWM value for each color, calcu- late the difference between this value and the next value, and spread the result over the tran- sition time. Then raise or lower the PWM value for each color at each step during the transition interval (here the transition interval is given in increments of 100 ms). The result of the division is typically a decimal fraction, which means that floating point vari- ables have to be used for the calculation and for storing the values. The PIC16F microcontrollers are simple 8-bit devices, and the compiler had a lot of trouble handling these "big" floating-point variables. This led to timing problems and errors in the com- piled code. The solution to this problem was rel- atively simple. Multiplying and dividing integers takes less time and memory than working with floating point numbers. Accordingly, the differ- ence between the PWM values for each color is first multiplied by 100 and then divided by the transition time, as shown in the following code segment (Listingl). At every step during the transition interval (every 100 ms), the current PWM value is calculated and then divided by 100. The result is an integer "rounded off" to two decimal points, rather than a decimal number (Listing 2). With this approach, an 8-bit microcontroller can handle color transitions without significant per- formance problems. Operation After the controller is switched on, it first shows a welcome message on the display consisting of its name and version number. The menu becomes available 1 second later. Operation of the con- troller is self-explanatory, but an extensive User Guide is also available as a free download [2]. You can scroll through the menu using rotary encoder ENC1. First you see the three options Run Program (where x is 1, 2 or 3) for run- ning one of the defined programs. Select one of the three programs and press Enter (the push- button of ENC2). To return to the menu, press Back (the pushbutton of ENC3). The menu option Charge Battery selects moni- tored battery charging mode. First connect a 15-V battery charger, and then select this option. In this mode the relay is energized and shorts out resistor Rl, so that more current can flow into the battery. The color LED strips are switched off to prevent potential damage from the higher than usual input voltage. When the battery volt- age reaches 13.8 V, the relay is released. This reduces the battery charging current to the trickle 46 | July & August 2013 www.elektor-magazine.com LED Lighting Controller charge level, and the color LEDs are switched on again. The Battery Charge option shows the charge level of the battery in steps of 10%. The value is determined by measuring the battery voltage and expressing it as a percentage, where 0% corresponds to 0% and 13.8 V cor- responds to 100%. LED D5 indicates the charge state of the battery. The LED is lit constantly when the battery is fully charged (13.2 V). When the battery starts to get low, it blinks for one second with a duty cycle that depends on the remain- ing battery charge. If the battery is nearly empty, the LED lights up very briefly. When the battery is so low that the color LEDs must be switched off, the buzzer start beeping. Switch S2 provides a Child Lock func- tion. When it is closed, the Edit Program and Edit menu options are not available. To adjust a color setting, select Edit / press Enter, and use the rotary encoders to set the red, green and blue levels over the range of 0 to 100%, in steps of 1%. Press Enter to save the new settings, or press Back to return to the menu without saving the new settings. To configure a program, first select Edit Pro- gram and then press Enter. Then use rotary encoder ENC1 to select the color, rotary encoder ENC2 to set the Hold time, and rotary encoder ENC3 to set the transition time. ( 110406 - 1 ) Internet Links [1] www.elektor.com/110553 [2] www. elektor.com/1 10406 Advertisement s V-J Buffered reference ou External reference Em capable S B P GW E R E D wit h i nterface . 65dB LINEAR RANGE (+10dBm to Morse CODE OOK Modulation Module ention this Advertisement and we wil dude a FREE USB cable and FREE shipping, 51 2-992-8657 or email foberE@rf CO Q J W >>>□££]£ q a o<— icNco^j-Lncor'-u QQQQQQQQ_j_l +5V O- ci i 100n C2 lOOn o o CJ o LL LU > < PCO (ADCO) > □c < PDO (RXD) PCI (ADC1) PC2 (ADC2) PC3 (ADC3) IC1 PD1 (TXD) PD2 (INTO) PD3 (INTI) PC4 (ADC4/SDA) PD4 (XCK/TO) ^7| PC5 (ADC5/SCL) PD5 (Tl) PC6 (RESET) PD6 (AINO) PD7 (AIN1) ATmega8-16PU PBO (ICP) PB3 (MOSI/OC2) PB1 (OC1A) PB4 (MISO) PB2 (SS/OC1B) PB5 (SCK) Q Z O < I— X CM —1 < X Q Z O JL S3 . m: n: up i down; RESET PB2 '1 C3 22p XI ifll C4 "p XI = 16MHz P i I lOkl/f 131 r*- CO I CD I O I 8,90) and an Nokia brary for the ogger uses an Araumo, c screen ($6,80;iteadstud keypad Driver Plate Modification for ElektorWheelie After intensive use of the ElektorWheelie it appears (see lower photo) can bend, warp or even rea High-end propeller jn ce Of Vision (POV) display is This led row is either also known as anically moving basea on c oscillating MHz DDS Function Generator rt of this project is AD9834 - Direct Digital Synthesizer . . >-« nonprate sine and triangular wav upto 37 .5MHz htzeit-Stimmhohen-Teiler hen. das hateinenganz Proposals Finished Vote for your Favorite Proposal Sharing Electronics Projects Elektor.LABS is an online community for people passionate about electronics. Here you can share your projects and partici- pate in those created by others. It's a place where you can discuss project development and electronics. Elektor's team of editors and engineers assist you to bring your projects to a good end. They can help you write an article to be published in Elektor. MAGAZINE or even develop a complete product that you can sell in Elektor.STORE! GET •LEKTORIZED Join or Create a Project at www.elektor-labs.com Jk •Projects CDI Ignition ufacturer has used this method on purpose to build in an electronic speed limiter to ensure the moped is road legal. However, the carburetor is not limited and it happily continues to deliver the fuel mixture, which ends up unburnt in the exhaust. Apart from the fact that this has a nega- tive impact on the fuel consumption, it doesn't do the exhaust any good either. There will be more of a carbon build up in the exhaust, which means it has to be replaced sooner. You could of course open up the existing CDI (Capacitive Discharge Ignition) unit and modify it, but since this is completely encased in pot- ting compound this is not something we would recommend. Instead, we investigated what was required to produce the sparks without limiting the rpm. The result of this can be seen in the schematic shown here. Since the ignition coil and pickup coil are mounted next to the flywheel of the engine we only have to concern ourselves with the electronics that make a capacitor discharge into a coil at just the right moment. The input is connected to a pickup coil that deliv- ers a single pulse for every revolution of the fly- wheel. The output is connected to the ignition coil that supplies the high voltage pulse to the spark plug. Capacitor Cl stores the electrical energy and is charged up via D3. When there is For Spartamet and Saxonette mopeds By Jan Visser (Elektor Labs) This article describes a home-made CDI unit for Spar- tamet and Saxonette motor-assisted bicycles (mopeds). Having been virtually forced to use a Spartamet to travel between home and work for three weeks, it was noticeable that although the moped ran fine, at full throttle and at top speed (15 mph) the ignition began to misfire. The fuel consumption at full throttle also increased dramatically: from 118 mpg at 3/4 throttle to 71 mpg at full throttle. There was a strong suspicion that the higher fuel consumption was related to the misfir- ing of the ignition; this was confirmed after some fur- ther thought and having checked the spark plug and exhaust after several rides. The ignition starts to skip sparks when the 30 cc two-stroke engine is at full throttle and at top speed. The man- 72 | July & August 2013 www.elektor-magazine.com CDI Ignition a pulse at the input it triggers the thyristor into conduction, which connects Cl to ground so it can discharge into the ignition coil. That is all there is to it! A single sided PCB has been designed for the circuit (the layout can be downloaded from [1]). However, note that the components are mounted on both sides of the board. This was necessary in order to keep the circuit the same size as the orig- inal CDI unit. Its dimensions are 59x38x24 mm. The photos of the prototype make this clearer. First mount Dl, D2, Dll and C2 onto the compo- nent side. You should then solder diode D3 and thyristor TH1 onto the board. These should be bent over so they're level with the board, with D3 ending up on top of D2 and T1 on top of Dl and DI4. The MKP capacitor (Cl) ends up along- side the board. The varistor (VR1) and resistor (Rl) are then mounted onto the solder side of the board. And finally you should solder the three spade terminals onto the board. For the enclosure you can use a small box from Hammond (001100), Conrad Electronics part number 540830-89, although an acrylic home- made box (cassette or cd case) is an alternative. Once the board has been populated and con- nected you can check if the ignition produces any sparks. If it all works and the spark plug is sparking happily you can put the circuit in its enclosure and fill it with potting compound. If you fail to do this it is very likely that the circuit will soon stop working properly, since the ignition is subject to quite a lot of vibration. There are two types of CDI unit in use, one made by Motoplat (red) and one made by Pru- frex (blue). In both cases the earth is connected to the middle connector of the CDI unit. If you accidentally connect the input and output the wrong way round the CDI unit won't produce a spark. All you need to do when this happens is to swap the red and blue wires over. When the circuit was installed and put into use the effect was immediately noticeable. The engine runs much smoother at full throttle and it no longer misfires. The average fuel consumption was also found to have improved considerably to 166 mpg. Since the little engine has its own mechanical limitations (carburetor, exhaust, compression ratio), the top speed won't increase by a huge amount: we found it to be about 2 to 2.5 mph higher. The biggest advantages are of course the K1 lu 400V 120601 - 11 COMPONENT LIST Resistors Rl= 560ft VR1 = S10K140 varistor Capacitors Cl = lpF 400V MKP C2 = 68nF 400V MKS Semiconductors D1,D2 = 1N4007 D3 = BY329 Dll = diac D30 (al- ternative: ER900 or DB3) TH1 = TIC126N Miecellaneous 3 pcs 6.3-mm (0.25") Fast-on (spade) terminal plugs, PCB mount PCB 120601-1, see [1] better running of the engine and the improved fuel consumption. ( 120601 ) Internet Link [1] www.elektor.com/120601 Connection Details for the CDI Unit Motoplat: black coil with a red CDI unit Prufrex: blue/gray/red coil with a blue CDI unit Motoplat a = yellow b = blue c = red Prufrex a = black b = red c = blue The connection details are shown on top of the CDI unit. Should you connect the red and blue wires the wrong way round you won't get a spark, and you won't damage the coil or CDI unit. www.elektor-magazine.com | July & August 2013 73 •Projects Simple Servo Tester Basic test gear for modelers By Bernhard Kaiser and Michael Gaus (Germany) When a servo motor starts to malfunction there is generally not much to see from the outside to help diagnose the problem. That's why every modeler's toolbox should have one of these handy units! Figure 1. The circuit uses a dual timer IC. +5V (±> K1 +5V GND X / AJ pi l> 50k R3 | R2 C3 HI4 R1 100n C4 6 1_ 12 8 13 C2 14 vcc THR1 RST1 TRIG1 OUT1 IC1 DIS1 CV1 NE556CN /NOPB THR2 RST2 TRIG2 OUT2 DIS2 CV2 Gr JD ^47n ^47n 10 11 lOu 16V K2 PULS 1 +5V 2 GND 3 Cl O Servo 120474 - 11 Servos are one of the basic components used in all branches of model building. They are small, lightweight, low cost and are remarkably easy to control. Model building servos connect directly to an RF receiver unit. They typically have just three connections: positive supply (+5 V), ground (GND) and control (Pulse) lead, which supplies a control signal to move the servo arm. The signal on this lead is pulsewidth modulated and supplied by the receiver. Positive pulses with a length of 1 ms cause the servo arm to move fully to one end of its travel while 2 ms pulses move the arm fully in the opposite direction. Pulse widths between these limits move the arm to an inter- mediate position proportional to the pulsewidth. A pulsewidth of 1.5 ms centers the arm. The pulse repetition rate is approximately 20 ms i.e. 50 Hz but this rate is not too critical. When you suspect that the model is not behav- ing as it should it could be a problem with the remote control transmitter, receiver or a servo motor. This handy unit allows you to quickly test the servo and eliminate it (or otherwise) from your lines of enquiry. This pulse generator design Figure 2. The ready made PCB makes circuit construction a cinch. COMPONENT LIST Resistors R1 = 220kft R2 = lkft R3 = lOkQ PI = 50kft linear potentiometer Capacitors Cl = lOpF 16V, 7.5mm pitch C2,C4 = 47nF C3 = lOOnF Semiconductors IC1 = NE556CN Miscellaneous K1 = 2-pin pinheader, 0.1" pitch K2 = 3-pin pinheader, 0.1" pitch PCB 120474-1 DesignSpark-project files can be downloaded from [1]. 74 | July & August 2013 www.elektor-magazine.com Servo Tester shown in Figure 1 is one of the basic bread and butter circuits known to almost all engineers. A Two timing circuit The pulse generator is made up of a dual timer chip type NE556, the output pulse width is con- trolled by the position of a potentiometer. The combination of resistor R1 and capacitor C2 in timer 1 of the NE556 produces the repetition rate of the pulse. This timer output signal at pin 5 has an approximately symmetrical mark space ratio. The negative going edge of the output signal is used via C3 to trigger the second timer which then produces a positive going output pulse at pin 9. The width of this pulse is defined by the values of capacitor C4 and the combined resis- tance of R3 and PI. Pot PI thereby gives control of the pulse width. During tests it was found that the circuit with the component values specified here produced a pulse width in the range of 0.5 to 2.6 ms which more than covers the standard pulse width range used by these types of servomotors. For this reason PI should not be turned fully to either end of its travel otherwise the connected servo will go past its intended end position and hit the mechanical stops, possibly damaging the servo. Before the circuit is powered up ensure that the control knob PI is roughly mid position. The pulse repetition rate of the circuit was found to be 18 ms. The vast majority of servos operate with a supply in the range of 4.8 to 6 V. Here the operating volt- age is in the range of 5 to 6 V which can be sup- plied by four AA primary cells or rechargeables. To make a neat job and simplify construction we have made a PCB for this design (Figure 2) which is available from the Elektor Shop [1]. All components have standard (non SMD) outlines so fitting the components should not pose any problems. ( 120474 ) Internet Link [1] www.elektor.com/120474 Advertisement Joe, solutions" UWQUF SOLUTEON5 ON A SINSlE CHIP - SECURITY * Aft keys are managed by an in-circuit crypto processor. * Apps. Secured: Protects your applications from unauthorized mess’ * (rypto File System waitable. www.soclutions.com/proOucts/linux-module jmp y/.\r * p* „ * . * f f * INTEGRATED 1 or 2 Ethernet ports. . EXPANDABLE Add new functionalities in a easy way. FRONT PANELS & HOUSINGS Cost-effective single units and small production runs Customized front panels can be designed effortlessly with the Front Panel Designer. The Front Panel Designer is available free on the Internet or on CD. • automatic price calculation • delivery in 5-8 days • 24- Hour-Service if required Sample price: 34,93€ plus VAT/shipping Schaeffer AG • Nahmitzer Damm 32 • D-12277 Berlin • Tel +49 (0)30 8058695-0 Fax +49 (0)30 8058695-33 • Web info@schaeffer-ag.de • www.schaeffer-ag.de www.elektor-magazine.com | July & August 2013 75 •Projects Slow-Start Stabilizer By Michel Defrance (France) r 1 T 1 ft lL J a * K1 COMPONENT LIST Resistors (SMD 1206) R1 = 3.3kQ R2 = 3.09kft R3 = 2.2kQ R4 = lkQ Capacitors C1,C4 = lOOnF (SMD 1206) C2 = 470nF (SMD 1210) C3 = 10|JF 16V (SMD 1210) C5 = 22|jF 10V (SMD 2312) R3 D3 C4 n b a R2 R4 □ □ rn R1 C3 + □ □ ; D1 D2 1 1. C2 □ — vO O co o • • • 1C • • 1 III • " rM 3 | 2 IC1 = MIC2941AWU TR (TO-263) Semiconductors D1,D2 = LL4148 D3 = LED, low current, shape 1206 D4 = LL4150 Miscellaneous EMI suppression filter type DSS- 6NE52A222Q55B (Murata) PCB # 130173-1, see [1] Your everyday 7805 regulator is not the best choice for powering accurate measurement cir- cuits and A/D converters, mainly because it gen- erates too much noise, and exhibits spurious behavior at power on. Taking our Universal Preci- sion Measuring Interface as an example we have a type MCP3421 A/D converter with a resolution of 18 bits. To be able to exploit the high resolu- tion to the last bit, the supply rail must be abso- lutely stable and free of noise. In addition, the supply voltage should rise slowly when turned on, allowing the components in the measuring circuit to stabilize in terms of bias voltages and temperature. Of course, that can also be accom- plished by using a software timer, but doing so has an effect for a couple of components only. The circuit described here meets all conditions mentioned and can easily serve as a replace- ment for an ordinary 7805, because the circuit board has about the same size, and the connec- tions are identical. That does mean however that everything got designed in SMD technology due to limited space. The regulator used is a MIC2941 from Micrel. It's is a low-dropout regulator in which the output voltage is set using a resistance divider, just as with an LM317. The design is simple but effec- tive. The supply voltage is set by (R1 + R2)/R3, resulting in 5 V here. Diode D4 serves as polarity protection. Furthermore, a bunch of capacitors is present for decoupling and noise suppression. At the output an EMI filter is included (FL1). The DSS6NE52A222Q55B is a 3-pin component 76 | July & August 2013 www.elektor-magazine.com Slow-Start Stabilizer from Murata, containing two coils separated by a capacitor to ground. The delayed appearance of the supply voltage is accomplished by capacitor C3. When the supply is switched on, initially the voltage at junction R2/R3 remains at virtually 0 V. Next, the capaci- tor is charged via R3 charged in a about 20 ms, causing the output voltage to rise slowly (see screendump). Diodes D1 and D2 prevent nega- tive voltage ending up at the regulation input, causing the capacitor to be discharged via R2. The circuit can deliver an output current of at least 1 A. With no cooling however a few tens of mA are possible at an input voltage of 12 V. The PCB artwork is available as a free download of the Elektor website [1]. ( 130173 ) Internet Link [1] www.elektor.com/130173 1440112} iKW flKlOlttO®. Sw Ui 74 3> lMl I— | |v| ^ Hqrm-TnQ f tqtnpfrFi ^ Advertisement Throw off the 8-bit bail and chain! CFA10036 ARM9 + Linux SOM * fast: 454MHz ARMS * jljSD: 4GB to 64GB * Linux mainline Kernel * deep; 1 28/256M6 * U S B/U A RT/S PI/I 2 C ■ 6xADC/8x P WIWC AN * wide; 91/126 GRID * debug/status OLED * $71^01 to $48@05QD Get your project lo market fa$t: lay down a standard SO DIMM connector, snap in a CFA1QQ3G System-On-Module and you instantly have access to tons of GPIO and the power of Linux, Leave the 8-bit dark ages behind. CFA920-TS This tiny, touch-enabled embedded Linux PC is powered by the CFA1 0036 * 800x480 color TFT * resistive touch screen * 10/100 Ethernet + USB ■24 GPIO on OS' * 79 more GP^O on 1 mm *6-diannel aocel+gyro * $140@Q1 to$10S@G50D 108 mm/4. 25 * 13.5mm 0 . 73 ” thick Crystalfontz www. try stalfontz,Com +1 509 892 1200 HeshPro4iO Flush Pro-CC FloshPro2m GangPre43il MSP-GANG GangPru-C~C FtoshPro-CM flush Prn-LM flush Pw-sm USB Flash and Gang Programmers for Texas instruments' MCus MSP43Q, Chipcon CCxx, C2000, St el laris LMxx and ST“ Microelectronics MCUS - 5 TM 32 xx (ARM) ■ can assign wr^e serial nuntoer ' up to 64 USS-FPA programmers can fre connected to one PC program tyruyl devices ermutEanwOUStly MSP-GANG t A MFi P43C 1 Ca ng P'THflrwn-nc - L SB-FPA • » Reliable and the fastest programmer on the market Perfect for production usage. rammers USB-FPA - 1 US 6 -FFA -2 USB'FPA-3 USB-FPA-fl JTAG j sew M5P430Fxx MSP 430 Fm P/SP4JUF-MI MSP43QFBT Elpr o Lroi lip www.elprotronic.com www.elektor-magazine.com | July & August 2013 77 •Projects 8x Relays and Much More Expansion modules for Linux and other controller boards In the April edition we presented an expansion PCB for the Elektor Linux board and mentioned at the same time that this could be used with other controller boards as well. Meanwhile the development team at Embedded Vfs, Projects has been working hard designing a whole raft of extra extension boards that are available from Elektor. As an appetizer, so to speak, here is a card with eight relays. -IN Figure 1. Relay module. By Benedikt Sauter and Jens Nickel The relay module (Figure 1) is driven using the 14-pin Gnublin Connector , just like the Linux Extension Board featured back in April. As an Embedded Extension Connector it is also used on the Xmega Webserver Board from Elektor (see next issue) and we are planning further controller boards equipped with this connector. The expan- sion board is ideal for newbies for whom Linux is (still) too complicated and equally suited to 'power users' who prefer to develop their pro- grams using 'bare metal', in other words without the aid of an operating system. The relay board, like the Elektor Linux board, originated from the firm Embedded Projects, run by Benedikt Sauter [1]. It's one of a whole series of expansion boards (see boxout) that all mate with the EEC connector mentioned above, pro- viding as it does pins for SPI, I 2 C, PWM, analog inputs and digital inputs/outputs. On the other hand, Elektor Labs have been working on modules using a 10-pin expansion connector ( Embedded Communication Connector ) for UART/TTL connec- tions with one another (see boxout). A small zoo is growing up of controller boards and expansion boards that can be combined flexibly— microcon- troller fans can look forward to an interesting time over the coming six months! Relay card The circuit diagram of the relay card can be seen in Figure 2. As with the Linux Extension Board, a port expander PCA9555 (IC1) addressed over the I 2 C bus increases the number of digital outputs available to 16, of which eight are used here. The address of the I 2 C module can be preset using 78 | July & August 2013 www.elektor-magazine.com Expansion modules +3V3 +5V +3V3 © +3V3 © Kll K10 Hi A2 A1 AO 21 R15 I C l | C2 TTu7 llOOn X 24 VI )D 1/00.0 SCL 1/00.1 SDA 1/00.2 1/00.3 1/00.4 1/00.5 1/00.6 IC1 1/00.7 PCA9555D 1/01.0 AO 1/01.1 A1 1/01.2 A2 1/01.3 1/01.4 1/01.5 iNT 1/01.6 1/01.7 VSS 12 10 11 13 14 _1S _ 16 17 _ 18 _ 19 20 K1...K8 = G6D-1A-ASI5VDC Figure 2. Circuit diagram of the relay module. +5V +5V +5V +5V +5V +5V +5V +5V 130157 - 12 www.elektor-magazine.com | July & August 2013 79 •Projects Expansion modules for the Gnublin/ Embedded Extension Connector (selection) 8x relays (130212-91) 4x20 text display (130212-92) Stepping motor driver (130212-93) I/O expander (130212-94) Temperature sensor (130212-95) Distributor board 'Bridge Module' (130212-71) Raspberry Pi adapter 'GnuPi' (130212-72) These and other boards are available from Elektor [2]. In each case the boards come with SMD components preinstalled, with leaded components supplied in the kit for DIY assembly. Raspberry Pi Adapter The Raspberry Pi adapter board 'GnuPi' increases the system's flexibility even further for using expansion boards. It plugs directly into the Raspberry Pi and in turn enables the use of a range of Gnublin/ EEC plug-in connectors [2]. In this way all the expansion boards shown can also be used with the new computer platform that's all the rage. This is neat: the C/C++ API from Embedded Projects can also be used with the Raspberry Pi. To convert a Gnublin/Elektor Linux board application to work on the Raspberry Pi all you need do is alter one single line of code: w #define BOARD GNUBLIN -► #define BOARD RASPBERRYPI jumpers K9 to Kll. Pull-up resistors for the I 2 C bus can be implemented using K13 and K14. The digital outputs IO 0.0 to IO 0.7 of the port expanders each drive a FET, with in turn operates a relay. An LED for each serves as status display. The Gnublin/Embedded Extension Connector is equipped with a 3.3 V pin, which enables the expansion boards to be powered from the controller board. A step-up con- verter (IC2) is built in to provide the 5 V coil voltage for the relay. A length of flat ribbon cable serves to con- nect the controller board and the relay board. The Embedded Projects development gang have already thought about the option of hooking up several expansion boards at the same time; a distributor board (Figure 3) is available from Elektor too [2]. C/C++ API We have already shown in [3] and [4] how you switch the outputs of the port expander ICs in Linux. But there is now an even simpler option. Benedikt Sauter and his comrades-in-arms have written a complete C/C++ API for controlling the expansion cards with great ease. You can incorporate the functions in programs that you write yourself but a number of short command line tools are also available. More on this in the next edition, in which we'll introduce the other extension boards. A first taster of the C/C++ API is given in the listings. Listing 1 shows how you can access the digital inputs and outputs of the Elektor Linux board easily. Listing 2 demonstrates how you can read in values via the analog input. And Listing 3 shows how you operate the relay card. Expansion modules for the Embedded Communication Connector RS485 interface (under development) RS232 interface (planned) 433 MHz radio module (under development) Bluetooth using the BTM-222 (planned) WLAN using the WizFi220 (planned) USB using BOB (planned) More on this subject at the Elektor.Labs website [8]. The new API [5] also clarifies the route into the world of Embedded Linux for beginners, manag- ing without the more complex features of C like, for example, the Pointer. For the names of func- tions the developers have in part borrowed from the corresponding Arduino functions. If you're interested, you are of course welcome to cast a glance at the source code [6]. Debian for the Elektor Linux board Not only has the Gnublin Linux system been enhanced with new hardware but the software side has also been updated. If you feel inclined, 80 | July & August 2013 www.elektor-magazine.com Expansion modules Listing 1: Digital output control on the Elektor Linux board. #define BOARD_GNUBLIN #include “gnublin.h” int main() { gnublin_gpio gpio; gpio . pi nMode (3 , OUTPUT) ; whi le (1) { gpio. di gi talWri te (3 , HIGH) ; sleep (2) ; gpi o.digi talWri te (3, LOW) ; sleep (2) ; } } you can now equip the Elektor Linux board with a Debian system (in place of the ELDK file sys- tem). Debian is very easy to install on the SD card (it doesn't matter whether you are using the 8 MB or 32 MB version of the board); you can find instructions on the Internet [7]. (130157) Internet Links [1] sauter@embedded-projects.net [2] www.elektor.com/gnublin [3] www.elektor.com/120596 [4] www.elektor.com/120518 [5] http://wiki.gnublin.org/index.php/API [6] https://github.com/embeddedprojects/ gnublin-api [7] http://wiki.gnublin.org/index.php/ GNUBLIN-Elektor [8] www.elektor-labs.com/ECC Listing 2: Reading a value on the analog input. #define BOARD_GNUBLIN #include “gnublin.h” int main() { gnublin_adc ad; while(l) { printf(“AD value %i \n” , ad . getValue (1) ) ; } Listing 3: Driving the relay card. #defi ne BOARD_GNUBLIN #include “gnublin.h” int main() { gnubli n_module_relay relay; relay . setAddress (0x24) ; relay . swi tchPi n (4 , ON); sleep (2) ; relay . swi tchPi n (4 , OFF); } www.elektor-magazine.com | July & August 2013 81 •Projects Store it Quickly 2.0 By Jurgen Werner (Germany) Some microcontroller applications require sta- tus information or other important data to be stored to EEPROM immediately as power to the equipment is turned off or fails. When power is resumed this information will then be available for use as required. To solve this problem Rainer Reusch developed a circuit (Figure 1) and it appeared in Elektor magazine as a Design Tip [1]. The principle behind this original circuit is that the voltage at the anode of D1 falls sooner than voltage across reservoir capacitor C2. A comparator evaluates these levels and outputs a signal to the microcontroller indicating that the input voltage has fallen. Thanks to D1 and C2 voltage at the non-inverting input to IC1.A falls faster than the voltage at the inverting input. This produces a Low level at the comparator out- put, triggering an interrupt. As long as there is sufficient energy stored in the reservoir capaci- tor, the microcontroller now has time to store all important data to EEPROM before the supply rail sinks too low. The circuit functions effectively, at least in sim- ple situations. One problem is that it takes a few milliseconds to write data to EEPROM cells. The value of C2 must therefore be larger than is strictly necessary since it must also act as a res- ervoir to supply the regulator when input voltage falls. Apart from that the calculation of Cl, for the ripple voltage is not so easy. Even more of a problem is if the power is supplied from a wall wart type adapter which includes built-in voltage regulation or switch-mode supply. In this case the circuit cannot work because the voltage at the input to R1 does not fall fast enough thanks to the reservoir capacitors integrated into the adapter. These shortcomings led the author to set about tweaking the original design; the result can be seen in Figure 2 which is both a better and simpler solution. The comparator has now been moved to after the voltage regulator. With this configuration we are comparing the input volt- age with the voltage output from the regula- tor. We no longer need the diode in series with the voltage regulator. The reservoir capacitor Cl does not need to be so big now. The biggest improvement however is that now the circuit is not dependant on how quickly the input voltage falls. When the voltage from the power adapter sinks the level on the output of the regulator is held constant by regulator action. When dimen- sioned correctly the voltage divider at the non inverting input of the comparator produces an input voltage lower than the level at the invert- ing input, generating a low output to trigger an interrupt in the microcomputer. The circuit values have been calculated assum- ing the mains adapter has a 9 V output and the voltage regulator produces 5 V. D1 protects the regulator from current flowing in the reverse direction. With Cl equal to 100 pF and a load current of 5 mA the microcontroller has at least 17 ms in which to store data to EEPROM. An edge triggered interrupt is used here. When it is possible to disable power-hungry features of the microcontroller such as any A/D converters, that'll give extra time to store data. ( 120674 ) [1] Store it Quickly! Elektor January 2009, www.elektor.com/080379 82 | July & August 2013 www.elektor-magazine.com The latest on electronics and information technology Videos, hints, tips, offers and more Exclusive bi-weekly project for GREEN and GOLD members Elektor behind the scenes In your email inbox each Friday etetrtor g post ©ektor QDDttirffl SonnaDO [PsumsD IP© PPC-E4+ * ARM9 400Mhz Fanless Processor * Up to 1 GB Flash & 256 MB RAM * 4.3" WQVGA 480 x 272 TFT LCD * Analog Resistive Touchscreen * 10/100 Base-T Ethernet ' 3 RS232 & 1 RS232/422/485 Port * 1 USB 2.0 (High Speed) Host port *1 USB 2.0 (Highspeed) OTG port * 2 Micro SD Flash Card Sockets * SPI & I2C, 4 ADC, Audio Beeper * Battery Backed Real Time Clock * Operating Voltage: 5V DC or 8 to 35V DC * Optional Power Over Ethernet (POE) * Optional Audio with Line-in/out * Pricing starts at $375 for Qty 1 Hg y™- '•» WindowsCE Designed and Manufactured in the USA the PPC-E4+ is an ultra compact Panel PC that comes ready to run with the Operating System installed on Flash. The dimensions of the PPC-E4+ are 4.8” by 3.0”, about the same as that of popular touch cell phones. The PPC-E4+ is small enough to fit in a 2U rack enclosure. Apply power and watch either the Linux X Windows or the Windows CE User Interface appear on a vivid 4.3” color LCD. Interact with the PPC- E4+ using the responsive integrated touch-screen. Everything works out of the box, allowing you to concentrate on your application rather than building and configuring device drivers. Just Write-lt and Run-lt. www.emacinc.com/panel_pc/ppc_e4+.htm Since 1985 OVER 28 YEARS OF SINGLE BOARD SOLUTIONS ■ O Phone: ( 618) 529-4525 • Fax: (618) 457-0110 • Web: www.emacinc.com Electric Guitar Sound Secrets and technology BEST- SELLER ric Guitar 1 Secrets IUI I. What would today’s rock and pop music be without electric lead and bass guitars? These instruments have been setting the tone for more than sixty years. Their underlying sound is determined largely by their electrical components. But, how do they actually work? This book answers many questions simply, in an easily-understandable manner. For the interested musician (and others), this book unveils, in a simple and well-grounded way, what have, until now, been regarded as manufac- turer secrets. The examination explores deep within the guitar, including pickups and electrical environment, so that guitar electronics are no longer considered highly secret. With a few deft interventions, many instruments can be rendered more versatile and made to sound a lot better - in the most cost-effective manner. 287 pages • ISBN 978-1-907920-13-4 £29.50 •€34.50 •US $47.60 Further information and ordering at www.elektor.com/electricquitar •Projects Another Look at Some Specific Points of the 500 ppm LCR Meter The luxury of precision within everyone's reach Jean-Jacques Aubry, The success of the Ollioules Elektor 500 ppm LCR Meter The enthusiastic, attentive reactions from a great many readers to the publication of this project show that high-quality measuring instruments are still among their favorite constructional projects. The author, Jean-Jacques Aubry, has issued a cor- rection in the French forum [4] — the only signifi- cant error so far noted — for the USB connector and SW1 cut-outs drawing. For the SW1 cut-out, the 1.16 mm dimension should be 0.96 mm. For the J19 cut-out, the 8.03 mm dimension should be 5.39 mm and the 3.97 mm dimension should be 6.61 mm. A corrected drawing has been included in the download on the website, as has a new version of the schematic which corrects a few points of detail. In the components list for the main cir- cuit, J17, listed along with 37, J8, ... should in fact be J9. R81 appears twice; the correct value is 7.5 kft, R81 = 10 kft should be deleted. On the main circuit diagram, R31 = 750 Q. and on the extension circuit, the resistor in series with LED D5 is R8 = 1 kft. And lastly, C30 = 1.5nF 5% NPO. These corrections do not affect the operation of the circuit. The PCB and the ready-to-use mod- ule are unchanged, and as everything is working well, to date (May 23, 2013) there have been no updates since the 3 rd article came out. And while we're talking details, at the start of the "First time Setup" document downloadable from our site, the firmware file is wrongly called LCR3A_ update_Vxxx.hex. The correct name is LCR3A_ firmware_Vxxx.hex. The author will be happy to answer any other questions directly on Elektor's English language forum too, and will gladly discuss points with users of his precision LCR meter. In the three articles describing the LCR meter [1], certain aspects were glossed over, to avoid making the articles excessively long. We propose here to go back over some details that may also be interesting outside the context of the device described. This is the case for a special routine for display- ing icons on a graphics screen, which takes a bit of gymnastics. We're also going to discuss the accuracy of the measurements, the factors affecting accuracy, and errors. Reading this article will only be of any use if you have already also read the three preceding articles - particularly the description of the circuit and measuring principles. Graphics display library Where necessary, the bootloader and firmware use the graphics display (GLCD) to display mes- sages and images. The display's RAM is organized into 128 columns and 8 lines of bytes (64 bits or pixels). Now the height of the elements to be displayed (icons) exceeds 8 bits and they are described using several bytes: the height of the two fonts used is e.g. 11 and 16 bits. All the icons are defined in the file glcd_bitmaps.c (or boot- loader_glcd_bitmaps.c for the minimalist version, minus some of the icons and fonts used by the 84 | July & August 2013 www.elektor-magazine.com 500 ppm LCR Meter firmware). If we want to be able to write in any position, e.g. spanning byte boundaries, and if writing into the GLCD's RAM is done in whole bytes at well-defined addresses, we need to: know the contents of the RAM before writing, and perform some clever calculations between the old and new bytes so as to only modify the required pixels (bits). The number of port lines available for the display means we are obliged to use the serial mode. Unfortunately, this mode does not allow us to read the display's RAM. So we have to create a mirror of the GLCD's RAM in the MCU RAM: uchar xdata GLCD_Array [LCD_C0LS] [ LCD_R0WS] ; These calculations between old and new bytes quickly seem inextricable, as there are so many different cases to resolve. The solution I've adopted consists in representing a column as 64 bits instead of as 8 bytes! This solution requires: 1. Creating an image in the MCU RAM of the columns where each byte represents a single pixel in the GLCD RAM column, hence a value of 0 or 1. uchar xdata Column_Array [ ( LCD_R0WS +1) *8]; // + 1 for 2nd byte of char in last li ne 2 . Creating a routine to read the display column (in fact the mirror) and write, after converting to equivalent bits (0 or 1), into Column_Array []. void GLCD_read_column (uchar col) { uchar rows , pi x , i , j ; i = 0; // read column col, byte after byte for (rows = 0; rows < LCD_R0WS; rows++) { pix = GLCD_Array [col] [rows] ; // write pix, bit after bit for (j = 0; j < 8; j++) { Column_Array [i ] = pix & 0x01; pix >>= 1; i ++ j } } } 3 . Creating a routine to read the contents of Column_Array[], write to the GLCD RAM, and update the mirror: void GLCD_wri te_column (uchar col) { uchar rows, pix, i, j; i = 0; // write column col, byte after byte for (rows = 0; rows < LCD_R0WS; rows++) { pix = 0; // read pix, bit after bit for (j = 0; j < 8; j++) { pix += Column_Ar ray [i ] << j; i++; } if (GLCD_Array [col] [rows] != pix) // only if GLCD RAM byte modified { www.elektor-magazine.com | July & August 2013 85 •Projects } } } GLCD_set_pos ( rows , col); GLCD_Wri teData (pi x) ; GLCD_Array [col] [rows] = pix; // draw in GLCD RAM // update RAM mirror 4 . Creating a routine to display a defined icon in bitmap. This can be done anywhere, whatever its size (within the limits of the display!) void GLCD_show_i con (uchar code *bitmap, uchar width, uchar height, uchar x, uchar y, uchar mode) { } uchar tx, ty, pix, hb, i, j, k; hb = (height - 1) / 8 + 1; // character height in bytes for (tx = 0; tx < width; tx++) // loop for width columns { } GLCD_read_column (tx + x) ; i = y; k = 0; for (ty = 0; ty < hb; ty++) // read hb bytes of icon { pix = ^(bitmap + ty * width + tx) ; // read one byte if (mode == GLCD_PIXEL_OFF) pix = -pix; for (j = 0; j < 8; j++) // write 8 bits of pix to Column_Array { if (mode != GLCD_PIXEL_INV) Column_Array [i ] = pix & 0x01; else Column_Ar ray [i ] A = pix & 0x01; pix >>= 1; if (k == height) break; i ++ ; k++ ; } } GLCD_wri te_column (tx + x) ; 5 . And lastly, creating a write routine for text, which just means writing a succession of icons that are defined in a font. void GLCD_draw_text ( uchar x, uchar y, uchar *text , uchar mode ) { uchar i, posx, posy; uchar *pt; posy = y - font_height + 1; for( pt = text, i = 0; *pt; i++, pt++ ) { posx = x + i * font_width; if( posx + font_width > LCD_C0LS ) { i = 0; posx = x; posy += font_height; } GLCD_show_i con ( font + (*pt - font_offset) * font_charsi ze , font_ width, font_height, posx, posy, mode ); } } 86 | July & August 2013 www.elektor-magazine.com 500 ppm LCR Meter Measurement accuracy The impedance to be measured can be written: Z„ = V„+jV a GR P J q w i sense _ x F + jh X G V V I +V I V I -V I p p (j (j * Q P P Q j I 2 + I 2 p q I 2 + I 2 p q x C 1 R lx sense G V where Gi and Gv are the current and voltage gains of the amplifier chain, and R sense is the IU_converter resistor. Gi - G 1NAm x G buffer x G PGA i x G DAC i Gv = G 7NA128 xG BUFFER x G pga v x G DAC V Hence again, using the series representation of an impedance Z = R s + JF vi +v i g _ p l p Y q l q S I 2+1 2 p q x G PGA i G DAC i ^ sense GpGA V G D ac v X s = V„ /.+K I q p I 2 + I 2 p q p ~q y G PGA i G DAC i R sense GpGA V G D ac v If we ignore the digitizing errors, as explained in the "We need to keep an eye on the gain" paragraph in the first article [1], then: A R s _ AX S X < XG PGA i | A G pga v G PGA i Gpga v + lAV L XG DAC i | A G dac v Gbac* Gdac v + A R sense lAv R sense We can split the overall error into two main parts: • the error due to the inaccuracy in the PGA103 and DAC8811 gains • the error in the true value of the resistors in the IU_converter (calibration error). To this will be added an error due to: • the display (± 1 bit in the last digit) • the residual phase error (after phase error compensation) • the fluctuation caused by amplification noise and stray signals picked up by the measuring leads (power line, etc.) And then the digitizing error will appear in ranges 1 and 8, when the amplitudes of the voltage or current signals become too different through lack of gain. Factors affecting accuracy Gain error According to the BURR-BROWN (TI) documentation for the PGA103 Gain 1 10 100 Typical gain error ±0.005% ±0.02% ±0.05% Max gain error ± 0.02% ±0.05% ±0.2% For ranges 3-6, the PGA103 programmable amplifier always has unity gain and the term A G pga i X G v>n a v G PGA i + 'PGA GpGA V is zero. For ranges 2 and 7, this term introduces a maximum error of ±0.07 % (typically ±0.025 %). For ranges 1 and 8, this term introduces a maximum error of ±0.07 % (typically ±0.025 %). www.elektor-magazine.com | July & August 2013 87 •Projects According to the 77 documentation for the DAC8811C, its max. relative precision is ± 1 LSB Hence the maximum gain error will be ± 1/N, where N is the code defining the final amplifier gain. post_Ampli. step 0 1 2 3 4 5 6 7 N 7 500 8 700 10 000 11 600 13 500 15 500 18 000 20 700 post_Ampli. step 8 9 A B C D E F N 24 000 27 600 32 000 36 900 42 600 49 100 56 700 65 500 When the post_amplification_U and post_amplification_I steps are equal, the term ^G DAC i | AG dac v Gbac* G dac v is zero. Otherwise, it is maximum when one is 0 and the other 1; it then has a value of 1 1 7500 8700 i.e. 0.025 %. Note: Using the B version (DAC8811B) doubles this error. The IU_converter, whose open-loop gain is not infinite, also introduces a measurement error. As the closed-loop gain is <1 in ranges 3-6, its open-loop gain of around 80 dB (10,000) @ 10 kHz introduces an additional error of around 0.01 %. This will be negligible at the lower frequencies. Note: On the computer, the AU2011 program lets you display the gain error value. Phase error The use of a very wide bandwidth (50 MHz) amplifier in the IU_converter and the various phase compensations (described in the downloadable document "First time Setup" [3]) allow us to reduce spurious phase shifts to a minimum. However, they are not completely eliminated. What's more, the phase of the final amplifier is assumed to be independent of the gain, which is only true to a first approximation, as with data between 0x2000 and OxFFFF, its bandwidth is fairly constant (around 8 MHz) within the operating range of the DAC8811. This residual error will have an effect on the value of the secondary parameter, which will be all the more pronounced the closer the component under test's phase is to 0 ° or ±90 °. Calibration error The initial error is that of the precision resistors fitted on the PCB, i.e. ±0.05 %. It is possible to improve this by following the indications given in paragraph 7 Calibrating the resistors in the downloadable document "First Time Setup" [3]. Internet Links & References ( 130174 ) [1] 500 ppm LCR meter, Part 1 www.elektor. com/110758 [2] 500 ppm LCR meter, Part 2 www.elektor. com/130022 [3] 500 ppm LCR meter, Part 3 www.elektor. com/130093 [4] www.elektor.fr/forumLCR 88 | July & August 2013 www.elektor-magazine.com -Jr v j ■ w ■ ■ Professional Quality Trusted Service Secure Ordering GHIIli n I ■fli-ina Curi *»jJrt*ri . Ci ipi lektor PC * r V i l i. Ma i s*»^u CPK'^-MC-iini) > 5*1 qood ip liTfrnr i r T “ nJ PCBChfc, *r ktoi t ITT! smce jsefs havF u: : i reqis^^B fc?ktor ?fr service Elektor Wiaft*! ■■ LjC^ >K 1 «“ ■= ■ V fltlllHI, ■"‘‘fvf, -M«*fOT- HTfl 1* tv*Mr < j'-mj . iL " - M.J,--. Lrt^r Elektor PCB Service at a glance: O 4 Targeted pooling services and 1 non-pooling service o Free online PCB data verification service o Online price calculator available O No minimum order value o No film charges or start-up charges i bnfrw m itfwn n ptifwi Delivery from 2 workina days DESIGNSPARK PCB SPOT THE DIFFERENCE By Wisse Hettinga In line with a strong trend in the industry, Renesas underscore that their latest GR Sakura board is Ardu- ino compatible. This over- view allows you to check for yourself just how far that compatibility goes. Difference #1 Okay, the GR Sakura board is pink! But then, look at the specs— Pink is Power! Difference #2 It's 8 bit, 16 MHz and lim- ited memory of the AVR controller against full 32 bit, 96 MHz and massive memory capacity of the Renesas processor. The real question is, which applications will actually unleash GR Sakura's full potential. Difference #3 The USB Host functionality on the Sakura board shows potential. It is implemented with a Mini-B connector, while a Type-A connector can be fitted on the back side of the board. 1 ) * <083Z OiltfdHI INWdiOOJ NOS It V 3 0 S HO U 00 00 0 0 0 0 k * i)® 0 v r 1 K Si 33 owinaav mw ■ A B I. B BIB BIB U Bill B SB BS^^I l -I P + +6 ► « P + Altfil NI 3QVW 1,11 BIB BBBil ■ f J »S J ptfH- PI STTi PB If 1 BTB, 1 F PI B r B BT HtfOdlVld DN^AiOlOa^ S3lN0yi3313 M3d0 4 ■ I ■ Ki ■ Pd i id h I ri B-i b bb bi own 13QOH oavoa 0 H j 0 0 0 0 0 0 * 0 0 0 Arduino Uno GR Sakura Supply Voltage(s) 5 V processor operating voltage 3.3 V processor operating voltage 5 V board supply voltage USB Type B connector Board runs off USB voltage by default. Mini B connector Type A connector provides Host support Board runs off USB voltage by default Network None Ethernet RJ45 90 | July & August 2013 | www.elektor-magazine.com Spot the Difference ARDUINO UNO vs. GR SAKURA FULL Difference #4 You can't deny that the true power of the Arduino concept is due to the huge and eas- ily accessible program library (at www.arduino.ee), rather than the hardware. However, don't underestimate the pro- gramming options available for the Sakura board either. It has lots of features that come to life once you start using the Cloud Base Com- piler. Just hook up the board to your PC, push the right but- tons— all well documented— and watch the board appear as a new drive connected to your PC. With the new drive a link is provided that takes you straight to the website. If you have an Android phone, have a look at Gadget Director— an easy, 'icon' based program- ming language. Find all the references at www.designspark.com and go to the Design Centers. (130177) Arduino Uno GR Sakura ATmega328 RX63N Processor 8 bit 32 bit 16 MHz operating frequency 96 MHz operating frequency Memory 32 KB Flash of which 0.5 KB used by bootloader SRAM: 2 KB EEPROM: 1 KB 1 MB Flash RAM: 128KB Data Flash: 32 KB MicroSD socket www.elektor-magazine.com | July & August 2013 | 91 Wideband Wien Oscillator By Merlin Blencowe (United Kingdom) \M3jQ This Wien bridge oscillator (after Max Wien, 1866- 1938) produces a low-distortion sine wave of con- stant amplitude, from about 15 Hz to 150 kHz. It requires just four opamps and will work off a single 9-volt battery. Also, unlike most Wien bridge oscillators, it does not require a dual-gang potentiometer for tuning. Op amp IC2b provides an artificial ground so that the circuit will operate from a unipolar supply (9 V battery or power pack). IC2a is the main amplifier for the oscillator. The frequency range is divided into four decades by 2-pole, 4-way rotary switch SW1. Only one arm of the Wien network is varied, but the change in positive feedback that would normally result is compensated for by IClb, which works to bootstrap R2, thereby changing the negative feedback enough to maintain oscillation. A linear change in the resistance of the tuning pot results in a roughly logarithmic change in frequency. To get a more conventional linear change a log-ta- per pot is used wired so that rotating the knob anticlockwise causes frequency to increase. You could use an anti-log pot the other way around if you prefer, but these things are notoriously hard to find. C9 R12 92 | July & August 2013 | www.elektor-magazine.com Test & Measurement IC1A is an inte- grator that moni- tors the amplitude of the output signal and drives an LED (D2). This must be mounted facing the LDR (light dependent resistor) and shielded from ambient light (for example, with a piece of heat- shrink tubing). ICla is then able to control the gain of IC2a so that oscillation is maintained with minimum distortion. The maximum output amplitude of the gener- ator is about 2 V p . p when the LED and LDR are mounted as close as possible. Distortion is less than 0.5 % in the lowest range, and too low for the author to measure in the higher ranges. Any LDR should work, provided its dark resistance is greater than 100 kft. If you do not have an LDR with such high resistance, try increasing R5 until oscillation starts. Breadboarded proto- types of the circuit were built by the author using dual and quad opamp packages, and both work equally well. The DesignSpark schematic and circuit board design files for this project are available for down- loading from www.elektor.com/120330. ( 120330 ) COMPONENT LIST Resistors R1,R2,R3,R6,R10,R11 = lOkft R7 = lOOkft R4,R9,R12 = 100ft R5 = 12kft R8 = lkft P1,P2 = lOkft potentiometer, logarithmic law R13 = LDR, R(dark) >100kft, e.g. Excelitas Tech type VT90N1 (Newark/Farnell # 2568243) Capacitors C1,C5 = lpF solid C2,C6 = lOOnF C3,C7 = lOnF C4,C8 = InF C9-C12 = 47pF 16V, electrolytic, radial Semiconductors D1,D2,D3 = 1N4148 D4 = LED, red, 5mm IC1,IC2 = TL072ACP Miscellaneous SW1 = 2-pole 4-position rotary switch, C&K Compo- nents type RTAP42S04WFLSS K1,K2 = PCB terminal block, 5mm pitch PCB # 120330-1 www.elektor-magazine.com | July & August 2013 | 93 DESIGNSPARK PCB 4 Amps Photovoltaic Charge Controller By T. A. Babu (India) panel, which equates to about 75 watts of power. A charging algorithm called 'pulse time modulation' is intro- duced in this design. The current flow from the solar panel to the bat- tery is controlled by an N-channel MOSFET, Tl. This MOSFET does not require any heat sink to get rid of its heat, as its R D _ S ( 0n ) rating is just 0.024 ft. Schottky diode D1 prevents the bat- tery discharging into the solar panel at night, and also provides reverse polarity protection to the battery. In the schematic, the lines with a sort-of-red highlight indicate potentially higher current paths. The use of solar photovoltaic (PV) energy sources is increasing due to global warming concerns on the one hand, and cost effectiveness on the other. Many engineers involved in power electronics find solar power tempting and then addic- tive due to the 'green' energy con- cept. The circuit discussed here handles up to 4 amps of cur- rent from a solar The charge controller never draws current from the battery— it is fully powered by the solar panel. At night, the charge controller effectively goes to sleep. In daytime use, as soon as the solar panel produces enough current and voltage, it starts charging the battery. The battery terminal potential is divided by resis- tor R1 and trimpot PI. The resulting voltage sets the charge state for the controller. The heart of the charge controller is IC1, a type TL431ACZ voltage reference device with an open-collector error amplifier. Here the battery sense voltage is constantly compared to the TL431's internal reference voltage. As long as the level set on PI is below the internal reference voltage, IC1 causes the MOSFET to conduct. As the battery begins to take up the charge, its terminal volt- age will increase. When the battery reaches the charge-state set point, the output of IC1 drops low to less than 2 volts and effectively turns off the MOSFET, stopping all current flow into the battery. With Tl off, LED D2 also goes dark. There is no hysteresis path provided in the regu- lator IC. Consequently, as soon as the current to the battery stops, the output of IC1 remains low, preventing the MOSFET to conduct further even if the battery voltage drops. Lead-acid bat- tery chemistry demands float charging, so a very simple oscillator is implemented here to take care of this. Our oscillator exploits the negative resistance in transistors— first discovered by Leo Esaki and part of his studies into electron tun- neling in solids, awarded with the Nobel Prize for Physics in 1973. In this implementation, a commonplace NPN tran- sistor type 2SC1815 is used. When the LED goes out, R4 charges a 22-pF capacitor (Cl) until the voltage is high enough to cause the emitter-base junction of T2 to avalanche. At that point, the transistor turns on quickly and discharges the capacitor through R5. The voltage drop across R5 is sufficient to actuate T3, which in turn alters the reference voltage setting. Now the MOSFET again tries to charge the battery. As soon as the battery voltage reaches the charged level once more, the process repeats. A 2SC1815 transis- tor proved to work reliably in this circuit. Other transistors may be more temperamental— we suggest studying Esaki's laureate work to find out why, but be cautioned that there are Heavy Mathematics Ahead. 94 | July & August 2013 | www.elektor-magazine.com Power Supplies D1 MBR1645G As the battery becomes fully charged, the oscil- lator's 'on' time shortens while the 'off' time remains long as determined by the timing com- ponents, R4 and Cl. In effect, a pulse of current gets sent to the battery that will shorten over time. This charging algorithm may be dubbed Pulse Time Modulation. To adjust the circuit you'll need a good digital voltmeter and a variable power supply. Adjust the supply to 14.9 V, that's the 14.3 volts bat- tery setting plus approximately 0.6 volts across the Schottky diode. Turn the trimpot until at a certain point the LED goes dark, this is the switch point, and the LED will start to flicker. You may have to try this adjustment more than once, as the closer you get the comparator to switch at exactly 14.3 V, the more accurate the charger will be. Disconnect the power supply from the charge controller and you are ready for the solar panel. The 14.3 V setting mentioned here should apply to most sealed and flooded-cell lead-acid batter- ies, but please check and verify the value with the manufacturer. Select the solar panel in such a way that its amps capability is within the safe charging limit of the battery you intend to use. The DesignSpark schematic and circuit board design files for this project are available for down- loading from www.elektor.com/110751. ( 110751 ) COMPONENT LIST Resistors R1 = 15kQ R2,R3 = 3.3kft 1% R4 = 2.2MQ R5 = lkft PI = 5kft preset Capacitors Cl = 22pF 25V, radial Semiconductors D1 = MBR1645G (ON Semiconductor) D2 = LED, 5mm IC1 = TL431ACLP (Texas instruments) T1 = IRFZ44NPBF (International Rectifier) T2 = 2SC1815 (Toshiba) (device is marked: C1815) T3 = BC547 Miscellaneous K1,K2 = 2-way PCB terminal block, lead pitch 5mm PCB # 110751-1 www.elektor-magazine.com | July & August 2013 | 95 Con DESIGNSPARK PCB Starting a Schematic Design By Neil Gruending (Canada) Last time I talked about how DesignSpark uses technology files to store configurations settings. In this article we'll start a new project and start a schematic design. We'll start by configuring the DesignSpark libraries and then we'll set up a schematic title block so we can create a nice looking schematic. Figure 1. Inspecting DesignSpark's library paths. Configuring the libraries DesignSpark uses library files to organize all of your design information. Schematic symbols are one library type and PCB footprints are another. They are then combined to make a component library that you can use to place parts and doc- umentation symbols into your design. The only difference between a documentation symbol and a regular component is that a documentation symbol contains either a schematic symbol or a PCB symbol, but not both. If you would like more information about DesignSpark's library system and how it works, there is a good tutorial at [1]. In this article we will make a schematic documen- tation symbol to use a title block in a schematic but before we do that we need to double check DesignSpark's library search paths. You do that by going into the 'Files -> Libraries...' menu and selecting the 'Folders' tab. Here you will see a screen that looks something like Figure 1. You want to make sure that the directory where you are storing your library files is listed as the first item in the 'Folders and Search Order' box which in my case is 'C:\Users\Neil Gruending\ Documents\dspcb2lib\library'. You can reorder the directory list by selecting the directory that you want to move and using the Up/Down but- tons. I would recommend that you don't save any changes or new files into the DesignSpark system default library folders just in case the libraries get overwritten in a future upgrade. Now that the library paths are set up, you can create a new schematic symbol library to store our schematic title block by selecting the 'New Lib...' button on the 'Schematic Symbols' tab. Then select the 'New Item...' button to open up a blank schematic symbol page. For more informa- tion you can review the symbol creation tutorial on the DesignSpark website [1]. Creating a schematic title block I personally always use title blocks on a schematic to make them look much more professional and to help to document a design. DesignSpark is dif- ferent from other packages because schematic title blocks are stored in a schematic component library instead of a template file or technology file which means that DesignSpark will ignore any drawing elements in a schematic technol- ogy file. DesignSpark comes with several title block templates in its Schema library in several different sizes like A4 and Letter, but I prefer to use Tabloid (11 in. x 17 in.) for my designs. I also prefer to use a more traditional documenta- tion area that takes up less of the drawing area. In my last article I showed you how to use tru- etype fonts in a schematic technology file, but there is a downside to using them in a schematic title block. That's because DesignSpark shifts truetype fonts slightly downwards when printing 96 | July & August 2013 | www.elektor-magazine.com Tips & Tricks a schematic to a PDF file. That normally doesn't matter for things like reference designators but in title blocks where text alignment is more impor- tant you'll definitely notice. Therefore I chose to use stroke fonts for my title block, which is shown in Figure 2. I recommend that you name the various text styles so that they're easy to modify later. In my case I ended up with the styles shown in Figure 3. The numbers and letters around the drawing area frame use the text style 'Frame' and the field descriptions use the text style 'Title-small'. Field items use the style 'Title'. Since DesignSpark doesn't support project variables you have to add the text strings to the title block manually, which is why all of the title block fields are blank in the schematic component. Also, you don't have to add these text styles to the schematic tech- nology file because they will be copied into the schematic when you add the title block. Once you've finished editing the title block, save it to the schematic symbol library you created earlier so that we can create a schematic docu- ment symbol. The first step is to open the Library Manager ('File- > Libraries...') and go to the Com- ponents tab. You can create a new component library by selecting the 'New Lib...' button and then create the document symbol by clicking on the 'New Item...' button which will open the 'New Component' window. Here you can give the component a name and select your title block symbol. Unchecking the 'PCB Symbol' check box will make the component a schematic document symbol like we need. Save your changes and let's start a new DesignSpark project. Creating a new project DesignSpark uses projects to collect all of the rel- evant information about a design like schematics and PCB documents in one place. The main reason for using a project is to allow a set of schematic sheets to be linked to a PCB design. The linked schematic sheets can then act as one large proj- ect where global net information is shared and all component designators are unique. Creating a new DesignSpark project is simple. Go into the 'File -> New' menu to open the 'New Design' window, select 'Project' and then press 'OK'. You will then be prompted where to save the new project and then a blank project will be created for you. Now you can add existing files to the project by using the 'Project -> Add Files to Project...' menu. Adding new items to a project is done by opening the 'New Design' window, but before clicking on OK make sure you check the 'Add to Open Proj- ect' box. Conclusion Now that we can cre- ate projects and create nice looking schematic templates, the next step is to start draw- ing your design using components from the DesignSpark librar- ies. You can also cre- ate and use your own libraries with some extra component attri- butes that will make it easier to generate bill of material (BOM) listings later. The title block I've drawn here (Figure 4) is available from my dsppcb2lib project on Bitbucket at [3]. ( 130181 ) Internet References [1] www.designspark. com/tutorial/ components-library- structure-library- manager m PMfrujpMfcm— I C-tars, *»r HE : - - -- . ■ " — : Figure 2. Structure and layout of the schematic title block. Figure 3. Text formatting in the title block. Figure 4. A completed schematic title block. [2] www.designspark.com/tutorial/components- creation-with-symbol-footprint-wizards [3] https://bitbucket.org/neilg/dspcb2lib www.elektor-magazine.com | July & August 2013 | 97 •Labs Celebrate! By Clemens Valens This month we party because Elektor.LABS has passed the 5,000 registered par- (Eiektor.Labs) ticipants mark. Thank you! Also we are happy to start awarding Gold Memberships for outstanding .LABS performers. Another excellent reason to Join Us... * D Return of D Formant Most people posting a project on .LABS limit themselves to a few lines of text and maybe a photograph ora schematic. But not Greek contributor "AChorevas", hell no! Not being an Elektor member this OP con- tacted us to post his d-Formant project on Elektor.LABS, a digital version of the legendary Elektor Formant modu- lar analog music synthesizer from the late seventies. After reading the project sum- mary he kindly provided, we were more than happy to grant him free access to the .labs website. Not even in our wildest dreams did we expect that this would result in fifteen posts containing detailed descriptions, sound samples, sche- matics and source code files. The OP's d-Formant is an all digital sound synthesizer. In the instrument all the ana- log signals of the original Formant got replaced by 16-bit digital streams, while PIC24 microcontrollers have taken the place of the transistors and operational amplifiers. The design is fully modular and offers the patching capabilities of the original Formant, allow- ing the user to rewire sounds on the fly. All the original controls can be implemented, although the prototype has a much simpler and cheaper user interface: an LCD, some pushbuttons and a rotary encoder (that alone is enough for me to like it ;-). To play the synthesizer you can use a standard MIDI keyboard or any other MIDI device capable of sending 'note on' and 'note off' commands. We are definitely going to write about this excellent project in the printed magazine. Meanwhile we have awarded AChorevas a free Elektor Gold Membership. Congratulations! www.elektor-labs.com/node/3124 ( 130098 - 1 ) * Quote from The Evil Dead (1981). www.elektor-labs.com Note: OP stands for Original Poster, the person who started an online project or discussion. OPs who want to have a chance of appearing in the printed edition of Elektor must (regu- larly) check the email address they use to access Elektor. Labs. This is our only means of contact. 98 July & August 2013 www.elektor-magazine.com Desoldering Tip SMD Desoldering Tip If an engineering problem appears daunting and complex that does not always equate to the solu- tion being expensive and/or high tech. Elektor Labs resident Luc Lemmens supplied a valuable tip on a method of desoldering surface mount ICs he found on the Internet. All you need are preci- sion pliers, a short piece of solid copper wire- like electrical installation wire— a decent solder iron and some solder tin, and a pair of tweezers. When desoldering ICs with leads at two oppo- site sides of the case, it is suggested you start by folding the copper wire as shown in the first photo. Make sure the wire contacting the pins is as straight as possible, making sure it touches as many IC pins as possible. Now apply some solder to the wire where heat needs to be transferred (second photo). This improves the heat transfer to the IC pins and the PCB pads significantly. Press the wire on the chip pins as shown in the third photo and heat it with a decent soldering iron, all the while making sure the pins at both sides of the IC are in full contact with the wire. When the solder has melted, quickly remove the IC from the PCB using tweezers. With a little custom folding of the copper wire, even ICs with pins at all four sides of the pack- age can be desoldered using the above method. Shape the copper wire in a similar way, as pic- tured in the fourth image. Watch out for damage to the IC as well as the PCB by overheating, and keep the time you apply heat limited to just melt the solder and be able to securely remove the IC. An IC that's been sub- jected to overheating, meaning it's been soldered on either too long or at an excessive temperature will obviously be DBR (damaged beyond repair). As is the precious circuit board, where too much heat will result in copper pads becoming detached from the PCB surface. Once you get the hang of it and perform this little trick correctly wielding your solder, solder iron and copper wire, you will damage neither IC nor PCB. ( 130099 ) Found on http://youtu.be/dCUSwADP6DE. By Thijs Beckers, Associate Editor www.elektor-magazine.com July & August 2013 99 •Industry 0 0 0 . 00000000 00000090 0000 0 000 W 0 j 000 ------- 0000 0000 (7 J -i ^ ^ - N !> IBk^ 0 0 0 0 0 0 0 d| 0 0 0 000 j^0009 • 0 0 m |0 0 0 0 0 0 0 0 0 a lBBEE l WB H 0 0 ^=S^i 0 9 0 0 0 9 0 0 9 9 0-0 0 0 9 9 ^pi c a. < R 0 0 0 0 H 0 0 0 0- 0 0 0 0 0 0'0 0'0 05 » 5 » 3 * 3 b :9 9 < 0 0 0 -0V0 0 0 0 ■m'ij : ^ mm ? ft 0J| ^2^ Professional PCB Manufacturing How your four-layer PCB gets produced at Elektor PCB Service Dry film / Resist Photo Tool Laminated Copper Epoxy resin and glass-fibre core The technology of manufacturing printed circuit boards professionally has evolved immensely since Elektor published its first "panels" some 50 years ago. In this article we venture into the kitchen of our Elek- tor PCB Service, powered by our production partner Eurocircuits, to check out how we bake our —multi-layer— cakes. Understanding the manufacturing process is sure to enable you to design PCBs that can be produced easier and cheaper while also improving long-term reliability, so that your customers will keep coming back to you. So let's have a look at the manu- facturing process of a 4-layer PCB. Professional PCB manufacturers usually don't manufacture PCBs as one-offs. Instead they combine several circuits onto one large production panel, which is much more efficient to produce and handle throughout the production process. This is often called 'order pooling'. Eurocircuits also produce their PCBs this way. In the illustra- tions you should be able to discern four individual designs combined in a single panel. (1) From Gerber to production data The board designer has prepared his/her track layout on a CAD system (Computer Aided Design). In response to each system using a proprietary data format, the PCB industry developed a standard output (file) structure to ensure a uniform format is used to describe the physical properties of a PCB. This is format is called "Extended Gerber" or "RS274X". The Gerber files define the layers of copper tracks as well as the solder masks and component positions and designations. The first job in the whole process is to check whether the data submitted by a client meets the manufacturing requirements. This is mostly done automatically. Track widths, space between tracks, pads around holes, smallest hole size and the likes are pitched against manufacturability. Once the design is approved, an engineer will output all tool files needed to run the machines that produce and test the PCB. (2) Photo tools for PCB image transfer A laser photo plotter prints the films needed for the production. These are auto- matically developed and held ready for the PCB fabrication process. For every PCB layer one film or photo tool is generated. The films are aligned with each other by punching precisely located alignment holes in each sheet. These holes will align with the alignment pins on the imaging equipment so the different layers of the board will be perfectly aligned. (3) Inner layer imaging To produce the inner layers of a multilayer PCB, manufacturers like Eurocircuits typi- cally start with a panel of laminate, which is an epoxy resin and glass-fiber core with 100 | July & August 2013 | www.elektor-magazine.com Info & Market copper foil pre-bonded onto each side. First the copper is cleaned and the panel is transferred to a clean room to ensure no dust gets onto the surface where it could cause a short or open circuit. The cleaned panel is given a coat of photosensitive film, the photoresist. Next the image on the film is transferred to the PCB by a 'printer' using powerful UV lamps to cure the photoresist through the clear film, thus defining the copper pattern. The bed of the printer has alignment pins matching the holes in the photo tools and panel. The operator positions the first film using the pins, then the coated panel, and then the second film. The pins ensure that the top and bottom layers are precisely aligned. When 'printed', the panel is sprayed with a powerful alkali solution to remove any resist that failed to cure completely. The panel is then pressure-washed and dried. The cop- per pattern is now covered by the cured resist. The operator checks the panel to make sure that the copper surface is clean and all the unwanted resist has been removed. (4) Etching the inner layers The copper layout is now etched using a powerful alkaline solution to dissolve the exposed copper. The process is carefully monitored to ensure that the final conduc- tor widths are exactly as designed. Next, the blue photoresist protecting the copper image is stripped off. The operator checks that all the photo-resist has been removed. (5) Alignment and inspection of inner layers The inner core of our multilayer board is now complete. The operator punches align- ment holes in the panel to align the inner and outer layers. Since there is no way to correct any mistakes on the inner layers once the outer layers are attached, a full inspection is given to the panel. An automatic optical inspection system scans the board and compares it with the digital image generated from the original design data. (6) Bonding the inner and outer layers The outer layers consist of sheets of glass cloth pre-impregnated with uncured epoxy resin ('prepreg') and a thin copper foil. First a copper foil and two sheets of prepreg are placed on the heavy steel base plate. Then the pre-treated core is carefully posi- tioned using the alignment pins. Lastly two more sheets of prepreg, another copper foil and an aluminum press plate are put on top. This stack is loaded into the bond- ing press, which uses heated press plates and pressure to bond the layers of the PCB together. The heat melts and cures the epoxy resin in the prepreg, while the pressure bonds the layers together. The bonding process is computer controlled, so a permanent bond that will last the lifetime of the PCB is ensured. (7) Drilling X-ray drilling of reference holes. Before etching the outer copper layers, all holes for leaded components and vias are drilled. First an X-ray equipped drill is used to locate the drill positions in the cop- per of the inner layers. The machine drills alignment holes to ensure precise drilling through the center of the inner layer pads. Prepare the stacks for drilling To set up the drill the operator first puts a panel of disposable material on the drill bed to keep the drill from tearing the copper foil as it exits at the bottom side. Then he loads the panel and a sheet of aluminum entry foil. www.elektor-magazine.com | July & August 2013 | 101 •Industry Drilling the holes The drilling machine is computer-controlled. The operator selects the correct drilling program. This tells the machine which drill to use at what XY coordinates. The drill uses air-driven spindles which can rotate up to 150,000 rpm. High speed drilling ensures clean hole walls to provide a secure base for plating. Drilling is a slow process as each hole must be drilled individually. So depending on the drill size up to three PCB panels are drilled in one run. The machine selects the drill to use from the drill rack, checks that it is the correct size and loads it into the drill head. Cut-off excess resin During the bonding process excess resin from the prepreg is squeezed to the edge of the panel outside the image area. This is cut off on a computer controlled profil- ing machine. The drilled panel is now ready for plating. (8) Plating - first part First a conductive layer is deposited over the hole walls. The operator clamps the panel into a jig so the panels can be taken through a series of chemical and rins- ing baths, where the hole walls are seeded with micro particles of palladium, and a layer of copper about 1 micron thick can be deposited. The remaining copper is up for "electroplating", a process to deposit a layer of metal onto an electrically con- ductive surface. But first... (9) Outer layer imaging ... the panel is transferred to the clean room again and coated with a layer of pho- toresist, which is hot-rolled onto the copper using a cut-sheet laminator. The opera- tor loads the first film onto the alignment pins, followed by the laminated panel, and finally the second film. After removing the Mylar film protecting the photore- sist, the uncured resist is removed in a developer. The operator checks the panels again to make sure that the copper surface is clean and all the unwanted resist has been removed. Exposed copper (10) Plating - second part Now the boards are electroplated with copper. The operator starts the automated plating line, where the copper surface is cleaned and activated in a number of baths and then electroplated. The whole process is computer controlled to ensure that each panel stays in each bath exactly the right amount of time. To ensure good conductivity through the holes about 25 microns of copper are needed on the hole walls. Due to the way electroplating works, 25-30 microns gets effectively plated onto the rest of the surface tracks as well. Thus starting off with a 17.5-micron copper foil will result in a 40-42 micron copper layer after processing. 102 | July & August 2013 | www.elektor-magazine.com Info & Market For the next step— etching off unwanted copper foil— a thin layer of tin is plated onto the copper. When the plating is completed the operator uses a non-destructive test to check the copper and tin plating for correct thickness. (11) Etching the outer layers Now the outer layers are etched. First the resist covering the unwanted copper is dissolved and washed off. Then a powerful alkaline solution etches away any exposed copper. The process is carefully controlled to ensure sideways etching is prevented, so the finished track widths are exactly as designed. Finally the thin tin coating which used to protect the copper image, is stripped off. (12) Solder mask coating Before applying the solder mask, the panels are first cleaned and brushed to remove any surface tarnish. Then they are loaded into the vertical coating machine which simultaneously covers both sides of the panel with the epoxy solder mask ink. The panel is racked and put through a conveyorized drier which cures the resist just enough to allow it to be printed ("tack-dried"). The operator checks for a complete and even coating. Next, the coated panels are imaged using a UV printer. The operator mounts the photo tool films on the machine and places the panel onto the alignment pins. As with the etching and plating resists used earlier in the process, the UV lamps in the machine cure the ink where the film is clear. This is where solder mask will be on the finished board. The imaged panels are put on a conveyor moving them out of the clean room and into the developer, which strips off the uncured and unwanted resist. The operator checks the alignment of the solder mask on the panel and makes sure there are no traces of ink on the pads or through the holes. To provide a robust and permanent coat the resist gets cured once more in a conveyorized oven. (13) Pad and hole finishing The copper pads and holes for the component wires or terminals do not have solder mask material on them. A solderable surface finish is now applied to protect the copper until the components are soldered onto the board. The image shows a gold finish, which is achieved by chemically depositing 5 microns of nickel onto the cop- per followed by 0.1 microns of gold over the nickel. Under the EU Reduction of Flazardous Substances (RoFIS) legislation, lead cannot be used in the finishes, so gold over nickel is offered, as well as a sterling silver finish or lead-free hot-air leveling. For the last option the panel is lowered into a bath of molten tin. As it is lifted from the bath, hot air jets blast the surplus molten metal from the panel to leave a coating of tin of about 2 microns thick. ENIG finish www.elektor-magazine.com | July & August 2013 | 103 •Industry (14) Hard gold electroplating Electroplated gold is needed for edge connectors getting repeatedly inserted in, and removed from, a bus connector. First, the operator puts protective tape on the board above the connectors. Then he mounts the panel on a horizontal electroplating bath. Between 1 and 1.5 microns of gold are then electroplated over 4-5 microns of plated nickel. (15) Silk screen printing A special inkjet printer is used to print the silk screen directly onto the board. This printer works just like a conventional inkjet printer where minute droplets of ink are sprayed onto the panel to generate the image. Now both the epoxy ink solder mask and the silk screen are finally cured. This takes about 10 minutes using a five-stage conveyorized oven. (16) Routing out the panels The panel is now ready for separating the different PCBs by routing them out. A computer controlled milling machine mills out any small slots or internal cutouts first. Then the milling head automatically picks up a 2 mm cutter, checks the diam- eter and mills around each PCB. (17) Electrical testing At the end of the PCB production process every multilayer PCB is electrically tested against the original board data. A flying probe tester checks each net to ensure that it is complete (no open circuits) and does not short to any other net. A faster method using an Acceler8 machine is optional. This uses 4000 tiny probes like a brush. It builds an electronic map of the PCB from a pre-tested board. Then it compares each board with its map. This cuts test times by 90%. (18) Final inspection In the last step of the process a team of eagle-eyed inspectors carefully check each PCB. If everything is OK, a release note is printed. The PCBs are vacuum-sealed to keep out dirt and moisture. Next they get bubble-wrapped, securely boxed, sealed and shipped out to customers. Now you know how we produce your PCB at elektor PCB Service and what happens after you order it at www.elektorpcbservice.com. In the next installment we will focus on design requirements you have to comply with considering several physical properties of the production process described here. ( 130061 ) Illustrations courtesy of Eurocircuits. Internet Link www.elektorpcbservice.com Eurocircuits are a European based manufacturer of standard technology printed circuit boards. Its headquarters are located in the picturesque Belgian town of Mechelen, while production units are near Aachen in Germany, and in Eger, Hungary. Eurocircuits specialize in providing prototypes and small batch PCBs for designers, product development departments, niche market electronics companies, universities and research institutions. 104 | July & August 2013 | www.elektor-magazine.com An Exclusive Offer in your Email Inbox each Tuesday TAKE ADVANTAGE OF OUR WEEKLY SUMMER DEALS! » / v / \ i ' ' j Register for our FREE Elektor.POST newsletter to receive our weekly Summer Deals* *lf you already receive Elektor.POST you don’t have to act. You’ll automatically receive our Summer Deals. •Industry ByPic Dev Board is Text Oriented The ByPic development board from ByVac is a unique concept in microcontroller development that allows you to "program with text" The Intelligence' is within the IC. This means that no IDE is necessary, no complex C code, no compiling , and no programmer is required, just a serial interface. Build, connect and it's ready to go; simply download your text and the IC will take care of the rest. The concept is ideal for beginners and rapid prototyping as there is no need to learn any complex IDE systems, a free terminal emulator is available. Perfect for 'what if' scenarios and to test out new ideas. The IC is a PIC32MX150F128 that has 128 K of flash, 32 K RAM and operates at 40 MHz. Loaded into the flash is the unique ByPic development system that gives you > .■* *1 4 * A A A ■■ ' s, X X A A l Dtifl a kJi Lfi T ^ n 3! a 5 xl 1 DtGITPiL ^ ~ '♦ -i ■ ^ w _ h ~ tr_ J If * f* & h ml — T)f /i- +y. * ors ; — SlW - uj n POUCP rNA|_Q& IN j. 3 Q hUi GNOUM 1 ^ m n; IO "1 ii D access to all of the internals of the microcontroller without having to know how it all works. As a great confidence booster, once connected to a serial port it gives an 'ok' prompt to let you know everything is working okay. The language will interpret commands typed directly into the IC but will also compile any functions that you write and so you have the interactivity of an interpreted language and the speed of a compiled language. As an example, typing: adc_init(0) will set up ADC channel 0 and print adc_get(0) will get the value of the channel The IC can be purchased on its own to built into your own projects, the BP1 is an Arduino™ shaped board with a large prototyping area that is supplied in kit form. The kit costs just £9.95 and £12.95 with a USB to serial adapter. www.byvac.com (130223-III) USB 3.0/WiFi Mixed Signal Oscilloscope with Protocol Analyzer USBee.com, the website for CWAV, has introduced the first PC-based mixed signal oscilloscope (MSO) integrated with a protocol analyzer utilizing USB 3.0 and WiFi technology. The USBee QX is a 600 MHz MSO with 24 digital channels and 4 analog channels, resulting in the highest integrated MSO in the PC-based test instrument category. While competitive MSOs provide protocol decoders that display data in complex HEX format, the USBee QX utilizes a protocol analyzer to display serial or parallel protocols in human readable format using a packet presentation layout. By eliminating the tedious tasks of constantly converting HEX data to meaningful interpretations, firmware developers and verification engineers are more productive in their debug process, saving man-days or man-weeks of effort. With a large buffer memory of 896 Msamples coupled with data compression capability, the USBeeQX can capture up to 32 days of traces, allowing developers to find and resolve the most obscure and difficult defect. The USBee QX includes popular serial protocols such as RS232/UARTs, SPI, I2C, CAN, SDIO, Async, 1-Wire, and I2S that are typically costly add-ons for benchtop oscilloscopes. In addition, the USBee QX has the unique capability to support any custom protocol, utilizing APIs and Tool Builders that are integrated into the USBee QX software. With protocol packets to wire behavior on a single time correlated screen; external triggering with multiple test instruments are no longer needed, enabling the capture of symptoms and root cause in a single trace. The new WiFi capability in the USBee QX allows the test set-up to be in the lab while the developer or engineer is at their desk. WiFi also creates electrical isolation of the device under test to the host computer. With a price of $2495, the USBee QX is 85% lower price than equivalent benchtop MSOs. Being extremely small, portable, and affordable, every firmware and electronic hardware engineer or firmware developer can have a debug system at their disposal, eliminating wasted time for scheduling lab time or accessing shared test instruments. www.usbee.com (130223-IV) 106 | July & August 2013 | www.elektor-magazine.com C’S'. I *"* <1> ^ramwfrt REM rLEKT&ft l h "“*' IWStrUTO Lh | w Wuiavir « r ,^ r . rtk^t, F*** 4W*t' Ihft>»v IV«te*| ~«,i ~* ***** ntHtnr y Htfcwi ,t * ‘f- r-*l-T,r TathTnenFUjie ;,, W»rrt Sun, WHr. J H4 .** * f * 1 ^ ■*' b* ^“fr-frd j , :ir 4jf nu M ■wn ■ iTAilKO 'l H - 4 -* r 30 (Ih (?] Fascinated by technology’s impact on the future? Check out Tech the Future! r www.techthefuture.com Computing power and global interconnectivity are pushing tech innovation into overdrive. Pioneering technologies and creative workarounds affect even the couch potato 24/7. Tech the Future reports on technology strides that shape the future — yours included. Follow Tech the Future Fundamental Amplifier Techniques with Electron Tubes The ultimate tube amplifier reference book! Amplifier Techniques m Ejjta m * a This book is a must-have for all tube fans and the growing circle of RAFs (retro-audio-aficionado’s)! In a mind blowing 800+ pages Rudolf Moers covers just about everything you need to know about the fundamentals of electron tubes and the way these wonderful devices were designed to function at their best in their best known application: the (now vintage) tube audio amplifier. The aim of the book is to give the reader useful knowledge about electron tube technology in the application of audio amplifiers, including their power supplies, for the design and DIY construction of these electron tube amplifiers. This is much more than just building an electron tube amplifier from a sche- matic made from the design from someone else: not only academic theory for scientific evidence, but also a theoretical explanation of how things work in practice. 834 pages (hard cover) • ISBN 978-0-905705-93-4 £65.00 •€75.00 •US$104.90 Further Information and Ordering at www.elektor.com/electrontubes u •Industry Myriad Open Source RF Project Gets US Backing Richardson RFPD has committed to the Myriad open source RF initiative. The US-based distributor will begin stocking and selling the Myriad-RF-1 board to customers around the world via its website's online store immediately. Myriad was launched in March 2013 as an open source, non-profit initiative to increase access for easy-to-use, low-cost RF hardware and to drive innovation in the sector. Myriad-RF boards use field programmable RF (FP-RF) transceivers to operate on all mobile broadband standards— LTE, FISPA+, CDMA, 2G— including all regional variants; and any wireless communications frequency between 0.3 and 3.8 GFIz, which includes the regulated, licensed bands and unlicensed / whitespace spectra. Lime is seeking to increase involvement and design contribution from the general RF design community — including both hobbyists and professional system designers. Myriad-RF-1 measures approximately 5x5 cm, uses a 5 V power supply and is software configurable to operate from 300 MFIz to 3.8 GHz and on 2G, 3G and 4G communication networks. Pre-built boards will initially retail for $299 or less. "We've had a lot of interest in the project since its launch, and Richardson RFPD's involvement is a great endorsement," said Ebrahim Busherhi, Lime CEO and Myriad-RF creator. "RF has needed an open source model for a long time and as people from outside the RF sector begin to work with such technologies new inventions will come to the fore that overcomes the problems they face, but we had no idea existed." http://myriadrf.org www.limemicro.com www.richardsonrfpd.com (130167-V) R&S High-Performance Vector Signal Generator The R&S SMW200A high-performance vector signal generator from Rohde & Schwarz enables faster time- to-market, improves end-device quality, and exceeds important 2G, 3G and 4G digital standards and applications. Featuring versatile configuration options, the range of applications extends from single-path vector signal generation to multichannel MIMO receiver testing. The R&S SMW200A vector signal generator is the only product on the market that provides a baseband generator, RF generator and real-time MIMO fading simulator in a single instrument. The vector signal generator covers the frequency range from 100 kHz to 3 GHz or 6 GHz, and features an I/Q modulation bandwidth of 160 MHz with internal baseband. Exceptional modulation and RF characteristics make it ideal for developing high-end components, modules and complete products for wideband communications 108 | July & August 2013 | www.elektor-magazine.com news & new products systems such as LTE-Advanced and WLAN IEEE 802.11ac. The generator performs especially well in verification of 3G and 4G base stations, as well as aerospace and defense applications. The R&S SMW200A can be equipped with an optional second RF path for frequencies up to 6 GHz and with a maximum of two baseband and four fading simulator modules, giving users two full-featured vector signal generators in a single unit. Fading scenarios, such as 2x2 MIMO, 8x2 MIMO for TD-LTE and 2x2 MIMO for LTE- Advanced carrier aggregation, can be easily simulated. Previously, this had required complex setups consisting of multiple instruments. Higher order MIMO applications such as 3X3 MIMO for WLAN or 4X4 MIMO for LTE-FDD are easily supported by connecting a third and fourth source to the R&S SMW200A. The R&S SGS100A are highly compact RF sources that are controlled directly from the front panel of the R&S SMW200A. Overall this solution takes up considerably less space with only a total of five height units for 4x4 MIMO receiver tests and provides correctly encoded baseband signals, real-time channel simulation, AWGN generation, and phase-locked coupling of multiple RF paths, if required. Options for every important digital communications standard are available from the start: LTE, LTE- Advanced, 3GPP FDD/HSPA/HSPA+, GSM/EDGE/EDGE Evolution, TD-SCDMA, CDMA2000®/lxEV-DO and WLAN IEEE 802.11a/b/g/n/ac. The standards run directly on the R&S SMW200A— without having to connect an external PC— making it possible to vary signals or specific parameters quickly and easily, as required to test multi-standard radio base stations, for example. www.rohde-schwarz.us (130223-V) mrnvvr Manchester and NRZ Configurable Protocol Decoders Teledyne LeCroy Corporation Manchester and NRZ (non- return-to-zero) configurable protocol decoders enable users to specify a broad range of physical layer characteristics for Manchester- or NRZ-encoded signals. The decoders define the grouping of bits into words, and words into frames, which makes short work of analysis for custom and/or proprietary protocols based on those generic encoding schemes. Decoded information is then shown in a color-coded overlay directly on top of the physical layer waveform. Many of today's data-communication protocols are built on Manchester or NRZ encoding. Protocols like this range from specialized buses such as Digital Addressable Lighting Interface (DALI) for control of building lighting and the Peripheral Sensor Interface 5 (PSI5) used to connect sensors to controllers in automotive applications, to proprietary, custom buses used for non-standardized applications. In all of these cases, basic Manchester and NRZ schemes are modified to create the more complex, specialized protocols. Designers around the globe are developing and debugging systems with these protocols and looking for bus analysis tools to simplify the process. The new protocol decoders aid in the process of designing and debugging such custom protocols by providing broad flexibility in terms of physical layer characteristics, protocol word and frame structure as well as other parameters. Users may specify bit rates from 10 bits/s to 10 Gbits/s. Idle states, sync bits, header and footer information can all be configured to decode custom preambles or CRC details. Decoding is highly flexible: data mode can be in bits or words; viewing in hex, ASCII, or decimal; and bit order may be either LSB or MSB. Decoded information is displayed with a color-coded overlay which expands or contracts as the user adjusts the oscilloscope timebase or zooms in on the waveform for more details. Powerful search capabilities allow users to quickly search long captures of decoded Manchester and NRZ waveforms for specific bus details such as data, sync or interframe gap. Decoded data is conveniently displayed in an interactive table. Clicking on any line in the table opens a zoomed view of that instance in the waveform. teledynelecroy.com/europe (130167-1) www.elektor-magazine.com | July & August 2013 | 109 •Tech The Future Care Robots The future of health care ByTessel Renzenbrink (Elektor Editorial TTF) The second time I met Alice, she was already able to stand up. When she smiled, I involuntarily smiled back. It took a while for me to realize that I was sending nonverbal signals to an entity that was not able to receive them. That says something about the Alice robot, and it says something about me. The facial expressions of the robot are so refined that I responded to them auto- matically as a social being. Johan Hoorn (photo: Waag Society CC BY 2.0) The meeting with Alice took place in the lab of the Services of Electromechanical Care Agencies (SELEMCA) project, which has its quarters at the Free University of Amsterdam [1]. The project team is studying how intelligent systems, such as robots, can interact with their users in a more human manner. The social issue underlying this project is the growing demand for care services. As a consequence of the ageing of the popula- tion, the number of people needing care will keep rising faster than the available number of care professionals. To be able to offer people ade- quate care in future, work is currently underway on technological solutions that could take over some of the care tasks. To make dealing with a technological care system pleasant for users, SELEMCA is developing the human-friendly I-Care system for care services. capabilities. There are also specific functionalities - things that can be meaningful to someone or actions that someone can perform. They collec- tively form the I-Care system, which runs in the background. Finally, there is the interface that makes the I-Care system visible to the outside world." Machines with human capabilities An example of how this layered structure is elab- orated in practice is provided by research into the emotional component of moral reasoning. A robot that acts strictly according to an ethical code will be experienced by humans as coldly rational and therefore threatening. In a scientific article about Moral Coppelia, to which Johan contributed as a co-author, this was illustrated using the cart and footbridge dilemmas [2]. Johan F. Hoorn, who holds doctorates in litera- ture and science, is the principal investigator and project manager of SELEMCA. He was enthusiastic when talking about the goals, achievements and obstacles of the project: "The core of SELEMCA is the scientific investigation of intelligence, emotion and creativity. This is surrounded by a shell of machine code and machine behavior, consisting of a number of programs that can simulate these A cart traveling at dangerously high speed is heading along a railway track towards a group of five people. By throwing a switch, the cart can be directed onto a track where just one person is standing. The choice for the moral agent is to take action to save the lives of five people at the expense of the life of one person, or to allow the cart to continue on its course, resulting in five fatalities. In another scenario, the moral agent is 110 July & August 2013 www.elektor-magazine.com Care Robots standing on a footbridge next to another person. Here again the cart is threatening five people, and this time the choice is whether to throw the one person off the bridge in order to stop the cart. Although taking action results in a five to one ratio of living and dead persons in both cases, people will generally choose to throw the switch but will draw the line at actively throwing someone from a bridge. This is because they do not reason on the basis of purely ethical principles, but also let emotions play a part in their moral decisions. By contrast, a robot with purely rational moral rea- soning will always sacrifice the one person for the benefit of the larger number. People would not like a robot that throws peo- ple off bridges, so Johan and his colleagues are developing a system that integrates emotional intelligence into moral reasoning. Systems of this sort, which simulate human capabilities such as affection, moral reasoning and creativity, are built into I-Care and are expressed in the functions offered to care recipients. If a patient with a bro- ken leg does not want to eat, the robot respects the patient's autonomy and leaves the decision to the patient, but in the case of an Alzheimer patient with reduced autonomy, the robot would offer the food again. Creativity is also a significant aspect. Instead of repeatedly putting the plate in front of the patient, which would probably just provoke more and more resistance, the robot can try an alternative approach, such as taking a spoonful of food and pretending it's an airplane. Alice en DARwIn The interface that makes the I-Care system visi- ble to the outside world is an important element. According to Johan, the interface can take virtu- ally any imaginable form. It can be a robot, a toy, a doll or a virtual agent on a screen, but what's behind it is always the same system. It does not have to look like a person, but it does act like a person. A coffee machine, for example, could act as an avatar of the I-Care system. Users may think that they are working with three different devices, but in fact they are simply interacting with the I-care system in three different mani- festations. After all, the real meaning of "avatar" is a god in human form, such as Vishnu. The Alice robot is one of the avatars in which the I-Care system can manifest itself. Thanks to the human facial expressions of the robot, many users find it a nice way to communicate with the system. However, in terms of physical devel- opment Alice is still at a relatively rudimentary stage. It can stand up, but it can hardly perform any actions. Alice's companion DARwIn-OP, whose name is short for "Dynamic Anthropomorphic Alice en DARwIn-OP Robot with Intelligence - Open Platform", is a (photo: Waag Society cc by 2 . 0) lot more agile and can perform physical tasks. However - as Johan mentioned - robots are not the only type of interface. In the SELEMCA lab they are also working on an interactive bicy- cle. Alzheimer patients are not good at follow- ing therapy programs. After they sit down on a home trainer to get the required exercise, they quickly become distracted and get off the trainer. Johan and his team are developing a virtual environment that gives the patient the feeling of cycling through the city and increases their attention span. The team would like to extend this to allow the patient to cycle virtually alongside a close friend or relative, by estab- lishing an online link to another person, such as the patient's son, who in reality is biking to work. This gives the patient physical exercise together with human contact, without the risk of ending up under a bus. The companion cyclist is visualized on a handlebar screen as an ava- tar. Having the companion act as an interface for I-Care gives the system very human traits. During the day, the I-Care system in its various manifestations cares for the patient without the conscious awareness of the patient. www.elektor-magazine.com July & August 2013 111 Tech The Future Robot Alice DARwIn-OP (photo: Waag Society CC BY 2.0) all the time and there are a thousand commit- tees, but all the committees get in the way of innovation. I don't want committees; I want effective action." "In terms of technology, a lot is already possible with robotics, but there is a lack of cooperation. Alice has well developed facial expressions, but the body of the robot is fairly limited. If you look at DARwIn, the body motion is quite good but it doesn't have any facial expression. The machines developed by the DARPA projects in the USA can kick you without falling over - they recover their balance and keep on walking - but they are totally lacking in creativity. There are all sorts of bits and pieces that work well on their own, but we still don't have an integrated platform. What we need is for all these people to get together and integrate everything that is already possible. You would be amazed at the results - it's unbeliev- able what you could do then." (130039-1) SELEMCA is part of the Creative Industry Scientific Programme (CRISP), with funding from the Netherlands Ministry of Education, Culture and Science [3], We would like to thank the Waag Society for organizing the PhDO - Trust Me, I'm a Robot event and permission to use the photos [4], Internet References Fashioning the future today It's essential to build I-Care as an open, modular platform, according to Johan: "Everything we develop is open and available to the entire world. What we offer is a structure or abstraction, and what you attach to this structure is up to you." That applies equally well to users and developers. If a company in the industry wants to offer its own mod- ule and wishes to screen off part of it in order to make a profit with it, that is possible. "I like to describe the lab as a sort of cathedral with lots of little shops clustered around it, like the ones you see around old cathedrals where you can buy things that communicate the religious mes- sage. In this case, we would like to see interface designers, robotic sens- ing companies and electromechanical companies set up shop around the lab. Almost literally, so that there is face-to-face contact every day and the knowledge about I-Care that we have here can be put into prac- tice by the companies and industrial organizations." "That's the sticking point right now, because things are very quiet on the commercial side. It's a bit strange, because we are certain that there will be market for this in ten years. You hardly need to do any market research, because we worked with the end users in the development process. Care providers and peo- ple in need of care have personally contributed to the concept that we have created here. For the govern- ment, this offers a solution to a grow- ing problem, and for companies it offers a business opportunity, so I don't understand why people are so reluctant to run with it. What we do here arouses more interest in Hong Kong and South Korea than here in Europe. Here everybody says, "Very interesting, really special, good job", but that's it. We lack a real innovation climate. People talk about innovation [1] http://crispplatform.nl/selemca/selemca [2] http://dare.ubvu.vu.nl/bitstream/hand- le/1871/38598/Moral%20Coppelia%20 IBERAMIA%20Proof%2076370442. pdf?sequence=l [3] www.crispplatform.nl [4] http://waag.org/en 112 July & August 2013 www.elektor-magazine.com Choose from print delivery, digital or a combination of both for maximum accessibility. Subscribe to crudloXpress at { www.audioamateur.com today! ^ 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 testing, and vintage audio, then audioXpress is the magazine for you! 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 Audio lamultiLir TuEjg. Soltd stale-, Loudipeaice! Tech V*. . % . A \\v * -V , md ibtf 11“ an er tth frd*ton you roodfe] tMCWTTSia ' ,-r. ■ *ttf- (3* Tha rw#ty rtVMKl y f . ' > - "tin* ' -Kl'Ppfl- unji'flfl.cr ;'l.“ rjn lcjudfch",^rV A£*ic4 tifi ‘ -fl fc"Kj CTOM-OWI 1 rhBJljJflT. VI ■ •! ■ “,l* r. :■ !■*■*, li lx uaCti ( IQU nflc "V'C.u nnn d tu «vj cr k;:.>+ dhi^i boots A S-&S vn'uc. tod^y for Ju 5-1 S 3 $.9 5 , fta boo*!, and many products* com. to Do your to you? Are the words CtUCllO, SCtker technology” music to your ears? " J >' and S Then you should be •Magazine By Jan Buiting, Editor-in-Chief Philips PR9150/PR9151 Surface Roughness Testers Just scratching the surface of 1950s metalworking Most electronics people I know hate machining and mechanical work in general, and most metalworking addicts I know take a dim view of electronics. Historically it's at CAD & CAM where the two interests were seen to get along somehow. Re- cently e and mech are friends in that hot area called 3-D Printing. In the mid-1950s, the Philips Netherlands com- pany was renowned for the outstanding quality of all mechanical assemblies and parts in their test & measurement and communications equipment. This must have been due largely to the scientific foundations laid by the renowned Philips' Physics Labs (Natuurkundig Laboratorium) where some of the most brilliant physicists and mechanical engineers were given total freedom to perfect their art— with no lack of funding either. Again in the mid 1950s Philips was a strong player in the sub-scientific class of test and measure- ment equipment— the stuff you'd find in labora- tories and workshops of the non-hobbyist type. Philips' 'PR' series of equipment was electronic for sure, but not limited to electronics— serving the chemical, medical and mechanical industries and research institutions, which represented a large and lucrative market at the time. Examples include acidity testers and meters for fluids con- ductivity, sound pressure, megavolts, all sorts of gases, vibration, Xrays... you name it. Back in 1952, Philips Physics Labs worker G. W. van Santen got all worked up by the muddle of standards the 'mechies' threw at each other when talking about surface roughness (SR) of finished metal products, let alone expressing SR in values everyone could understand. At one end of the spectrum you had extremely expensive instru- ments operated by a few happy scientists, while at the other end, old hands at metalworking, eyes closed, used their nails to gauge the smoothness of the finish after milling, honing and polishing their workpieces. Remarkably, many of us can perceive surface roughness down to about 40 pm or about the thickness of human hair. 114 | July & August 2013 | www.elektor-magazine.com XXL Roughness confused & defined Here now follows a tale of horror on standards not unlike the Tower of Bable. Try to do a time warp to 1952, okay? Figure 1 shows the profile of a machined sur- face. The drawing is vertically expanded with respect to the length of the workpiece. For the surface roughness to be recorded unequivocally the quantity should be normalized internationally. Regrettably, that is not the case yet. Surface roughness is defined differently in coun- tries, as follows: British standard BS 1134 defines average roughness height (center-line average; C.L.A.) as the standard, with the actual values expressed in micro-inches just as with / 7 rms . • maximum roughness height, H max , i.e. the height difference between the highest peak and the lowest valley. This forms the basis of German standard DIN 4762. H max is expressed in microns. • effective roughness height, h eff or /7 rms , i.e. the square root of the mathematic average of the squared deviations h from the baseline (L, average level), measured over a defined length: h ^ T h 3 ^ + h ^ n American standard ASA B46 mentions / 7 rms throughout, with the value given in micro-inches. • average roughness height. /7 avg , i.e. the mathematical average of the absolute values of the deviations h from the baseline measured over a defined length: + /^2 + ^3 + h n The Dutch High Commission for Standardiza- tion also recommended average roughness height as the standard, arguing that (a) the definition of /? avg is beyond discussion; (b) the term average value is easier to clarify in a workshop; and (c) the quantity can be measured directly with electronic means. Additionally, the difference between /? avg and h eff is negligible in practice. Unit of roughness For smooth (metal) surfaces the micron (micro meter; pm; 10 -6 m) is a fairly coarse unit that's likely to pester users with small numbers. And then the milli-micron sadly is too small giving impractically large numbers. The micro-inch is a good unit in between large and small, as most finished surfaces will be within 1 and 500 micro- inch in terms of surface roughness. For example: smooth surface 0.05 p = 2 p" = 50 mp rough surface 6.3 p = 250 p" = 6300 mp Alas, in countries like Holland where the metric system dominates, a reference standard based www.elektor-magazine.com | July & August 2013 | 115 •Magazine 2 on inches (i.e. a non-metric unit) is unlikely to be adopted. As a workaround the Yu' got proposed as the unit of surface roughness, with these lin- guistic ploys applied: rugosite; ruwheid; 'rough- ness unit' to convince French, Dutch and English speaking users respectively. A surface has a roughness of 1 ru if the aver- age roughness height R avg = 1/40 micron ~ 1 micro-inch. With this problem out of the way ( and a chuckle on the persistent recurrence of the inch) rough- ness classes R x through R 6 were set up along with a set of symbols the people at the lathes and milling machines were supposed to recognize from construction drawings. It was an exten- sive set of solid and open triangles, and solid and open circles to play with and I suppose you could learn them just like we learn our kilo-ohms and milliamps. The PR9150/PR9151 Hey the only difference between the two is the use of American tubes in the PR9151 (like a a 6X4 for an AZ41). Regrettably I've no schematic of the PR9150 or 9151 to share with you. But then I always open up equipment— see Figure 2. Pristine interior after 60 years. Let's guesstimate. The electronics probably amounts to an adjustable input attenu- ator (for roughness classes R2 though R5), an Table 1. PR9150 / 9151 versions Type Meter Scale Measurement Ranges Roughness Samples PR9150/01 PR9151/01 Scale /01 (Fig. 5a) for • comparison; Red= approved, Green = rejected • multiplication (with indicated factor, for SR w.r.t. reference workpiece) 1 - 300 ru, divided in 4 sub ranges Reference piece or PR9180/00 (R a calibration values: 125 - 32 - 8 and 2 ru; 3.2 - 0.8 - 0.2 and 0.05 p) PR9150/02 PR9151/02 Scale /02 (Fig. 5b) calibrated for R a in ru ( = C.L.A. in p"); scale shows SR values recommended as standard I: 50-280 ru II: 10-70 ru III: 3-16 ru IV: 1-4 ru PR9180/00 (see above) PR9150/03 PR9151/03 Scale /03 (Fig. 5c) with decimal division, calibrated for R a in ru. I: 50-250 ru II: 10-60 ru III: 3-16 ru IV: 1-4 ru PR9180/00 (see above) PR9150/04 PR9151/04 Scale /04 (Fig. 5d) calibrated for R t = ^max ^ M I: 5-25 p II: 1-6 p III: 0.3-1. 6 p IV: 0. 1-0.4 p PR9180/02 (R a calibration values: 12.5 - 3.2. - 0.8 and 0.2 p PR9150/05 PR9151/05 Scale /05 (Fig. 5e), calibrated for R a in p I: 1-6 p II: 0.3-1. 6 p III: 0. 1-0.4 p IV: 0.02-0.1 p PR9180/00 (see above) 116 | July & August 2013 | www.elektor-magazine.com ^etwrncd XXL amplifier, a rectifier and a moving coil meter. Can't be wrong much. The electronics is housed in a beautifully made wooden case with a leather carrying handle and a hinged cover. The lot weighs approximately 15 lbs (6 kg). Whenever I open up the case with people around they think I am going to take radiation measurements. The Probe The crux of the instrument is the probe shown diagrammatically in Figure 3. It contains a piezo electric crystal made from barium titanate, secured to the probe case at one side, and ter- minated with a stylus at the other. The stylus is a synthetic sapphire needle with a hardness of 2,000 VPN and an end radius of about 60 pm. This allows the roughness profile of finished sur- faces to be 'probed' down into the deepest valleys (the slopes nearly always exceed 150°). The tip of the stylus can easily be seen and felt. If the PR9150/9151 had a loudspeaker it could probably be used to play Joe Cocker or Janis Joplin records. In practice, the probe is so small it can be used for measurements in holes down to 8 mm diam- eter. It is connected to the instrument with a good length of screened cable terminated in a solid, very high quality plug. The probe (Figure 4) has an elegantly styled Bakelite handle. A dial for each standard Apparently Philips were not too confident in a 'one size fits all' instrument with a uniform ru readout as proposed by what must have been a lot of committees and bureaucrats. Clearly, a case of the industry finding ways to deal with "Wash- ington and Brussels". I was amazed and intrigued to find five different types of PR9150/9151 men- tioned in the manual that came with the first instrument I obtained about two years ago. I've summarized the differences in Table 1. Each version has its own meter scale to suit differ- ent markets, Chief Inspection Officer (CIO) prefer- ences and applications I suppose. Figures 5a-d are an attempt at reproducing the various meter scales from my only copy of the manual. I have PR9151 instrument versions /01, /02 and /05, also three probes (one with a broken stylus), one manual, and one ... Original Calibration Box! While the PR9150 and 9151 aren't rare birds, the calibration box mentioned in the manual is. r o i Q 0.5 r 1 1 * < j o | 1 T 1 I t M I I 1 II M | 1 N 1 | t G /0I a b r° \TY f-LI Q j f 1 50 i . TOO 150 2CQ 550 1 L - L J 1 J ■ J i E 1 m — ms T ' rrr IQ 4 1 20 30 t a . t . "■ ’ ) ■ | 1 * 11 1 | ‘ ‘ a □ SO 60 10 13 14 16 J k J m J 1 - J o M Q rare ■ “1 1 1 2 3 4 c www.elektor-magazine.com | July & August 2013 | 117 •Magazine ESP 2004 Retronics is a monthly section covering vintage electronics including legendary Elektor designs. Contributions, suggestions and requests are welcome; please telegraph editor@elektor.com I was eventually able to get one included with the third PR9151 I came across, which was also the scruffiest. While you can do comparative measurements with the PR9150/9151, Sales dept., CEO, CFO and CCO will insist on having absolute numbers and benchmarks! So you need to calibrate your instrument before taking readings on samples. The PR9128/00 calibration box shown in Fig- ure 6 is made from strong Bakelite. Also note the solid and open triangle symbols to denote four classes of surface roughness. The exact SR values are hand written. I was easily able to see the degree of finishing of the four metal pieces in the box, and feel the grooves due to milling on the two 'roughest' samples. The other two pieces require a bit more effort to tell apart. All pieces have thin chrome plating which does not affect their surface roughness. Anyone have a PR9180/02 box? In practice Having calibrated the instrument using the sam- ples in the box you are supposed to put the probe on the surface to be tested at an angle of 90 degrees with respect to the direction of finish- ing. You can move the probe up and down 2-3 times per second over a distance of 1.5 - 2 cm, or have the workpiece turn slowly (say, in a lathe or mill). A minimum probe or object speed of about 4 cm/s is required. The underside of the probe has to touch the surface across the full length. Although the PR9150/9151 has high-pass filters to eliminate the effects of uncontrolled hand movement, some practicing is required to avoid sudden changes in the meter deflection. And yes, the testing is damaging— the stylus leaves scratches. In a rather lengthy chapter in the PR9150/9151 manual Philips conclude that their instruments can achieve an accuracy of about 20%, which is "outstanding, considering that extremely accurate and costly roughness meters achieve about 15% precision due to the non-homogeneous structure of ordinarily finished surfaces". Today, surface roughness (SR) meters are aplenty on Ebay & Co. They use vastly improved technolo- gies over recording bumps with a piezoelectric stylus and a tube or two like they did in 1955. Still, you do not see an awful lot of them around in metal workshops, not even where they do cylinder bore honing and precision polishing. I guess the good old 'thumbnail' method coupled with a solid amount of craftsmanship and experi- ence still hold their own against K-dollars worth of electronics and the Internet. ( 130057 ) 118 | July & August 2013 | www.elektor-magazine.com Android Apps programming step-by-step ml SLM BEST- SELLER jP|f Sdiwart Android Apps *v*r~r l~** m * ®ek«or ^ 6 Kf 0l+ _ *J When it comes to personalizing your smartphone you should not feel limited to off the shelf applications because creating your own apps and programming Android devices is easier than you think. This book is an introduction to programming apps for Android devices. The operation of the Android system is explained in a step by step way, aiming to show how personal applications can be programmed. A wide variety of applications is presented based on a solid number of hands-on examples, covering anything from simple math programs, reading sensors and GPS data, right up to programming for advanced Internet applications. Besides writing applications in the Java programming language, this book also explains how apps can be programmed using Javascript or PHP scripts. 244 pages • ISBN 978-1-907920-15-8 £34.95 •€39.95 •US '$56.40 % Further information and ordering at www.elektor.com/android Create complex electronic systems in minutes using Flowcode 5 flowcode Design - Simulate -Download Flowcode is one of the World’s most advanced graphical programming languages for micro- controllers (PIC, AVR, ARM and dsPIC/PIC24). The great advantage of Flowcode is that it allows those with little experience to create complex elec- tronic systems in minutes. Flowcode’s graphical development interface allows users to construct a complete electronic system on-screen, develop a program based on standard flow charts, simulate the system and then produce hex code for PIC AVR, ARM and dsPIC/PIC24 microcontrollers. {M 7 MB Convince yourself. Demo version, further information and ordering at www.elektor.com/flowcode •Magazine Hexadoku Puzzle with an electronic touch Summer in electronics land does not mean Hexadoku takes a vacation. Try to crack the puzzle on the beach, in an airport lounge— anywhere you think you need to take your mind off the daily grind of reporting, debugging and meet- ing deadlines. Enter the right numbers or letters A-F in the open boxes, find the solution in the gray boxes, submit online, and you automatically enter the prize draw for one of four vouchers. The Hexadoku puzzle employs numbers in the hexadecimal range 0 through F. In the diagram composed of 16 * 16 boxes, enter numbers such that all hexadecimal numbers 0 through F (that's 0-9 and A-F) occur once only in each row, once in each column and in each of the 4x4 boxes (marked by the thicker black lines). A number of clues are given in the puzzle and these determine the start situation. Correct entries received enter a prize draw. All you need to do is send us the numbers in the gray boxes. Solve Hexadoku and win! Correct solutions received from the entire Elektor readership automatically enter a prize draw for one Eurocircuits PCB voucher worth $ 140.00 and three Elektor book vouchers worth $ 60.00 each, which should encourage all Elektor readers to participate. Participate! Before September 1, 2013, supply your personal details and the solution (the numbers in the gray boxes) to the web form at www.elektor.com/hexadoku Prize winners The solution of the May 2013 Hexadoku is: 3D1AE. The Eurocircuits $140.00 voucher has been awarded to Dirk Neerijse (Belgium). The Elektor $60.00 book vouchers have been awarded to Jozsef Nagy (Hungary), Sigrid Scheel (Germany), and Joe Young (Canada). Congratulations everyone! 6 2 4 9 C E 8 E C A 8 B 0 2 A F 5 8 1 5 2 7 B 4 6 8 0 D 9 7 F 6 D 7 E 1 2 C 6 0 B 3 6 0 8 F 4 7 C 7 B 2 E 8 4 5 3 4 9 5 2 D A 6 D 4 1 2 8 A 7 A 8 B E 4 C 6 5 9 D 1 6 A 9 7 2 0 8 9 6 2 E D 8 A 2 5 C 1 9 D 7 6 8 3 F 7 1 B 5 9 9 4 E 7 F 5 6 D c 1 3 8 0 2 B A B A 0 F 1 7 E 2 4 9 5 D C 8 3 6 5 1 2 3 0 9 c 8 6 A E B 4 D F 7 C D 6 8 3 A 4 B 2 F 0 7 E 9 5 1 6 9 4 E 2 8 7 F 1 B c 0 3 A D 5 8 7 3 A 9 1 0 c 5 D 4 E 2 B 6 F D 2 F 1 4 B 5 E 3 6 9 A 8 c 7 0 0 5 B c 6 D A 3 7 2 8 F 1 E 4 9 7 6 9 B 5 0 F 4 8 C 2 3 D 1 A E 1 8 5 0 A 2 3 9 D E 7 4 6 F c B E F A 4 7 C D 1 9 0 B 6 5 3 2 8 2 3 c D 8 E B 6 F 5 A 1 7 0 9 4 A C 1 5 B 6 8 7 E 3 F 2 9 4 0 D F E 8 6 c 4 2 0 A 7 D 9 B 5 1 3 3 0 D 9 E F 1 5 B 4 6 C A 7 8 2 4 B 7 2 D 3 9 A 0 8 1 5 F 6 E C The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. 120 | July & August 2013 | www.elektor-magazine.com Retronics 80 tales of electronics bygones This book is a compilation of about 80 Retronics installments published in Elektor magazine between 2004 and 2012. The stories cover vintage test equipment, prehistoric computers, long forgotten components, and Elektor blockbuster projects, all aiming to make engineers smile, sit up, object, drool, or experience a whiff of nostalgia. IDskii&jrn c-Aytanr m-H ,v> j a jB-i nj-iki* Frt'J-ir . ■ a i*.-1 i : J : C Profiling Tool to ngt tone and usagelf* For more informatro/* WWW visit: www.ccsinfo.com/dealers for www.ccsmfo.com sales©ccsinfo.com 262-522-6500 RFID MIFARE and Contactless Cards in Application Further Information and MIFARE is the most widely used RFID technology, and this book provides a practical and comprehensive introduction to it. Among other things, the initial chapters cover physical fundamentals, relevant standards, RFID antenna design, security considerations and crypto- graphy. The complete design of a reader’s hardware and software is described in detail. The reader’s firmware and the associated PC software support programming using any .NET language. The specially developed PC program, “Smart Card Magic.NET”, is a simple development environment that supports sending commands to a card at the click of a mouse, as well as the ability to create C# scripts. Alternatively, one may follow all of the examples using Visual Studio 201 0 Express Edition. Finally, the major smart card reader API standards are introduced. 484 pages • ISBN 978-1-907920-14-1 £44.90 • €49.90 •US$72.50 Gerard's Columns Penny Wise and Pound Foolish By Gerard Fonte (USA) What this means is that the larger concerns are neglected in favor of the small or immediate concerns. This is a common human trait. It's much easier to address small, urgent problems than big, important ones Up in Smoke Hobbyists are perpetually short on cash (me too). So we try to do the most with the least. There's nothing wrong with this unless you end up spending more over time by trying to cut corners. A classic example of this is the humble power supply. I'll bet that the large majority of readers don't have a dedicated, adjustable voltage, current limited power supply for their bench. I didn't for a very long time. I used the typical cheap ones based on the ubiquitous three-terminal regulators. And I accepted the occasional fried component when I made a wiring error. But these smokers add to the cost of using a non-current regulated power supply. Let's look at the numbers. You spend $20 for a cheap kit. There's no voltmeter so either you have to add one (another $10) or go through the bother of measuring it every time you use it. (How much is your time worth?) Suppose you destroy one $2 part every 3 months. Over 5 years you've blown $40 in parts. Total cost: $70 (including $10 for the meter you finally added because you got so annoyed at having to measure the voltage every time). However, for about $60 you can get a nice current regulated power supply (from a number of on-line sources). It includes a voltmeter and ammeter. (Knowing how much current your project actually draws is very important and useful information.) And by limiting the current to a very low value, there are no more bad smells coming from your circuit when you make a mistake. The point is to examine the future before you make a decision. It's a lot less expensive to buy something marginal now, but it will cost more in the long run. It makes sense to spend more for quality tools that you use a lot (soldering iron, meters, etc.). While you may be able to get by with penny-pinching equipment, the results will be better and faster with superior tools. That also makes your hobby much more fun. Upscale The same thing happens at the other end of the economic spectrum as well. Large companies consistently fail to examine the consequences of short-term decisions. Managers and VPs work hard to provide the largest profit for the year-end report to the share-holders. You can't argue with success, can you? However, the situation is a bit more complex in this situation. Here there is a clear conflict of interest. Human beings are naturally selfish creatures. We all want as much as we can get. And executives often get a sizeable portion of their salaries in the form of performance bonuses. If the company does well that year, they get a big bonus and perhaps a promotion. If the company does poorly, there are smaller pay-outs and maybe it's golden parachute time. Obviously, it is in the best interest of the executive to provide the maximum performance for that year so he or she can get the biggest paycheck. But this may not be the best for the company. For example, the Research and Development (R&D) department rarely shows a profit for any year. In terms of straight economics, R&D is a major drain on the company. Money goes in to support expensive employees (with PhD's) and costly equipment. But no money ever seems to come out. If you are interested in a quick boost to the bottom line, cutting R&D funds is the way to go. The yearly profits are increased in direct proportion to the reduction in R&D. Obviously, this is a very short-sighted approach to increasing the company's profits. However, this is done with regularity. Down to Earth Human nature is amplified with powerful people. Politicians, and the wealthy people that influence them, can manipulate matters on a world-wide scale. But politicians are people, too. They each have an agenda that they think is important. The only way that they can pursue their goals is to be in office. In order to remain in office, they must please the voters on a regular basis. So, naturally, they are under pressure to provide immediate results that will get them re-elected. Important long-term issues that benefit the country are neglected in the urgency to maintain popularity with the political base. Even the issues with global reach are postponed. There are a growing number of academics who think that the human race may face a serious downward population adjustment or even extinction within a century or two (or less). The primary possible causes are: global population, climate change, energy availability, fresh water supplies, nuclear war, or disease (man-made or otherwise). There is no doubt that humans have the power to exterminate themselves by simply being short-sighted. This was not true even a hundred years ago. And while there is some political talk, there's not much action. Square One Curiously, individuals do have the capability to set and achieve long- term goals at the expense of short-term amusements. You spend four years to get your EE degree, eight for a PhD or twelve for an MD. So while human nature tends to be penny wise, we certainly don't have to be pound foolish. ( 130224 ) 122 | July & August 2013 | www.elektor-magazine.com EAGLE Learning Further information and This book is intended for anyone who wants an introduction to the capabilities of the CadSoft’s EAGLE PCB design software package. After reading this book while practicing some of the examples, and completing the projects, you should feel confident about taking on more challenging endeavors. The book will quickly allow you to: • obtain an overview of the main modules of EAGLE: the schematic editor; layout editor and autorouter in one single interface; • learn to use some of the basic commands in the schematic and layout editor modules of EAGLE; • apply your knowledge of EAGLE commands to a small project; • learn more about some of the advanced concepts of EAGLE and its capabilities; • understand how EAGLE relates to the stages of PCB manufacture; • create a complete project (a proven design from the engineering team at Elektor), from design through to PCB fabrication. 208 pages • ISBN 978-1-907920-20-2 Incl. CD-ROM containing EAGLE 6.4.0 for MS Windows, Linux and Mac £29.50 •€34.50 •US$47.60 Benefit now: Elektor PCB Service offers a permanent 90-day launch discount on new Elektor PCBs! Check www.elektor.com/ocb. for an overview of all Elektor PCBs 'll Circuit Cellar issue PDFs are always available at www.cc-webshop.com. Save $2 off every issue PDF now through the end of July. Use coupon code CCPDF713 PLUS! Want the complete J Dog AT your issue? No problem! Each issue of Circuit Cellar contains: • Analysis of the newest embedded technologies • Electronics engineering insight • Hardware design • Programming tips • Techniques for testing www.cc-webshop.com Ends July31,2013 issue archive? Get a CC Gold USB drive today. It’s packed with every Circuit Cellar issue published through date of purchase. Join the Elektor Community Take out a GOLD Membership now! ektor Your GOLD Membership contains: • 8 Regular editions of Elektor magazine in print and digital • 2 Jumbo editions of Elektor magazine in print and digital (January/February and July/August double issues) • Elektor annual DVD-ROM •A minimum of 10% DISCOUNT on all products in Elektor.STORE • Direct access to Elektor.LABS • Direct access to Elektor.MAGAZINE; our online archive for members • Elektor.POST sent to your email account (incl. 25 extra projects per year) • An Elektor Binder to store these 25 extra projects • Exclusive GOLD Membership card •Projects ^ l R J B 0 " tro,ler Board I i ~ La In *T* f’rViud f ** 1 * 'fri- 1 . niivwn, TEOfc ljri t*TI Iww I'anii U W ‘ M tvrl ***1 pC-j Ljn Iri* : -**<#■■*< Kf afar ALSO AVAILABLE: The all-paperless GREEN Membership, which delivers all products and services, including Elektor.MAGAZINE, online only. * * tun*-* 1 ‘.W-hWHWr \ m " 111 in i* t - r tip ivgiii'vja.. •— ». -hiij .... ,bi ci£ ..... I'!' Ltka.Evmara JnNni. > 4 H 4 . - H t.- 5 £B ! MU BWtfh ll w na a. •jp MW urucMf. tor . *wm. . --4 GMdr. I-- 4 - .. I K ** ! ’ ,w l*|r. jiiv , 4 -£ i ,-/ 1 -mMMS H a #irr "iMaE^i, fen-» t j . ektor IK B ■ ership m < Take out your Membership now at www.elektor.com/member K Cil firt-vitaH Tit#4wqlir«< P*jpi* filler TOFIF [Vi (<*y ■ ■' Lm 5c*-w t«h LOG*™ Iuwpj LuCATk> J-.-rf Jamt ICO'M U«(dSwi K3LH HUX a FWEH trs source rca MflUCH 10 13 ISSUE 173 ROBOTICS _ 1(J * Rotational Inverted BuddaCu Pendulum Checkout HarHiwarft Monitor Electrical Use SffiS. ^1 Time Electronic Arduino Survival Guide Thermal A Modern Morse Coding f for Engineers An MCU-B Network C • H^ty, #. C *.-!,<> r. i 1 Arqwi Jtru^r. ■*L.r„ .-L-’lj All L'wri EE Design Inspiration // HnrrUvAra s Softwre Prototyping // inivoyjiSvt rsoc-Bosed nrajscti // Appllutiafl Ncie Writing /7 Ar*d Merc Subscribe now to the leading computer applications magazine specializing in embedded systems and design! 1 2 issues per year for just Print OR Digital: $50 :: Combo (Print + Digital): $85 Ordering Information ORDERING INFORMATION To order, contact customer service for your region: USA / CANADA Elektor US 111 Founders Plaza, Suite 300 East Hartford, CT 06108 USA Phone: 860.289.0800 E-mail: service@elektor.com Customer service hours: Monday-Friday 8:30 AM-4:30 PM EST. UK / ROW Elektor International Media 78 York Street London W1H 1DP United Kingdom Phone: (+44) (0)20 7692 8344 E-mail: service@elektor.com Customer service hours: Monday-Thursday 9:00 AM-5:00 PM CET. PLEASE NOTE: While we strive to provide the best possible information in this issue , pricing and availability are subject to change without notice. To find out about current pricing and stock , please call or email customer service for your region. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in the magazine. If difficulties in obtaining components are suspected, a source will normally be identified in the article. Please note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Shipping Note: All orders will be shipped from Europe. Please allow 2-4 weeks for delivery. Returns Damaged or miss-shipped goods may be returned for replacement or refund. All returns must have an RA #. Call or email customer service to receive an RA# before returning the merchandise and be sure to put the RA# on the outside of the package. Please save shipping materials for possible carrier inspection. Requests for RA# must be received 30 days from invoice. Patents Patent protection may exist with respect to circuits, devices, components, and items described in our books, magazines, online publications and presentations. Elektor accepts no responsibility or liability for failing to identify such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, discs, and software carriers published in our books and magazines (other than in third-party advertisements) are copyrighted and may not be reproduced (or stored in any sort of retrieval system) without written permission from Elektor. Notwithstanding, printed circuit boards may be produced for private and educational 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 connection 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 with respect to the goods. MEMBERSHIPS Membership renewals and change of address should be sent to the Elektor Membership Department for your region: USA / CANADA Elektor USA P.O. Box 462228 Escondido, CA 92046 Phone: 800-269-6301 E-mail: elektor@pcspublmk.com UK / ROW Elektor International Media 78 York Street London W1H 1DP United Kingdom Phone: (+44) (0)20 7692 8344 E-mail: service@elektor.com O Do you want to become an Elektor GREEN or GOLD Member or does your current Membership expire soon? Go to www.elekt or.c om/member. www.elektor-magazine.com | July & August 2013 | 127 •Store Limited Time Offer for GREEN and GOLD Members! 16°/o DISCOUNT + FREE SHIPPING www.elektor.com/july Ideal reading for students and engineers E Practical Digital Signal Processing using Microcontrollers This book on Digital Signal Processing (DSP) reflects the growing importance of discrete time signals and their use in everyday microcontroller based systems. The author presents the basic theory of DSP with minimum mathematical treatment and teaches the reader how to design and implement DSP algorithms using popular PIC microcontrollers. The author's approach is practical and the book is backed with many worked examples and tested and working microcontroller programs. The book should be ideal reading for students at all levels and for the practicing engineers who may want to design and develop intelligent DSP based systems. 428 pages • ISBN 978-1-907920-21-9 £44.90 • € 49.90 • US $72.50 10 captivating lessons E PIC Microcontroller Programming Using the lessons in this book you learn how to program a microcontroller. You'll be using JAL, a free but extremely powerful programming language for PIC microcontrollers. Assuming you have absorbed all lessons you should be confident to write PIC microcontroller programs, as well as read and understand programs written by other people. You learn the function of JAL commands such as include, pin, delay, forever loop, while loop, case, exit loop, repeat until, if then, as well as the use of functions, procedures and timer- and port interrupts. You make an LED blink, build a time switch, measure a potentiometer's wiper position, produce sounds, suppress contact bounce, and control the brightness of an LED. And of course you learn to debug, meaning: how to spot and fix errors in your programs. 284 pages • ISBN 978-1-907920-17-2 £29.50 • € 34.50 • US $47.60 A whole year of Elektor magazine on a single disk E DVD Elektor 2012 The year volume DVD/CD-ROMs are among the most popular items in Elektor's product range. This DVD-ROM contains all editorial articles published in Volume 2012 of the English, American, Spanish, Dutch, French and German editions of Elektor. Using the supplied Adobe Reader program, articles are presented in the same layout as originally found in the magazine. An extensive search machine is available to locate keywords in any article. With this DVD you can also produce hard copy of PCB layouts at printer resolution, adapt PCB layouts using your favorite graphics program, zoom in / out on selected PCB areas and export circuit diagrams and illustrations to other programs. ISBN 978-90-5381-273-0 £23.50 • € 27.50 • US $37.90 Display, buttons, real time clock and more E Elektor Linux Board Extension This extension board was developed to further propel our Embedded Linux series of articles and the matching GNUblin board. It has a display, buttons, a real time clock and 16 GPIOs. Linux devotees, switch on your solder irons. The Linux extension board includes everything needed to provide the user interface for a wide variety of projects! Module, SMD-populated and tested board, incl. LCD1, XI, K1-K4, BZ1, BT1 for home assembly Art.# 120596-91 £31.10 • € 34.95 • US $50.20 LabWorX 2 E Mastering Surface Mount Technology This book takes you on a crash course in techniques, tips and know-how to successfully introduce surface mount technology in your 128 | July & August 2013 | www.elektor-magazine.com Books, CD-ROMs, DVDs, Kits & Modules Mastering Surface Mount Technology Vincent HimpD Open Source Electronics ■*V&rwkl! A, imitii •i LabWorX 2 ©lektor workflow. Even if you are on a budget you too can jumpstart your designs with advanced fine pitch parts. Besides explaining methodology and equipment, attention is given to SMT parts technologies and soldering methods. Many practical tips and tricks are disclosed that bring surface mount technology into everyone's reach without breaking the bank. A comprehensive kit of parts comprising all SMT components, circuit boards and solder stencils is available for readers wishing to replicate three projects described in this book. 282 pages • ISBN 978-1-907920-12-7 £29.50 • € 34.50 • US $47.60 Ultrasensitive wideband E-smog detector E TAPIR Sniffs it Out! Attention boy scouts, professionals and grandfathers! This ultrasensitive wideband E-smog detector offers you two extra senses to track down noise that's normally inaudible. TAPIR — short for Totally Archaic but Practical Interceptor of Radiation — also makes a nice project to build: the kit comprises everything you need. Even the enclosure, ingeniously consisting of the PCB proper! Using the TAPIR is dead easy. Connect the headphones and an antenna and switch it on. Move it around any electrical device and you'll hear different noises with each device, depending on the type and frequency of the emitted field. Kit of parts, incl. PCB Art.# 120354-71 £13.30 • € 14.95 • US $21.50 OS Hard- and Software for Electronics Applications E Open Source Electronics on Linux If you have ever wanted to take advantage of the expanding field of open source software for electronics and everyday applications, this book is for you. Using the Linux OS, Warwick A. Smith guides you through the world of open source hardware and software, teaching readers to use EDA tools and software that is readily available online, free to download. The hardware projects inside can be built using easily obtainable parts, in the comfort of your own home, on single sided PCBs, or professionally manufactured with output files generated by you. Open Source Electronics on Linux is about changing today's electronics enthusiast into empowered, savvy, discerning engineers capable of building and modifying their creations, be it solely on Linux or in tandem with your current operating system. 272 pages • ISBN 978-1-907920-19-6 £29.50 • € 34.50 • US $47.60 Further Information and Ordering: WWW.elektOr.COm/stOre or contact customer service for your region UK / ROW Elektor International Media 78 York Street London - W1H 1DP United Kingdom Phone: +44 20 7692 8344 E-mail: service@elektor.com USA / CANADA Elektor US 111 Founders Plaza, Suite 300 East Hartford, CT 06108 USA Phone: 860.289.0800 E-mail: service@elektor.com www.elektor-magazine.com | July & August 2013 | 129 •Magazine NEXT MONTH IN ELEKTOR MAGAZINE Compact Audio Power Amp Audio projects have been thin on the ground recently in Elektor. Next month we make amends with the publication of a cracker pow- er amplifier built around a special driver IC from Texas Instruments. Operating at supply voltages up to ±100 V, a single pair of output transistors supplies more than 200 watts con- tinuously into 4 ohms, still maintaining pretty low distortion figures. The compact amplifier board also contains switch-on delay and DC protection circuitry. Numitron Clock Elektor magazine is increasingly home to ad- vanced projects built on the Arduino platform. In this case we strove to blend old and new technologies in a stylish way using an Ardui- no-compatible microcontroller system with some add-ons electronics to drive a couple of Numitron tubes for a digital clock/thermometer. A Numitron is a vintage electron tube that can be used as a seven-segment display. Remark- ably, each segment consists of a filament. Nu- mitrons are generally affordable, and available from several online resources. Xmega Webserver In the next issue we present a versatile micro- controller board designed around a very powerful AVR microcontroller. In terms of I/O we have 4 LEDs, 4 pushbuttons and a (separately installed) display. For interfacing, you can choose between RS485 and various UART/TTL connectors, allow- ing our BOB USB-TTL converter to be connected, for example. The Embedded Extension Connector makes the board pretty versatile. The board also has a Micro SD connector, and there is room for a TCP/IP module that allows web server and other network applications to be realized. Article titles and magazine contents subject to change; please check the Magazine tab at www.elektor.com. Elektor September 2013 edition is published to members on August 13, 2013. See what's brewing @ Elektor Labs 24/7 Check out www.elektor-labs.com and join, share, participate! get started ^ with the LPC800 < O V 30 Printer Head aul Hot Tnm p ent urn f ft iltrft III" r iL._. in ™*» BJjVTT A fatktLIPe ridl T.I+ battery charg-tir / guana... T.imii «». * *■* *• * Amino Id ityic Aap&ritlve o-eiiEina pattern luck 1 120... ***** sleVLor put editors 5* choice '■£ Create a Project C'«tt -a nttt »r tnlir a BtoooMl Get I«Ih- t-r ecpacn S. iVsm pUter Tutors. >.-•? rvv ---I! E>«Kt ^:»«4 t-na! Vpu want to p- 05 -t a project but you arc hot a member? TjfcjTj OfCH ngre *0 1CH() a dCHnptiO" -or your project including 0 diagram and H phct&gr iiph for pv aim atidft And Ertaybft you wiil be granted 130 | July & August 2013 | www.elektor-magazine.com WHY COMPROMISE Technology SPEED v ACCURACY? HAVE IT ALL PicoScope PicoScope 5442A PicoScope 5442B PicoScope 5443A PicoScope 5443B PicoScope 5444A PicoScope 5444B Channels 4 Bandwidth All modes: 60 MHz 8 to 15-bit modes: 100 MHz 16-bit mode: 60 MHz 8 to 15-bit modes: 200 MHz 16-bit mode: 60 MHz Sampling rate - real time 2.5 GS/s 5 GS/s 10 GS/s Buffer memory (8-bit) * 16 MS 32 MS 64 MS 128 MS 256 MS 512 MS Buffer memory (> 12-bit)* 8 MS 16 MS 32 MS 64 MS 128 MS 256 MS Resolution (enhanced)** 8 bits, 12 bits, 14 bits, 15 bits, 16 bits (hardware resolution + 4 bits) Signal Generator Function generator AWG Function generator AWG Function generator AWG 2 Channel models also available * Shared between active channels ** Maximum resolution is limited on the lowest voltage ranges: ±10 mV = 8 bits • ±20 mV = 12 bits. All other ranges can use full resolution. FLEXIBLE RESOLUTION OSCILLOSCOPE ^ !*■ »•■ J Bln »■ ■» A JW-4 4 ■ ■ '■M . . » i cr > * MB PC ' iinmuiiiaim y.-J » » rf , " J ALL MODELS INCLUDE PROBES, FULL SOFTWARE AND 5 YEAR WARRANTY. SOFTWARE INCLUDES MEASUREMENTS, SPECTRUM ANALYZER, SDK, ADVANCED TRIGGERS, COLOR PERSISTENCE, SERIAL DECODING (CAN, LIN, RS232, l 2 C, PS, FLEXRAY, SPI), MASKS, MATH CHANNELS, ALLAS STANDARD, WITH FREE UPDATES. www.picotech.com/PS2l8 CAD CONNECTED PROTEUS DESIGN SUITE VERSION O Featuring a brand new application framework, common parts database, live netlist and 3D visualisation, a built in debugging environment and a WYSIWYG Bill of Materials module, Proteus 8 is our most integrated and easy to use design system ever. Other features include: ■ Hardware Accelerated Performance. ■ Board Autoplacement & Gateswap Optimises ■ 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 ARM MCUs. ■ Polygonal and Split Power Plane Support. - Direct Technical Support at no additional cost. Labcenter Electronics Ltd. 21 Hardy Grange, Grassington, North Yorks. BD23 5AJ. Registered in England 4692454 Tel: +44 (0)1756 753440, Email: info@labcenter.com Visit our website or phone 01756 753440 for more details