www.elektor-magazine.com magazine May 2014 Touchless Gesture Control Interface 3D Pad Wireless Gateways Intelligent Cuelight System for Theaters Microcontroller BootCamp | RGB LED Lamp | Current Probe with Transimpedance Amp Grid Frequency Logger | Elektor Radiation Meter using PC Zero-Electrolytics 555 Timer • PCB Transformer | Mystery Cap I Post Win • Speedy 1200+ Acoustic Modem US$9.00 - Canada $10.00 25274 24965 7 7 WIZnet’s WIZ550io Ethernet module or W5500 chip Your reward? A share of $15,000 in cash prizes and worldwide recognition from WIZnet Circuit Cellar, and Elektor\ Anyone with a WIZ550io Ethernet module or W5500 smart Ethernet chip is encouraged to participate. The competition starts on March 3, 201 4 at 1 2:00 PM EST and ends on August 3, 201 4 at 1 2:00 PM EST. Get started today! WIZnet’s WIZ550io module is a complete Ethernet solution that includes the W5500 smart Ethernet chip (1 0/1 00 MAC/PHY, hardware TCP/IR 32KB RAM buffer) and network interface (transformer and RJ-45) along with built-in MAC and default IP addresses. For technical support: wizwiki.net/forum To purchase: shopwiznet.com or shop.wiznet.eu lektor Sign up for CC.Post to receive announcements and notifications! WIZnet Join the loT revolution by designing an innovative ’Net-enabled electronics system using sensors expo & conference www.sensorsexpo.com June 24-26, 2014 Donald E. Stephens Convention Center • Rosemont, IL Sensing Technologies Driving Tomorrow's Solutions mm Register with code A303C for $50 off Gold and Main Conference Passes * SPECIAL , Subscriber Discount! Ifp'^ Tracks 6 IS 0 0 (!) V Si CHEMICAL & GAS SENSING ENERGY HARVESTING INTERNET OF THINGS M2M MEMS MEASUREMENT & DETECTION POWER MANAGEMENT SENSORS @ WORK WIRELESS Plus+ • Full-day Pre-Conference Symposia • Technology Pavilions on the Expo Floor • Internet of Things • MEMS • High Performance • Energy Harvesting • Wireless Computing t^ S&Co- location with High Performance Computing Conference • Best of Sensors Expo 2014 Awards Ceremony /OGC f — • Networking Breakfasts • Welcome Reception • Sensors Magazine Live Theater • And More! w Featuring Visionary Keynotes: Reimagining Building Sensing and Control Luigi Gentile Polese Senior Engineer Department of Energy, National Renewable Energy Lab Sensors, The Heart of Informatics Henry M. Bzeih Head of Infotainment & Telematics Kia Motors America Innovative Applications. Expert Instructors. Authoritative Content. Tomorrow's Solutions. Register today to attend one of the world's largest and most important gatherings of engineers and scientists involved in the development and deployment of sensor systems. Registration is open for Sensors 2014! Sign up today for the best rates at www.sensorsexpo.com or call 800-496-9877. f in #sensors14 OFFICIAL PUBLICATION: INDUSTRY SPONSOR CO-LOCATED WITH: sensors *Discount is off currently published rates. Cannot be combined with other offers or applied to previous registrations. Contents 8 3D Pad: Touchless Gesture Control Interface An electrode plane PCB, an Arduino Uno, and a shield are the ingre- dients for DYI-ing a circuit that supplies reliable 3-dimensional co-ordinates data. From now on it's wave, don't touch! 18 Wireless Gateways If you do not fancy writing SPI drivers for LPR radio modules, con- sider using an ATmega micro, it's sure to make life much easier as far as programming is concerned. 26 Intelligent Cuelight System for Theaters As opposed to most cuelight systems, this one's got a micro- controller built in to give the Stage Manager very accurate control of timings in a play or performance. Shakespeare would have loved it. 34 Microcontroller BootCamp (2) This month we cut our teeth on di- gital inputs, not necessarily limited to digital signals though as we also venture out to sawtooth waveforms and latchup effects. 42 An RGB LED Lamp Traditional incandescent light sources found in night clubs, stage lighting, car instrument panels and interior room lighting have all benefited from a semi-conductor makeover. Here we add the conve- nience of a ready made hand-held remote controller. 48 Current Probe with Transimpedance Amp To make precise measurements of alternating currents we use a wide variety of ferrite cores in conjunc- tion with a simple circuit incorpora- ting a transimpedance amplifier. 52 Grid Frequency Logger Our popular Grid Frequency Monitor now gets extended and adapted to supply a stream of data enabling a log file to be compiled. 58 Elektor Radiation Meter using PC Here Reinier Ott explains his me- thods of migrating the hugely po- pular Elektor Radiation Meter from ATmega to PIC, with some pretty impressive results. 74 Zero-Electrolytics 555 Timer There's nothing scary or odd about using giga-ohm resistors, in fact for our application they are much preferred over leaky wide-tolerance electrolytics. 4 | May 2014 | www.elektor-magazine.com Volume 40 - No. 449 May 2014 • Labs 64 PCB real estate 'transformed' Does it take copper to build a power transformer? Yes, but not necessarily one with wire. 66 What's up with this cap? (2) So what was that '105' print on last month's mystery capacitor all about in relation to '104' on the flip side? 68 Post and Win This month: Join our live Q & A sessions on popular projects from the labs; Why copy/paste may not work on the labs website. • DesignSpark 70 DesignSpark Tips & Tricks Day #10: Custom Outline Models It's quite instructive to see what happens if you import a PCB back into a 3D model. 72 Unijunction Transistors Weird Components— the series • Industry 76 News & New Products A selection of news items received from the electronics industry, labs and organizations. • Regulars 80 Retronics Speedy 1200+ Acoustic Modem (1984). A well-researched, critical recollection of digital communi- cations over the telephone in the pre-internet age. Series Editor: Jan Buiting. 84 Hexadoku The Original Elektorized Sudoku. 85 Gerard's Columns: Appearing Strong A column or two from our colum- nist Gerard Fonte. 90 Next Month in Elektor A sneak preview of articles on the Elektor publication schedule. www.elektor-magazine.com | May 2014 | 5 Community Volume 40, No. 449 May 2014 ISSN 1947-3753 (USA /Canada distribution) ISSN 1757-0875 (UK / ROW distribution) www.elektor.com Elektor Magazine is published 10 times a year including double issues in January/February and July/August, concur- rently by Elektor International Media 111 Founders Plaza, Suite 300 East Hartford, CT 06108, USA Phone: 1.860.289.0800 Fax: 1.860.461.0450 and Elektor International Media 78 York Street London W1H 1DP, UK Phone: (+44) (0)20 7692 8344 Head Office: Elektor International Media b.v. PO Box 11 NL-6114-ZG Susteren The Netherlands Phone: (+31) 46 4389444 Fax: (+31) 46 4370161 USA / Canada Memberships: Elektor USA P.O. Box 462228 Escondido, CA 92046 Phone: 800-269-6301 E-mail: elektor@pcspublink.com Internet: www.elektor.com/members UK / ROW Memberships: Please use London address E-mail: service@elektor.com Internet: www.elektor.com/member USA / Canada Advertising: Peter Wostrel Phone: 1.978.281.7708 E-mail: peter@smmarketing.us UK / ROW Advertising: Johan Dijk Phone: +31 6 15894245 E-mail: j.dijk@elektor.com www.elektor.com/advertising Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic and edu- cational use only. All drawings, photographs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, DVDs, software carriers, and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopy- ing, scanning 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 fail- ing to identify such patent(s) or other protection. The Publisher disclaims any responsibility for the safe and proper function of reader-assembled projects based upon or from schematics, descriptions or information published in or in relation with Elek- tor magazine. © Elektor International Media b.v. 2014 Printed in the USA Printed in the Netherlands New and old are relative Recently I bought a Bluetooth audio receiver device for the price of two Elektor magazines. It pairs to my smartphone or PC and outputs a stereo audio signal through a pair of RCA sockets. I am using it to replace the messed up RF and IF sections of a 1960s tube radio I was given. Although I should have been able to repair the 2- and 3-tube sections, the cost and time involved is no match against dropping the Bluetooth device in the huge wooden case, and wiring it to the volume pot. I effectively disconnected the faulty sections in the radio. Now, it plays my favorite songs, and I can even tune it remotely using the FM radio app on my smartphone. Just as state of the art electronics can provide functionality equivalent to, or surpassing, old technology, the reverse process also applies occasionally. I am referring to the 3D Touch Pad project in this issue— where a good old 4046 phase locked loop IC from the early 1980s is the key component in a system that might be part of the next generation of smartphones or tablets. After typing, speaking, touching and swiping keyboards, screens and pads, you can now look forward to gesturing to get your smart device to understand your commands and selections. With some practicing of course. A version of the project, OotsideBox, is now about to apply for crowdfunding. I am also happy to publish afterburner articles on two of our most exciting and popular projects, the Improved Radiation Meter and the Grid Frequency Ana- lyzer. Both started out as modest, all-experimental setups with their respective authors. After post engineering by labs and publication in the magazine they got a warm reception from the Elektor crowd and beyond, witness the number of kits sold and the flood of responses and discussions on our forums. The Radiation Meter now appears with a PIC in control, while the Grid Frequency Analyzer is extended with a logger function. Speaking of the Elektor forums, they have been restyled, cleaned and relocated to forum.elektor.com. Write access is granted through your Elektor Labs user name and password. Looking forward to seeing your contributions there. Flappy Reading, Jan Buiting, Editor-in-Chief The Team Editor-in-Chief: Publisher / President: Membership Managers: International Editorial Staff: Laboratory Staff: Graphic Design & Prepress: Online Manager: Managing Director: Jan Buiting Carlo van Nistelrooy Shannon Barraclough (USA / Canada), Raoul Morreau (UK / ROW) Flarry Baggen, Jaime Gonzalez Arintero, Denis Meyer, Jens Nickel Thijs Beckers, Ton Giesberts, Wisse Flettinga, Luc Lemmens, Mart Schroijen, Clemens Valens, Jan Visser, Patrick Wielders Giel Dols Danielle Mertens Don Akkermans 6 May 2014 www.elektor-magazine.com Our Network USA Carlo van Nistelrooy + 1 860-289-0800 c.vannistelrooy@elektor.com United Kingdom Carlo van Nistelrooy +44 20 7692 8344 c.vannistelrooy@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 Ferdinand te Walvaart +31 46 43 89 444 f.tewalvaart@elektor.nl Spain Jaime Gonzalez-Arintero +34 6 16 99 74 86 j.glez.arintero@elektor.es Italy Maurizio del Corso +39 2.66504755 m.delcorso@inware.it Sweden Carlo van Nistelrooy +31 46 43 89 418 c.vannistelrooy@elektor.com Brazil Joao Martins +31 46 4389444 j.martins@elektor.com Portugal Joao Martins +31 46 4389444 j.martins@elektor.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 VOICE tal COIL circuit cellar Connects You To Supporting Companies lAT^onix Batronix www.bdtronix.com 23 Cleverscope otovtr I-M-I www.cleverscope.com 57 DLP Design Des far. www.dlpdesign.com 25 Eurocircuits www.elektorpcbservice.com 67 Express PCB www.expresspcb.com 77 Front Panel Express www.frontpanelexpress.com 57 pi GO P' co www.picotech.com/ps242 92 egress pc b npoioiu Pololu * EieciKHfiiet www.pololu.com 63 E25aeli| Saelig UJkii|p HUthKl V www.saehg.com 25 sensors Sensors Expo 2014 www.sensorsexpo.com 3 SID Symposium www.sid.org 47 A *«HKTMIUEt WIZnet ,Vj r »vi J Wii iamMfc! J " LrM www.circuitcellar.com/wiznet2014 23 ft Canf&P&fKsG' SID Not a supporting company yet? Contact Peter Wostrel (peter@smmarketing.us, Phone 1 978 281 7708, to reserve your own space in Elektor Magazine, Elektor«POST or Elektor.com www.elektor-magazine.com May 2014 7 •Projects 3D Pad: Touchless Gesture Control interface point to make the point 43530 “ _i ui K3 O A C LED1 ELS ELI 130508-2 Ul.l LED2 A itn K4 tVI _l U EL4 E61 9335 By Jean-Noel Lefebvre (France) You can easily produce a Touchless Gesture Control interface that's capa- ble of reliably providing 3-dimensional co-ordinates (X, Y, and Z axes). This simple, experimental device, designed in collaboration with the Elektor Labs team, consists of a sandwich made up of a PCB called an electrode plane, an Arduino Uno, and a shield, with control software. Be a part of the new revolution in person/machine interfaces, which began a long time ago with... punched cards, followed by keyboards, screens, joysticks, mice... Today, touch screens are every- where, with so-called 'gesture' control, but using finger contact (to zoom, unlock, etc.) The new step that Elektor is inviting you to take now is touchless interaction, using gestures in the air in three dimensions. This isn't science-fiction— this article is here to prove to you that it's even ... at your very fingertips. Detection principle How about 'projecting' capacitive detection? To detect the proximity of the human body (e.g. the hand or finger), we are going to be making use of a technique known as projected capacitive [3]. This is the principle of virtually all the touch screens on modern phones and tablets— except that here we are going to be detecting gestures in the air, relatively far from the detector surface (10 cm max.) The principle is simple: normally, in our circuits, we expect a capacitor to present 8 May 2014 www.elektor-magazine.com Touchless Gesture Control the least possible leakage of the electrostatic field outside its plates. Well, for our proximity detec- tor, it's just the opposite. We need a capacitor that's as open as possible, built using copper tracks (which we'll be calling electrodes) on an epoxy panel, so as to obtain maximum "hand effect" (Figure la). An oscillator under the influence? The capacitor formed by our electrodes is part of a logic-gate oscillator (Figure lb) whose fre- quency is influenced by the proximity of a hand or finger when it enters the electrostatic field. This intruder in fact forms a third electrode which is going to cut the field lines and divert the elec- trical charges. One of the electrodes, connected to an inverter output, at low impedance, is called emitting. The other, connected to the junction between the resistor R and the inverter input is called receiving ; this is at high impedance (depending on the value of R). Result: the closer the hand approaches the electrodes, the greater the extent to which the capacitance between the electrode diminishes, and the more the oscillator frequency increases. When the hand is 10 cm from the electrodes, the oscillator frequency only varies very slightly— a few hundred ppm at the very most (100 ppm = 0.01%!) Now with this sort of oscillator, the frequency is largely determined by other factors too - in particular, the temperature and supply voltage. So the main challenge in our circuit is to distinguish the very slight variations in the oscil- lation frequency caused by the hand from those resulting from the other influencing factors. One part of this task is entrusted to the software, so it will also read from two reference electrodes that are not (or only slightly) influenced by the hand, but which are subject to all the other factors. "Switching" oscillator As we're not dealing here with a simple proximity detector, but with a system capable of providing co-ordinates in three dimensions (X, Y, and Z axes), our oscillator will be connected to one of six receiving electrodes in turn. This device has four spatialization electrodes: top, bottom, left, right, and two reference electrodes. In the cen- tre of the electrode plane is the single emitting electrode (Figure la). To ensure a good response time for the person/machine interface, the six electrodes will be scanned in turn around 200 times a second, in an operation vaguely akin to Specifications • Touchless 3D gesture detection • Projected capacitance via a plan of four electrodes, Z = 4 inches/ 10 cm • Arduino shield and sketch • Creative Commons license ON TOP SIDE ON BOTTOM SIDE Figure la. The first step in understanding this circuit is to imagine the four electrodes as capacitors: in the center, the common electrode, and around it the 4 spatialization electrodes (top, bottom, left, right) Figure lb. By diverting part of the capacitive field projected by the electrodes, the hand upsets the oscillator frequency. What's it used for? There's a wide range of applications— in the kitchen, for example, to adjust the oven or induction ring controls without touching them with your greasy fingers! In the medical field, when care staff no longer have to touch devices, the risk of nosocomial infections will be reduced. In the huge field of artistic expression, with instruments like the Theremin which are played by using gestures in space. In the gaming field, like Fruit Ninja [1] or Despicable Me— Minion [1]. Instead of touching the tablet screen, you'll soon be able to play with movements of your hand in the air. I'm counting on you and your imagination and impatient to see what you can create around the 3D-Pad! Who is it useful to? Anyone who wants it, as it's a very open design. To make it easier to build and share, and above all to encourage you to express your own creativity, it is presented in the form of a shield for Arduino. All the design documentation, diagrams, and software are Open Source under a Creative Commons CC BY-NC-SA 4.0 License [2]. www.elektor-magazine.com May 2014 9 •Projects Figure lc. Detail of the switched electrode oscillator circuit from Figure 3. Here, the logic circuit is shown configured with the top electrode (EN_TOP = 1) connected to the oscillator. multiplexing. The software's job, at each step in the scanning, is to analyze the oscillator fre- quency with each of the electrodes in turn. Figure lc shows the electrode oscillator in the state it is at the moment the top receiving elec- trode is in circuit. The control signal en_top is high, all the other control signals en_x are low. The three ports IC6A, IC7C, and IC7D now form just a simple inverter. IC6D is also configured as an inverter. So this circuit is equivalent to that of the "easily influenced oscillator" in Figure lb. With a bit of concentration, once you have familiarized your- self with the circuit, you'll be able to find it in the full circuit diagram in Figure 3, by spotting the logical AND and NAND operators (IC6, IC7, and IC8). You'll also see that the switching and receiving electrode (en_x) selection signals come from the Arduino Uno board (top left). The nom- inal frequency of our oscillator, in the absence of hand influence, is set by R9-R14 at around 1.6-1. 8 MHz. Now that we have an oscillator whose frequency varies by a few hundred ppm according to the proximity of a hand, all that remains for us to do is to derive - if possible using a simple solu- tion— from that a signal that can be used for a final application. To do this, we need a frequency comparator comprising: Figure 2. The functions of each of the three boards. r — — — — — — — — — — — — — — — — — — — — — — t P — — — — — — — — — — — — — n 10 May 2014 www.elektor-magazine.com Touchless Gesture Control rQ o K6 o K3 TP2 f ik\/ 1 6_ 5_ 4 -o RST -O +3.3V ■ OV [ATJ • 3 _r\ nwn hq 2 \/im 1 \/im VIN M0D3 ARDUINO CPF OUT SCPF CLEAR A / A r VCOJNH LED1 LED2 AREF GND 13 12 11 10 9 8 7 6 5 4 3 2 TX RX T +5V © SPI CLK SPLDATA DAC CS^ \ MCU_EN_REFA MCU_EN_LEFT \ A MCU_EN_TOP 2 MCU_EN_REFB \ MCU EN RIGHT© MCU_EN_BOT 5 ENOSC SENSE \ K5 SYNC SCOPE© \ 1 MCU_ EN BOT 3 / 'mcu_ EN RIGHT 5 ^ MCU EN REFB 7 ^ MCU EN TOP 9 ^ MCU EN LEFT 11 ^ MCU EN REFA 14 +9V 0 VIN 16 Is JTc J— ' ) CIO 100n VCC VDD IC4 4504D AO BO CO DO EO FO MODE GND 13 2 EN_BOT 4 EN_RIGHT 6 EN_REFB 10 EN TOP 12 EN_LEFT 15 EN_REFA 1 0Ou 16V \ \ \ \ \ 8 A ELEC CENTER TL \EN TOP LED1 R15 K7 -| 470R |- LED2 R16 -| 470R |- +9V © 1 K8 TP3 i IC6.A © IC6 © ELEC TOP ELEC LEFT \EN LEFT ELEC REFA k EN REFA Cl 3 11 IC6.D & IC7.C IC6.B R9 & & 10 Cl 5 lOOn IC7 £ Cl 7 lOOn IC8 £ C16 lOOn +5V IC7.D 12 IC6.C 13 RIO & vIO & 11 R11 & 13 XXX 12 MOD2 130508-2 IC8.A ELEC BOT EN BOT ELEC CENTER BR IC9.A OSC SENSEI 2 OSC SENSE2 4 A ELEC RIGHT EN RIGHT ELEC REFB EN REFB A Cl 4 11 IC8.D & IC7.A IC8.B R12 & & IC7.B IC8.C R13 & O0 & R14 & » XXX 12 © IC9 © C18 lOOn 1C6, IC8 = HEF4011BT IC7 = HEF4081BT IC9 = 74HC50 IC9.C IC9.B v 7 1 6 / IC9.D , N 9 1 10 IC9.E 1 V 1 12 IC9.F 1 ^ 1 15 +5V ©■ TP7 0 \OSC SENSEI \ENOSC SENSE 14 ~± I VDD IC2 CLK 74HC24 RST Q1 Q2 Q3 Q4 Q5 Q6 Q7 VSS .OSC SENSE2 R4 12 11 9 +5V ©■ TP 5 0 14 12 - | 120k | - +5V ©- C5 TTu7 |10V 11 R5 16 Is R1 TP4 0 VDD CIN VCOUT INH SIGIN IC1 PC2 PP PCI CX DEM ZEN HEF4046 rY R2 BT CX R1 VCOIN VSS R2 13 10k Cl 2n2 R3 CPF OUT / T1 l ^22 SCPF CLEAR / 2N7002 +5V © R7 1 V lOOn TP8 0 R6 -| 10k |- R8 C7 u 100n VDD IC3 DOUT SYNC DIN SCLK DAC8311 GND X 1 1 DAC CS 3 SPLDATA 2 SPI CLK 130508 - 11 Figure 3. Full circuit diagram. Top left, the Arduino Uno board and below it, the electrode plane. Everything else is on the Arduino shield. The supply voltage comes from the Arduino Uno board. www.elektor-magazine.com May 2014 11 •Projects Figure 4. The scanning of each electrode generates a sawtooth whose amplitude is an indication of the capacitance detection. • a reference oscillator • a phase/frequency (P/F for short) comparator • a control and locking program. Have you already seen that somewhere before? Yes, these elements, often used for phase-locked loops (PLLs), are found all together in the 4046, a prodigious elderly integrated circuit, well known Figure 5. These three boards together form the (touchless) gesture detection device using projected capacitance. This principle is the same as for the ootsidebox. and widely available. Here, it's not being used as a PLL, but let's see in the block diagram (Fig- ure 2) how the 4046's voltage-controlled oscil- lator (VCO) and P/F comparator are used. The latter compares the signal from the VCO, which is going to be our reference oscillator, with the one from the electrode oscillator, whose frequency is brought down by the prescaler into a range com- patible with that of the VCO, i.e. a few hundred kHz. Proven over decades, this simple system allows us to assess the frequency variations in the oscillator formed by the system of electrodes against the VCO frequency. The conversion of the (small) frequency shift into a variation in a voltage signal will be easy to use later. The VCO frequency is adjusted by way of a digital/ana- log converter (DAC) controlled by Arduino via the SPI port. Now let's see how the scanning sequence runs for each of the electrodes: • Initial situation: electrode oscillator at rest (no en_x signal active), VCO inhibited, no oscillation. P/F comparator output is zero. • A set-point value is applied to the VCO such that its nominal frequency is close to that of the electrode oscillator. This set-point stays the same for the rest of the sequence. • The two oscillators are unblocked and we let the analog signal coming from the P/F comparator change for around 300 ps (i.e. around 30 cycles at 100 kHz) and the scan is stopped so as to capture the analog value by launching an acquisition on Arduino; then the oscillators are blocked again. The result of this scanning sequence (on one electrode) at the output of the P/F comparator is 12 May 2014 www.elektor-magazine.com Touchless Gesture Control an analog signal, a sort of sawtooth (Figure 4a), whose exact shape and above all maximum ampli- tude are a direct function of the frequency dif- ference between the two oscillators. A similar sequence will be produced for each of the receiv- ing electrodes, starting the electrode oscillator with the corresponding en_x signal and applying to the VCO each time the set-point appropriate for this electrode (Figure 4b). Obviously, it's the software that determines this set-point. In the block diagram (figure 2), the signal called "injection", coming from the electrode oscillator prior to prescaling, is sent to the VCO to per- form what we call "injection locking" [4]: when an oscillator injects a small amount of energy into another, it tends to drive the second oscil- lator when certain conditions are met (in par- ticular, their nominal frequencies must be fairly close). The driving oscillator tends to impose its own frequency on the other oscillator. The prin- ciple also works on a harmonic, i.e. a multiple of the fundamental frequency. For our 3D-Pad, the effect of this is to influence the phase rela- tionship between the two oscillators, and thereby the shape of the waveform at the P/F comparator output. The advantage lies in terms of the signal- to-noise ratio and the robustness against EMC interference - this is crucial, given the extreme sensitivity of our system. So even though it is achieved using logic gates, my detector in fact delivers an analog signal. Maybe I'm a bit old-fashioned, but seeing this analog signal directly on the oscilloscope is for me a decided advantage. When you test this circuit for yourself, once you've built it, here's what one of the electrode signals will give: • Start by holding your hand far enough away from the 3D-Pad (at least 6 inches / 15 cm): the software has stabilized the analog value at the end of the sequence at 0.7 V. • Bring your hand closer to the electrodes: the sawtooth amplitude changes from 0.7 V (@ 5 inches / 10 cm) to nearly 5 V @ 0.4 inches / 1 cm! Our 3D-Pad comprises three boards (Figure 5): the Arduino UNO (in version R3 or higher), the main 3D-Pad shield board, and lastly the elec- trode plane. Their different functions are clearly indicated in the block diagram (Figure 2). Circuit Now you know all about how it works, here are a few interesting details about the circuit (Figure 3). If you change the geometry of the electrodes by even a tiny amount, or even the technology used to produce the PCB (the influence of stray capacitances is not negligible), you'll certainly have to adjust the values of resistors R9-R14, which let you adjust the electrode oscillator fre- quencies (IC6, IC7, IC8). If you reduce their value, the frequency goes up: you need to get as close as possible to 100 khlz. Capacitors C13 and C14 are not fitted. Buffers IC9A and IC9B (4050) adapt the voltage level from the oscillator, powered at 9 V, to that of the downstream components, powered at 5 V. The counter IC2 (4024) acts as a prescaler for the osc_sensei signal and supplies a lower fre- quency (sigin) to the P/F comparator IC1. Its Q4 output gives a frequency divided by 16. The signal from its Q3 output (sync_scope) is sent to one input on Arduino. This counter can also (and will) be reset to zero by the (\enosc_sense) signal from the Arduino microcontroller. The VCO and P/F comparator functions are found together in the same 4046 IC (IC1); their two end frequencies are determined by R2, R5, and C2. The electrode oscillator frequency (prior to prescaling) is injected by R4, as per the injection I'm not going to go into details about getting started with Arduino. If you need to familiarize yourself with this versatile tool (as I did before this project), I recommend the following books: Arduino by Gunter Spanner and Mastering Microcontrollers with the Help of Arduino by Clemens Valens [5]. The latter saved me a great deal of time and now has pride of place within easy reach, just next to my soldering iron. And not forgetting the other Elektor articles that have already been published on the subject. www.elektor-magazine.com May 2014 13 •Projects Figure 6. The three boards assembled. Figure 7. An extract from the code of the _3Dpad_sensor sketch, with (on the right) the data sequences corresponding to the movements detected by the four electrodes. locking principle mentioned above. The VCO's set- point voltage comes from IC3, a DAC8311 14-bit DAC, itself controlled by Arduino. The resistor net- work R6, R7, and R8 that the DAC output voltage passes through before reaching the VCO set-point input makes it possible to avoid the 4046's loss thresholds— i.e. a minimum voltage below which the frequency hardly reduces any further, and a maximum voltage above which the frequency does not increase any further, or hardly. The P/F comparator (IC1) sees at its cin input the signal from the VCO and on its sigin input the Q4 output from the prescaler. The analog voltage is additionally cleaned by the network OO H 0 | _3Dpad_ sensor >IN 0221 0323 0623 0239 < * >IN 0222 0321 0621 0243 < >IN 0223 0321 0619 0248 < // Elektor Labs - 00TSIDEB0X project >IN 0222 0320 0619 0248 < >IN 0220 0320 0621 0244 < // Touchless - Gesture 3D-pad >IN 0217 0321 0624 0240 < >IN 0216 0321 0626 0236 < // IN Lefebvre 10 Hars 2014 >IN 0216 0321 0626 0236 < // https://tuitter.coB/iunouhvnot >IN 0220 0322 0625 0238 < // https://tuitter.com/Ootsidebox >IN 0220 0319 0622 0243 < // >IN 0221 0320 0621 0247 < >IM 0222 0320 0622 02S1 < >IN 0222 0320 0623 0249 < f include >IN 0220 0323 0626 0245 < (include > IN 0219 0323 0628 0240 < (include >IN 0219 0323 0631 0236 < (include >IN 0220 0323 0629 0237 < (include >IH 0223 0324 0628 0239 < (include >IN 0226 0322 0627 0243 < (include >IN 0228 0322 0629 0247 < (include Regulation. h> >IN 0228 0322 0630 0249 < >IN 0228 0324 0633 0245 < struct _Autonate AutomateData; >IN 0225 0324 0635 0241 < >IN 0224 0325 0638 0237 < void Run(void); >IN 0224 0325 0638 0237 < void SetupFct(void) ; >IN 0227 0327 0637 0240 < unsigned int El[NODE]; //tableau des consignes VCO >IN 0228 0325 0636 0245 < unsigned int VAL[HODE] ; //tableau des valeurs resultantes >IN 0230 0325 0635 0250 < unsigned int FI ITER [ NODE J [ FI LTERLENGHT ] ; >IN 0230 0325 0636 0254 < unsigned int VALF[NODE] ; >IN 0229 0325 0636 0252 < > IN 0224 0328 0637 0247 < unsigned int Node; >IN 0222 0328 0640 0243 < unsigned int ConsigneValue.CONSIGNE; >IN 0222 0328 0643 0239 < >IN 0222 0330 0641 0240 < unsigned int BaseTempsRegulatlon°BDTREGUL; >IN 0226 0331 0639 0245 < unsigned char Prox*0; >IH 0226 0328 0637 0249 < unsigned char OldProx; >1* 0226 0328 0638 0253 < unsigned char IntoField«0; >IN 0225 0327 0638 0254 < >IN 0223 0328 0640 0248 < void Run(void); >IN 0221 0329 0641 024S < void Filter (void) ; >IN 0218 0328 0642 0239 < void Regulation (unsigned int BaseTempsRegul scion, unsigned char Touch); >IN 02 V 0 DeHemer* automstique . ■ v 1 15200 b^7 V iTaille binaire du croquis : : 6 478 octets (d'un max de 32 256 octets) Rl, R3, and C2, with its rapid discharge achieved by Tl, itself driven by an Arduino output (SCPF_ clear). On TP4, we have the usable analog value (cpf_out), both for observing operation on an oscilloscope and for the Arduino software, after analog/digital conversion. For the electrode oscillator, we need 9 V, stabi- lized by a linear regulator (IC5), itself powered from a DC voltage of at least 12 V. This passes via the Arduino, which we'll be powering from a small 12 V DC power supply (Arduino UNO has provision for this). IC4 is a step-up level-changer (4504) which allows the Arduino controller's 5 V outputs to control the electrode selection, even though the electrode oscillator is powered at 9 V. The connection between our shield and the Arduino UNO board is made via K3, K4, K5, and K6. Construction As all the drawings for the UNO board are acces- sible online, it's not beyond the bounds of pos- sibility for you to build it yourself. But I suggest you'd do better to buy a ready-built and tested UNO board [6]. The same goes for the two dou- ble-sided 3D-Pad boards - the track layouts are available on the Elektor website, but I'd recom- mend ordering them from the ElektorPCBservice [7]. A few details deserve special attention, like capacitors C5 and C12, which must be less than 6 mm high, otherwise you'll have to fit them lying down. You'll need an iron suitable for sol- dering SMD components, and you'll have to take particular care soldering IC3: the DAC8311 is so small, you need a magnifying glass to spot the pin 1 identifier. The electrode plane connectors must be fitted on the underside of the PCB, so that the screen-print- ing on this board is on the top once it is plugged onto the 3D-Pad shield board (Figure 6). The case must be plastic, not metal. If you're lucky enough to own a 3D printer, or have a Fab-Lab near you, you could have fun designing an original, futuristic case for it. I used a FIBOX ABS 125/35 LT case (RS ref. 498-4306) which has a transparent lid. Software The software (sketch) to be downloaded into the Arduino UNO consists of a file named _3Dpad_sen- sor.ino and a library ElektorLabs3DPad, to be installed into the Arduino IDE in the usual way. This program sends the data to the terminal via 14 May 2014 www.elektor-magazine.com Touchless Gesture Control the USB port, which is used in COM port mode (fig. 7). The data sequence contains the four electrode measurement values: >IN/OUT EL_Gauche EL_Droite EL_Haut EL_Bas < in/out indicates when the hand is perceived as being (IN) the detection field or not (OUT). The program on the UNO board has two main functions: on the one hand, the scanning and sequential measurement of the electrodes, on the other, the regulation, i.e. maintaining the operat- ing point, taking the two reference electrodes into account. The principle is the same as for Touch detectors, e.g. the ones from Atmel. The level is regulated outside the detection window, which makes it possible to overcome slow variations (mainly caused by temperature changes); then when the detection is active, this regulation is usually blocked. In our case, this implies princi- pally that the VCO set-points for each electrode measurement are continuously being corrected [8]. I can't go into a detailed description of the software here - it would take a whole article at least as long again as this one. However, here are the successive states of the 3D-Pad: Self-calibration: (when first brought into ser- vice or on command via a serial link) the sys- tem seeks the operating point for each electrode, then memorizes the set-points into EEPROM on the Arduino. Setup: each time it is powered up, or on com- mand via a serial link, the system quickly (less than one second) seeks the operating point, start- ing from the set-points read from the EEPROM. There are also automatic configuration conditions, e.g. in the event of saturation of the electrodes. Run: the normal operating state, which always follows on from a successful configuration. The software's other tasks are: Interpolating the co-ordinates: from the mea- surement values of the top, bottom, left and right electrodes, it calculates 3D co-ordinates: X, Y, and Z. Gesture recognition: it recognizes swipes in all four directions (upwards, downwards, left, and right), rotating movements with turns counting and detection of the rotation direction, and push- ing a virtual button (Push). And fortesting, with the _3Dpad_test . i no file loaded instead of _3Dpad_sensor.ino, we have commands that allow us to activate the oscilla- tors continuously, by choosing the electrode to be used. This lets us check the frequencies and adjust the resistors R9-R14 if necessary. There is also a command to make the VCO work with these set-points: 0, Max and Vi (i.e., at the DAC output, 0 = 0 V, Vi = 2.5 V and Max = 5 V). As a bonus, I am offering a very simple but fairly comprehensive application program, for PC under Windows (XP and 7): this displays the 3D co-or- dinates in the form of a cursor whose position on the screen reflects X and Y, while the Z axis is represented by the diameter of the cursor; it also displays the words "Air Swipes" when it detects a sideways sweep of the hand along one of the four axes, or the word "Push" when you make the movement of pushing a button (Z axis); and lastly, it indicates the rotation direction of the hand or finger it detects and the number of turns (very handy for carrying out settings). It will be easy for you to draw inspiration from this program in Visual Basic 6 for your own applications. Set-up Your Arduino UNO board is operational and you have installed the software into the Arduino IDE. You'll need a voltmeter, an oscilloscope, and a frequency meter (the latter is unnecessary if you can measure frequencies with the 'scope). Once the components have been correctly soldered, I recommend the usual checks: orientation of the integrated circuits and polarized components, examination of the soldering using a magnifier (especially for the DAC IC3). The tension mounts: Plug together all the boards to form the stack of PCBs (Figure 6) then plug the 12 V DC supply into the Arduino UNO external power jack. It's a good idea to check the power rail voltages: 12 V on K3-1, 9 V on TP1, and 5 V on TP2. All OK? Then upload and run _3Dpad_test.ino. Open the connection with the terminal set to 115,200 baud; a menu of the commands avail- able appears. Let's check the oscillators are working: www.elektor-magazine.com May 2014 15 •Projects VCO: enter the command to activate the VCO oscillator with a set-point V 2 : you should see 2.5 V on TP8 and a nice square wave on TP5 at a frequency of 100-110 kHz (depending on com- ponent tolerances). Electrodes: make sure you clear everything away from around the electrode plane. For each of the six electrodes, use the terminal to send, via the serial link, the corresponding command (e.g. "T" = top electrode, or "B" = bottom one) and check the oscillation signal on TP6. The fre- quency should likewise be close to 100-110 kHz. The other commands are documented in the soft- ware source code. If these checks are satisfactory, load the normal program _3Dpad_sensor . i no in place of the test rci3i R10 ' R9 \® ® ® [®1 3D Pad dMDtlfi'OKCO aaaaaaaa K1 R16 K6 i) K8 IC6 K3 3 3 0 CD ID Z + + (£> IV CL • R6 IV u ID vH O C10 IC5 r Cll ID ■H CL K ?\9 9 ® RST R2 AREF I ® 6ND [® 13 f® * 12 I® ® +3 - 3 . u c4 R5 ®j+5U * R4 , R1 ® I GND ® | GND g IC3 ll I ® 10 [® CV CO • <3 0 . IC4 9 ® . 8 ® * ® DIN T1 • • . ^ -H CD r o • U Ct • L A • y V)l® ® ® ® ^h[® G 1 c HH 2 o> o 3 ”75 c 4 « • ID O 7 ® 6 ® CD <3 5 ® 4 ® Cl 7 C12 K4 o 1C7 3 ® 2 ® TX I® RX [® VO O IC2 00 K5 IC9 otsidebox CO o elektor@labs res K2 1 ® | ® ® ® | R12 (C) ELEKTOR 130508-1 Ul.l R13 K3 E3 A ■ C LED1 3D Pad otsidebox elektor@labs ft ELI EL4 Component List 3D-Pad Arduino shield Resistors SMD 0805, 0.125 W) Rl, R6, R7 = lOkft R2, R8 = 18kQ R3 = 1MQ R9,R12 = 47 kQ R4 = 120kft R5 = 470kft R10,R13 = 82kQ R11,R14 = 22kQ R15,R16 = 470ft Capacitors default: SMD 0805 Cl = 2.2nF C2 = 220pF C3,C4,C6,C7,C8,C9,C10,C11,C15,C16,C17,C18 = lOOnF C5 = 4.7pF 16V (pitch 2mm) C12 = 100pF 16V (pitch 3.5mm) C13, C14 = not fitted Semiconductors IC1 = HEF4046BT IC2 = CD74HC4024M IC3 = DAC8311 ou AD5641AKSZ IC4 = CD4504BM IC5 = 78L09 (SOT-89) IC6, IC8 = HEF4011BT IC7 = HEF4081BT IC9 = CD74HC4050M T1 = 2N7002 Miscellaneous K5, K6 = 8-pin pinheader* K3, K4 = 6-pin pinheader * Kl, K2 = 4-pin pinheader * K7, K8 = 2-pin pinheader Electrode Plane Semiconductors LED1,LED2 = LED, green, SMD, Kingbright type KPT-20 12SGC Miscellaneous K1,K2 = 4-pin pinheader* K3, K4 = 2-pin pinheader* PCB # 130508-21 * 0.1" pitch 16 May 2014 www.elektor-magazine.com Touchless Gesture Control Serial Inventor and Entrepreneur Jean-Noel Lefebvre learnt electronics with his soldering iron in his hand and through reading magazines and specialist books (including Elektor, naturally) The 3D-Pad circuit described here is based on his own patents. A "DIY" enthusiast, he fully supports the concept of HackerSpaces and Fab-Labs, in association with the Makers movement. Jean-Noel has been devoting his time for a year now to OOTSIDEBOX, a start-up that is going to be offering devices like the 3D-PAD, and also an accessory for Android tablets that enables them to be controlled by touchless gestures, identical to the 3D-Pad system. This project will shortly be launched on the Indiegogo crowdfunding website. You can participate in his project and help him. Follow @ootsidebox on Twitter: twitter.com/Ootsidebox or post a LIKE on Facebook: www.facebook. com/ootsidebox en.wikipedia.org/wiki/Hackerspace edutechwiki.unige.ch/en/Fab_lab en.wikipedia.org/wiki/Maker_culture www.ootsidebox.com www.indiegogo.com program. A good way of checking the 3D-Pad in operation consists in connecting a 'scope probe to TP8 (DAC output) and another to TP4. The sync is taken from TP8. At first switch-on, or follow- ing the self-calibration command (send "A" from the terminal), the voltage level on TP8 will fall gently: this is the search for the set-points for each electrode. After a few moments, this trace should be stabilized (end of self-calibration) and your oscilloscope screen should look like the one shown in Figure 4b. Bring your hand closer to the electrode plane: you should see the sawtooth on TP4 change and also the measurement values scrolling on the terminal [9]. You can launch a reconfiguration at any time, either with the com- mand "R" from the terminal, or by saturating the electrodes by bring your hand flat within a few millimeters of the electrode plane. I'll be there to help you if you need help getting it going or information for a specific application, or if you have any suggestions for developing the project. Don't hesitate to contact me on Twitter [10], I'll be delighted to answer you personally. ( 130508 ) Web Links [1] games Fruit Ninja: http://fruitninja.com/ Despicable Me - Minion Rush: https://play.google.com/ [2] CC BY-NC-SA 4.0 http://creativecommons.Org/licenses/by-nc-sa/4.0/ [3] www. embedded. com/design/prototyping-and-development/4008781/ Getting-in-touch-with-capacitance-sensor-algorithms [4] injection locking: http://en.wikipedia.org/wiki/Injection_locking [5] www.elektor.com/arduino [6] assembled, tested UNO board from the Elektor e-shop www.elektor.com/arduino [7] www.elektorPCBservice.com [8] www. rtcmagazine. com/articles/view/10 1626 [9] video of the sawtooth signal on TP4 http://youtu.be/rYdyR49qFzU demo video: http://youtu.be/llQGUxXFYq8 [10] @junowhynot + #3DpadElektor: https://twitter.com/junowhynot www.elektor-magazine.com May 2014 17 •Projects Wireless Gateways From serial to radio, and back again Tiny low power radio (LPR) modules operating at UHF ISM frequencies like 433 MHz and 868 MHz are available on the market that are ideal for remote measurement and control applica- tions. They are usually controlled over an SPI interface. Poring over datasheets and writing a driver is, however, not every- one's delight, and we have therefore designed a small board that carries an LPR module along with an AT- mega328 microcontroller and a serial interface. Pre-programmed firmware allows the board to be used as a simple gateway for strings of characters between the serial interface and the ether. By Jens Nickel (Elektor Germany) FCC (USA) and ETSI (European) approved and certified LPR modules (Figure 1) operating at 3.3 V are available from the Chinese manufac- turer HopeRF. Also known as SRDs (short range devices) they are based on the Silicon Labs Si4421 [1] and include the necessary support circuitry and a quartz crystal. The IC makes it relatively straightforward for advanced embedded systems developers to add wireless data transfer to their projects. The transceiver is controlled over an SPI interface: specified byte sequences act as commands that switch the device between transmit and receive modes, alter the data rate, and so on. The SPI interface is also used to trans- fer characters to be transmitted and characters that have been received. A designer with enough experience and enough patience could write the necessary firmware to drive the SPI interface, and, on top of that, a small Si4421 driver library to assemble the com- mand byte sequences for the device and send them to it. In the simplest case such a library would provide a function to allow the sending of character strings generated by the application program over the wireless link; a further function could be provided to store received characters in a circular buffer for subsequent processing by the application program. Shift those strings Although example microcontroller-specific SPI drivers and Si4421 libraries can be found on the Internet, adapting these to your own firmware and project will take some time. In this article we take a different route, similar to that adopted with considerable success by FTDI for its USB interface drivers. FTDI's USB-to-TTL converter ICs are popular chiefly because they are so easy to interface to the serial ports on microcontrol- lers. The designer is freed from having to do any special USB driver programming, and only has to worry about sending and receiving characters using the UART. Our board is designed so that you can simply plug in a HopeRF wireless module. As well as a power supply, the board includes an ATmega328 microcontroller and a 2-by-5 header that carries the UART RX and TX signals (Figure 2). The pin- 18 May 2014 www.elektor-magazine.com Wireless Gateways out is based on the EEC specification presented in Elektor [2]. Thanks to its firmware the 8-bit microcontroller on the board looks after all driving of the radio module. Elektor supply the board with prepro- grammed example firmware, turning the board into a gateway between a UART and the "ether". If a string (of up to 62 characters) is sent to the gateway, terminated by a character, it will be sent over the wireless link. In the reverse direction a string received over the wireless link is output over the serial interface: the data rate for serial communication in either direction is set at 9600 baud. The gateway board is based on a design by Elektor author Gunter Gerold, who developed his module for telemetry applications for his 'Wheelie'. In the Elektor labs we designed a printed circuit board, which is available either populated or unpopu- lated [3]. In the populated version the microcon- troller comes ready-programmed with the gateway software, but you can of course replace this with your own code. Based in Europe, Elektor Labs used Hope RF's 433 MHz version of the LPR module. Circuit The circuit diagram (Figure 3) is not particu- larly complicated. The central component is the ATmega328 microcontroller, which can be flashed with new firmware over ISP connector K2. The crystal and power supply circuits follow the stan- dard datasheet arrangement. A LED and a button are connected to port pins PD4 and PD5. These provide a minimal user interface that can come in handy during firmware development on the board, as well as in test and in actual use. The RFM12B wireless module is connected to the microcontroller over a total of eight wires. Four Figure 1. The low-power radio module from Chinese manufacturer HopeRF (433 MFIz version shown here with header pins soldered on) is controlled over SPI. Versions are also available for the 868 MHz SRD band. Figure 2. The gateway board with ATmega328, button, LED and a two-by-five connector for serial signals. VCCcon O 130023 - 11 Figure 3. The microcontroller is connected to the wireless module over a total of eight wires. Five of these are used by the pre-programmed firmware. www.elektor-magazine.com May 2014 19 •Projects Component List Resistors R1,R4 = lkft (0805) R2 = lOkft (0805) R3 = 2kft (0805) R5,R7,R9,R11,R13,R15,R17,R19 = 1.8kQ (0603) R6,R8,R10,R12,R14,R16,R18,R20 = 3.3kQ (1%, 0603) Capacitors C1,C2 = 22pF (0805) C3..C7 = lOOnF (0805) C8 = 4.7pF (0805) C9 = lOpF, 25V (1206) C10,C11 = lpF (0603) Semiconductors D1 = LED yellow (0805) D2 = LED green (0805) D3 = PMEG2010AEH Schottky diode (SOD-123F) IC1 = ATmega328P-AU, programmed (TQFP-32) IC2 = LDO NCP5501DT50G (DPAK-3) IC3 = XC6206P332MR (SOT-23-3) Miscellaneous K1 = 10-pin (2x5) pinheader, 0.1" pitch K2 = 6-pin (2x3) pinheader, 0.1" pitch K3 = 2-pin pinheader, 0.1" pitch JP1 = 3-pin pinheader, 0.1" pitch with jumper SI = pushbutton XI = 16MHz quartz crystal, 50ppm, 18pF MODI = RFM12B-433-S1 radio module (HopeRF) 14-pin pinheader, 2mm lead pitch 14-way receptacle. 2mm pitch PCB # 130023-1 [3] of these comprise the SPI interface mentioned above, and these are connected directly to the hardware SPI port on the ATmega328. This is the same interface as the microcontroller uses when it is being programmed: pull-up resistor R3 takes the module's select input /SEL high during programming, so that the wireless module does not try to interpret the bytes being transferred. When the microcontroller wants to send bytes to the radio module it must pull this signal low ECC: connector specification for serial signals The Embedded Communication Connector (ECC) employed again in this project, is a two-by-five pinheader that carries serial signals. As well as the expected RX and TX we have two general-purpose digital signals or GPIOs (green in the figure). In the March 2014 edition we described a small RS-485 interface adapter that can be connected to a microcontroller board via the ECC. In the planning stage we also have an RS-232 interface adapter as well as modules for USB, WLAN and Bluetooth. The pin at the top right allows a converter board to be supplied with power from the microcontroller board. In contrast to a 'dumb' converter board, a gateway such as the one described in this article contains a microcontroller with software running on it. The ECC makes it possible to connect such a gateway to a converter as easily as to a microcontroller board. In the former case the gateway can provide the converter with power over the VCON pin; and similarly the gateway can itself be powered from a microcontroller board via the VIN pin. If a ribbon cable is used to connect the two boards together, the plug at the gateway end should be turned through 180 degrees so that the VCON pin of the microcontroller board connects to the VIN pin of the gateway. Conveniently this also happens to swap over the RX and TX signals, so that the microcontroller on the main board and the gateway can communicate with one another. The latter case is probably the standard application— our Gateway effectively equipping the main controller board with a radio link. Consequently pin 1 of the ECC points inwards on the component overlay, so inwards is where the 'nose' of the flat ribbon connector should point also. On all controller boards pin 1 of the ECC connector (and the connector nose) points outwards. Attention: due to the flip around (swapping TX and RX) te pin numbering is not conclusive about the pin function; pin 1 for instance can only be GPIAB once or GPIOB once. The pins shown in white are uncommitted, and can be used for special purposes. In the project described here we have used one of them as an extra connection for the RX signal and connected the other to a general-purpose port pin of the ATmega328. GATEWAY CONVERTER GPIOA O O VCON GPIOA O o VCON GND O O GND O o RX O O TX RX O o TX O O GND O o GND VIN O O GPIOB O o GPIOB S GPIOA O O VCON GPIOB o o VIN GND O O GND o o RX O O TX TX o o RX O O GND o o GND O O GPIOB VCON o o GPIOA CONTROLLER BOARD GATEWAY 130155 - 14 20 May 2014 www.elektor-magazine.com >jice Wireless Gateways in software via port pin PB2. The pre-programmed software also makes use of the FFIT pin on the wireless module. The signals /FFS, /INT and /IRQ are connected to port pins on the microcontroller as well in order to allow you to make more flexible use of the wireless module in your own code. K1 is the ECC connector mentioned above. The middle pair of pins provides access to the RX and TX signals of the microcontroller's UART, while the other pins of the connector are taken to port pins PD2, PD3 and PD6 of the microcontroller. These could be used for flow control on the serial port or for dedicated functions. The lower left pin is connected to the 5 V micro- controller supply. The gateway board can supply a small current over this pin, sufficient for an adapter to convert the TTL-level serial signals to RS-232 or RS-485. An RS-485 adapter for con- nection to the ECC was presented in the March 2014 edition [2]. The top right pin, conversely, allows the gateway board to be supplied with power over the connec- tor, for example from a motherboard. Alterna- tively the board can be powered via K3 and volt- age regulator IC2: the power source is selected using jumper JP1. Green LED D2 indicates when power is present. The gateway's 5-V operating voltage is used by a small small voltage converter to generate a 3.3-V supply for a radio module; at the same time the 5-V signals are converted down to 3.3 V and vice versa. Thanks to the use of SMD components the gateway board is very compact and the art- work is always available for downloading from the project page set up for this article. There you can also your ready populated and tested Gateway board together with radio module type RFM12B-433. If you use a different radio module, do make sure you have a 3.3-V version. Although there are surplus stocks around, the 5-V version of the radio module is no longer manufactured. On ANTI connect a suitable piece of stiff wire around 17 cm long (quarter wavelength at 433 MHz). 433 MHz, 868 MHz or ?? MHz? That depends on the country you live in, bear- ing in mind that Elektor is published worldwide in English. One or more of the above frequency ranges may be allocated to ISM (industrial/sci- entific/medical) applications allowing the use of type-approved low-power radio modules by pri- vate individuals within the limits of national, state, or regional legislation. Applications The ECC leaves two uncommitted pins for use in special applications (shown in white in the figure in the text box). We have routed the UART RX signal to one of these pins so that RX, TX and ground are available on the connector as three adjacent pins in a straight line. As a result the BOB USB-to-serial converter [3] can be connected directly to the board for test purposes or even in a final project: see Figure 4. An FTDI 5 V USB- to-serial cable (also available from Elektor) can be fitted, but the pins in the socket need to be moved around so that the pinout matches [4]. Connect the USB adapter to a PC. Connect a sec- ond wireless module to a microcontroller board with RX, TX and ground pins available: connect TX on the microcontroller to RX on the ECC and vice versa. You can now send strings of up to 62 characters from the PC to the microcontroller board (Figure 5). At the PC end you can use a simple Figure 4. A BOB USB-to-serial converter can be connected directly to the gateway. Figure 5. One possible usage scenario for the gateway: strings can be transmitted to and fro between a PC and a microcontroller board. www.elektor-magazine.com May 2014 21 •Projects Figure 6. A terminal program such as HTerm comes in handy when testing the radio gateway. terminal program such as HTerm, which can be downloaded from the Internet free of charge [5]. HTerm should be configured so that a complete line of characters is sent when the 'Return' key on the keyboard is pressed, with a (ASCII 13) character appended. To send data in the opposite direction you will need to arrange for the micro- controller to output a string using its UART, again terminated by a character. The ready-programmed version of the wireless gateway has two modes: 'send' and 'listen'. When power is applied the gateway enters send mode, with the yellow LED not illuminated. In this mode the board will accept strings over its serial con- nection and send them out over the air, but will not act as a receiver for data. Press the button, and the gateway will switch to listen mode, indi- cated by the LED lighting. The board will now listen for characters sent over the ether. When a character is received the entire string is output over the serial interface. Special commands A gateway can also be switched between its two modes of operation by sending the sequence '@@ c' to its serial interface (the 'c' stands for 'change'). The command '@@s' ('s' for 'swap') causes both gateways to switch between one mode and the other. However, the second gateway only changes mode when it receives a string over the air that indicates that the first gateway has switched to listen mode. A gateway connected over its serial interface responds to the two special commands with the acknowledgement strings ' MDL' ('mode listen') or 'MDS' ('mode send'). In this way we receive confirmation of which mode the gateway is now in and can pro- ceed to test whether the connection is working via the serial interface (Figure 6). Assuming that only a unidirectional connection is wanted, then initially the remote module will be set up in listen mode and strings can be sent to it. The direction of communication can be reversed at any time by sending the command '@@s' to the gateway currently in send mode. The gate- way forwards this command to the other end of the link, as a message which could be interpreted as meaning 'I have finished transmitting and am now switching to listen mode and will wait for your transmissions'. This behavior does not cover all possible appli- cation requirements, of course. For example, if a sensor board wants to send regular readings to a control system running on a PC, then the module connected to the PC will have to be left in listen mode. However, this means that the PC is unable to send out commands, such as to tell the sensor board to change the interval between readings. The gateway software therefore includes the possibility that both ends of the connection are in listen mode. Despite being in listen mode, characters can be sent to the serial interface on either board to be sent over the wireless link. For technical reasons, in this mode it is nec- essary to terminate the string to be sent with two characters (that is, press the Return key twice in the terminal program). In this bidi- rectional configuration either participant can be sending or receiving at any time and it is up to the application software (running on the PC or on the microcontroller board) to ensure that col- lisions do not occur. Software The firmware that is programmed into the ready- made boards is of course available as a source- code download from the Elektor website in the form of an Atmel Studio 6 project [3]. The code is written in a modular fashion, based on the Embedded Firmware Library (EFL) [6]. The micro- controller file for the ATmega328 sits at the bot- tom of the software stack, exposing to higher levels functions such as 22 May 2014 www.elektor-magazine.com uint8 SPIMaster_Transcei veByte (i nt8 Handle, uint8 Databyte) which sends a character over the SPI interface. This particular function is used by the low-level driver for the wireless module, which is located in the board file (BoardEFL.c). The low-level driver provides the following functions: void Wi relessModule _Command (ui nt8 Wi relessBlocklndex , uintl6 Command) void Wi relessModule_SendData (ui nt8 Wi relessBlocklndex , uint8* DataBuffer, uint8 DataLength) void Wi relessModule_Recei veData (ui nt8 Wi relessBlocklndex) In this case Wi relessBlocklndex is always zero, although in principle it would be possible to connect more than one wireless module to the microcontroller. The Wi relessModule_Command ( ) function can be used to send a two-byte command to the wireless module as specified in its datasheet [2]. This function simply calls the lower-level function SPlMaster_TransceiveByte() twice while holding the / SEL pin low. The function Wi relessModule_SendData () is responsible for sending characters. The function first sends the byte 0xB8 to the wireless module; subsequent bytes are then transmitted. The developers of the wireless module specify that a two- byte synchronization pattern (0x2DD4) should be sent before the payload data to improve the reliability of transmission. After all the payload bytes for trans- mission have been transferred over the SPI bus, the function appends a byte char_wireless_endoftransmission to the end of the string: in BoardEFL.h this is defined to take the value 0x04. The function Wi relessModule_Recei veData () is repeatedly called in listen mode. Its most important component is a loop which continuously receives characters. At the head of this loop is a small nested loop in which the FFIT pin is checked. When this pin is high it means that the wireless module has received a character and written it to its internal FIFO buffer. The function now takes /SEL low and sends the command OxBOOO to the module to fetch the received character. The code then returns to checking the FFIT pin. The wireless module starts to write characters into its FIFO as soon as it sees the synchronization pattern. The characters received are written to a circular buffer dedicated to the wireless module. Like all circular buffers in the EFL it has a default size of 64 bytes. When the character 0x04 is received the receive function exits its main loop. Note that the 0x04 character is not written to the circular buffer. By clearing a flag in a specified register the wireless module is instructed not to write further characters into its FIFO until the synchronization pattern is seen again. This will occur at the start of the next received string. The receive loop is also exited when the button is pressed or if a byte is received over the serial interface: this allows the bidirectional function described above to be implemented. Configuring the wireless module We have now covered all the functions that are used to control the wireless module. As usual for the EFL, the functions are written in a hardware-independent fashion and can be used on other boards with different wiring. The wiring configuration of the gateway board, including its button and LED, are defined in the function Board_init() in the board file [6], which will need to be changed suitably to use the code with different hardware. Before we can send and receive characters we need to configure the wireless module. What command bytes do we have to send to the board using the func- UNBEATABLE at price-performance ratio. The new Rigol measurement devices ne m ij a m JT V — ■ t - r . f PTr 1 \ o id d ~ ■ 1 r 77 * k=j / ik i \ K-' 1 o ^ ' & i \ Rigol DS1 000Z Oscilloscopes 4 channels, 70/100 MHz, 1 GSa/s sample rate, 12 million measurement points memory, USB, LAN, professional measure & analyse features, opt. built-in waveform generator, 3 years warranty a r r\ from € 450,“ net incl. EU wide free shipping Rigol DG1 000Z Waveform Generators 2 channels, 30/60 MHz, 200 MSa/s, 2 Mpts memory, USB, LAN, LXI, analog and digital modulation, arbitrary signal generation, 3 years warranty ^ A AL~7 from 40/,- net incl. EU wide free shipping ake your LIVE easier. jding TECHNOLOGY h BATRONIX satisfaction- guarantee Attractive prices Expert advice Large selection in stock 30 day trial period Money back guarantee EU wide free shipping for most product: Dur special offers now: r.batronix.com/go/32 * Batronix Lise-Meitner-Str. 1 -7 24223 Schwentinental service@batronix.com www. batron ix. com Germany •Projects tion Wi relessModule_Command ( ) to achieve this? The only way to find out involves painstaking study of the module's datasheet. For that reason we have written the library module Wirelessln- terfaceEFL. If the function Wi relesslnterface_ Li bra rySetup ( ) is called when an application starts up it will carry out the basic configuration of the wireless module, for example setting its data rate to 9600 baud. The individual commands are commented in the code, including a cross-ref- erence to the relevant section of the datasheet where you can find a more detailed explanation of what is going on. The function Wi relessInterface_Send () config- ures the module for transmission, activating the TX register and the transmitter. This function should only be called immediately before actually sending data in order to conserve power. The function WirelessInterface_Listen() switches the wireless module into FIFO mode, which, among other things, means that the FFIT pin mentioned above will signal the arrival of a new character. The receiver is also enabled. One-to-one gateway The remaining piece of the puzzle is a mechanism which in listen mode will periodically read the character received over the air from the circu- lar buffer where they are stored and send them out over the serial interface, and, in the opposite direction, take characters received over the serial interface from the other circular buffer where they are stored (by the UART interrupt code) and transmit them. These tasks are carried out by the library OneToOneGatewayEFL, which was described in a previous article [7]. The library inspects the two circular buffers in turn to see if a character has been received. If so, the characters received up to that point are sent out over the appropriate channel in one go. The OneToOneGatewayEFL library has been extended for this project to handle the special commands, which always start with the sequence and which are three bytes long. A call to the func- tion OneToOneGateway_SetSpeci alCommandFunc- tion() is used to tell the library what callback is to be called when a special command is received over the communications channel. In our case we specify the function SpecialCommandGatewayQ, which is implemented in the main part of the code. The parameter to this callback function is the third character of the command, here 'c' or 's'. Depending on which character is received the gateway will switch between its listen and send modes. The command is also sent over the wireless link to the other gateway module: this behavior can be configured using the second parameter to OneToOneGateway_SetSpecialCom- mandFunctionQ, which we have set to 'TRUE'. Testing To test the gateways we can connect two units, each equipped with a BOB or FTDI cable, to two USB sockets on the same host computer. It is now possible to open two copies of the terminal program and send characters to and fro. If you enter the special command '@@c' in both terminal windows both gateways will inde- pendently switch to listen mode. Each wireless module should reply with the string 'MDL' ('mode listen') over its serial interface, and hence in its terminal window. This means that serial commu- nication is working correctly: if this test fails, it sometimes helps to try disconnecting and recon- necting the USB-to-serial adapter. You can now try sending short messages from one terminal to the other. Don't forget that you need to press the Return key twice at the end of each message! ( 130023 ) Note: the firmware running in Elektor programmed mi- crocontroller is purely experimental. The publish- ers cannot guarantee error-free operation is all situations. Web Links [1] www.silabs.com/Support%20Documents/TechnicalDocs/Si4421.pdf [2] www. elektor-magazine. com/130155 [6] www.elektor-magazine. com/120668 [3] www. elektor-magazine. com/130023 [7] www. elektor-magazine. com/130154 [4] www. elektor-magazine. com/080213 [8] www.elektor-labs.com/ecc [5] www.der-hammer.info/terminal/ (site in German) [9] www. elektor-magazine. com/120126 24 May 2014 www.elektor-magazine.com ■ ■ ^ rj Add USB to your next project, w O D It's easier than you might think! DLP-USB1232H: USB 2.0 UART/FIFO HIGH-SPEED 480Mb/s • Multipurpose: 7 interfaces • Royalty-free, robust USB drivers • No in-depth knowledge of USB required • Standard 18-pin DIP interface; 0.6x1 .26-inch footprint DLP-I08-G 8-Channel Data Acquisition Only $29.95/ • 8 I/Os: Digital I/O Analog In Temperature • USB Port Powered • Single-Byte Commands DLP-IOR4 4-Channel Relay Cable DLP-THIb Temp/Humidity Cable DLP-RFID1 HF RFID Reader/Writer DLP-FPGA USB-to-Xilinx FPGA Module www.dlpdesign.com SCQPBDR 6 -IN -1 scope ® ..caic onoKHz 11- Wt oscilloscope, £-cn 2 -cn 2MSa/s 200KHZ vv amt rary spectrum anaM^r, 2 MS.j9 network waveform generator, func- _ analyzer. PWM /Digital i/o. - CGM 101 ST9 passport-size PC SCOPES . fnr use witn laptops ,Gsa/s AWG/wfm gen. - PS2200A j -t SSssr rate oscilloscope. 8 -in coiw Autoscale function. includes ^ £ E^ y case * 3 yr warranty'. - SDS503EE $2.0 SO MHz SCOPE ajcMsa/s Best selling col0 r TFT- LCD. 100MHz SCOPE PRICES FRLL TECHNICAL SUPPORT JCREDIBLfc PRICES, i " , _ . — * The latest on electronics and information technology Videos, hints, tips, offers and more Exclusive bi-weekly project for GREEN and GOLD members only Elektor behind the scenes In your email inbox each Friday elektor post Tte beginning of a beauilfur Hriensshin Etei'cr POST ij. hart, to ESJy based life forms of the World unite! EJeto-.WJSr V HVK* £no- a n-uifajiw w«hr oruf o-f pjg many nr# n wim pn^ucts jitki piixtuc^ w nt \e pi Iffti 5lPp.ji-r*3i ***** . fewrwaH, Elektoj.TV goes Linux H*li* AM BuOg htMhMn T* WATCH IT ON EIEKT Oft.TV >» ti lektor Register today at www.elektor.com/newsletter.L ■■ •Projects Intelligent Cuelight System for Theaters Act III,Sc. II: Storm still, Enter Lear and Fool By John Baraclough (UK) A cue light is a system of one or more electric light bulbs (usually traffic light col- ors) used to allow silent cues to be given to technicians and performers at vari- ous working locations during the running of a show or play. Typically, the Deputy Stage Manager sends signals to these cue lights at pre-arranged times. In this article we present a low cost microcontroller-driven version, hence "Intelligent". Typically, traditional cuelight systems have an "Acknowledge" button that allows feedback on the status of the person at the cue point to the Cue Light Operator. Although headset systems have made cue lights less popular, they are still used in some cases where silence is necessary, or where a headset is not practical. There are multiple protocols that are used to des- ignate the meaning of each light. Green is usually used to signal a "Go" cue. An optional yellow light or a flashing red generally means "Stand By." A solid red light can indicate that the standby has been acknowledged, or that no cue is pending, depending upon the protocol used and hopefully 26 May 2014 www.elektor-magazine.com Intelligent Cuelight System learned by the actors and prop assistants. No light at all can represent that no cue is pending. An alternate scheme with only one lamp uses 'on' as a standby cue and 'off' as the cue. Why build a cuelight system when there are commercial products available like [1],[2]. Most of these systems contain multiple channels, each channel having its own Standby, Go and Clear buttons. Meaning a lot of buttons in front of the (Deputy) Stage Manager. The author designed a system with a different approach: he uses up to four banks (called 'buses') of Standby and Go buttons, and one 'Master' Clear button (or individual Clear for one or more channels). In principle there's no limit to the number of channel boards in the system— every channel has four DPST switches (S1-S4) to connect it to up to four buses. Every channel board controls one 'remote' PCB with a red and a green LED and an optional signaling button. K5 c H - 6 o E VCC © v+ © JP1 2 3 JE R25 R26 ■^s I” VDD GP5/CLKIN GPO IC1 GP4/CLKOUT GP1 PIC12F629 GP3 GP2 VSS [R 14 R11 rt v+ ■© tioK) BC547 ’=’■ | T 9 -£© I BC557 - — •8 BC547 R17 l 10k |- T R22 T14 VCC © R19 T13 © (M BC547 BC547 R16 R9 T12 T6 H l0k H r T © J=I© J=I© @ RIO BC547 ^T D2 R21 X — 1 BC547 D4 D3 SI 71 X 7Z S2 6 * 6 1 G ^^5 R18 X — BC547 BC547 j H ,t7 V ^ R8 r- ■*3- X D6 S3 O . 6 1 G // // // // t D8 S4 6 » 6 1 G v+ i K2 10 12 14 16 o o- o o o o- o o- o o- o o- o o o o- T D1...D8 = 1N4148 6 * 6 1 G 11 K4 13 15 [R 4 R1 T V+ ©) BC547 ” 5 © I BC557 3 BC547 R7 10k LED1 M © (M BC547 BC547 R6 LED2 || K1 XLR 1N4001 C2 lOu 25 V C4 lOOn C5 lOOn C3 1 0Ou 16V 130321 - 11 Figure 1. Schematic of the Channel board. Intelligence supplementary to that of the (Deputy) Stage Manager comes from a PIC micro. Communication with other Channel boards is through connector K2. www.elektor-magazine.com May 2014 27 •Projects Figure 2. The Slave (Remote) board is entirely passive. To clear or not to clear... The option of using the "Clear" button is down to the preference of the Stage Manager (SM). With professional casts and stage crews he/ she would probably not use the "Clear" func- tion and just expect the appropriate people to react correctly at the right time. With less expe- rienced cast members and stage crew it is defi- nitely an advantage to have the "Go" light stay on until the SM can see that the people have responded. With the cast and crew in our local Community Theatre it certainly makes a differ- ence having the "Go" light on for a longer period. Enabling the "Clear" function means that the SM doesn't have to hold down the "Go" but- ton until he or she sees some action on stage! In the original prototype one of the ADC channels was used to read an external pot which controlled the on-time delay of the "Go" LED after the "Go" button was released. The mock-up was shown it to a couple of retired stage managers living near Figure 3. State diagram for "Clear- included" mode of operation. V Power on with Clear button without Clear button Figure 4. State diagram for "Clear- not-included" mode of operation. s [ alternating l red/green remote pressed < 3 - r remote released V LEDs off red LED flashing go red LED off green LED on remote pressed r remote released V. alternating red/green 28 May 2014 www.elektor-magazine.com Intelligent Cuelight System the author and both said that they didn't think that function was a very useful feature, and hav- ing the option of keeping the "Go" LED on and using a "Clear" button would be much better. It was easily changed with a simple software mod- ification so was built-in. The difference between the PIC12F615 and -629 is the absence of A/D. In the first prototype the -615 was needed. Circuit description; software creeping in The schematic of the Intelligent Cuelight System comes in two parts: Figure 1 for the Channel board, and the much smaller Figure 2 for the Slave board. Pin 2 on JP1 (effectively pin 2 on the PIC) is the "Clear" input of a channel board. It is read by the software at startup and the sub- sequent behavior depends upon its level. If the pin is tied to V+ at startup with a jumper across pins 1 & 2 (i.e. pin 2 on IC2 effec- tively pulled Low) the software will ignore that pin from then onwards, and the green "GO" LED will extinguish a second or so after the assigned "GO" button is released. If the jumper pin is floating at startup (i.e. pin 2 on IC2 pulled High) then the "CLEAR" function is activated. This can be done in either with a "CLEAR" button per channel connected between pins 1 & 2 on JP1 or with a common "CLEAR" but- ton connected between V+ and pin 4 on the rib- bon cable bus on K2. In the latter case a jumper between pins 2 & 3 on JP1 is required. Instead of using links an SPDT switch can be connected to the jumper JP1. In one posi- tion it will connect pins 1 & 2, disabling the "CLEAR" function. In the other position it will connect pins 2 & 3 on JP1, allowing the common bus line to be used for the "CLEAR" function. Two state diagrams show how a channel board and remote board work, depending on the set- ting of JP1 at power-up: with Clear, Figure 3, and without Clear, Figure 4. In terms of the current source constellations T1-T5 and T7-T11, the design could have been Figure 5. Component mounting plan for the Channel board. Component List Channel Board, no. 130321-1 Resistors R1,R8,R11,R18,R21,R24 = 47kft 5% 250mW R2,R3,R4,R5,R7,R9,R12,R13,R14,R15,R17,R19,R2 0,R22,R23,R25,R26 = lOkft 5% 250mW R6,R16 = 36ft 1% 250mW RIO = 4.7kft 5% 250mW Capacitors C1,C4,C5 = lOOnF 50V C2 = lOpF 16V radial C3 = lOOpF 25V radial Semiconductors D1,D2,D3,D4,D5,D6,D7,D8 = 1N4148 D9 = 1N4001 LED1 = low current, 5mm, green LED2 = low current, 5mm, red T1,T9 = BC557 T 2 ,T 3 ,T4 ,T 5 ,T 6 ,T 7 ,T 8 ,T 1 0 ,T 1 1 ,T 1 2 ,T 1 3 ,T 1 4 = BC547B IC1 = PIC12F629-I/P, programmed, Elektor Store # 130321-41 [3] IC2 = 78L05 Miscellaneous K1 = 3-pin XLR socket, PCB mount K2 = 16-pin (2x8) boxheader, 0.1" pitch JP1 = 3-pin pinheader, 0.1" pitch K4 = 2-pin pinheader, 0.1" pitch K5 = 6-pin pinheader, 0.1" pitch PCB # 130321-1 [3] T1 T2 T3 T5 T4 *\j *\j !T\T6 /V?A\T12 ledi (C)Elektor « 130321-1 VI .0 LED2 < HHHHH ' R17 > ■ « H~ R14 ~|^ H ~ R15 T9 T7 T8t-|(t. Til 1T\T14 D2 -OEh •4DEH D1 •KGEh D4 * ,D6 •4GEH HEH D5 HE5>^ 8 C5 SB -'•Jo o# J — SB *VJ 00 Cl Kseosss® 00 0 + www.elektor-magazine.com May 2014 29 •Projects Listing 1. Excerpt of assembly code (.asm) file ; Main code starts here ? MAIN BSF STATUS, RP0 MOVLW TRISIO_DATA MOVWF TRISIO MOVLW OPTION_DATA MOVWF OPTION_REG MOVLW ANSEL_DATA MOVWF ANSEL ; Select Bank 1 ; Set port direction register ; Set OPTION register. ; No analog inputs. BCF STATUS, RPO ; Select Bank 0 MOVLW GPIO_DATA MOVWF GPIO ; Initialize GPIO. CLRF FLAGS ; Initialize the file registers. CLRF STATE_MACHINE CLRF ACK_BUT_REG CLRF GO_BUT_REG CLRF SBY_BUT_REG CLRF CLR_BUT_REG CLRF PULSE_RELOAD CLRF GPIO VALUE 1 Figure 6. Component mounting plan for the Slave board. in > co i c fn i o s cnm rs a bit less complicated if the LEDs would simply be switched on and off using one bipolar transistor or FET. But the constant current (~0.6 V/36 Q. = 17 mA) drive concept used in this design actually only uses two extra transistors but has a couple of benefits. Firstly the length of the connections makes no difference to the LED brightness and secondly the power supply can be any- LED 1 LED2 '.O M thing which comes to hand. It could be as low as 9 V and as high as the high voltage limit for the 5-V regulator (usually about 36 V). For a porta- ble system that's quite an advantage as, if the power supply is lost or fails, any handy one can be used as a replacement. The complexity in the cable driver comes from the need to always have the supply voltage available I J f®l J1 1 e-iEr* fil J UBlh ' (C)Elektor 130321-2 R1 VI .0 mJ 0© LED2 lIdI Component List Slave Board, no. 130321-2 Resistor R1 = 47kQ 5% 250mW Semiconductors D1,D2 = 1N4148 LED1 = low current, 5mm, green LED2 = low current, 5mm, red Miscellaneous K1 = 3-pin XLR plug, PCB mount SI = pushbutton PCB # 130321-2 [3] 30 May 2014 www.elektor-magazine.com Intelligent Cuelight System CLRF GPI0_VALUE_2 MOVLW TICKS_PER_50MS ; Timer ticks for 50mS. MOVWF TICK_COUNT INT_ENABLE MOVLW (1 << GIE) | (1 << T0IE) ; Enable Timer 0 & Global interrupts. MOVWF INTCON CHECK CLEAR BUTTON BTFSC GPIO , CLR_BUT_BIT ; Check if CLEAR button pressed (link is closed). BSF FLAGS , USE_CLR_BUT_FLAG ; Pin is high, so set the flag to use it. MOVLW RED_LED_ON ; Turn RED LED on. BTFSS FLAGS , USE_CLR_BUT_FLAG ; If using CLEAR button then show RED LED. MOVLW GREEN_LED_ON ; Otherwise show GREEN LED. MOVWF GPIO ; Write value to LEDs. MOVLWTWO_SECONDS ; Show the appropriate LED for two seconds. MOVWF PULSE_COUNT BSF FLAGS, TIMER_FLAG CHECK CLEAR BUTTON 2 BTFSC FLAGS, TIMER_FLAG ; Wait for timer to finish. GOTO CHECK CLEAR BUTTON 2 MOVLW BOTH_LEDS_OFF ; Turn off LEDs. MOVWF GPIO at the remote terminal for signaling. When the system is inactive the positive supply is routed to both legs of the LEDs so that pressing the Acknowledge button when no LEDs are lit still provides signaling capability (through the isolat- ing diodes). One of the positive supplies must be switched off when the LEDs are lit, which requires the extra transistors. For a completely wired channel board four DPDT switches would be needed for selection of the SB (standby) / GO bus(-es) it should respond to. Plus one SPDT for the Clear setting and (optional) one pushbutton if the channel must be cleared indi- vidually. All channel boards are interconnected with a 16-way flatcable on K2 (mounted on the bottom side of the PCB!), which not only connects the channels to the four SB/GO buses and the Master Clear bus, but also links all boards to the power supply; only one board will have a direct link to the power supply on K4. In many practical situations not all switches will be needed and/ or used, and the complete setup will depend on the performance, play, number of actors, the- ater, and so on. Finally referring to the schematic in Figure 2, every channel has its Slave/Remote board, connected via a 3-wire XLR cable. The remote boards will only need a pushbutton SI if the performers should acknowledge that they are ready or if they— for some reason— must be able to draw the attention of the Stage Manager (in cases of stage fright, collapsing stages and such...). If this button is not needed, resistor R1 and 1N4148 diodes D1 and D2 can also be omitted on the remote board. www.elektor-magazine.com May 2014 31 •Projects Figure 7. DIY programmers! Abide by these fuse settings and you're okay for burning your own PIC12F629(s) for the project. Firmware Every single channel board has a microcontroller (PIC12F629), ready programmed available from the Elektor Store as no. 130321-41. Another option is to buy blank microcontrollers from your local supplier, download the firmware or even the assembler code file from the Elektor Magazine website [3] free of charge and do the program- ming with a programming/debugging interface like the Microchip PICkit or ICD connected to K5. A code extract is shown in Listing 1, and the ever popular programming fuse settings are shown in the screendump in Figure 7. ( 130321 ) Web Links In addition to that, there will be a maximum of four SB and four GO buttons connected to the buses, plus one Master Clear. All in all quite some wiring to do if one wants to build a complete sys- tem with a lot of channels. [1] www.orbitalsound.com/sales-paging-gds.asp [2] www.leonaudio.com.au/16_channel_cue_ Iight_mk4.pdf [3] www.elektor-magazine.com/130321 Assembly The system consists of one or multiple Channel boards and associated Slave boards. The board layouts designed by Elektor Labs are shown in Figure 5 and Figure 6 respectively. Here we're looking at plain old through-hole parts on dou- ble-sided boards so assembly should not pres- ent too much of a problem to the 'e-volunteer' appointed by the Company of Actors & Stage Assistants— by democratic vote of course. c m » (M —• I « in > ® o e CD 3 - z O CD •-> 32 May 2014 www.elektor-magazine.com DVD ed: The Full Range of 2000-2009 Vo I umes of Elektor Magazine! through! m Jektor CuMamJ ©lektor ¥ lO YEARS OF ELEKTOR ON DVD O *' e 5 f ™»nK Archive, Article PDFs Quick Search Function ° fcwVSr; “Sr ° v " «»» — 1C* t-Have nnoifc' iu ai iqea^ auc ■■ ?X tmsctjoM i^KiOE. |q,j" |OL ||€C LC |J k n UC|IO '9003, ROM 5 2D 25-3. n.^JHdrthrdUbn^n. ISBN 978-1-907920-28-8 £77.95 *€89.00* US $121.00 •Projects Microcontroller BootCamp (2) Digital inputs When a microcontroller has to do more than just blindly follow a predefined pro- cess, it needs additional information while the program is running. Inputs enable £ BASCOM-AVR IDE [2.0.7.6] - [C:\Arbeit_neu\Elektor\Uno\Unol\Progl\UNOJnput4.bas] (H) „ File Edit View Program Tools Options Window Help 35 DVM2.bas ^ UNOJnputl.bas UN0_Input3.bas ^ UN0_Input4.bas S3 ▼ Label UNO_Input4 . BAS Sregfile = "m328pdef.dat' Scrystal = 16000000 if ig PORTB if ig PORTC Then End If. The instructions inside the If block are executed if the condition is fulfilled, and otherwise these instructions are not executed and the program jumps directly to End If. In the program in Listing 3 you can also see another new instruction called Toggle, which means "switch to the opposite state" and causes the output to change state each time the instruction is executed. The blinker runs as long as the signal level on port pin PC5 is logic 1, which means 5 V or at least something higher than 2.7 V. When the input pin is connected to ground, which corresponds to logic 0, the LED remains in its current state - either constantly lit or constantly dark. The circuit is the same as in Figure 1. Here as well, you can test the circuit by connecting the input to ground or +5 V, or by touching it with your finger. An interesting aspect in this regard is that your finger acts like a high (logic 1) signal. This means that if you touch the input pin when nothing else is connected to it, the LED will blink at a steady rate. This results from the Wait instruction in the If block. When the program sees a 0 level on PC5, it immediately jumps to End If and then back to the start of the loop. This means that a 0 level causes the If condition to be tested repeatedly in rapid succession. If you apply a 50-Hz signal to the input by touching it with your finger, after at most 10 ms a 1 level is detected at the input. Then the Listing 2. Inverting the input signal. ' UN0_Input2 . BAS i $regfile = "m328pdef.dat" $crystal = 16000000 i ' ATmega328p '16 MHz Config Portb = Output Config Porte = Input Do Portb. 5 = Not Pine. 5 Loop 'Inverted Input to Output Listing 3. An If block. ' UN0_Input3 . BAS i $regfile = "m328pdef.dat" $crystal = 16000000 i ' ATmega328p '16 MHz Config Portb = Output Config Porte = Input Do If Pine. 5 = 1 Then Toggle Portb. 5 Waitms 250 End If Loop www.elektor-magazine.com May 2014 39 •Projects Figure 7. A pull-up resistor. LED changes state and the program waits 250 ms before testing the If condition again. This aspect of the program also shows you what you shouldn't do. Open inputs are bad news and cause nasty problems, especially if you overlook them. In the case of this simple program, it's totally unpredictable what will actually happen when nothing is connected to the input. The input may be at the high level, in which case the will LED blink, or it may be at a low level, in which Listing 4. Polling a port with a pull-up resistor. ' UN0_Input4 . BAS i $regfile = "m328pdef.dat" $crystal = 16000000 i ' ATmega328p '16 MHz Config Portb = Output Config Porte = Input Porte. 5 = 1 ' Pullup Do If Pine. 5 = 1 Then Toggle Portb. 5 Waitms 250 Else Portb. 5 = 0 End If Loop case the LED will not blink - but you can't say in advance whether or not the LED will blink. If you hold your hand close to the input and move your feet, the static charge on your body can cause the port to change states as a result of capacitive coupling through the air. An outside observer who doesn't know all the details might start looking for a pesky intermittent contact, and perhaps start to doubt the reliability of microcontrollers in general. Many experienced designers have learned about this the hard way by spending hours looking for a suspected software bug or hardware error, when the actual problem was an open input. Reading switch states with a pull-up resistor From the above, we can conclude that open inputs cause problems. Suppose you want to read the state of a switch. This means that the input must have a defined state when the switch is open. The usual way to achieve this is to use a pull-up resistor, which is a resistor connected to Vcc to pull the input high when it is open. If the microcontroller sees a low level at the input, it knows that the switch connected to the input is closed. The pull-up resistor in Figure 7 is shown connected by dashed lines, which means that the resistor is optional. This is because the microcontroller has built-in pull-up resistors; all you have to do is connect them. Many microcontrollers have a separate register for this purpose. However, AVR microcontrollers manage to handle everything with a total of three registers: PORTC, PINC and DDRC. In this case you set all bits of DDRC to 0, which configures all pins of port C as inputs. You also set all bits of PORTC to 1, as though you wanted to set all the pins to high outputs. What actually happens in this case is that each port pin is connected to Vcc by an internal pull-up resistor (marked "Rpu" in Figure 3) with a resistance of approximately 30 kft. This causes the input pins to have a high signal level and a relatively low input impedance, instead of a high impedance. As a result, all bits in PINB will be read as 1 unless they the corresponding pin is connected to ground by an external switch. In Listing 4 you only need the instruction Porte. 5 = 1, which connects the internal pull-up resistor to pin PC5. The other inputs of port C are left in the high-impedance state without a pull-up resistor. That doesn't matter here because they are not used in the program. With this change, the program response is unambiguous. An open 40 May 2014 www.elektor-magazine.com Microcontroller Bootcamp input is always read as a high level (logic 1), and the LED blinks. Another change is necessary to ensure that there is no ambiguity when the switch is closed. This consists of adding an Else section to the If block. The instructions between Then and Else define what has to be done when the switch is open, and the instructions between Else and End If define what has to be done when the switch is closed. In this case, the LED should be off then. By the way, you might want to measure the actual value of the internal pull-up resistor. The data sheet says that it is somewhere between 20 kQ. and 50 kft. To check this, connect an ammeter to the input pin instead of the switch, or in parallel with the switch. In our case, we measured 140 pA. This corresponds to a resistance of 35.7 kQ. (5 V + 0.14 mA), which is exactly in the middle of the range specified by Atmel. ( 130568 - 1 ) Web Links [1] www.elektor-magazine.com/120574 [2] www.elektor-magazine.com/130568 Latch-up You can use the input protection diodes of the port pins intentionally in your circuits to limit input voltages higher than Vcc. To take an RS232 interface as an example: the signal voltage on the output line of a PC serial port is often -12 V and +12 V, or in some cases somewhat less. This is a complete mismatch to CMOS inputs with 5 V signal levels. The quick and dirty solution is to connect the signal line directly to the input through a protective series resistor (value 10 kft or 100 kft) as illustrated in Figure 1. Here the protection diodes take care of the rest. However, there's one thing you have to watch out for: the current through the protection diodes should never exceed a few milliamperes. This is because every CMOS IC has a parasitic thyristor that can be triggered unintentionally. It basically consists of an NPN transistor and a PNP transistor, which are a sort of undesirable side effect of the CMOS structure. This thyristor can be triggered by the current through the protection diodes if it rises above a certain value, which might be 100 mA or as high as 1 A —but you never know the precise value. The worst thing about this is that even very short current spikes can trigger the thyristor. After the device enters the latch-up state, what happens next depends on how much current the power supply can deliver. The latched CMOS IC draws as much current as it can and gets blistering hot. So if you get your fingers get burned, switch off the power right away and wait a few minutes. There's still a small chance that the IC will have survived, but in most cases it's game over. If you measure the resistance between the Vcc and ground pins, you'll only read a few ohms. If your body has a static charge and you touch an IC input, the current pulse may be large enough to trigger latch-up. Many modern ICs can withstand static discharges up to 15 kV, based on a human body model with a contact resistance of 1 kft. In that case the ignition threshold is about 15 A, and you can certainly feel static discharges of that magnitude. However, no IC can survive contact with a 12 V power lead lying loose on the bench, especially if the power supply has a hefty output capacitor. If the power lead touches an IC pin, the microcontroller is guaranteed to be dead. Have a look at the circuit diagram in the above figure. Do you see anything to be worried about? To all appearances, the only thing the capacitor on the input does is to debounce the switch contacts. This is common practice to ensure that the microcontroller only sees a single level change when the switch contacts bounce back and forth a few times. What the circuit diagram doesn't show is the length of the wires and their inductance. If you imagine an inductor in the circuit as shown in the middle diagram, you have something that looks a lot like Marconi's spark-gap transmitter. When the switch is closed, there is an excited resonant circuit that oscillates at 500 kHz, assuming a capacitance of 100 nF and an inductance of 1 pH There's also enough energy available, since the capacitor has previously been charged through the pull-up resistor. The first peak of the oscillation waveform hits the protection diode with full force, and under unfavorable conditions it can trigger that nasty thyristor. The circuit diagram at the bottom shows how you can prevent this. All you need is a current limiting resistor that soaks up the excess energy. www.elektor-magazine.com May 2014 41 •Projects An RGB LED Lamp With remote control! I LSI! Although the technology has been around for a while, RGB LED lamps are still state of the art for interior lighting. Traditional incandescent light sources found in night clubs, stage lighting, car instrument panels and interior room lighting have all benefited from a semi-conductor makeover. Here we add the convenience of a ready made hand- id remote controller. By Martin Christoph (Germany) Interior designers will tell us that the color of our surroundings has a big influence on our mood. White spaces fill us with a sense of calm sobri- ety. The redder the light, the warmer we feel. Blue light gives an impression of coolness; you are more likely to start shivering in a blue room than you are in a white room. With space at a premium our living areas must now be multifunc- tional. With the appropriate background color, the room atmosphere can be adapted to enhance its suitability for your chosen activity. With the help of a little technology we can now achieve this goal in seconds without resorting to DIY overalls, dust sheets and a paint roller. Instead we can set the background lighting color almost instantly to achieve the desired atmo- sphere. When the dinner table is used by your kids to do their homework you can select a day- light color temperature. This has a hint of blue which will suppress production of the sleep hor- mone melatonin so that they remain alert and able to concentrate (explain this to them care- fully... they now have no excuses). As the time comes for supper, adjust the color of the eating area to give an orange cast to the light; this is not only cozy but is said to stimulate your appe- tite and boost metabolism. In the living room a yellow light gives a sunny radiance and helps lift the mood. When it's time to break out your Barry White albums just lower the lights and dial the mood to red. You can achieve these effects with the lighting unit described here. It consists of a 57 mm diam- eter PCB fitted with four programmable RGB LEDs. To set the light color you don't need to fumble around with switches or controls on the unit; you can use a TV remote controller handset to give you just the right lighting effect. Special components The complaint you hear most often about RGB type LEDs is that the blue emitter is less intense than the other two colors. For some time now Osram have had their MultiLED devices on the market. These come in an SMD package with six connection pads and achieves an output of 370 mcd from the blue emitter (even up to 560 mcd in the upper blue wavelength). This is a distinct improvement compared to other multi color LED devices. The increased brightness in this range is beneficial because our eyes are less sensitive to the blue end of the spectrum than they are to the yellow region for example. In 42 May 2014 www.elektor-magazine.com RGB LED Lamp addition the short blue wavelength gives a good impression of a fully saturated blue light. Using the MultiLED gives you a more even coverage of the complete RGB spectrum. The MultiLED type LRTB G6TG contains three independently con- trollable LEDs emitting wavelengths of 632 nm (red), 523 nm (green) and 465 nm (blue). This series also contains other types with different brightness relationships [1], here we use the type given in the parts list. The circuit diagram, Figure 1 shows four LED units with the same color LED in each unit con- nected in series. An LED boost driver drives each of the three colors. There are a number of ICs available for this purpose; here we have chosen the NCP5007 from ON Semiconductors [2]. This particular IC is relatively low cost and can drive up to five series-connected LEDs. The NCP5007 needs just five external components mostly for power decoupling. A resistor connected to the FB pin defines current through the LED chain. Two methods can be used to control LED bright- ness: an analog voltage (or PWM signal with an R/C filter) applied to the FB input or pulse width modulating the IC Enable input which we have used here. A standard IR receiver module type TSOP31236 (for a 36 kHz carrier frequency) is used to demod- ulate the IR signals. An Atmel ATmega328 (as K1 o a o a ISP MOSI 1 MISO SCK RESET K2 a a a a a a 10 1 TSOP31236 +5V 15 16 17 29 23 24 25 30 31 32 VCC VCC PB3(MOSI/OC2) PB4(MISO) PB5(SCK) PC6(RESET) PCO(ADCO) PCI(ADCI) PC2(ADC2) IC4 AVCC PBO(ICP) PBI(OCIA) PB2(SS/OC1B) PC3(ADC3) PC4(ADC4/SDA) PC5(ADC5/SCL) ADC6 ADC7 ATMEGA328P-AU PDO(RXD) PD5(T1) PDI(TXD) PD6(AIN0) PD3(INT1) PD7(AIN1) PD4(XCK/T0) PD2(INT0) GN DGNDXTAL1 XTAL2 AREF GN * CIO X t 8 C11 18pF Tl8p —T~ 12 13 14 26 27 28 19 22 _10 11 20 21 C12 lOOn ♦♦ M M ♦♦ i H H H H i LED2G LED1G LED4G LED3G +5V©- ♦♦ M M ♦♦ i H * H * H * H * LED3B LED2B LED1B LED4B +5V©- ♦♦ M M ♦♦ i H H H Hi LED1R LED4R LED3R LED2R +5V@- 130268 - 11 Figure 1. The controller receives IR commands and controls the LEDs using PWM signals. www.elektor-magazine.com May 2014 43 •Projects used in the Arduino) decodes the IR command messages, converts them into RGB values and outputs them to the hardware PWM pins on the LED boost driver chips. An 8 MHz clock is more than adequate for this work so the microcontrol- ler's own internal clock is used here. The board's low power requirements allow the use of a micro USB socket for connection of an external USB power adapter. All components in the circuit have an operational voltage range between 2.7 and 5.5 V so there is no need for any additional on-board power regulator. Altogether there are 28 components (11 different types). The PCB layout includes some expansion options for future use but aren't necessary for operation of the unit. These measures include pads on the PCB to allow an external crystal to be fitted and also some GPIOs available at the SIL pin header K2. RC5 to HSV to RGB to PWM The special feature of this RGB LED controller is that it uses a standard TV remote control- ler to send color and brightness information to the lamp. The circuit receives IR signals in RC-5 format, converts the commands to HSV color A color model primer The work most engineers get involved with rarely requires them to have an appreciation of color manipulation and representation. This is an area where the worlds of art and science touch. It's probably fair to say most are already aware of the red green and blue (RGB) color concept in connection with computer monitors and cameras pixels and also that Cyan, Magenta and Yellow are used for color representation in printing. But most people won't be familiar with the concept of a color wheel (or is that a color sphere?) which contains all the base colors and the mixes of base and complementary colors. And what's all that about white/black and achromatic? Open up the color picker in Photoshop (or the corresponding tool in a similar graphics program) and have a play around with the options. On the left is shown a section from the color field which is represented on the vertical color slider in the centre. When you click here the selected color is shown in a box and beneath it are the corresponding RGB values for the color. Each of the three colors can have a value from 0 to 2 8 -l = 255, when RGB = 255,255,255 this indicates the color white and RGB = 0, 0, 0 represents black. Underneath these values are the RGB values in hexadecimal and on the right are the CMYK values (in percentage) of the color used by printers (K stands for Key and refers to the black value). While the color information can be given by these three values it doesn't give us the whole picture because although we have color information there is nothing about brightness or amount of black or white. Above the RGB and CMYK values in Photoshop there are also HSB and Lab values for the selected color, these two systems do not suffer from the same shortfall and are preferred by the professionals. The RGB lamp controller uses the HSV color model (Hue, Saturation and Value) also known as the HSB (Hue Saturation and Brightness) to control the LED light output: (photo source: Wikipedia [3]): Hue The hue is defined with an angular value where Red is (0°), yellow (60°), Green (120°), Cyan (180°), Blue (240°), Magenta (300°) Saturation The color saturation is given as a percentage. The color saturation is greatest at the edge of the circle (100 %) and at the centre (0 %) only grey (white to black) Brightness The brightness is given as a percentage indicating how much white/black the color contains. 100 % indicates none, 0 % is maximum black. These coordinates are sent by the remote controller handset. 44 May 2014 www.elektor-magazine.com RGB LED Lamp Undergo the Red / Green / Blue Miracle model information to control the LED light out- put. HSV is also sometimes referred to as HSB which substitutes the word Brightness for Value. If the color wheel concept is completely alien to you, take a look at the color wheel primer in this article. This should give you a quick introduction to phraseology graphic designers use for color representation. The firmware decodes infra red RC5 signals from the remote controller (for TVs with a device code ID 0) and converts these values internally to levels of hue, saturation and brightness. Next comes a HSV/RGB conversion in accordance with the algorithm described in [3], finally the new values of PWM signals are calculated and sent to the boost-converter IC's. The firmware uses in-phase 8-bit PWM and the controller's PWM hardware functions. The saturation and brightness levels are defined with almost 8-bit resolution. The LED controller can be configured to learn the RC5 codes generated by your TV remote controller. First short together pins 1 and 2 of on the expansion header K2 then power up the LED controller. In this 'learn' mode the LED color will be green (instead of blue which indicates normal operation). Now press the twenty pushbuttons on the RC-5 remote controller in the sequence given in Table 1 for the controller to learn all the codes. Each button pressed is acknowledged by a green flash from the LED controller. All other push buttons on the remote controller have no function in this application. Use full saturation of a base color (not white) when setting the hue. You will soon get a feel of how it functions when you have played with the controller for a bit and tried out all the lighting and color options. A standby function is implemented in the firm- ware; pressing the eleventh button (POWER) turns out the light (brightness = 0) and current consumption of the LED controller drops to a few hundred microamps. This low current standby mode is necessary to keep the IR receiver active so that signals from the remote controller can wake up the LED controller. When the controller goes to standby the most recent color settings are stored in EEPROM and reloaded on wakeup. The same procedure is followed when a power outage occurs. Unknown IR signals can bring the controller out of standby but if no valid command is received it quickly returns to standby mode. At this point we should point out a problem we discovered: To test the LED lamp controller we bought a 13-1 universal replacement IR remote controller (type IM-1313) which we configured to send type RC-5 device ID 0 (TV) control signals. The all-in-one controller however caused a prob- lem: when the button on the right was pressed to increase the hue angle it sent more than one RC-5 command which set the saturation level to zero at the same time. When this happened the hue button had no further effect on the color. If you get this problem try to find an original Philips TV remote controller from a boot sale or on-line auction site. That is guaranteed to send the correct codes. Using a needle tip Just looking at the PCB in Figure 2 you can see that your large soldering iron bit isn't going to Table 1. The remote controller operating keys Key Function 1 Brightness 1 2 Brightness 2 3 Brightness 4 4 Brightness 7 5 Brightness 11 6 Brightness 16 7 Brightness 22 8 Brightness 32 9 Brightness 252 (maximum) 0 Brightness 0 Power Sleep-Mode, Brightness 0 red Switch hue to red (0°) green Switch hue to green (120°) yellow Switch hue to yellow (60°) blue Switch hue to blue (240°) up Increase saturation down Reduce saturation left Reduce hue angle right Increase hue angle OK Switch saturation from max to min www.elektor-magazine.com May 2014 45 •Projects Component List Resistor R1,R2,R3 = 10ft, 0.25W, 1%, SMD 1206 Capacitors C1-C6,C8,C9,C13-C20 = lpF 16V, 10%, X7R, SMD 0603 C7,C12 = lOOnF, 25V, 10%, X7R, SMD 0603 C10,C11 = 18pF, 50V, 5%, C0G/NP0, SMD 0603 (not used) Inductors L1,L2,L3 = 22 pF, 0.5A, 20%, R DC 0.575 ft (Wurth 744025220) Figure 2. The circular PCB populated with SMD components. Semiconductors D1,D2,D3 = BAT54 LED1-LED4 = LRTBG6TG-TU7 1+V7AW-36+ST7-68 (Osram) Mouser # 720-LRTBG6TGTU71V7AW IC1,IC2,IC3 = NCP5007 IC4 = ATmega328P-AU, progerammed, Elektor Store # 130268-41 IC5 = TSOP31236 Miscellaneous K1 = 6-pin (2x3) pinheader, 0.1" pitch K2 = 10-pin pinheader, 0.1" pitch K3 = Micro-USB Type B, right angled, SMD, Molex 47346-0001 PCB # 130268-1 Alternative for LEDs: LRTBG6TG-TV-1+VAW-36+ST7-69-20-R18-IB (Os- ram) RS Components # 697-3682 be of much use here, to fit the SMD components you will need a fine needle bit. The 57 mm diam- eter PCB populated with all SMD components (except the IR receiver and headers) and the pre-programmed controller can be ordered from the Elektor shop [4]. If you are not planning to make any mods to the controller software your- fc&iVU/O (OCLEKTOQ v 130260-1 kvl.0 — self (The source and hex files for the project together with programming tips can be found at [4]) or need to alter the code (this would be necessary if you were planning to use a different remote controller which has a different device ID) then you can leave out the ISP connector Kl. The same goes for the expansion connector K2, although you will need to use a two pin header between positions 1 and 2 to enable the learning procedure (alternatively just use a temporary wire bridge here). To get a more diffuse lighting effect, try fitting a frosted acrylic half-globe over the PCB. It should be possible to source such an item from a hobby supply outlet or on-line. The circuit takes a maximum of 170 mA with all the LEDs at maximum intensity. The majority of USB ports will be able to source this level of current without any problem. The USB connector is only used for supply of power; the data signal lines are not connected. Pin 10 (+) and Pin 4 (-) of connector K2 provides an alternative point to power the circuit. ( 130268 ) Web Links [1] www.mouser.com/ds/2/311/RTB_G6TG_Pb_free-258912.pdf [2] www.onsemi.com/pub_link/Collateral/NCP5007-D.PDF [3] http://en.wikipedia.org/wiki/HSL_and_HSV [4] www. elektor-magazine. com/1 30268 46 May 2014 www.elektor-magazine.com Display Week is Che premier, must-see showcase for g ubal infcrriatior: display companies and researchers looking to unveil cutting-edge developments in display technology. Not only did Display Wee* give Che world its first glimpse at technologies such as LCDs, pasmE and OLECs Chet have shaped today's d' splay industry - but it's also where emerging industry trends sucn as 4K, touch and interactivity, flexible and e-paper displays, solid-state lighting and plastic elect no hies will catch your eye No other display event in the world offers Display Week’s unique combination of qualified attendees, technologies and exhibitors networking and educational opportunities, vital trade information, and state-of-the-art symposium presentations You won't wait to miss this years event, so set you r sights on June 1-6, 2014 at the San Diego Convention Center. FLEXIBLE DISPLAYS 4Kx2K Benefit now: Elektor PCB Service offers a permanent 90-day launch discount on new Elektor PCBs! •Projects Current Probe with Transimpedance Amplifier 1™™!" °“ mann Wideband alternating current measurements R1 This article describes how easy it can be to use a current transformer to make precise measurements of alter- nating currents. We use a wide variety of readily-available ferrite cores in con- junction with a simple circuit incorpo- rating a transimpedance amplifier. Figure 1. Current measurement using a transimpedance amplifier. Figure 2. AC coupling eliminates the effect of the offset voltage. Figure 3. The LT1010 can deliver a higher current. Figure 4. The circuit of Figure 3 in use. i R1 R1 In a previous installment [1] we saw how the lowest operating frequency of a classical current transformer is determined by the shunt imped- ance on the secondary side: if this is reduced, the lowest operating frequency also goes down, but the sensitivity of the device is also corre- spondingly lower. The question therefore arises whether it is possible to extend the lower fre- quency limit with the help of a bit of electronics. Ideally we would like to be able to work with a shunt having R = 0, and this can be achieved using a transimpedance amplifier. The outline of the circuit of such a current probe is shown in Figure 1. The operational amplifier controls its output such that the current through R1 exactly compensates for the current through the secondary coil, and hence the differential input voltage to the ampli- fier is zero. Since the voltage across the sec- ondary coil is zero, it is in effect short-circuited. The output of the circuit is matched to a 50-ft impedance, and the effective transfer impedance is thus given by: Rl 2N Unfortunately we cannot realize the circuit directly in the form shown. The reason is that, from a DC point of view, the input to the operational ampli- fier is effectively short-circuited by the coil and so no negative feedback is provided by Rl. The quiescent output of the operational amplifier will 48 May 2014 www.elektor-magazine.com Current Probe therefore be equal to its offset voltage multiplied by its open-loop DC gain. If, for example, the offset voltage is 1 mV and the open-loop gain is 100,000, then the amplifier will go into satura- tion. To solve this problem we add a capacitor C in series with the secondary coil, as shown in Figure 2. The lowest operating frequency is now determined by the resonance of the circuit formed by L and C. If we let N = 25 and select a ferrite core with A l = 3 pH/A/ 2 , then we have L ~ 2 mH. To achieve a resonant frequency f res = 20 Hz we need C = 35,000 pF, which is rather large. Figure 3 shows an assembled prototype, where C = 33,000 pF is formed often electrolytics in parallel. A type AD8055 operational amplifier is used, with a bandwidth of 350 MHz. Its output is capable of delivering up to around 50 mA, which allows currents of up to about A/x50 mA = 1.25 A to be measured. Adding an LT1010 buffer after the AD8055 (Figure 4) increases the maximum mea- surable current to 5 A. The main disadvantage of this circuit is the requirement for a large capacitor, needed to allow negative feedback at DC for the operational amplifier. An alternative would be to provide an 'active' negative feedback path using another operational amplifier. The complete circuit that results is shown in Figure 5. Regulator IC1 provides the 10-V supply for the operational amplifiers. A mid-level 'ground' is generated by IC2a. The transimpedance amplifier is built around IC4, with IC2b in effect providing a reference voltage for the secondary coil of the current transformer. IC2b adjusts this voltage to ensure that the DC level at the output of IC4 is zero. The gain can be set using R8. Practical use For a first example we measured the primary and secondary currents in the transformer of a small switching supply (Figure 6). The two upper traces in Figure 7 show the primary current, the first measured using a Tektronix TC202 cur- rent probe and the second using our transimped- ance probe. There is good agreement between the traces. The lower trace shows the secondary current, measured using a Vitroperm ring core (see [1]). Since the unit under test is a forward converter, primary and secondary currents are aligned with one another. IC1 Figure 5. Circuit with offset voltage control. Figure 6. Making measurements on a switch-mode power supply. Figure 7. The upper two traces show the primary current (measured with a Tektronix TC202 current probe and with the transimpedance current probe); the bottom trace shows the secondary current. www.elektor-magazine.com May 2014 49 •Projects Figure 8. Measuring the current in a coil in near-saturation. Figure 9. Voltage (above) and current (below) measurements on a drum-core inductor. Measuring saturation Having a way to measure currents accurately lets us look at the behavior of coils at higher currents. Figure 8 shows measurements being carried out on a drum core inductor. The current was measured using a shunt and then using the current transformer. Figure 9 shows the coil voltage (above) and the coil current (below). The current waveform is triangular and the peaks show that the core is already in saturation. To generate the high cur- rents needed for this experiment a half-bridge driver circuit (Figure 10) was used. Other core shapes It is of course possible to use cores with other shapes to make current transformers. Sometimes there is a requirement to make measurements on circuits where the lowest frequency present is only in the tens of kilohertz, and in these cases the lower frequency limit on the probe is less crit- ical. For example, a ferrite bead with ten turns of wire can give R = 2 Q (see Table 1), a transfer impedance of 0.1 V/A, and a lower frequency limit of around 5 kHz. Figure 10. Half-bridge driver circuit for producing higher currents. Figure 11. Measuring current using a ferrite bead. Figure 11 shows a ferrite bead being used to measure the current on the primary side of a switching supply based on a flyback converter. The results were compared with the Tektronix TC202 probe, and as Figure 12 shows we get good agreement between the two measurements. Binocular-core ferrites Leafing through the manufacturer's datasheets we discover the BN73-202 binocular core with an A l value of 14 pH/A/ 2 . This is surprisingly high, and makes possible the construction of a current transformer with a lower frequency limit of around 10 Hz (see Table 1). Figure 13 shows the bin- ocular core being used as a current transformer. The core was used to measure the input current of a switch-mode mains power supply. Figure 14 shows a comparison against the results from the Tektronix probe, and again we get good agree- ment between the curves. Split-core ferrites The core shapes described above have the dis- advantage that the wire carrying the current to be measured has to be threaded through a hole. This can be avoided using a split-core ferrite (Fig- ure 15) of the type used for suppressing electro- 50 May 2014 www.elektor-magazine.com Current Probe Figure 12. Measuring the current in a transistor in a switching power supply. Figure 13. A binocular core can be used as a current transformer. magnetic interference. The low A L value of these cores makes them really suitable only for higher frequencies, but they can nevertheless be used in conjunction with the transimpedance amplifier. Conclusion The circuits, experiments and measurements we have described show how simple equipment can be used to replace an expensive professional cur- rent probe and still obtain good results. We hope that this article will help you to identify where the most significant potential sources of error can lie, and to know how to avoid them. ( 130411 ) nMC-1524 Mid 0*10! 30000 :-W05^2 *ijre ff.rc / fain ■Tli T 120 U-i IgHijiCmv Figure 14. Measuring a current at 50 Hz using the binocular core of Figure 13. Web Link [1] Current Transformer Calculations, Elektor April 2014, www.elektor-magazine.com/1 30410 Figure 15. A split-core ferrite can be used in a current transformer. Table 1. Core A l value |jH//V 2 Windings N Resistance R [ft] Transfer impedance «tr [O] Frequency limit f g [Hz] Pollin 3.0 25 0.50 0.01 42.4 VITROPERM 80.0 25 0.50 0.01 1.6 Ferrite bead 0.56 10 2.00 0.10 5684 Binocular core 14.0 25 0.50 0.01 9.1 Split core 2.2 25 0.50 0.01 57.9 www.elektor-magazine.com May 2014 51 Record frequency variations on the electricity grid By Wolfgang Borst (Germany) Variations in frequency on the electricity grid often arise as a result of differences between supply and demand. Although small, these changes can be measured and, using a neat combination of two existing Elektor projects, can be monitored and recorded automatically. Most people are familiar with the fact that the grid frequency in Europe is 50 Hz, while in other coun- tries such as the USA, 60 Hz is used, and sophis- ticated control mechanisms are used to maintain Features • Monitoring of grid frequency • Logging over long time periods • Logs stored on USB memory stick • Frequency resolution: 2.5 mHz • Absolute frequency accuracy: 25 mHz • Display of instantaneous grid frequency using LEDs • Graphical display of frequency against time • Suitable for use on 230 V or 115 V grids • Suitable for nominal frequencies of 50 Hz or 60 Hz • Full source code available this frequency within very tight bounds. In the author's country, even in exceptional circum- stances the frequency error is normally only at most 0.2 Hz, although in one incident in northern Germany, on the evening of 4 November 2006, an extreme excess of demand over supply led to the frequency dropping almost to 49 Hz for several minutes. The grid frequency can thus be used as a way to measure the balance between energy supply and demand and as a real-time proxy for the health of the grid as a whole. Measure + record = log The excellent 'Grid Frequency Monitor' project published in Elektor in January 2012 [1] pro- vides a convenient means to indicate the instan- taneous grid frequency. The circuit measures the frequency and displays the result using 11 LEDs to give a visual indication of deviations of up to ±0.2 Hz, including two red LEDs that light when extremes of deviation occur. A printed circuit 52 May 2014 www.elektor-magazine.com Grid Frequency Logger r ri % i ft J l H- < ^ »-*. (O g £ * ^9 1 n * ♦ » <» i U it M .* * *. * P'1* #« M (J O • V Jjr * €> Q • < * fife] TOP Js /V * r > # , • *1 - iT \ o o • Nj -A t v •r f a 3rv ^ \ £ f V.# Q * '• o o * ui A board was designed for the project: as Figure 1 shows, the unit, including its on-board trans- former that can be configured to run on 115 V or 230 V for worldwide use, forms a very com- pact module. So this device solves the problem of how to make the measurements that we need. What struck the author after reading that Elektor article was that it would be desirable to have a means of viewing the changes in grid frequency over time, rather than just seeing its instanta- neous value. This involves periodically extracting the frequency readings from the device and stor- ing them somewhere. Since the microcontroller used in the frequency monitor project had a pin to spare and some unused space left in its pro- gram memory, the obvious approach was to equip the monitor with a serial interface over which it could be made to transmit readings. Then the only problem remaining is to store these readings. To receive and process the serial data the sim- plest solution would be to use a PC, which almost everyone would have available anyway. A terminal program, configured to match the communica- tion settings of the modified frequency monitor, could be used to show the results directly. A more elegant approach would be to use the author's specially-written program, which can display the frequency readings graphically (see Figure 2). And even more elegant would be to avoid the use of a PC altogether and create a stand-alone solution. Again in this case we have a ready-made option, in the form of the 'USB Data Logger' project described immediately before the grid frequency monitor in the December 2011 issue of Elektor [2]. This design uses a microcontroller that simply records all incoming data on a USB memory stick. Figure 3 shows the tiny printed circuit board of the data logger. In addition to combining these two projects and modifying the firmware of the frequency moni- tor, the author also wrote a PC-based program to read back data recorded by the data logger on a USB memory stick and display them graph- ically. Bringing these elements together provides a complete solution for long-term monitoring of grid frequency data. Figure 1. Prototype of the grid frequency monitor published in Elektor in January 2012. The compact module indicates the grid frequency using a row of LEDs. Hardware changes As alluded to above, pin P3.1 of the microcon- troller is not used in the grid frequency monitor project: conveniently for us, this can be config- ured as the output of the hardware UART periph- eral. To connect the monitor to the data logger (or to a PC) all we need to do is bring this pin out: literally, in this case, as we simply solder short wires to pin 3 of IC1 and to a ground point on the board to connect to the additional hard- ware interface. Figure 4 shows the original cir- cuit of the frequency monitor, plus (highlighted) Figure 2. The program 'Netzfrequenz_P' can be used to visualize the logged frequency data. www.elektor-magazine.com May 2014 53 •Projects the extra components that comprise the two new interfaces. To connect to the USB data logger we simply use a ten-pin two-row header on a 0.1 inch pitch: it is best to use a box header, mounted on a small extra piece of perforated board. It is important to note that the power supply for the frequency monitor is not adequate to provide the additional power required by the USB data logger and its USB memory stick. This means that pin 1 (+5 V) and pin 2 (ground) on K3 should not be connected to the corresponding points on the frequency monitor board. An additional 5 V power supply is required, connected to these pins using a suitable socket. K3 can then be connected to the logger using a length of ten-way ribbon cable fitted with insulation displacement connectors, Figure 3. Prototype of the USB data logger published in Elektor in December 2011. The microcontroller is responsible for piping data received over its serial port onto a USB memory stick. carrying both the data to be logged and power. A power adapter capable of delivering 0.5 A and 5 V should be adequate for the demands of any USB memory stick. If you wish to keep the option of connecting the frequency monitor directly to the serial port on a PC, a suitable nine-way sub-D connector (K2) should also be mounted on the perforated board. It is also necessary to invert the polarity of the signal for the PC to be able to decode it correctly. A simple MOSFET (Tl) and pull-up resistor (R4) make a suitable inverter and driver for the serial port on most PCs when run at a low data rate: in our case, the date rate is 4800 baud. If, due for example to the length of the interface cable, the circuit does not operate reliably, this inter- face circuit can easily be replaced by a 'genuine' RS-232 driver IC such as a MAX232. Software changes The hardware changes required are relatively straightforward, but we still need to consider the extensions needed to the firmware in the micro- controller in the grid frequency monitor to allow it to output data over its serial port. The author has stayed faithful to the original software by Dieter Laues [1] as far as possible: in particular, the LEDs are still correctly driven to allow direct monitoring of the instantaneous grid frequency. All the source code files and a hex file suitable for programming directly into the microcontroller are, of course, available for free download via the Elektor web page corresponding to this arti- cle [3]. If you wish to make further modifications to the software, you will need the Wickenhauser C compiler [4]: the free demonstration version is adequate for this project. The firmware has the following functions: it first measures the time taken for fifty cycles of the line input (sixty cycles in the case where the grid runs at 60 Hz) and converts the result to an output value. This means that a new value is obtained every fifty (or sixty) cycles, so about once every second. Hence if we know when a series of mea- surements was begun, then we can use this fact to determine, without the need for timestamps, the time corresponding to each measurement in the series. Since the long-term accuracy of the grid frequency is very high, we get good agreement between time estimates using this method and the actual time, even after many days of operation. Every second a reading is also transmitted over the serial interface, either directly to a PC or to the data logger. The analysis software developed by the author turns a series of readings into a graph of grid frequency against time. The firm- ware configures the serial interface parameters to 4800 baud, no parity and one stop bit. To ensure that the USB data logger is configured in the same way it must, when it is powered up, find a text file on the USB memory stick containing the line “COM_baudrate: 4800”. This can be created using a simple text editor under Windows, or the example 'config.txt' file in the download [3] can be used instead. No other configuration of or modification to the data logger is required. PC program As mentioned above, the PC-based program developed by the author is capable not only of 54 May 2014 www.elektor-magazine.com Grid Frequency Logger receiving data from the frequency monitor directly over the serial port but also of processing and displaying data stored in a file, for example by the USB data logger. The program can be switched between two operating modes using the control at the bottom right of its window (see Figure 2). 'XMax' can be used to adjust the displayed time range and 'Offset' the zero point (measured in hours) of the x-axis relative to the time of the first reading. 'Save bitmap' writes the currently-dis- played frequency graph to disk as an image file. The software does not need to be formally installed: it is simply necessary to ensure that the application 'Netzfrequenz_P.exe' and the file 'Netzfrequenz.ini' are stored in the same direc- tory. The '.ini' file records all the settings of the program, so that when it is opened parameters such as the window width and height are pre- served from when it was last closed. If you decide to make changes to the program and then recom- pile it, bear in mind first that the program is writ- ten using Delphi, and secondly that before the compiler can be run the package file 'CommRec. dpk' for the serial interface must be installed. This file is included in the archive 7\SYNC32.ZIP' which is inside the directory of that name in the download [3]. File read mode The USB data logger always writes its output in a file called 'LOGGING.TXT' on the USB mem- ory stick. It is a good idea to rename the file to something more informative about its con- K1 230V 'v* 115V 'v IC2 LM2936Z.5.0 SUBD9 Hri LED11 _n LED10 LED9 n LED8 _n 12 LED7 13 14 LED6 15 16 LED5 LED4 K K K LED3 n LED2 _n LED1 49,800 Hz □ 49,900 Hz □ 49, 925Hz □ 49,950 Hz 49,975 Hz 50,000 Hz □ 50,025 Hz □ 50,050 Hz □ 50,075 Hz □ 50,100 Hz 50,200 Hz 130233 - 11 Figure 4. Expanding the original grid frequency monitor circuit to provide two serial interfaces requires just a couple of components. www.elektor-magazine.com May 2014 55 •Projects The log file It is possible for the first entry in the log file to be erroneous, and so it is best to delete it before proceeding: only one second's worth of data will be lost. The log file format is plain ASCII text and so can be edited using any ordinary text editor. If you would prefer not to enter the date and time manually into the PC program whenever it is run, you can add an extra line at the start of the file (in other words, replacing the possibly erroneous reading) to indicate the date and time when the log started. The frequency values themselves are stored in the file as periods expressed as integers in units of one microsecond. A 50 Hz grid frequency is therefore represented by a stored value of 20000. Fresh from the USB memory stick a log file might start as follows: 9998 20001 20000 19998 • • • and after replacing the first line with the date and time it might read: 14 . 12.2013 12 : 06:08 20001 20000 19998 • • • A sample log file is included in the software download [3]. tents. One idea is to use a convention such as / NetzLog_20131214_120608' where the date is encoded in 'YYYYMMDD' format and the start time as 'HHMMSS'. The program gives you the opportunity to select a file when 'Start' is clicked. The date and tiWbme can then be entered by hand in the appropriate fields in the program's main window. Alternatively the file itself can be edited before importing it into the program to include date and time information (see the 'The log file' text box). Serial interface mode In this mode the program reads data from the selected COM port (from 1 to 9) and simulta- neously makes a copy in a file called 'NetzLog_ yyyymmdd_hhmmss.txt' on the PC for subse- quent processing and inspection. Logging begins when the 'Start' button is clicked. Conclusion By combining two previously-published Elektor projects and adding a little new software the author managed to create a useful device while avoiding the temptation to reinvent the wheel. The combination is more than the sum of its parts, providing not just real-time autonomous recording of the grid frequency, but also a com- plete solution for monitoring and analyzing the quality of the grid supply over longer periods. The software is available in 50 Hz and 60 Hz ver- sions, and, since the source code is published, it is easy to make changes to it yourself. One possibility would be to build in an electronic real- time clock so that timestamps could automat- ically be added to the logs: perhaps the circuit described in the article 'Time Transporter' in the July/August 2011 issue of Elektor [5] will provide some inspiration. (130233) Web Links [1] 'Grid Frequency Monitor', Elektor January 2012: www. elektor-magazine.com/1 10461 [2] 'USB Data Logger', Elektor December 2011: www. elektor-magazine.com/1 10409 [3] Software and source code: www.elektor-magazine.com/130233 [4] C compiler (demonstration version): www.wickenhaeuser.de [5] 'Time Transporter', Elektor July/August 2011: www. elektor-magazine.com/1 10285 56 May 2014 www.elektor-magazine.com LCR + Stability Use the Cleverscope FRA panel to easily auto plot Gain/Phase, Impedance, Capacitance or Inductance vs Frequency. Display the Gain and Phase Margin. Check for instability. Easy As, with Cleverscope. Measurement See our FRA tutorial video to show you how to verify your operating power supply or amplifier design. Check the impedance of your DC buses. Verify magnetics you have wound. 80 dB dynamic range! 0 - 65 MHz isolated Sig Gen. Streaming 100 G samples to disk ♦ ♦ Protocol Analysis • Symbolic Math • Matlab Interface • 80 dB dynamic range *100 MHz Bandwidth • Tracking Zoom • 0-65MHz isolated sig gen • Video Tutorials CS328A-FRA 1 4 Bit MSO www.cleverscope.com The Convenient All-in-One Solution for Custom-Designed Front Panels & Enclosures You design it to your specifications using our FREE CAD software, Front Panel Designer We machine it and ship to you a professionally finished product, no minimum quantity required • Cost effective prototypes and production runs with no setup charges • Powder-coated and anodized finishes in various colors • Select from aluminum, acrylic or provide your own material • Standard lead time in 5 days or express manufacturing in 3 or 1 days r FRONT PANEL 1 1 J EXPRESS i FrontPanelExpress.com 1 (800)FPE-9060 Create Complex Electronic Systems in Minutes Using Flowcode 6 Flowcode is one of the World’s most advanced graphical programming languages tor 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. Design -► Simulate ■+■ Download New in Version 6: • Component Library Expansion; • Improved Simulation; • New Test Features; • 3D Design Environment; • Third Party Instrument Support; • Dashboard HMI Components; • And More! Further Information and Ordering at www.elektor.com/flowcode Projects The Improved Radiation Meter from the November 2011 issue of Elektor is a handy and affordable measuring instrument for the measurement of various types of radioactive radiation. The original design was built around an ATmega88. That it can also be implemented with another controller and at the same time acquire a few more features, is demonstrated by this project. By Reinier Ott (Netherlands) Another for an existing solution design Elektor Radiation Meter using PIC This radiation meter is based on the 'Improved Radiation Meter' by Burkhard Kainka, which was published in the November 2011 issue of Elektor. I purchased the Elektor kit for this project and experimented extensively with it. Based on this experience, I designed a new version, which I decided would be based around a PIC, instead of the Atmega88 in the original. I copied the sen- sor board in its entirety, with the only difference that I doubled-up on the BPW34. While writing the software for the PIC, using Flowcode, I also added a number of new functions. A lot of use- ful information on the original project may be found on the Elektor Forum in the Test & Mea- sueemnt section. Schematic As already mentioned, the preamplifier section is completely unchanged and we also continue to use the existing circuit board number 110538-2 for this. This part of the circuit is therefore also not drawn in the schematic for this PIC radiation meter, which is shown in Figure 1. The entire hardware is built around a PIC16F88, which is provided with a crystal of 19.6608 MHz, from which a run-time clock, with a time accurate in seconds, is derived via the internal prescaler of the timer. The output signal from the preamplifier is con- nected to connector Jl. This then goes via resis- tor R2 to pin 17 (RAO), which is configured as an analog input. A zener diode of 5.1 V (Dl) has been added to protect the analog input. Although the output voltage of the preamplifier can never exceed 5 V (even though it is powered from a 9-V battery), it was nevertheless decided to include some input protection because the design is gen- eral-purpose and it is possible to connect a com- pletely different type of sensor to it. 58 May 2014 www.elektor-magazine.com Just as with the original radiation meter, a 2x16 characters LCD is used for the read-out, which is controlled from a few pins of port B (RBO through RB5) of the PIC. P2 is used to adjust the con- trast of the LCD. In addition to the on/off-switch SW1, there is a mode- and a reset-pushbutton (BT1 and BT2). The purpose of connector J2 is for in-circuit pro- gramming of the microcontroller. This program- ming however does necessitate the removal of jumpers JP1 and JP2. The removal of JP2 is nec- essary to prevent the output of the 78L05 from being loaded incorrectly by the external power supply of the debug-board. JP1 ensures, during normal operation, that the circuit can be reset with BT1, but while in external debug-mode this has to be removed, otherwise the required pro- gramming signal on MCLR will be attenuated by R5 and R6, which will prevent in-circuit flash programming of the PIC. New, when compared to the original circuit, is the audio part comprising an LM386N output amplifier and a small speaker, which makes the detected radiation audible. Visual indication is provided by LED LD1. Pin 1 (RA2) takes care of driving the LED and the speaker. The backlight of the display can be switched on using jumper JP3. This, however, draws so much current from the 9-V battery that the circuit can oscillate because of instability in the 78L05 power supply regulator that is used here. Without the backlight the entire circuit draws about 20 mA, which means that a regular 9-V battery will last about 8 hours. LCD2 +5V © J2 cc < OL o o Q£ CL R6 PGD PGC WICLR BT2 D3 BT1 x M I 1N4148 C TJP1 D2 1N4148 R5 M ± C6 330n 13 12 R4 (t — | 470R [ 3_ 2_ 18 R3 +8V4 © n« ji QC O CO CO lOOn I i — Dl C2 lOu 25 V R2 -| 470R |- R1 Dl ,~x ^^PD5V1 17 ^^0 C5 lOOn +5V © LC DISPLAY 2x16 DEM16217 C O O CO co o — co CM CO lO CO I s — J w , w ' v ^ W >>cdq;q;|luqqqqqqqq t 180mAh 220u 25V C15 lOOn +5V © JP2 +5 V INT C16 lOOn C17 □ lOu 25V 1r 8 1N4007 rh < i C7 J3 I LED 4 3_ SIG 2 LcMjO HBC549 1 1u 25V O I— => CL I— => o PI u ^ / V +8V4 -© 10k log C8 lOOn C12 22u I 25V C11 CIO lOOn SP1 47 n ,-L|/ ° 80 T 130569 - 11 Figure 1. The schematic of the PIC radiation meter with, naturally, a PIC16F88 at its center. www.elektor-magazine.com May 2014 59 •Projects Figure 2. The various screens when the radiation meter is started. Figure 3. a) Measurement display, b) intensity mode, c) manual setting of the threshold levels. Operation After the power supply voltage is switched on (the PIC is reset at the same time) a short introduction is shown on the display (Figure 2a), followed by some information about the author and the firmware version (2b). During this time the circuit determines the noise level (comparable to the original design) and the final introduction screen (Figure 2c) displays a few values: • noise level in bits, in this case 440 (10-bit ADC -> 0 through 1023) • The value 'Low threshold' L, in this case the value 8, which is added to the noise level in order to obtain the most sensitive measuring signal. • The 'Moderate threshold' M, in this case the value 15 as an average sensitivity of the instrument. • Finally the 'High threshold' H, for measuring the most energetic radiation. (Note that the values L, M and H can be changed at any time through pushbutton combinations and these values, just as in the original design, are stored in the EEPROM memory.) When the sensor is faulty or is not connected, the error message shown in Figure 2d is displayed. In this case the red LED will also be turned on continuously. After the introduction, which takes a total of 5 seconds, the instrument begins to make measurements. The instrument will now indicate a few values on the display (Figure 3a). The top line shows suc- cessively radiation level L (low), M (moderate) and H (high) as measured pulses (indicated in a manner comparable to a normal GM counter tube). At the same time each pulse will briefly light up the red LED and there is an audible 'click' from the speaker (the sound level of which can be adjusted with PI). The bottom line shows the elapsed time (since the intro) and the number of measured low-pulses per minute (a new value appears after each minute). The measured pulses and the time are updated every second. Operation Pushbuttons The PIC can be reset with pushbutton BT2. The intro-procedure starts immediately after releasing this pushbutton. If, during the first three seconds of the intro, the other pushbutton (mode, BT1) is also pushed, the program switches to a so-called pulse-speed mode (pulses per second), suitable for measuring radiation intensity (Figure 3b). The top line then shows the number of measured pulses per second of the most sensitive radiation range (L). The bottom line shows the same, but this time in the form of an 'intensity bar'. Programming radiation level The programming of the 3 radiation levels is possible by first pressing (and then continue to hold) BT1 (mode) and subsequently pushing BT2 (reset), then release BT1 approximately 3 s into the intro. Now all the levels (L, M and H) can 60 May 2014 www.elektor-magazine.com PIC Radiation Meter be programmed one after the other (pressing BT1 increases the value by 1 every second, the value is 'frozen' after the button is released), see Figure 3c. The program will similarly work through the other values and finally will show that the new values have been stored. This can also be seen on the display after a reset since these values are shown during the intro (Figure 2c). Software The software has been developed entirely in Flow- code 4, where the various tasks of the software have been implemented in separate macros (sub- routines) as much as is possible to ensure opti- mal readability. The basic program structure comprises 3 parts (modes), where it starts with the intro-part (Ini- tialization). This intro is responsible for determin- ing the average noise level (the method used is identical to the original design), however here a 10-bit ADC is used, which results in 1024 sig- nal levels, to obtain sufficient resolution for the signal to noise ratio. In practice the noise signal will have a value of about 440. This is also used to decide whether the sensor is 'valid'. The threshold value for this is 100. If this condition is not satisfied (= no or faulty sensor) then this is shown as en error on the dis- play and the program will not enter the measuring loop. The intro-part is also responsi- ble for the definition of the 10-bit measurement threshold values L, M and H. These values are calculated from the average noise level (also a 10-bit value), increased with a fixed signal threshold value, which for each measurement level is stored as a unique 8-bit value in the EEPROM of the PIC. With this, the smallest threshold value will give the highest sensitivity of the sensor. From the intro, using the mode- and reset-but- tons, a selection can be made for the desired operating mode: • Normal pulse counting mode for the 3 radia- tion levels; • Radiation intensity (pulses per second) with intensity bar; • Programming mode for the 3 separate sensi- tivities L, M and H. After the intro has been completed, the main program according to the desired selection is immediately invoked. It turned out that it was very important to keep the polling-loop for reading the signal as short as possible to maintain sufficient speed in the measurements. This is important so that pulses that arrive in rel- atively quick succession can be detected. From testing it proved possible, when using Figure 4. The hardware of the radiation meter, nicely built into a home-made enclosure. a sufficiently strong sample (radium paint from an old alarm clock), to reach a measurement value of more than 6000 pulses per min- ute. Flere we have to make the com- ment that generally the number of measurements that can be detected reliably is about 0.5 x the polling-loop frequency, in order to ensure suf- ficient margin so that no pulses will be missed. This therefore means that the upper limit of reli- ably detecting the pulses is around 5000 pulses per minute. (Not including the loss of speed of www.elektor-magazine.com May 2014 61 •Projects the PIC for displaying the values on the display, the speed of the polling-loop in the software was measured at around 9 to 10 kHz.) The measured analog signal is presented to PAO, is converted to a 10-bit value (INT definition in Flowcode). This value is first compared to the sum of the noise level and the L value (low sig- nal threshold level), as determined during the initialization phase. Only when a signal has been detected which meets this condition, will the M and H levels be examined to see whether the sig- nal is powerful enough to exceed these thresh- old levels too. The order adopted here is important to ensure that the PIC runs through as few lines of code as possible during the actual measuring loop. When a sensor signal has been detected the correspond- ing variable is increased by 1 (incremented), the value of which is updated every second on the display. With this method you have to take into account that an H-signal will also be counted as Figure 6. The double sensor, the front surfaces of which are nicely aligned. Figure 5. The (also home-made) enclosure for the probe. an L- and M-signal, and an M-signal will also be counted as an L-signal. This means that when an L-signal has been detected it is possible that it was strong enough that it could have been con- sidered an M- or even an H-signal. In this way the high values are also included in the lower values. The entire program runs on the basis of a tim- er-interrupt, which is set to a fixed frequency of 75 Hz. This is then directly used to calculate the displayed time and the 'refresh-rate' of the dis- play is fixed at 1 s so that the measuring speed of the instrument is affected as little as possible be the display indication routines. At the same time the necessary (intermediate) calculations are carried out during this phase. A small piece of C-code, implemented directly into the Flow- code display macro, provides a nicely formatted time display in the form of 'hh:mm:ss'. As already described, the program also has an operating mode for displaying the pulse speed. The measured value is simultaneously visualized as an intensity bar (gauge bar). The length of the bar indicates the measured radiation inten- sity. It was decided to implement the intensity bar with something approximating a logarithmic scale. In this way it is possible to give a clear indication despite the limited resolution of the 16-character display. Since by default there are very few mathematical functions available for the PIC, a very simple piece of C-code has been included in the implementation part of Flowcode ('supplementary code' under 'project options'): short GaugeValue (i nt p) // Position of Gauge bar { short y; if (p>1000) y=16; else if (p>500) y=15; else if (p>250) y=13; else if (p>120) y=12; else { y=p/10; } return (y) ; } Finally we still need to mention that the intro part of the software also contains some 'built-in data'. Here you can store the specific details of the owner of the instrument. Each time the instrument is switched on or is reset, the post 62 May 2014 www.elektor-magazine.com CD CO -i — > L_ CD > “O < code and house number, for example, of the owner can be shown on the display. In the version of software that can be downloaded from [2], the final block of the Flowcode-In- tro-macro contains '1234AB56 vO'. Here you can enter your own information and version number. Construction The sensor, together with the sensor circuit board, are housed in an hermetically, light-proof enclosure (Figure 5). The window, a disc of aluminum foil, is attached to the front in such a way that it is easily swapped (using a threaded ring). This has the advantage that it is very easy to experiment with different foils (even ordinary household aluminum foil is already available in varying thicknesses). Note. When mounting both of the BPW34 sensors it is import- ant that their packages push slightly against the aluminum foil window, to prevent (as was also mentioned in the original article) unwanted microphone behavior. Robotics & Electronics Optical Encoder Pair Kit for Micro Metal Gearmotors ITEM #2590 Compatible Gearmotors $895 Add quadrature encoding to your micro metal gearmotors! • 3- and 5-tooth wheels included • 3.3 V and 5 V versions available • Works with our growing assortment of gearmotors with extended back shaft (gearmotors sold separately) Premium Jumper Wires STARTING AT 38 kHz IR Proximity Sensor ITEM #2460 $595 This 'microphone effect' can be quite persistent. The rea- sonably elastic mechanical mounting of the measuring PCB with respect to the aluminum foil window does of course not help much when trying to suppress these artifacts. With the construction method described here, an improvement was found by putting a small amount of silicon grease between the surface of both BPWs and the aluminum foil. The grease provides some mechanical damping. However, the layer of silicon has to be as thin as possible since it negatively affects the radiation transmission. It is also recommended to rigidly attach the circuit board on all its sides inside the enclosure (even more so when the measuring probe is implemented as a separate unit). As can be seen in Figure 6, the BPW is implemented using two devices, i.e. they are connected in parallel, in order to obtain an increased sensor surface area. In the original arti- cle this idea was already discussed and there was the cau- tion for an increased parasitic capacitance at the input when multiple sensors are connected in parallel. However, exper- iments showed that this negative effect was outweighed by the increase in sensitivity of the instrument (all the more because generally only relatively weak radioactive sources are being measured). In addition, the sample-frequency is already somewhat limited (see the description of the hard- ware) and software, because the data processing takes place inside a microcontroller. ( 130569 ) Weblinks [1] www.elektor-magazine.com/110538 Make prototyping connections « quickly and easily with these high- quality jumper wires, available « with male or female terminations in a variety of lengths and colors. « Step-Up/Step-Down Voltage Regulator SI 8V20ALV ITEM #2572 Typical sensing range up to 24" (60 cm) Fixed-gain modulated IR detector Small size (0.4" x 0.6") $ 15 95 3 V to 30 V input 2 A typical max output current Adjustable 4 V to 1 2 V output can be above or below input voltage Pololu Basic 2-Channel SPDT Relay Carrier with 12 VDC Relays ITEM #2487 $ 8 25 Control two SPDT relays easily with logic level signals. Available with 5 V relays or without relays. Single carrier also available. Simple Motor Controller 18v15 ITEM #1377 Highly configurable DC motor controller that supports four interface modes: USB, TTL serial, analog voltage, and hobby radio control (RC). Dagu Wild Thumper 6WD Chassis (Witn 75:1 Steel Gearboxes) ITEM #1563 $ 249 95 • Rugged aluminum body • All-terrain suspension • Available in 4WD and other gear ratios and colors [2] www.elektor-magazine.com/130569 Flowcode is available through Elektor Store, www.elektor.com Take your design from idea to reality. Find out more at: www.pololu.com •Labs A power supply was born at Elektor Labs. Arne Hinz has spent his time as an Elek- i tor Labs trainee well, designing a versatile benchtop power supply with the output electrically isolated from the AC power outlet based on a design by Martin Christoph at ISEA, RWTH Aachen, Germany. By Thijs Beckers (Elektor Labs) PCB real estate mecT Preliminary, Tentative Specifications: • PC PSU supplies raw 12-V input • Output voltage adjustable from 0 to 30 V • Power output 30 watts max. His design incorporates an interesting implementation where the essential step-up transformer is designed 'in-board' as proposed by Christoph. The input voltage is stepped up using a switch-mode regulator and this 'PCB transformer' to supply a voltage for the output circuit. Two 7-segment displays show voltage and current, which are set using two encod- ers. We cannot reveal all the details for the circuit at this point, but we do have some photographs to show you and whet your appetite. ( 130363 ) 64 May 2014 www.elektor-magazine.com ALSO AVAILABLE: The all-paperless GREEN Membership, which delivers all products and services, including Elektor magazine, online only. 0lektor membership 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; our virtual, online laboratory • 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 projects • Exclusive GOLD Membership card cr^-- — - ©ektor membership Connect with us! www.facebook.com/elektorim www.twitter.com/elektor Join the Elektor Community Take Out a GOLD Membership Now! •Labs What's up with this cap? (2) By Thijs Beckers (Elektor Labs) FRONT BACK MARKING ^ Uyi Cr'itEj Code: Loi Code AVX Logo Capacitance Cotie Toleiance Cods Voltage Code li sms, Char Code XXX A XX ■. XXX ■ XXX Last month I reported on an oddball capaci- tor imprint. While checking the semi-kit for our ADAU1701 Universal Audio DSP Board [1] I stum- bled upon this very odd thing going on with the 0.1-pF capacitors in the kit. As you can see in the photo, they have a "105" marking on one side and "104" on the other side. Every 100-nF capacitor in every sample kit I checked showed the same 104 / 105 print shown here, so it was not just a misprint on one of them. The relatively simple answer to this conundrum came from our supplier. As can be seen from the marking illustration taken from the datasheet [2], the front shows the capacitance code (104: "10-with-4-zeroes" = 100 000 = 100 000 pF = 100 nF = 0.1 pF) and the back shows the 3-digit date code (105: "2011/5" is our educated guess). In this case the date code and capacitance code wreaked havoc here at Labs. Without (1) a way to determine the front or back side of the device and (2) without knowing the other codes AVX employ, or (3) being aware AVX is a capacitor manufac- turer in the first place, it is hard to declare the actual capacitance with dead certainty and not being dragged over to the LCR Meter by fellow lab workers. Calling out to our well-informed readers and pro- fessionals last month resulted in some response on the topic. Most answers correctly surmised an issue with the date printing (but still not knowing what's what); some went as far as suggesting a secret auto-destruct time, a new notation like 10 5-1 or a new base value adopted for the famous 1-0-x system to indicate the value or even an April 1 spoof from EIM (Elektor International Media). No harm befell on any of the ADAU1701 DSP semi-kits shipped or due for shipping and you can safely solder in those yellowish 100-nF Cs. Thank you all for your helpful and amusing answers and your involvement in our quandary. ( 130523 ) Web Links [1] www.elektor-magazine.com/130232 [2] www.avx.com/docs/Catalogs/skycap-sr.pdf 66 May 2014 www.elektor-magazine.com Professional Quality Trusted Service Secure Ordering pee i - . 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 !“ - V i mCHtME, "••-' S'.'! Ji-W ‘ I *« "t f 4< M KWH * i Delivery from 2 workina days •Labs Post and Win By Clemens Valens (Elektor.Labs) For the year 2014 we decided to offer a small present in return for a project post- ed on Elektor.Labs. Every month we choose a gift and all you have to do is post a project to receive it!* Check the banner on the Elektor.Labs homepage to find out what this month's gift is. Live Q & A Back in the nineteen eighties Elektor orga- nized weekly one-hour telephone sessions allowing readers to ask questions and some- times put themselves to shame in regard to published projects. One poor soul at the wrong end of the line and flanked by piles of magazines and TI books would try to answer these questions live on the phone. It was rumored that some callers got connected through to a 600-ohm resistor for advice. This cool service was abandoned due to several factors including overheating ears, loss of voice, and painful elbows (i.e. phone related RSI symptoms overall) but it was never forgot- ten. And now it is back! Not exactly as a phone service, but online in the guise of free webinars. We plan to organize a Q & A session once a month when you can ask your tech questions. Isn't Inter- net wonderful? Announcements will be made on Elektor.Labs and in our dot-POST newsletters. www.elektor-labs.com/qal Copy-Paste Don't Work Often Elektor.Labs users prefer typing their proj- ect text in a text editor like Word or Notepad prior to copying it on to the .Labs project page. The advantage of doing so is that you will not lose your text when bits flip or drop on the Internet or when you forget to save your project before surfing off. We actually recommend working this way. However, every once in a while we do receive a complaint from a user saying that it is not possible to paste text in a project's text field. Clearly something must be wrong with the Elektor.Labs website! I would not venture to say that our website is perfect and that there are no problems at all, but this issue is in fact browser related. A security feature to be more precise to prevent malware programs from copying-pasting themselves or other unwanted content all over the Internet. In case you didn't know: when enabled, small JavaScript programs embedded in webpages can have access to your computer's clipboard and use it to fool around, which is why some browsers disable this option by default. If you run into this problem, change your browser's security set- tings. Depending on your browser, when you try to paste something, it may also ask you to allow clipboard access for the current active page. ( 130524 ) * 1 (say, one) gift per user/poster per month - www.elektor-labs.com/ 68 May 2014 www.elektor-magazine.com 25% OFF CIRCUIT CELLAR Whether it’s programming advice or design applications, you can rely on Circuit Cellar for solutions to all your electronics challenges. Raspberry Pi, embedded Linux, low-power design, memory footprint reduction and more! Become a member, and see how the hottest new technologies are put to the test. RiwtwT-r t\ I/O hert [Pwl 3 ) !*■ MffW i n " i IMiTi: tlltw Mu ll B circuit cellar MCU-BASED COLOR DATA ACQUISITION MfL fjfrjrM , rif artiwin .^nsi.r » ms mar ■ Wertt* Clide | 04* Pm tHstrnnlcj: fn^reiXTPeur m wn Cdbe-SoMoO RokUt H-f* I/O kund | Robot* «urJH trtrtrft 0*Sk* for [ IE0 CbJirWWriKJlofi | CWfoG Se^pi-rs ^ Tl((5. tut th-nfl fIM? ri*5 is DtfWl SNft* JOIN TODAY! www.circuitcellar.com/sepN1 3 DesignSpark Tips & Tricks Day #10: Custom Outline Models By Neil Gruending (Canada) Let's import our PCB back into our 3D model and have a little fun. Over the last couple of days (that mysteriously lengthened to months in Elektor) we designed a circuit board to fit in a Hammond 1551N enclo- sure using DesignSpark PCB and DesignSpark Mechanical. Today we'll import our board back into DesignSpark Mechanical and have a little fun along the way. import - DesignSpark Mechanical JL , A £/ Spin * \ □ o ■> 7. “1 X 53 © \ 1 Cktovil a * S^Pjw Q iecm * \ ©GO# si y Sntecf N> Pull Movr Fil Cemtmm f -fi Protect lr»«rt J » =S 1 Sfcdcti bill 6 £ import* • 1551W Boar ♦ PCB Outiirve MS 0®» K w pout Click an object to abgn the hantfe to it ^ r$ Meeture Creeoe cecserni Marten crier ita bur rile CMegory Co ubfect tu align U* liandta lu it U« | i mpnrf* . c- PCR Outfinr* C* Figure 1. Imported board outline Figure 2. Corrected board placement Import the PCB into DesignSpark Mechanical We had finished the board outline in the last installment so now it's time to export an IDF file from DesignSpark PCB by using the "Output->De- signSpark Mechanical (IDF)" menu. This will open the DesignSpark Mechanical IDF export window where you can specify a name for the file and the board thickness. Note that the export will use a default component height of 1mm unless the components spec- ify a different height in the library. We'll see an example of that later. • w d 1551nOutline5 - DesignSpark Mechanical (•jHcir* * tQ’Spin * J»n a * S3 QZwm • lOOl •;# \ o o O Jtffe « 53 a it <£ Pull Most F.l " W1 1 0,-H | sw«*> i Mode 1 bill Inter »*ct V £ IbblnOutfirmb ♦ Vfc 155 IN Bo* ♦ * A PCBOu* 4 ♦ □» K e ep c u t V wynt Click an object to afcgn ths haniJe to it [hum Now let's import the IDF into our DesignSpark Mechanical model using the file import tool (Insert tab->File) and you should get something like Fig- ure 1. DesignSpark has already selected the board outline for us so now we just need to move it to the right posi- tion in the enclosure. This is really easy in our case because we just need to line up the new board outline to our original model. The first step is to move the move anchor point to a board corner using the Anchor tool. Then select the Up To tool and select the same corner on the original PCB outline. Both of these tools are available in move mode in the left side of the drawing window. The updated model should now look like Fig- ure 2. Everything looks fine except that our mounting holes have squares over them. That's because our mounting holes are components on the PCB and DesignSpark PCB applied the default 1mm component height rule to them which gives us the square boxes over the holes. A quick edit to remove the square will actually update both of the holes automatically because DesignSpark Mechanical has also imported the component structure from the PCB. I expanded the model structure in Figure 3 to show the mounting hole components. The figure also shows what the imported PCB looks like after being cleaned up. Now let's add some components to the board to get a complete rendering of our design. Adding PCB components to our model Now let's add some components to our board and see what happens. I chose to add a few SOT23 transistors and a couple 0603 resistors like in Figure 4 and then imported the board into DesignSpark Mechanical which looks like Figure 5. I had problems getting the PCB com- ponents to import correctly into DesignSpark Mechanical while I was playing with the playing with the component heights though. The solu- tion ended up being to delete all of the files in the IDF export directory. Figure 5 also shows an example of what import- ing a PCB with different component heights looks like in DesignSpark Mechanical. The mounting holes have the small box drawn around them like before and the 0603 and SOT23 patterns are 0.5 mm and 1.12 mm tall respectively. The trick is that you have to specify the component heights in DesignSpark PCB by adding a value named "Height" to the component properties. I 70 [ May 2014 | www.elektor-magazine.com Tips & Tricks recommend doing that in the component librar- ies so that you don't forget later. My board was already set to metric units so I set the height to the desired value without any units, i.e. I entered 0.5 mm as 0.5. But what if you wanted to make our imported 3D PCB look more realistic? The first thing we'll need are the 3D models for our components. It's possible to draw them yourself in DesignSpark Mechanical but in this case I will use STEP mod- els downloaded from 3D Content Central [1]. DesignSpark also has a lot of 3D models avail- able as part of Modelsource [2]. The only real requirement for the models is that they use the same co-ordinate origin and orientation as the PCB components so that the new 3D models will line up properly. For example, I like to use the center my PCB footprints as the component origin so I used 3D models that also used their bottom center point as the origin. Note that DesignSpark Mechanical won't let you edit STEP models so sometimes you might have to try several dif- ferent models before finding one that will work. Now we're ready to update the 3D PCB model. Open the imported PCB with the "Open Compo- nent" command which will open the PCB in its own viewing window. Now you can select the components to change in the Structure window. Right click on it and select "Source->Replace Component" and then choose the 3D model file you want to use. DesignSpark Mechanical will then exchange the model for the new one and it will also rotate it as necessary. This is why it was important to use models that correspond to the PCB footprint. The final result will look like Fig- ure 6 after a little bit of editing. Make sure you double check the component 3D model position if its placement is critical. Figure 3. Finished board import. Figure 4. Components added to PCB. Figure 5. 3D PCB model. Conclusion Today we used DesignSpark Mechanical to make a 3D model of our finished PCB. Next time we will focus on using DesignSpark PCB for more complex designs. ( 130575 ) Web Links [1] www.3dcontentcentral.com [2] www.tracepartsonline.net/(S(rhrqx- sieinz4vp45g4eluh55))/content. aspx?fwsid = DESIGNSPARK8d_ang=&P= • w A ISSInOutline.PCBwiihParis • DesignSpart Mechanical Figure 6. Final PCB model. www.elektor-magazine.com | May 2014 | 71 DESIGNSPARK PCB Unijunction Transistors Weird Component #5 Mention the word transistor and I bet most people immediately think of the usual bipolar variety. Unijunction transistors (UJTs) aren't common anymore but a few decades ago they achieved widespread use in low frequency oscillators and sili- con controlled rectifier (SCR) firing circuits. Let's take a look at how these devices work— and at a modern replacement. By Neil Gruending (Canada) lB2 ^2 A traditional UJT is a 3-pin device with a single (!) PN junction inside. Its construction, circuit sym- bol and basic circuit arrangement are shown in Figure 1. Two of the pins are used for the base connection and are labelled B1 and B2. They con- nect to either side of a bar of N-type silicon with a well of P-type silicon in it for the third connec- tion called the emitter (E). When the UJT is off there's a resistance between the base pins, and the emitter acts as a diode. The base construc- tion acts as a voltage divider for the diode so that no current will flow into the emitter until the voltage exceeds the internal base voltage. Once the emitter voltage increases enough to start conducting, the UJT will switch on and create a low resistance path between the emitter and Bl. This switching point is called the peak voltage Tek Run: SO.OMS/s Sample liTOT DPO Brightness: 69 \ Cl Freq 833.33 HZ Low signal amplitude q Mar 2014 00:20:09 and the UJT will continue conducting until the emitter voltage drops below the valley voltage threshold. The valley voltage is always less than the peak voltage, which gives UJTs their nega- tive-resistance characteristic and makes them great for triggering from short pulses. A modern replacement for UJTs are programmable unijunction transistors (PUTs). They operate in a similar manner as a UJT but internally they are an SCR with a 4-layer P-N structure. This con- struction means that PUTs have an anode, cath- ode and gate connections (Figure 2) instead of the usual UJT connections. Just like a UJT, a PUT has a negative-resistance characteristic when the anode voltage exceeds the gate voltage which is programmed with a resistor voltage divider. I couldn't find UJTs to play with but I did find some 2N6027s which are a PUT so I put together a simple relaxation oscillator (Figure 3) and mea- sured its output with an oscilloscope (Figure 4). Channel 1 in the oscilloscope trace shows the anode voltage and Channel 2 is the cathode volt- age. The anode is charged by a RC circuit and when the threshold voltage is reached the SCR kicks in and discharges the capacitor very quickly as shown by the cathode voltage pulses. This cir- cuit isn't terribly useful by itself but if you used it to trigger an SCR then you could start controlling much larger loads. UJTs may be almost obsolete but the fact that they are being replaced by PUTs shows just how useful their functionality can be. ( 130477 ) 72 May 2014 www.elektor-magazine.com Elektor and National Instruments Present: ^^lusively for Students! Professional Hard & Software at a Special Discounted Price! As the new sales partner of National Instruments, Elektor offers products from the Nl platform for the education of students and enrichment of educational institutions. This educational platform brings together hardware, software and teaching materials to allow students an attractive and inspiring learning environment. Do Engineering - Real-World Solutions for Hands-On Learning LabVIEW With the LabVIEW system design software, students can gain hands-on learning through projects and systems in a single environment and thus acquire skills and procedures that are invaluable to any future career they might wish to pursue. Circuit Design Suite The Nl Circuit Design Suite combines Nl Multisim and Ultiboard software for a complete circuit design, simulation, validation, and layout platform. The Suite has features that are specifically tailored to the needs of students, which are useful in the development of electronic concepts. myDAQ myDAQ is a low-cost data acquisition device that allows for measurement and analysis of physical signals in any place, at any time. myDAQ is compact and portable, guaranteeing students practical experience outside of the laboratory and use of industry standard tools and methods. Connect with us! www.facebook.com/elektorim www.twitter.com/elektor •Projects Zero-Electrolytics 555 Timer A timer circuit that turns on a pump for a short time every five minutes can be easily made using the famous 555 IC. Unfortunately, it's almost im- possible to avoid using electrolytic capacitors to achieve such a long period, which makes the cir- cuit less accurate and reliable, especially in the longer term. However, there is one solution to this problem, and that is to use a special 1 giga-ohm resistor! The more resistance the better By Albert van Dalen (Netherlands) The author designed a timer for his vacuum pump that turned it on for a short period roughly every five minutes. This was just enough to avoid the loss of vacuum due to small leaks. Such a timer can be easily made using the well-known 555 IC (in this case the dual version, 556). The circuit described here stands out by the fact that no electrolytic capacitors have been used for the components that determine the delay. Instead, ordinary film capacitors were used, which have a much lower leakage current than electrolytics. Since the capacitance of this type of capacitor is much lower than that of electrolytics with a similar size, the load resistor has to be a very high ohmic type. In this circuit a resistor of 1 GO. (giga-ohm) is used! Most electronics hobbyists probably don't even realize these exist. This com- ponent appears to be available cheaply, and the author thought it a nice challenge to use it in the design for the timer. Circuit without electrolytics The result can be seen in Figure 1 and requires little explanation. There are two timers, which are connected in series. The first timer (IC1A) is configured as an astable multivibrator, with a period of about 270 s. The components Rl, R2 and Cl are used to set this time. By using the previously mentioned 1 GO. resistor for Rl, it is sufficient to use a capacitor of only 0.39 pF to achieve this period. The second timer (IC1B) has been implemented as a monostable multivibrator. With the component values given for R3 and C2 it outputs a positive pulse of about 7 s when it gets a falling edge from the output of IC1A. The MOSFET (Tl) is turned hard on during this time, powering the motor (max. 12 V, 10 A). The timer section can be switched on or off using switch SI, or it can be permanently activated via JP1. The pushbutton (S2) offers the facility to turn on the motor manually, and to keep it running for as long as the push button is held down. Finally, the power input is protected by a combination of a resistor (R4) and a 12 V zener diode (Dl). These ensure that the timer circuit won't be damaged by voltage spikes on the power input, or when the input voltage is a bit higher than 12 V. Sturdy board A small, single-sided printed circuit board with- out wire links has been designed for this circuit (Figure 2), measuring 58.2 x 43.6 mm. It is very easy to build the circuit, since only through-hole mounted components have been used. A large area of the PCB has been taken up by the fuse and the 'Faston' spade terminals. The tracks on the PCB have been designed to cope with currents of up to 10 A. The specified fuse holder clips (see parts list) can even cope with 15 A. When switching currents up to 10 A it is not nec- essary to mount MOSFET Tl on a heatsink, but we would recommend that you leave a gap of a few millimeters between the MOSFET and the PCB. This will prevent the specified R t h Q_ a) from increas- 74 May 2014 www.elektor-magazine.com 555 Timer ing too much (the PCB material underneath the FET would otherwise act as a thermal insulator). At a constant current of 10 A the temperature of the FET rises to about 40 °C above the ambient temperature (with U GS > 10 V). This may seem like a lot, and it does feel hot, but the junction temperature will still be within its safe range. The MOSFET can also be mounted vertically, but this doesn't make a lot of difference to its heat loss. The switch (SI) is mounted at the edge of the PCB. When the PCB is mounted in an enclosure the switch can still be operated through a small hole in the side of the case. The circuit can be permanently activated via a wire link or jumper across JP1 (obviously only as long as power is applied). Alternatively, you can solder two wires onto JP1 and connect them to an external switch, instead of using switch SI. Practical considerations The measured period of IC1A in the prototype built in the Elektor Labs was initially found to be over 20% longer (333 s) than the theoretical value of 275.7 s from: T = Cl (R1+2R2) In2 [s] Even when we take all tolerances into account, we have to conclude that there are some parasitic resistances in the circuit. The combined bias cur- rents of the threshold and trigger inputs (typically 20 pA) only play a minor role in this. It turns out that it was caused mainly by contamination of the PCB and the 1 GO. resistor. To prevent this, you have to carefully handle R1 at all stages of the soldering, and clean the PCB on completion of the soldering. You should never touch the body of the 1 GO. resistor, as it will leave some grease from your skin behind. Only touch the end of the leads that will later be cut off. You should also mount the resistor slightly above the PCB, so it doesn't make contact with the board. The current consumption of the circuit depends very much on the supply voltage. At 12 V the circuit uses only about 300 pA. At higher voltages the zener diode (Dl) will start to conduct, which increases the current consumption significantly (at 13.6 V it goes up to 1.7 mA). This won't make any difference when you're using a large lead- acid battery as the power source, but in other applications this could be something you have to keep an eye on. If necessary, you could increase the zener voltage to 14 V or 15 V (the TLC556C © IC1 © |R3 cm DIS IC1A THR OUT TR > O co| 13 12 M FI In I I 17 o +BT1 10AF L-i ' C2 cm DIS IC1B THR OUT TR > o 5=1 IC1=TLC556 LOAD 130257- 11 i\z {7^~o]-BT2 Her is rated for use with supply voltages up to 18 V). With a lower supply voltage (less than 10 V), it is recommended that you limit the current to be switched. The ON resistance of T1 increases with a lower gate-source voltage, which increases the heating significantly. In this case, you will need to add a heatsink. ( 130257 ) Figure 1. The circuit diagram for the timer circuit is straightforward. The most noticeable component is Rl, a resistor with a value of 1 Gfi. Internet Links [1] www.elektor-magazine.com/130257 COMPONENT LIST Resistors Rl = 1GQ 0.25W 10%; TE Connectivity type RGP0207CHK1G0 R2,R3 = 10MQ R4 = lkft R5 = lOkft Capacitors Cl = 390nF, lead pitch 5mm or 7.5mm C2 = 680nF, lead pitch 5mm or 7.5mm C3 = lOOnF, lead pitch 5mm or 7.5mm Semiconductors Dl = 12V 0.5W zenerdiode D2 = 1N4007 D3,D4 = 1N4148 T1 = IRF1405ZPBF IC1 = TLC556CN (DIP14) Miscellaneous K1-K4 = spade terminals, Faston, 0.2" pitch JP1 = 2-pin pinheader, 0.1" pitch 51 = slide switch, miniature, 1 C/O contact; C&K Components type OS102011MA1QN1 52 = pushbutton with make contact, 12V 50mA, 6x6 mm FI = fuse, 10A fast, 5 x 20 mm, with PCB mount 15A holders; 2 pcs Cooper Bussmann type 1A3399-10-R PCB # 130257-1, [1] S2 D3 ©ELEKT0R 130257-1 vl.O V. Figure 2. The circuit board is single-sided, with the tracks for the switch section being suitable for currents up to 10 A. www.elektor-magazine.com May 2014 75 •Industry Cut the Cord — Power Over Ethernet Touch Panel PC Habey USA's new PPC-6612POE Power-over-Ethernet Panel PC is powered by an Intel Atom N2800. This touchscreen computer, featuring an 11.6 inch 4-wire resistive touchscreen, is a slim, fanless system is perfect for automation, video camera control, digital signage, and more! Offering a 1.3-MP front facing camera, and two bezel mounted front facing stereo speakers the PPC-6612POE is also perfect as a point of sales device. With the Power-over-Ethernet port, all you need is a compatible Ether- net cable for both power and data for easy network installation. Additionally, this system is Wi-Fi ready with a traditional 12-V power adapter. www.habeyusa.com (130458-11) World's First Stand-Alone NFC MicroSD Card Certified for Visa and MasterCard Mobile Payments ams AG announced that US-based DeviceFidelity, Inc. is using unique ams RF technology in its latest CredenSE 2.10 Near Field Communication (NFC) microSD card to enable secure, certified NFC transmissions between any mobile phone and contactless payment terminals from Visa and MasterCard. DeviceFidelity CredenSE 2.10 is the world's first NFC microSD card to successfully achieve global payment certifica- tions from both Visa and MasterCard without requiring external booster antenna or device specific attachments. Using the AS3922 chip from ams, an integrated NFC front end with Active Boost technology, CredenSE achieves a typical read range of 4 cm in a mobile phone's microSD slot. The mobile phone is a notoriously difficult environment for RF and variations between phone models make it dif- ficult to consistently achieve good performance. The stringent requirements for read range compatibility with payment terminals for payment applications cannot be met in small form factors such as SIM or microSD cards with a traditional passive NFC card emulation front end and simple planar antenna. The DeviceFidelity CredenSE 2.10 is the first commercially produced NFC microSD card that meets EMV standards using only an ultra-small antenna embedded in the card, making distribution and compatibility with hundreds of phone models possible with one easy-to-deploy microSD card. Active Boost allows for robust tag-to-reader commu- nication at a coupling factor 100 times higher than is possible with conventional passive tag designs. The AS3922 also offers unique Antenna Auto Tun- ing and Q factor adjustment, which are critical to microSD, SIM and pSIM applications. The IC includes an ACLB interface for communication with the con- tactless interface of any Dual Interface Secure Ele- ment, and DCLB and NFC-WI interfaces for digital communication. Use of the AS3922 with a 3D antenna also provides for smooth operation with any payment terminal by eliminating the need for the user to hold the phone in any orientation. In addition to successful performance with Visa and MasterCard payment terminals, DeviceFidelity's Cre- denSE microSD also provides an option for service providers to deploy mass transit and physical access applications. www.ams.com/NFC/AS3922 (130458-V) am ::: : ill i GND GND 76 | May 2014 | www.elektor-magazine.com High Performance, Low Cost, Ultra-Compact Ultrasonic Sensors Our most popular sensor is now available in a new design which is physically shorter than any of our current outdoor sensors, allowing easy integration into users' applications. Our new UCXL-MaxSonar- WR-series sensors are flexible, OEM-customizable products intended to be integrated into a customer's system with our horn, or designed for flush mount- ing into your existing housing. These rugged, high performance sensors are individually calibrated to provide the quality that you have come to expect from MaxBotix. Mounting design recommendations are provided through our 3D CAD models (available in multiple formats) to facilitate your design process. The UCXL sensors are RoHS and IP67 compliant with proper mounting design, and the sensor layout offers four conveniently placed mounting holes for design flexibility. The UCXL-MaxSonar-WR comes with the easy to use outputs and standard pin configuration of the pre- vious MaxSonar products. In addition to the three stan- dard sensor outputs of RS232 serial (TTL out- put available upon request), Analog Volt- age, and Pulse Width. We are offering four models: MB7260 WR & MB7270 WRA for integration into DOWNLOAD our free CAD software DESIGN your two or four layer PC board SEND us your design with just a click eMDresspBb.corn a customer's housing design which includes our rec- ommended horn, and MB7267 WRC & MB7277 WRCA, flush-mounted designs that do not include a horn. These sensors feature 1 cm resolution, operational temperature range from -40°C to +70°C (-40°F to +160°F), real-time automatic calibration (voltage, humidity, ambient noise), 200,000+ Flours Mean Time Between Failure, an operational voltage range from 3. 0-5. 5 V, with low 3.4-mA average current require- ment. These sensors are also RoFIS Compliant and CE Compliant. Sensors are available for immediate shipment. www.maxbotix.com (130521-III) www.elektor-magazine.com | May 2014 | 77 •Industry STM32 Nucleo prototyping boards free to users of FTM Board Club website Broadline technical distributor Future Electronics today announced that it is to make the new range of STM32 Nucleo prototyping boards from STMicro- electronics available free via its FTM Board Club website for design engineers. The FTM Board Club provides a wide range of evaluation, development and prototyping boards free to any OEM engineer based in the EMEA region, pro- vided the project which the board supports has a nominal commercial value. Development boards from many leading franchises are available via the site. Now Future Electronics has extended the FTM Board Club's broad portfolio of products with the STM32 Nucleo base boards, providing users of STM32 ARM®-based microcontrollers with free access to the latest prototyping boards. The new STM32 Nucleo boards are compatible with ARM's mbed application development platform. They also include ST Morpho extension headers to allow access to all of the microcontroller's on-chip peripherals, and Arduino headers which accept shields from the extensive Arduino ecosystem, allowing developers to add specialised functionality quickly and easily. In addition, ST will offer its own dedicated shields supporting functions such as Bluetooth® Low Energy and Wi-Fi® connectivity, GPS satellite positioning, audio recording, proximity sensing and wireless control. Any shield can be re-used with any STM32 Nucleo board and across various projects. The STM32 Nucleo-F030R8, STM32 Nucleo-F103RB, STM32 Nucleo-F401RE and STM32 Nucleo-L152RE boards are available immediately on the FTM Board Club, free to qualified OEM engineers. www.my-boardclub.com (130521-1) open development platform Cost-saving System Management Reference Design for Lithium Pedelec/E-bike Batteries Ams's example design for lithium pedelec/e-bike batteries implements accu- rate cell monitoring and balancing without the need for a microcontroller in the Bat- tery Management System (BMS). Battery pack and pedelec manufacturers which use the design will benefit from valuable bill-of-materials (BoM) cost savings and a simpler circuit design, compared to batteries in pro- duction today. The ams design is for a 48-V pedelec battery consisting of up to 14 lithium-ion cells. It uses two AS8506 smart cell monitoring ICs, with few supporting components, to monitor the temperature and voltage of up to seven cells each and to implement passive balancing of the cells when charging. By contrast, conventional BMS designs in pedelecs use dumb voltage monitoring ICs to measure the voltage and temperature of cells, report- ing the values to a dedicated battery management microcontroller via a serial communications link. The MCU is required to control safety and protection functions (over- and under-voltage and over-temperature shut-down) and cell balancing. The AS8506 from ams, however, includes built-in logic functions for con- trolling cell safety, protection and balancing. These functions can easily be configured by the user, with the settings saved in an on-board OTP memory. The device also features integrated MOSFETs for use in pas- sive cell balancing operations. During charging, each cell's voltage is compared to a user-programmable reference voltage threshold. Up to Exchangeable E-Bike battery AS8S06 GND f E -0 V5V AS8506 Balance ongoing Indicator -i o a .< 230V Cell c„l of range detect C 04001 4XNAN0 Logic, monoflop Charger G z o S I 5V logic level* A vcc Seniors: Torque. Temp, rotor position, current Inverter. Motor control. DCOC. SOC. SOH BMS M HMI GND Serial Interface 78 | May 2014 | www.elektor-magazine.com news & new products 100 mA may be discharged through the MOSFET from any cell exceeding the threshold, until all cells have reached the threshold and the battery module is fully charged. This architecture, in which battery monitoring and cell balancing opera- tions are implemented inside the AS8506 voltage-monitoring device, dispenses with the dedicated MCU required in conventional pedelec bat- tery designs. When an AS8506 detects an over- or under-voltage or over-temperature condition, an interrupt signal is transmitted to the pedelec's motor controller IC to complete the required safety shut-down operations. The reference design can be used in any pedelec or e-bike battery con- taining up to 14 lithium-ion cells. It can also be extended to supervise more than 14 cells by daisy-chaining additional AS8506 ICs as required. The reference design files are available on request from ams. http://www.ams.com/eng/battery-stack-monitor/AS8506-demokit (130521-II) E-Bike Monitoring & Balancing - Blueprint for Lithium Pedelec Battery Application - Strongly reduced component count www.ams.com/AS8506 ◄ & ► Complete Ecosystem for HMI Development on Intelligent Displays 4D Systems and FTDI Chip have now added to the recently announced 4DLCD-FT843 intelligent display solution— which incorporates the award-winning FT800 Embedded Video Engine (EVE), where display, audio and touch functionality are integrated onto a single chip - with the subsequent introduction of two further products. Profiting from the novel object-oriented approach employed by EVE, this combined prod- uct offering presents design engineers with a foundation on which to construct compelling new human machine interfaces (HMIs) in a quick and trouble-free manner. The first of these new products is a compact Arduino-compatible shield named ADAM (Arduino Display Adaptor Module), which has been devel- oped specifically to interface with the 4DLCD-FT843— permitting com- munication between it and the Arduino via the SPI interface. With dimensions of just 47.5mm x 53.4mm, the shield is suitable for use with Arduino Uno, Due, Duemilanove, Leonardo, Mega 1280/2560 and Pro 5V, as well as variety of popular Arduino clones. It has a micro-SD card that provides the Arduino-based display system with capacious data storage. Through this the 4DLCD- FT843 can retrieve objects (such as images, sounds, fonts, etc.). Drawing power from the Arduino's 5V bus, ADAM regulates the 4DLCD-FT843's supply to 3.3 V. The FT800 EVE controller can deal with many of the graph- ics functions that would otherwise need to be undertaken by the Arduino. ADAM is complemented by the 4DLCD-FT843-Breakout. With a footprint of 26.5mm x 12mm, this is a simple breakout module that allows the 4DLCD-FT843 to be attached to a general host or breadboard for prototyping purposes. It features a 10-way FPC connection for attachment with the 4DLCD-FT843, along with a 10-way, 2.54mm pitch male pin header for connection directly to the host board. An operational temperature range of -10°C to +70°C is supported by both these new products. The EVE-driven 4DLCD-FT843, which was released last month, has a 4.3" TFT QWVGA display with a 4-wire resistive touch screen. It features a 64 voice polyphonic sound synthesizer, a mono PWM audio output, a programmable interrupt controller, a PWM dimming controller for the display's backlight, plus a convenient flexible ribbon connector. www.4dsustems.com.au www.ftdichip.com (130521-IV) www.elektor-magazine.com | May 2014 | 79 •Regulars Speedy 1200+ Acoustic Modem Telecom authorities under pressure By Gerd Kowalewski Some of you may have heard of modems to enable a PC to "go online" to access (Germany) BBSs in the dim past, but always with cable connections to the telephone network. Here we reminisce on the precursor of the wired modem: the acoustic coupler. Now a thing of the past, it blew the dust out of some telecom authority offices in the early 1980s. First, let's do the ACK Handshake so anyone under 40 is not lost straight away: BBS stands for bul- letin board system; modem is an acronym for modulator/demodulator, and a PC in our realms is a personal computer. Acoustic couplers in the early 1980s were used for data communications via POTS (plain old tele- phone service — no kidding, Ed.) telephone hand- sets, and even on the German "C-Netz" earphone network ("Autotelefon") to reach a remote line modem hooked up somewhere else on the pub- lic switched dial-up telephone network (PSTN). In the US such a device was called an acoustic coupler, or MUFF, where the microphone and ear- piece parts of a telephone handset got pushed into a pair of cushioned seatings acting as acous- tic seals to prevent external noise from interfer- ing with the data carried over the voice channel once communications with the remote system had been established. Historically, technically Such a device technically was in fact a simple FSK (frequency shifty keying) modulator and demod- ulator connected via a asynchronous serial con- nection (US: RS232C; EC: CCITT V.24/V.28) to one of these "newfangled" desktop computers, frequently built by the modem user or "hacker" himself. Surely unforgettable: that scene from John Bad- ham's 1983 movie "War Games", with the text characters moving at a snail's pace (300 bps) across the green CRT screen, when a teenager gamer was trying to play the fascinating new computer game called Thermo Nuclear War against a US military super computer's brain, after hacking a secret line modem access port. Using two voice channel compatible pairs of car- rier frequencies in an FSK modulation scheme, according to US Stds. Bell 103 for a whopping 300 bps FDX (full duplex), or Bell 202 for "high- speed" 1200 bps HDX (half duplex) or compara- ble European CCITT Stds. V.21 FDX or V23 HDX, such devices established one major, or even two, in-band data communication channels within the telephone network's extremely variable (!) and noise infested narrow voiceband channel of about 300 Hz to 3.4 kHz (realistically, 2.5 kHz), depend- ing on telephone lines used on the individual connection. FDX implies bidirectional communi- cation at the same time; HDX means one-way communications at a time, with the direction of transmission changing under the control of a data comms protocol running on the host computers (anyone remember Kermit, Xmodem...?). There was even a special mixed mode within the CCITT V.23 standard, the so-called split-mode, 80 | May 2014 | www.elektor-magazine.com with a "fast, high-throughput" RX channel at 1200 bps and a slow 75 bps TX channel. This technique was used for Germany's Datex-P based "Bildschirmtext" (screen text) system of Deut- sche Bundespost, or "Minitel" as I think it was called in France, to mention some of the first public data networks. This was the intended market for EXAR's world famous XR2206 (October 1976!) and XR2211 chips, plus at least a dozen others, like AMD's AM7910 WorldChip, and Silicon System's 73K22x series. EXAR/TI, Rockwell, AT&T and US Robotics soon became the major players in specialized DSP solutions for "data-pump" modems. Clever use of CCITT V. 22 The Speedy 1200+ acoustic coupler modem was one of a few types to have been tested success- fully over the German C-Netz, the third shoot of Germany's early mobile radio phone networks, which was used by lots of business and high up sales people on their travels and tours across the country. More on the early A-, B- and C-Netz networks in a future Retronics article. This Speedy 1200+ for the first time used a DPSK modulation scheme for a 1200-bps FDX link according to CCITT V.22, making better use of the changing communication voice channel band- width. Uniquely at the time, the unit employed an inductive coupling method (selectable by a slide switch) instead of the traditional microphone to pick up the signal created by the magnetic stray field of the dynamic transducer in the earpiece. This avoids acoustic noise pick up on the low-sig- nal level side of the device. This selection switch was needed for added compatibility with piezo- electric speakers used in earpieces, which do not create any magnetic stray field. The system also supported the former 300 bps FDX CCITT V.21 standard, switch selectable for Originate or Answer mode. In terms of hardware, on opening the Speedy 1200+ we find a Silicon Systems Inc. (later, TDK Semi. Corp.) 73K222 DSP, an 80C39 microcontrol- ler, an 8-KB EPROM, a few V. 28 interface drivers, opamps, LEDs and switches. Many countries, many standards I received the Speedy 1200+ pictured here from my brother who was clearing out his stuff, and found it still in the box! The unit was kind of dear to me because around 1986 I worked for a few years as a design engineer for its manufacturer, I ESP 20041 Retronics is a monthly section covering vintage electronics including legendary Elektor designs. Contributions, suggestions and requests are welcome; please telegraph editor@elektor.com CPV mbH in Flamburg. Those were "wild west" times in Germany, with a lot of turmoil due to the changes afoot in the whole area of telecommunications. The German telecom authority, Deutsche Bundespost (DBP), was forced by European regulations to open up its former national network structures and to relax some of the very strict technical regulations, in order to allow nationwide competition. Those exciting days saw strong confrontation between the industry and the Ministry for Post and Telecommunications, on how to break up the crusted structures of the former monopolist DBP. Especially the grueling lab tests done at the ZZF approval labs (Zentralamt fur Zulassungen im Fernmeldewesen), located at Saarbrucken, southern Germany, scored highest in prevent- www.elektor-magazine.com | May 2014 | 81 •Regulars Inventor Robert Weitbrecht (1920-1983), deaf born, physicist and amateur radio enthusiast, made his first long distance call using his invention called "acoustic coupler device", hooked up to a TTY (teletypewriter) in May 1964. His so-called "deaf TTY" (telephone TTY) pioneered telecommunications between deaf people around the globe. Light and portable electronic typewriter machines combined with acoustic couplers soon replaced the earlier electromechanical TTY monsters (like the Silent 700 from TI [1]). This idea was picked up and worked out by the "computer" generation to follow. ing foreign companies to get type approval for their communication equipment to be marketed in Germany. This was also the time when a ZZF approved 300-bps FDX/1200-bps HDX dial-up modem operating to CCITT V.21 and V. 23 carried an immense price tag of DM 3,000. Far Eastern and US manufacturers just capitulated in front of the price quote and red tape for type approval in ole' Germany. Even in later years, when laptop comput- ers appeared, US standards seemed to dom- inate in the area of dial-up modems, and just a handful carried ZZF approval, i.e. show- ing the FTZ label with an old post hornet pic- tog ra m and the device's approval number. Web Link [1] Deafness. about. com/od/peopleindeafhistory/a/weitbrecht.htm Further Reading / Browsing A small gallery of Acoustic Couplers may be found at: Commons.wikimedia.org/wiki/Category :Acoustic_couplers?uselang=en Including: Dataphone S21 (Woerltronic, Cadolzburg) CX-21 (Epson) AK2000 (EDV-Kontor GmbH) Datenklo (Chaos Computer Club, 1985) AM211 (Anderson-Jacobson) "307" (TRANSDATA) Silent 700 (Texas Instruments— from RCS/RI collection) Also found there: Telecoupler II (Road Warrior Inti.) (claims 33.4 kbps) Carterphone (1959) — historic acoustic coupling device Exactly at that time, the dwarf company CPV mbH jumped the bandwagon. CPV designed lots of dial-up modems with full German approval for many of the internationally well-known laptop manufacturers, as well as for a few German ones. It should be mentioned here that in those years there was no such thing as European telecom- munications, it was all EC telecoms (European Community). Every European country including Switzerland (not part of the EC) had its own national equipment registration procedure and associated technical approval systems in place. No wonder that this European diversity was — and still is — driving mass volume producers of data communication equipment ultimately crazy! Meanwhile this situation has changed somewhat. The EC-wide and national standards are much relaxed. And a dial-up modem is about €15 if you ever want to use one again when your broadband Mbits/s or Gbit/s lines are down. Follow-up versions For this particular apparatus, the German PTT was forced to create a whole new device class for approval— because nobody ever thought of having V. 22 on an acoustic coupler! No worries, it's got its label with the post horn pictogram, allowing it to be used within the German pub- lic dial-up telephone network. A later, upgraded version, including the first optical line interface with German approval, previously invented for the space limited slots found in laptop computers, went on market. Another version, this time with an FCC68 approved dial-up line interface, data compression and MNP4 error correction, even made it to COMDEX electronics show— little won- der, it turned out a total flop in the US market. ( 130465 ) 82 | May 2014 | www.elektor-magazine.com SS;s VOl electronics senga . networ data „ ai medial information ' | ■m product news ( embedded design tips tutorial software Q) neering tools system au d i o business n inq media ° COMMUNITY .. ^Jat\4'4x) -Uk4r> iAouy ir\4tiy^s4s opirtiorts! Ov&cjv. omtI" ovy Nje^i Social stadia 0«He4s f or J&Yick- ertgage*vei4j CIRCUIT CELLAR / AUDIOXPRESS / ELEKTOR •Regulars Hexadoku The Original Elektorized Sudoku Spring weather allowing you should have had opportunities, however short, to take your Hexadoku puzzle outside for an attempt at solving. And here's another one to keep you going. Find the solution in the gray boxes, submit it to us by email, and you automatically enter the prize draw for one of five Elektor book vouchers. The Hexadoku puzzle employs numbers in the hexadecimal range 0 through F. In the diagram composed of 16 x 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 five Elektor Book Vouchers worth $70.00 (£40.00 / €50.00) each, which should encourage all Elektor readers to participate. Participate! Before June 1, 2014, supply your name, street address and the solution (the numbers in the gray boxes) by email to: hexadoku@elektor.com Prize winners The solution of the March 2014 Hexadoku is: 0E4D6. The €50 / £40 / $70 book vouchers have been awarded to: Adrie van de Ven (Netherlands), Ola Sandin (Sweden), Jose Carlos Negro (Spain), Saudin Dizdarevic (Bosnia and Herzegovina) en Kiss Tibor (Hungary). Congratulations everyone! 5 7 2 4 F 8 0 E E B C 3 4 8 2 6 A 9 F 8 0 s 9 E B 2 B F 4 0 C D 6 ll C D 6 0 7 A 6 1 F A E 4 0 3 E 4 7 2 6 A D 5 c 5 A 3 8 7 9 6 1 0 4 C 5 2 D ?! 6 9 5 B F 1 3 A 1 F D 0 2 5 E D i 7 4 0 3 5 5 8 B D 4 3 9 A E cl 7 1 8 D 3 E 6 a! 0 E 4 D 6 3 7 9 2 A 5 8 1 c B F F 5 6 2 A B 8 4 0 c 1 3 D E 7 9 1 A B 7 5 D C 2 4 E F 9 8 0 3 6 8 3 9 c E F 0 1 6 7 B D 2 A 4 5 7 B c E 8 A D F 9 2 6 0 3 4 5 1 4 8 F 1 7 6 E 0 5 B 3 c 9 D A 2 D 6 2 3 B 1 9 5 E F 4 A C 8 0 7 5 0 A 9 2 C 4 3 D 1 8 7 B F 6 E 9 C E B D 8 F 6 7 3 A 5 4 1 2 0 6 D 1 4 c 0 5 7 8 9 2 B E 3 F A A F 7 0 1 2 3 B C D E 4 5 6 9 8 3 2 5 8 9 4 A E F 6 0 1 7 B c D 2 1 D 6 F 9 B c A 4 7 E 0 5 8 3 c 7 3 A 0 E 2 8 B 5 D 6 F 9 1 4 E 9 0 F 4 5 1 A 3 8 c 2 6 7 D B B 4 8 5 3 7 6 D 1 0 9 F A 2 E c The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. 84 | May 2014 | www.elektor-magazine.com •Gerard's Columns Appearing Strong By Gerard Fonte (USA) In today's competitive envi- ronment the difference between appearing strong and appearing weak can have a significant impact on your success. Let's take a look at several scenarios with two different engineers that have identical capabilities. The strong-appearing engineer is John Bigbooty and the weak-appearing engineer is John Smallberries (thank you Buckaroo Banzai). Can Do! The boss has decided (correctly) that the only realistic approach to the new widget design is to use a Field Programmable Gate Array (FPGA). Flowever, neither engineer has any real experience in working with FPGAs. (Note: the cost for the engineer's salary, benefits, support and overhead is about $2500/week.) John Bigbooty: "No problem! I'll get on it right away. You can count on me." Fie goes to his desk and starts researching FPGAs. There's loads of data on the Internet as well as many vendors. Fie figures that the first thing to do is decide which FPGA type is best. Fie spends several days working through each vendor's products and eventually chooses the Xilinx Spartan family. Fie downloads and studies the data- sheets, user guides and application notes. There are several hundred pages of data that takes a few more days to examine. Fie downloads the development software and takes a few more days to get familiar with it. At the end of two weeks, he is ready to start developing the FPGA for the widget. Cost to company: $5000 and a two week delay. John Smallberries: "Gee boss, I've never done anything like that before. Let me check it out." Fie goes to Pinky Carruthers ( ibid) who has a lot of experience with them and asks for help. Pinky is involved in another very important project but can spend half an hour explain- ing FPGAs. John comes away with a basic understanding of what is needed, which FPGA is best suited for the application, and what he needs to learn. Fie spends an hour on-line researching Xilinx techni- cal support. About two hours after being given the assignment, he goes to his boss, explains the decisions he has made and requests $1500 for two on-line courses to bring him up to speed. FHis boss agrees and in two days he is ready to start developing the FPGA for the widget. Cost to company $2500 and a two day delay. Say What? At the weekly meeting a new assignment is presented. A low-speed serial interface has to be added to the widget as per the customer request. The stated reason is to interface to some older customer equipment. John Bigbooty: It seems certain that either USB or Firewire are good choices. Flowever, USB is more universal and speed isn't an issue. Fie decides on USB and spends the next week designing a simple and inexpensive, drop-in module for the widget. It is truly an elegant and sophisticated design that he is anxious to present at the next project meeting. John Smallberries: Fie goes to his desk and starts working and realizes that he doesn't really know what the customer wants. FHis boss wasn't specific at the meeting. So he drops by his boss's office to ask him to clarify the assignment. FHis boss replies that the customer wants an RS-232 interface. They want to transfer some calibration data during start-up and want to record occasional operating parameters. Fie returns to his desk and provides a workable RS-232 interface at the next project meeting. Oops! The widget project is ready to go into production and the engineer realizes that he made a slight specification error in a power supply capacitor. Fie overlooked that AC voltage is specified as RMS rather than peak (which is 141% more than expected). So the 50% safety margin in capacitor's working voltage is really only 9%. John Bigbooty: Admitting to an error will make look bad and I'll get a poor performance review. The capacitor is still working within its safety margins. So, it's not really an error. A different engineer may very well specify a 10% safety margin. After all, the lower working voltage means a cheaper capacitor. Anyway, the design is accept- able as it is. Besides, it will take months or years— perhaps never— for anyone to realize that the capacitor is under-rated. Who knows what will happen in that time. John Smallberries: As soon as he realizes his error he goes to his boss. "Boss, I screwed up. I called out the wrong working voltage for capacitor C6. There's only a 9% safety margin instead of 50%. The capacitor is a critical part of the power supply so reliability is an important consideration. I checked out available parts and we can get a capacitor with 50% margin that will fit the circuit board for only fifteen cents more. We can return our existing stock of old capacitors and replace them with new ones within two days. If we market an unreliable product it will cost us in sales, product returns and customer loyalty." Role Reversal It is probably not surprising to realize that employers much prefer the attitude and performance of John Smallberries to John Bigbooty. In this case, being strong and independent is really being selfish and shortsighted. John Smallberries demonstrates better problem solving skills, better interpersonal relationships and a better understanding of business. Fie also shows loyalty to the company and its customers. In short, being weak is really being strong in character. ( 140008 ) www.elektor-magazine.com | May 2014 | 85 •Store Raspberry Pj® Hardware Projects ^ J W _L 1 5 * , Uy . H i hi £ 1 5 _ * xg I |i«E Si^Tnli-, ■ | a £ t Time wave form v . I c Analog block invaders | i n I—? iSH Display- *sSr°P^-,i_ r I! ^ jSjSS;“-: 1 " ' <1 ^user ■ Sn| i iff! iMs*" ;, 5 5 £ l'f* k |l | Subprogr VNC Viewer -■ Rfinamyig S&nsor pncla LJ ; • i ■ 0|ektor i E j ^ £ £ / L?:M '3 '-^il 2C|0|«| r-wref *3 w \- fsli 1 >■ v . - ?! %n a ji “if' 53 Dogai Ibrahim 150/o DISCOUNT for GREEN and GOLD Members! www.elektor.com/may The RPi in Control Applications ■ Raspberry Pi Hardware Projects This book starts with an introduction to the Rasp- berry Pi computer and covers the topics of purchas- ing all the necessary equipment and installing/using the Linux operating system in command mode. Use of the user-friendly graphical desktop operating envi- ronment is explained using example applications. The RPi network interface is explained in simple steps and demonstrates how the computer can be accessed remotely from a desktop or a laptop computer. The remaining parts of the book cover the Python pro- gramming language, hardware development tools, hardware interface details, and RPi based hardware projects. ISBN 978-1-907920-29-5 £34.95 • € 39.95 • US $54.00 An essential source of reference material . Process Measurements with C# Applications Measurement is vital to the successful control of any process. This book introduces PC based measurement systems and software tools for those needing to under- stand the underlying principles or apply such techniques. Throughout the book, the C# programming language is used to give the reader immediate practical desktop involvement. C-Sharp has a wide support base and is a popular choice for engineering solutions. The basics of measurement and data capture systems are presented, followed by examples of software post-processing. Application examples are provided from a range of pro- cess industries, with reference to remote monitoring, distributed systems and current industrial practices. 144 pages • ISBN 978-1-907920-24-0 £23.95 • € 27.50 • US $38.00 Lots of power with low distortion ■ Q-Watt Audio Power Amplifier Elektor has a long history with audio power amplifiers. We are proud to present yet another fully analog cir- cuit developed entirely in house. Despite the simple design of this audio power amp with just one pair of transistors in the output stage, Q-Watt can deliver over 200 quality (Q!) watts into 4 ohms with excep- tionally low distortion thanks to the use of a special audio driver IC. Due to popular demand, this project is now supported by a semi-kit containing everything you need to build a stereo amplifier. 2 PCBs and all electronic parts Art.#110656-72 £147.95 • € 169.95 • US $230.00 The luxury of precision within everyone's reach B 500 ppm LCR Meter The remarkable precision of this device and its amazing ease of use are the result of careful design. It works so well behind its uncluttered front panel that one could almost forget the subtleties of the measurement tech- niques employed. A dream opportunity for our readers who are passionate about measurement to enjoy them- selves. If, like us, you wonder at the marvels modern techniques bring within our reach, come along and feel the tiny fraction of a volt. Set: main board and LCD board, assembled and tested Art.# 110758-93 See www.elektor.com/lcrmeter All articles in Elektor Volume 2013 E3 DVD Elektor 2013 This DVD-ROM contains all editorial articles published in Volume 2013 of the English, American, Spanish, Dutch, French and German editions of Elektor. Using the supplied Adobe Reader program, articles are pre- sented 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 86 | May 2014 | www.elektor-magazine.com Books, CD-ROMs, DVDs, Kits & Modules graphics program, zoom in / out on selected PCB areas and export circuit diagrams and illustrations to other programs. ISBN 978-90-5381-277-8 £23.95 • € 27.50 • US $38.00 The First Elektor Chip 03 E-Lock The E-Lock chip allows you to connect your control system to the 'Network of Networks' and monitor and control it from anywhere on or around the globe using your computer, tablet or smartphone without having to worry about the security of the connection and in full assurance of protection against intruders. Ready build module Art.# 130280-91 £96.95 • € 111.00 • US $150.00 See www.elektor.com/e-lock Programming step-by-step E Android Apps 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, aim- ing to show how personal applications can be pro- grammed. A wide variety of applications is presented based on a solid number of hands-on examples, cov- ering anything from simple math programs, read- ing 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. 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! 244 pages • ISBN 978-1-907920-15-8 £34.95 • € 39.95 • US $54.00 MIFARE and Contactless Cards in Application E RFID MIFARE is the most widely used RFID technology, and this book provides a practical and comprehensive introduc- tion to it. Among other things, the initial chapters cover physical fundamentals, relevant standards, RFID antenna design, security considerations and cryptography. The complete design of a reader's hardware and software is described in detail. The reader's firmware and the asso- ciated 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. Alter- natively, one may follow all of the examples using Visual Studio 2010 Express Edition. Finally, the major smart card reader API standards are introduced. The focus is on pro- gramming contactless smartcards using standard PC/SC readers using C/C++, Java and C#. 484 pages • ISBN 978-1-907920-14-1 £43.95 • € 49.90 • US $68.00 A Small Basic approach E PC Programming There are many different PC programming languages available on the market. They all assume that you have, or want to have, a knack for technology and difficult to read commands. In this book we take a practical approach to programming. We assume that you simply want to write a PC program, and write it guickly. Not in a professional environment, not in order to start a new career, but for plain and simple fun... or just to get a task done. There- fore we use Small Basic. You will have an application up and running in a matter of minutes. You will understand exactly how it works and be able to write text programs, graphical user interfaces, and advanced drivers. 194 pages • ISBN 978-1-1-907920-26-4 £30.95 • € 34.50 • US $47.00 www.elektor-magazine.com | May 2014 | 87 •Store van Oaqi Raspberry Pi Qektor Drag 'n Drop ADAU1701 Universal 1 Audio DSP Board Always wanted to start out with DSPs, but afraid of the SMD? Here's the answer: Elektor's all-DIY Univer- sal Audio DSP Board! Based on the Analog Devices ADAU1701 DSP chip and drag-and-drop software, this board will ease your way to becoming a sound crafts- man, guaranteed maths-free. Semi-kit: all TH components, PCB with DSP preassembled Art.# 130232-71 £63.95 • € 72.95 • US $99.00 110 Elektor Editions, Over 2500 Articles I DVD Elektor 2000 through 2009 This DVD-ROM contains all circuits and projects published in Elektor magazine's year volumes 2000 through 2009. The 2500+ articles are ordered chrono- logically by release date (month/year), and arranged in alphabetical order. A global index allows you to search specific content across the whole DVD. Every article is printable using a simple print function. This DVD is packed with ideas, circuits and projects that are ideal for any electronics enthusiast, student or professional, regardless of whether they are at home or elsewhere. ISBN 978-1-907920-28-8 £77.95 • € 89.00 • US $121.00 Explore the RPi in 45 Electronics Projects E! Raspberry Pi This book addresses one of the strongest aspects of the Raspberry Pi: the ability to combine hands-on electronics and programming. No fewer than 45 excit- ing and compelling projects are discussed and elab- orated in detail. From a flashing lights to driving an electromotor; from processing and generating ana- log signals to a lux meter and a temperature control. We also move to more complex projects like a motor speed controller, a Webserver with CGI, client-server applications and Xwindows programs. Each project has details of the way it got designed that way. The process of reading, building and programming not only provides insight into the Raspberry Pi, Python, and the electronic parts used, but also enables you to modify or extend the projects any way you like. 288 pages • ISBN 978-1-907920-27-1 £34.95 • € 39.95 • US $56.40 Helped By Arduino E Mastering Microcontrollers The aim of this book is not only to let you enter the World of Arduino, but also to help you emerge victori- ous and continue your microcontroller programming learning experience by yourself. In this book theory is put into practice on an Arduino board using the Arduino programming environment. Having completed this fun and playful course, you will be able to program any microcontroller, tackling and mastering I/O, memory, interrupts, communication (serial, I 2 C, SPI, 1-wire, SMBus), A/D converter, and more. This book will be your first book about micro- controllers with a happy ending! 348 pages • ISBN 978-1-907920-23-3 £34.95 • € 39.95 • US $54.00 Circuits & Projects Guide E Arduino The Arduino user is supported by an array of software libraries. In many cases, detailed descriptions are missing, and poorly described projects tend to confuse rather than elucidate. This book represents a different approach. All projects are presented in a systematical 88 | May 2014 | www.elektor-magazine.com Books, CD-ROMs, DVDs, Kits & Modules ‘GUM;* , Arduino og ahouimq Praetor.*! I digital Signal Processing \ ' jF,4l LJ ^i>MnirclHj;i V A ^ 7*r- K D V Qpijdr'i ibrsnirp Ciektor eificiin HEIM manner, guiding into various theme areas. In the coverage of must-know theory great atten- tion is given to practical directions users can absorb, including essential programming technigues like A/D conversion, timers and interrupts— all contained in the hands-on projects. In this way readers of the book create running lights, a wakeup light, fully func- tional voltmeters, precision digital thermometers, clocks of many varieties, reaction speed meters, or mouse controlled robotic arms. While actively work- ing on these projects the reader gets to truly com- prehend and master the basics of the underlying controller technology. 260 pages • ISBN 978-1-907920-25-7 £34.95 • € 39.95 • US $54.00 draw cries of amazement from the visitors who find it in our laboratory. Well bet many of you will want to do the same in your own homes! Module, ready assembled and tested Art.# 120732-91 See www.elektor.com/ultiprop Ideal reading for students and engineers Practical E 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 mini- mum 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 pro- grams. 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 sys- tems. Undergraduate students should find the theory and the practical projects invaluable during their final year projects. Similarly, postgraduate students should be able to develop advanced DSP based projects with the aid of the book. 428 pages • ISBN 978-1-907920-21-9 £43.95 • € 49.90 • US $68.00 Time & Date Floating in the Air E UltiProp Clock Electronics is never so fine as when it skillfully com- bines magic with physics, mechanics with software, imagination with thoroughness and precision, and a taste for beauty with good workmanship. This time- piece was designed to display the time and date in an original way— but we admit we did also design it to Further Information and Ordering: WWW. el ektor.COITl /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 | May 2014 | 89 •Regulars NEXT MONTH IN ELEKTOR MAGAZINE FT311D Breakout Board If you're into driving electronics circuits it may be quite useful to employ an Android device to generate control commands for a circuit, or to display data on a screen. To help you on, Elektor Labs have designed a small circuit that can be connected directly to an Android device. The circuit is built around an FT311D from FTDI, which is a so-called USB Android Host IC. Earthquake Detector This circuit gives a visual and acoustic warning when it detects an earthquake or a major shock. It is plain simple and consists of a special piezoelectric sensor, a pulse stretcher, an alerting device and a relay. It is also possible to send the alert signal wirelessly to a remote location. A simple transmitter and receiver got designed for the purpose, using low power radio modules. These are also described in the June 2014 issue. Revolution Counter with OLED Display Users of milling machines and lathes often need to know the exact speed at which the cutter or the workpiece is revolving. For this is a small shield got designed for putting on an Arduino Micro, creating a nice compact unit. An OLED is used for display function. The speed detection is implemented using an LED- phototransistor device. The display can show both the speed and the total up time. Article titles and magazine contents subject to change, please check www.elektor-magazine.com for updates. Elektor June 2014 is processed for mailing to US, UK and ROW Members starting May 20, 2014. See what's brewing @ Elektor Labs 24/7 Check out www.elektor-labs.com and join, share, participate! on Qektor projects ychi want to post a project out you ore not a member? Click here to «nd a description or your project Including a circuit diagram and a photograph for equation -arid may to ytnj will be granted 90 | May 2014 | www.elektor-magazine.com 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@pcspublink.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.elektor.com/member. www.elektor-magazine.com | May 2014 | 81 7 functions of PicoScope: 1. Oscilloscope 2. Spectrum analyzer 3. 5. Logic analyzer 6. Serial protocol analyi Technology r Function generator 4. AWG 5r 7. Automatic waveform test osc I* I* — ' s. ?-■ fi r- S-r-, L r ■ ■> ■* ’L : ! L. ■■ K ■ • ■■ ' J in_n n n n juin/uuuyuui/mnnii ■i ■ - • n n n_nj — • ij u u u u u u i " Mi-H > -t ■ * \ / a i r . ■: - .If J ■ jir tin '_n I? WL f-ir-i' Tin n niii A *1 — - . i W iiA w* " t ! 'A/ i/w J L - — yUMMMp / /A3£X: c , uMi i *.Rni nil itif-j nni-ai ■ .tf-j ii ‘k-sm i!u« b*i* an- aw- i-m*- t* - Jf ^ For just £1395 • High resolution •USB powered • Deep memory ■ J _i J ■— J h- J WWW»pl CQtgch. CPI PlrnSropc -lOOQ St.‘ik:^ ± 5Q V © © T 1 'Tfc ,*] ©“ ©> ©' © © INCLUDES AUTOMATIC MEASUREMENTS, SPECTRUM ANALYZER, SDK, ADVANCED TRIGGERS, COLOR PERSISTENCE, SERIAL DECODING (CAN, LIN, RS232, l 2 C, PS, FLEXRAY, SPI), MASKS, MATH CHANNELS, ALL AS STANDARD, WITH FREE UPDATES 12 bit • 20 MHz • 80 MS/s • 256 MS buffer • 14 bit AWG www.picotech.com/PS242