www.elektor-magazine.com •magazine January & February 2014 EXTRA-THICKEDm^. ' s DI v ELECTRON** OF PAGES 132 US$14.00 - Canada $14.00 o 56698 24965 8 WHERE THE CHIP MEETS THE BOARD DesignCon 2014 is the premier event dedicated to the chip, board and systems design engineering community involved in high-speed design with a Focus on the pervasive nature oF signal integrity at all levels oF electronic design. Explore 100+ Technical Tutorials, Panels & Case Studies For the latest design theories, methodologies and applications Meet 150+ Exhibitors showcasing advanced design tools & solutions to your biggest SI, PI & verification challenges Attend Keynotes: ProF. Dr. Hermann Eul, VP & GM, Mobile Communications Group, Intel & J. Thomas Pawlowski, ChieF Technologist & fellow, Micron Share ideas & insights with peers & industry experts at the: Welcome Reception, DesignTOUR, Happy Hours, Chiphead Theater, Awards Programs & more CONFERENCE: January 28-31 EXPO: January 29 & 30 Santa Clara Convention Center, Santa Clara, CA REGISTER RT WWW.DESIGRCOR.COIR Does your design need class-leading 32-bit MCU performance, code density and ADC throughput? PIC32MZ offers 330 DMIPS and 3.28 CoreMarks T 7MHz performance \ PIC32MZ Embedded Connectivity MCU Family 2 MB Flash, 512 KB RAM, 330 DMIPS © 1 Microchip Microchip's new PIC32MZ 32-bit MCUs achieve class leading performance, combined with ADC throughput of 28 Msps, 30% better code density and up to 2 MB dual-panel Flash with live update and 512 KB RAM. The PIC32MZ Embedded Connectivity (EC) family of 32-bit MCUs introduces a breakthrough in high-end embedded control with its class-leading performance and code density in addition to new levels of on-chip memory and peripheral integration. With up to 2 MB of dual-panel Flash and 512 KB of RAM, the PIC32MZ offers 4x more on-chip memory than any other PIC® MCU, with fail-safe operation during live Flash updates. It is also the first PIC MCU to use the enhanced MIPS microAptiv™ core which adds 159 new DSP instructions that enable the execution of DSP algorithms at up to 75% fewer cycles than the PIC32MX families. Advanced connectivity is supported over Hi-Speed USB, 10/100 Ethernet and two CAN 2.0b modules as well as multiple UART, SPI/I 2 S, and l 2 C channels. The optional on-chip crypto engine ensures secure communication with a random number generator and high-throughput data encryption/ decryption and authentication. For more information, go to: www.microchip.com/get/eupic32mz DEVELOPMENT TOOL SUPPORT: ■ Turn-key PIC32MZ EC Starter Kits ■ Multimedia Expansion Board II ■ PIC32MZ2048EC Plug-in Module for Explorer 16 PIC32MZ Embedded Connectivity Starter Kit (DM320006 or DM320006-C with crypto engine) Microchip Microcontrollers * Digital Signal Controllers • Analog * Memory • Wireless The Microchip name and logo, and PIC are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. All other trademarks mentioned herein are the property of their respective companies. ©201 3 Microchip Technology Inc. All rights reserved. DS60001247A. ME1092Eng1 1.13 Contents Community 8 Elektor World • Postermania • The Elektor Studio • World Class Tips • From Tracing Paper to Computer: Elektor Schematics Layout • Raspberry Pi Cookbook 10 New Look for the Elektor Store Welcome to the revamped Elektor Store, and enjoy the shopping experience! • DesignSpark 78 That Zero-ohm Resistor The Unbearable Lightness of Being zero ohms. 104 DesignSpark Tips & Tricks Day #7: 3D Modding and Modeling How to create a 3D view of your project, and export it to DesignSpark Mechanical. • Projects 12 ADAU1701 Universal Audio DSP Board Always wanted to start with DSPs, but afraid of the SMD? Here's the answer. 20 UltiProp Clock (2) This month we conclude with the intricate assembly of the propeller clock. 26 Compact Tube Amplifier Hey this one works with ordinary power transformers. 32 Pretty Accurate Digital Wall Clock No radio control, yet an error of just 64 seconds per year, max! 38 RJ45 'Running-Lights' Cable Tester No microcontroller included— no common ground lead either. 40 Multi I/O for FPGA Development Board Applying VHDL programming to the Elektor FPGA dev system. 48 555 Class-D Audio Amplifier What do you mean Class-D audio always requires complex ICs? 54 Mixing Electronics and Mechanics with Flowcode 6 3D is Key. The developers explain. 60 LED's Replace That Halogen Lamp A direct-fit replacement for the standard GU4 halogen lamp. 64 Model Train Dual Radio Control Radio takes over from infra-red. 70 Arduino on Course (6) Let's build a sounding balloon to capture weather data. 75 Active ESD Protection Some microcontrollers and other ICs can do with extra protection against static discharges. 4 | January & February 2014 | www.elektor-magazine.com Volume 40 No. 445 & 446 January & February 2014 80 Developing with Embedded Linux This month we learn how to develop our own applications using C++ and Eclipse. 87 Simple Current Pulse Generator Theory and practice for wide-range current measurements on a budget. 90 Soldering LFCSP ICs by Hand Demonstrating how the ultra-tiny AD9913 DDS IC gets wires attached to its pins. 92 USB Key Passport Turn the key and have your password typed automatically. 98 Nanoamps on the DMM Measure tiny currents using an ordinary digital multimeter. 100 Bird Drinking Water Heater Using a 2N3055 and a tomato paste tin. Labs 108 Arduino Yun Labs got their hands on a Yun and found out if it really bridges two worlds. 113 What it Takes to Make an LED Blink Behold the embedded-age equivalent of a switch and a resistor. 114 Join the Fourth Industrial Revolution! An overview of Internet of Things (IoT) projects hot on our labs website 115 Where There's Smoke There's Fire An attempt at building an electric cigarette. • Industry 116 News & New Products A selection of news items received from the electronics industry, labs and organizations. • Regulars 120 Hexadoku The Original Elektorized Sudoku. 122 Retronics Elektor AC Power supply (1984!). A useful tool if you are mindful about starting up low-voltage power supplies. Series Editor: Jan Buiting. 125 Gerard's Columns: Pro-Tronics A column or two from our columnist Gerard Fonte. 130 Next Month in Elektor A sneak preview of articles on the Elektor publication schedule. www.elektor-magazine.com | January & February 2014 | 5 •Community Volume 40, No. 445 & 446 January & February 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 132 pages— and not on a diet I used to think it was hard to prevent total dominance in Elektor magazine of articles chew- ing over projects, technologies or programming methods related to microcontroller and embedded technologies, and with our new "kitchen" website www.elektor-labs.com well up and running I had reason to fear an overwhelming presence of bit crunchers and compilers. Yet, looking at the Proposals and In Progress columns on the labs website there is a reassuring number of projects and project ideas that are suitable for microcontroller-free diets. Three areas in particular, audio, radio, and test & measurement, seem to attract designs produced without any PICs, AVRs, ARMs, or Cortex-Xs acting as black boxes. That does not mean the projects are totally free from Raspberry Pis or Arduinos though, as these and similar boards are now (rightly) considered "just another useful compo- nent" rather than an intricate microcontroller in a cloud of code and protocols. This extra thick edition of Elektor magazine intends to get you through the two first winter months of 2014 while attempting to give analog en non-microcontroller projects their due share of pages. To kick off, there's our DSP-without-the-math on page 12. There are two magnificent audio amplifiers, one 555 based (page 48) and one with tubes (page 26). The amps have low cost, ease of assembly, and vintage components in common— and by no means aspire to reach the realms of High End Audio. We could not resist though grilling them on our Audio Precision distortion analyzer. Besides the 555 another old faithful, the 2N3055, hails from the past- secured to the bottom of a tomato paste tin, on page 100 it's helping to serve a drink of water to birds of the feathered variety during the winter months. The RJ45 Cable Tester on page 38 also excels in not having a microcontroller. Nanoamps current measurements (page 98) and current pulses (page 87) are covered in two separate articles for the T & M fans among you. The latter article is part of a series due for continuation in the March 2014 edition. Thumbs up for that AC power sup- ply from 1984 (page 122). Diets if applied should be moderate and balanced— we serve dishes with and without the opcode ingredient. Enjoy! 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) Harry Baggen, Jaime Gonzalez Arintero, Denis Meyer, Jens Nickel Thijs Beckers, Ton Giesberts, Wisse Hettinga, Luc Lemmens, Mart Schroijen, Clemens Valens, Jan Visser, Patrick Wielders Giel Dols Danielle Mertens Don Akkermans 6 January & February 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@gmail.com 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 m COIL circuit cellar Connects You To Supporting Companies c □ £ DESfCNUON Design rimnwmm rimi Cleverscope www.cleverscope.com 99 Crystalfontz www.crystalfontz.com 69 DesignCon 2014 www.designcon.com 2 DLP Design www.dlpdesign.com 69 Eurocircuits www.elektorpcbservice.com 37 EzPCB www.ezpcb.com 79 Front Panel Express www.frontpanelexpress.com 79 IPC APEX Expo 2014 www.ipcapexexpo.org 59 LrwtK ttiC vi’iA— Labcenter www.labcenter.com 132 Max B otix Maxbotlx L^— — — www.maxbotix.com/elektor 31 Microchip Microchip , , www. microchip. com/get/eupic32mz 3 Pico picu www.picotech.com/ps239 131 flPnlfilii P ° l0lU SJdSS www.pololu.com 47 Racelogic www.labsat.co.uk/triall4 59 Reichelt iFXSlF ^ e ^ www. reichelt. com 11 Saelig mm www.saelig.com 77 LabSat? 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 January & February 2014 7 Community Compiled by Wisse Hettinga Elektor World Every day, every hour, every minute, at every given moment designers and enthusiasts are thinking up, tweaking, reverse-engineering and developing new electronics. Chiefly for fun, but occasionally fun turns into serious business. Elektor World connects some of these events and activities — for fun and business. Raspberry P< ■ M «5 single-t>oa rd compU „’3 r , or popular A credit-card size , ard and ha s supp et ) as well It runs linux from = and peripherals (USB, options for connect (GPIO)- Postermania These are interesting times for the publishing world. The new 'online and content' are giving the old, established media a run for their money, and who still believes you can make a decent profit from publishing something as old-fashioned as a book? Or take posters— in the old days Elektor often produced posters showing, for example, a bunch of connectors. You can still find them in classrooms. Is it just ancient his- tory? To our surprise the Raspberry Pi poster did rather well earlier this year. The design was downloaded over 35,000 times and as you are reading this an Arduino poster is being made available— and there's more coming. And everything is down- loadable. I know what you are thinking: ''So, back to online anyway?" And yes, everything is downloadable— arguably the easiest way to deliver to your door. sis®® SSsSSSSSr-'®*” SSWiw**®'--- - — The Elektor Studio There are a few places in the Elektor offices that stand out. We have the permanent wire & meter mess of the Lab, the 'dungeons' (what secrets the walls could tell us...) and we have our attic. For years the attic remained unused and unloved, gathering dust. We decided to bring out the brooms and convert the space into a real video & photo studio. From our attic studio we bring you our monthly webinars in cooperation with element 14. Video will be implemented more and more in the new workings of Elektor— we are well past our first les- sons and mistakes, and are now creating video manuals for an increasing number of products. The number and form of the webinars will also be looked at— you can look forward to more even more interesting sessions from us. Patrick Wielders will be our man behind the camera and will manage the studio. 8 January & February 2014 www.elektor-magazine.com dra* cellar (J “ kwwh |‘jTIVbY 1 IMT Vj llf Wta »T«fci I ? 4^1 i. ■l£ji'ilru □SP vtj HI 5 C Processes {EE Tip ill 10 } t'.V" World Class Tips Oam*iM*r-**k hi Ih #il*4ttrwn i &- POKq nl m m riM m fts? 4 ; V ° 4 I arm ilLiri^ i hiH«w«i^«*w«Ui b^uM^ ■ M&G ■ nnriiiinr«M ^ UL-W lM «#A ^pWllMf|fh*l*rBttlfW | WWWfl CadS-nit lurfli 2 5 WP**™ P ^#PfWTM Vfm I 1 friH illii. P wn *iwN -*+*p ■* ith*V !■ ■ 3 »» I :•*:!* nwi iu ■•SAWC ■ i2 ■ I Imuh r-i n .f u’i'.ti vnml ■ n ‘Aus Ti U> ]«■ y^UUlaJT^Ciarj rttfcjB- ¥ ■ ULLLfl* «_rp n saiaE] For the past few months, Circuit Cellar magazine has been posting a weekly electrical engineering tip at CircuitCellar.com. The response has been excellent. Engineers from around the globe have been reading the tips and even submitting tips of their own. Recent tips have included: ’ Prototyping Tips for Engineers: Pro engineer and CC columnist Jeff Bachiochi presents three prototyping options and discusses the pros and cons associated with each one. He writes: "There are two alternatives to having a PCB house manufacture your PCBs: do-it-yourself (DIY) and routing. If you choose a DIY approach, you'll have to work with ferric chloride (or another acid) to remove unwanted copper. You'll be able to produce some PCBs quickly, but it will likely be messy (and dangerous)." (http://bit.ly/lbB4a40) ✓ DSP vs. RISC Processors: Engineer Bernard Debbash covers a few fundamental differences between DSP and RISC processors. Some generic RISC processors like the NXP LPC2138 don't have a saturation function, he explains. "So it's important to ensure that the input values or the size of the variable are scaled correctly to prevent overflow. This problem can be avoided with a thorough simulation process." (http://bit.ly/laBFPKb) Visit the CircuitCellar.com website or follow the editorial team via Twitter (https://twitter.com/circuitcellar), Facebook (https:// www.facebook.com/circuitcellar), and Google+, to get your weekly EE tips. Feel free to share you tips as well. From Tracing Paper to Computer: Elektor Schematics Layout If there is one characteristic of Elektor that stands out, it must be the way schematics are drawn. From the very start in the early 1970s Elektor has had a very specific way of schematic drawing, and the force behind this is... Mart Schroijen. For 36 years he has taken care of the drawings; initially using a set of Rotring pens and caique tracing paper, now it's all done with the help of com- puters and Patrick Wielders. Over the years Mart created thousands of draw- ings and also took many of the techy photographs appearing in the magazine. The biggest advantage of the Elektor schematic drawing style is instant recog- nition. Sometimes we receive project proposals covering our own publications, or we spot illegal downloads of our published articles (fun Friday afternoon times). In all cases the Elektor style is instantly recognizable. Raspberry Pi Cookbook Last year Elektor members enjoyed a series of RPi projects and arti- cles arriving via their Elektor.POST subscription every other week. The first seven projects have been compiled into a small cookbook allowing everyone to start off right away using a Raspberry Pi micro- computer. The booklet will be available to anyone launching a project on www.elektor-labs.com in January. www.elektor-magazine.com January & February 2014 9 New Look for the Elektor Store Since the start of the year, the familiar address www.elektor.com takes you to a fully revamped Elektor Store. The first thing you notice on the website is the fresh new layout based on the "less is more" principle. Thanks to Responsive Web Design technology, the site looks good on all types of devices, including computer monitors, tablets and even smartphones. • However, what's even more important is that the search function has been dramatically improved— and we have to admit that it was not one of the major strengths of our previ- ous online presence. The main menu gives you access to the fol- lowing product categories: Books, Micro- controllers, PCBs, Kits & Modules, and even more. A new feature is that searches now depend on criteria specific to the selected product category. For example, you can search for microcontrollers based on the product number, but you can also restrict your search by selecting parameters such as operating voltage or package type. You can select a price range for searching in any product category, and if desired you can sort the results by price. • Each product has its own page where all the product data is shown in an orderly manner. But that's not all: there you can also access pictures and user guides or manuals, and in many cases videos produced by the Elek- tor Labs end Editorial teams. The options for combined purchases and special offers are another attractive feature. That can save you a pretty penny! By the way, the range of payment options has been expanded and now includes MasterCard, Direct Debit (UK) and PayPal, to mention only the most important. However, we have dropped the Elektor Credits option. Regular and special editions of Elektor magazine can now be purchased directly in the store without the bother of credit units. • The new Elektor Store at www.elektor.com no longer includes the well-known project pages. They have been moved to www.elek- tor-magazine.com. The project pages are the starting point for downloads for Elektor projects, such as software or PCB layouts in PDF format. You can access an individ- ual project page quickly using the deep link www.elektor-magazine.com/xxxxxx, where "xxxxxx" is the six-digit article number that is always shown at the end of each article. How- ever, the old links with the format www.elek- tor.com/xxxxxx still work; they are automati- cally redirected to the -magazine website. The forums are still available to Elektor readers as usual. You can access the reader forums via the link http://forum.elektor.com. • Finally, a word about user accounts for the Elektor Store: if you have previously ordered something from the online store, you do not have to enter your data again. Now it's time for us to stop talking and for you to see for yourself: simply surf to the new Elektor Store at www.elektor.com, where you are bound to find something attractive. ( 130402 - 1 ) 10 | January & February 2014 | www.elektor-magazine.com \\\ Shop languages /7reichelt electronics Your competent online partner for Components Shop & soldering technology Power supply systems Home & security technology Measuring technology Network technology PC technology Sat/TV technology Communication Receive fresh information every week on New products Best offers Reduced prices Digital memory oscilloscope with outstanding performance data and USB interface! Y extra large full-colour display y / 25 MHz bandwidth Y 2 channels • Scanning rate: 250 MS/s • Rise time: <14 ns RV • Storage depth: 25 kpts lv • USB interface for export of readings Digital multimeter with USB interface • LC display, backlit, 6000 counts • Accuracy: 0.5 % • Safety: CAT II 600 V, CAT III 300 V • Measures resistance, \ frequency, capacitance, Ut temperature as well as f AC/DC current & voltage Hand-held Digital memory oscilloscope Combines the functions of an oscilloscope and a digital multimeter. • 1 -channel DSO with 25 MHz analog bandwidth • Scanning rate: 200 MS/s (real time) • High-resolution LC display, 8.89 cm/3.5", 320x240 pixels • Digital multimeter: 4000 counts • USB interface, software included True effective value Digital multimeter • Backlit LC display, 40,000 counts • Accuracy: 0.025 % • Safety: CAT III 1000 V, CAT IV 600 V • USB interface, software included • Data logger function: 100 readings • Measures resistance, capacitance, frequency, temperature as well as AC/DC current and voltage J (-£ 42.00) Infrared Thermometer • Measurement range: -18 to 380 °C • Distance/ measurement point ratio: 10:1 • Preset emissivity: 0.95 • Resolution: 0.1 °C • Repeat accuracy: ±0.5 °C or ±0.5 % • Measurement accuracy: ±2 °C/±2 % (-£248.89) (-£113.54) UT 300B f (-£29.39) True effective value Digital table multimeter Universal measuring device with outstanding features and a multi-function 40,000 count display! • 4 -% digit dual display, 40,000 counts • Accuracy: 0.025 % • Measures resistance, capacitance, frequency, temperature as well as AC/DC current and voltage • Diode and continuity check • Relative value measurement • Data logger function • USB/RS232 interface, software included • Safety: CAT I 1 000 V, CAT II 600 V AC/DC digital Clip-on measuring device • Up to 400 A • Clip: 0 28 mm • 3- 3 A digit LC display, 3999 counts • Safety: IEC 61010, CAT II 600V, CAT III 300V 'l.uijQq tnuaci &UB&CBIBB NOWl Professional Quality @ Discount Prices! Order now! WWW.reichelt.COITI English Hotline: +49 (0)4422 955-333 International payment method Daily prices! Prices as of: 12/12/2013 For consumers: The statutory right of withdrawal for consumers shall apply. All stated prices in € include the legal value added tax, ex works Sande/Germany, plus forwarding charges for the entire shopping cart. Our general terms and conditions shall apply exclusively (under www.reichelt.com/agb). Subject to prior sale. All brands, product names and logos are property of the respective manufacturers. Images can be similar. Subject to misprint, errors and changes in prices, reichelt elektronik GmbH & Co. KG, Elektronikring 1 , 26452 Sande/Germany (HRA 200654 Oldenburg) •Projects ADAU1701 Universal Audio DSP Board and no SMDs to solder drag 'n drop DSP'ing — By Ramkumar It seems that to even dip your feet in the ocean of DSP (digital signal processing) Ramaswamy (India) y 0 u neec j | ots Q f so |dering skills and a ton of math. Seems. Let's end the anxiety: here is a Universal Audio DSP board for the DIYer. Based on the Analog Devices ADAU1701 DSP, this board has only through-hole components— except for the DSP itself, which Elektor PCB Service reflow-solder in place especially 4 U. Analog Devices' ADAU1701 DSP chip represents a wonderful way of starting out and experimenting with DSP (digital signal processing). Together with the associated (free!) development environment called SigmaStudio, the chip is targeted at those who want an easy migration path from all-ana- log audio signal processing designs and moving into the digital domain. SigmaStudio requires no programming— just drag and drop prebuilt blocks such as "State Variable Filter" and hey 12 | January & February 2014 www.elektor-magazine.com ADAU1701 DSP Board D3V3 DVDD presto you have a circuit in minutes which can either be implemented as a DSP platform or sim- ulated using this board and then implemented as an analog platform! So there you have it— an easy-to-assemble DSP board featuring analog and digital I/O , easily programmable with no special hardware, in an environment that allows you to go for a finished product that is DSP-based or analog. All with no math! Out of the box, the ADAU1701 offers sampling rates of 44.1 kHz and 48 kHz. Higher sampling rates such as 96 kHz are possible but they require deeper configuration. The board comes with the DSP chip (a 48-legged SMD component!) preassembled. Even better, Elektor's semi-kit #120232-71 contains that same board and all through-hole parts, so there's also the fun of building it yourself. DSP board h/w The schematic shown in Figure 1 is based on the standard "self-boot" constellation found in the ADAU1701 datasheet, with some additions. All parts except the ADAU1701 DSP chip (IC3) are standard through-hole (TH). Let's do a quick tour. Unstabilized 5 to 12 volts DC enters the circuit via Figure 1. Schematic of the ADAU1701 Audio DSP Board. Caution: Transistor T2 must not be not fitted. www.elektor-magazine.com | January & February 2014 ] 13 •Projects Figure 2. Circuit board design for the ADAU1701 Universal Audio DSP Board. Conveniently the board comes with the DSP chip soldered in place. Do not fit T2. COMPONENT LIST Resistors (all fixed Rs 5%, .25W) R1,R18 = 100ft R15 = 330ft R4,R10,R11,R12,R13 = 470ft R21,R22,R23,R24 = 560ft R2 = lkft R3,R5,R14 = 2.2kft R25,R26 = lOkft R16,R19,R20 = 18kft R17 = 47kft R6,R7,R8,R9 = lMft P1,P2,P3,P4 = lOkft potentiometer, linear law P5 = 470ft preset (trimmer) Capacitors C1,C2 = 22pF C4 = 3.3nF C24,C26,C28,C30 = 5.6nF C6 = 56nF C3,C8,C9,C10,C11,C12,C14,C15,C21,C22,C32,C34 ,C36 = lOOnF C5,C7,C13,C16,C33,C35 = 10pF 16V, radial, 2.5mm pitch C23,C31 = 47pF 25V, radial, 2.5mm pitch C17,C18,C19,C20 = lOOpF 16V, 2.5mm Semiconductors D1,D2,D3 = 1N5817 D4,D5,D6,D7 = BZX79-C3V3 3.3V zener diode IC1 = 24LC256-I/P, DIL8 case IC2 = MCP6004, DIL14 case IC3 = ADAU1701JSTZ (LQFP48 case) IC4 = TS2940CZ-3.3 T1 = BC327 T2 = DO NOT FIT Miscellaneous K3,K4,K5,K6,K7,K8 = RCA/cinch socket, PCB mount K1 = DC power adaptor connector SI = pushbutton w. tactile feedback XI = 12.288MHz quartz crystal JP1 = 2-pin pinheader, 0.1" pitch K10 = 4-way pin header, 0.1" pitch K9 = 5-way pin header, 0.1" pitch Kll = 14-way pin header, 0.1" pitch K12 = 7-way pin header, 0.1" pitch Jumper PCB, Elektor Store # 130232-1, comes with ADAU- 1701JSTZ presoldered Semi-kit, Elektor Store # 130232-71, includes PCB 130232-1 and all through hole parts C21 * HI- * TP12 vF> C22 v TP13 0 vHF> f \*HF>/ ^ Cl 7 C24 C18(+ • • ) C26 C19(+ • • TP10 ^ ' •3E> • • TPll CD | 1 I • I CTS 06 v • SDA* > < . — _ gi \ \ [•] GND 5^ • • • H-E*lh • [ • J scl* ^ \ R 13 • CD* • UP* > < CM ) R12 • ■ [•|rst*>* < S P in S m [•I RTS TP1 TP3 MP3 NP8 luvH S i— H I “ U -•-•mi TP2 TP4 MP2 MP9 TP8. t TP6 PI ledi r. AUX_ADC1/NP2 AUX_ADC2/MP3 AUX_ADC3/riP8 AUX ADC0/MP9 • SI 1 RESET 14 | January & February 2014 www.elektor-magazine.com ADAU1701 DSP Board socket Kl. Schottky diode D1 provides protection against reverse polarity of the input voltage. All other circuitry on the board operates off a 3.3 V voltage supplied by regulator IC4. The stereo analog input sound is applied to DSP audio inputs ADCO and ADC1 via K3 and K4. The digitally processed audio from DACO, DAC1, DAC2 and DAC3 is available on cinch connectors K5-K8. Pots PI, P2, P3 and P4 are analog inputs for the DSP. They deliver a voltage from 0 V to a max- imum level defined by preset P5. The pot wiper voltages are buffered by rail-to-rail opamps IC2.A through IC2.D. Pushbutton SI is used to reset the DSP via its RESET pin (5). Jumper JP1 on the DSP's CLATCH line must be installed to program the on-board AT24CP EEPROM (IC1). Note that the DSP will not boot with JP1 fitted. After programming remove JP1 and press SI to allow the DSP to boot. K10 is for programming the EEPROM using a special programmer. K12 allows using the Elek- tor FTDI-BOB module # 110553 to program the EEPROM using the Elektor application S. Studio to EEPROM Converter. This is rather slow though. K9 is for programming the EEPROM using cus- tom hardware like an Arduino board. Its pins accept 5-V swing and are protected by 3.3 V zener diodes D6 and D7. Kll finally gives access to all GPIO pins of the DSP. Four lines (2, 3, 8, 9) are also used by the potentiometers P1-P4. Note however that these four lines can only be used to access the outputs of the opamp IC2, and not as inputs. DSP board assembly Elektor Labs have designed a compact PCB for the circuit— the component layout is shown in Fig- ure 2. This board is supplied with the DSP chip pre-assembled, so the rest of the construction should be easy. The introductory photograph and the one in Figure 3 show the prototype assem- bled by Elektor Labs. Note that transistor T2 must not be fitted. It was required during an Figure 3. View of the completed board and enclosure bottom half. www.elektor-magazine.com | January & February 2014 | 15 •Projects Figure 4. Example of the ADAU1701 SMD chip fitted on an SMD- to-DIP adapter board— in this case a Voti type PCB-06 (LQFP48). For convenience, the board pinout and ADAU1701 DSP pin index is pictured also. MODI Figure 5. Creating a project in SigmaStudio. early phase of the project but causes malfunc- tion in the final setup. Those of you keen to have the ADAU1701 DSP chip only on a separate board for dropping into their own project (stomp box, audio processor, ham radio TRX) will be delighted to know that LQFP48-to-DIP adapter boards are available from various sources like Voti [1], Dipmicro [2], Proto Advantage [3], Schmartboard [4] and ... EBay! The Schmartboard is our favorite for solderability, kind staff and the pinheaders included. Figure 4 shows the Voti adapter board assembled by Labs. Our DSP board accepts both 0.6 inch and 0.7 inch wide adapter boards— either can go in PCB position MODI, but only if the DSP chip is not fitted on the DSP main board. This provision should suit those of you having persisted in etch- ing and drilling their own circuit board from the artwork provided [5]. DSP'ing the graphic way DSP sadly but falsely remains associated with mathematics which tends to put people off. Happily, the Analog Devices' SigmaStudio envi- ronment follows an almost entirely graphical approach to configuring that complex DSP chip. With SigmaStudio it's drag and drop mostly instead of mathematics. Let's see how it's done in a Tutorial. The prerequisites are: • Windows 7 x86/x64, Vista, XP Professional or Home Edition with SP2; • at least one COM port or a USB-to-serial adapter; • .net framework 4 + 3.5; • SigmaStudio 3.9 (download at [7], free but account needed); • Elektor SigmaStudio to EEPROM Converter utility [5], an Arduino Uno or Mega board, or a I 2 C EEPROM programmer supporting the AT24CP. Step 1. Create a SigmaStudio project Start SigmaStudio. Select File - New Project and wait for the project to be created. You will see elements in the toolbox on the left; drag and drop "ADAU1701","USBi" and "E2Prom" blocks to the main window named Hardware Configu- ration. Now link one of the blue dots of the block 16 | January & February 2014 www.elektor-magazine.com ADAU1701 DSP Board USBi to the green dot of the ADAU1701, link the other blue dot of USBi to the green dot of the E2Prom. The result should look like in Figure 5. Save the project (e.g. as "Tutorial"), in a folder of the same name. Now Click on the "Schematic" tab. Notice the change of toolbox at the left. • Under 10 - Input, drag and drop an "Input" element. • Under 10 - Output, drag and drop an "Out- put" element twice. • Under GPIO - Input, drag and drop the "Auxiliary ADC Input" element. • Under Volume Controls — Adjustable Gain — Ext Control — Clickless SW Slew, drag and drop the "Single slew ext vol". • Right click on the "SW vol 1" block, select Grow Algorithm — 1. Ext vol (SW slew) — 1. Block "SW vol 1" should now have 3 inputs and 2 outputs. • From Filters — Second order — Single pre- cision - 2 Ch drag and drop "Medium Size Eq." • Right click on the "Mid EQ 1" block, select Grow Algorithm — 1.2 Channel - Single Precision — 3. Block "Mid EQ 1" should now have four sliders. • Connect the blocks as pictured in Figure 6. Now we need to configure GPI09 as an auxiliary ADC input. • Return to the "Flardware Configuration" tab and then click "IC1 -170x\140x Register Control" tab at the bottom of the window. • Select MP9 In the GPIO block and change "Input GPIO Debounce" to "ADCO", then return to "Config" tab as illustrated in Figure 7. Return to the Schematic and change the values of the slider frequencies in the equalizer and set the gain to your taste. The project is ready, save it. Press F7 or select from the menu Action — Link Compile Download. You will see a Comms error because duh you do not have the official program- mer. At some point during the creation of the schematic you will see a message mentioning USB problems. You can safely ignore this message. Return to the Flardware Configuration Tab, right click on IC1 and select "Write Latest Compilation Figure 6. These four sliders are the virtual equivalents of the pots on the DSP board. Here we're creating an equalizer function. Look, no maths! E% EP - imj Input fiklUIMi-iiiniEP MP-I ! [nput £010 Mg Wbourtgg Chrtjhir [V Output GflLO Output cn ■ Figure 7. Let's do some GPIO configuring in SigmaStudio. to E2PR0M". This will create an executable file that we can program into the EEPROM. Step 2. Programming the EEPROM Three possibilities exist— each is discussed below. Figure 8. Elektor's 'Sigma Studio a) Programming over the serial port using Serja | j 2 £ EEPROM the Elektor Sigma Studio Serial I 2 C EEPROM Pro- Programmer' utility in grammer utility (it's rather slow). See Figure 8. action. www.elektor-magazine.com | January & February 2014 ] 17 •Projects Creating a Burnable EEPROM File One of the first things you will need to get hold of is the somewhat hard-to-find method to capture the EEPROM text file generated by SigmaStudio and convert that to something you can burn. I have distilled the procedure from various posts on the SigmaDSP forums and it is presented here for ready reference. Step 1. Open the project file (.dspprog) in SigmaStudio, and navigate to the schematic page. Step 2. Click Hardware Configuration tab. Press F7 or menu item Action — Link Compile Download. (If the Analog Devices Eval Board is not connected you will get a message saying " Communication Failure " that may be respectfully ignored.) Step 3. Right click on the ADAU1701 box and choose "Write latest compilation to E2PROM." In the project folder (which contains the .dspproj file), look under the subfolder IC2 for the file E2Prom.hex. Step 4. Open E2Prom.hex in a text editor. Use search and replace to remove all and "Ox" and save the file. Step 5. Open the HxD hex editor. Click New, copy all of the contents of the modified E2PRom.hex file and paste it into HxD. Step 6. Use File-Export to export the file in one of the Intel Hex or Motorola S-Record formats listed. Burn the exported file into the EEPROM using your favorite EEPROM burner. • Connect a stereo audio source to ADCO and ADC1, and headphones or an amplifier to DACO and DAC1. • Connect the DTR, RTS & GND lines of a serial port to K12 using either a real RS-232 port or a USB-to-serial converter like the Elektor BOB. Note that depending on the type of port you use you may need to invert or not the RTS and DTR signals. Checkboxes to do this are pro- vided (default values are for Elektor BOB). • Place a jumper on JP1 • Power the DSP board • Launch the utility and open the file E2Prom. Hex that you created with SigmaStudio. A preview in Intel Hex format will be shown. You can also load a file in Intel Hex format if you have such a file • Select the serial port in the utility • Select the right EEPROM size and click the "Program EEPROM" button. Programming will start and may take several minutes depending on the size of the file. The slow- ness is due to the serial port driver. • To verify if all went well first click "Read EEPROM" (this will again take a while), then click "Verify". • If all went well, remove the jumper from JP1 and press the Reset pushbutton on the DSP board. Verify that you can adjust output vol- ume by turning P4. Note 1: This tool allows the conversion of an E2Prom.Hex file in proprietary Analog Devices format into a standard Intel Hex file that can be used with a commercial EEPROM program- mer. Use the button "Save as Intel Hex File" to do this. Note 2: This tool can also be used to read an EEPROM and save its contents as an Intel Hex file. To do so start the tool without loading a Hex file. Then click "Read EEPROM" (this will again take a while), followed by a click on the button "Save as Intel Hex File". By the way, it will read no more than 10,000 bytes as the maximum possible ADAU1701 program size is about 9,200 bytes. b) Use an Arduino board as a programmer (recommended). To speed up programming we wrote an Arduino Sketch that accepts a file in E2Prom format and that will program it into the EEPROM. To make things even better we added automatic control of jumper JP1 and the Reset pushbutton. Connector K9 allows you to connect the Arduino board. The default pinout is: Signal Arduino pin SDA 10 SCL 11 WP 12 Reset 13 GND GND The Sketch is of course available for download [5] (Dead Parrot not included). Use a serial port terminal program to send the E2Prom.Hex file to the Arduino board (option "Send file" in Tera Term). The baud rate is 19,200 baud. Faster rates will not work well. c) Use a dedicated EEPROM programmer. Refer to the manual of your programmer. You can use the Elektor utility mentioned under a) to create useable files. Connector K10 is available for direct connection to the EEPROM's I 2 C pins. Step 3: try the examples A few examples like a stereo chorus, short delay and a state variable filter with three outputs 18 | January & February 2014 www.elektor-magazine.com ADAU1701 DSP Board have been created and are contained in the free software archive [5]. That concludes the step-by-step programming. All EEPROM programming can be done with the DSP board powered. K12 is for the Elektor USB-serial BOB. This 7-pin connector employs all seven connections at the front side of the BOB where normally a 5-pin connector is mounted. Signals RTS and DTS required here are located in-line just beside the 5 connections, allowing a 7-pin connector to be fitted easily. The SigmaDSP Forum The art of writing exhaustive manuals and Help files has deteriorated in the Internet Age— today a product is pushed out well before its documen- tation is complete. SigmaStudio is no exception, and there is lots of essential programming infor- mation that is unfortunately not in the Help files. To make full use of the platform you need to refer to the Analog Devices EngineerZone SigmaDSP forum [7] and look at the I see's and a/?a's that people have posted there. Needless to say there is a high probability you will end up registering and posting questions (and answers) there. For issues specifically related to this publication you're also more than welcome at the Elektor Forum. ( 130232 ) Internet References [1] Voti 48-pin LQFP adapter board: www.voti.nl/winkel/catalog.html [2] Dipmicro 48-pin LQFP adapter board: www.dipmicro.com/store/ PCB-LQFP48-DIP48B [3] Proto Advantage 48-pin LQFP adapter board: www.proto-advantage.com/store/product_ info. php?products_id =2200109 [4] Schmartboard 48-pin LQFP adapter board: www.schmartboard.com/index. asp?page=products_smttodip&id=451 [5] www.elektor-magazine.com/1 30232 [6] Sigma Studio: www.analog.com/en/dsp-software/ ss_sigst_02/sw.html [7] SigmaDSP Forum: ez. analog.com/community/dsp/sigmadsp Features • Analog Devices ADAU1701 DSP • Sigma Studio 3.9 graphic oriented DSP support software (free) • Examples for stereo chorus; short delay; state-variable filter • Design your own sound effects • Stereo audio input • 4 DAC outputs • 4 pots feeding into aux ADC inputs • 8 GPIO pins • I 2 C EEPROM for effects storage • DSP chip preassembled on PCB • Optional: DSP chip on 48-pin DIP carrier board (0.6 inch or 0.7 inch) • Semi-kit available from Elektor (SMD presoldered PCB and TH parts) www.elektor-magazine.com | January & February 2014 ( 19 •Projects ■ UltiProp Clock (2) Part 2 By David Ardouin (France) ardouin.david.projects@gmail.com fj? CL The first installment didn't tell you everything— far from it. Lots of readers intrigued by this proj- ect have been wondering about its principle and how it works. For example, what about the opposing magnetic fields around the trans- former and motor? Several readers thought that the torque produced by the transformer field would oppose the rotation of the motor... In point of fact, this field is perpendicu- lar to the transformer windings, and hence coaxial with the axis of rotation. Thus turn- ing the secondary about this axis has no effect on the current induced and doesn't gener- ate any mechani- cal torque either. In theory, there might be a force coaxial with the motor shaft, but it must be negli- gible... I did how- ever have a doubt about the possible effect of this field on the Hall-effect ffl ov ffl Cra ■Wl \( ^ ml sensor in the motor, but on thinking about it, this is not very likely, as the sensor detects variations in the radial field, i.e. orthogonal to that created by the transformer. Do you have any other questions? Ask away! The answers may provide material for a third installment. In the meantime, the purpose of this one is to describe how to put the clock together. Assembly and set-up The construction of the two boards (Figure 10) takes care and even dexterity; don't attempt it if you have never worked with 0805 for- mat SMD devices before. Practice on simpler circuits first, and while waiting to have gained enough experience, you'll do better to buy the assembled, ready- to-use modules on offer from our ElektorPCBservice . After you've separated the different PCBs, take care to clean up the edges using a fine flat file. Certain parts have a purely mechanical function: the three washers that will be used to space the propel- ler away from the motor body to which it will be glued, and the two crescent-shaped feet. Note: the numbering of the illustration continues from the first article 20 | January & February 2014 www.elektor-magazine.com Ultiprop Clock Figure 10a. Clock PCB. In theory it's not necessary, but the rectangular lands at the ends of the propeller can be loaded with solder if necessary to correct any imbalance problems. For soldering the fine-pitched integrated circuits, I first lay down a bed of solder short-circuiting across all the pins using a large-diameter bit. Then, using desolder braid, I remove the excess solder to eliminate all the bridges between the pins, leaving only the strict necessary to make the contact between the pins and the copper. ICs U5 and U8 have a solder pad on their underside. Solder their eight pins as normal, then solder the bottom pad from underneath by way of the hole in the PCB. If you are paying attention, you'll notice that on the PDF of the PCB this hole seems to be only 0.5 mm. Don't worry, on the circuit supplied by ElektorPCBservice, its diameter is Figure 10b. This version of the board didn't yet have the 3 spacer disks (see Figures 10a & 13a). www.elektor-magazine.com | January & February 2014 | 21 •Projects Figure 11a. Setting the fuses for the Base Unit ATmega328. Fuses Extended OxFC Brown-Out activated @ 4.3 V High 0xD9 External 20 MHz oscillator, maximum start-up time Low OxFF Figure lib. Setting the fuses for the Propeller ATmega328. Fuses Extended OxFD Brown-Out activated @ 2.7 V High 0xD9 External 20 MHz oscillator, maximum start-up time Low OxFF indeed 3 mm, which will allow you to solder the component from below. Don't be afraid to fill the hole with solder to improve the thermal transfer. On the propeller, the alignment of the 50 diodes and the symmetry of the two blades must be perfect. When spinning, the tiniest error will be visible in the image produced. If you have read the first article properly, you'll also understand the importance of perfect symmetry between the rows of LEDs on the two halves of the propeller. You'll notice on the photos of the prototype that diode D65 is fitted with a sleeve in black heat- shrink sleeving, in order to obtain as narrow a light beam as possible, in order to ensure a clear- cut signal as the propeller passes. The microcontrollers are programmed via an ISP link using the software supplied [2]. Watch out for the fuse settings (Figures 11a &b), which are different between the two devices: on the pro- peller, the brown-out detection is configured to 2.7 V to guard against voltage dips when there is a high current demand, which is inevitable with the way this part is powered. Self-diagnosis Before (!) moving on to the mechanical assembly and even before winding the transformer, you can check that the two boards work properly on your workbench, first independently and then making them communicate (even without the propeller spinning). First off, on the base, keep SI pressed while powering up. The test diode D67 will then flash at 2 Hz, indicating that test sequences are being sent over the infrared data link: look closely, and you should see a red- dish glow in D65. At the same time, the motor (which you will have hooked up temporarily) is Figure 12. Cross-sectional view of the assembly. Power Supply 22 | January & February 2014 www.elektor-magazine.com Ultiprop Clock activated and should run at full speed; the volt- age for the transformer is also present. Using an oscilloscope and temporary 1-10 kft resistors connected between pins 1-2 and 2-3 on J4, you will be able to observe the 50 kHz square-wave drive signal with an amplitude of 9 V. Let's now test the propeller independently of its base. Power it via a 9 V battery on J1 (the polar- ity doesn't matter). The two LEDs closest to the center ought to light at once. If you now pass Q1 or Q2 in front of the infrared diode D65 on the base unit, a third LED lights indicating correct reception of the positioning signal. If you obtain this result, your propeller is ready for use. Bring the central part of the propeller closer to the base, directing U7 towards the ring formed by D54-D62. The propeller circuit confirms the reception of the data sequences by lighting in turn the fifty diodes on the two blades. You can't find U7? Look under the propeller... Were these tests satisfactory? Well let's move on to the assembly then! Mechanical The biggest step in the mechanical construction consists in modifying an 80 mm fan, common in computers, keeping only the motor itself, and winding the transformer onto it. To avoid hav- ing to go into the details of this operation here, I've prepared a document [1] that I invite you to read: it explains everything step by step in detail with pictures. Follow these instructions to the letter and you will obtain without any trouble (but with some patience) the vital transformer. The cross-sectional view of the top (Figure 12) and the photo (Figure 13) give an idea of the assembly of this spinning team. The primary, wound on the outside, is fixed to the base and so doesn't move. The motor stator is also glued to the base. The secondary, with a slightly smaller diameter, is positioned in the center of the primary and Figure 13. Close ups of the transformer after winding (a), then separated (b) and lastly assembled (c). In (a) we can make out the strip of card which was used during winding to maintain a space between the primary and secondary windings, as well as in (c) the two green disk spacers that space the propeller away from the motor to which it is glued. www.elektor-magazine.com | January & February 2014 | 23 •Projects Figure 14. Using the Apple remote-control. glued around the fan motor. So it turns with the propeller, which is itself glued to the motor hub. To keep the turns in place while winding the transformer, you'll need to insert between the layers of copper wire a good (!) thin, double-sided adhesive tape, then add instant glue as you go along to keep the turns finally in place. The two crescent-shaped pieces are the feet, to be fitted by soldering. Fitted perpendicular to the base unit PCB, they will support your clock if it is placed on a flat surface. Don't solder them till everything else is finished. If you prefer, the hole at the top of the base unit will let you hang your clock on a small nail on the wall or any other appropriate support. You can thread the power cable through the hook- shaped notch made for this purpose at the foot of the base unit. This cable mustn't get tangled up with the propeller! We also draw your attention to the mechanical fragility of certain components, in particular at the ends of the blades (Q1 and Q2); when the propeller turns at full speed, you must avoid these components hitting an obstacle. The clock's not slow There's ventilation in the air! If you have checked the operation of your two boards, in a few sec- onds and in a gentle waft of air you're going to discover the magic of your UltiProp Clock. All that is missing is a power supply between 10-14 V DC, capable of supplying at least 250 mA at cruising speed. When power is applied, the variables and peripherals are initialized, then the motor and transformer start up. On the propeller side, D1 and D26 light constantly to confirm the presence of the supply. A few moments later, LED D65 is lit in turn, to bring the display to life. The time is then shown in the top half, and a welcome message scrolls. Once started, the clock can be controlled by either the remote-control (Figure 14) [3] or the rotary encoder. Press this button to put the system into stand-by, or to wake it up. Turn it to the right or left to scroll at will through several tens of display modes, with various combinations of colors and representation of the clock-face and the hands, Co m ponent List Resistors SMD 0805, 5% R1-R5,R23,R30 = 47kft R6,R7,R16,R22,R26,R27,R31,R32,R36,R37 = 4.7kft R8-R12,R24 = 22kft R13,R14,R15,R17,R19,R21,R29 = 100ft R25,R34 = 1.5kft R28 = 330ft R33,R35 = lOkft R38 = lMft SMD 1206, 5% R39 = 10ft R40 = 0.1ft Capacitors Ceramic, SMD 0805, 20% C1,C2,C5,C6,C12,C13,C20,C21,C24,C25,C27 ,C34 = lOOnF 50V C9,C16,C30 = lOnF 50V C22,C23,C26,C28,C29,C35 = IjjF 10V C37 = InF 50V C38-C41 = 33pF 10V Ceramic, SMD 1206, 20% C3,C4,C7,C8,C10,C17 = 22pF 10V C11,C18,C19,C43 = 1 (jF 50V C14,C15 = lOpF 16V Miscellaneous C31,C32 = lOOpF 16V, Vishay 593D C33 = 47pF 25 V, Vishay 593D C36 = 0.1F 5.5V, Panasonic EECF5R5U104 (9692703) Inductors L1,L3 = 68|jH 0.84 A, Bourns SDR0604-680KL (1828011) L2 = 220|jH 0,38 A, Bourns SDR0604-221KL (1828016) L4 = ImH 0.12A, Bourns SDR0604-102KL (1828020) L5 = 33|jH 3A, Wurth 744771133 (2082608) Semiconductors D1-D50 = LED, bicolor, PLCC4, choose your color, e.g. Vishay VLMKE3400-GS08 (1328370) D51,D52,D53,D63,D66,D68,D69 = MBRS140T3G, ON Semiconductor (9557237) D54-D62 = SFH421-Z, infrared LED, Osram (1226346) 24 | January & February 2014 www.elektor-magazine.com Ultiprop Clock with or without the seconds displayed, as well as the date and ambient temperature, and the choice between analog or digital display. Once you have made your choice, don't touch anything for ten seconds and this mode will be saved into non-volatile memory so it can be restored next time the unit is turned on. Press the encoder for more than two seconds to enter the con- figuration menu and set the time, date, choice of language, rotational speed in day and night modes, and the brightness, etc. You can navi- gate through this menu by short presses to select the required parameter and then by rotating to adjust the value. Internet Links [1] 120732 - UltiProp Clock Assembly.pdf [2] Downloadable software, including source code: www.elektor-magazine. com/1 20732 [3] Remote control for Apple Universal Dock: http://store.apple.eom/en/product/MC746ZA/A/ apple-universal-dock Choosing zero speed in night mode allows the unit to go into stand-by and wake up again auto- matically according to the ambient light in the room, ideal if the project is fitted in a bedroom. This option is handy, but it can catch you out. If by chance your clock refuses to start up, this may be because there's not enough light and it thinks you are sleeping. So before you start looking for a fault, do make sure the surroundings are bright enough. Next time you adjust the parameters, remember to raise the stand-by threshold a little. This is where our electronic clock adventure together ends. Over to you now to get stuck in. I hope this project will give you as much plea- sure as I have derived from developing it, and that lots of you will come and share your expe- riences and enthusiasm in the Microcontrollers & Embedded area on the Elektor forum. (130389) D64 = BAT54 D65 = VSLY5850, infrared LED, Vishay (1870807) D67 = LED, orange, PLCC2 D70, D71 = SMBJ48A (1899472) Ql, Q2 = TEMT1020, phototransistor, Vishay (1470165) Q3, Q4, Q7 = BC847B Q5, Q6, Q8 = IRLML0060, transistor, Interna- tional Rectifier (1783927) U1 a U4 = MAX6957AAX, Maxim [Digikey # MAX6957AAX+T-ND] U5, U8 = LM22674M-5.0 (1679666) U6, U10 = Atmega328P-AU (1715486) U7 = SFH2400FA-Z, photodiode, Osram (1226452) U9 = LM2670SD-ADJ (1286849) U12 = DS3231S, Maxim (1593292) U13 = TSOP6238, 38kHz infrared receiver, Vi- shay (4913220) U14, Ull = TC4427EOA, Microchip (9762647) Miscellaneous Y1,Y2 = 20MHz quartz crystal, TXC 7B-20.000MAAJ-T (1841988) SI = PEC11-4215F-S0024 rotary encoder, Bourns (1653380) R41 = VT935G, photo resistor, Excelias Tech. (1652638) J2, J3 = 6-pin pinheader (2x3), 0.1" pitch J4 = 3-pin pinheader, 0.1" pitch J5 = mini-jack socket, 2.1mm, Cliff DC10AS (1889309) J6 = ventilator, 80mm, 2000-3000 rpm TR1 = transformer with two concentric wind- ings [1] Enameled wire, 0.56mm diam. (23 AWG), ap- prox. 25m (75 ft.) Instant glue and double sided adhesive tape (see construction manual [1]) PCB nos. 120732-1 through -7 Numbers only in parentheses () are Farnell/Newark/elementl4 order codes www.elektor-magazine.com | January & February 2014 | 25 •Projects Compact Tube Amplifier Using ordinary power transformers By Michiel Ter Burg (Netherlands) Many audiophiles have occasionally thought about building a tube amplifier, but they are deterred by the high cost, large enclosure, hefty transformers and complicated wiring harnesses. For all the people in this group, the author has developed a compact, low-cost option using readily available compo- nents, so that everyone can enjoy the warm sound of a tube am- plifier in their living room or den. To obtain a wide hi-fi bandwidth and an output power of 10 watts or more, you usually need big transformers for the power supply and driving the loudspeakers. However, in practice it doesn't take a lot of power to achieve a good sound level in an average living room with a pair of reason- ably efficient loudspeakers. With regard to the frequency range, most music has virtually noth- ing the low bass range (below 50 Hz) or the high treble range (above 12 kHz), so you can achieve savings there as well. This means that if you are willing to relax your requirements a bit, it is possible to build a small tube amplifier with a few watts of output power per channel using ordinary PCB-mount power transformers as the output transformers. The other components are also readily available, for example from mail order companies, and not expensive. The tube used here is a PCL86 (near- est US equivalent: 14GW8), a reasonably modern audio tube (dating from 1961) that combines a preamp triode rated at 0.5 W with a power pen- tode rated at 9 W. The design uses two of these tubes, with the triodes wired as a phase splitter and the pentodes operating in a conventional push-pull configuration. The lower limit of the bandwidth is really deter- mined by the primary inductances of the trans- formers, while the upper limit is determined by the coupling factor of the output transformer. The coupling factor K is very low with this sort of transformer because the primary and second- ary windings are in separate sections to meet an insulation voltage spec of 5 kV. 26 | January & February 2014 www.elektor-magazine.com Compact Tube Amplifier The input transformer used here (originally intended for a light organ) results in a fairly low input imped- ance of approximately 1 kft, which is necessary to obtain a reasonable open-loop bandwidth. This should not cause a problem if the input signal comes from a good preamp or the headphone output of a computer, MP3 player or similar source. Schematic Figure 1 shows the schematic diagram of the amplifier. The audio input signal on connector K1 is fed to input transformer TR2. The secondary of this transformer drives the two triode sections of the tubes in opposite phase via resistors R8 and R12. The anodes of the pentode sections of tubes VI and V2 are connected to the primary winding of transformer TR1 (an encapsulated PCB-mount power transformer), which is recast as an output transformer here. The output signals from the tri- odes are fed to the control grids of the pentodes via networks C3/R3 and C5/R16. The two second- ary windings of TR1 drive the loudspeaker. You can fit jumpers on JP1 to connect these windings in series or in parallel. JP2 and R26 provide the negative feedback path from the output to the input. You can experiment with different values for R26, or you can disable negative feedback entirely by removing the jumper on JP2. A jumper can be fitted on JP3 to connect the input ground to the loudspeaker output. Trimpot P2 sets the quiescent current of the tubes. It adjusts the negative bias on the con- trol grids of the pentodes, which is derived from the negative filament voltage V ff . PI adjusts the balance between the two tubes. Header K3 allows the quiescent currents of the two tubes to be measured individually using a voltmeter. The scale ratio is 10 volts per ampere, so with a current of 25 mA (the recommended value) the reading is 250 mV. You should let the tubes warm up properly before setting the qui- escent current. All the filaments are connected in series, and the filament current should be 300 mA. To prevent excessive filament current at switch-on (inrush current) due to the low cold resistance of the filaments, a simple current source built around an LM337 is included on the circuit board. A sim- ple negative voltage supply with an output of at least 31 V is all you need for the filament current. +Va Figure 1. This simple tube amplifier is built around a pair of PCL86 (14GW8) tubes. www.elektor-magazine.com | January & February 2014 | 27 •Projects The allowable range of the anode supply voltage \/ a is 160 V DC to 200 V DC . A suitable power supply for the amplifier is described below. PCB design Elektor Labs designed a double-sided PCB layout for the tube amplifier. The PCB design is posted at [1]. The board has a large ground plane on one side to shield the mostly high-impedance com- ponents on the other side, with extra-wide iso- lation on account of the high anode voltage. The input transformer is located as far away from the output transformer as possible to minimize the magnetic coupling between the two transformers. Figure 2. The PCB layout for a single amplifier channel; two of these must be assembled for a stereo amplifier. Component List Amplifier Resistors (1%, .6W, 350V): R1,R3,R6,R8,R9,R11,R12,R15,R16,R19,R25 = lkft R2,R14 = lOOkft R4,R17 = 680kft R5,R18 = 10ft R7,R13 = 47ft R10 = 220ft R20,R21 = 47kft R22 = 2.7kft R23 = 470ft R24 = lOkft R26 = 4.7kft R27,R28 = 8.2ft PI = lOkft trimpot, 0.15W, horizontal mounting P2 = lkft trimpot, 0.15W, horizontal mounting Capacitors C1,C3,C5 = lOOnF 250V, 5%, MKP, 5, 7.5, 10, 15 or 22.5mm pitch C2,C8 = lOOnF 100V, 10%, MKT, 5 or 7.5mm pitch C4 = 47nF 250V, 10%, MKP, 5, 7.5 or 10 mm C6 = lOpF 100V, radial, 2.5mm pitch, 6.3mm diam. C7 = lOpF 250V, radial, 5mm pitch, 10 mm diam. Semiconductors D1 = 1N4007 IC1 = LM337 Tubes VI, V2 = PCL86 or 14GW8 Miscellaneous TR1 = power transformer, Block type FL 14/6, 2x1 15V primaries; 2x6 V secondaries; 14 VA TR2 = 1:5 audio transformer, e.g. LTEI19/KD-0703 (Conrad Electronics # 515701-89) K1,K5,JP2,JP3 = 2-pin pinheader, 0.1" pitch K2,K4 = 2-way PCB screw terminal block, 5mm pitch K3 = 2-way PCB screw terminal block, 7.5mm pitch JP1 = 4-pin pinheader, 0.1" pitch 3 or 4 jumpers for JP1, JP2, JP3 VI, V2 = tube socket, ceramic, 9-pin Noval, PCB mount Heatsink for IC1, 30K/W (e.g. Fischer Elektronik SK 12 SA 32) PCB # 130385-1, see [1] Power Supply K4K2 00 JPl^. PSP prvv , Y ,, '| pry^YV^ 130385-1 vl.l ©ELEKTOR Resistors R1 = 270kft, .5W, 350V R2 = lOkft, .25W, 250V Capacitors C1-C4 = 4.7nF 400V C2-C8 = 47nF 100V ceramic C9 = lOOpF 350V C10,C11 = lOOOpF 50V Semiconductors D1-D4 = 1N4007 D5-D8 = 1N5819 D9,D10 = LED, low-current Miscellaneous FI = fuse, 200mA/T (115VAC: 400mA/T) with holder F2 = fuse, 750mA/T with holder K1,K2 = 2-way PCB screw terminal block, 7.5mm pitch K3 = 2-way PCB screw terminal block, 5mm pitch TR1 = power transformer, Block type FL 30/12, 2x115V primaries; 2x12V second- aries, 30VA TR2 = power transformer, Block type FL 18/12, 2x115V primaries; 2x12V second- aries, 18 VA 28 | January & February 2014 www.elektor-magazine.com Compact Tube Amplifier To keep the PCB as compact as possible, several tracks are routed underneath the input trans- former. As a consequence, this amplifier must never be powered directly from the rectified AC line voltage. The photos clearly show how everything should be mounted. All of the components are normal leaded types. PCB screw terminal blocks are used for the supply and loudspeaker connections. Due to the high anode voltage, a terminal block with a lead spacing of 7.5 mm is used for K3. A heat sink is fitted on the LM337 regulator. The size depends on the level of the supply voltage; the temperature rise should preferably be kept below 40 degrees. After assembling the circuit board, you should immediately fit several jumpers before connect- ing the supply voltages. First fit a jumper on JP2 (negative feedback) and JP3 (ground connection between input and output). You can use pinheader JP1 to select either series or parallel connection of the two secondary windings. Fit two jumpers to connect them in parallel, or fit one jumper in middle of JP1 for to connect them in series. Power supply There are various ways to implement the power supply for the tube amplifier. For the prototype, the author built an external switch-mode supply with a transformer for galvanic isolation from the AC line. The guys at Elektor Labs opted for another approach with a power supply using two PCB-mount power transformers with their sec- ondary windings connected back to back. This results in good galvanic isolation from the AC line without the need for a transformer that may be hard to obtain. It also allows the filament volt- age to be derived from the secondary voltage of the first transformer by means of bridge rectifier D5-D8, filter capacitors C10/C11 and associated components. This is why the first transformer is a 30-watt type and the other, an 18-watt type. If you are on a 115 V grid fit jumpers JP1 and JP3, and a 400 mA slow-blow fuse for FI. The high voltage at the output of TR2 will not be the targeted 230 volts, but instead lower because the data sheet says that the no-load voltage of TR2 is 1.22 times higher than the nominal voltage. The actual voltage is therefore 188.5 V (230/1.22). This will drop by an additional factor of 1.22 under load, so we end up with a plate voltage in the vicinity of 154 V. As PCB transformers of this sort are not designed to be used backwards, large losses will occur when the filter capaci- tors are being charged by short current spikes. In our test setup, the measured voltage with no input signal was slightly more than 188 V DC , dropping by ten volts or so at maximum output power. Pay attention to the voltage ratings of the various capacitors in the amplifier circuit. With a higher supply voltage, it is advisable to use 350-V types instead. For both supply voltages there is an LED indica- tor that shows whether the voltage is present. The LED for the high voltage supply also forms a Figure 3. A suitable power supply configuration for the amplifier. Here two power transformers are connected "back to back" FI www.elektor-magazine.com | January & February 2014 | 29 •Projects +12 +9 +6 +3 +0 -3 d 41 B -9 12 15 18 21 24 27 30 33 B A Few Measurements Plot A shows the total harmonic distortion plus noise versus frequency at an output power of 1 watt into 8 ft at 1 kHz. The two secondary windings are connected in parallel, and feedback jumpers JP2 and JP3 are fitted. This clearly shows the effect of the inferior characteristics of a power transformer in comparison to a real output transformer. Plot B shows the frequency characteristic of the amplifier at 1 watt into 8 ohms. The two secondary windings are connected in parallel. The curve with the larger bandwidth was measured with negative feedback (input level 850 mV); the other curve was measured without negative feedback (input level 235 mV). For comparison, the two curves were normalized at 1 kHz. j Ap) ; j ; : j : j y / : : j ; j 500 Ik Hz 10k 20k 130385- 13B Plot C shows the total harmonic distortion plus noise versus output power with an 8 -ft load. The two secondary windings are connected in parallel. The green curve is with negative feedback, and the blue curve is without. Plot D shows the Fourier spectrum of a 1 kHz signal with 1 W into 8 ft and the secondary windings connected in parallel. The total harmonic distortion plus noise is 0.4%. Along with the two harmonics of the 1 kHz signal, a broad noise spectrum can be seen. It is caused by the ripple on the supply voltage. +0 -10 -20 -30 40 -50 -60 d B -70 r -80 A -90 -100 -110 -120 -130 -140 -150 -£> 5k 10k 20k 50k 100k 130385-1 3D Measured Performance Input sensitivity (parallel connection with negative feedback): 1.7 V (P max = 3.1 W) (series connection with negative feedback): 1-3 V (P max = 1.04 W) Input impedance at 1 kHz: 1.01 kft Continuous output power (parallel connection): > 3 W (series connection): approx. 1 W Power bandwidth (parallel connection with negative feedback): 28 Hz - 6.2 kHz max. 12 kHz at 0.1 W (series connection with negative feedback): 46 Hz - 4.8 kHz S/N ratio at 1 W / 8 ft (parallel connection with negative feedback): > 64 dB (> 72 dBA) THD + noise at 1 W / 8 ft (parallel connection with negative feedback): 0.4% (series connection with negative feedback): 5% Damping factor at 1 W / 8 ft (parallel connection with negative feedback): 2.75 (series connection with negative feedback): 1.25 Current consumption on high voltage rail with parallel connection: 52 mA (quiescent; \/ a = 188 V) 59 mA (P = 3 W, V a = 181 V) 30 | January & February 2014 www.elektor-magazine.com Compact Tube Amplifier load for the supply, to prevent the voltage from rising too high right after switch-on when the tubes are not yet drawing any current. If you wish, you can experiment with a somewhat higher supply voltage and different settings for the tubes. The author managed to achieve an output power of about 10 watts (at 10% THD) with the prototype, using a beefier power sup- ply with an anode voltage of 200 V and a higher quiescent current. Putting it all together After you have assembled the amplifier board and the power supply, you can adjust the quiescent current and the balance after letting the tubes warm up for a while. As already mentioned, you can start with a quiescent current of 25 mA per tube (250 mV on K5) and adjust the balance so that the currents through the two tubes are exactly the same. Then you're ready to start listening to the ampli- fier. The author obtained the best results with the two output windings connected in parallel and a 4.7-kft resistor in the feedback path, as indicated on the schematic. With various speakers (either box enclosure or panel type, and regardless of the impedance) it sounds like what you would expect from a tube amplifier: good detailing at low volume and smooth overdriving at high signal levels. Although the measured bandwidth at full power may be somewhat disappointing, in practical listening situations you don't miss anything because the bandwidth is fairly large at lower output levels, extending to above 10 kHz. ( 130385 - 1 ) Internet Link [1] www.elektor-magazine.com/130385 Advertisement Elektor RF & Microwave Toolbox A for Android The RF & Microwave Toolbox contains 55 calculation and conversion tools for RF, microwave and electronics in general. Whether you are an RF professional, radio-amateur, astronomer or hobbyist, this app puts some of the most impor tant tools right at your fingertips. Literally! Highlights: • Amplifier cascade (NF, Gain, Pldb, 0IP2.0IP3) • Field intensity and power density converter (W/m2, V/m, A/m, Tesla, Gauss, dBm, W) • PCB Trace calculator (impedance/dimensions) • PI and T attenuator • Antenna temperature (Kelvin) • EMC (EIRP, ERP, dBpV/m) • Filter Design (Butterworth, Chebyshev, prototype) • And much more Further information at www.elektor.com/rf-app ^ Google p Fay MaxBotix High Performance Ultrasonic Rangefinders Phone tt: 218-454-0766 Email: sales@maxbotix.com www.elektor-magazine.com | January & February 2014 | 31 N-f-. -i — r“ i DESIGNSPARK PCB Pretty Accurate Digital Wall Clock .000202943 % slow or fast max. By Niras C.V. The crucial component in this project is a Maxim IC type DS3231, qualified by Ind ' a its manufacturer as an "extremely accurate I 2 C real time clock (RTC) with inte- grated temperature compensated crystal oscillator (TCXO) and crystal." Maxim also says that the integration of the crystal resonator enhances the long-term accuracy of the device, guaranteeing a maximum error of less than 64 seconds over a year, and over a temperature range 0 to 40 °C (32 to 104 °F). The de- vice incorporates a battery input which maintains running of the device in the absence of external power. Circuit description Hyper-accurate as it may be, the DS3231 is unable to do anything useful without the help of a few other components. Referring to the sche- matic in Figure 1 , A PIC16F876A microcontrol- Features • PIC16F876A controlled • Maxim DS3231SN RTC chip • 1.5 inch red 7-segment LED displays • Max. error 64 seconds per year • Optional IR remote control • 9V @ 500 mA max. power supply (DC adapter) • Free C source code • Free DesignSpark PCB files ler (IC4) is used to interface to the RTC (IC3) as well as drive a bunch of 7-segment LED displays (discussed further on). The microcontroller has an I 2 C port which makes for easy interfacing to the DS3231 RTC. The microcontroller clock operates at 20 MHz due to quartz crystal XI and its two load capacitors Cl and C2, not forgetting the appropriate con- trol word in the microcontroller "config settings". Port lines RA0-RA3, RA5 and RC1 of the PIC micro switch individual LED displays on and off through drivers/level changers T10-T21. Note the use of an npn/pnp transistor pair on each line to handle (1) the level conversion from 5-V swing (PIC side) to 9-V swing (display side), and (2) feeding current from the 9-V rail to each dis- play via its CA (common anode) terminal under multiplex control. 32 | January & February 2014 | www.elektor-magazine.com Wall Clock BT1 £ 3.0V 5 K1 1 2 +5V © 1 14 C3 lOOn 2 VCC VBAT INT/SQW IC3 32KHZ SCL RST SDA DS3231SN NC NC NC NC NC NC NC NC Gh ID +9V © 16 15 R17 R18 R19 R39 21 14 15 17 10 11 12 13 LM7805CT C8 470u 16V IC1 C6 lOOn +5V © C7 lOOn C9 470u 16V +9V ©■ 18 12 R37 20 1 K JS I ^«0n I— VDD MCLR/VPP RC2/CCP1 IC4 RBI RBO/INT RB2 RB3/PGM RC3/SCK/SCL RB4 RC4/SDI/SDA RB5 RC6/TX/CK RB6/PGC RC7/RX/DT RB7/PGD PIC16F876A Rrn -l/SP RCI/TIOSI/CCP RC5/SDO RA5/AN4/SS RAO/ANO RA4/T0CKI RA1/AN1 RA3/AN3 RA2/AN2 VSS OSC1 OSC2 VSS C2 22p XI I I 20MHz. 10 13 R41 22 23 24 25 26 27 28 11 16 19 Cl 22p R34 R31 R16 -| 680R R14 T7 R7 680R R13 Tfi R6 680R R12 — | 680R T5 R5 R11 H 680R RIO 680R R9 -| 680R R8 680R R1 5 27R |- BC548 BC548 BC548 BC548 T4 _ - _ R4 -O-0E] BC548 J3 .-I R3 BC548 T2 R2 -Q-cki — 1 BC548 T1 i— i R1 BC548 R28 R25 R22 *K2) J H of the displays LD2-LD5 are connected together and brought out to pins on K4. Displays LD3 and LD5 are mounted upside down on the board (note the dots!) to create an oblique colon (:) between hours and minutes, and minutes and seconds. The PCB design takes care of this. The LED dis- plays are multiplexed through their common-an- ode (CA) terminals, brought out to pins on K5 connecting to K3 on the microcontroller board. Pushbuttons SI and S2 for controlling the clock functions are connected to the microcontroller also by way of K4 on the display board connect- ing straight to K2 on the microcontroller board. The display brightness can be adjusted as a user setting stored in the PIC micro. This function may be implemented using the flag 'DisplayOn' in the code. Finally, on the display board, a bicolor LED (D2) is used to indicate AM (green) or PM (red if the clock operates in 12 hour mode. Infrared remote control: software ramifications The TSOP3 1 238 in position IC2 on the dis- play board is an infra-red receiver IC responding to 38 kHz signals from an RC5 (or compatible) IR remote control. LED D1 and its driver circuit form an infrared transmitter. An Infrared 'send' function was originally not implemented, hence if you do not need it, D1 and associated parts may be omitted. As the Wall Clock project progressed, changes were made to the source code, as follows: • Xtal changed to 20 MHz enabling the PIC to execute RC5 protocol section without any hiccups in the original code. • RC5 protocol section implemented in the 34 | January & February 2014 | www.elektor-magazine.com Wall Clock interrupt routine, microcontroller now scans port pin RC7 status; checks received signal against RC5 protocol. • In the main section: addresses and com- mands get extracted from the received RC5 data. • If the command received is 16 or 17 (address and all other commands except 16 & 17 ignored) the program takes it as but- tons SI or S2 being pushed, respectively. • Implemented Watchdog functionality in-or- der to avoid any uncertainty in the program. With IR reception implemented you can control the clock from a distance wielding your (RC5 compatible) remote. Don't tell the kids! Real Time Clock (RTC) type DS3231 The DS3231 is a serial RTC driven by a tem- perature compensated 32-kHz crystal oscillator (TCXO), and provides a stable and accurate ref- erence clock. The temperature sensor, oscillator, and control logic form the TCXO. The control logic reads the output of the on-chip temperature sen- sor and uses a lookup table to On first power up the PIC microcontroller initial- izes the RTC to generate a 1-Hz square wave at the INT/SQW pin by writing 0x00 to the RTC's control register. This is connected to the external interrupt (INT) of the microcontroller, effectively setting the PIC's INTF flag on each High-to-Low transition at RBO/INT. This is used to initiate a reading of the RTC's time registers. A 1-Hz (i.e. 1-second) flashing colon can also be derived from polling the status of RBO/INT. Construction In terms of hardware the clock is divided into two sub-circuits: microcontroller/driver and display. Each is built on its own circuit board of which the component overlays are shown in Figure 3. Excepting the RTC, the entire design is imple- mented in old skool through-hole (TH) parts so should be easy to build if you apply care and pre- cision in reading and soldering. Here are just two mistakes Elektor tech staff in their 35 hex years of publishing on electron- ics have heard K2 on the microcontroller board is linked to K4 on the display board through a 14-way SIL pinheader bcLb uic i~a|jai». tance selection registers. The AGE function is not used in this project— use of the aging register is not needed to achieve the given accuracy. With the clock source, the RTC provides seconds, min- utes, hours, day, date, month, and year infor- mation, all accessible through the I2C bus. The device monitors its VCC level to detect power failures and to automatically switch to the backup supply when necessary. cLcpidLlc. ie same for K3 on the micro- controller board and K5 on the display board. These connections allow the display board to be stacked on top of the microcontroller board. Operation The circuit has only two pushbuttons to perform user control and adjustments. Press SI for 1 sec- ond to take the circuit into time adjusting mode. Blinking digits means they're open to having the www.elektor-magazine.com | January & February 2014 | 35 DESIGNSPARK PCB COMPONENT LIST Combined for microcontroller board, display board Resistors (5%, 0.25W) R1 = 82ft R2-R7,R15 = 27ft R8-R14,R16,R22,R25,R28,R31,R34,R37 = 680ft R17,R18,R19,R39,R40,R41 = lOkft R20,R23,R26,R29,R32,R35 = lOOkft R21,R24,R27,R30,R33,R36 = 150ft R38 = 47ft R42-R45 = lkft Capacitors C1,C2 = 22pF ceramic C3-C7,C10,C11 = lOOnF C8,C9 = 470 |jF 16V radial Semiconductors D1 = LED, red, 5mm D2 = LED, bicolor, e.g. Kingbright L-93WEGW IC1 = LM7805CT IC2 = TSOP31238 (Vishay Semiconductor) IC3 = DS3231SN (Maxim Integrated Products) IC4 = PIC16F876A-I/SP, programmed, Elek- ”D "0 "D T 'D "0 "0 "0 "0 R 1 1 R 1 2 R 1 3 ELEKTOR (C) 1 1 0 167- I 1 1 c« VER 1 . • H h* R “ • -j f- • R 16 iDDO R19 C5 R41 R 1 7 R 1 8 Figure 3. Separate printed circuit boards were designed for the microcontroller display sections, both using DesignSpark PCB. Boards shown at XX per cent of actual size. The display board accommodates Kingbright 1.5-inch (38 mm) SA15-11SRWA 7-segment displays. tor Store # 110167-41 LD1-LD6 = SA15-11SRWA 7-segment dis- play, CA (Kingbright) T1-T15 = BC548 T16-T21 = BC327 Miscellaneous BT1 = 3V Lithium button cell with holder. K1 = 2-pin PCB screw terminal block, 0.2" pitch. K2/K4, K3/K5 = 14 pin SIL connector pair (pinheader and receptacle). S1,S2 = pushbutton, PCB mount, tactile feedback, e.g. Alps SKHHALA010. XI = 20MHz quartz crystal. PCB # 110167-1 (microcontroller board). PCB # 110167-2 (display board). displayed value changed by you, the user. Digits can be selected individually by a short press of SI— from seconds, through minutes, hours, 24/12 hour selection, to exit. Pressing S2 increments the selected digit to its highest value then rolls over, except for the 'seconds' digits, these will be changed to zero. Also, if the seconds exceed 30, the minutes' digits will increment by one. Press- ing S2 ('up') with the clock not in time adjust- ment mode shows the temperature in °C with a minus sign for really cold rooms. The tempera- ture sensor has an "accuracy" of ±3 °C and a resolution of 0.1 °C. Conclusion The circuit provided here is a basic wall clock with sizeable (1.5") displays. Features such as alarm or synchronization between PC via infrared link- ing are optionally possible. The schematic, PCB design and PCB Gerber files produced by Elek- tor Labs India Dept, using DesignSpark PCB are available for free downloading at [1]. The same applies to the PIC source code written in C. The project is expressly pitched at everyone wish- ing to extend it with their own functionality by adding software of their own creation, like display brightness adjustment mentioned above. Let the designer and the community at www.elektor-labs. com know how you are getting along. ( 110167 ) Internet Reference [1] www.elektor-magazine.com/110167 36 | January & February 2014 | www.elektor-magazine.com powered by Eurocircuits ■ ■ ■ ■ Professional Quality Trusted Service Secure Ordering Ibliin r. I laraba WplJH'VW r . {MW A UhS i Vflektor p r r r, t- c v i Main Menu Ltf KU*M£ * sg« PCBChei.. it-Kte* Lw>:»u lu Hnanh jsers. havf be *n regj5S( fc?kfcor and »■ PH -*n ** i - ok 51 *, 9f 5 , lrtH.1 -CWJVMr aAf -M ff BC retry : I V- BWJa t £*■ I -T» JT« a'Ki B *ka E>jh* Bl g* - *®^.* 'Ji WLfc’io^ir opftpw ** fc«. r >k| 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 •Projects By Flemming Jensen (Denmark) RJ45 'Running-Lights' Cable Tester Remarkably, it has no microcontroller (hooray!) and no common ground lead (huh?). This cheap & cheerful circuit is indispensable if you are suspicious about a defective RJ45 cable in the patch cabinet or anywhere else for that matter. Connect the Master (sender) to one end of the cable under test (C.U.T.) and the Slave (receiver) to the other end. If the LEDs light up in succession then the cable is okay. If not, flaunt the cable to the IT Manager, drop it in His trash bin (with a fanfare) and ask a raise as a reward for keeping the company in business. Let's look at this clever money making gadget then. Remarkably, it has no microcontroller (hoo- ray!) and no common ground lead (huh?). Each of the 4017's counter outputs CT0-CT7 has its own LED and wire in the cable under test but no wire is required for the ground return cur- rent. When one of the 4017 counter's outputs is logic High due to the clock pulses from IC1 a current flows through the corresponding LED and normally returns to ground (GND) via diodes D1-D8 or the reverse connected LEDs, by way of the Low outputs of the 4017. You either fit eight dual colour LEDs in positions D11-D18, or eight diodes in positions D1-D8 and eight high efficiency LEDs in positions D11-D18. No buffers are needed between the 4017 and the LED array at the other end of the C.U.T. consid- ering the IC is capable of sourcing the necessary current. Current limiting resistors R4-R11 are required though in view of the 9-volt supply volt- age. The speed of the running lights is adjustable on preset PI within a certain range. The LEDs tells a thing or two on the cable under test, as follows. • RJ45 cable all right and straight through: LEDs light in succession like a small running lights. • One or several wires are shorted: one or several LEDs light all the time. • One or several wires broken: one or several LEDs off permanently. • One or several wires connected to a wrong pin: running lights erratic (jumping around). 38 | January & February 2014 www.elektor-magazine.com Cable Tester IC1.C 12 _ 13 & +9V © 1 ICI. A & \3 2 I — <> Pi R1 IC1.B & Cl "N 15u C2 S 15u 14 +9V © C3 In 13 N 15 10 IC1.D & 11 ici © 16 © CTRDIV10/ DEC & IC2 CD4017 CT=0 0 1 2 3 4 5 6 7 8 9 CT>5 3 R4 j 2 R5 j 4 R6 i 7 R7 i 10 R8 i 1 R9 i 5 Rio j 6 R11 i 9 11 .12 8x Ik ICI = CD4011 Terminal 8 = GND Terminal 16 = VDD D1...D8 = 1N4148 D9...D16 = Duo LED 110691 - 11 The Master and Slave circuits are built as sep- arate units pictured here. The two boards are separated by sawing along the dashed line on the component overlay. Note again that on the Slave board you fit either the dual LEDs or the single color LEDs and diodes D1-D8. The photo- graph shows the first option. ( 110691 ) COMPONENT LIST Resistors R1 = 56kQ R2 = 33kQ R3 = 4.7kQ R4-R11 = lkft PI = lOOkft preset, vertical Capacitors C1,C2 = 15pF 16V radial C3 = InF Semiconductors ICI = CD4011 or HEF4011 IC2 = CD4017 or HEF4017 D1-D8 = 1N4148* D9-D16 = LED, dual-colour low-current, or single colour LED* Miscellaneous PCB # 110691 K1,K2 = RJ45 CAT5E socket, PCB mount, e.g. Farnell # 2060718 * either/or (see text) www.elektor-magazine.com | January & February 2014 | 39 •Projects Multi I/O for FPGA Development Board (2) Programming in VHDL By Andreas MokroB, Dominik Riepl, Christian Winkler and Professor Thomas Fuhrmann (Germany) Figure 1. The board showing the welcome screen. PGfi~ Board go we TEMPERATURE Elektor 13014B-1 U2,3 tffw Pria n ■ ■ , 11 ■ - T ‘ . mm i X In the December 2013 edition we described the FPGA development board hard- ware. With this board it's a simple job to interface the FPGA to real world devices and events. The extensive range of peripherals include sensors and an LC display. The next step is to program the FPGA and get them talking to one another. The Elektor FPGA board was originally featured in December 2012. It has the part number 120099- 91 and can be ordered directly from the Elektor Store. This FPGA board alone does not contain any peripheral chips. To make it more useful as an educational aid an expansion board was developed by the students at the Ostbayerischen Technischen Hochschule in Regensburg, Germany. The expansion board has a number of peripheral sensors and an LCD which interface to the FPGA board. They can be easily configured and con- trolled using VHDL and put to use in all sorts of applications. The complete development environ- ment with both boards is shown in Figure 1 . In part 1 [1] of this project the development board hardware was described, in this second part we describe how these peripherals can be controlled using VHDL. This will give you a good grounding in the technology so that you can go on to use it for your own applications. 40 | January & February 2014 www.elektor-magazine.com FPGA Expansion Board The complete project has been developed using the XILINX ISE 14.5 Design Suite which is freely available to download from the Internet [2]. A hierarchical approach For large projects in VHDL it is sensible to approach the design in the way you would a soft- ware project by breaking down the program into small manageable parts. Unlike software VHDL doesn't use functions or classes, instead we use descriptions of hardware, the so-called Module. Each module is described by its own file and has its own defined interface to the outside world. A module functions as a self-contained unit and can be simulated with the help of a Test-Bench. It can be seen as a functional black box which integrates into the complete project. The use of modules greatly simplifies the process of sys- tem debugging. Based on the sensors, display, control elements and their control, the VHDL project is divided into the following areas (see Figure 2): • menu_control: The central module; this is where all the data comes together and the menu functions are taken care of. • taster: Interfaces to the pushbuttons with debounce logic. • led: Drives the LCD and loads the display data. • gps_control: Controls the GPS module and receives Global position information and time of day. • ADC_control: Controls the A/D converter. Pushbutton Control A/D Converter GPS Data l l 130390-11 clock. Apart from this the module's data output Figure 2. has an enable signal which goes to a logic '1' The project's block diagram, state for one clock period when all the process- ing in the module is completed. It indicates that output data is stable and can be used elsewhere. Package: self_defined_types This Package contains the global definitions for the complete project and frequently used data types and conversions to make them more readable. It defines the following data types: • byte: An 8-bit wide array of type std_logic • byte_array: An arbitrary width array of type BYTE At the top level the individual modules are com- bined and no logic process is described. The con- nections are made in the sub-modules defined in the top_level description using the component key word. The compiler is thus informed which components are used and what inputs and out- puts are available. Connections to the module are defined in the port map, where the input and output of the sub modules are linked to the signals defined in the top level. While VHDL is a Hardware Description Lan- guage, they get translated directly into gates and because the modules work in parallel it is not necessary to consider the order of the modules. All modules have a connection to the 8 MHz clock so that every process is synchronous with the In addition the function HEXtoASCii is defined which converts a 4-bit wide std_logic_vector with a hexadecimal value into a displayable ASCII character. The packages are linked into this and any other library using the command: library work; use work. self_defi ned_types . all; The ADC Module The first module described here is used to con- trol the A/D converter and read the output data. The module uses a 3-bit long std_logic-input vector i n_channel to select the analog channel and an 8-bit long std_logic-output vector out_ adval to output the data. The other inputs and www.elektor-magazine.com | January & February 2014 | 41 •Projects which is inverted, so that the time that the timer runs from 0 to reset corresponds exactly to a clock period of the generated clock. The constant const_di vider is the ratio of the clock frequency of the external oscillator and the required converter clock frequency: Figure 3. State diagram of the ADC read processes. outputs are necessary to communicate with the IC (in_sar, in_do, out_clk, out_di, out_not_cs, out_not_se). 7 . . _ oscillator clock frequency const _ divider = converter clock frequency The Clock Process According to the data sheet of the A/D converter [3] it should be provided with a clock signal in the range from 10 kHz to 400 kHz. For this appli- cation we use 100 kHz. The clock is generated a dedicated process, see Listing 1. The counter cnt_clock is incremented on each rising edge of the 8 MHz input clock in_ elk and the internal clock adc_clk at (const_ divider - 1) / 2 and (const_di vi der - 1) Listing 1 constant const_di vi der : integer := 80; signal cnt_clock: integer range 0 to const_di vider - 1 := 0; signal rising_clk: std_logic; signal falling_clk: std_logic; signal adc_clk: std_logic := '0'; process (i n_clk) begi n if ri si ng_edge (i n_clk) then if cnt_clock = const_di vider - 1 then adc_clk < = 1 1 1 ; ri si ng_clk <= ' 1 ' ; cnt_clock <= 0; elsif cnt_clock = (const_di vider - l)/2 then adc_clk < = ' 0 ' ; falling_clk < = 1 1 1 ; cnt_clock < = cnt_clock + 1; else ri si ng_clk <= ' 0 ' ; falling_clk < = '0'; cnt_clock < = cnt_clock + 1; end if; end if; end process; Apart from this the Enable signal rising_clk and f alii ng_clk are generated for state machine communication with the converter. The reading process: implementing a State Machine For the sake of clarity control of the FPGA func- tions are implemented in modules using state machines. The following implementation will be for the A/D converter. The state transition dia- gram of the machine is given in Figure 3. Each state is represented by a circle and transition to another state is indicated by an arrow labeled with the transition condition. Two states are required to read data from the ADC: In wait_state the state machine waits until data is available indicated by the SARS out- put from the ADC going to a logic '1'. The state machine then jumps to the send_state which reads the 8-bits from the converter. To describe the state diagram in Figure 3 using VHDL a separate data type state_type_read is defined with all the possible states and then a signal that is this type. The compiler con- verts this construct into a timer. For a devel- oper the approach used here is more easily understandable. It is written as a process using a case statement, in which all the possible states of the machine are described, see Listing 2. The two separate states of the machine can now be described: • wait_state: When the A/D converter out- puts a new word the SAR status output is set to a logic ‘V. This makes the machine state change to read_state. • read state: This is where the ADC serial 42 | January & February 2014 www.elektor-magazine.com FPGA Expansion Board output value is read bit by bit and starting with the MSB, written into a shift register. When 8-bits have been read the Value-En- able-Bit int_val_en is set to logic '1' and returns to the wait_state. After the change this will be reset to logic '0' again. The ADC outputs a new bit on every falling clock edge of the 100 kHz clock. Each bit is read on the rising edge of the clock with help from the Enable signal from the clock process. This implementation is used in the same way by all the other state machines so only the individ- ual states and transitions will be described and not the principle itself. The sending process A/D conversion is initiated by sending a telegram to the A/D converter. This is performed using a separate process. According to the ADC data sheet (data sheet [3], Figure 20) it reads con- trol signals from the FPGA on rising clock edges. The A/D converter outputs a new bit at rising clock edges. To ensure that the data is stable the implemented state machine reads the value of these bits on the falling clock edge. The state diagram showing the sending pro- cess structure is given in Figure 4. The process is implemented as a state machine with three states: • wait_state: Waits for the Channel_Enable signal to start the conversion. When this signal is logic '1' the chip select signal is set to logic '0' and the first bit of the telegram is sent. The state machine changes to the send_state state and decodes the remaining bits in the telegram. • send_state: In this state bits are sent one after another on the data line to the A/D converter. The number of sent bits are counted until all the bits have been sent then the state changes to wait_for_rec_ready. • wai t_for_rec_ ready : In this state the wait for the conversion process of the analog voltage is finished. This is done with help of the i nt_val_en signal. When reading out is finished communication with the A/D con- verter is ended by switching the chip select signal to logic '1'. The machine returns to the output state wait_state and the next request can be processed. send processes. Listing 2 type state_type_read is (wait_state, read_state) ; signal read_state_machi ne : state_type_read : = wait_state; process (i n_clk) begin if ri si ng_edge (i n_clk) then if rising_clk = 1 1' then case read_state_machi ne is when wait_state => read_bi t_count <= 0; i nt_val_en <= 'O'; if in_sar = ' 1 ' then read_state_machi ne <= read_state; end if; when read_state => if read_bi t_count /= 8 then int_adval (7 downto 1) <= int_adval (6 downto 0) ; int_adval (0) <= in_do; read_bi t_count <= read_bi t_count + 1; else read_state_machi ne <= wait_state; i nt_val_en <= 1 1 1 ; end if; end case; end if; end if; end process; www.elektor-magazine.com | January & February 2014 | 43 •Projects The pushbutton input module The process which reacts to pushbutton activity is contained in a separate VHDL module. Its main function is to perform contact debouncing (see article on the board hardware [4]). To achieve debounce a counter is started when the signal level from the pushbutton input changes state. The counter is used to produce a delay so that the signal level is only valid once this counter has finished counting. A long press would result in the counter timing out several times and regis- tering several presses. To avoid this situation the active pushbutton is polled at every rising clock edge to check if the press has already been reg- istered. The pushbutton input signal state is com- pared with its state stored when the counter last Listing 3 generic (WAIT_40MS: integer : = 320100; WAIT_4_1MS: integer := 32900; WAIT_1_52MS: integer : = 12200; WAIT_100US: integer := 900; WAIT_38US: integer := 400; WAIT_450NS: integer := 10); Listing 4 when send_data => out_enable <= ' 1 ' ; if wait_counter = WAIT_450NS - 1 then state <= wait_state; wait_counter <= 0; else wait_counter <= wait_counter + 1; end if; when wait_state => out_enable <= 'O'; if wait_counter = wait_time - 1 then if prev_state = '0' then state <= init; else state <= write_data; end if; wait_counter <= 0; else wait_counter <= wait_counter + 1; end if; elapsed. When the two states are the same (long press detected) the counter is reset otherwise it runs until the debounce delay time finishes. Any contact bounce will be finished before the counter reaches the end of its counting period. The signal level is now stored to temporary mem- ory and a short pulse is output. The LCD Module The LCD has a parallel interface so all control and data information is sent in the form of parallel words. After each word it is necessary to intro- duce a wait period to allow the LCD board con- troller to process the information. It is therefore necessary to generate some wait periods. This is achieved with the generic command where con- stants valid in the module are placed. These are defined in the Entity declaration, as in Listing 3. The wait period is defined by the integer value which defines the maximum value of the counter clocked at 8 MHz. The LCD state machine A state machine with six states is implemented to control the LCD. Figure 5 shows a simplified state diagram for the LCD. The state machine starts with start_up. Firstly there is a 40 ms delay introduced to allow for the LCD to power up. Next is the init state to initialize the LCD. After initialization it automatically jumps to the wai t_for_data state and stays here until in_ data_en (an external input) is logic '1\ This indi- cates that display data is available to be written to the display. Next it jumps to the write_data state, where all the data is written to the display. For every character written the LCD interface requires a ‘Y of at least 450 ns on its Enable input. This is taken care of after each character is sent out in the send_data state. In here the out_enable is set followed by a 450 ns wait. The display requires a processing time of 38 ps after each character is sent to the display. This is generated by using a wait.state before the next character is sent. After each wait.state elapses it returns to write, data state until there are no more characters left to send to the display. Listing 4 shows the relevant section of VHDL code which handles send data and its wait state. 44 | January & February 2014 www.elektor-magazine.com FPGA Expansion Board GPS The VHDL description of the GPS module is made up of four individual modules. The top module for GPS control is gps_control which contains three sub-modules gps_serial_parallel, gps_check- sum and gps_parser. GPS control (gps_control) In the top module gps_control the other sub-mod- ules referenced above are declared as components and linked to the corresponding ports. The pro- cess to turn the GPS module off and on is in this module. In addition a short process flashes an LED each time a valid GGA-type sentence is read. The Conversion Process (gps_serial_parallel) In the gps_serial_parallel module the serial UART protocol data from the GPS module is con- verted into a one byte wide parallel signal. Using a previously calculated divider constant the com- munication speed with the GPS module (here we use 4,800 bit/s) can be adapted as necessary. It is important that the sampling points of the received GPS data stream are synchronized to the data rate. To achieve this, the falling edge of the start bit at the beginning of every byte is detected, the GPS data gps_data input signal is shifted into the vector data_shift using the internal 8 MHz clock and compared with the bit sequence '1110'. Once the falling clock edge is detected the fol- lowing GPS data will be sampled one half of a bit width later i.e. mid-bit, and then shifted into the i nt_data shift register until a complete byte has been received. The valid data is now stored in int_data and written to the parallel data output out_data and the Enable-signal set. Checksum calculation (gps_checksum) The gps_checksum module calculates the check- sum on all the transmitted data bits and compares it with the checksum value sent from the GPS module. This ensures that there are no errors in the received sentence. When an error is detected the corrupted sentence is discarded. A state machine with five states is used to read-in, calculate, validate and them output the result: • reset: All of the signals used for these cal- culations are first reset to zero. When valid data from the serial/parallel converter (out_ Figure 5. data_enable = 1) is available the state of State diagram of the LC zeichen_in changes, as soon as a '$' symbol display, is detected in the data. This symbol is the GPS sentence start character. • zeichen_in: This detects where the check- sum begins in the received sentence and changes to the checksum_in_i state. An 'if' condition is used to detect an asterisk which marks the end of the sentence data. The two characters following the asterisk are the two-byte sentence checksum. • checksum_in_i: This reads in the first check- sum character. This is XOR'ed with the sum of the input characters. When it is not valid the signal int_checksum_err will be assigned logic '1'. • checksum_in_2: The second checksum char- acter is read in here. Otherwise identical to checksum_i n_l. • output: When the checksum is valid then the signal int_checksum_ok is given the value logic '1' otherwise it has the value 'O'. Reading GPS data (gps_parser) The gps_parser module filters out the relevant information from the received GPS data stream and prepares it for further processing. The GPS module sends all its data sentences sequentially www.elektor-magazine.com | January & February 2014 | 45 •Projects according to the NMEA protocol. It is necessary to identify the sentence of interest (for our pur- poses the GGA sentence containing positional fix information) and recover it from the data stream. A '$' character identifies the start of every new data sentence. A state machine checks when this occurs. Following this character is the 'GPGGA' sequence which is the preamble to the GPS data of interest to us. There is a state for each data sentence of interest in which the data is read in. Each data field in the sentence is separated by a comma and this is used to change the state Figure 6. of the machine. One after another all the data The menu options. is read in and sent to the corresponding output. Menu control in VHDL A menu has been implemented on the display to allow user control of the GPS module and A/D converter. Pushbuttons under the display allow intuitive interaction with displayed menu options. Figure 6 shows the menu layout. After the start screen there is an option to select sub menus 'GPS' or 'ADC'. The GPS sub-menu firstly gives you the option to turn it off or on. Other pages give you the option to view additional information such as your current longitude and latitude. The com- mand 'up' returns you to the next level up in the menu structure. Selecting 'ADC' from the menu allows you to select a channel of the A/D converter. The mea- sured values are displayed on a page in the sub- menu. Pressing 'ref' (refresh) causes the ADC to make another measurement of the displayed channel and update the display with the new value. The GPS menu The menu control is also built with a state machine and can be easily restructured (by changing the state transition diagram) or expanded (add new states). The menu structure and associated state machines are described using the GPS menu as an example. Each page in the menu has a corresponding state of the state machine for control of the menu. The current state is stored in the signal state. The machine starts in the state_init state and then changes to the state_welcome state. Now the welcome screen is shown. A press of the pushbutton on the right changes to the state_gps state. This state builds the highest level of the GPS menu. In the lower line of the display are arrows pointing to the left and right. Pressing the button beneath the arrow changes the state to state_adc and now the A/D converter menu options are displayed. Staying in the GPS menu you can press OK to get to the first GPS sub-menu, here you have the option to switch the GPS module on and off (state_GPS_toggle). When powering down the GPS module it is important to observe the cor- rect power-down sequence to avoid any possible internal memory data corruption. On one level with the state to switch on and off there are dis- play options for GPS data such as longitude and latitude which can be selected using the left and right pushbuttons. 46 | January & February 2014 www.elektor-magazine.com E CD CO -i — > i CD > “O March 23-27, 2014 CONFERENCE S EXHIBITION ji March 25-27, 2014 MANDALAY BAY RESORT AND CONVENTION CENTER LAS VEGAS, NEVADA NEW IDEAS... FOR NtW HORIZONS > TRUST in the expertise of IPC - recognized worldwide as the leading standards organization for electronics manufacturing. > EXPLORE emerging technologies and the latest innovations that will shape the future of our industry. > COMPARE equipment, materials and supplies from more than 400 of our industry's top companies, in one location. > LEARN about the latest research and processes that will advance J W X * VW . If REGISTER TODAY www.IPCAPEXEXPO.org eapu worm ii. Brent Huggler] EE- CAD Designer Bourns Inc., Automotive Division DESIGN | PRINTED BOARDS | ELECTRONICS ASSEMBLY | TEST •Projects LED's Replace That Halogen Lamp Economical alternative for the GU4 By Fons Janssen (Maxim Integrated, Netherlands) There are numerous LED alternatives available these days for most types of in- candescent and halogen lamps. But as an electronics hobbyist you can of course design and build something like this yourself, as this article illustrates. The LED lamp presented here can replace a GU4 model 10-watt halogen lamp, uses only one-tenth of the power and is barely bigger than the original. LED lighting has experienced a great ascent, par- ticularly since several government commissions have banned the good old incandescent lamp. Since 100% compatible LED retrofit lamps are very complex, because of all the optical, ther- mal, electrical and commercial requirements, the design of such a lamp is normally reserved for large development teams. This however, does not have to hold us back from designing such an LED amp ourselves! The real Elektor reader does not shy away from a few compromises to nevertheless build a working lamp which can also save a lot of energy. LED alternative for a 12-V capsule lamp The LED lamp proposed here is an alternative for a so-called halogen capsule lamp, also known as the GU4 (the 4 refers to the distance of 4 mm between the pins). The headline photograph shows both lamps side by side. In practice the light output of the LED lamp at 1 watt is com- parable to the light output of a 10-watt halogen capsule lamp. This is a saving of 90%! By selecting 12 V as the power supply voltage, we don't have to worry much about electrical safety. That is because the 12 VAC transformer provides sufficient isolation from the powerline so that it is safe to touch the circuit without having to place trust in an earth-leakage circuit breaker. As can be seen from the photo, the dimensions of the LED variant are somewhat larger than the original, with the consequence that it is not pos- sible to replace every GU4 in any light fixture. There are, however, also applications where the additional space requirement is not a problem. A nice example is the so-called 'starry sky', where a matrix of lamps is spread across a ceiling. Our alternative fits exactly in the socket and, at most, 60 | January & February 2014 www.elektor-magazine.com LED-Halogen Replacement will stick out a little further than the original. Because the lamp is not enclosed it is very easy for it to dissipate its heat. Because an LED is a point source it is not pleasant to look at it directly. A special lens solves this problem and provides a nice beam of light. Construction Which challenges remain? The design of the lamp must be simple, robust and frugal. The individual components have to be readily available and the whole assembly cannot be too expensive. As can be seen from the photo, this lamp shines from simplicity. There is no need for a sepa- rate enclosure; two circuit boards are connected together using standard right-angle header pins. The LED board is clamped firmly to a TO-220 heatsink using two M2 bolts. The small lens is attached with a couple of drops of glue to the LED board. The main connection pins use the same header pins as those used to interconnect the boards. The LED that has been used here is the so-called Rebel from Philips Lumileds. This is readily obtain- able and available in various colors and color temperatures. By limiting the power to 1 watt we kill two birds with one stone. Firstly, it is possible to use any type of Rebel-LED with that a similar power rating. The second advantage is that the heatsink can remain quite small and finally the LED will operate more efficiently since it doesn't become so hot. That is because LEDs do not like heat and operate more efficiently at lower temperatures. Electronics schematic Figure 1 shows the schematic for the circuit for the drive electronics. Diodes Dla through Did form a bridge rectifier for the incoming 12 VAC voltage. The rectified voltage is filtered a little by Cl. A tantalum capacitor is used because a ceramic type was found to produce an annoying 100 Hz (120 Hz) audible hum. D3 was added at a later stage of the project, after a few proto- types without this transient over-voltage pro- tection went up in smoke. The LED driver IC, a MAX16820 van Maxim (IC1), has a 'buck' archi- tecture and uses an external switching FET (Tl). The IC attempts to regulate the voltage across shunt resistor R1 to 200 mV, so that the current through this resistor, the coil and the LED equals 200 mV/620 mQ ~ 320 mA. The forward voltage drop across the LED is about 3 V, so that the D2 Dla, Dlb, Die, Did PMEG4010CEJ Cl □ PMEG4010CEJ LED1 R1 < i — | 0R620 |- R2 D3 T - 0 — I ♦ ♦ H i ! Luxeon Rebel 1 LI _rf rw\ I IOOuH 2u2 25 V IN Vcc IC1 MAX16820ATT+ CSN DRV DIM GND EP SMAJ24A Jc2 1u 16V Tl IRLML2030 TRPBF 130315 - 11 power in the LED amounts to about 1 W (3 V x Figure 1. 0.32 A). The control itself is quite simple. When Schematic diagram for the the voltage across the shunt resistor is smaller control electronics, than 190 mV FETT1 will be turned on. The cur- rent will increase linearly at a rate of dl / oft * (l/ in - V LED ) / L As soon as the voltage has reached a value of 210 mV the FET is turned off again, with the result that the current will decrease at a rate of dl / dt~ V LED / L noting that the current is returned to the input via D2. As soon as the bottom threshold of 190 mV is reached again, the FET is again turned on and the cycle repeats. The result is a sawtooth shaped current as shown in Figure 2. The switching Figure 2. frequency depends on the input voltage. Since The sawtooth shaped the input voltage is not constant, the switching current through the LED. c 104 Fast forward The controller is slightly modified from the orig- inal unit. A pot is now used in place of the five pushbuttons to provide slow/fast forwards and slow/fast reverse plus stop. The stop position is the control knob at mid-travel. Turning clock- wise is slow forward and fully clockwise is fast forward. Counter clockwise from the central posi- tion achieves the same speeds in the reverse direction. Compared to the original controller it is more intuitive and the young train enthusiasts actually prefer to use it. From the circuit function the analog input RA2 sees an input voltage varying in the range from zero to half supply voltage. The measured value is converted into an 8-bit digital value in the range of 0 to 128 by the A/D converter. This translates to 5 speed ranges (this is not an analog control function) given in Table 3. Also on the controller are pushbuttons for the sound generator: Bell (S2), Horn (S3) and 'Bridge' (S4) (sounds like the train is passing over a bridge). These signals connect to inputs RB5, RB7 and RA4 (with pull-up resistors) on the microcontroller. The LED connected to RC1 flashes each time a command message is sent. The double-sided transmitter PCB has been designed in the Elektor Lab using the DesignSpark [4] software. Component fitting should be quite easy; no SMD components are used in the design. The RF module is available with either SMD mounting pads or a DIP version with two rows of pin headers (at 2 mm grid spacing). This version can be soldered directly to the PCB. Note that the antenna, made up of a 17 cm (6.5-inch) length of copper wire (for 433 MHz), is soldered on the topside of the board by the SMDs (see Figure 1). For 868 MHz, the antenna length is 8.5 cms (3.3 inches) A 9 V battery connected at K1 provides power to the circuit and low-drop regulator LP2950CZ-3.3 provides the on-board 3.3 V, ensuring that every last drop of juice gets used up from the battery. Diode D2 in the supply protects the circuit from accidental reverse polarity connection. The switch type for SI is not important and depends on the type of housing you use for the transmitter. The transmitter circuit's current drain on the 9 V bat- tery pack is 4.5 mA quiescent, rising to 11.8 mA when transmitting. The PIC controller can be ordered (just like the PCB) ready programmed from [5]. It is also pos- sible to program it yourself if you have a pro- 66 | January & February 2014 www.elektor-magazine.com Model Train Remote Control grammer. Free software downloads for this project from the Elektor site include the ready-assembled firmware and Pascal source file. Firmware for this project can be compiled using versions 5.60 or 6.01 of Pascal Pro from MikroElektronika [6]. The fully functional compiler is free to use for pro- grams less than 2 KB in size. The microcontroller connector K2 hooks up to a Microchip PICKit3 programmer [7] for in-circuit programming. The receiver circuit (Figure 2) corresponds quite closely to the transmitter circuit. Not only is there the same PIC18F14K22, RFM12B-433 combina- tion, they are also identically connected. The microcontroller built into the train is controlled by active-low pulses from the receiver unit via a two stage transistor driver consisting of T1 and T2. The output control pulse sequences are given in Table 1. Power is supplied by the battery pack (2 x 3 AA cells) in the train. The battery supply attaches to connector K1 through protection diode D1 and voltage regulator IC2. The 3.3 V output powers the circuit. LED D2 is a status indicator, it gives a short flash every 2 s while no data is received and extends to double the length when a message is received. The PIC is programmed in exactly the COMPONENT LIST, Receiver Resistors R1-R4,R7,R8 = lOkft R6,R9 = lkft R5 = 330ft Capacitors C1,C3-C6 = lOOnF C2 = 47(jF 16V Semiconductors D1,D3 = BAT43 D2 = LED, 3mm, red T1,T2 = BC547 IC1 = PIC18F1422-I/P, programmed, Elektor Store # 130160-42, [5] Miscellaneous MODI = RFM12B-433-D, 3.3V version (Hope RF), or 868 MHz 3.3V version (country-specific) K1 = 4-pin pinheader K2 = 5-pin pinheader PCB # 130160-2 [5] www.elektor-magazine.com | January & February 2014 | 67 DESIGNSPARK PCB IS i r - 1 same way as the transmitter unit using PICKit3 connected to K2. The receiver circuit's current drain on the 4.5 V battery pack is 19.5 mA quiescent, rising to 21.2 mA during message reception. Firmware The transmitter firmware continually reads the value of the speed/direction pot and pushbuttons. When a change is detected the corresponding command is sent to the train receiver. After the PIC microcontroller and the RFM12-433 module have been initialized the firmware enters an end- less loop where it reads the input voltage level from the speed control pot and generates a com- mand. Note that 868-MHz modules may require different initializing codes. When this command is identical to the previous one nothing is sent out. It will only be sent if it is not the same. The microcontroller also takes into consideration the current status of the train: suppose you were to spin the pot quickly from say maximum forward to maximum reverse. The controller first sends out a Stop command and then a Slow Reverse command followed by Maximum Reverse. This puts less strain on the mechanism and pauses between the commands help to give a more realistic motion. In the second part of the end- less loop the sound generator pushbuttons are polled. When the train is running the correspond- ing sound command is sent to the train. Similarly the receiver firmware executes an end- less loop after everything has been initialised. In the loop it checks if a new message has been received. When an error-free message is received the command byte is interpreted to select the corresponding message defining the pulse/pause sequence sent to the train's built-in controller. For security the process is repeated three times. Now with the new controller working, peace has broken out in the playroom. The only source of conflict now is whose turn it is to use grandpa's controller. ( 130160 ) Internet Links [1] Manufacturer: www.golden-bright.com/ [2] http://en.wikipedia.org/wiki/Hamming_code [3] www.hoperf.com/rf/fsk_module/RFM12B.htm [4] www.designspark.com/eng/page/ designspark-pcb-home-page [5] www.elektor-magazine.com/130160 [6] www.mikroe.com [7] www.microchip.com/pickit3 COMPONENT LIST, Transmitter Resistors R1,R4,R5,R6 = lOkft R2 = 330ft R3 = 4.7kft PI = 5kft trimpot Capacitors Cl = lOpF 25V C2 = 47pF 16V C3-C6 = lOOnF Semiconductors D1,D2 = BAT43 D3 = LED, 3mm, red IC1 = PIC18F1422-I/P, programmed, Elektor Store # 130160-41, [5] IC2 = LP2950CZ-3.3/NOPB Miscellaneous MODI = RFM12B-433, 3.3V version (Hope RF), 915 MHz or 868 MHz 3.3V version depending on area. K1 = 2-pin pinheader K2 = 5-pin pinheader SI = 2-pin pinheader and/or slide switch, 1 make contact S2,S3,S4 = pushbutton PCB # 130160-1 [5] 68 | January & February 2014 www.elektor-magazine.com Throw off the 8-bit ball and chain! E E eOt E«J I” r- tD 0) CO o CO Crysta/fonfz 7 CFA10Q36 CFA10036 ARM9 + Linux SOM / \ ■ ■ ^ 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 * fast: 454WtHz ARMS « jySD' 4GB to 64GB * Linux mainline kernel * deep 1 28/256MB * USB/LIART/SR[/! 2 C * 6*ADC/&xPWM/CAN * wide; 91/126 GRID * debug/status QLED * $71 @01 to S4fl@Q500 Get your project to market fast: lay down a standard SO DIMM connector, snap in a CFA1003S Systeni-On-Module and you instantly have access to tons of GPIQ and the power of Linux, Leave the 8-bit dark ages behind, CFA920-TS Thas tiny h touch-enabled embedded Linux PC is powered by the CFA10036 * 600x480 color TFT * resistive touch screen * 10/100 Ethernet +- USB ■24GPIO on O.r * 79 more GPIQ on 1 mm * 6-channel accel+gyro ‘$140@Q1 to$105@Q500 108mmf4.25 18 6mm 0.73" thick Crystalfontz www.crystalfontz.com +1 509 892 1 200 • Standard 18-pin DIP interface; 0.6x1 .26-inch footprint DLP-I08-G 8-Channel Data Acquisition • 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 powered by Eurocircuits Elektor Benefit now: Elektor PCB Service offers a permanent 90-day launch discount on new Elektor PCBs! Check www.elektor.com/DCb.for an overview of all Elektor PCBs •Projects Arduino on Course (6) eiOPIA KIDS Report on the Mobile Weather Station experiment Arduino Verkstad ("Workshop") was tasked to create a set of education- al experiments aimed at introducing Highschool students to electronics. The primary goal was to make it affordable, yet engaging and challenging enough to trigger their curiosity. Included in the set of experiments is The Mobile Weather Station, a cross-curricular experiment combining natural sciences, physics and technology. By David Cuartielles, Clara Leivas, and Tien Pham (Arduino Verkstad) For the mobile weather station, we wanted stu- dents to be able to actively gather data from different environments— in the city, through the parks, and along the riverbanks. Each environ- ment might provide a different set of data for the students to use for comparison. We decided to use tethered balloons so that stu- dents could control the placement and gather data at higher altitudes. This also gave us the oppor- tunity to include a time-lapse camera enabling the kids to correlate and visualize their data to the different environments. Decisions, decisions We set about gathering the required electron- ics— a temperature/humidity sensor, a micro- phone, a lightweight spy camera, and a C0 2 sen- sor. To our knowledge, there were no ready-built wind speed sensors that would fit our require- ments. Most anemometers require a stable sur- face or object to attach to in order to get their readings, but because ours would hang from a balloon, we had to figure out a different method. That, along with a few other unexpected issues, complicated what we thought would be a rela- tively simple project. In order to keep costs low, we decided to use a cluster of balloons rather than a single large weather balloon. We purchased a consumer-size helium tank along with regular party balloons. Searching online, we were able to estimate that it would take about 25 or so balloons to lift the Arduino, a shield, the sensors and a lightweight frame or container. Next up was the anemometer. To measure wind speed accurately wasn't our goal so much as to be able to compare the speeds. Deciding to only measure rotations per second, we thought to use a light dependent resistor (LDR) and an LED to create a sensor. The idea was to place the LDR opposite the LED with a paper disk in between the two. The disk would have a slot cut out and as the blades would turn and intermittently allow light to pass through to trigger the LDR. 70 | January & February 2014 www.elektor-magazine.com Arduino on Course (7) Problem solving As part of our first attempt we tried placing the LED very close to the LDR hoping the magnitude of the readings would obviate the need for shielding. As suspected, this wasn't the case, so we decided to find a dark box to house the electronics. This presented another set of problems regard- ing mechanic assembly, and so we set out minds on using an infrared (IR) sensor and a black and white paper disk instead. This looked more hope- ful as it required just one electronic component, meaning less room for mechanical error. We tested the assembly and got it to work. The next part was a bit trickier— how to actually catch the wind in order to spin the disk. Because our aim was to build a lightweight weather station, we couldn't exactly use its weight to stabilize it so that an anemometer could spin while having a stationary point as reference. Again, to make the assembly reproducible any- where by students, we decided to try papercraft. We made a simple turbine blade out of paper and tape (Figure 1). We mounted it horizontally so that regardless of wind direction, it would spin. In order to keep the balloons stable, we clustered the balloons at the four corners hoping that the weather station wouldn't spin. Blowing in the wind Our paper mockup proved that it might work. In any case, we got the IR sensor and paper disk to work so we were quite happy. Time was now upon us to test the proof of concept— we only had the temperature/humidity sensor, IR sensor, and spy camera. We first tested the temperature/humidity sensor and camera indoors. We walked over to the Uni- versity building nearby, inflated the balloons and were quite happy to realize we didn't have to use that many balloons (Figure 2). Up it went— we did our high-fives as we loaded the results from the SD card. Now it was time to test the make- shift anemometer. The West Harbor in Malmo, Sweden, is very windy and we were hoping that it would yield good results. So, out we went with the balloons. As soon as the sliding doors opened the balloons got sucked out and the tether pulled taut. The balloons started to spin wildly and tangled their strings. Not only that, but the winds were so strong that the balloons and weather station blew almost horizontally, seemingly close to the point of breaking the tether string. Figure 1. A paper-and-tape crafted model of a turbine for use as an anemometer. Hopefully! Figure 2. About a dozen balloons appeared enough to lift the Arduino Mobile Weather Station assembly, rather than 25 as initially calculated. www.elektor-magazine.com | January & February 2014 | 71 •Projects Figure 3. Initially impressed with the Rokkaku kite. Figure 4. Connection diagram intended for Highschool kids working at the "connect-wire-x-to- wire-y" level. It was only then that we realized what should have been obvious. The design of the anemom- eter wouldn't work because the balloons would never be upright if tethered. At best, it would be at a slight angle. Perhaps it was because of the traditional design of free-floating weather bal- loons that we didn't consider this, but having a tether changed the dynamics completely. Defeated, we tried several designs, one of which was to mount the turbine vertically. The problem was getting it to align to the wind so we tried adding a tail similar to that of weather vanes. That shifted the weight of the unit and simply was too unpredictable as it oscillated in the wind. Bidirectional turbine Finally, we decided to design and 3D-print a tur- bine that would blow in both directions. This was achieved by twisting the shape of the blades along its spinning axis. Since the test school we were working with already had a 3D printer, they could at least print the turbine out at a reason- able cost. It was a compromise, but we couldn't think of anything better at the time (and time was pressing). The person in charge of the mechanics (that would be me, David) didn't have much experi- ence with 3D printing— in fact, it would be his first time. After a few tries, a rough, workable prototype was printed. We tested it again and were glad to find that, yes, the anemometer worked at almost every angle. At this point, we decided to also laser-cut a frame out of MDF (plywood) so that it could be mounted properly, and construction would be consistent. This would help to enable the sensors, especially the IR sensor, to work well. (In terms of cost, it would be relatively inexpensive for us to use the communal laser cutter to produce lightweight kits that we could send off. Again, a compromise, but still affordable.) Our joy was short lived as we again went to test it outside (no balloons, just outdoors). Somehow, the IR sensors were receiving a lot of interfer- ence being outside. The only solution we could find was to spray-paint the plastic casing black. Eventually, we would have to print the casing using only black plastic since other colors allowed interference. The IR sensor proved to be just as temperamental as the LDR. Moving the sensor a few millimeters closer or farther from the disk would prevent the sensor from reading values correctly. In fact, it seemed that the IR sensor we were using had a small working range toler- ance, but we finally managed to get it working. Goodbye balloons We found that 3D printers, while being great for prototyping, weren't necessarily the most accu- rate (perhaps it was simply a matter of inexpe- rience) or smooth. Small points of friction where the print was bumpy meant it now required more 72 | January & February 2014 www.elektor-magazine.com Arduino on Course (7) wind, thus raising the speed threshold. Another compromise, but one we again decided to take. We thought we were nearing the finish line but then remembered the issue regarding the bal- loons. The idea of a kite came up and we figured it would be best to try it that way. So, it was off to research kites. Our first foray into kite making was a box kite. Someone mentioned an anecdote about a box kite capable of producing enough pull to lift a human, so we decided that would be our first model. After building a rather sad looking kite using dowels and trash bags, we managed to get it flying... for about ten seconds before it crashed back down. Adding wings as stabilizers helped, but the area we were in had unpredictable winds and the kite came crashing down— hours of work gone with a few broken dowels. Eventually, we happened upon a kite design called rokkaku— a six-sided kite originating from Japan that was said to be the most stable single-string kite available. We built a mockup with bamboo and plastic sheeting, and got it up and flying (Fig- ure 3). We were quite happy with the result, it being the first kite that any of us had ever built. We were set to bring the whole thing together for a test run . . . when it was then decided that all of these elements would be a bit too unpre- dictable for our purposes. We needed something a bit more foolproof and so we compromised yet again by deciding to hang the mobile weather station from a long stick with a curved hook. This actually turned out be a good and interesting decision because it felt a bit more interactive. Students could direct the weather station into the trees to see if greenery would affect readings, or hover it over a bridge directly above the water. Satisfied, we went back to working with the elec- tronics. We added the sound sensor and it worked perfectly. The C0 2 sensor was another matter. While it did work, there were complications. It requires warming up and demands quite a lot of care on the source code, and therefore it gets hard to explain to the kids participating in the workshop how the sensor works. Figure 4 gives an idea of how everything gets connected up to the Arduino. While we aren't 100% completely satisfied with the way the experiment turned out, we are sat- isfied with the learning curve. We messed up and failed many times, but eventually, we got there. Sometimes, there is success in failure. The completed Mobile Weather Station assem- bly is pictured in Figure 5 as an exploded view. More of these drawings showing the electronic side of things are available for free download- ing from [1]. Running the show We tried the weather station hanging from bal- loons, as well as from a kite. Both attempts at getting meaningful pictures out of the experiment turned out bad. Therefore we decided to hang the station from a long pole with a staff exten- sion (Figure 6). The first time this weather station was put into practice was at the "Etopia Kids" Tech-Camp in Zaragoza (Spain) that took place in June and July 2013. During this event, kids get exposed to dif- ferent interactive technologies during a period of 5 days. They learn how to count in binary, how to program Arduino boards, get robots to move, and how to read environmental data and show it on a display. The kids first assemble the station and then go for a hike to capture data at different locations. Temperature, humidity, sound level and wind speed are captured at a constant pace together with an image of the location from above. The participants then return to the computer lab, and using the 'Processing' software application, they map the information with the images and proceed to create a small presentation for the other groups explaining what they learned about the different locations. The Processing "sketch" developed for the project is also available at [1]. Figure 5. Final assembly of the Mobile Weather Station hardware. Temperature, humidity, altitude and C0 2 level are measured, processed by Arduino and written to an SD card. The system also takes pictures from above. Note the 3-D printed turbine incorporated in the PCB. www.elektor-magazine.com | January & February 2014 | 73 •Projects Figure 6. After fruitless attempts with balloons and kites, it was decided to hang the Arduino Weather Station from a long pole. Here's what the teachers had in mind... and an example of how one kid built it. The turbine parts were produced in different colors. Lessons learned As the time of writing we have been running the experiment with kids for three days. It will be done a total of 15 times over the following three weeks and 150 kids will get to try the weather stations. One thing we have seen is that there are far too many cables on the design. For a successful con- tinuation of this or even the expansion to more sites, the current Arduino shield design needs to have the components soldered to a board. Also, the camera we hacked for taking the pictures turned to be as weak as one could expect for the price we paid. We had to resolder the wires that "hack" the button on it several times. We'll definitely develop this experiment further and if you have any feedback, ideas on how to improve it, or know of similar successful exper- iments that we can refer to, please feel free to let us know at experiment. design@arduino.cc. The illustrated story The set of tech drawings presented to students to assist in the assembly of the Arduino Mobile Weather Station is available for free downloading from the Elektor website [1]. One set of draw- ings illustrates the connection of the external electronics to the Arduino main board ('Balloon- Experiment-xx.png), the other, the assembly of the complete unit, including the pole it is hung from (MDF_WeatherStation_Instructions-xx.png). ( 130043 ) [1] Arduino software Processing sketch (.zip file); electrical and assembly drawings (.zip file): www.elektor-magazine.com/130043 (free download). About Arduino Verkstad Arduino Verkstad ("workshop" in Swedish) is a newly formed team— each of us specializes in different areas, some of which overlap. Not everyone was directly involved in the process, but nearly everyone was able to contribute a bit of advice and guidance to the main developers, Tien and Clara. 74 | January & February 2014 www.elektor-magazine.com ESD Protection Active ESD Protection For microcontrollers and more This circuit is designed to be used when an application requires a greater degree of electrostatic discharge (ESD) protection than that provided by an IC on its I/O pins. Although arrays of ESD clamping devices are available, they rarely offer precise limiting of voltage overshoots and undershoots. Normally when dealing with a microcontroller or other digital circuit the connections on the device are protected against electrostatic dis- charge. Nevertheless engineers are 4ever taking special precautions when handling such devices to avoid the risks of ESD: the lab will have an anti-static covering on the floor, and nylon clothes and shoes with soles made of insulating material are avoided. And, in case that is not enough, it is normal to wear an anti-static wrist band when moving devices from their anti-static bags to the anti-static bench surface. But what exactly do we mean when we talk about ESD? The 'human body model' and others The first model for static discharge, mentioned as early as the nineteenth century, was the 'human body model' (HBM). This takes as its starting point a voltage of up to 40 kV, a body capaci- tance of a few hundred picofarads and a (skin) resistance of 1.5 kft. We find that even with a static voltage of only 10 kV, as might easily be acquired by walking across an artificial fiber car- pet in shoes with synthetic soles, it is possible to discharge through a fingertip at peak cur- rents of up to 20 amps! The discharge also hap- pens in a very short period, perhaps measured in nanoseconds. The HBM was adopted in the electronics industry in the 1970s with the introduction of sensitive JFET devices in space applications. The compo- nents were tested using a simple RC circuit like the one shown in Figure 1. The discharge cur- rent depends only on the resistance in the cir- cuit, and the damped discharge curve is largely free of oscillation and is accurately reproducible. There are also other models that deal with dis- charge through a sensitive component, for exam- ple when a low-resistance electrical connection is made between two devices (the 'machine model', or MM), or when a static charge present on the device itself is discharged (the 'charged device model', or CDM). Good introductions to this sub- ject can be found at [1] and [2]. ESD clamp circuits Figure 2 shows the typical protection circuitry provided on a microcontroller's I/O port. This example is from an ATmega; other microcontrol- lers and logic devices use similar arrangements. Two bipolar protection diodes conduct discharge currents that could cause undershoots or over- By Peter Kruger (Germany) Figure 1. Standard test circuit and current waveform for the human body model. www.elektor-magazine.com | January & February 2014 | 75 •Projects Figure 2. Typical ESD protection circuit, as found in an Atmel microcontroller. shoots to one of the supply rails, either V cc or ground. However, the diodes take about 6 ns before they conduct fully. Since ESD transients can sometimes be considerably shorter than this it is possible that the CMOS circuit structures will be damaged long before the diodes spring into action. The parasitic capacitance of the pin is around 6 pF, and this is quickly charged up by the energy in the electrostatic discharge. Unfortu- nately we cannot increase this capacitance with- out increasing the impedance of the pin, which is not desirable. Figure 3. Current waveform under the system-level model. Standard ESD protection circuits like this one are designed to meet the particular requirements set by the ESD association [3]. However, it is becoming apparent that the traditional models are not appropriate for modern applications. Recent efforts have been directed toward developing a new 'system level model' (SLM) which takes into account the different aspects of the older models. This model employs two stored charges that are discharged in different ways, creating a high-amplitude current pulse that decays very quickly plus a low-amplitude pulse that dies away more slowly. The energy transferred in a dis- charge under the SLM can be very much higher than that in the traditional models (Figure 3). It is readily apparent that the conventional I/O pin circuitry on the IC is not sufficient to provide ESD protection under this model. Also, the con- tinuing industry pressure to make smaller and more complex structures makes it very difficult for design engineers even to maintain current levels of ESD protection, let alone improve on them. In other words: the silicon area needed to provide ESD protection in accordance with the SLM is simply not available! For this reason external ESD clamp circuits (see [4], for example) are becoming more rele- vant. If a component provides only a low level of ESD protection (or even none at all) it is possible to add such a circuit at the points most at risk. The clamp circuits usually use so-called transient suppression diodes (transils ortranzorbs) which, like Zener diodes, start to conduct at a specified Figure 4. This protection circuit clamps voltage transients outside defined upper and lower thresholds. 76 | January & February 2014 www.elektor-magazine.com threshold voltage. However, unlike Zener diodes, they react quickly and can withstand much higher current transients. There are many variations on the circuit design, but none has exceptional performance and none offers precise clamping of voltage undershoots and overshoots. State of the art ESD clamping If we are in the lucky position of not having to worry about the last cent of materials cost or the last square millimeter of board area we can easily cre- ate a 'state of the art' active ESD protection circuit from discrete components (Figure 4). The transistor circuit forms a kind of regulated voltage divider. The current through the two resistors R2 and R3 is such that the voltages across them are just enough that transistors T1 and T4 start to conduct and T2 and T3 are just short of saturation. So we have one base-emitter voltage (about 600 mV) across each of these two resistors, which means in turn that the emitters of T2 and T3 are 600 mV below VCC and above ground respectively. The circuit as shown is suitable for a 5 V supply; R1 can be changed to suit supplies of 3.3 V or 2.7 V if needed. What is the point of this complexity? If the I/O pin is high (at +5 V) the upper 1N4148 switching diode will conduct fully as its cathode is at only 4.4 V. If a positive voltage transient should occur it will be conducted by the 1N4148, without switching delay, to the positive rail by 1N5817 Schottky diode D2, which acts quickly and has a low forward voltage. The same thing happens with polarities reversed when a negative voltage transient (below ground) occurs. Hence the digital inputs and outputs are protected against voltage excursions outside the range of the supply rails. In addition, voltage peaks are limited by the use of suppression inductors. The Murata BLM series induc- tor [5] presents a relatively high impedance to signals in the 100 MHz range and so can significantly reduce the level of transients. Although the approach we have described works well with digital levels, it is not suitable for use with signals destined for the analog-to-digital converter (ADC) on a microcontroller. In this case a reverse-biased diode between the signal and each supply rail is required to clamp overshoots and undershoots, with a pair of 10 kQ. series resistors to limit the transient current. The series-connected capacitors C2 and C3 present a low-impedance path for transients between VCC and ground, and hence spikes on the supply rails will also be conducted away. ( 130221 ) Internet Links [1] www.teseq.de/de/de/service_support/technical_information/01_Transient i m m u n ity_testi n g_e . pdf [2] www.ti.com/lit/sg/sszbl30b/sszbl30b.pdf [3] http://www.esda.org [4] www.semtech.com/circuit-protection/esd-protection/ [5] www.murata.com/products/emc/basic/feature/bl_intro.html CD LT) CD > “O 1 _ s'roj^a Upbr*i FS r (J-- Btriiiyrw-ip.r ffniruiri«"i ► ji i nr IiiHi'-’. T li^rr ► [lJ rjrii >ih 'i rp.f. v R gnubli-n.h * [c; nridyDvinu Ljfjt ► L 3 - OKbijg & % H fine lube- grunl sn.n" RtnC-lildfr *" □ i: i-l r s'.ih * uima njneipje* Ltd; int *ii(i Unit irtit, thJf **j»svJ ( Sfinb]in_Kpjfli KVic.piJiVadeClS^U^U: }? rtii+ti>{ RP i b-dlJt 1 tilwiui IK , H 4 l*H> : tltHifraj; U.lvi Ljifti i tdi 1 * , LtMt; Ht-ipm: 0 Kroblsw £] l*s-fci Q (.ortsslt U HroperaES- •f Hi T R 1 1 1 (<: I Cufnuir [RrUyOm'm] imrffcirttf: W.I 4.*- UfHHF jp** -■$ -i»iXflMu.F]d- .YsrfljR^wb-aini.fl- UrtliNri building L ji kvI ; Id “■* OubJd FlnH^id *"* $ *\% : u « rf s* r> "" rf Wfifrblt 3 nfidrf iiHErt 70 : 1 Things have been moving on since the start of our series on Embedded Linux. A second version of the Gnublin/Elektor Linux board has been produced, and we have made improvements to the file system used on the memory card. It is now time to get back to the fundamentals, and in this article we turn to a topic of interest to all users: developing your own applications. First of all we will quickly review the basic architecture of the embedded Linux operating system. The bootloader copies the kernel from the SD card to the processor's working memory and jumps to it. The kernel includes all the basic operating system 'firmware' functions including the scheduler, drivers and so on. Meanwhile the file system hierarchy is used to store all the applications, user data, log files and the like. At start-up a number of different programs are loaded from the file system, and executed. If we want to include our own application among these we need to store it in a suitable place in the directory hierarchy and integrate it into the start-up sequence. When copying the application to the SD card it is necessary to take great care to ensure that the structure of the file system is not otherwise disturbed. Copying the application to the card can be done using a Linux PC and an SD card reader (Figure 1). Alternatively, a PC can be connected to a running Linux board over the network and the file transferred that way. Developing for Linux with Linux The Elektor Linux board is shipped with an SD card which already contains the bootloader, the 80 | January & February 2014 www.elektor-magazine.com C++ and Eclipse sudo picocom -b 115200 /dev/ttyUSB0 console and start the 'picocom' terminal program using the following command: This will establish a connection between the PC and the board via the USB cable and the CP2102 USB bridge chip. If a Windows PC is being used in conjunction with VirtualBox, it must be installed in such a way that the signals from the CP2102 are visible 'on the inside' in the Linux guest operating system. kernel and the file system [2]. Of course, it can happen that the card is lost or the files on it are damaged. And all current users of the first version of the Elektor Linux board will find it worthwhile to create a new SD card: the new file system is much less prone to damage, for example when power is interrupted (see text box). We have developed a graphical tool, 'Gnublin Installer', to help create new SD cards. The text box describes how to use it. Gnublin Installer is a program that runs only on Linux PCs. Even if you do not need to use this program we still recommend using a Linux PC for the development of embedded Linux applications. A good choice is the Ubuntu distribution, as there is plenty of help for beginners available on the Internet for it, and the Gnublin distribution for the board was itself developed using Ubuntu. We described how to install Ubuntu on a PC in the third part of our Linux series [3]. The article also showed how to use the VirtualBox image, specially prepared for Elektor readers by the author and which can be downloaded from the Elektor website [3]. This lets Linux run in a virtual machine, avoiding the need for a full installation of the operating system. For the initial test the board should first be rebooted (by pressing the reset button): the boot process can be followed on the screen of the PC. When the boot process is complete you should see the Gnublin prompt, at which you should enter 'root'. Beginners can now start to familiarize themselves with the basic Linux commands such as 'cd', 'mkdir' and 'cat'. For a A first test As we have mentioned before, there are a couple of steps you can take to test your embedded Linux board (possibly including a new memory card). Connect the board to a PC using a USB cable (Figure 2) and then apply power: the board will automatically start to boot. Now, on the Linux PC, bring up a command line Figure 1. A reader for microSD cards. Figure 2. Connecting to the PC over USB and WLAN. www.elektor-magazine.com | January & February 2014 | 81 •Projects Figure 3. Downloading the Eclipse development environment. The development environment In order to develop our own applications we need to install a compiler and a development environment on the PC. First open a terminal window on the PC and enter the following command: wget http : //gnubli n . org/downloads/eldk- egli bc-i 686-arm-toolchai n-qte-5 . 2 . 1 . tar . bz2 '.■jDrkipjcc Launcher 5titrt t w&ncipie* Eclipse Platform storeiyeijr projects In a folder called a werkspace. choose* workspace folder fo use for this Kiilon. LVorh-s s-a-E-e: \fbatr\*?i j ut e r/ w»r k s- p a «! k Dr-swte Now unpack the archive you have downloaded into the file system on the development computer: sudo tar xjf eldk-egli bc-i 686-arm- toolchai n-qte-5 . 2 . 1 . tar . bz2 -C / Figure 4. Here we select where our project will be stored. Figure 5. Our first C++ project. G Utethu ii the default 4 r>d -do not ail: again t aiwfl little instant gratification you can switch the LED on the board on and off, as described in part 2 of our Linux series [4]. When you have finished experimenting, it is important to power down the board properly using the 'halt' command. Now, when the board is disconnected from the Linux PC, the terminal program will close down automatically and the PC's normal prompt will appear. C++ PrajKt t+J P reject treat* Ct^ preset hd* serened type iPrfijWt narw PfMxyOprnnj i v Uw drf.Hj'l E Inc Jl itin LoctfUtMi: i"l +ji iwi/b-dult i bt/wur kiLid r*|4>tirK> ClwKi a .t j fHi* syMN'm ih’f.mlt lPr»j«-rt typ*! Tsotjhain?! L£>fiNU Al.tutLKjE Crocf qcc: l iiuiv (ICC “ Empty PfB|eci ** HuUo World C++ Pruirel j t Lj?- S-l'Ji '.-'J LiUi ji y i Lfcrary t>* t-U-.H ! J i- | ii p i | h-. : ** Show pttfKt typ** *tid t^chaifU prtlyif they Or* support* d On tfi* platform * B.-ifU 1 r CzmeM This command extracts the contents of the tar archive and installs the cross-compiler in the directory /opt/eldk-5.2.1/, a process which takes a little time to complete. The command requires super-user privileges as the archive is unpacked into T , the root of the file system. If the ready- made virtual machine image is used, the required password is 'elektor'. The next step is to download the 'Juno' version of Eclipse [5]. Only this version (and not the most recent 'Kepler' version of Eclipse) includes the 'cdt tools', an extension to allow the use of Eclipse for C and C++ development. We will use the Linux 32-bit or 64-bit version (see Figure 3). When the download is complete a .tar.gz file will be found in Ubuntu's 'Downloads' folder. Unpack this archive into your home directory using the following commands: cd -/Downloads tar -vxzf ecli pse-epp- j uno-SR2-li nux-gtk . tar.gz -C -/ A small change to the file '.bashre' in your home directory will make it easier to launch Eclipse from a terminal window. Launch the 'nano' text editor: nano -/.bashre and add the following new line to the file: export PATH=$PATH : -/ecli pse Then save the file using Ctrl-0 and exit the editor with Ctrl-X. You should now close the terminal 82 | January & February 2014 www.elektor-magazine.com C++ and Eclipse window that you are using and open a new one. From now on you can launch Eclipse from the terminal by simply typing: ecli pse On start-up you will immediately be asked for a workspace path where a new project will be created. The default path suggested by the system is normally a good choice (Figure 4). Our first project We can now start on our first small application. In Eclipse's main menu click on File -> New -> C++ Project and then select Executable -> Hello World C++ Program and 'Cross GCC' (see Figure 5). We will call our first project 'RelayDemo'. Now open the window shown in Figure 6 where we can set the path to the cross-compiler: Prefix: arm-li nux-gnueabi - Path: /opt/eldk-5 . 2 . l/armv5te/ sys roots/ i 686-eldk-li nux/usr/bi n/ armv5te-li nux-gnueabi The next step is to ensure that the Gnublin C++ library is linked into our project. This library provides an easy way to communicate with the peripherals on the Linux board and expansion boards [2]. The best approach is to download the Git repository that contains a copy of the software archive: it is then very easy to download any updates later. First install the Git version control system: sudo apt-get install git Now switch to a directory where the source code of the C++ API can be kept, and download the source code from the Internet using the following command: git clone https://github.com/ embeddedproj ects/gnubli n-api The two files 'gnublin. cpp' and 'gnublin. h' have to be imported into the Eclipse project, which involves copying them into the project directory. To do this, in Eclipse's 'Project Explorer' on the left click with the right mouse button on the project's src directory, and then select the 'Import' menu item, followed by 'General' and 'File System'. In the window that now appears (see Figure 7) first select the directory from which the files are to be imported: in our case this means the directory 'gnublin-api'. A list of the files in this directory will now appear, from which you should select the files 'gnublin. cpp' and 'gnublin. h'. To update the API at a later date simply switch to the 'gnublin-api' directory in a terminal window and type the command: git pull Network connection Now enter the code from Listing 1 in the main program source code window. The program can be compiled by clicking on the small hammer icon. The status window below will show whether compilation has been successful or not: with luck, no warnings or errors will be displayed there. The file 'RelayDemo' will now be found in the directory ^/workspace/Relay Demo/Debug. This is an executable file which needs to be transferred to the Linux board. One way to do this would be Figure 6. Selecting the cross compiler for our embedded Linux system. Figure 7. The files 'gnublin. cpp' and 'gnublin. h' contain functions that greatly simplify application development. www.elektor-magazine.com | January & February 2014 | 83 •Projects Listing 1: Relay Demo #include "gnublin.h" int main (int argc, char **argv) { gnublin_gpio gpio; gpio . pi nMode (18 , OUTPUT) ; while (1) { gpio. di gi talWri te (18 , HIGH) ; sleep (2) ; gpi o. digi talWri te( 18, LOW) ; sleep (2) ; } } to put the SD card into a card reader attached to the PC and copy the file across. However, especially with larger programs that will undergo a lot of tests and changes, this approach will soon become tedious. It is much more convenient to transfer the program using a network connection. First we have to set up the network connection at the Linux board end. This can be done using its RJ45 wired connection, as described in the previous article in this series [6]; further information can be found at [7]. Even simpler is to use a wireless network (WLAN), using one of the WLAN sticks recommended for use with the Linux board such as the Asus WL-167g V3 (see Figure 2). First connect to the board using picocom as before, and on the board execute the following command: gnubli n-wlan -s networkname -k wl an pas sword -t dhcp The name of the network and the password must not include any spaces or special characters. If it is desired to bring up the network connection automatically when the board is powered up the above command can be added to the file Vetc/ rc. local'. Open the file using nano and add the command before the line that reads 'exit O' (see Figure 8). To test whether the board is connected to the Internet, use a 'ping' command as described previously: ping www.google.com If the gnublin-wlan tool does not work (this was the case, for example, with the Elektor guest WLAN which uses WPA security), further help can be found at [8]. Open an SSH console When the board is connected to the network, its IP address can be determined using the 'ifconfig' command. Now we want to use the network to establish a connection from the PC to the board, using SSH. First we have to set the board's password. On the Linux board type passwd and then enter the same password twice. Once this is done we can connect from the development PC to the board using the following command (replacing 192.168.0.190 with the IP address of your board): ssh root@192 . 168 . 0 . 190 The first time you do this, type 'yes' to confirm the board's fingerprint. Then enter the board's password that was set up above; you should now see a console prompt at which you can enter commands for the board. How to transfer a program First, on the development computer, switch to the directory where the compiled program is located cd ~/workspace/RelayDemo/Debug and then copy the executable file from there to the Linux board: scp RelayDemo root@192 . 168 . 0 . 190 :/ root This will again require you to enter the SSH password you chose previously. The file will now 84 | January & February 2014 www.elektor-magazine.com C++ and Eclipse Create your own SD card The easiest way to create a new SD card is with the 'Gnublin Installer' tool. You will need a Linux PC on which this tool can be installed, an Internet connection (to download the required image files) and an SD card reader. It is possible to use a virtual machine instead of the Linux PC, as long as it uses an Ubuntu or Debian distribution. First go to the website at [11] and download the relevant package (amd64 version for 64-bit systems, i386 for 32-bit systems). Double- clicking on the package file should trigger the installation process. Once the installer is installed it can then be run from the console with super-user privileges (having ensured that the right SD card is inserted in the reader): sudo gnubli n-i nstaller Now select the SD card from the list under 'Select Device' and select 'fetch from http://gnublin.org' for all the options below. Later you can select your own images here. Now click on 'Apply': the process will take a little while, depending on the writing speed of your SD card. The log window shows what is happening in detail. • # ■“ CrfUBLIN InitbLIff llllLdlta &d'.ku|J * * 5*l«t Device I pwHw /Jev/iiMp|in/iryfri.vw..- i.GGB flT tili'.'Pi ElooMohiiffT iiAimtfhJLN}*’ A fetth rre-ir hup ■■vysrubln.e-rs:’ ifs-enie (kfir*) Model Lniux ifemniMijifjeii (uj.'ptj Kernel da no! th.i nyu # hti.p .jfji'qmbl. n.cq/ MwBf (It pi rug dti imr fh^iw A iT-CECh frcT I’KpK/yjpys! i.e-rj; ustrile (fcfir*) b ueard we & £2 MU' a mb Anwemlffii Instotling GHUHLIN... SI.aiC.my imldUdliun... Tlii% iiiiylAldi.e -i fewnmuLtri Unmoynbinfl /^ev/wle i UrirriuunMnrg /d#j/Ldc ;3 CmtiiigptitiberH lkiwnku.dinij .md thee kintf baatlD.idw ril'.i-adifry apes bin md S mdi cheek; ok Ouwailciddii hj diid i >I k«i SkirHj hri nrf D4W4il«4diri4 ktrfKUar. 4 z.m 05 - jnri% r Km.1i ■ nt: Downloading and chocking roc Oewnlaidlng reocfixir.gi.md S mdi check: ok wrlGirvg tnHMlaadtf Mnitnfiru]i iniit (wutJllAn EAtrMctmflFtoeCFS appear within the file system on the Linux board. Connect to the board again using a console and switch to the directory into which we copied the file: cd /root The program can now be run with: board: the simpler but less elegant way, and the more complicated but neater way. The simple method is to add the command to launch the program to the file '/etc/rc. local' before the line that reads 'exit 0' (as we did above for the gnublin-wlan tool). Since the program should be started in the background, you need to add an ampersand symbol to the end of the command: . /RelayDemo You should be able to hear the relay on the Linux board clicking every second. It can be inconvenient to have to enter the SSH password every time you want to copy a file across to the board, and it is possible to avoid this by exchanging keys between the development computer and the Linux board. More about how this is done can be found at [9]. Auto start There are two ways to have an application start up automatically when power is applied to the /root/RelayDemo & U'J [i f igUM IIHmplMIH.M - «! /Pln/iK ■ e r * rc..T.o-tat r rriu icrtpt ti erec-jitfcl il the entf of ckH nuietunr fL.M. ms S>lwc/ tjo*ur irttay^s-fs AAik opirtic MsuM- om4" ovY NjevJ Social /A&d Ounces fW Airiud- lAqAqmh rtf! information v%%, CIRCUIT CELLAR / AUDIOXPRESS / ELEKTOR DESIGNSPARK PCB By Neil Gruending (Canada) Figure 1. A 3D rendering of our example board designed using DesignSpark PCB. DesignSpark Tips & Tricks Day #7: 3D Modeling & Modeling Today we're going to make a 3D view of our example board using DesignSpark PCB and also see how to export our design into DesignSpark Mechanical. These 3D views are very useful when designing a board. DesignSpark 3D Library Introduction DesignSpark will generate a 3D view of a cir- cuit board when you open the PCB file and go into the 3D->3D View menu. Figure 1 shows our example board. DesignSpark was able to create a 3D view even though our library doesn't contain any 3D models because it has default models available based on the PCB footprint name. This is different than other CAD packages where the 3D model is linked to the component in the library, and it means that the DesignSpark's 3D libraries are completely independent from the component libraries. You link the 3D to the PCB footprint name by defining a pattern matching rule in the 3D library, much like a search term or regular expression. You can't use a custom 3D shape (like a STEP model) for a component, but DesignSpark does have a built-in 3D modeling tool that can gen- erate most component shapes. One cool feature of the 3D tool is that it's parametric so that one 3D model can be used for many different real components. For example, one model for a 0.1- inch male pinheader can be used for headers with different pin counts because the number of pins assigned to the model can change with the footprint name. 104 | January & February 2014 | www.elektor-magazine.com Tips & Tricks Creating a Component 3D Model The default SOT23 model used by our transistor doesn't resemble their real physical shape, so let's try making one. We will make a simple model because it reduces the design complexity and it will make it easier to export mechanical files in other CAD programs if DesignSpark PCB supports it in the future. It's also a good guideline to use with other PCB packages because otherwise the exported files can be so large that they're diffi- cult for CAD software to manage. The first step will be to click on the New Item button in the Library Manager 3D View tab. Use "SOT-23-L" for the PCB Symbol Name because that's the symbol used by our transistors. The name needs to be as specific as possible to make sure that DesignSpark will apply our model when it's matching the PCB symbols to 3D models. Fig- ure 2 shows what the Edit 3D Package window will look like after making the necessary changes. I set the Package Style to Shape because DesignSpark will make a best fit area that includes the component silkscreen and pads which it will extend in the Z direction by the Height mea- surement. In this case the height is 1.10 mm which is the maximum component height from the datasheet. The Inside parameter lets you reduce the size of the Shape. In this case I used the value of 0.80 mm to reduce the shape width to expose the component pads. You can calculate this number, but I just estimated it by comparing it to the silkscreen width. An easy way to do this was to click in the preview window and rotate it until I had a view where I could see the shape and silkscreen outline. I also changed the pin style to Gullwing. So now let's save the 3D model, it should look like Figure 3. It's looking much better now except that transistor bodies aren't lined up with the center of the component. Remember how a 3D shape tries to do a best fit over a components silkscreen and pads? In this case there's a pin-1 designator that's far to the left of each transis- tor which is being included by the shape object. To fix it, open the SOT-23-L PCB symbol from the library, delete the pin-1 designator and then update the component in the PCB. The new 3D view would look like Figure 4. Now the transistor bodies are centered but they aren't quite wide enough. Also now all the pins are rendered prop- erly whereas previously one of them was rendered Figure 2. Editing the 3D parameters of the SOT-23-L case. Figure 3. The transistor bodies look more realistic in 3D view now. nvr fm Cte* 3 n$P*rfcPC 6 5.1 a td ny US - iL«0ir« .*'• >31 ijr'i Seen# Bcb ^ ^kiix @U«ID'w®r.pIDF menu. You have to specify the board thickness (1.6 mm) and which layer to use for the component outlines which is usually Silk Screen. Figure 6 shows what it looks like in DesignSpark Mechanical. All of the basic design parameters are there, including component heights and placement even though it doesn't include our component 3D model information. The DesignSpark website has more information about this process in the tutorials found at [1] and [2]. Conclusion Today we experimented with DesignSpark PCB's 3D modeling capabilities. Next time we'll look at some of DesignSpark PCB's other mechan- ical abilities. ( 130303 ) [1] http://designspark.com/eng/tutorial/export- ing-designs-from-designspark-pcb-to-me- chanical-cad [2] www.designspark.com/eng/tutorial/de- signspark-mechanical-importing-electron- ic-designs-pcbs Figure 6. Initial result of importing the 3D model of our example board into DesignSpark Mechanical. 106 | January & February 2014 | www.elektor-magazine.com Join the Elektor Community Take out a GOLD Membership now! SUPRA PIATFl fv \\ 'SS^asSa^ 5- '*^ C*W< me ersnip 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 1 0% DISCOUNT on all products in Elektor.STORE • Direct access to Elektor.LABS • Direct access to Elektor.MAGAZINE; our online archive for members • Elektor.POST sent to your email account (incl. 25 extra projects per year) • An Elektor Binder to store these 25 extra projects • Exclusive GOLD Membership card •Projects W'-Fi Controller Board Control RGB LED strinc 0 a r Q stuff K 1 “ l huh tin* to start thlnkmfl ncout Ma „ H] household Wnowsto Your home Wi-Fi network. Centtulliog you, ho** from you, mobie phono •'M oever been eases fhonkj to lh« uivrena Yn-Ki controller mrsenteci here. Although wt uonfl *loj«tUie colour o< An RGB LtO ttTip, you un ujo tha board for a PMhora ot other applications. *r Clamors Valeras (Uwdor label The project you are about to encounter took a •cruie to complete It ta staitcd a year ago with • Home Automation system (I ) Ottoman, devel- oped by two trainers at tMMor tabs. Keen and lesper. One part of me,r systam was an 000 LtO stop Controlled oyer Ethernet, l.e w*h a cable. The «Se» was row. put I M that a wVtieu connection wrouig be a more appealing sotuuoa Ado. 1 wanted a wep browser harm epoSsatren, rompataie wen most browsers, and that used sMen to control the cnKur M tn< (trie. So Koto set oc* to develoo the It*, but irtortunaue, rut trance penod ended before ha could frish tnr pro)rrt and he went badt tn coaege More he left Itehxor, Keen had erptaned ce me the prob* terns he had run etto, lone of wlsch *11 needed t* 1 hew 3011 1 n ALSO AVAILABLE: The all-paperless GREEN Membership, which delivers all products and services, including Elektor.MAGAZINE, online only. @ektor membership Take out your Membership now at www.elektor.com/member jS •Labs Arduino Yun Bridging Two Worlds? Source: www.arduino.ee By Clemens Valens (Elektor.Labs) The Cloud is where you have to be today. However, to connect to the cloud you need an internet connection, preferably wireless. This is where the new Arduino Yun board can help. Yun means cloud in Chinese and the board is equipped with a Wi-Fi module to connect to it. But the Yun is more than Wi-Fi— it also runs Linux. Arduino on Linux? Linux on Arduino? How does that work? What's on board? Quite a lot, actually. Let's start with what we are familiar with: the Arduino part. Like all Arduino boards the Yun is based on a micro- controller unit (MCU) from Atmel. In this case it is an ATmega32u4 from the 8-bit AVR family. This is the same MCU as the one on the Arduino Leon- ardo board, and the Yun can actually be viewed as a Leonardo with an on-board Linux co-processor a.k.a. Wi-Fi/Ethernet/USB/SD-card shield. This complicated shield is built around an Ath- eros AR9331 chip (we have to trust the Arduino documentation on this as there is no print on the metal shield covering it). According to the data- sheet of this chip, it's a highly integrated IEEE 802. lln lxl 2.4 GHz System-on-a-Chip (SoC) for wireless local area network (WLAN) access point (AP) and router platforms. The heart of this SoC is a 32-bit MIPS 24K processor, which goes to show that you don't always have to use ARM. The SoC communicates with the Leonardo part over a serial link. The Atheros chip provides Wi-Fi connectivity, but it's also connected to an Ethernet connector pro- viding a wired network interface. Furthermore, it has access to an AU6350 single chip integrated USB2.0 hub and multimedia card reader controller from Alcor Micro (mounted on the underside of the Yun board— Figure 1). This chip offers the Yun its USB host connector and micro SD-card slot. The AU6350 communicates over a USB con- nection with the Atheros chip. Summarizing, the Arduino Yun combines— on a single PCB the size of an Arduino Uno 108 January & February 2014 www.elektor-magazine.com Projects (53 x 69 mm)— three processors, a Wi-Fi inter- face, the four Arduino shield extension connec- tors, an Ethernet connector, a female USB-A host connector, a micro USB-B connector, a micro-SD card connector, a bunch of LEDs and three (3) reset pushbuttons. Breaking with traditions All other Arduino boards have Italian and English names, Yun is Chinese. This is not the only nota- ble change; the Yun differs from other Arduino boards in several ways: • The Yun is a far cry from the simple and easy-to-build Uno and earlier boards. The only through-hole parts are the connectors; all other parts are so small you can hardly see them. Repairing a faulty board will be grueling; • I may be mistaken, but the Yun seems to be the first Arduino board for which the hard- ware CAD files are not (yet?) published, thus breaking with the Open Hardware tradi- tion. The schematics are available as a PDF document, but I have not been able to find any information on the PCB. This is proba- bly a 4-layer (or more) design, making DIY Yun boards difficult anyway— not to mention assembling them; • There is no external power supply input— the Yun can be powered from 5 V only; • The Arduino shield connectors have nice labels stuck on them that show which pin is which. There is not enough space on the Yun board to print these labels; • The board sports three tiny reset pushbut- tons, one for the WLAN, one for the Yun and one for the Leonardo, so always make sure you press the right one. Note that the Leonardo and therefore the Yun too exhibit different reset behavior compared to the Uno or related boards. To restart a sketch on the Yun you have to press the reset button twice! • The Yun can be programmed over Wi-Fi and Ethernet (if you set it up properly); • It appears that the design has not been done by the Arduino team but by a Boston-based company named Dog Hunter specialized in home automation control systems. They are probably going to notice an increase in traffic on their unfinished website; • The Yun is manufactured in Taiwan, not in Italy. Specifications Arduino Leonardo (ATmega32U4) with • 20 digital input/output pins (7 of which can be used as PWM outputs and 12 as analog inputs) • 16 MHz crystal oscillator • micro USB connection • ICSP header Atheros AR9331 running Linino, an OpenWRT-based Linux distribution with • Ethernet • Wi-Fi • USB-A host connector • micro-SD card slot • 3 reset buttons While researching and writing this article Intel's Galileo board was launched. This Arduino com- patible board is based on a 32-bit Pentium Quark SoC X1000 Application Processor, yet another new direction for Arduino. Also the Arduino Tre was announced, based on the 1 GHz ARM Cortex-A8 Sitara AM3359AZCZ100 from Texas Instrument. Let's hope that Arduino will not implode under the pressure of complication and diversification. Figure 1. Front and rear view of the Arduino Yun showing the SD card connector and the Alcor Micro AU6350 integrated USB2.0 hub and multimedia card reader controller. (Source: www.arduino.ee) www.elektor-magazine.com January & February 2014 109 •Labs Figure 2. Overview of the Arduino Yun showing the board's subsystems and the way they are bridged together. i 1 • USB Host ATmega 32U4 Rx Bridge A> Linino . Tx Rx AR 9331 < > ◄— SD • 1 Card i USB Prog. A V WIFI ETH Interface Interface ARDUINO ENVIRONMENT LINUX EN 130378 - 11 Getting started Breaking with traditions is one thing, but how does it affect the ease of use of the board? Let's find out. First of all, you need a micro USB-B cable to connect the board. I have hundreds of Mini USB cables, but only one Micro USB cable as part of my phone battery charger. While you are looking for a suitable cable, download in the meantime the Arduino IDE 1.5.4 or later (I downloaded version 1.5.4 r2), it's only 134 MB and you will need it. Install the software before connecting the board. Now connect the board to the computer. On OSX or Linux Ubuntu 10.0.4 and up everything should work straight out of the box. On Windows you may have to install a driver or two. Luckily a Windows installer is available which has the advantage that it can install the necessary driv- ers automatically. If you prefer to do it manu- ally, the drivers are in the drivers folder of the IDE distribution. After connection and installing drivers where needed the board should be operational. On my board this meant that the red LED L13 started blinking irregularly and the green On LED lit up. When, on your computer, you inspect the avail- able wireless networks, you should see a new network named "Arduino Yun-XXXXXXXXXXXX" (where the X's represent hexadecimal characters). You may now be tempted to upload a sketch to the board, but the Guide to the Arduino Yun ('The Guide' from here on) on the Arduino website [1] suggests that you first set up the Wi-Fi connec- tion, so let's do that now. Connect your computer to the Yun Wi-Fi net- work and open a browser. Point it to the address 192.168.140.1 (the suggested link http://ardu- ino. local did not work for me). You should now see a page that asks for a password. The default password is "arduino". Enter it and click on the Log In button. On the Welcome page that opens, click on the Configure button. Set the time zone and select the Wi-Fi network that you want to use in the future, enter its pass phrase, etc. I did not change the default pass- word, because I know I will forget it. I also set the REST API (the API that allows you to issue Arduino port commands as URLs, see below) to open, but that is of course up to you. When done, click Configure & Restart. (Re)Connect your computer to the Wi-Fi net- work that you selected for the Yun and start the Arduino IDE. In the Tools— Board list choose the Yun, in the Tools— Port list pick the very last option "Arduino at xxx.xxx.xxx.xxx (Arduino Yun)" where the x's form a valid IP address (192.168.2.6 in my case). Now you can try out a sketch. Open for instance the Blink (or BlinkWithoutDelay) example and click the Upload button. After compilation you will be prompted for a password. Enter the one you assigned to your board ("arduino" for me since I didn't change it). Uploading of the sketch starts, the board is restarted (you may hear a USB disconnect/connect sound on Windows) and the sketch is executed. Note that you don't have to enter the password every time you upload a new sketch, you have to do it only once at the beginning of a programming session. That was not too bad, was it? It seems a bit silly to program a board that is physically connected to your computer over Wi-Fi, but why not? BTW, it is also possible to use the Ethernet port to do all this, but I leave that as an exercise for the reader. 110 January & February 2014 www.elektor-magazine.com Projects Linux So, now you have an Arduino Leonardo that you can program wirelessly over Wi-Fi or with a cable over Ethernet. However, that was probably not the main reason why you decided to invest in an Arduino Yun board— more likely it was the Linux part that triggered your interest. When you look at the circuit diagram of the Yun you may notice signal labels referring to 'Hornet'. Feeding 'Hornet' to a search engine together with 'AR9331' takes you to OpenWRT, an open- source community project that allows commercial network routers to be used as Linux computers. The Atheros processor on the Yun runs such an OpenWRT-based Linux distribution named Linino. Linino can be configured wirelessly. Enter the Yun's IP address in a browser, log in, and then click on the "advanced configuration panel (luci)" link. This will open a status page from where you can access all kinds of parameters. At the top is a black menu bar with many options. Take your time to browse around. Have a look at the kernel log page to see what happened during start-up. Use the System — Software menu to install or remove software, use the System-Startup to see what is loaded during Linux startup. Here you can also add commands to be executed at the end of the boot sequence. Clicking the "Arduino Web Panel" link at the bottom of each page takes you back to the Yun's homepage. Take me to the bridge According to The Guide, you can access the Arduino pins (or ports) from the browser by typ- ing in the right URL (through the REST API). For example, it is possible to make the URL (replace the first "arduino" by the name of your board) http://arduino.local/arduino/digital/13/l set digital output pin 13 as if you called the Arduino API function di gi talWri te (13 , 1) ; You can also go the other way around and con- trol Linino Linux from within a sketch. This is made possible by the Arduino library "Bridge" that allows you to access the USB, Ethernet, Wi-Fi and SD card devices in a sketch as well as run scripts and communicate with web services on the Linux module (Figure 2). To familiarize yourself a little with the Bridge, 1921 6S.2 .6:22 - Te ra Term VT File Edit Setup Control Window Help fusyEtox vl.19.4 [2013-08^07 16:1b :02 CtoTl built “in shell (ash] inter Wp ? f*r a list of built-in amends. m A \ A \ A \ A \ /:/ V A \ fi:V i A \ /ssT” i /a\ \ /:/ / V:\ \ p 1 I 1 /: i : i i \ /:!:!! 1 J:A:\ V f'J t ft:\ \ /:/!:! i f\:\ \ /:/!=! i /:/ > : \ \ zf / hN / /:/ Is! A V fzf\f / /:/ ill A \ /:/ / \z\ :\~\ A/:/ / V !:!/;/ f A/:/ / V is E/s/ f \:\ \ /-j \i\ \ \::f / !:/;/ / \: if / I:/:/ / \i\ AJ / \:\ \ \:\ \ \:'J / \:\ \ i : : f / \-.\i:! i \:\ \ \f f /:/ / V / /:/ / \::f f \/ / V / V / 4 i r-l“ T ■ 1 ! 1 t I 4 9 1 1 1 _ J i 1 1 ] “ 1 II k 1 i a i i i i II “1 11 II 1 1 1 1 ] 1 i ] :i i i a ini a e i 1 1 _ .! U I K E L E S S F R E E D 0 H otPfirduino: 8 I'd suggest entering the Console example sketch Figure 3. from The Guide. When you compile and upload Welcome to the Linino it to the board, you will be able to use the serial command shell, monitor included in the Arduino IDE to communi- cate with the board (as if it was a normal Arduino board). After receiving the welcome message type a capital 'H' to switch on the red LED L13. Typing an 'L' will switch the LED off. To make things a bit more complicated, you can do this also from a terminal like Tera Term or PuTTY. I used Tera Term and here is how to do it: Open Tera Term. In the New Connection dialog select TCP/IP; for the Host enter the IP address of your Yun. Set the Service to SSH and the Port to 22. Click OK. (You may get a warning about the Host not listed in your cache or something; simply allow whatever the program wants.) Now a new dialog window is opened where you are required to enter a user name ("root") and a Passphrase (the password you set for your board, "arduino" by default). If all goes well you should now see the screen from figure 3 meaning that you are connected. At the prompt ("root@Arduino~#") type "telnet localhost 6571" and hit Enter. Nothing will hap- pen. Nothing? Try typing 'H' or 'L'. With these two commands you can control LED L13. Cool, right? The Guide gives an example sketch that runs a little Linux program named "curl". Before trying www.elektor-magazine.com January & February 2014 111 •Labs Raspberry Pi Looking at the Arduino Yun one cannot help thinking of Raspberry Pi (R- Pi), the $35 Linux board. So how do the two compare? The RPi has been available for over a year now, a large user community has developed and many RPi to Arduino projects have been published together with lots of projects that accomplish the same tasks as those targeted by the Yun. The RPi does not have on-board Wi-Fi, but you can stick a cheap Wi-Fi dongle in its USB port. The RPi has support for graphical displays, the Yun does not. The RPi requires Linux knowledge whereas the Yun does not. The R-Pi does not need a host computer to develop applications on, the Yun does. However probably the most important difference: Yun will cost you twice as much as an RPi the sketch you may want to see its result in the Linux console. At the prompt, type curl http : //ardui no . cc/asci i logo . txt Press Enter and wait a few seconds. You should see appear the Arduino logo in ASCII (Figure 4). The point of this demonstration is to show that whatever you can do in the Linux console, you can also do it from within an Arduino sketch. To be honest, I have tried the example sketch and it compiles and uploads without problems, but I have not succeeded in making the result visible. I must have missed something here. Figure 4. The Arduino logo in ASCII as fetched by curl. _ L92.16S.2.&22‘ Ten Term ot- IS File Edit 5etup Canted Window Help oHihd-JLiic: a cw.L hilt : .'••■'j'r : i Loqc.U* ■ S 1 !• P n ■ i 1 ¥ 9 5 i i l ! 9 ? c 5 -i i J £ 5 5 M i- S 5 h j i »■ 5 I I h F % I I I ! 1 5 Jl I I I H 111! i i.ivni jiviii I'i *33333 I i“ 3 3 3 3 • 3 3 1 if ? ? ? ? i ■ ? iM Feeling lost? I don't know about you, but all this leaves me with a rather strange feeling. On the one hand I have the familiar and extremely simple Arduino IDE running on my PC while on the other I have access— through a browser on the same PC— to a web interface with tons of Linux options. Both programs target the same little blue board lying next to my PC. The Guide almost starts with Python and other— to me unfamiliar— Linux concepts, and I cannot help feeling a bit lost. Why would I use a little microcontroller to run a Linux script if I can run the script also directly on the on-board Linux system? What does the Arduino interface add for the Linux programmer? Arduino is targeted at people with little to no programming experi- ence, yet the user is supposed to know how to control Linux from the command line? It is not that bad. For starters, you can skip the whole Linux bit and just be happy with how the Arduino team configured it for you. Using the REST API you can control the Arduino board from a web application through URLs that you process in your own sketch. Thanks to the Temboo [2] library you can easily interface an Arduino sketch with Twitter, Dropbox, Gmail, MySQL and many more web services. For the more adventurous there is Spacebrew [3], a software toolkit based on Websockets to interconnect interactive things. Once you master the Yun's built-in Cloud support you can go further and install your own programs and utilities on the Linux module to enhance its capabilities and your options. Steep The Arduino Yun is not for beginners. For exam- ple, connecting the board to the Arduino IDE is not Plug 'n' Play at all. And once you get it going you are supposed to use it for client-server web applications. However, once you master all this, the Yun can be an excellent tool to create fun applications. ( 130378 - 1 ) [1] Guide to the Arduino Yun: http://arduino.cc/en/Guide/ArduinoYun [2] Temboo: https://temboo.com/arduino [3] Spacebrew: http://docs.spacebrew.cc/ 112 January & February 2014 www.elektor-magazine.com % What it takes to make an LED blink A Projects ■ 0 f' 0/ SC r ?■ * ?yj v Aj 4 ///// iNUUl r« D % & iX“ U * k J Jt * jCr > v iSV' Vo; m 1 1 ■ r . j o: ‘-KiWnt- fiaar s lul OX jit , fs^i - ’ - * ikj In the Old Days blinking an LED was done with no more than a switch or a tinner IC and the inevitable current limiting resistor added. Nowa- days it seems the amount of electronics needed— or better, used — to perform even the simplest of tasks seems to have grown to extraordinary proportions. Although microcontroller development platforms have become more powerful than ever (look closely and spot the Raspberry Pi and Beagle Bone Black in the pile, both very potent boards, as is the Xilinx Zedboard FPGA dev system), many tutorials faithfully start out with a short lecture on 'switching something' which in most cases boils down to 1 (say, one) LED. Behold, then, the staggering complexity of the systems we work with today. Melancholy strikes and I cannot help reminiscing for a while on the simple life back then. (130417) By Thijs Beckers (Elektor Labs) www.eIektor-magazine.com January & February 2014 113 •Labs Join the Fourth Industrial Revolution! By Clemens Valens Intelligent interconnected objects, devices and machines are revolutionizing the (Eiektor.Labs) world we live in. The world-encompassing network dubbed The Internet of Things (IoT) is expected to change the way we interact with our environment in a dra- matic way. Wireless and energy harvesting technologies are key to make this metamorphosis come about. Eiektor.Labs and its users already jumped the band- wagon— what about you? Wireless Resonant Power for a 2.4GHz Security Camera In this project a wireless security camera is modified to become wireless. And we mean it— no power cord and no batteries either. The power is transferred to the camera by a pair of air-coupled coils (transmitter, receiver) helped by resonant capacitors. http://www.elektor-labs.com/node/3653 Tweeting Freezer OP mvnieuw posted a smart freezer project employing an NXP mbed module not just to to monitor his freezer's 2-digit 7-segment LED temperature display, but also publish its status on Twitter. Of course I became a staunch follower of the OP's freezer; I simply feel uneasy when I don't know how it is doing. http://www.elektor-labs.com/node/3065 Q,c-mor :ms Multi-channel Isolated Smart Energy Meter for Distribution Board Smart Metering and the Smart Grid are two hot IoT / Industry 4.0 topics. OP markusrr is working on such a project. His goal is to monitor his energy consumption in as much detail as possible by individually monitoring every connection to and from the distribution board of his home.B http://www.elektor-labs.com/node/3322 Charge Controller for Off-Grid Systems Quite a number of people are working on alternative power. The problem here is to charge a battery the proper way using power sources like a solar panel or a hydro/wind turbine. OP Chunky is tackling this with a charge controller designed for off-grid battery-based systems at voltage levels of 12 V or 24 V DC and currents up to 20 A DC. http://www.elektor-labs.com/node/3482 Note: OP stands for Original Poster— the person who started an online project or discussion. OPs wishing to qualify for their project being published in Elektor magazine (i.e. on paper) must regularly check the email address they use to access Eiektor.Labs. This is our only means of contact. 114 January & February 2014 www.elektor-magazine.com Projects Where There's Smoke There's Fire Recently the EU Parliament adopted a new Amendment to Article 18 of the Directive of the European Parliament and of the Council on the approximation of laws, regulations and adminis- trative provisions of the Member States concern- ing the manufacturing, presentation and sales of tobacco and related products [1]. If you're still reading after this prolix sentence, this is about the currently popular e-cigarettes and personal vaporizers. This amendment- no. 170— compels a limit of 30 mg/ml of nic- otine in liquids, dictates tht labels must list all ingredients contained in, and emissions result- ing from the use of the product, on vials and instructions. It allows flavors to be used in the products, puts a limit on advertising, sponsor- ship, audiovisual commercial communication and product placement of products containing nico- tine. It prohibits sales to minors, and defines a couple of other details. In short, the latest amendment means the e-cig is still alive and kicking in the EU, even though some political parties tried to re-categorize it as a pharmaceutical product (which was rejected). To cap it all, intelligent regulations and improved quality standards have been set up. One of our former trainees, French Aurelien Mou- lin, came up with the idea to design a personal vaporizer that runs on USB power. Since 'smok- ing' a vaporizer is generally allowed in non-smok- ing areas, this would be an ideal solution for office-resident vaporizer addicts. No more dead batteries and no more deferred satisfaction. Aurelien started working on his project and soon it became apparent it wouldn't be that easy to implement a proper circuit. The vaporizer part needs (a lot) more peak power than a standard USB connection can provide, so he decided to implement two 2.3-volt, 22-farad (!) Goldcap bulk capacitors to soften the current surge and distribute the power drawn from the USB port more evenly. Although he hasn't been able to finish his project within the time set for his traineeship (mainly because of other higher priority projects) the project still lingers in the back of his mind. For the time being, other obligations— again mainly his studies— take up too much of Aurelien's time to continue with this project. It is our sincere wish that someone else, be it a colleague or a Member of our Elektor Labs platform [2], picks up Aurelien's idea and turns it into a usable product. By Thijs Beckers (Elektor. Labs) On a side note: there's this trifling matter of limitations to advertising for and commercial communication about tobacco products as set out in Directive 2003/33/EC and 2010/13/EC. Technically, this design, when finished, doesn't contain any nicotine, but it could be considered a tobacco-related product, to which all the afore- mentioned rules and regulations apply. Food for our attorneys, I guess. ( 130246 ) Internet Links [1] http://www.europarl.europa.eu/sides/get- Doc.do?pubRef=-%2F%2FEP%2F%2F- NONSGML%2BAMD%- 2BA7-2013-0276%2B169-170%2BDOC%2B- PDF%2BV0%2F%2FEN or google 'amendment 170 tobacco'. [2] www.elektor-labs.com www.elektor-magazine.com January & February 2014 115 •Industry Sensirion Joins Atmel's Sensor Hub Platform Ecosystem Sensirion has partnered with leading platform manufacturer Atmel to create an easy-to-use and power efficient sensor hub solution. This relationship allows Sensirion to provide its customers with turnkey sensor hub solutions and enables designers to create smarter, connected devices including mobile devices and wearables. Atmel's sensor hub solutions combine inputs from different sensors, which range from motion sensors to environmental sensors, such as Sensirion's humidity and temperature sensors. These sensor hub solutions not only provide real-time direction, orientation and inclination data, but also now include environmental information, bringing visibly superior performance to a range of applications including gaming, navigation, augmented reality, and contextual awareness. "As devices get smarter and more connected, there is an increasing need for envi- ronmental sensors, such as humidity and temperature," said Johannes Winkelmann, Technology Evangelist, Sensirion. "By partnering with Atmel on their ultra-low power sensor hub solutions, our customers can implement always-on sensor solutions while maintaining low-power consumption to increase the battery life for many of these battery-operated devices." "With the increasing number of sensors in consumer devices today, low power is a key differentiator specifically for battery-powered devices," said Espen Krangnes, Senior Product Marketing Manager, Atmel Corporation. "The platform is the first of many devices in this series that is specifically tailored for sensor hubs. Our ultra-low power and devices features, and the flexible develop- ment ecosystem bundled with the best sensors and sensor software in the market allows customers to create unique and differentiating products. We are excited to partner with key sensor companies in the market to offer the best solutions for our customers." According to market analyst BCC Research, the market for sensors is expected to increase to nearly $91.5 billion by 2016. With more sensors being integrated into mobile, gaming, consumer, wearables, and healthcare devices, there is an increasing demand to offload the application processor with a standalone microcontroller that fuses the sensor data. www.atmel.com/SensorHub www.smart.sensirion.com (130364-IV) Ultra-Low Forward Voltage Schottky Diodes Toshiba Electronics Europe (TEE) has extended its family of surface mount Schottky barrier diodes (SBDs) with a new device CxS15S30 device based on the latest Toshiba semiconductor process, which improves forward voltage and reverse current performance. The CxS15S30 SBD offers 1.5 A and 30 V maximum ratings for average rectified current and peak reverse voltage, respectively. Package options comprise an ultra- compact LGA type CST2C package (CCS15S30) measuring only 1.6 mm x 0.8 mm x 0.48 mm, and a standard SOD-323 package (CUS15S30). Toshiba's new diode will be particularly suited to space-limited applications where high current handling and low forward voltage (V F ) characteristics are key require- ments. The CxS15S30 delivers the high-efficiency operation demanded by battery- powered and other power-sensitive designs. A low typical forward voltage rating of V F = 0.39 V at 1.5 A and the low typical reverse current of only 200 pA ensures lowest loss operation in most common applications such as LED backlight circuits or current backflow prevention in battery charging. Featuring a total typical diode capacitance of just 200 pF means that the CxS15S30 can also be used in general high-speed switching applications. www.toshiba-components.com (130364-1) 116 | January & February 2014 | www.elektor-magazine.com news & new products Gameduino has FTDI Chip's FT800 Graphic Controller Technology FTDI Chip has confirmed that its ground-breaking FT800 Embedded Video Engine (EVE) is a key compo- nent in an exciting new Kickstarter project— the Gameduino2 game adaptor shield from Excamera. In 2011, the Kickstarter-funded Gameduino made major industry impact by successfully bringing vintage gaming to the popular Arduino platform. Now, with the introduction of Gameduino 2, users will be able to transform their Arduino units into modern handheld gaming systems that feature touch control, 3-axis accelerometers, headphone audio outputs and microSD data storage for game assets. In addition, they will benefit from the shield's support of next generation graphics via its built-in 4.3-inch display. The Gameduino 2's graphical capacity, which stems from FTDI Chip's highly- integrated and easy-to- use FT800 IC, is much greater than that of its predecessor, thereby dramatically enhancing the gaming experience that results. Furthermore, its OpenGL-style command set makes programming far simpler to carry out. It can load JPEGs, support alpha transparency and has a full 32-bit color pipeline. Incorporating a 4-wire touch controller and a single channel audio controller that allows midi-like sound quality, the FT800 EVE graphic controller employs an object-oriented approach (where objects are images, fonts, specific sounds, templates, overlays, etc.). This renders images in a line by line fashion with l/16th of a pixel resolution, while still maintaining high-quality graphi- cal representation. It means that system designs based on it are a lot more streamlined - requiring fewer supporting components, less board space, a lower power budget and shorter development times. "With the EVE concept FTDI Chip is looking to change the way in which people interact with everyday technology, by providing the display, audio and touch functionality needed to create innovative new products, while simultaneously being very cost effective and not placing heavy demands on the developers." states Fred Dart, CEO and Founder of FTDI Chip. "Gameduino 2 is a prime example of what can be achieved. We were all very pleased to be involved in this project." www.kickstarter.com/projects/2084212109/gameduino-2-this-time-its-personal (130364-V) Cleverscopes Stream to Disk lfl m ■ E r*i _t_ri l ni v Chiilfoi ■htmIcii cirf»/d Tie -i a k y 1 J - J Wm The latest release of software for Cleverscope includes streaming for the first time! Yes, the folks at Cleverscope have finally ironed out the kinks and you can now stream to hard drive at up to 1.6MSamples/sec for days— just make sure the hard drive is large enough! Update now and give it a try. To get it going, first point to where the files will be saved in File Options. And then set how fast you wish to go in Acquisition Settings. Click on the Stream button... And that's it! Stand back and watch the bits fly. A video on the website shows how to set it up and investigate the resulting output. This software release also allows owners of "A" version Cleverscopes to upgrade to the CS701 Isolated AWG Sig Gen. The CS701 is useful for driving a small signal into the feed- back loop in things such as power supplies, audio power amplifiers, servo amplifiers and positioning systems, and then measuring the resulting correction. By doing this over the operating frequency range you plot gain and phase, and can directly measure the system stability, all while the system is used normally. You need isolation because the feedback loop is not usually ground referenced. Before the CS701 you needed an expensive network analyzer, so give it a go! Cleverscope are working on an option to make setting up for FRA even easier. www.cleverscope.com/videos/ www.cleverscope.com/fra/ (130364-VI) 1 ■ a ^ini I ■ a :£.+*+■ i jiirava iriii ■ hih mm •>-, ■ urn k w =" r* m HfflT I>*wgn. ■****! !►». tfU IP W** ■WfflUl hAf"* »*+*«** \ £*»*2*P*^ 2*m*fc#**Xf ■;-o ■+ fl 4; *.# www.elektor-magazine.com | January & February 2014 | 117 •Industry New Model KPSI 745 Submersible Level Transducer The new KPSI® 745 submersible hydrostatic level transducer is specifically designed with a 3.5" OD allowing installation into 4" pipes to provide precision depth measurement under rigorous environments encountered in slurry or highly viscous applications. The 745 transducer can be ordered with level ranges of up to 115 feet (35m), custom polyurethane or ETFE cable lengths, and optional lifetime lightning protection. A protective cage option is also available to shield the elastomeric diaphragm from impact with suspended solid materials. Measurement Specialties, Inc. designs and manufactures sensors and sensor-based systems. The company, recently ranked No. 76 on the Forbes Top 100 List, produces a wide variety of sensors and transducers to measure precise ranges of physical characteristics such as pressure, force, vibration, torque, position, tempera- ture, humidity, fluid properties, mass air flow and photo optics. Measurement Specialties uses multiple advanced technologies— including piezo-resistive, electro-optic, electro-magnetic, variable reluctance, magneto resistive, digital encoders, thermistors, thermocouples, RTDs, capacitive, resonant beam, application specific integrated circuits (ASICs), micro-electromechanical systems (MEMS), piezoelectric polymers and strain gauges to engineer sensors that operate accurately and cost-effectively in customers' applications. www.meas-spec.com (130364-VII) Microchip: Arduino Compatible chipKIT Ecosystem with Wi-Fi® Development Board, IoT Cloud Software and Motor Control Shield Microchip Technology Inc. announced the expan- sion of its Arduino™ compatible chipKIT™ eco- system, with two new development tools from Digilent, Inc., and an embedded cloud soft- ware framework. Digilent's chipKIT WF32 board minimizes the need for users to purchase additional hardware or shields, by integrating Microchip's 32-bit PIC32MX695F512L MCU with Full Speed USB 2.0 Host/ Device/OTG, its agency-certified MRF24WG0MA Wi-Fi® module and an energy-saving switch-mode power sup- ply that employs Microchip's MCP16301 DC-DC con- verter, along with a microSD card— all while main- taining an Arduino hardware-compatible form factor. Digilent's chipKIT Motor Control Shield enables the development of applications using a wide variety of motor types, including Servos, Step- pers and DCs, while allowing users to take advantage of the extra I/O pins found on many of the chipKIT devel- opment boards. This additional I/O provides added con- nectivity and more features than traditional, lower pin- count Arduino shields. On the software side, an embedded cloud software framework enables designers to easily create "Inter- net of Things" (IoT) applications with the chipKIT WF32. Additionally, Digilent facilitates the rapid development of wireless HTTP server applications, via its comprehensive sample application that supports static pages loaded from the chipKIT WF32's microSD card, as well as dynamically generated Web pages. Hobbyists, makers, students and academics are look- ing for an easy way to add wireless connectivity to their Arduino projects, which is provided by the com- bination of Digilent's chipKIT WF32 base board and its HTTP server example application. This board also provides professional engineers with a rapid method for evaluating Wi-Fi in their embedded designs, and for creating embedded cloud computing services using Exosite. Additionally, as with all chipKIT base boards, the chipKIT WF32 can be connected to Micro- chip's PICkit™ 3 programmer/debugger, allowing users to seamlessly move into Microchip's professional MPLAB® X IDE and XC32 C and C++ compilers. Robotics applications are particularly popular with hob- byists, makers, students and academics. And, their robots are driven by exactly the motor types that the chipKIT Motor Control Shield is designed to support. Digilent's chipKIT WF32 (part # TDGL021, $69.99) and chipKIT Motor Shield (part # TDGL020, $29.95) are both available today. They can be purchased from microchipDIRECT. The chipKIT WF32-compatible embedded cloud com- puting framework, including source code and quick- start information, can be downloaded today from www.microchip.com/get/LS3W. Digilent's HTTP server example application can also be downloaded today from www.microchip.com/get/lV8L. For more information on any of the above products, or for additional chipKIT resources, please visit the chipKIT Community Site, url below. www.microchip.com/get/2T2W (130364-11) 118 | January & February 2014 | www.elektor-magazine.com V 25% OFF CIRCUIT CELLAR Whether it’s programming advice or design applications, you can rely on Circuit Cellar for solutions to all your circuit cellar MCU-BASED COLOR DATA ACQUISITION 51V nftcfeKCU Optra I Cwtmg hnm | TIjh !u ikLv) BMP flUi _ f IwrASftif i drill FJlkwi JOIN TODAY! www.circuitcellar.com/sepN1 3 •Magazine Hexadoku The Original Elektorized Sudoku We ring in the New Year with a fresh installment of our celebrated Hexadoku conundrum for the electronically minded (and/or their spouses). 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 * 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 March 1, 2014, supply your personal details and the solution (the numbers in the gray boxes) by email to: hexadoku@elektor.com Prize winners The solution of the November 2013 Hexadoku is: E75F4. The Eurocircuits $140.00 (£80.00) voucher has been awarded to Christian Basler (Germany). The Elektor $60.00(£40.00) book vouchers have been awarded to Wojtek Stoduly (Poland), Hakan Jonsson (Sweden); Ciril Zalokar (Slovenia). Congratulations everyone! B C F B 8 3 0 9 2 7 A 2 9 l| F B 4 C 8 0 2 5 7 E 6 A 9 5 7 2 B 9 C 9 3 A 0 1 5 7 E 9 5 A 6 3 0 D 2 c 5 8 A B 9 8 F 5 A 6 c 3 D 2 A E 8 7 7 A 3 8 B E 4 9 D 2 C A 8 3 1 E 5 c 0 F 8 B 4 9 8 7 C 6 3 B 9 1 A 8 F 3 5 6 D 7 5 i B 2 8 E 0 D 6 9 C 4 7 A 3 F 3 4 9 A 6 F 7 i D B E 0 8 5 C 2 8 C E 7 A 4 B 5 F 1 2 3 D 0 6 9 0 F D 6 2 9 c 3 5 8 7 A 4 B 1 E 4 D 7 1 B A 8 2 E C 9 6 5 F 0 3 9 3 F E C 7 1 0 4 5 B 8 A 2 D 6 2 5 0 B 9 6 E F 7 A 3 D i 8 4 C 6 8 A C 3 5 D 4 0 F 1 2 E 7 9 B 7 E c 8 D 0 4 9 2 6 F 1 B 3 5 A F 0 6 3 7 1 A 8 B E 4 5 c 9 2 D D 9 1 5 E 2 3 B c 0 A 7 6 4 F 8 A B 2 4 F C 5 6 3 D 8 9 0 1 E 7 B 2 4 9 0 D 6 7 A 3 5 E F C 8 i C A 3 D 1 B 2 E 8 4 0 F 9 6 7 5 E 7 5 F 4 8 9 c 1 2 6 B 3 D A 0 i 6 8 0 5 3 F A 9 7 D c 2 E B 4 The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. 120 | January & February 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@pcspubNnk.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 | January & February 2014 | 121 •Magazine Elektor AC Power Supply ( 1984 ) Rescued from e-debris @ e-labs By Jan Buiting (Elektor Editor-in-Chief) The previous months we've been discussing equipment in the complex, bizarre, rare or expensive categories (tick as applicable— multiple options allowed). Here, we choose to go back to a primary requirement of lots of electronic DIY projects working at low voltages (say, 3 to 20 volts): the al- ternating voltage from the transformer secondary. Smell out the trouble It's not unwise or bold to say that (a) not a lot of electronics works without a proper power supply voltage and (b) that same power supply is the commonest source of failure in vintage equip- ment that's gone faulty. While today problems in circuits are "addressed" the non-invasive way by firmware updates arriv- ing over the web from the helpdesk in Pakistan, in the old days— like 25 years ago— you'd begin with removing fuses, followed by disconnecting the power supply input cabling from the recti- fier section. Next, a thorough visual and olfac- tory investigation of the power supply section. Everything beyond suspicion so far, you'd reinstall the primary fuse and do a few AC voltage mea- surements on what you think are points with the transformer secondary voltage(s) on them. One hand in pocket, if applicable. Good voltage now. Somehow the DC power supply is overloading the transformer, or the raw-DC circuitry is faulty or interrupted somewhere. Where? Bridge rectifier and/or electrolytic reservoir caps (the big cans) are the usual suspects, and a good way to find out is apply external AC to the rectifier inputs, and slowly step up to the nominal value. Professionals and sticklers might argue that a double-isolated variable transformer (variac) is the best way to tackle such cases, not realizing such a beast would be a rare occurrence in the early 1980's hobbyist workshop, let alone under the kitchen table. The crux: you need to carefully step up the voltage to the rectifier inputs, i.e. its AC terminals. Applying judicious measurement in the low-voltage parts of the power supply, this slow-and-careful method will disclose any errors without the risk of smoke, exploding electrolyt- es and more fuses successfully passing the test. Confidence now rules in your workshop instead of anxiety. Enter the adjustable AC Power Sup- ply published in Elektor magazine's April 1984 edition. 122 | January & February 2014 | www.elektor-magazine.com fRet*anic& XL Still @ Labs There can only be three reasons for the tatty looking instrument pictured here to be around in Elektor Labs after almost 30 years: 1. it's fool- proof and easy to use; 2. it's downright useful; 3. it does not contain a microcontroller. I found the little box with its two-tone imitation Tektronix case on Elektor Labs' only general-pur- pose workbench where all sorts of projects get prepped for photography— where chaos reigns and nobody bothers to clean up anything before finding pizza slices with 3 months' worth of free organic growth on them. As it turned out, the instrument I rescued from the e-debris was a prototype that survived count- less moves and equipment clear-outs, and even- tually became an Elektor Labs resident. Thirty years back With the help of Harry Baggen, senior Editor of Elektor's Dutch edition of and a walking ency- clopedia, I was able to trace the publication of the "AC-POWER SUPPLY" (sic) back to the April 1984 edition. I joined Elektor in October 1985. At just three pages the article entitled a.c. power supply (sic) is really trifling compared to some of the blockbusters we've seen in Retronics over the years, and Harry may have forgotten all about it if the actual instrument had not surfaced in our labs. With the original article on my desk, it struck me that the instrument pictured there (Figure 1) was not an exact copy of the instrument I was looking at (introductory photograph). The arrangement of the controls and labels is differ- ent and a black front panel is used on the real thing with the famous diode-k prominent in the brand name 'elektor'. The enclosure with the nice tilt stand appears to be the same though. The most striking variance however is the use on the actual instrument of six banana sockets for the 3-6-9-12-15-18 VAC outputs instead of a single AC OUT socket and a 6-position rotary selector switch as advertised in the article. When I opened the instrument by unscrewing the front and rear panels (Figure 2) I discov- ered the circuitry was built on a 110 x 80 mm piece of veroboard (a.k.a. stripboard; perfboard), while the 1984 article showed a nicely designed 110 x 45 mm printed circuit board. I have not undusted the inside. IESF 20041 Retronics is a monthly section covering vintage electronics including legendary Elektor designs. Contributions, suggestions and requests are welcome; please telegraph editor@elektor.com This leaves me with the question why the instru- ment has an artsy-techno black front panel of which the design was never published. No one on the current staff knows. The style closely resem- bles that of the 1977 ElektorScope. www.elektor-magazine.com | January & February 2014 | 123 •Magazine I have not checked the veroboard construction against the circuit as published in the magazine in 1984, but they appear identical functionally and in terms of components used. Note that 1-meg- ohm resistor soldered directly across pins 3 and 5 of the CA3140. How it worked— and works Compared to DC adjustable benchtop power sup- plies, AC variants are rare, probably because we assume that the AC power transformer is a reli- able component and while expensive, is easy to replace. However there are many situations in 1 © © Trl -1**- MV* mv 1 W rvft jyassri which you want to be in accurate control of the AC voltage applied to a power supply, like when the CEO or Lab Manager want you to be accurate about the minimum or maximum input voltage to a DC regulator. Silently I was hoping for the circuit to provide an adjustable, stabilized output voltage, but instead it has selectable 3-volt steps from 3 V AC to 18 V AC directly off a transformer secondary. The built-in current limiter though is adjustable though with a control on the front panel, so my fuses can remain in their boxes. The instrument shown here can be adjusted from about 0 to 1.5 amps. The schematic is reproduced in Figure 3. The output current drawn from Trl is sensed by Rl, and the resulting pulsed DC voltage drives the current limiter circuitry around IC1. Note that this circuit is powered separately from Tr2, D1-D4 and IC2. IC1 compares a fixed (ermm...) voltage at its pin 2 with that developed across Rl, where the former voltage is adjustable with the pair of preset PI for the maximum output current, and potentiometer P2 for the continuous adjustment between 0.2 A up to the maximum. The maximum current is obviously dependent on the transformer used in position Trl— the 1984 article suggests a 60 VA multi-tap type. As soon as the current draw on the output exceeds the level set on P2, the output of comparator IC1 toggles, causing Thyristor Thl to be fired through R6-R7. Con- sequently the coil in relay Rel is energized and the primary current to Trl is cut off through the X-Y contact. LED D6 also lights to indicate an overload condition has occurred needing inves- tigation followed by repairs! The thyristor will remain conductive even after the gate pulse has passed; meaning the only way to reset the circuit and restore the output voltage is to press SI— after clearing the (disastrous) cause of the current limiter action of course! Although rotary switch S3 is duly specified at 5 amps in the parts list, I much prefer the six discrete banana sockets on the instrument as I have it. A fine little instrument I'd highly recommend systematically substitut- ing faulty, suspicious, unfathomable or "beyond- Ebay" subassemblies of electronic circuits by Known Good BoatAnchors (KGBs). Doing so is highly educational and cheaper in the end than forever replacing new parts that blow due some other part having blown due to reasons beyond you. Elektor's 1984 AC Power Supply is now safe from harm, and a KGB on my Retronics workbench. To celebrate the arrival the original 1984 (!) article is available as a .pdf file for free downloading by all fans of AC [1]. ( 130367 ) Internet Reference [1] a.c. power supply, Elektor April 1984, www.elektor-magazine.com/130367 124 | January & February 2014 | www.elektor-magazine.com Gerard's Columns# Pro-Tronics By Gerard Fonte (USA) Last month I talked about what it was like as hobbyist fifty years ago. This month I'll look into the future to see what the next fifty years will bring. Hardware Starting easy: solid state drives will / replace magnetic as well as optical drives. CDs and DVDs will go the way of the vinyl record. It may still be possible to buy hard copies of audio and video recordings, but they'll just be chips. The 3-D printer will revolutionize PCB (Printed Circuit Board) pro- to-typing with the use of conductive polymers. This makes "plated"- through-holes and two-sided boards easy. There will be no more soldering. Components will be attached with conductive polymer glue. By the way, check out 3M's Z-axis adhesive tape (9703). It only conducts through the tape— top to bottom, not side to side. So, if you want a quick and easy way to attach a 100 pin TSSOP IC to your PCB, you might consider this. (Unfortunately, the AC electrical specifications aren't well defined by 3M.) Batteries will disappear to be replaced with capacitors. Aerogel tech- niques have created capacitors with staggering values in a very small volume. I have a 2600 farad capacitor (that's right 2.6 Kilo-farad!) that's about the size and weight of a soda can (full). Capacitors (for hand tools) can be re-charged in 90 seconds and up to 500,000 times (versus 90 minutes and 500 times for conventional batteries). Cole- man (USA) and GMC (Australia) have attempted to introduce the tech- nology with screwdrivers but consumers don't want to pay $100 for a cordless drill, even if it means no more batteries to buy. Toyota is experimenting with capacitor assist in its Yaris Hybrid-R concept car. Expensive power transformers may be replaced with components that operate directly from rectified 120 VAC household voltage. (That's 170 volts DC for bridge rectified and about half of that for half-wave.) There are plenty of inexpensive power MOSFETS that operate at 250 volts or more. Linear Technology has an op-amp that runs off of 140 volts (LMC6090) for about $4.00. Of course, off-line switching supplies will also be in general use. Communication Conventional local broadcast TV and radio will be gone. That's not to say that TV and radio will disappear. It's those multi-kilowatt trans- mitters that will fade away. The internet will carry the programs and music instead. Many radio stations already "broadcast" on the web. The ether will become quieter but will be much more active. Hard-wired installations will be rare. Low-power cell-like commu- nications will even replace fiber-optic cables for TV and internet. I wouldn't be surprised to see a resurgence in amateur (Ham) radio on some of the frequencies left open by radio and TV. Your cellphone will hold all your important records. This includes credit card numbers, medical information, driver's license, passport, insur- ance data, resume and everything else. But since people are always misplacing their phones, this actual data will be attached to you; like a wristwatch. It will communicate to your actual cellphone with a very short-rage, encrypted transceiver. It's possible to put everything on your wrist, but that's too small to be convenient. (Remember those early digital watches with the built-in calculator and very tiny but- tons?) Biometric sensors will make your data useless to anyone else. Of course, this means death to cash. Money, credit cards and checks will no longer be used. Direct fund transfer from account to account will be the norm. Electronic receipts will be generated and all trans- actions will be recorded. In fact, it's very possible that non-electronic transactions may be banned by the government because they can't be traced and taxed (especially taxed!). Cash may only be found in the black market. The good news is that filling out your income tax forms will also be obsolete. Filing will be done automatically at the push of a button since all of your financial records are immediately available. Home The current method of electrical wiring is to cut the power cable at every outlet or switch box and then reconnect the wires together to continue on to the next outlet or switch box. It's really a rather silly technique. In the future, the power cable will be clamped at the box and insulation displacement connections will be made by simply tightening the clamp with screws. Fast and simple with no cutting of the wire. Insulation displacement has been around for a long time and is very successful. I think the biggest impediment is probably the archaic building codes. Your roof (the southern facing part) will be made from flexible pho- tovoltaic "shingles". They will be automatically self-connected during installation. Being flexible, they won't crack from expansion/con- traction and will weather the weather well. (PowerFilm Solar, Silicon Solar and others already manufacture flexible panels.) The use of distributed solar power generation will significantly reduce atmo- spheric carbon emissions. The last item is not electrical but does play an important role in energy conservation. This is the use of foamed concrete as thermal insula- tion. It's cheap, effective, insect repellent, non-toxic, non-flammable, water resistant, sound damping and increases the structural strength of walls. Check out AirKrete for more information. Print Lives I think Elektor (or its equivalent) will still be around because hard- copy is just too convenient to disappear. And electronic hobbyists will always want to learn and do. So, if I'm not there in fifty years— feel free to start without me. And let me know how it turns out. ( 130418 ) www.elektor-magazine.com | January & February 2014 | 125 •Store @lektor * Pi j41.il.” -q hvLFTlliri:| * 5im^ [ilrjfUiftl h^ll * I:' Mil uwy r (.ilmMn * L.;mp'?> Apdnqliknj hjf HJwri Ifmmui I JUBft 15°/o DISCOUNT for GREEN and GOLD Members! www.elektor.com/january Circuits & Projects Guide E 1 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 manner, guiding into various theme areas. In the coverage of must-know theory great attention is given to practical directions users can absorb, including essential programming techniques like A/D conversion, timers and interrupts— all contained in the hands-on projects. In this way readers of the book create run- ning lights, a wakeup light, fully functional voltme- ters, precision digital thermometers, clocks of many varieties, reaction speed meters, or mouse controlled robotic arms. While actively working on these projects the reader gets to truly comprehend and master the basics of the underlying controller technology. 260 pages • ISBN 978-1-907920-25-7 £34.95 • € 39.95 • US $56.40 Learning to fly with Eagle f EAGLE V6 Getting Started Guide This book will quickly allow you to obtain an overview of the main modules of EAGLE: the schematic editor; layout editor and autorouter in one single interface. You will apply your knowledge of EAGLE commands to a small project, learn more about some of the advanced concepts of EAGLE and its capabilities and understand how EAGLE relates to the stages of PCB manufacture. After reading this book while practic- ing some of the examples and completing the proj- ects, you should feel confident about taking on more challenging endeavors. 208 pages • ISBN 978-1-907920-20-2 £29.50 • € 34.50 • US $47.60 Display, buttons, real time clock and more i Elektor Linux Board Extension This extension board was developed to further propel our Embedded Linux series of articles and the match- ing GNUblin board. It has a display, buttons, a real time clock and 16 GPIOs. Linux devotees, switch on your solder irons. The Linux extension board includes everything needed to provide the user interface for a wide variety of projects! Module, SMD-populated and tested board, incl. LCD1, XI, K1-K4, BZ1, BT1 for home assembly Art.# 120596-91 £31.10 • € 34.95 • US $50.20 The luxury of precision within everyone's reach E3 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 140 Minutes video presentation and more _ DVD Feedback in Audio Amplifiers In this Masterclass we address several aspects of feed- back in audio amplifiers. The focus of this Master- class, although not entirely math-free, is on providing insight and understanding of the issues involved. Presenter Jan Didden provides a clear overview of the benefits that can be obtained by feedback and its sib- ling, error correction; but also of its limitations and 126 | January & February 2014 | www.elektor-magazine.com Books, CD-ROMs, DVDs, Kits & Modules G «rhgrd H. kJialt & e| Ai fiifnMI Ml FAKE and Courwlltii Cards k %|b!lon disadvantages. Recommended to audio designers and serious audio hobbyists! ISBN 978-907920-16-5 £24.90 • € 29.95 • US $40.20 Taming the Beast E FPGA Development Board FPGAs are unquestionably among the most versatile but complex components in modern-day electronics. An FPGA contains a maze of gates and other circuit ele- ments that can be used to put together your own digital circuit on a chip. This FPGA development board (designed in the Elektor Labs) shows how easy it is for any electron- ics enthusiast, whether professional or amateur, to work with these programmable logic devices. Module, ready build and tested Art.# 120099-91 See www.elektor.com/fpgaboard 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, aiming to show how personal applications can be programmed. A wide variety of applications is presented based on a solid number of hands-on examples, covering anything from simple math programs, reading sensors and GPS data, right up to programming for advanced Internet appli- cations. Besides writing applications in the Java pro- gramming 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 $56.40 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 usingany.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 £44.90 • €49.90 • US $72.50 A Small Basic approach ID 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 quickly. 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. Therefore 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 £29.50 • € 34.50 • US $47.60 www.elektor-magazine.com | January & February 2014 | 127 •Store Wireless and button-free Android * Elektorcardioscope Instructive, fascinating, and potentially useful to everyone: perform your own electrocardiograms on your Android smartphone or tablet! The project involves skillfully combining a small PIC interface to control an analog input stage with a great deal of software. Our ECG interface is available in the form of a ready- to-use module to which you just have to add four electrodes and an Android application for smartphone or tablet; there's no physical connection between this terminal and the interface, as it uses Bluetooth com- munication! Ready assembled board Art.# 120107-91 See www.elektor.com/elektorcardioscope 110 issues, more than 2,100 articles . DVD Elektor 1 1990 through 1999 This DVD-ROM contains the full range of 1990-1999 volumes (all 110 issues) of Elektor Electronics mag- azine (PDF). The more than 2,100 separate articles have been classified chronologically by their dates of publication (month/year), but are also listed alpha- betically by topic. A comprehensive index enables you to search the entire DVD. What's more, this DVD also contains the entire 'The Elektor Datasheet Col- lection 1...5' CD-ROM series, with the original full datasheets of semiconductors, memory ICs, micro- controllers, and much more. ISBN 978-0-905705-76-7 £69.00 • € 89.00 • US $111.30 Concept, implementation and assessment E Designing Tube Amplifiers This book looks at tube amplifiers from more than just a theoretical perspective. It focuses primarily on the design phase, where decisions must be taken with regard to the purpose and requirements of the ampli- fier, and it addresses the following questions: How do these aspects relate to subjective and objective criteria? Which circuits sound the best, and why? If you want to develop and market an amplifier, what problems should you expect? What are the signifi- cance and meaning of measurements? Are they still meaningful, or have they lost their relevance? Thanks to the enormous processing power of computers, we can now measure more details than ever before. How can these new methods be applied to tube amplifi- ers? Menno van der Veen will give you all the answers! 188 pages • ISBN 978-1-907920-22-6 £29.50 • € 34.50 • US $47.60 Helped By Arduino [ 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 $56.40 128 | January & February 2014 | www.elektor-magazine.com Books, CD-ROMs, DVDs, Kits & Modules Display, SD card, Ethernet, RS-485, buttons and LEDs E XMEGA Web Server Board This microcontroller board is particularly well suited to monitoring and control applications. The plug-in TCP/IP module allows you to implement a web server and other network-oriented applications and a microSD card provides mass storage. Four LEDs, four buttons, and a removable display provide the user interface options. And of course the board comes with a wide range of external interfaces. Controller Module Art.# 120126-91 See www.elektor.com/xmega , Process Measurements 1 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 technigues. 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 £24.50 • € 27.50 • US $39.50 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 minimum mathematical treatment and teaches the reader how to design and implement DSP algorithms using popular PIC microcontrollers. The author's approach is practical and the book is backed with many worked examples and tested and working microcontroller programs. The book should be ideal reading for students at all levels and for the practicing engineers who may want to design and develop intelligent DSP based systems. Undergraduate students should find the theory and the practical proj- ects invaluable during their final year projects. Simi- larly, 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 £44.90 • € 49.90 • US $72.50 Further Information and Ordering: WWW. el ektor.COm /store or contact customer service for your region UK/ ROW Elektor International Media 78 York Street London - W1H 1DP United Kingdom Phone: +44 20 7692 8344 E-mail: service@elektor.com USA / CANADA Elektor US 111 Founders Plaza, Suite 300 East Hartford, CT 06108 Phone: 860.289.0800 E-mail: service@elektor.com USA www.elektor-magazine.com | January & February 2014 | 129 •Magazine NEXT MONTH IN ELEKTOR MAGAZINE Small Audio Output Stage A small audio power amplifier with a modest ability but still good specifications is a handy circuit for a variety of audio applications. Just think of an active two-or three-way speaker system, in which the power amplifiers are in- corporated in the box together with the power supply. The amplifier is based on a number of classic schematics with proven guality. The design is compact and offers space for your own extensions. Precision Adjustable DC Current Source An adjustable current source is a handy tool for testing diodes, zener diodes and LEDs to men- tion just a few parts. Provided it is sufficiently accurate, the instrument should also allow you to determine the brightness of an LED or to record the voltage-current characteristic of a zener diode. Our instrument has 20 measuring ranges of 10 nA to 20 mA and also has a built-in digital 3V2-digit voltmeter with two ranges. Mini Breadboard Modules Many electronics designers use a breadboard to build a circuit, so they can experiment extensively. In doing this you often have to replicate the same sub circuits over and over again. That can be avoided by using a number of standard modules that fit on virtually any breadboard. This way you can create a power supply, a microcontroller, ora display, and eas- ily add it to a circuit. Article titles and magazine contents subject to change, please check www.elektor-magazine.com for updates. Elektor March 2014 is processed for mailing to US, UK and ROW Members starting February 17, 2014. See what's brewing @ Elektor Labs 24/7 Check out www.elektor-labs.com and join, share, participate! elektor Sharing Electronics Projects Home Pn>posa-& FiniS-TM e lektor PCB rvic Cjgwyrqd by Curpcirmil* WWW " lekturpcbservice com Proposal* Adtive Popular In Progress Popular Finished ! Active Popular akktor Afduhnr^lfr-BlHjow- F pc q u c n cy - Do ta km g e r ***** nuniition Anfui no Clock and Thermometer I120T40-I] S.iM,™ ***** Ef«ktOT.PD5T-NO.£ {LED Eaninul u.MSv: V j ■ J . i , Joil a-' labs I**™ ) About Elektor. LABS E'tHlD ia r— — ID * * f j Cm* j Create a Rrojact CivdUa g n«Hf uriri«Ll.ui untup a uruwjbal G 7 L hi*, fmrihHfr E'i Vfftitf fiw rihiir vi elat. nrn rv^rp wsi A n wt EieUreriirt HmU Not o member? Yau want U> pott A ftffiject but yfru are not a member? T/fiCC Click here w send a deserlHlon of mir pro)«t i ncl uding a circuit diagram end a photograph tor rwjliijitinri ,TjkJ rrij] ynu will be granted 130 | January & February 2014 | www.elektor-magazine.com Technology WHY COMPROMISE SPEED v ACCURACY? HAVE T ALL Channels Bandwidth All modes: 60 MHz 8 to 15-bit modes: 100 MHz 16-bit mode: 60 MHz 8 to 15-bit modes: 200 MHz 16-bit mode: 60 MHz Sampling rate - real time 2.5 GS/s 5 GS/s 10 GS/s Buffer memory (8-bit) * 16 MS 32 MS 64 MS 128 MS 256 MS 512 MS 1 Buffer memory (> 12-bit)* 8 MS 16 MS 32 MS 64 MS 128 MS 256 MS | Resolution (enhanced)** 8 bits, 12 bits, 14 bits, 15 bits, 16 bits (hardware resolution + 4 bits) Signal Generator Function generator AWG Function generator AWG Function generator AWG 1 PicoScope 5444A PicoScope 5443B PicoScope 5444B PicoScope PicoScope 5442A PicoSco 5442 r PicoScope 5443A [ - H-' £33 f ■ ' v ‘ \ Tf *4 pico' 2 Channel models also available * Shared between active channels ** Maximum resolution is limited on the lowest voltage ranges: ±10 mV = 8 bits • ±20 mV = 12 bits. All other ranges can use full resolution. FLEXIBLE RESOLUTION OSCILLOSCOPE ALL MODELS INCLUDE PROBES, FULL SOFTWARE AND 5 YEAR WARRANTY. SOFTWARE INCLUDES MEASUREMENTS, SPECTRUM ANALYZER, SDK, ADVANCED TRIGGERS, COLOR PERSISTENCE, SERIAL DECODING (CAN, LIN, RS232, l 2 C, PS, FLEXRAY, SPI), MASKS, MATH CHANNELS, ALL AS STANDARD, WITH FREE UPDATES. www.picotech.com/PS239 CAD CONNECTED “ism m.tvn J V ' V .S . Featuring a brand new application framework, common parts database, live netlist and 3D visualisation a built in debugging environment and a WYSIWYG Bill of Materials module, Proteus 8 is our most integrated and easy to use design system ever. Other features include: . Hardware Accelerated Performance. . Board Autoplacement & Gateswap Optimiser. . Unique Thru-View™ Board Transparency. . Direct CADCAM, ODB++,, IDF & PDF Output. . Over 35k Schematic & PCB library parts. . Integrated 3D Viewer with 3DS and DXF export. . Integrated Shape Based Auto-router. . Mixed Mode SPICE Simulation Engine. . Flexible Design Rule Management. . Co-Simulation of PIC, AVR, 8051 and ARM MCUs. . Polygonal and Split Power Plane Support, . Direct Technical Support at no additional cost. Lab center Electronics Ltd, 21 Hardiy Grange, Grassington, BD23 5AJ, Teh +44 (0)1756 753440, Email: info@labcenter.com Registered in England 4692454 E E