^ worldwide miciibdintiroil discovered 9 770268 45114 2 www.elektor.com January 2009 “ J w PC Oscilloscopes <& Analyzers BitGen DSP Waveform & Timing Generator for USB BitScope 100 Powerful waveform generation & mixed signal data capture in one low cost USB test instrument. Digital Storage Oscilloscope Dual Channel Digital Scope with industry standard probes or POD connected analog inputs. Fully opto-isolated. Mixed Signal Oscilloscope Capture and display analog and logic signals together with sophisticated cross-triggers for precise analog/logic timing. Multi-Band Spectrum Analyzer Display analog waveforms and their spectra simultaneously. Base-band or RF displays with variable bandwidth control. Direct Digital Synthesis Generator Arbitrary waveform crystal referenced DDS frequency synthesis. Microsecond one-shot timing precision and burst generation. Independent but sample synchronized with BitScope capture. Noise, Dither and Entropy Generator Pseudo-Random Number noise, dither and entropy generation. White, pink or binary with programmable or random seed. Voltage, Clock and Logic Generator Programmable voltage, clock and serial logic generation. Adjustable DC reference and mark/space clocks to 5MHz. Logic level shifting and probe calibration signals. BitGen is a comprehensive DSP based waveform and timing generation solution available as standard in BS100M or an option for BS100U. From clocks, sine, square or triangle waves to sophisticated bursts, chirps, noise or user programmable signals, BitGen supports them all. www . bitscope . com EasyPlC is a world-class tool that enables immediate prototype design... IN-CIRCUIT pmxinAMHLn PIC Ut^hLUI'M±m BOARD User-Friendly PIC development system Thanks to many new features, you can start creating your great devices immediate- ly. supports 8-, 14-, 18-, 20-, 28- and 40- pin PIC microcontrollers (it comes with the PIC16F887). The^^^^^ (Hardware In-circuit Debugger) enables very efficient step by step debugging. Examples in H and^^^^^M language are provided with the board. EasyPIC5 comes with the following printed documentation: EasyPIC5 Manual, PICFIash2 Manual and mikrolCD Manual. Also EasyPIC5 is delivered with USB and Serial cables needed for connecting with your PC. I 1 " Evolving product features and modern input design require the use of touch screens. The b with connector available on EasyPIC5 is a \ with the ability to display and receive information on the V, same display. It allows a display to be used as an input iKt device. Simple installation onto the face of a GLCD for easy a"-, connection to EasyPIC5 board with built-in Touchscreen I Controller and Connector. i mikrolCD - Hardware In- Circuit Debugger on-board enables easy debugging High-Performance USB 2.0 On-Board Programmer SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD mikroElektronlka A. J DEVELOPMENT TOOLS I COMPILERS I BOOKS Find your distributor: UK, USA, Germany, Japan, France, Greece, Turkey, Italy, Slovenia, Croatia, Macedonia, Pakistan, Malaysia, Austria, Taiwan, Lebanon, Syria, Egypt, Portugal, India, Thailand, Taiwan, Czech and Slovak Republic. http://www.mikroe.com/ RF meets micro As announced in our Publishing Plan, this January 2009 issue has a focus on wireless technologies. Over the past few decades, the noble art of RF circuit design, repair, expe- rimenting and manufacturing has gradually declined and now seems to have 'niche' status. As many companies have come to recognise, proper RF design is a costly affair because, we are told, "old guys sit in front of expensive gear". The younger generation, totally at ease with cellphones and WiFi and not having the faintest idea what's actu- ally being radiated and received, seem indifferent about what was once a bustling area in the large field of electronics. A Smith Chart, WG16, a pi match, a balun, stray inductance or a padding C are now 'weird things' to a whole generation of embedded system programmers, managers and IT specialists, none of them called Pat Hawker. Con- sequently, there is now a painful shortage of qualified RF design engineers, and lacking coordinated incentives from European Universi- ties and Colleges the whole profes- sion seems to have moved to India, the Far East and other low income countries where RSGB handbooks are still prize possessions. Some of the RF circuitry seen in today's consumer electronics, like radio-controlled toys, is really appal- ling and hopefully not an example for the few young people wishing to start a career in 'radio'. On the other hand, there is an interesting trend to consider a transceiver for the 'xyz' frequency band a "module" with inputs for digital or analogue signals, and pins or cop- per pads for the supply voltage and of course the antenna connection. Inside the module are miniature RF bits you can happily take for gran- ted, as all the design work, testing and ETSI/FCC type approval has been done for you. This 'wireless' issue of Elektor has a few articles on how such modules can be interfaced to (AVR) microcontrollers to build RF links for data and (digital) audio traffic. The 868 MHz modules are license exempt, and to encourage all of you with a (totally unfoun- ded) fear of RF we are selling them through our shop. Old hand at RF or not, let us know how you fare with these modules and do show us your applications. Jan Buiting Editor lektor lectronics worldwide Radio for Micros There is plenty of cable in the world, most of it tangled up behind various pieces of equi- pment. An alternative is data transfer using low-cost radio modules, which are easy to connect to a microcontroller. We have tried this out using two ATmega microcontrollers programmed using BASCOM-AVR, hand- ling near-simultaneous transmission and reception. 28 Three-dimensional Light Source Everyone will have encountered a 2D LED matrix at some time, but the version described here is of a completely different calibre: namely five matrices stacked together into a cube; a true 3D matrix therefore, every LED of which can be switched on and off individually. CONTENTS Volume 35 January 2009 no. 385 RFID allows for non-contact reading and is effective in manufacturing and other hostile environments where traditional identification technologies such as bar code labels could not survive. Having its radio origins in LF and HF bands like 1 35 kHz and 1 3.56 MHz, RFID is now rolled out to UHF, too. We investigate. 62 Capacitive Sensing and the Water Cooler Here we show how the controller managing capacitive sensing can take on additional functions, to add further value to customers, as well as reduce maintenance expenses. To put it all in practice, Elektor has two CapSense evaluation kits on offer for you. Moving up to 32 Bits We're now entering a phase of one of the most significant changes in embedded product development in the last 20 years - the advent of affordable 32-bit microcontroller technology. The ECRM40 module and Flowcode for ARM are the perfect introduction. roiects 28 Th ree-dimensional Light Source 34 Rad io for Microcontrollers 4 ( Meeting Cost Timer 52 l 2 C Kernel for ATtinyl 3 and '23 1 3 56 ATM1 8 on the Air 66 Moving up to 32 Bits 70 BASCOM AVR Course (5) 74 Design Tips: Low-power crystal oscillator Store it quickly! technolo 22 DBPSK! ODFM! DVB! QAM! 46 RFID goes UHF 62 Capacitive Sensing and the Water Cooler info & market 6 Colophon 8 Mailbox News & New Products Elektor Live! 6 ’ Electrical Safety page 80 Elektor SHOP Sneak Preview infotainment 20 The Discovery of Homo Radiens 76 Hexadoku 77 Retronics pWatch: return of the scientific calculator watch ELECTRONICS WORLDWIDE elektor international media Elektor International Media provides a multimedia and interactive platform for everyone interested in electronics. From professionals passionate about their work to enthusiasts with professional ambitions. From beginner to diehard, from student to lecturer. Information, education, inspiration and entertainment. Analogue and digital; practical and theoretical; software and hardware. .iMtrmiJci lancin Volume 35, Number 385, January 2009 ISSN 1 757-0875 Elektor aims at inspiring people to master electronics at any personal level by presenting construction projects and spotting developments in electronics and information technology. Publishers: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 www.elektor.com The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor is published 1 1 times a year with a double issue for July & August. Elektor is also published in French, Spanish, German and Dutch. Together with franchised editions the magazine is on circulation in more than 50 countries. International Editor: Wisse Hettinga (w.hettinga@elektor.nl) Editor: Jan Buiting (editor@elektor.com) International editorial staff: Harry Baggen, Thijs Beckers, Ernst Krempelsauer, Jens Nickel, Clemens Valens. Design stc Antoine Authier (Head), Ton Giesberts, Luc Lemmens, Daniel Rodrigues, Jan Visser, Christian Vossen Editorial secretariat: Hedwig Hennekens (secretariaat@elektor.nl) Graphic design / DT Giel Dols, Mart Schroijen Managing Director / Publisher: Paul Snakkers Marketing: Carlo van Nistelrooy Customer Services: Anouska van Ginkel Subscriptions: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 Internet: www.elektor.com 6 elektor - 1/2009 Masterclass High-End Valve Amplifiers \ Specifically for audio designers, audiophiles, DIY enthusiasts etc. In this Masterclass Menno van der Veen will examine the predictability and perceptibility of the specifica- tions of valve amplifiers. Covered are models that allow the characteristics of valve amplifiers to be explored up to the limits of the audible domain from 20 Hz to 20 kHz. This then leads to the minimum stability requirements that the amplifier has to satisfy. The coupling between output valves and output transformer are also modelled. This gives new insight into a unique type of distortion: Dynamic Damping Factor Distortion (DDFD). Negative feedback is often used in amplifiers. What is the optimum and what are the audible consequences? The correct amplification of micro details is explained, based on new research, and new models about this are presented. Presenter: Menno van der Veen, Msc Leading designer of valve amplifiers and output transformers Programme: Reception and registration (9.30) Preamplifiers: equivalent schematics, limits in the frequency domain Power amplifiers: modelling of class A to B, interaction of the specifications for OPTs and frequency range and damping factor Lunch (12.15-12.45) Negative feedback: how negative feedback can be done right, remarkable experiments in "the project" Output transformer: limits and possibilities for the output transformer Discussion and end (3.30) The course fees are £ 1 60.00 (Including handout, certificate and lunch) Subscribers to Elektor are entitled to 5% discount! Date: Saturday 21 February 2009 Location: Birmingham City University Time: From 1 0.00 am to 3.30 pm Further information and registration at www.elektor.com/events register now. I c!Li, cawH is sWc% Email: subscriptions@elektor.com Rates and terms are given on the Subscription Order Form Head Office: Elektor International Media b.v. P.0. Box 1 1 NL-61 1 4-ZG Susteren The Netherlands Telephone: (+31 ) 46 4389444, Fax: (+31 ) 46 43701 61 Distribution: Seymour, 2 East Poultry Street, London EC1A, England Telephone:+44 207 429 4073 UK Advertising Huson International Media, Cambridge House, Gogmore Lone, Chertsey, Surrey KT1 6 9AP, England. Telephone: +44 1932 564999, Fax: +44 1932 564998 Email: p.brody@husonmedia.com Internet: www.husonmedia.com Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photo- graphs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software carriers and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopy- ing, scanning an recording, in whole or in part without prior written permission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may ex- ist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publisher to alter the text and design, and to use the contents in other Elektor International Media publications and activities. The Publisher cannot guarantee to return any mate- rial submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2009 Printed in the Netherlands 1/2009 - elektor 7 INFO & MARKET MAILBOX Hf W-dL pr lr-p. M-r^M nnlc ■ -#^ n * h-l >t»^K ,rtl ' r D>ij LiUrchnik SACK TO THE ROOTS lj&tn.Bi *q|ll I — *H H ■IHHiPWtf «*,' B bH kMn ctf#* ■rtfii'fl «* rf# k 4 -ij w---™? Mm HJ 5 M. j.»w.F Counter tubes / E1T Hi Jan — I just saw the Ret- ronics item about E1T tubes on your website (ref. issue 9/2008, Ed.). I'm inviting you and your readers to have a look at our project at: www.emsp.tu-berlin.de/lehre/ mixed-signal-baugruppen/ dbtreinf You might find some interesting ideas here (with full schema- tic diagrams and a detailed description available for download). Here is another link for the general background and some other projects that you may also find interesting: www.emsp.tu-ber- lin.de/lehre/lehre/ mixed-signal-baugruppen Henry WestphaQ (Germany) Many thanks for the interesting links Henry. Were pleased to be able to pass this information on to our readers. We also appreci- ate your feedback on the Retro- nics articles , and we wish your group all the best with your 'her- itage component' projects. Data cable for mobile phone Dear Elektor — I write in response to your article 'Remote Control by Mobile Phone' in the November 2008 issue. For some time now, I have been operating a domestic alarm system using a mobile phone (Siemens S35) and a PIC16F84. The alarm system is activated and de-activated by phone calls. It reports events to me by text messaging (which incurs costs) or by calling (letting the phone ring for 15 seconds and then hanging up). At first I used a mobile phone data cable and a MAX232, but then it occurred to me that there must be a simpler solution. The Siemens mobile phone has a working signal level of approximately 3 V, which is high enough to be regarded by the microcontrol- ler as a logic '1 ' on its input. I use a Zener diode to pull the 5-V signal from the microcon- troller down to 3 V for the mobile phone. Communication between the mobile phone and the microcontroller works per- fectly with this arrangement, without a MAX232 or a data cable (which anyhow includes a MAX232) in the circuit. I also charge the battery of the mobile phone by connecting 7 V to pin 3 of the Siemens socket (Lumberg socket). This ensures that the alarm system continues to work properly even if I am away for an exten- ded time. On the web are various sites with extensive descriptions of the AT commands (including the Siemens commands), for example, www.nobbi.com. I was able to find PDU Spy, a program that makes coding and decoding text messages especially easy. The connector pin assignments of the Nokia and Siemens mobile phones are also described. Maik Busse (Germany) Bascom course Hi Editor — to make your Bascom AVR course somewhat easier to understand for begin- ners, it would be a good idea to first explain how to use the Bascom compiler. For instance, some of us don't know how to use an STK xyz or don't want to use one. How can you load code into flash memory if the ATxxx is built into a circuit? What is the specific procedure for transforming source code into a running program? And so on. With the R8C1 3, this was all explained nicely and gar- nished with hardcopy text. Everything worked right off the bat, but with Bascom I see a constant stream of error mes- sages, such as 'Selected Chip does not match', 'Could not identify Chip-1 D', etc. Perhaps you could post a similar article for newcomers on the Elektor website — that would be nice. WilD Sergeant (UK) Burkhord Koinko , the course aut- hor replies I om owore of the problem. In many coses , newcomers to Bas- com ore also newcomers to the AVR microcontroller. However ; there is a countless variety of platforms , development boards and device programmers. We initially considered describing three different systems in some detail but we abandoned this idea because the ATM18 system is currently the most popular among Elektor readers. Many readers who have purchased this system hove already put the hardware learning curve behind them , ond whot they ore interested in now is developing their own programs. For other systems , you may obtain help from fellow readers on the Elek- tor forum. Incidentally the large number of possible software levels , set- 8 elektor - 1/2009 tings and jumpers are something that even experienced users find very handy It is quite normal for things to not work. It happens to me fairly often - for instance , if yesterday I tried out something with a different microcontroller and today I wonder why device programming isn't working. Every time you have o problem , you hove to look for the couse: check the clock signal , connecti- ons, , operating voltage , software settings , etc. — or maybe there's an intermittent contact. It usually takes only a few minutes to sort things out ; except in the rare coses where the micro- controller has been fried. I managed this once with a Mega 8 8, probably with too high o voltage. It worked OK for a good while afterwords , but it eventually succumbed to its wounds. The best approach , again , would be to post o query on the Elek- tor forum with o more detailed description of the hardware you ore using. Is there a benign Elektor reader out there who can help me to obtain working Delphi code? I know my micros are sending/receiving HID mes- sages, because I did manage to find an HID snooper. Can any one help? Ceri Clatworthy (UK) Much simpler Dear Jan — regarding your 'Indicator for Weller Solder- ing Stations' (July/August 2008, Ed.), I believe I have a much simpler circuit for a heat spindle, to give you up/down pulses for a counter on each axis. The easiest source of these is a computer mouse with a ball in it. These usually have two small wheels inside, each with an optical (infrared) rotary encoder fixed to them. There is usually a small circuit board in there, too, which translates the encoder signals to up/down pulses; you can use these signals coupled to an up/down counter with output suitable to drive a 7-segment display for each axis, such as the Intersil ICM7217A, a switch on when the battery is fully charged, in order to block THY2. Gel-cell batteries should be regarded as fully charged when the individual cell voltage at room temperature (20 °C) rea- ches approximately 2.45 V (range: 2. 4-2. 5 V) with normal charging. The individual cell vol- tage for trickle charging (continu- ous charging) is approximately 2.275 V (range: 2.25-2.3 V). The drops somewhat as the tem- perature rises. Help with Delphi code Hi Jan — I have been working with PIC micros (specifically PIC4550) for a very long time, and recently, the Atmel AT90USB1 287. Both have USB and good merits. Both also have sample code from the manufacturers, as you would expect. At the moment, I am trying to get a HID application to work with Delphi. I know it can be done, using DLLs, because I have a Vel- leman P8055, which is very easy to talk to. I've also used a Measurement Systems USB box, which is similar to an Nl LabView system. Unfortunately I seem to be unable to find out how to get a basic HID DLL that I can use I have searched the internet, for days (!) only to find stuff upwards of £ 2500, or non working code. Js 1 JL r eg a o y— eg 00 LED1 1W R2 1W LED2 | R4 X X ON CHARGED 1W * THY2 D4 Bfc HH " THY1 TIC106D D3 ►4 6V8 400mW R3 • • N pi \ 1N4004 R5 CO R6 * Cl F2 5A +BATT HO D5 4k7 22, Li 25V IN 5402 0 h) BT1 | 12V J F 080224-11 -BATT indicator lamp: a 10-Q resis- tor in series with the primary winding, with a LED and 47-Q series resistor connected across the 10-Q resistor. I also soldered a small capacitor across the LED to slightly reduce the switch-on current surge. This arrangement has been working perfectly for several months now. Jim Colthorpe (UK) 4-digit BCD up/down counter. Use one on each axis. Hope that helps! Steve Reynolds (UK) Wiring up (2) Dear Editor — this is in response to Phil Pumphrey's letter 'Wiring up' in Mailbox, October 2008. Do you have access to the traverse spindles of the table? If so, you could use an optical shaft encoder driven by each Using the car battery charger with gel cells Hi Jan — do you think your Automatic Car Battery Charger (July/August 2008, Ed.) can be used for charging gel-cell lead-acid batteries (and keep- ing them charged)? Keith Vandross (South Africa) In theory yes, Keith, after all, lead is lead... However, it's important to adjust the threshold voltage with PI such that THY1 is off when the battery is not yet fully charged. THY1 should only Mai I Box Terms • Publication of reader's orrespondence is at the discretion of the Editor. • Viewpoints expressed by correspondents are not necessarily those of the Editor or Publisher. • Correspondence may be translated or edited for length, clarity and style. • When replying to Mailbox correspondence, please quote Issue number. • Please send your MailBox correspondence to: editor@elektor.com or Elektor, The Editor, 1 000 Great West Road, Brentford TW8 9HH, England. 1/2009 - elektor 9 INFO & MARKET NEWS & NEW PRODUCTS Workshop RFID Principles and Practice Saturday 1 7 January 2009 from 9:00 am to 4.00 pm, Birmingham City University, Technology Innovation Centre. Presenter: John Merrill BSc (Hons) CCAIPGCE The principal aim of this one-day course is to introduce the student to the concepts involved in RFID. The course will use E-blocks hardware with one of the common 40-pin PIC microcontrollers. Participants will learn how to use the revolutionary new software 'Flowcode'to implement some of the functionality of modern RFID transponders. A prerequisite for the seminar is a basic range of electronics skills and computer proficiency (using Windows). On completing this course the student will have learned: - the basic components of a RFID system; - common applications for RFID; - techniques to configure the RFID reader to enable communication with either ICODE or Mifare transponders; - the commands and syntax used to read and write data from and to RFID transponders. The course fee is £ 199, including handout, lunch and certificate. Elektor subscribers are entitled to a 5% discount. Be quick to register, there is seating capacity for only 20 participants! Masterclass Hiqh-End Valve Amplifiers Saturday 21 February 2009 from 10:00 am to 3.30 pm, Birmingham City University, Technology Innovation Centre. Presenter: Menno van der Veen , MSc. In this Masterclass Menno van der Veen will examine the predictability and perceptibility of the specifications of valve amplifiers. Covered are models that allow the characteristics of valve amplifiers to be explored up to the limits of the audible domain from 20 Hz to 20 kHz. This then leads to the minimum stability requirements that the amplifier has to satisfy. The coupling between output valves and output transformer are also modelled. This gives new insight into a unique type of distortion: Dynamic Damping Factor Distortion (DDFD). Negative feedback is often used in amplifiers. What is the optimum and what are the audible consequences? The correct amplification of micro details is explained, based on new research, and new models about this are presented. The course fee is £ 160, including handout, certificate and lunch. Elektor subscribers are entitled to a 5% discount. Register now, seating capacity is strictly limited. Further information and registration at www.elektor.com/events Elektor comes to the USA Packed with electronics projects, know-how and technology, Ele- ktor magazine has now come to North America and Canada! A special landing page is available on the web for US and Canadian readers. Elektor USA's November 2008 and October 2008 trial issues English, Dutch, Spanish, French, German, Italian, Portuguese and Brazilian magazines centrally produced by Elektor International Media, with websites to match. Printed at US letter size and con- taining local advertising, the new US edition of Elektor has basi- cally the same editorial contents www.cIcklDrxom 0£ I uyUvriXti lektor electronics worldwide sktor International Magazine is coming to North America were distributed by mail as well as at the Audio Engineering Society (AES) Convention held in San Francisco on October 2- 5 2008 and Embedded Systems Conference (ESC) Boston, Octo- ber 27-30 2008. This January 2009 issue marks the official launch of Elektor USA magazine, joining the successful as the UK magazine. American and Canadian read- ers originally subscribed to the European/UK Elektor can now subscribe on-line using the spe- cially created USA landing page, which contains an offer they will find hard to refuse! www.elektor-usa.com Social network and online lab for electronics enthusiasts SchmartBoard recently announced the launch of Solder By Numbers - a social network and online elec- tronic circuit design lab for elec- tronics professionals, educators, students and hobbyists. Professionals can find peers within the electronics industry and con- nect with them to share ideas and discuss electronics issues or employment opportunities. Edu- cators can set up private rooms where they can have students cre- ate circuits online and communi- cate with them via VoIP with web cams to discuss the coursework or teach complete lessons. Students can enhance their learning experi- ence with a plethora of tools and the ability to interact with others from around the world. Hobbyists of all levels and spe- cial interest areas can create and share circuits and learn. Even 'newbies' can visit SolderbyNum- bers.com and now build electronic circuits because the site uses the same concept for building circuits as Paint By Numbers uses for art. With no previous experience users will be able to build electronic cir- cuits. Users who apply for, and are authorized to, publish circuits in a Solder By Numbers format will earn income every time someone builds their circuit. Some of the features on the site are: • Electronics Lab, Circuit Library • Company Directory, Jobs Posting • Create Profile, Blog and Make Friends • Clubs, Forums, Polls, Event Listings • Chat rooms, VoIP, Web Cams • Post Photos, Documents, Videos • Make Commission on Circuits To sign up, users can go to the website below. www.solderbynumbers.com 10 elektor - 1/2009 Reduce prototype development and testing times to hours and min- utes with ^ and compilers lor various Built-in and Routines wi Wi ¥*« R'+n F d;-! t Hiip CflflfrxJ phi: t ki-fc£47J4>tH{Uf J,, 2M6 - iSt< Puziipiion/ Tfrtm Ef4E *# ijl> i t 4 ?>■’ ■' 5f i i_G4c'd_M t^heai +h bp* I j- p -<:j. I.L-cl Wnln DdU.^+4: h^l' l«iJu 5FI .Cited P r hI .Ddi a: fc/f f r* *■ •>■ -- 5Pt_W«i_5*lJ*:i-J*11*EfHt PlWiM £n«f tatistics i lucdi « iMi t ?.t : if Porti^pander Library ^fwersions Library OTath Library String Library Our compilers include a number of useful implemented tools ,i , i — i help you to devq application more ? and comfortably. ASCII Chary^Thandf tool, partiflSariy useful when working with LCD display. USART Terminal is a tool for RS232 communi cation - baud rate con- trol, RTS and DTR com- mands... Watch Window allows you to monitor program items during runtime sim ulation. It displays variables and controller's SFR (Special Function Registers), their addresses and values. Values are updated as you go through the simulation. ■' j irnrnTi : t : t i : t j +■ * i- ► * 1 ■ *. * i 1 l i. a. L 1. r ■ a ™. f a. t L t t It E I 1 - 1 " f I- * T- r P 1 fa' r tbv Lra W*-*. 11 "1 13 ] ■ rH! YJj* -- ■T V j - 1 KTi'C.'.-iT p. tf tr n TO: T5B - D 1 : -.'6rj> r -: J rr pJ h* \ JiT-HTB ■ |jrp r Iwm 'fa {f4«9 | j * -o r* % y ij ft 1 n- 41 Jfcfl Ca J ■ 1$ J3 # A Jh .i ! h“# * ^ * * £j ar 1 uelugn I'M - ori Liorarj - USART UKi i - USB HUrLi vim r -j,- TMw biili « . Jr BUB And many other tools are available as well: mikroBootloader, EEprom Statistics - After successful compiling, you can review detailed statistics Editor, HID Terminal, Seven Segment Decoder, UDP Terminal. on y° ur cocle - Supporting an impressive range of microcontrollers, easy-to-use IDE, hundreds of ready-to-use functions and many integrated tools makes MikroElektronika compilers one of the best choices on the market today. Besides , mikroElektronika compilers offer a statistical module, simulator, for graphic dis- plays, , ASCII table, HTML code export, com- munication tools for SD/MMC, UDP (Ethernet) and USB, EEPROM editor, program- ming mode management, etc. SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD 1 11 mikroElektronika 3, A DEVELOPMENT TOOLS I COMPILERS I BOOKS http:// Find your distributor: UK, USA, Germany, Japan, France, Greece, Turkey, Italy, Slovenia, Croatia, Macedonia, Pakistan, Malaysia, Austria, Taiwan, Lebanon, Syria, Egypt, Portugal, India, Thailand, Taiwan, Czech and Slovak Republic. kroe.com/ INFO & MARKET NEWS & NEW PRODUCTS Elektor at Embedded Systems Conference Boston, USA By Jan Buiting From 27 to 30 October 2008 Elektor was present at the Boston, USA edition of Embedded Systems Conference. The Elektor booth was initially staffed by Wisse Hettinga (International Coordinat- ing Editor), Jan Buiting (Editor) and Hugo Vanhaecke (Elektor USA Publisher). On the second day of the exhibition, we were joined by Mike Costa and Peter Wostrel from Strategic Media Marketing Inc., Elektor's US advertising bureau. The Elektor crew at ESC Boston 2008 (left to right): Mike Costa, Hugo Vanhaecke, Peter Wostrel, Wisse Hettinga, Jan Buiting. Photograph: Amanda Gardner. The ESC exhibition was used to introduce the US edition of Elektor mag- azine to visitors and exhibitors. The response was positive throughout. Some comment heard on the blue-carpet walkway: "that's a mighty fresh magazine compared to what we get here"; "Hey I used to take the Euro- pean edition - great but too expensive to get here"; "R u around since 1975? Awesome!"; "How can I subscribe to it?" [using the card inside the mag , or go to www.elektor-usa.com ]; "Do you accept contributions from freelance authors?" [sure]. "Cool, you people have your own lab" [yep]. "What, housed in a castle?" [yep]. Close to 1 ,000 copies of the November 2008 trial issue were distributed to visitors and exhibitor staff. The two-day exhibition is embedded (pun intended) into the ESC event Your Editor, mighty Thor and a less imposing but equally sympathetic member of staff at the Atmel stand at ESC Boston. which actually lasts five days and is famous for its conference sessions. At Boston, the sessions were rewarded with good attendance throughout, with the Teardown Sessions and the hands-on lectures on the Tl Bea- gle board project and MIT's Robot Swarms, the most popular. These Teardown Sessions deserve a following! We watched Apple 'Pip- pin' and 'Newton' PCs (fashionable for a month, then market fiascos) being taken apart 'less carefully' and the innards drilled out, smashed and revealed in a journalistic way with a good deal of American calm and humor. Doing our rounds on the show floor we ran into the US representatives of a number of market-leading companies Elektor Europe has been in close contact with for many years. Atmel was showcasing not only their Quantum touch sensing modules, ICs and software, but also a number of souped up microcontrollers and AVR Tools now going by awe-inspiring names of Norwegian gods like Odin, Thor and Gjallarhorn. Thor was actually present at the show; he is about 8 feet tall and mostly air inside. Fortunate for me, Thor was guided by two kind young ladies who took pleasure in bashing selected visitors on the head with AVR labeled balloon hammers. Much smaller but equally kind in its response I found Atmel's model dinosaur with strikingly pet-like behavior, even to the point of making growling noises and tugging gently backwards if you put a finger in its mouth. Microchip had a rather traditional booth with tech assistance from Digi- Key staff for the introduction, at the exhibition, of their new ICD3 in-circuit Debugger/Programmer. We were told that the '3 now uses hardware The cuddly Atmel dinosaur — take one home for the kiddies! acceleration and cheerfully 'does' all PICs in the Microchip programme (and that's quite a few). Microchip also staged seven technical training sessions during the show. Renesas was impossible to miss, if only for the impact (voice and appearance wise) of Jeff Waldman on his stool. Jeff told me about the Board ID chips Renesas is about to introduce, as well as about their new 32-bit microcontrollers. The Renesas 8-bit R8C, extensively featured in Elektor two years ago, is still going strong and has thousands of fans. Many other booths were visited, including Mouser Electronics, Altera, Circuit Cellar, Jauch, Texas Instruments, Planar Energy Devices, Logic Supply, LXD, Sundance America, PCB-Pool (hi Elisabeth!), Keil and Blue- water Systems. 12 elektor - 1/2009 VISIT 2000 SERIES 3000 SERIES " ..... .... T R e naw Allows ■yO-L I* go bJck.. revirWj inti W ,1 n,i Ip# gp tr. 1000 t;^ptg itb wit bin & ns waveform playback ioaL Tdi'h niilogy The hiCOStOfX- 3000 5eri£S of tiiC-ill0S£Gpu4 from Pico Tut-hnsoloyy includes general purpas-e arid high resQtuUon model e: With 1 2 bit resolution orid 1% dccur-j^y, [lie IQMMz PitoScopu 3424 is afoJe Eu dl-SOt I changes a& s-mall as OJ024% (244ifipfnl - making il the ideal 4- channel osciiloscoiw for anahK] design und analysis The higher- speed 6 bit models in the PicoScope 3000 ■■! ‘ NL'S I lmiu i sunip&i iuj r : : [■. ■■ u p * u 2QOM5V1 and Up to 1 MS/l rc comfortably inio i he palm of you r hand yet si III ft ** includes Che p awer I u I features found m larger osdlld scopes www.picotech.com/scope498 to check out our full line of PC-based instrument! or call 01480 396 395 for information and a product catalogue INFO & MARKET NEWS & NEW PRODUCTS Microchip: inductive touch sensing Microchip announces new mTouch™ Inductive Touch-Sens- ing Technology, as an addition to its capacitive touch-sensing solutions. Inductive touch sens- ing's fundamental operating principles enable it to work through a front panel such as plastic, stainless steel or alumin- ium. The technology also works through gloves and on surfaces that contain liquids. Microchip enables designers to integrate inductive touch-sens- ing functionality within existing application code in a single standard 8-, 16- or 32-bit PIC® microcontroller (MCU) or 16-bit dsPIC® Digital Signal Controller (DSC). Touch sensing also ena- bles a completely sealed and modern-looking design. Applica- tions for inductive touch-sensing include stainless steel front pan- els for appliances, robust industrial equipment and automotive appli- cations because of the ability to reduce accidental touch triggers. Implementation details for Micro- chip's inductive touch sensing solutions are available now by free download from the website below. Items available for down- load include user manual with quick-start guide for building an inductive touch-sensing applica- tion and application notes cover- ing hardware and software design practices, with example implemen- tations for inductive touch-sensing solutions, such as inductive touch mechanical design, induc- tive touch hardware and induc- tive touch software. Also available for download are graphical user interface software tools for analysis of designs, utilising Microchip's PICkit™ Serial Analyzer devel- opment tool, source code for a variety of sensing routines and frequently asked questions. Microchip continues to make it easy, inexpensive and royalty- free for engineers to implement touch-sensing interfaces into their designs. With the addition of inductive touch technology. www.microchip.com / mtouch ( 080965 - 1 ) Single chip Hi-speed USB 2.0 solutions for serial and parallel interfacing Future Technology Devices International Limited (FTDI) announced the availability of their 5 th generation of USB to UART/ FIFO ICs. The two new devices support the 480 Mb/s USB 2.0 Hi- Speed specification. The FT2232H and FT4232H devices have the capability of being configured in a variety of industry standard serial or parallel interfaces such as UART or FIFO. The FT4232H offers four con- figurable interfaces and the FT2232H two configurable interfaces. Two of the FT4232H's interfaces and both of the FT2232H's interfaces can be con- figured as UART, JTAG, SPI, I2C or bitbang mode serial interfaces with independent baud rate gen- erators. The additional two inter- faces of the FT4232H offer UART or bitbang options. In addition, the FT2232H can be configured as a dual FT245 FIFO, a host bus emu- lation mode, a CPU interface FIFO mode or a fast opto-isolated serial interface mode. Both devices support a data trans- fer rate up to 12 Mbaud when configured as an RS232/RS422/ RS485 UART interface and > 25 MBytes/second over a parallel FIFO interface (FT2232H only). A USB protocol engine controls the physical Universal Transceiver Macrocell Interface (UTMI) and handles all aspects of the USB 2.0 Hi-Speed interface. Both ICs integrate a Low Drop-Out (LDO) regulator, an internal 12 MHz to 480 MHz PLL and interface to an external EEPROM. These devices integrate the entire USB protocol on a single chip and provide extremely flexible inter- face configuration options. They provide a flexible method of inter- facing to FPGAs and microcontrol- lers as well as upgrading legacy designs to accommodate USB communication. www.ftdichip.com ( 080965 - 11 ) Wireless data acquisition and PXI Express modules for sound and vibration applications National Instruments released a new wireless data acquisition module and two new PXI Express modules for sound and vibration applications. With the Nl WLS- 9234 wireless dynamic signal acquisition (DSA) module, engi- neers and scientists can stream vibration data wirelessly over the IEEE 802.1 lg (Wi-Fi) standard to distributed monitoring systems and eliminate the cost and clutter of cabling. The new PXI Express DSA modules, the Nl PXIe-4496 and PXIe-4498, make it possible to acquire data from 272 channels at full rate in a single PXI Express chassis, so engineers and scientists can acquire more data from more channels at faster rates. The WLS-9234 offers four simulta- neously acquired input channels, each with 24-bit resolution and a 51.2 kS/s maximum sampling rate. The module delivers 102 dB of dynamic range and incor- 14 elektor - 1/2009 porates software-selectable AC/ DC coupling and integrated elec- tronic piezoelectric (IEPE) signal conditioning for accelerometers and microphones. The WLS-9234 relays data wirelessly over a Wi-Fi network, allowing for easy distrib- uted I/O, and provides support for various wireless security protocols including WEP, WPA and WPA2 (IEEE 802. 1 1 i) to protect data and network integrity. In addition, the module features support for direct Ethernet connection. The Nl PXIe-4496 and PXIe-4498 modules offer 16 simultaneously acquired channels, each with 24- bit resolution, 204.8 kS/s maxi- mum sampling rates and a 1 13 dB dynamic range. The modules are based on the PXI Express bus architecture, which offers higher throughput than PXI and makes it easy to synchronise up to 17 Nl PXIe-449x modul es in a sin- gle chassis and simultaneously acquire data at full rate. The Nl PXIe-4496 and PXIe-4498 mod- ules are designed for interfacing with accelerometers and micro- phones that require constant cur- rent power. All the new modules are compat- ible with the Nl Sound and Vibra- tion Measurement Suite. The suite includes Nl Sound and Vibration Assistant stand-alone, interactive software for quickly acquiring, analysing and logging acoustic, noise and vibration data. www.ni.com/soundandvibration (080965-III) Entry level plug and play intelligent display platforms cation expertise. Based on a 200 MHz ARM proces- Anders 7 UMR intelligent displays sor, the new UMR 3 series is a low- consist of small sized colour TFT cost platform designed for medium Anders Electronics 7 UMR-1 and UMR-3 Series enable seamless migration from monochrome to colour, towards the ultimate user experience. The new low-cost platforms will allow designers and system inte- grators to quickly and cost-effec- tively enhance the usability of their devices by migrating legacy products to full colour interfaces, whilst also adding functionality not usually supported by their existing systems. The Anders UMR platforms bring products to life through a 'plug and play 7 intelligent colour dis- play interface, with optional GUI development tools and run time engine. This allows enhancement of next generation user experi- ences more commonly found in cutting edge consumer devices - and enables development teams to focus resources on their core appli- displays with touch screen, pre- integrated with a multi-functional, configurable embedded system with ready to run operating sys- tem, optimised to drive the display and run a qraphical user interface |GUI|. volume applications requiring lim- ited animation capabilities. For higher volume applications the UMR 1 series offers a very low-cost platform based around a 50 MHz ARM processor, supporting bitmap graphics and configurable to spe- cific applications. Both of the new platforms are sup- plied with a debugged embedded operating system with all required drivers and are available with pre- integrated options of a 2.8-inch, 3.5-inch and 5.7-inch QVGA dis- plays or a 4.3-inch WQVGA TFT. Because the new platforms provide a complete end-to-end user inter- face solution they eliminate the need for designers and integrators to create a discrete design, and help overcome the challenges of selecting and interfacing a TFT dis- play, and adding new embedded functionality such as an Ethernet or SD card. As a result, they sig- nificantly reduce the time and cost taken to move from initial concept to manufactured product. www.anders.co.uk (080965-IV) Diodes Inc. wins Environmental Award Diodes Incorporated has won the Environmental Award at the annual Elektra Awards held in Munich on the eve of Electronica 2008. Now in their sixth year, the Elektra Awards are regarded as the most prestigious electronic product, technology and business awards in Europe and recognise the achieve- ments of individuals and compa- nies throughout the European Elec- tronics industry. For the Environmental Award cat- egory, Elektra invited companies to demonstrate how their busi- ness strategies are reducing the impact on the environment of their products, manufacturing process and commercial practices. The 20-strong independent panel of judges also looked for evidence of how good environmental prac- tice has permeated across the com- pany by being inclusive of staff at all levels of the organisation. Diodes 7 Elektra win follows hot on the heels of another award, the National Microelectronics Institute's Low Power "Green 77 Design Award for 2008. The award was made to Diodes for its ZXGD3 1 01 T8 MOS- FET rectifier controller. The first in a new family of products, it enables external power adapter designers to replace lossy Schottky diodes with surface mount MOSFETs to achieve higher efficiency, less heat generation, a reduction in adapter size and weight and a simplifica- tion of overall circuit design. Pictured left to right are: The Mas- ter of Ceremony Sky Sports Pre- senter Jeff Stelling, Colin Greene, European President, Diodes Incor- porated, Martin Southam, Director of Marketing of the award sponsor TDK-Lambda and Richard Wilson, Editor in Chief of event organisers Electronics Weekly. www.diodes.com (080965-V) 1/2009 - elektor 15 INFO & MARKET NEWS & NEW PRODUCTS Flexible controlling and monitoring of DC motors ■ KALEJA Elektronik's new control system for DC motors offers to users a low-cost solution to elec- tronically drive and monitor direct current motors. Fast assembly is ensured due to the modular design which can be snapped onto the DIN rail as well as the plug-on spring-loaded terminals. The con- trol system has been designed for reversing operation. The motor speed can be controlled from 0 to maximum speed via an analogue 0-10 VDC input. A reference volt- age of 1 0 VDC is provided by the control system and thus it is very easy to connect a potentiometer for speed control. A trimmer at the front of the control system is used to set the maximum motor current. If the motor current increases above the set value, the module switches off the motor under dynamic brak- ing and a signal is transferred to the terminal l-out. To prevent the current evaluation from respond- ing during the start of the motor, a fixed time (approx. 300 ms) is active. An additional trimmer is integrated at the front to enable flexible handling of the over-current switch off. This trimmer is used to set the time (0.2 s to 2 s) until the over-current is switched off. If the motor current returns to the normal value within the time set, the con- trol system does not switch off, but switches off only when over-current is reached the next time. A meas- uring point has been installed at a connection terminal to set the maximum motor current at the trim- mer always at the same value for serial production. The setting can be read from a voltmeter and bal- anced using the trimmer. The width of this flexible control system is only 22.5 mm. www.kaleja.com (080965-VI) AVR-based RF transmitter family for automotive remote keyless entry apps Small-outline, Cost-efficient AVF*®-based RF Transmitter Family for RKE Applications Atmel® Corporation recently announced the availability of the new AVR®-microcontroller-based RF transmitter family ATA577x for Remote Keyless Entry (RKE) appli- cations. The new devices are Sys- tem-In-Package (SiP) or Multi Chip Module (MCM) solutions incor- porating Atmel's well-known AVR microcontroller ATtiny44V and the RF transmitter T5750/53/54. This new family covers all world- wide frequencies (ATA5773: 315 MHz, ATA5774: 433 MHz, and ATA5771 : 868 to 928 MHz). The tiny QFN24 packages, measur- ing only 5 mm x 5 mm, allow the creation of extremely small key fob designs at competitive costs. The ATA577x family members are ideal for high-volume, uni-direc- tional RF RKE car keys with a sepa- rate immobilizer transponder. This product family especially fits RKE applications focusing on the latest RF and microcontroller technolo- gies while retaining legacy trans- ponder protocol compatibility. Additionally, thanks to the stacked SiP technology, these applications will benefit by material cost sav- ings of about 10% and a board area saving of about 20%, com- pared to conventional two-chip solutions. The new transmitter devices are produced using existing Atmel components in high-volume pro- duction. This ensures the products' high reliability. Customers can reuse their existing T5754/53/50 or AVR designs, cutting down time-to-market. Atmel's RF transmitter family will be updated in Ql/2009 with 2 addi- tional car access devices. The first device is targeted at the upcoming RKE combi keys; the second will serve the new Passive Entry Go (PEG) keys. www.atmel.com / dyn / products / product_card.asp?part _id=441 3 (080965-VII) Versatile KM6 caseframe revitalised and updated Verotec has introduced new designs of KM6 caseframes, designed for applications that require the mounting / housing of Eurocard-based cards or mod- ules in either a 1 9" rack mount or desktop enclosure. A step up from a standard subrack, its design requires no additional housing, and offers optional EMC protec- tion along with the integration of cooling fans and power supplies in a self contained, attractive unit. The use of standard KM6 subrack components means that the KM6 caseframe is fully compatible with KM6-II card guides, front panels, plug-in units and other accessories. The top and bottom covers are readily removed for system build- ing and servicing requirements. A range of accessories are avail- able; tilt feet, carry handles, fan trays and hinged front and rear covers allow the requirements of most applications to be met with standard off-the shelf parts. The KM6 subrack family is argu- ably the most comprehensive and versatile system available on the market; it conforms to DIN41494 and IEC297 and has been used in numer- ous projects over the last thirty years. The large number of standard ele- ments enables highly com- plex units to be configured from standard components, reduces time to market and ensures that front end engineering costs are minimised. Specific variants are approved for use in high shock and vibration environments such as railway applications and other versions offer enhanced attenuation for use where EMC is a potential issue. www.verotec.co.uk (080965-IX) 16 elektor - 1/2009 VISA Quasar Electronics Limited PO Box 6935, Bishops Stortford CM23 4WP, United Kingdom Tel: 08717 177168 Fax: 07092 203496 E-mail: sales@quasarelectronics.com Web: www.QuasarElectronics.com 08717 All prices INCLUDE 17.5% VAT. Postage & Packing Options (Up to 2Kg gross weight): UK Standard 3-7 Day Delivery - £3.95; UK Main and Next Day Delivery - £8.95; Europe (EU) - £6.95; Rest of World - £9.^5 (up to 0.5Kg). lOrder online for reduced price UK Postage! Payment: We accept all major credit/debit cards. Make cheques/PO’s payable to Quasar Electronics. Call now for our FREE CATALOGUE with details of over 300 kits, projects, modules and publications. Discounts for bulk quantities. Master Card Electron Credit Card J: ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ .w. J £ -L;V s have some fantastic gilt:|deas for young (and old) enquiring minds ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ t)\ K Electron lie Project 1 Labs An electronics ; course in a box! All a: ssume no previous knov /ledge and require N 0 solder. See website f details ar full 30 in ONE -£16.95 Order Code EPL030KT 130 in ONE -£39.95 Order Code EPL130KT 300 in ONE -£59.95 Order Code EPL300KT 500 in ONE -£149.95 Order Code EPL500KT Robot Sensor - £19.95 Order Code EPLR20KT Digital Recording Laboratory - £29.95 Order Code EPLDRKT AM-FM Radio Kit -£6.95 Order Code ERKAFKT Short Wave Kit - £6.95 Order Code ERKSWKT Crystal Radio Kit - £6.95 Order Code ERKCKT Electronic Bell -£8.95 Order Code EAKEBKT Electronic Motor - £8.95 Order Code EAKEMKT Generator - £8.95 Order Code EAKEGKT Room Alarm - £4.95 Order Code EAKRAKT Hand Held Metal Detector - £7.95 Order Code ELMDX7 Metal Detector - £7.95 Order Code ELMDKT Robot & Con- struction Kits Future engineers can learn about the opera- tion of electronics, robotics and transmis- sions systems. Trainmech — £12.95 Order Code C21-606KT See our website for even more great gift ideas! Musical LED Jingle Bells -£17.95 Order Code 1176KT Flashing LED Christ- mas Tree - £5.95 Order Code VMK100KT Robomech -£12.95 Order Code C21-603KT Tyrannomech -£12.95 Order Code C21-601KT Moon Walker - £33.95 Order Code 401 5KT Robot Arm - £54.95 Order Code 401 7KT www. QuasarElectronics. corh Secure Online Ordering Facili ies • Full Product Listing, Descriptions & Photos • Kit Documentation & Software Downloads INFO & MARKET NEWS & NEW PRODUCTS FPGA eval boards from Poland PROPOX from Poland introduce a family of FPGA evaluation boards. The company has devel- oped an evaluation system for the Xilinx Spartan 3 and fulfilled com- patibility with the Cyclone EP1 C3. a VGA connector, two PS2 ports, two RS-232 ports, an MMusb245 module, an MMIan3 mod- ule, six 7 segment LED displays, alphanumeric LCD connector, 8 DIP Switches, 8 switches, an MMC/ SD Card, and a Altera The EVBfpga evaluation board enables users to connect an MMfp- gaXX mini module containing pro- grammable integrated circuits with various on board peripherals like form pga mod- ules are mmTm connec- tor com- patible. The m mTM sol u- tion reduces cost of a flexible evalu- ation .^^pJatform. The working plat- buzzer. The alter- native is the EVBmmTm plat- form. The above mentioned MMf- can be changed from FPGA to ARM7, ARM9 or AVR just by interchanging mod- ules and interconnections. Within the range of EVBmmTm peripherals, users will find 8 switches, 8 LED diodes, Buzzer, 2 poten- tiom- eters, IRDA port, USB Device and USB Host ports, two RS232 ports with LEDs, an audio Codec, a CAN Interface, a 1-Wire con- nector, an SD /MMC card slot, an alphanumeric LCD connector, and a graphic LCD connector. The flexibility of the EVBmmTm plat- form has already attracted many fans due to amazing cost reduc- tions during the product develop- ment process. www.propox.com (080965-XI) 868 MHz wireless modules and device adapters for 40 kms range Digi International recently intro- duced XBee-PRO® 868 embed- dable RF modules and standalone device adapters, powerful XBee products that provide up to 40 kil- ometers of RF line-of-sight (LOS) transmission. The products are ideal for machine-to-machine (M2M) applications in chal- lenging terrain or long- range environments such as remote sensor networks, building automa- tion applications, Automatic Meter- ing Infrastructure (AMI) and Super- visory Control and Data Acquisi- tion (SCADA) systems. Customers using the XBee-PRO 868 can eas- ily migrate to other XBee solutions including pin-compatible 900 MHz options used primarily in North America, and 2.4 GHz ZigBee and proprietary options available globally. The XBee-PRO 868 operates on the 868 MHz Short Range Device (SRD) G3 band for Europe provid- ing comparable RF range charac- teristics as 900 MHz solutions in the U.S. Its outstanding range is fuelled by its strong transmission power. Where similar 2.4 GHz devices are limited to 10 mW of transmission power, the XBee-PRO 868 is capable of 500 mW of EIRP (equivalent isotropically radi- ated power). It also provides best- in-class receive sensitivity, rated at -1 1 2 dBm. Additionally, the XBee- PRO 868 features multiple antenna options, over-the-air configuration, strong 128-bit AES encryption for security and an industrial tempera- ture rating of -40 to 85 °C. A low- cost 868 MHz mesh solution is also in development. XBee-PRO 868 Development Kits, XBee-PRO 868 modules and XBee-PRO 868 adapters are now available. www.digi.com (080965-X) Snapper 9260 ARM9 Single Board Computer Module The Snapper 9260 from Blue- water Systems is a mid-perform- ance SOM and the ultimate value proposition. The module uses an ARM9 core and is built around the Atmel AT91SAM9260 microcontroller. Its extensive set of standard, on-board memory and peripherals provides engineers with a viable solution that is both cost-effective and transfera- ble across a broad range of elec- tronic designs and products. Snap- per 9260 offers all of the popular interfaces needed in an embed- ded system. Peripherals include CF and MCI interfaces, Ethernet, SPI, l 2 C and many more. The module also includes either a fully featured embedded Linux 2.6.20 or WinCE 6.0 kernel and a comprehensive board support package. Typical applications for this mod- ule include security imaging sys- tems, dedicated smart instruments and mobile/industrial control sys- tems. With its impressive perform- ance and on-board peripheral support, Snapper 9260 makes it easy to rapidly develop an embed- ded product while providing a quick turnaround and reduced development costs. www.bluewatersys.com (080965-XII) 18 elektor - 1/2009 On 22 November 2008, more than 1,000 animated Elektor readers and other visitors crowded the exhibition space, alleys and lec- ture rooms of the Evoluon building in Eindhoven, The Netherlands, to par- ticipate in the first edition of Elektor Live!, a vibrant and lively event hos- ting not only interactive workshops and lectures but also hands-on sol- dering and a chat with Elektor staff. Several 'extras' like a quiz, special offers and eye catching demon- strations (hydrogen car; quadro- copter) went down very well with the audience. Thank you all visitors, exhibi- tors, lecturers and volunteers for making this day a resounding success, and we're looking j forward to seeing you at next i year's Live! event. M O ■ - 5 a §* ==J8SE J ' # f § r •% 0 . * vw * ^ fig 1/2009 - elektor 19 INFOTAINMENT HOMO RADIENS A capsule history of the subject of our study: he started off walking on all fours, learned to swing his way through the trees, discovered fire, started hun- ting wild animals and his own kind, began walking on two legs, discovered the fireplace and the sofa, began travelling on two wheels (and later on four), discovered the television set and placed it in front of the sofa, stopped hunting and started feeling neurotic, and - the final step - started radiating. Elektor went on a quest for Homo Radiens, the new radiant species of mankind. To learn more about this species, we placed a specimen in a measu- ring chamber and examined its frequency spectrum. Peak Notebook We can expect to see a mixture of signals from a notebook. The processor, front-end bus and memory have their own frequencies, which range from 250 MHz to more than 1 GHz. The notebook measured here (a Dell Latitude D820) exhibited several strong signal lines at 240 MHz, 680 MHz, and well above the 1-GHz range. The radiation levels were surprisingly low. These values were recorded with the measuring antenna at a distance of 1 metre. Peak Frequency (Hz) Measurement methodology and hazard assessment In order to make accurate measurements, all other sources of radiation must be reliably excluded. For these measu- rements, we used a semi-anechoic measuring chamber belonging to DARE, a company located in Woerden, The Ne- therlands. The chamber is an enormous Faraday cage, which blocks all external radiation, and the interior is non-reflective and absorbent. Consequently, only the radiation of the object in front of the antenna is measured. All measurements were made using a biconical log-periodic antenna (range 30 MHz to 1 GHz) with a Rohde & Schwarz ESIB 26 EMI Test Receiver (range 20 Hz to 26 GHz) as the measuring receiver. Vi cixcx fd o u s? elektor - 1/2009 Mobile phone As might be expected, the mobile phone exhibited a clean signal line above 900 MHz. There was also a relatively weak signal at half this frequency. The measurements were made with the antenna at a distance of 5 metres. 1/2009 - elektor 10 230 M 300 M 400 M 500 M 600 M 700 M 800 M 900 M 1000 M Peak E > =L CQ TD Peak 30 M 50 M 100 M Frequency (Hz) 200 M 230 M Frequency (Hz) Camera, MP3 player and remote entry key The digital camera and the MP3 player exhibited a nice lawn' of signals with a few small molehills. No especially strong signals were observed in the measuring range. In opera- tion, the car remote entry key radiated at approximately 435 MHz, but it also showed a few harmonics at 870 MHz. Peak TECHNOLOGY WIRELESS LINKS DBPSK! OFDM! Wireless links of all colours Alain Rimlinger (Maxim France) In this issue with its central theme of wireless links, we're going to try and give an overview of the most important current techniques, and see what the trends are for the months, indeed years, ahead. The last few years have seen a decided move towards wire- less links in the personal equipment market. We're all very keen to have our PC on a network — but we hate all those cables! We want the TV to be connected to the hard drive holding our photos — but we don't want to have to plug and unplug it every time. This is how Bluetooth (802. 15.1 standard) came into being for synchronising our organisers, telephones and earpieces. It uses the 2.4 GHz band with GFSK modulation, is multi-channel, and has a 1 Mbps data rate. A new incarnation of the standard known as Bluetooth EDR takes this up to 3 Mbps by using DQPSK (Differential Quadrature Phase Shift Keying) modulation. Wireless video Video is also making rapid advances, and high-definition uses up substantial digital data rates. To be able to transmit video streams in wireless high-definition, it was necessary to find vacant frequencies able to be modulated at very high data rates: this spawned WirelessHD 1 .0 (802.15.3c) which uses the 57-64 GHz band for transmitting uncom- pressed high-definition video at 4 Gbps over a maximum range of around 1 0 m. The aim is to replace HDMI cables and connect a Blu-ray player to the latest LCD screen hang- ing on the wall without the need to make any holes. For network connections, the prevailing wireless standard is WiFi (802.1 la/b/g/n, depending on frequency and data rates). WiFi uses the 2.4 GHz (802. 1 1 b/g and 5.8 GHz (802.1 la) bands. The modulation is either DSS/CCK (Direct-sequence Spread Spectrum / Complementary Code Keying) (802.1 1 b , or OFDM (Orthogonal Frequency-Divi- sion Multiplexing), used by 802.1 la and g. The data rate varies from 1 Mbps to 54 Mbs, depending on the received signal quality. If the signal-to-noise ratio is very good, the circuit uses the maximum bandwidth and most complex modulation to achieve the highest data rate. As the signal-to-noise ratio deteriorates, the circuit automati- cally adjusts the bandwidth and also reduces the complexity of the modulation, thereby reducing the data rate, in order to keep the link error-free. With the 802.1 1 b, the modula- tion goes from DBPSK at minimum (1 Mbps) up to DQPSK (1 1 Mbps). With the 802.1 la/g/n, OFDM modulation is used with 52 subcarriers, each able to be modulated at up to 64-QAM for maximum data rate. 802.1 In WiFi takes up the specifications of the 802.1 lg, incorporating the notion of MIMO (Multiple Input, Multiple Output). The principle of MIMO is to have several transmitters and sev- eral receivers all operating at the same time. This makes it possible to decode signals under the most tricky condi- tions and overcome the problem of echoes, for example. In this way, a high data rate can be maintained even when radio propagation conditions are adversely affected by the surroundings. Cellular communications and wide area networks The term cellular communications covers the various stand- ards used by mobile phones. In Europe, GSM predomi- nates; the new standards allowing digital Internet con- nection are being developed apace. Thus the 3G/3G+ (HSxPA High Speed Downlink/Uplink Packet Access) allows mobile terminals to connect to the Internet at speeds wor- thy of a hard-wired ADSL link: the standard provides for a maximum download data rate of 14.4 Mbps. The fre- quencies used are no longer in the 900 MHz band, but in the 1 71 0-1 770 MHz band for the uplink and 211 0— 21 70 MHz for the downlink. The modulation used is QPSK or 1 6-QAM allowing a higher data rate than the GSMK modulation used by GSM. The bandwidth is also increased from 200 kHz (GSM) to 5 MHz (HSDPA). Manufacturers are currently working on a new standard called LTE (Long Term Evolution), which promises even higher data rates, increased mobility, and the possibility of changing cells and/or communication mode without los- ing the connection. Terminals compatible with this standard are not expected to be marketed before 2010 — while the HSxPA standards are already being deployed. WiMAX For fast-developing countries, one alternative to the cable telephone network is called WiMAX (802. 1 6d standard for static WiMAX and 802.1 6e for mobile WiMAX). It's a sort of super WiFi, operating in different bands depend- 22 elektor - 1/2009 Glossary ASK Amplitude Shift Keying, digital amplitude modulation of a ra- dio carrier. When the amplitude is 0 or 1 00%, we also speak of OOK for On/Off Keying. Bluetooth Short-range communication standard between peripherals like mobile phones, organizers, earpieces, hand-free kits, and PCs. Bluetooth operates at 2.4 GHz with a 1 Mbps data rate. BPSK Binary Shift Keying - digital modulation where the bits are en- coded by a phase of 0 or 1 80°. DECT Digital Enhanced Cordless Telephone. Transmission standard for domestic cordless phones operating at 1 .8 GHz. Allows several handsets to be used with the same base station and for intercom between handsets. DAB Digital Audio Broadcasting - digital audio transmission stand- ard. A standard that enables FM to be replaced with CD-qual- ity radio. It uses particularly robust OFDM modulation. DAB is already widespread in the UK and Germany. DBPSK Digital Binary Phase Shift Keying. Like DQPSK but with only two phase states. DMB-T Digital Multimedia Broadcasting Terrestrial, a variant of DAB that also allows transmission of slow-changing graphics in- formation, like a disc sleeve or graphic. This is the standard France has chosen to go over from FM to digital radio. DQPSK Differential Quadrature Phase Shift Keying - digital modula- tion where the data are modulated by phase states taking pre- ceding states into account. DSS/CCK Direct-sequence Spread Spectrum with Complementary Code Keying - digital modulation used by the 802.1 1 b WiFi stand- ard. Data are transmitted by modulating the phase, and spec- trum spreading is achieved by frequency hopping. DVB Digital Video Broadcast, or digital TV. FSK Frequency Shift Keying - digital frequency modulation where a 0 corresponds to one frequency and a 1 corresponds to an- other slightly different frequency. GFSK is a variant of FSK used by Bluetooth amongst others. HSDPA & HSUPA High Speed Downlink/Uplink Packet Access - mobile technol- ogy allowing data transmission by packets at high data rates from the network to the subscriber. LTE Long Term Evolution - a future standard to succeed the UMTS for high data-rate mobile networks. OFDM Orthogonal Frequency-Division Multiplexing - modulation using several subcarriers within a given bandwidth. Each sub- carrier can then be modulated, for example by QPSK. Each subcarrier normally carries both useful and redundant infor- mation. OFDM is a form of modulation that's complicated to implement, but is very robust and ensures excellent transmis- sion reliability. QAM Quadrature Amplitude Modulation - both the phase and the amplitude of a signal are separately varied at the same time in order to transmit a higher number of bits at each moment. The constellation diagram makes it possible to position the groups of bits on concentric circles defining the amplitude and phases. QPSK Quadrature Phase Shift Keying - four-state digital modula- tion where two bits are coded by a phase state of 0/90/1 80 or 270°. WiMAX Worldwide Interoperability for Microwave Access. A sort of long-range 'super WiFi' that offers a radio alternative to the (A)DSL network. Many different bands allocated. ZigBee Radio communication standard between peripherals, mainly industrial. ZigBee has a comprehensive software network layer that ensures interoperability between peripherals from differ- ent manufacturers. ing on region or country (2. 3-2. 7 GHz, 3. 5-3. 9 GHz, 5.8 GHz and many more). Channel width is programma- ble from 1 to 28 MHz, and operators have the possibility of transmitting voice, data, and even digital TV. The modula- tion used is OFDM. This is a radio alternative to the ADSL networks offering the 'triple service'. Depending on how much end-users want to pay, they are allocated a different bandwidth; TV requiring the largest bandwidth. In some 1/2009 - elektor 23 TECHNOLOGY WIRELESS LINKS Timing diagram for QPSK modulation. The bitstream is displayed under the time axis. The input datastream is divided into two streams I and Q, with a 90° phase shift. The I and Q components are modulated in BPSK and then combined to form a single QPSK signal. DBPSK and DQPSK are based on the same technique, but use the difference between bits instead of their current value. WiMAX reference development card using the MAX2838. Frequencies and data rates 3G 1.7 & 2.1 GHz 1 4.4 Mbps Bluetooth 2,4 GHz 1 Mbps DMB 1 68-240 MHz (VHF) & 1 452-1 492 MHz GSM 900 890-915 MHz & 935-960 MHz 24.7 kbps ISM 433 MHz, 868 MHz & 2.4 GHz WiFi 2.4 GHz & 5.8 GHz 1-54 Mbps WiMAX 2. 3-2. 7 GHz & 3. 5-3. 9 GHz, 5.8 GHz, various other bands WirelessHD 57-64 GHz 4 Gbps Wireless USB 3.1-10 GHz 480 Mbps ZigBee 868 MHz & 2.4 GHz 250 kbps regions static WiMAX networks are being developed in areas where ADSL coverage is very poor. In developing countries, WiMAX makes it possible to easily deploy an Internet and communications network using radio relays that are cheaper and quicker to install than an underground copper network. Convergence of networks and technologies Currently, the majority of Internet subscribers use (A)DSL connections. They own one or more PCs, one or more mobile phones, and often a DECT-type cordless phone on their landline. To reduce costs, a popular idea is to tel- ephone over the Internet using software like Skype, using a PC or a dedicated phone that connects to the PC. There are even GSM phones with the Internet option using WiFi. To reduce the number of phone instruments and subscrip- tions, and to make things as simple as possible, some operators have had the idea of turning the box used as an ADSL modem into a mini 3G base station. An electronics card is added into the box, and the operator uses each subscriber as a network repeater station. This is known as a femtobasestation. The transmit power is very low — around 1 0 mW. For users, a single 3G phone lets them stay in touch every- where. Free of charge at home using their 3G femtostation, and paying away from home using the normal 3G network. For the operator, this is one way of increasing network coverage at minimal cost, since each femtobasestation is a small repeater that covers a reduced urban zone, where the standard 3G network sometimes has propagation issues because of concrete. The proliferation of femtobasestations ensures the operator of optimized coverage in an urban environment. But this also poses a few technical problems, since each femtobasestation is a real 3G base station, and must not interfere with neighbouring stations, still less with the normal network so-called 'macro' station. Tests are in progress to resolve these problems. In the future, several technical solutions will be available for wireless 'telephon- ing' and mobile Internet access. Which standard, out of 3G, LTE, WiMAX, and femtobasestation, will be the most widely deployed, only the future and the economic models are going to tell us. Public radio and TV broadcasting Will FM or AM radio broadcasting soon be coming to an end with a new standard, DMB-T (Digital Multimedia Broadcasting Terrestrial)? This standard makes it possible to replace FM so as to receive CD-quality radio. It too is based on multi-carrier OFDM modulation, using two bands, the L band between 1452-1492 MHz and the VHF band from 168-240 MHz. DMB-T also makes it possible to transmit slow-changing graphics information like a disc sleeve or a graphic. This is the standard a number of countries (includ- ing the UK, Germany and France) have chosen to gradually replace FM and move into the digital radio era. The digital revolution is also underway for HF broadcasting with DRM (Digital Radio Mondial) which also uses OFDM modulation, this time centred around 4 MHz. Analogue TV was already replaced by digital terrestrial TV in a number of countries. TV was the first to go digital — first of all via satellite, and then via terrestrial. The DVB (Digital Video Broadcast) standards have existed for a long time and are split into several groups: DVB-S for satellite, DVB-C for cable, and DVB-T for terrestrial. The advent of 24 elektor - 1/2009 high-definition changes the stakes a bit, and DVB-S2 for high-definition satellite has made its appearance. By the same token, DVB-T2 is being produced for high-definition digital terrestrial TV. For mobile devices with their smaller screens, definition is less important than battery life. So a standard derived from DVB-T has been created for mobiles called DVB-H for 'handheld'. It uses reduced bandwidth and a lower data rate, which requires less processing, and hence increases battery life. Industrial radio communications In industry too, radio is widely used for communica- tions between equipment — for instance, wireless telem- etry sensors, video surveillance, or alarm systems. Here again, different standards exist side by side, using different frequencies. The best known is undoubtedly 433.92 MHz, the centre of the ISM (Industrial, Scien- tific & Medical) band in the UHF range. There is also an ISM band centred on 868.3 MHz and another between 2. 4-2. 5 GHz. Each application is free to use its own modulation (generally ASK, FSK, or more rarely QAM) and its own protocol. A Bluetooth hands-free kit. (With kind permission from Logitech) and there is a software network layer that allows commu- nication between different pieces of equipment from differ- ent manufacturers. This is interoperability on an industrial level. ZigBee is still not very widespread in general public domain, but is growing fast in industry. To make certain pieces of equipment compatible amongst themselves, the ZigBee standard (802.15.4) was created, operating in the 868 MHz or 2.4 GHz bands. The range is around 100 m, the data rate may be up to 250 kbps, Trends We are seeing a proliferation of wireless applications. These days, no-one would want a car that didn't have radio remote controlled door locking. A portable PC would ■Advertisement iiiuiiEm * V ■v / h v -■•to, £ % ^ =. .f -iiiiiiii li = HHlMdni minimi l:INB|IPJ Parallax stocks chips for every invention! Pre-programmed with our PBASIC Interpreter, chips are available for every BASIC Stamp model to incorporate into your PCB for production. We also stock compatible resonators and EEPROM chips. Parallax SX chips are 8-bit, high- speed microcontrollers with flash program memory and in-system programming and debugging capability. An affordable solution for larger-volume production, the SX microcontroller is available in 4 package types. Available in three package types, the versatile Propeller chip with its 8 parallel-processing cogs, can perform multiple functions simultaneously and thereby reduce component count in your finished design. www.parallax.com Milford Instruments (+44) 1 977 683665 http://www.milinst.com 1/2009 - elektor 25 TECHNOLOGY WIRELESS LINKS The MAX2170 from Maxim is a triple-band receiver for terrestrial digital multimedia transmissions (DMB-T). no longer sell without a minimum of a WiFi 802.1 Ig connection. All this leads to a multiplication of remote controls, receiv- ers, and transceivers, all working on different frequencies. The risk of mutual interference is increased and the number of frequencies and/or channels available is constantly diminishing. The FOCUS AXSD is an advanced ZigBee meter/circuit-breaker that forms part of an intelligent network (Smart Grid). (With kind permission from Landis +Gyr) (With kind permission from Maxim). FOCUS AXR-SD FORM 2S CL2QQ 24DY 3W 60HlTA=30 Kh 72 98 531 9B4 FIN I! I Mil ! I II Hill L»ndi*+Gli , r Pi-nmiSA. Three antennas! A dual- band WiFi router to the 802.1 In MIMO standard. (With kind permission from Linksys). To allow all these pieces of equipment to work together without interfering with each other, the new standards are more stringent on transmit power levels and adjacent (n+1 , n-1) and alternate (n+2, n-2) channel rejection. The bands are divided into sub-bands and each sub-band is reserved for a specific use. Digital data rates are constantly increas- ing, creating a need to open up new bands at ever-higher frequencies. You can't expect to modulate a 30 MFlz car- rier to transmit 500 Mbps; but you can if that carrier is at 50 GHz. New bands in the microwave frequency range are coming into use for short-range, very high data rate links. New chip manufacturing processes are giving ever- higher transition frequencies (maximum operating frequency of a transistor where the gain has dropped to unity i.e. 1) and radios operating at several tens of gigahertz are now possible. Another trend is the strongly-growing use of mobile devices. Everyone — or almost everyone — has a mobile phone. Portable PCs are becoming widespread, at the expense of office machines, and ultra-mobiles like the EeePC are proving a real commercial success. Peripherals too have felt the urge to go wireless, including mice, keyboards, and indeed certain USB audio/video peripherals with the advent of Wireless USB products using an ultra-wideband protocol in the 3.1-10.6 GHz band, low transmit power, and a very wide operating spectrum. Channel bandwidth is 528 MHz, allowing a usable data rate of 480 Mbps, compatible with USB 2.0. But with a bandwidth and data rate like that, how is it possible to avoid interfering with other transmissions? The transmitted power is very low, of the order of -41 dBm/MHz, and other radio devices see the transmitted signal as background noise. The communi- cation distance is also very short — of the order of three to ten metres maximum. ( 080818 - 1 ) Bibliography and sources www.maxim-ic.com www.analog.com www.cypress.com www.csr.com www.agilent.com/find/wireless en.wikipedia.org/wiki/Phase-shift_keying en.wikipedia.org/wiki/Femtocell en.wikipedia.org/wiki/Ultra-wideband en.wikipedia.org/wiki/ZigBee 26 elektor - 1/2009 We add value to PGBs when others just sell it Prototype * *■ T ■L K Production 3D Enclosure Designing Virtual Assembly — V ttju wvilmm I * Wi y jili j l j Component Quick Prototype Keypad n r\ n r\ r\ A N T E X uuuuu Ante* offer a wide choice of input voltages and bit profiles for our soldering iron range 23QV 60+ years of experience It may surprise you but buying an Antex soldering iron costs less than you think in the long run, British made to exacting standards, they last significantly ton ger than many imported brandy With a wide range of thermal Sy balanced models, and temperature controlled irons too, you can always be sure to find an iron that meets your needs. A large range of replacement tips are available for most irons, and technical help is on hand from our offices in Devon UK. Buy Online Our new website has all of our irons, and soldering spares and accessories available 24hrs a day. Most items are shipped next day, and we offer free carriage throughout Europe. Why not give antex.cb.uk a try! www.anteK.eo.uk FREE shipping on alt orders Ante* Electronics Ltd 2 Westbridge Industrial Estate Tavistock, Devon PL1 9 8DE, UK Tel: +44(0)1822 613565 Fax: +44(0)1822 617598 Email: sales@antex.co.uk Web: www.antex.eo.uk 1/2009 - elektor 27 LED CUBE Jerry Jacobs (The Netherlands) Everyone will have encountered a 2D LED matrix at some time, but the version described here is of a completely different calibre: namely five matrices stacked together into a cube; a true 3D matrix therefore, every LED of which can be switched on and off individually. Hardware specifications • 125 LEDs in a special 3D matrix • ATMEGA32 microcontroller running @ 1 MHz internal clock • 10-way ISP-connector for reprogramming • 5 transistors for switching the layers • 25 transistors for switching the columns Most people are fascinated by flash- ing LEDs. But these are usually lim- ited to just a few LEDs or only a small display. This LED cube is something entirely different however, because there is an additional dimension for even more LEDs. Here we present a 3D display of LEDs, each of which can be controlled individually. This magnificent cube has at its heart an Atmel AVR microcontroller. These controllers are easy to obtain and superb open-source tools are available. Not only for Windows, but also for the Linux and Mac operating systems. Operation You would expect that with 125 LEDs in the cube you would need a large number of wires to be able to control them individually, but that is not so. A lot of wires can be saved because the signals are multiplexed. One ‘layer’, that is all 25 LEDs which are all at the same height in the columns, can be controlled with a single wire. This results in a total of 26 signal wires. If each LED were to be connected individually then 50 wires would be required. To turn an LED on we switch the pos- itive voltage to the desired layer on and select the appropriate column. Table 1 . Layer drivers & column drivers PORTA Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 BitO PA7 PA6 PA5 PA4 PA3 PA2 PA1 PAO Column 8 Column 7 Column 6 Column 5 Column 4 Column 3 Column 2 Column 1 PORT B Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 BitO PB7 PB6 PB5 PB4 PB3 PB2 PB1 PBO Column 25 — — Layer 5 Layer 4 Layer 3 Layer 2 Layer 1 PORT C Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 BitO PC7 PC 6 PC5 PC4 PC3 PC2 PCI PCO Column 1 6 Column 1 5 Column 1 4 Column 1 3 Column 1 2 Column 1 1 Column 1 0 Column 9 PORT D Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 BitO PD7 PD6 PD5 PD4 PD3 PD2 PD1 PDO Column 24 Column 23 Column 22 Column 21 Column 20 Column 1 9 Column 1 8 Column 1 7 28 elektor - 1/2009 Source LEDs Our cube has 5 layers and 25 columns. That means then that we have 30 wires for 125 LEDs. Without multiplex- ing the signals we would end up with 250 wires! With a clock speed of 1 MHz we obtain a refresh rate of 39 ‘frames’ per sec- ond. Every 1024 th clock tick a coun- ter is incremented (the clock divider used for this is also called a prescaler). When this counter reaches the value of 5, an interrupt is executed and the counter is reset. This interrupt takes care of sending the value in the buffer to the LED matrix. The controller in the cube has a clock speed of 1 MHz (internal clock). The software updates every 5 counter clock ticks. The internal clock is divided by the prescaler to become the counter clock. This results in a refresh rate of 195 Hz for the entire cube. Since we have five layers we divide this rate by five and arrive at 39 Hz per layer. Software The software (firmware) is written in C and can be compiled with avr-gcc [1]. It is also documented in such a way that it can be viewed as a web- site. This is made possible because of Doxygen [2]. Buffer Because it is quite complex to get the cube to display and arbitrary pattern in a simple way, a buffer is used for this purpose. The advantage of this is that you manipulate the bits in the buffer using functions which means that you do not need to write to outputs directly yourself. That’s the job of the interrupt routine. The buffer, just like the cube, has mul- tiple dimensions, so you can ‘draw’ a pattern in the buffer and the interrupt routine takes care of the rest. Interrupt The interrupt routine in the code, as already mentioned, ensures that the pattern on the cube is refreshed 39 times per second. This interrupt routine writes the val- ues, which you wrote to the buffer using another function, from the buffer to the appropriate ports and puts the bits in the correct place. We use bit masks which ensure that we only look at the corresponding bits which have to be low or high at the pins.. Low-level graphical instructions The routines have been put together in such a way that you can create your own effects for the cube. In Table 1 you can see exactly which pin connects to where on the cube. This makes it easier for begin- ners to get started quickly without the need to immediately understand how bit-masks, bit-shifts and other compli- cated functions work. These low-level instructions are defined in draw.h, this is the interface file for the instructions to control individual columns, layers, rows, etc. Below are a few examples which show how these functions can be used. For controlling a row on a certain layer we use set_row (ROW_l , LAYER_1 ) ; clear_row (ROW_l , LAYER_1) ; toggle_row(ROW_l, LAYER_1 ) ; The following functions can be used 1/2009 - elektor 29 LED CUBE CD II " 00 r? O ° CD co CO 150R ho TJ CO 1k8 o o I— o> lk8 150R 73 CO ro 150R to 73 CO CO 150R 73 CO -u o o I— cn 1k8 o o r- ■fev 1k8 o o Co 150R 73 CO cn O O NS 150R 05 73 CO 05 150R oo o CO cn cn 73 co ~0 O O 1k8 o o I— o 1k8 150R 73 CO oo O O CO G3 C3 « — * J 4 IrO 1 1 oortD L ~n 11 31 12 13 CO ro ro co o o o o 4i> I NO ) o cp cp o o o co -~j cn I co - 73 cn 7s ro n o 03 100k Og 73 cn o> I o> — ■ 330R 73 05 cn 173 cn 73 4^ is. 3 CO 73 CO is. -< tO I I 73 m TJ O T3 O T3 O T3 O "D O "O O ■O O TJ O GND m — i ~s| 05 cn 45. CO to — * o o o O -Q O O O a — \ —1 — t X s> ro PT1 o o s — 1 TJTJTJTJT3T3TJT3 QJCDCDCDDODOCDDD SO)Cn^WN)-iO GND XTAL2 XTAL1 W 2 § W| > > 3 s ' => os CD 2-1 (£2 — 3 m O CO IO iso X o § VCC AVCC "a "□ o o r-r> "O TJ TJ TJ TJ TJ TJ -o 05 -n T3 T3 T3 TJ TJ S > > > > > > > >AREF u O O O O O T3 -ni CT> cn 45. CO to <=> —i -H O 45. CO to o n - — ' , „ , . „ K „ „ . . . . „ „ o o 00 „ „ — * > > > > > > > cn cn o — 1 —1 cn cn O o o o CJ CJ CJ CJ o o ^ o s o CJ o o o o o o o o o to o c/s > 1“ a> cn 4^ CO to O 73 ro co 73 to 4^ 73 to cn 73 to CT> to -O to OO 73 to CO to to 1 4 LrQ 1 1 4 1x0 L ^^73 1 <11/0 1 1 <1 1x0 L ^^73 I : j 10 30 -O^ 32 CO JR roJ^I U O 150R O O oo N3 2 -o 150R oo o O 3 00 73 oo 2 CO 150R O o 150R cn 173 ro O 150R |— oO 73 05 ro 73 ro ISO O 150R | — oO 73 co 73 co 73 to to Figure 1. The AVR microcontroller is at the heart of this project. What is immediately obvious is the large number of transistors. 150R CO 30 elektor - 1/2009 for switching a column on and off: set_column (C0LUMN_1 , ON); set_column (C0LUMN_1 , OFF) ; We use handy names such as ON, OFF and COLUMN_l. These are defined names, also called macros, which have a fixed value. For example, ON has the value 1 and OFF the value 0. All these functions can be used one after the other to draw the desired picture. Because we cannot show all the source code and examples here, you can download them from the Elektor website. Hardware Normal ‘through-hole’ com- ponents are used to build the cube. The PCB is still very compact nevertheless. PBO PB1 PB2 R4 PB3 R5 PB4 R6 R2 R© ^Jj2 © © ^Jj4 © +5V ■o © LAY16 LAY26 LAY3Q LAY4 6 LAY56 ±- 1 3P L C0L1 1 R PAO R15 R7 HEEJ © 080355-12 Figure 2. In this figure you can see the path that the current takes through the middle LED in the first column. A mains adapter supplying at least 9 volts and rated 600 mA can be used as the power sup- ply. IC1 (a 7805) provides the voltage regulation and protec- tion diode D1 guards against accidental reverse polarity. Transistors T1 through T5 are used to connect the 5-volt power supply voltage to the different layers. The columns are switched with T6 through to T30. The return current flows through these latter transistors to ground and com- pletes the circuit through the LEDs (see Figures 1 and 2). The value of the column resis- tors depends on the voltage drop across the LEDs. We make the assumption that each LED requires 20 mA. This is also the current that will flow through the entire column. The power supply for Figure 3. The component overlay of the PCB shows the neatly arranged layout of the parts. 1/2009 - elektor 31 LED CUBE COMPONENTS LIST C2,C3 = lOOnF C4 = ljL/F 100V Resistors R1 = lOOkQ R2-R6 = 330£2 R7-R1 4, R31-R38, R47-R55 = see text R15-R30, R39-R46, R56 = 1 kQ8 Capacitors Cl = 470 a/F 25V Semiconductors IC1 = 7805 IC2 = Atmega32 D1 = 1N4001 T1-T5 = BC337 T6-T30 = BC547 1 25 LEDs for cube Miscellaneous 10-way boxheader (2x5), 2.54mm lead pitch 1 0-way SIL pinheader (1C socket) Heatsink, TO-220, 5°K/W for IC1 4 off M 3x5 bolt with 1 0-mm long hex spacers Mains adapter socket for 2.5mm pin diam. PCB, order code 080355-1 from the Elektor SHOP each layer is 5 V. The calculation for the resistance is then approximately: R = (5 V - U LED ) / 20 mA Assuming the voltage drop across the transistors can be neglected. For reprogramming of the cube the ISP interface is connected to K2. Table 1 shows which column and which row is connected to which bit. ( 080355 ) Internet Links [1] AVR-GCCTool chain: - For Windows: http://winavr.sourceforge.net - For Mac: www.obdev.at/products/avrmacpack - For Linux: depends on the distribution [2] Doxy gen: www.doxygen.org Get cracking! Step # 1 The ‘pillars’, made from PCB stand-offs, are mounted on the PCB first. The holes in the PCB serve as a guide so that each layer of LEDs can be soldered neatly. Use a sheet of paper so that the LEDs can be fitted tightly in the holes. It is best to pre- punch the holes first, using a ballpoint pen, for example. Step # 2 Fit five LEDs in the top row with the anodes (long pin) at the top and the catho- des (short pin) at the bottom. Next, bend the anode lead of the first LED to the left and move on to the second LED. The second LED is then soldered to the first LED. Repeat this until the entire row is complete. For each layer, five rows are required. We therefore repeat the whole story for the second to the fifth row. Once all five rows are complete, the bent anodes are all connected together with two perpen- dicular connections. After that the whole layer can be pushed out of the guide in one move using a flat plate. Step # 3 Once all five layers are finished, they are soldered together until they form the final shape. You do this by placing a layer on the PCB. On the next layer, bend the ends 32 elektor - 1/2009 The author Jerry Jacobs (1989) is a third-year Telecommu- nications/ICT student at ROC Leeu- wenborg College in Sittard, The Nether- lands. From a young age Jerry's been fascinated by the inner workings of computers and electronics. He is also a big Linux fan. The project described in this article was designed and produced during Jerry's traineeship period at Elektor. of the 25 column leads over by about 3 mm, to reach around the LEDs of the pre- vious layer. The second layer is subsequently placed above the first layer and we solder this layer at every connection, with a uniform spacing between the layers and the LEDs neatly lined up. Step # 4 All the other components are now mounted on the PCB. Make sure that the BC337 and BC547 transistors are not mixed up! The voltage regulator with its heatsink is mounted last. Step # 5 The final step is connecting each of the layers to their corresponding transistors. T1 is connected to the bottom layer and T5 to the top. Use tinned copper wire for this. Step # 6 The example software can be programmed into the chip. This software, together with the source code, can be downloaded from the Elektor website. You can also order the bare PCB from the SHOP section. 1/2009 - elektor 33 MICROCONTROLLERS There is plenty of cable in the world, most of it tangled up behind various pieces of equipment. An alternative is data transfer using low-cost radio modules, which are easy to connect to a microcontroller. We have tried this out using two ATmega microcontrollers programmed using BASCOM-AVR, handling near-simultaneous transmission and reception. Module characteristics • Operating voltage: 2.2 V to 5.4 V • Current consumption, transmitting: 23 mA • Current consumption, receiving: 14 mA • Frequency range: 860.48 MHz to 879.51 MHz • Transmit power: up to 4 dBm (approximately 2.5 mW) • Sensitivity: -100 dBm (approximately 2 jL/V) • Data rate: up to 1 15.2 kbaud • Frequency deviation: 1 5 kHz to 240 kHz • Receiver bandwidth: 67 kHz to 400 kHz • 1 6 bit receive data FIFO • Two 8 bit transmit data registers The low-cost radio modules from Hope RF [1][2] use the IA4420 universal ISM band FSK transceivers from Inte- gration Associates (now Silicon Laboratories Inc.) [3]. The IA4420 can be configured for use at 3 1 5 MHz, 433 MHz, 868 MHz or 91 5 MHz, although in Europe only 433 MHz and 868 MHz may be used. For each of the various bands Hope RF offers a module with a correspondingly trimmed antenna circuit (Figure 1). For this article we have cho- sen the 868 MHz variant, as this band is less congested than 433 MHz. The module can be operated at 433 MHz but because of imperfect antenna matching the maximum achievable range is severely reduced. The module must be operated in accordance with the requirements for Non-specific Short Range Devices (SRDs) at a frequency of between 868.0 MHz and 868.6 MHz: in particular, the maximum permitted transmit duty cycle is 1 %. Because of the relatively broad modulation we oper- ate the module in the middle of the permitted band, at a centre frequency of 868.3 MHz. 34 elektor - 1/2009 The block diagram of the transceiver (Figure 2) shows the most important details. At the heart of the receiver is an l-Q mixer similar to that used in the now famous Soft- ware Defined Radio circuit published in Elektor in May 2007. The baseband signal is processed via an amplifier, filter and demodulator to pro- duce a digital output. In the transmitter the PLL VFO drives the output stage directly. The modula- tion scheme used is FSK (frequency shift keying). The frequency deviation and receiver bandwidth are both configurable over a wide range: in contrast to the widely-used narrowband FM systems, frequency devia- tions of from ± 15 khiz to as much as ± 240 kHz are possible, with corresponding receiver bandwidths of up to ± 400 kHz. Initialisation As can be seen from Figure 3, the RFM1 2 modules are driven over an SPI bus using a total of four signals: chip select (NSEL), clock (SCL), and a data line in each direc- tion (SDI and SDO). The hardware SPI port of an ATmega microcontroller can be used, as long as it is borne in mind that the RFM1 2 expects 1 6 bit messages. In the case of the ATmega32 pins PB4 to PB7 are used for the SPI port (/ SS, MOSI, MISO and SCK). The program listing shows how a 1 6 bit word is transferred. The routine, which works for both input and output, can easily be modified to suit other AVR microcontrollers with a different port pin allocation for the SPI bus. Figure 1. Antenna matching inside the module. The exact circuit and component values used depend on the frequency range for which the module is designed. Nsel Alias Portb . 4 Sdi Alias Portb . 5 Sdo Alias Portb . 6 Sck Alias Portb . 7 Function Spil6 (byval Dout As Word) As Word Local Nspi As Integer Local Dspi As Integer Local Dsdo As Word Nsel = 0 Dsdo = 0 For Nspi = 1 To 16 Dspi = Dout And &H8000 If Dspi = 0 Then Sdi = 0 Else Sdi = 1 End If Dout = Dout * 2 Dsdo = Dsdo * 2 Dsdo = Dsdo + Sdo Sck = 1 Waitus 5 Sck = 0 Next Nspi Nsel = 1 Spil6 = Dsdo End Function Once power is applied to the module it must be initialised. Figure 2. Block diagram of the IA4420 transceiver. Test PB6— SDO, IRQ , FSK/DATA/FFS , DCLK/CFIL/FFIT, CLK , RES , GND, SEL — PB4 SCK — PB7 SDI — PB5 INT/VPI GND - GND VDD — +5V ANT -ANT 071125-12 Figure 3. Pinout of the radio module. PB4 to PB7 are the connections for the ATmega32 , s SPI port. The receive signal strength can be monitored at the test point. 1/2009 - elektor 35 MICROCONTROLLERS Figure 4. A diode can be used to verify that there is a signal present at the antenna output. be selected with the judicious use of a GOTO statement. Our first tests transmit continuously, and so are not compli- ant with the regulations on the use of the 868 MHz band. They should therefore be carried out without an antenna connected. The listing below shows how to test the trans- mitter without a modulating signal. The command &H8238 turns on the transmitter. To see if there is a signal present at the antenna output, connect a germanium or Schottky diode in parallel to ground (see Figure 4). A voltage of around 1 V should be present across the diode. If you are lucky enough to have a radio scanner, you can use it to look for the transmitted signal: not at 868.3 MHz, but at around 868.21 MHz, as in the absence of a modulating signal the carrier shifts down to this value. There is such a large number of configuration bits that it is not easy to get them all right first time. The comprehensive datasheet [3] lists all the settings. The listing below shows the recommended values for operation at 868.3 MHz with a frequency deviation of ± 90 kHz and a data rate of 2.4 kbaud. Subroutine Freq_rfml2 is also required as part of the frequency setting procedure. If the 433 MHz band is to be used, replace the value &H80e7 with &H80d7 in the listing. Nsel = 1 Sck = 0 'D = Spil6 ( &H8 0d7 ) '433 MHz band D = Spil6 ( &H8 0e7 ) '868 MHz band D = Spil6 ( &H82 d9 ) D = Spil6 (&Ha6 7c) D = Spil6 ( &Hc6 47) D = Spil6 ( &H94 a0 ) D = Spil6 (&Hc2 ac) D = Spil6 (&Hca 81) D = Spil6 ( &Hc4 83) D = Spil6 ( &H98 54) D = Spil6 (&HeO 00 ) D = Spil6 ( &Hc8 00 ) D = Spil6 (&Hc0 00 ) Freq = 868.300 Freq_rfml2 Sub Freq_rfml2 If Freq < 800 Then Freq = Freq * 2 Freq = Freq - 860 D = Freq / 0.0050 If D < 96 Then D = 96 If D > 3903 Then D = 3903 D = D + &HA0 0 0 D = Spil6 (d) End Sub Transmission There are so many possible pitfalls in using the modules that it is best to start with the simplest possible tests. The pro- gram RFM1 2.bas includes a number of test routines that can 'start transmitter, no data Testl : D = Spil6 ( &H82 3 8 ) Do Loop Our second test produces a modulated data signal (see below). The command used for this is &Hb8xx, where 'xx' is the modulating byte. In our example we use &Haa, which in binary is 10101010. Before each byte is transmitted the function Wait_rfml 2 must be called to wait until the module is ready: this involves taking NSEL low and waiting for SDO to go high. This works whether the module is operating as a transmitter or as a receiver. Sub Wait_rfml2 Nsel = 0 Do Loop Until Sdo = 1 End Sub 'transmit data Test2 : D = Spil6 ( &H82 3 8 ) Do Wait_rfml2 D = Spil6 (&Hb8aa) Loop Now the scanner should be able to pick up carriers at both 868.21 MHz and 868.39 MHz, as the transmitter is con- tinuously switching between these two frequencies. Reception To receive data a second system, comprising an ATmega32 and RFM12, is needed. Our next test demonstrates receiv- ing 100 data bytes in continuous reception mode, with all the bytes received being passed on verbatim over the RS232 interface. 'start receiver, all data Test4 : D = Spil6 ( &H82c8 ) D = Spil6 ( &Hca87 ) For N = 1 To 100 Wait_rfml2 D = Spil6 ( &Hb0 0 0 ) Data_in(n) = D Print Chr (d) ; Next N Do Loop The receiver produces output data even when there is no 36 elektor - 1/2009 signal being transmitted on the frequency being used. In this case the above test will convert receiver and antenna noise into a sequence of random numbers. An interesting effect is observed when the transmitter is switched on. For example, the second test above always sends the byte &Haa. How does the receiver react to this signal? The stream of bytes output changes immediately to a regular pattern, but not necessarily the correct one. On closer inspection it turns out that the sequence of bits is cor- rect but that the receiver does not know where each byte begins and ends. It is also possible to check the strength of the received sig- nal. The IA4220 has a pin connected to part of its AGC cir- cuit (ARSSI, shown as a test point in Figure 3) which unfortu- nately is not brought out to a pin on the module. However, the required test point is easy to locate on the printed circuit board, on the capacitor in the corner. The DC level at this point reflects the strength of the received signal. With no signal the level is typically between 0.3 V and 0.5 V, and with a strong signal the voltage can rise above 1 V. In nor- mal operation it is always possible to check this voltage to verify that the signal bursts from the transmitter are being received at sufficient strength. Here the author has soldered the module to a connector... D = Spil6 ( &Hca83 ) For N = 1 To 100 Wait_rfml2 D = Spil6 ( &HbO 0 0 ) Data_in(n) = D Print Chr (d) ; Next N Do Loop Synchronisation In principle we could take the (unsynchronised) bit stream from the receiver and extract the valid data with some cun- ning software. However, the designers of the IA4420 have included a feature to avoid this effort: the received data stream is continuously fed through a 16 bit shift register, and as each bit is received the contents of the register are compared against a fixed bit pattern. The magic number in question is hexadecimal 2DD4 (not to be confused with R2-D2!). The transmitter must therefore send exactly these two bytes, first hexadecimal 2D and then hexadecimal D4, in the data stream. At that point the receiver will then know that the next bit is the first bit of the first byte of the message proper. In practice the transmitter first sends an alternating sequence of ones and zeros, for example three bytes with hexadecimal value AA. This gives the receiver the chance to synchronise to the bitstream and adjust its automatic level control. After this pattern come the magic bytes and then the message itself. In this test the two bytes 2D and D4 are sent alternately. 'transmit key data Test3 : D = Spil6 ( &H82 3 8 ) Do Wait_rfml2 D = Spil6 ( &Hb82d) Wait_rfml2 D = Spil6 ( &Hb8d4 ) Loop Now we run the following test in the receiver, which differs only from the previous receiver test in the second initialisa- tion command. Again, 100 bytes are to be received. How- ever, in this case the program will wait in the routine Wait_ rfml 2 until the transmitter is switched on. The SDO line on the receiver will only go high when the bytes 2D and D4 are received, and the bytes that follow are deemed valid, with the transmitter and receiver agreeing on the positions of the byte boundaries. 'start receiver, matched data Test5 : D = Spil6 ( &H82c8 ) Transferring useful data With this test completed successfully we have everything we need to transfer useful data. The next listing shows suit- able transmit and receive routines, in each case employ- ing a data buffer of 10 bytes. When transmitting using Send_rfml2 two dummy bytes are appended to the ten data bytes: this ensures that the transmitter is not switched off too quickly while the last payload byte is being sent. The receive code includes a timeout feature: if the global variable Timeout is set to 1 00, Receive_rfm 1 2 will wait for at most 100 ms for incoming data. If nothing arrives, the receive buffer is left unaltered. Sub Send_rfml2 D = Spil6 ( &H82 3 8 ) Wait_rfml2 D = Spil6 (&Hb8aa) Wait_rfml2 D = Spil6 (&Hb8aa) Wait_rfml2 D = Spil6 (&Hb8aa) ... to allow experiments with an STK500AVR starter kit! 1/2009 - elektor 37 MICROCONTROLLERS Application ideas • Switching devices such as lamps and radios • Robot remote control • Garage door openers • Master switches for children's bedrooms, to ensure that everything is switched off at night • Alarm systems • Sending simple messages to the workshop (such as 'dinner is ready'!) • Remote heating system status monitoring • Monitoring analogue values (with modified software) • Remote monitoring of batteries and chargers • Weather station Wait_rfml2 D = Spil6 ( &Hb82d) Wait_rfml2 D = Spil6 ( &Hb8d4 ) For N = 1 To 10 Wait_rfml2 D = &HB800 + Data_out (n) D = Spil6 (d) Next N Wait_rfml2 D = Spil6 (&Hb8aa) Wait_rfml2 D = Spil6 (&Hb8aa) Wait_rfml2 D = Spil6 ( &H82 0 8 ) End Sub Sub Receive_rfml2 Tt = Timeout * 10 D = Spil6 ( &H82c8 ) D = Spil6 ( &Hca83 ) For N = 1 To 10 Nsel = 0 T = 0 Do T = T + 1 Waitus 100 If T > Tt Then Goto Nosignal Loop Until Sdo = 1 D = Spil6 ( &Hb0 0 0 ) Data_in(n) = D Next N Nosignal : D = Spil6 ( &H82 0 8 ) End Sub Receive_rfm 1 2 and Send_rfml2 are all that is needed to build a fully-fledged radio application. The aim is that the same firmware should be running at both ends of the radio link, so that the two systems can alternately transmit and receive data. In our example we populate the transmit buffer with an incrementing pattern. The receiver outputs the ten payload bytes over its RS232 interface, so that it is easy to verify that the link is working. One problem then remains: how do we ensure that the two stations do not attempt to transmit simultaneously and thus each fail to receive the other's data? This is easily solved with a dash of randomness: we change the timeout value at random in the range 400 ms to 1400 ms. After possibly a small number of transmission attempts, one station will find the channel clear; once one message is successfully received the two stations will then proceed to transmit alter- nately in step with one another. Do For N = 1 To 10 Data_out (n) = N Next N Send_rfml2 Waitms 500 For N = 1 To 10 Data_in(n) = 0 Next N Timeout = 400 + Rnd(1000) Receive_rfml2 For N = 1 To 10 Print Data_in(n); Print " " ; Next N Waitms 700 Loop A practical application of this system would be to read a byte in from a port on one microcontroller and transmit it to the other, which could then output the byte to one of its ports. This would in principle allow up to eight devices to be controlled remotely. One way to increase the reliability of the link would be to send the byte first in true form and then inverted: this would allow the detection of single-bit communication errors. It would also be possible to connect the outputs of the receiving microcontroller back to an input port on the same microcontroller, which could then provide feedback to the transmitting station. An application along these lines in the ATM1 8-CC 2 series can be found elsewhere in this issue, and we give some other possibilities in the text box. ( 071125 ) The radio module is available from the Elektor shop (order code 071125-71). See our website [2] or the pages at the back of this issue. The BASCOM program is available for download from the Elektor website [2]. Internet links [1] http://www.hoperf.com [2] http://www.elektor.com/071 125 [3] http://www.silabs.com/Support%20Documents/Technical- Docs/IA4420-DS%20vl .7r.pdf 38 elektor - 1/2009 I touo Dest testing loudsp ^ IS Design Cookbook ■yth Edition by Vance Dickason r ^INCLUDES X ^ BONUS CD WITH ADDED MATERIAL ftND DESIGN w SOFTWARE/ Testing Loudspeakers by Joseph D’Appoht° expert ADVICE from THE INVENTOR OF THE WITM Speaker Building 201 by RayAlden ;>v. ■ I "JgKRKf PRESENTS ORDER YOUR COPIES OF THESE BOOKS FROM MOTH GROUP AT 1 0 Dane lane Wilstead Bedford MK45 3HT. Telephone ++44(0)1234 741 152 Fax ++44(0)1 234 742028 email: sales@mothgroup.com url: www.mothgroup.com QUALITY PCB & SERVICE PROTOTYPE TO PRODUCTION instant online quote shopping cart ordering system China competitive prices free electrically test web h pcbcart, cum sates@pcbcart.oom ft?/ +86-571^7013819 Fa* +86-57 1 •87036705 Aefe i No, 76 GuCur Road, Hangzhou, China GEM ERAL CIRCUITS CO., LTD 1/2009 - elektor 39 Dr. Erik Lins and Steffen Fuchs (Germany) Longwinded discussions are costing commerce millions. Our meeting cost timer reveals the true cost of 'free speech' at business gatherings. The large seven-segment display lets you watch your money running away, whilst a single turn-and-push control switch makes operation of this attractive timer child's play. The credit crunch affecting most firms currently is not the only reason why they should be saving money Cutting down on direct costs often also leads to significant productivity improve- ments. Frequently the actual outlay on individual processes is not known in any great detail, meaning the potential savings of some new measure may not be easy to assess. This applies in par- ticularly to purely organisational proce- dures, in which we must include those beloved meetings. A distinct and ingrained meetings culture exists in most large organisa- tions. Participating in all this are many (expensive) executives and not infre- quently also plenty of (more or less expensive) fellow workers also play roles, even though they are generally involved in only a few points on the agenda. In itself the duration of a meeting pro- vides only a sketchy idea of the costs involved. Good intentions for holding productive and time-efficient meetings are all too often defeated by the time wasted afterwards on debriefing and reappraisal. How effective it would be if everyone could see the true cost of time wasted in meetings! Practicalities Even though notebook computers and data projectors are nearly always to hand in conference rooms and could be used to display the costing we have been discussing, the fact is that the stark reality of a large bright-red seven- segment display device would have significantly greater impact. In any case speakers would not take kindly to having a cost-clock display overlaid onto their carefully crafted PowerPoint presentations! A standalone solution would make the choice of a prominent location for displaying the cost of meet- ings significantly simpler. The device would have to be easy to operate and confine itself to the bare essentials. Parameters to preset would include the number of participants and their average hourly rate of pay. Any- thing more than a start, stop and reset function would be unnecessary. The number of digits for display- ing the cost has been defined as six. With two digits behind the decimal point we can show up to 9999.99 pounds (or euro, or what- ever currency you choose). If this total is exceeded regularly, things will presumably not be looking very good for your firm in future. That said, digits after the decimal point are not abso- lutely necessary but then you’d lose the effect of the decimal point flashing every second, which certainly under- lines the impression of time flying by (and money running away). Operation At switch-on the meeting cost timer announces itself briefly with the word HELLO and then invites you to enter the two vital parameters. These are the number of participants (display prompt shows PAR) and average sal- ary cost (display shows EUR but of course your figure can be in any cur- rency of your choice). Data is entered using the combined rotary switch 40 elektor - 1/2009 The recipe for productive meetings by Markus Sohngen Office jokes like "Feeling bored? Then call a meeting!" or "How about coffee at the firm's expense? Set up a meeting!" are no longer amusing for most organisations. Meetings can of course have a se- rious purpose: to agree a new policy or an important decision, for conflict resolution or a team celebration after achieving an important goal. Here are the ten most important rules for meetings: 1 . Spend some time on the invitation. Give people precise informa- tion on the date, time, duration, agenda and targets but keep the fine detail under wraps until the meeting. 2. The place you choose can determine how successful the meeting turns out. The 'right' location may work wonders! 3. The time of day should be selected carefully. Making crucial strategy discussions as soon as people have come into work may be unwise. 4. Invitees should feel their participation is crucial. 'The fewer the better' is only a half-truth and what you need is the right number and the right people. 5. Speak in a clear and engaging way, setting out background is- sues, the sequence of events to date, successes so far and the desired outcome. Bring any fruitless discussion to a rapid end. 6. If the meeting runs out of steam you can use this hiatus to offer a preliminary conclusion. Stick to your planned remit, time and targets. 7. Summing up when you reach intermediate conclusions is vital. 8. Motivation must continue until the very end of the meeting. Ex- ploit opportunities for humour — but with care! 9. Always keep an eye on the time. Are you leading a constructive meeting or is it developing into just an expensive hot air session? 10. When you come to wind up, recapitulate all the solutions that you have succeeded in finding. Compare your targets and the results you have achieved. Give the participants plenty of feed- back. Always close your productive meeting with thanks and mo- tivate the participants for the next meeting! 1/2009 - elektor 41 COST COUNTER GND GND 080396-11 Figure 1. The ATmegal68 controls six large 7-segment display characters. (encoder) and pushbutton. Turning the knob increments or decreases the fig- ure and pressing it enters the amount, ready for entering the second param- eter. Following entry the display first pauses at 0.00 currency units. Press- ing the switch once more triggers the timer, which will then increment until the clock is stopped by pressing a sec- ond time. A third press on the switch resets the timer to 0.00. Pressing the switch at any time for more than two seconds reverts to parameter entry, enabling you to re-enter the parame- ters to change the number of partici- pants and salary cost. The circuit When we selected the components for this project we kept in mind constantly the need to choose ones that were readily available from the more pop- ular catalogue distributors. All parts used have straightforward wire leads or solder pins, to make replicating the design as easy as possible. Figure 1 shows the circuit of the meet- ing cost timer, where besides the 70 mm-tall 7-segment display you will spot many familiar ‘old friends’. A coax- ial-type power supply connector means that many common ‘wall-wart’ mains adapters will suit without further ado. A Schottky diode protects the circuitry against accidental polarity reversal of the external voltage on its way to the 7805 linear voltage regulator. As the 7-segment displays are connected directly to the external supply voltage, this latter must not exceed 12 V. If you intend to use a higher voltage then the 42 elektor - 1/2009 series resistors of the cathodes must be changed (see below). The ‘brain’ of the device is an ATmegal68 microcontroller from the Atmel AVR range, which on the one hand takes care of setting the base parameters plus the start, stop and reset functions and on the other sees to controlling the multiplexing for the 7-segment LED displays. The controller is programmed using an ISP connector wired to the standard 6-way pinout, meaning that any common AVR-ISP programmer can be used for this. An optional I 2 C real-time clock PCF8583 is not required at this stage but could be retrofitted subsequently if you felt the need to add a conventional time display option to the clock. Data entry is by means of a rotary coder with additional press-switch function (SI or S2). Twin output sig- nals from the encoder provide two phase-shifted square-wave signals. The sequence of the rising and falling edges provides the number of steps and the directional information. Turn- ing and pressing the encoder triggers interrupts on the I/O pins connected to the microcontroller. The corresponding interrupt service routine evaluates the pins and controls the onward flow of the program. Reference timing for the display is provided by a 32768-Hz clock crystal, to which the asynchronous oscillator (Timer 2) of the ATmegal68 is slaved. This provides a timebase accurate to a second for calculating the cost. The timebase for multiplexing the 7-seg- ment display modules relies on the internal 8-MHz R-C oscillator of the microcontroller. Corresponding pres- calers create a timebase of 488 Hz, so that the human eye is not aware of the time-displaced presentation caused by the fact that each segment is activated at more or less 80 Hz (= 488 Hz / 6 displays). Multiplexing Were we to attempt to drive the six 7- segment devices in parallel without resorting to multiplexing, this would require a microcontroller with at least 42 I/O pins. Furthermore, large high- brightness 7-segment displays gener- ally use not just one LED per segment but four LEDs in a row (as in the type used here). This demands four times the voltage, in other words a good 8 V. Each I/O pin would then need a low- side (open collector/open drain) driver too. That would mean 42 drivers plus 6 for the decimal points. From a circuitry point of view it is far simpler to control the displays by time displacement. The displays are pro- vided with a common anode and sep- arately connected cathodes. We then employ multiplexing to connect a posi- tive voltage to each of the 7-segment display devices in sequence, using one high-side driver each. The respective cathodes of the 7-segment displays are connected to one another so that after each time they are advanced, the appropriate bit pattern is applied to the cathodes of the active displays. In this way our need for driver devices is reduced from 48 low-side drivers to just eight low-side drivers and six high- side drivers and correspondingly only 14 I/O pins on the microcontroller. We can save three more I/O pins by using a 3:8 demultiplexer to select the high-side driver, as then no more than one display is ever active at the same time. Selection is now performed by the bit pattern of the three I/O pins. The output Y0 belonging to bit pattern 000 is not used, to prevent one of the displays being activated by an unpro- grammed controller (all I/O pins are high-impedance). The last output Y7 is also unused, since only six display devices are in operation. For the high-side drivers we are employing two L293D H-bridge driv- ers. Designed primarily for controlling DC motors, each L293D gives us four push-pull outputs (to enable their use as an H-bridge) that can handle cur- rents of up to 600 mA. For our purpose with six displays we need one and a half L293D chips (the two remaining outputs are left open). As the L293D has active-high inputs the demulti- plexer has got to be a 74HCT238 with positive output logic rather than the more commonly used 74HCT138 with negated outputs. A ULN2803A Darlington transistor array with eight outputs, used as a low-side driver, takes care of control- ling the eight cathodes (seven seg- ments plus decimal point). The emit- ters of the eight transistors are com- moned internally and are connected to GND externally, so that each input can switch one of the outputs to GND. At this point we cannot save any more I/O pins (by using a demultiplexer for instance), as this might lead to several r — — — — — — — — — — — — — — — — — — — n ! Quick project specs i • 70 mm tall 7-segment displays i • Maximum total displayed: 9999.99 i • Single switch operation using rotary en- 1 coder with press-button function i • Connections and operating control can be mounted on either the right or left- i hand side of the PCB i • Controller: ATMegal 68-20PU • ISP adapter for programming • Power supply using 12V/ 800 mA i mains adapter L ________ J segments lighting at once. The series resistors for the segments are configured for the widely used supply voltage of 12 V. Each seg- ment accounts for four times the voltage requirement of a single LED (about 1.85 V), meaning that around 4.6 V is unaccounted for. The 68 ohm series resistors limit the current flow- ing through each segment to around 67 mA / 6 = 11 mA (average value). This is slightly below the nominal value according to the data sheet but should nevertheless be perfectly bright enough. The decimal point employs only two LEDs connected in series, so here a different series resistor has to be used. In theory the 220 ohms used is too high and limits the current to just 6 mA or so, but in practice this provides the same ‘perceived’ bright- ness as the other segments to users. : Meetings run I I up vast bills I i In The Netherlands, a study was made i on this controversial topic. At the end of i 2007 their first 'conference barometer' in- ( i dicated that meetings in the Netherlands i alone (population around 16 million) cost i the country around 60 billion euro (£ 51 ( i billion) a year! i i The average Dutch employee spent some i 1 three and a half hours a week in meet- 1 ings, the study revealed. The larger the i organisation and the higher the employ- i 1 ee's function, the more time was spent in discussions. Of the annual cost men- i tioned, around half was accounted for by i 1 the meetings themselves. Another 27 per 1 cent was spent on preparations and the i remainder went on travel costs. i _ J 1/2009 - elektor 43 COST COUNTER Software Saving drivers for multiplexing is bal- anced by greater complexity in the soft- ware, on account of the constant need to shuffle the 7-segment displays and apply the correct bit patterns to the cathodes in order to give the impres- sion of an always-on display. The software of the meeting cost timer and matching values for the demulti- plexer are output on port C to the cor- responding display. The cathode bit pattern is made ready correspondingly at port D. Also determined in the Timer 0 interrupt routine is how long the switch has been pressed. This must be for a minimum of around 120 ms (to debounce the switch) The program needs to dwell as briefly as possible in the interrupt routines to avoid delaying the rest of the program flow. For this reason the interrupt rou- tines generally do no more than poll statuses and set flags correspondingly, leaving the main program to handle the actual reaction to status changes and the consequent execution. COMPONENT LIST Resistors (all 0.25W, 5%) R1 = 220Q R2-R8 = 150^ R9 = 1 0kf2 Capacitors Cl = 330nF, ceramic, lead pitch 5mm C2 = 10jL/F 16V C3-C8 = lOOnF, ceramic, lead pitch 5mm Semiconductors D1 = 1N5817 (Schottky diode, 1A) IC1 = LM7805 (TO220 case) IC2,IC3 = L293DNE, DIP! 6 case (Farnell # 1470423) IC4 = ULN2803A, DIP18 case (Farnell # 1047761) IC5 = 74HCT238, DIP16 case (Farnell # 382231) IC6 = ATmegal 68-20PU, DIP28 case, pro- grammed, Elektor SHOP # 080396-41 IC7 = PCF8583P, DIP8 case (Farnell # 403908) LD1-LD6 = SA23-1 2SRWA (Kingbright), 7- segment LED display, red, common anode (Farnell # 1 1 68639) Miscellaneous XI ,X2 = 32768 Hz quartz crystal, cylindrical housing 3x8mm K1 ,K2 (optional) = mains adapter connec- tors for PCB mounting K3 = 6-way DIL pinheader, lead pitch 2.54 mm (Farnell # 1096984) SI ,S2 (optional) = EC 1 1 B 1 5242 (Alps), rotary encoder for front panel mounting, 1 1 mm (Farnell #1 1 91 733) PCB no. 080396-1 from the Elektor SHOP www. e I e kto r. co m was developed using the free WinAVR C compiler along with Atmel’s gratis AVR Studio (as a development environ- ment and for in-system programming of the microcontroller). For multiplexing the 7-segment dis- plays the Timer 0 interrupt routine is responsible. Prescalers and the Com- pare Match Register are used to set the timer to 488 Hz. At each call a display counter is counted up from zero to five for the program to react. If the button is depressed for more than a second, the program changes into parameter input mode. Recognition of switch depression and rotation of the encoder is handled by the Pin Change 0 interrupt routine. This interrupt routine is invoked automati- cally by pressing or rotating the control switch; it sets corresponding flags that are then evaluated in the Timer 0 inter- rupt routine and in the main program. The Timer 2 interrupt routine is invoked exactly once a second. All it does is to increment the seconds counter of the cost calculation. The first operation of the main program is generating the welcome message and inviting initial parameter entry. Next comes an endless loop of eval- uating the flags for the press switch. A short depression starts and stops the cost display or resets this to zero. 44 elektor - 1/2009 Pressing it down longer switches back to re-entering the parameters. After polling the flags the seconds counter of Timer 2 continually calcu- lates the cost amount. Construction and commissioning Because we avoided the use of SMD components entirely in this design, construction of the meeting cost timer (Fig- ure 2) should be problem- free. Components should be fitted and soldered from the bottom upwards, in other words starting with low- lying parts such as resis- tors, diodes and capacitors, afterwards fitting things like IC sockets and the volt- age regulator, then ISP and power supply connectors and finally the 7-segment displays and the rotary encoder. For maximum freedom in choice of construction and housing we have designed the project so that power connectors (K1 or K2) and the control switch (SI or S2) can be located on the right or left-hand side at the user’s choice. You could con- sider painting a large Pound (or Euro) symbol on the clock case beside the display read-out. This might make the control switch awk- ward to use, so you could then relocate it on the left side. There are M4-sized holes drilled at each corner of the PCB and these can be used to fix the module in its case. Before fitting ICs into their sockets it’s worth connecting a mains adapter and confirming the 5 V sup- Figure 3. This screen shot illustrates the fuse bit settings in AVR Studio. ply voltage following the 7805 voltage regulator, for example at Pin 2 (5 V) and Pin 6 (GND) on the ISP connector. If all’s well in the voltage department then you can plug in those ICs. Next on the list comes programming the ATmegal68. For this we used the AVR Studio software available gratis from Atmel and downloadable from the manufacturer’s web- site. The same function can be carried out using any of the current STK500-compat- ible ISP adapters. Another task is setting the fuse bits for the base con- figuration of the controller. Figure 3 shows the ISP dia- logue in AVR Studio high- lighting the selected fuse bit settings. They corre- spond substantially with the default values as far as the CKDIV8 fuse bit, which must be erased. Otherwise the processor would work at a clock speed of only 1 MHz instead of 8 MHz! The soft- ware (source code) can be downloaded as an AVR Studio project on the Ele- ktor website for this project (www.elektor.com/080396) with a precompiled HEX file in the default sub-folder. ( 080396 - 1 ) 1/2009 - elektor 45 TECHNOLOGY RFID goes UHF Standards, regulation, pitfalls Dr. Michael E. Wernle (Germany) Radio frequency identification (commonly known as RFID) is a generic term used to describe a system that transmits the identity (in the form of a unique serial number and data) of an object or person wirelessly, using radio waves. These wireless systems allow for non-contact reading and are effective in manufacturing and other hostile environments where traditional identification technologies such as bar code labels could not survive. Having its radio origins in LF and HF bands like 135 kHz and 13.56 MHz, RFID is now rolled out to UHF, too. Figure 1. Principle of inductive coupling between RFID reader and transponder (or 'tag'). Unlike bar codes, line-of-sight is not required for RFID, even on UHF. RFID is one of the few technologies where paint, dirt, grease, packaging, etc. do not interfere with the collection of data. For many decades, Auto-ID technologies have been used to reduce the amount of time and labour needed to input data manually and to improve data accuracy. RFID by its own is the most advanced representative of this technology today. The basic components of an RFID system are the transponder or tag as the electronic data carrier, and a read/write device, called reader or interrogator to transfer the data received from the transponder in digital form to a host computer or microcon- troller for further data processing. Figure 2. Backscatter coupling is the dominant mode of coupling at UHF. 46 elektor - 1/2009 RFID advantages RFID offers very specific features not available with other advanced Auto-ID technologies. Although not all systems offer all features, some common features of RFID may be listed. • Non-contact reading and writing • Non-line-of-sight reading and writing • Virtual immunity from obscuring paint, dirt, grease, etc. • Permanent identification or read/write capabilities • Read range from several inches to several feet (depending on the system) • Extremely high data integrity and access safety Figure 3. An open dipole made from a meandering PCB track. ( Figure 4. Combination of a closed dipole and meandering tracks. RFID applications RFID meanwhile is a well established technology in various mass applications for more than 15 years. Theses appli- cations are currently used in (but not limited to access control, car immobilisers, asset tracking, animal ( ivestock and domestic) identification, flexible manufacturing (track- ing and control), laundry tracking, vehicle identification, electronic toll collection, supply chain & logistics tracking. Since the beginning of the early 90's low cost RFID sys- tems entered the market in the above mentioned applica- tions based on highly integrated chips for transponders and read/write devices. Today's main carrier frequencies used are 1 25 kHz, 1 35 kHz and 1 3.56 MHz. Recent develop- ments since 2000 showed up new approaches based on higher frequencies in the 865-950 MHz range (UHF). A main driver for this development is the logistics and supply chain industry after acceptance of the fact that HF will not realise reading distances of 2-3 m minimum, even in the far future as required by these applications. Because of the importance of these new applications and the fact that LF and HF systems already got wide coverage in Elektor in refs. [1] and [2]), this article concentrates on RFID based on UHF frequencies. RFID components and coupling mechanisms for UHF It is necessary to understand some fundamentals of RFID technology before you are able to build real world sce- narios with RFID components available in the market. Espe- cially the important difference between LF/HF systems on one side and UHF on the other side is a key to properly working scenarios. If you are new to the laws of electro- magnetism at higher frequencies you may find some basic statements on this issue helpful [3]. Passive RFID tags (which are the most utilised) are 'asleep' (i.e. do not emit RF signals) until they enter a read zone created by an antenna connected to the RFID tag reader. The size and shape of this zone is dependent on both antenna design and operating frequency. In this zone the RF energy field emitted by the reader 'wakes up' the tag and supplies it with power to transmit its data to the reader, or write data to the tag if it has read/write capability. This exchange of energy and information uses different coupling mechanism depending on the frequency of the basic carrier signal. An important differentiation is the near field/far field boundary — a good approximation is the formula for dipoles, where c is the speed of light, a the dimension of the dipole and f the frequency 4,5]. For LF (125 kHz) and HF (1 3.56 MHz) RFID systems, the resulting value is approx- imately 382 m and 3.5 m respectively. Below these values, inductive coupling is the process of transferring energy from one coil to another through a shared magnetic field by vir- tue of the mutual inductance between the two coils of reader and transponder, as shown in Figure 1 . Here we concen- trate on UHF systems, mainly between 865 and 955 MHz. For these frequencies the assigned near field / far field boundary is between 1 8 and 20 cm. It is obvious that a different coupling mechanism takes place, see Figure 2. The reader antenna emits electromagnetic energy (radio waves) but no electromagnetic field is formed. Instead, the tag gathers energy from the reader antenna, and the micro- chip uses the energy to change the load on the antenna and reflect back an altered signal. This is called bockscot- ter coupling [6]. Based on the nature of the coupling a coil is no longer a reasonable antenna concept. The simplest antenna for UHF is a dipole with a length of /2. The disadvantages are well known in the HF community: physical dimensions and low bandwidth [7]. Now we have to take into consideration that two antennas are required, one for the transponder, the other one connected to the reader device. For transponders used in the logistics industry there are some limitations caused by the dimensions of barcode labels used today — typical extremes for the length are approx. 100 mm. Because of this limitation the ideal dipole has to be folded to create shorter antenna structures. Mean- der Structures (Figure 3), Folded Dipole (Figure 4), PIFA (planar inverter F antenna) are just a few expressions for highly sophisticated antenna designs and it is a must to refer to appropriate literature [5,7]. For UHF reader antennas the situation is much easier to handle. Antennas for fixed mounted long range RFID read- ers are typically based on the well known concept of patch antennas; the typical size is a square of 25 to 35 cm to meet the frequency requirements. For low power output of the reader, in Europe nearly each shape of an antenna is accepted by the ETSI radio regulations [9]; for transmit powers higher then 500 mW there are certain limitations like a maximum beam width of ±35 degrees. Especially the form of the antenna's main loop has to taken into considera- tion during the design of a long range RFID application like an antenna gate for forklifts and similar. / = c / (2 71 f) for antenna coils and / = (2a 2 f) / c Physical behaviour of RFID systems depending on frequency The main differences in RFID systems caused by the frequen- cies used are shown in Table 1 . 1/2009 - elektor 47 TECHNOLOGY RFID Table 1. Comparison of RFID band characteristics Frequency Characteristics LF (low frequency) 125-134 kHz In use since mid 1980s Read range up to 1 m Deep penetration Works best around metals and liquids Slow data rate and no anti-collision Costlier tag antennas because of wound coils HF (high frequency) 13.56 MHz In use since mid 1990s Read range up to 1 m Good penetration Widest application worldwide Most progress on standard definitions worldwide High Security transponder chips available Simultaneous read capability @ 50 tags UHF (ultra high frequency) 865-955 MHz In use since late 1990s Read range 4-7 m Fast data rate Susceptible to attenuation by liquids and metals Potential to offer lowest cost tags Simultaneous read capability @ 500 tags Regulations and Standards Fortunately, RFID is an area of technology with increasing standardisation for the benefit of the users based on more certainty for important investment decisions in Auto-ID infra- structure. We have to separate standards for the application and the technical functionality itself; here we concentrate on the technology side. All frequencies for RFID are out of Figure 5. RFID frequency allocation for Region 1 (chiefly Europe). Watt (W) (ERP) f (MHz) ► 080314 - 13 Figure 6. RFID frequency allocation for Region 2 (chiefly USA). Watt (W) (ERP) f (MHz) ► 080314 - 14 the ISM bands (Industrial Scientific and Medical bands) and can be used globally without a license. Ultra-high-frequency RFID transponders unfortunately cannot be used globally at one single frequency as there is no single global standard today. The ITU (International Telecommunications Union) has divided the world in three regulatory regions: - Region 1 includes Europe, Africa, Middle East and the former Soviet Union — see Figure 5; - Region 2 includes North America, South America and the Pacific Region east of the dateline — see Figure 6; - Region 3 includes Australia, Asia and the Pacific Region west of the dateline. In the USA, unlicensed use of RFID (subject to equipment type approval) is allowed in the frequency range from 902 to 928 MHz with restrictions for the maximum transmis- sion power (FCC CFR Title 47, Part 15). In Europe, RFID and other radio applications are regulated by ETSI recom- mendations EN 300 220 [8] EN 302 208 [9] and ERO recommendation 70 03 [10], allowing RFID operation with somewhat complex band restrictions from 865-868 MHz. RFID Readers are required to monitor a channel before transmitting ('Listen Before Talk'); this requirement has led to some restrictions on performance, the resolution of which is a subject of current research. Table 2 presents some information such as main regula- tory organisation, allocated UHF band and maximum out- put power emissions. In general, the performance of UHF systems in the FCC regulatory region is higher than in ETSI regions, caused by the larger bandwidth and the significantly higher number of channels available. EPC Number The Electronic Product Code is an extended form of UPS (Universal Product Code) used in barcode systems and was originally developed at the AutolD centre located at the Massachusetts Institute of Technology (MIT) in Boston, USA during the late 90's. This code has the approach to number all goods in the worldwide logistic transport chain starting at the manufacturer's site till to the consumer. In the basic meaning EPC is not linked to RFID, any electronic media 48 elektor - 1/2009 Table 2. Radio band regulatory organisations Region 1 Region 2 Region 3 Regulatory Organization European Conference of Postal and Telecommunications (CEPT) Federal Communications Com- mission (FCC) for the USA various organisations depend- ing on country Frequency band 865 - 870 MHz 902-928 MHz around 950 MHz Maximum radiated power 2 W ERP = 3.28W EIRP 4 W EIRP various Bandwidth for high power application 2 MHz 26 MHz depending on country No. of channels 1 0 @ 200 kHz up to 1 30 - is possible to handle these codes. But RFID is the logic car- rier of this numbering scheme, especially RFID within the UHF frequency range is heavily linked to EPC in the public opinion. Today EPCglobal [1 1], a joint venture between GS1 and GS1 US, is working on international standards for the use of mostly passive RFID and the EPC. One of the missions of EPCglobal was to simplify the various protocols prevalent in the UHF RFID world caused by the first dilettante EPC defi- nitions. Two tag air interfaces (the protocol for exchanging information between a tag and a reader) were defined by EPCglobal, these protocols, commonly known as Class 0 and Class 1, saw some commercial implementation till 2005. In 2004 a new protocol was created, the 'Class 1 Generation 2 interface', which addressed a number of problems that had been experienced with Class 0 and Class 1 tags. The EPC Gen2 standard was approved in December 2004, and is likely to form the backbone of passive UHF RFID tag standards moving forward. The EPC Gen2 standard was adopted with minor modifications as ISO / IEC 1 8000 Part 6C [1 2]. Today, it is the main, world- wide accepted standard for UHF RFID in the 865-955 MHz range. The EPC itself today includes the following number fields: - Header: defines data type; indicates code partitions; used to partition sub-domains. - Header: identifies the length, type, structure, version, and generation of the EPC. - EPC Manager Number: entity responsible for maintaining the subsequent partitions. - Object Class: identifies a class of objects. - Serial Number: identifies the instance. Figure 7 shows a simplified version with one header. The EPC number is stored on the transponder and trans- mitted to the host system by the RFID reader. Based on the number, the host system is able to collect additional informa- tion about the object scanned by using the so called Object Name Service (ONS). The ONS matches the EPC of a product to information about that product. As soon as the host software, often called RFID middleware, receives EPC data, it can query an ONS server to find out where more detailed product infor- mation is stored. This concept has a famous role model: the high performance Domain Name System (DNS) used in the Internet. Commercially available RFID UHF products For UHF transponders a wide range of silicon is already available. Suppliers are the usual companies in the RFID market like NXP, Texas Instruments and ST Microelectronics plus some new fabless chip suppliers like Impinj. Numer- 632.37000.123456.100000000 Header EPC Manager Object Class 8 bits 34 bits 20 bits Serial Number 34 bits "V" j assigned by EPC Global to its members organisations y assigned by EPC manager owner 080314-15 Figure 7. EPC 96 numbering scheme. \k Transmitter <^i Receiver Memory — A— Power Management £ A DSP V Digital Input /Output Microcontroller <=> <=> Communication Interface l. TtT7" j 080314 - 16 £ O K. — S3 =. w < C/3 - 1 OC Figure 8. Block diagram of an UHF RFID reader. Figure 9. SkyeTekM9vl-MH module. 1/2009 - elektor 49 TECHNOLOGY RFID Figure 10. SkyeTek M9v3-MH module. Figure 11. Sirit UHF EPC long range reader. ous suppliers around the globe produce transponders using this silicon — it is possible to identify a market for manu- facturers of flexible labels like UP M Raflatac, X-ldent and numerous others, and Wisteq, for example, for transpond- ers embedded in a hard case. For UHF readers the situation is different. For HF there is a wide range of high integrated reader circuits available — the user just adds microcontroller functionality, an HF amplifier if needed and (often underestimated) firmware to design a complete HF reader. For UHF there is till now only one real working high integrated reader chip available, (mainly for small low power reader modules) and LAN inter- face (fixed mounted long range readers). On a dedicated website, two RFID UHF Reader systems are presented in detail with screenshots of the development environment including some short explanations [1 3] to give a concrete example of a ramp up. Conclusion RFID using UHF is significantly more complex than LF and HF RFID. This is not only caused by the technology itself, handling frequencies close to one gigahertz, but by differ- ent radio regulations and application standards. In a future issue of Elektor well describe how to handle some commercial available products to ramp up a small RFID UHF application using ISO 1 8000-6C / EPC GEN2 compatible RFID components. ( 080314 - 1 ) originally developed by Intel and just recently (July 2008) sold to Impinj. On one side this chip gives a shorter time to market, on the other side the reader designers lose flexibil- ity during the design process, especially the integration of advanced transponder chip features beyond the bounda- ries set by the ISO standards. These chips like the new NXP Gen2 chips UCODE G2XM and G2XL just recently entered the market require high skilled features and require as a result a very flexible reader design like offered from suppli- ers like SkyeTek (Figures 9 and 10), Sirit (Figure 11), Motorola, Intermec and a few others. A reader device consists out of the basic functions trans- mit, receive, modulation, demodulation and baseband. The block diagram in Figure 8 shows the typical elements in conjunction with support functionality like digital I/O inter- face and communications interface like RS232, l 2 C, SPI References and Internet Links [1 ] RFID Door Opener, Elektor July/August 2008. [2] Elektor RFID Reader, Elektor September 2006. [3] Bergmann, Bergmann-Schaefer, Lehrbuch der Experimentalt- physik, Band 2, Elektromagnetismus, 8. Auflage, Verlag Walter de Gruyter, Berlin 1999. [4] Meinke, Gundlach, Taschenbuch der Hochfrequenztechnik, Springer-Verlag, Berlin, 4. Auflage 1986, Band 2. [5] Kark, Klaus W., Antennen und Strahlungsfelder, Vieweg, Marz 2004. [6] Detlefsen, Jurgen; Siart, Uwe: Grundlagen der Hochfrequen- ztechnik, Oldenbourg Verlag, April 2003. [7] Krischke, Alois; Rothammels Antennenbuch, DARC -Verlag, aktualisierte und erweiterte 12. Auflage. [8] EN 300 220-1 VI .3.1 (2000-9) Electromagnetic compatibility and Radio spectrum Matters (ERM); Short range devices; Techni- cal characteristics and test methods for radio equipment to be used in the 25 MHz to 1 000 MHz frequency range with power levels ranging up to 500 mW; Part 1 : Parameters intended for regulatory purposes. [9] ETSI EN 302 208-1 (2002-8) Radio Frequency Identification Equipment operating in the band 865 65 - MHz to 868 MHz to 868 MHz with power levels up to 2 W Part 1 : Technical charac- teristic MHz with power levels up to 2 W Part 1 : Technical charac- teristics and test methods). [10] Status of ERC Recommendation 70-03 relating to the use of Short Range Devices (SRD) including Appendixes and Annexes, ERC Recommendation 70-03, Edition of April 2004. [1 1] http://www.epcglobalinc.org, http://www.epcglobal.de/ [1 2] ISO / IEC 1 8000 Part 6C: Information technology — Radio frequency identification for item management; Part 6: Parame- ters for air interface communications at 860-960 MHz. [1 3] http://www.meshedsystems.com/dienstleistung/elektor.htm 50 elektor - 1/2009 J, -> * SERVICING YD U R COMPLETE PROTOTYPE NEEDS 1 EUROCARD (160 x 100 mm) + Tooling ~ + Photoplots + VAT € 49 ; Price example Any size and contour possible! Optional: • Soldermask • Fast-turnaround • Silkscreen • 4-Layer Multilayer • 6-Layer Multilayer powmmm tm Freephone Q) 0800-389856 0 "jr s y t j * - — ~ m , — soe "•» ^ j rrrad ■ [] Simply send your files A/IA 0/1/1# /*/|i)/| and order ONLINE: V%// / Isn’t it exciting when over 80,000 prices fall? RS Production Packaging rswww.com/electronics 08457 201201 MELU IDER OF FLEXIBILITY: * mmrm socket * 8 SWITCHES. 8 LED DIODES. BUZZER. * S POTENTIOMETERS. * IROR PORT. USB DEVICE RMD USB HOST. * 8 PORTS RSS3S KITH LEDS. * CDDEC RUDD, CRM IMTERFRCE. * ILUIRE COMMECTOR. * so/mmc crrd slot. * RLPHRMUMERIC LCD COMMECTOR. * WORE uETHILS RURILR8LE Rl UJUJUJPROPOXCOm *iP 28 | o* 8 8g“ * °-o S' LLE 1 S| 111 ii£S Q CL O O 0 CO7S Si? §S2 « * ||S § jl :9| °o§ C3zH z o 9 <2t3i OlllS giedrr lie des" J J VAT ^^■Kkp1298 70012 70046 ^^Hp^Pilblec. co.uk S5|||Pa!piec. co.uk Offers Atlas DCA includes new premium probes! ‘Special 10 f f erTA N PI R e d uce d l VATi ! Atlas DCA Model DCA55 Semiconductor Analyser Identifies type and pinout! Atlas LCR^ ► Better, tha n 2 WoWAI. Reduction! Atlas LCR Model Ldi40 Atlas ESR ;SpeciaLOffer AN D, Reduced iVATi ! Atlas ESR Model ESR60 ESR and Capacitance Meter Resolution of 0.01 ohms! Atlas SCR includes new premium probes! SpeciaLOffer-AND, Reduced 1 VAT 1 ! Atlas SHHiRRI 00 Inductor, Capacit M Resistor Analylejj Triac anipiijgiiw^galyse|^ Automatic paMjidentification. Auto gate tesflB^^^Bf to 100jj|i| UK: Please add £2 p&p to your order. P r i ce slB SBoejJKJ^IPl Please see website for overseas plmplilB 1/2009 - elektor 51 PROJECTS l 2 C l 2 C Slave Kernel (or Stir in BascomAVR, add Vladimir Mitrovic (Croatia) With all the processing power under the hood of the Atmel ATtinyl3 and ATtiny2313 micros, it's not too difficult to get them interfaced to the l 2 C bus: some Basic and embedded assembly code will do just nicely The I 2 C bus (a.k.a. IIC or inter-IC bus) as well as integrated circuits designed to work on it, have been described numerous times in this magazine, just look at references [1] and [2] for two recent articles. Although there exist hundreds of ICs with I 2 C compatibility, each and every one of these will have one specific function it was designed to handle. For example, humidity sens- ing, relay driving, LCD controlling, data memorising, push button activity detection, keyboard decoding, bus cur- rent boosting — you mention it, it’s all available, and cheap too! However, the true electronics enthusiast is creative and wants to be able to 1. glue home-brew things to the I 2 C bus; 2. design his/her own I 2 C peripheral(s) to do just what’s desired using preferred components. For both, it is necessary to have a mini- mum of I 2 C slave functionality and then take it from there with all levels of flex- ibility. If this sounds like ‘software’, it is: if you can program it, just do it. Project outline and hardware The AVR microcontroller is pro- grammed to act as an I 2 C slave. The write address of this slave is memo- rised in its internal EEPROM, at the address 0, bits 7-1. Bit 0 should be zero. The most important I 2 C rules are implemented in the program: it rec- ognizes multiple STARTs as well as unexpected START and STOP signals in the middle of a data sequence and keeps the SCL line Low while prepar- Technical Spec • Atmel ATtiny13 or ATtiny2313 programmed to act as a slave device on the I2C bus • Mix of BascomAVR and assembly code • Software open-ended and free to community • No fixed device address • Learning mode and hardware activation built in ing the byte to be sent to the master. The program is optimised for speed and with an 8 MHz oscillator it will accept an I 2 C clock with a frequency of up to 400 kHz. This means that the ATtiny2313 or ATtinyl3 can make do with their internal oscillators. As everything is realised in software, no external components are needed and we arrive at bare-bones circuit dia- grams shown in Figure 1 and Figure 2. The pull-up resistors on the SCL and SDA lines may be omitted if they are provided elsewhere on the I 2 C bus. For hardware, it doesn’t get simpler than that. The kernel The program has several time-criti- cal routines that are written in assem- bler. These routines constantly monitor the traffic on the I 2 C bus and call the appropriate subroutines if a valid write or read address is recognized. The program kernel acts as any other I 2 C slave, with the following conditioned functionality. 1. If the first byte following the START signal is recognized as its own write address (bit 0 = 0), it will: - confirm it with ACK; - accept up to two following bytes, con- firming each of them with ACKs; wait for RESET (any additional byte before RESET is ignored); - call the ‘Process_received_data’ sub- routine after RESET; - wait for the next START. 2. If the first byte following the START signal is recognized as its own read address (bit 0 = 1), it will: - confirm it with ACK; - pull down the SCL line to signal the I 2 C master that data is prepared (delayed SCL); - call the ‘Prepare_data_for_master’ subroutine; - free the SCL line to enable further communication; - send one byte of data contained in the ‘Data_for_master’ variable to the master; - wait for the next START. 3. If the first byte following the START signal is not recognised as its own write or read address, it will ignore all communication on the I 2 C bus until the new START signal. It is the programmer’s (i.e. your!) responsibility — and challenge — to provide the code for the ‘Process_ received_data’ and ‘Prepare_data_for_ master’ subroutines in order to proc- ess received data or to prepare data to be sent to the host. In order to facili- tate programming even for a not very skilled programmer, the assembler ker- 52 elektor - 1/2009 nel is embedded in the BascomAVR structure. So, the programmer may use BascomAVR from MCS Electronics [3] (even the demo version) to adjust the program to his/her own needs. Examples Two examples are provided to get cracking: T2C_slave_ATtinyl3_Ele- ktor.bas’ and ‘I2C_slave_ATtiny2313_ Elektor.bas’. The examples differ only in details specific to the microcontrol- ler used: ATtinyl3 or ATtiny2313. The kernel is placed before the ‘End’ state- ment, and the user subroutines and any data for the user to adjust, after the ‘End’ statement. In these examples the microcontrol- lers act like an AT24C0x serial EEP- ROM with its internal address set to $EA (write) and $EB (read). Write address $EA should be programmed in the first location of EEPROM (address 0). The BascomAVR compiler will pro- duce an ‘.eep’ file for the programmer, like this: $eeprom Data &HAE , address of this I2C slave $data The ‘Process_received_data’ subrou- tine is called after the STOP signal if a valid write address of this I 2 C slave is recognised before. Up to two bytes of data following the address are memo- rised as shown in Table 1. In this example, I2C_bl is used as the address of the internal EEPROM and I2C_b2 as data to be written — be careful not to rewrite address 0! Process_received_data : Writeeeprom I2c_b2 , I2c_ bl 'I2C_b2 byte is written to 'internal eeprom at I2C_bl Waitms 5 'wait until written Return The ‘Prepare_data_for_master’ sub- routine is called immediately after the valid read address of this I 2 C slave is recognised. No data are passed to the subroutine, but the subroutine should prepare one byte of data to be sent to the master in the variable ‘Data_for_ master’. Keep in mind, however, that preparing data for the master should be as quick as possible because the master usually does not wait for data indefinitely. In this example, one byte is read from the internal EEPROM from the address in I2C_bl (received before, accord- ing to the communication protocol for AT24C0x): Prepare_data_f or_master : Readeeprom Data_f or_master , I2c_bl 'IB is read from internal eeprom at I2C_bl Return Learning mode It was explained before that the I 2 C address of this I 2 C slave is memorised as the first byte in the internal EEP- +5V © R1 * SDA 0~ SCLO- R2 * © IC1 RST PB3 PB4 ATtiny13 Optional T 1 ^^00n 080613-11 Figure 1. ATtinyl3 as an l 2 C slave. The examples were tested on the circuits in Figures 1 and 2 and have worked well with an SCL of up to 400 kHz. Bear in mind that the ATtinyl3 has only 64 bytes of internal EEPROM, while ATtiny2313 has 128 bytes, so theoretically the ATtiny2313 could replace an AT24C01. However, the real advantage of this program is that the microcontroller may play the role of any ‘new’ I 2 C slave with specific address, according to one’s needs. For example, it may be used as an inter- face between the I 2 C master and any equipment. sda O — + scl O *optional 15 16 +5V PB3 PB4 ATtiny2313 080613-12 Figure 2. ATtiny2313 as l 2 C slave. Table 1. Data byte memory variable name variable type description l2C_bl Byte 1st byte after l 2 C address, = 0 if not received (i.e. if STOP signal occurred first) l2C_b2 Byte 2nd byte after l 2 C address, = 0 if not received (i.e. if STOP signal occurred first) l2C_stop Byte = 255 if STOP signal received, = 0 if not (only for debugging purposes, should always be = 255) 1/2009 - elektor 53 PROJECTS l 2 C ROM. It may be defined in the pro- gram and programmed in EEPROM after programming the flash memory as explained in the example. As an additional benefit, the microcontrol- ler may be set in ‘learning mode’ and accept and memorise the new address from the I 2 C bus. There are two ways to activate the learning mode, soft- ware and hardware. In both cases, the ‘Learning_mode’ flag is set and the first I 2 C address (1st byte after the next START signal) will be accepted and memorized as the new I 2 C address of this slave. Immediately after this procedure the ‘Learning_mode’ flag is erased and the microcontroller acts as explained before. The whole procedure is already programmed in the kernel; you only have to set the flag! An example of software activation of the learning mode is given below. Here, we check if a specific data com- bination is received and set the ‘Learn- ing_mode’ flag if it is: Process received data: If I2c_bl = xxx and I2c_b2 = yyy Then 'check if specific key combination is received Learn ing_mode = 1 'set learning flag End If Return hardware activation Use any free I/O pin, e.g. PINB.O and provide a jumper or pushbutton to con- nect it to the GND. When you want to reprogram the I 2 C address of this slave, keep the pushbutton pressed for two seconds at power-up or reset. At the beginning of the program the ‘Learn- ing_mode_hw_activation’ subroutine is called. This subroutine is normally empty (i.e. it contains no more than ‘Return’). If you want to enable hard- ware activation of the learning mode, you should check the state of the cho- sen I/O pin (Pinb.O in this example) and set the Learning_mode flag if the expected condition occurs (Pinb.O = 0 in this example): Learning_mode_hw_activation : Config Pinb.O = Output If Pinb.O = 0 Then Learning_mode = 1 End If Return Resources The Basic programs (written in Bas- comAVR) and hex object code files for the microcontrollers are available as a free download from the Elektor website [4]. Due care should be taken with the hex files as they may not be compat- ible with every programming system for the ATtinyl3 and ‘2313 microcon- trollers. In case of doubt, compile the .bas files locally and work out the com- patibility with your programmer. ( 080613 - 1 ) References and Internet Links [1] The Secrets of I2C, Elektor March 2008. [2] Bits on Parade, Elektor December 2008. [3] www. mcselec.com [4] www.elektor.com/08061 3 Advertisement See your design in print! Elektor Electronics (Publishing) are looking for Freelance Technical Authors/Designers If you have # an innovative or otherwise original design you would like to see in print in Europe's largest magazine on practical electronics # above average skills in designing electronic circuits # experience in writing electronics-related software # basic skills in complementing your design with an explanatory text # a PC, email and Internet access for efficient communication with our in-house design staff; then do not hesitate to contact us for exciting opportunities in getting your designs published on a regular basis. Elektor Electronics Jan Buiting, Editor P.O. Box II, NL-6141-AV Susteren, The Netherlands, Fax: (+31) 46 4370161 Email: editor@elektor.com 54 elektor - 1/2009 Christian, 19, freshman “Elektor is substance for professionals and those wanting to reach the level. The perfect entry to my studies!” Secure a head start in electronics with a Student Subscription!* *Only available in UK. Ask for the conditions. Students qualify for a discount of no less than 20 % compared to the normal price of an annual subscription Subscribers get up to 40% discount on special Elektor products No queues, travelling, parking fees or ‘sold out’ Elektor is supplied to your doorstep every month Always up to date - read your copy before everyone else Electronics at all the right levels Advantages to subscribers ! ■ www.elektor.com/subs • Tel. +44 20 8261 4509 electronics worldwide MICROCONTROLLERS Radio technology is fascinating: the almost ghostly 'action at a distance' that it allows would in former times have been regarded as magic or witchcraft. In this article we describe a low-cost yet reliable radio module that can be used with the ATM1 8 test system to build remote control and remote data capture applications. What would the people of 1800 think if we could take today’s radio technology back in time and show it to them? Per- haps it is for the best that time travel does not exist, as without a doubt they would find it entirely beyond their comprehension and our time travellers might not prove popular visitors. The earliest radio communications were made using sparks. In 1864 James Clerk Maxwell had predicted the possibility of the existence of radio waves from theoretical consid- erations, and just 24 years later, in 1888, Heinrich Rudolf Hertz demon- strated the production of radio waves experimentally. He used a spark gap to create a broad-spectrum radio sig- nal and was able to receive compo- nents of it a short distance away from the transmitter using a loop of wire and another spark gap. It was another twelve years before the first example of message communication by radio: in 1896 Guglielmo Marconi produced electromagnetic waves using a spark gap transmitter and a receiver by Alex- ander Stepanovich Popov. These early experiments achieved a range, incred- ible at the time, of 5 km. This is con- siderably more than the maximum range of the author’s first home-made transistorised FM transmitter, built in 1970, although that did not diminish his sense of achievement at the time. Indeed, that was the beginning of his life-long fascination with radio (which included the acquisition of an Amateur Radio licence to put his experiments on the right side of the law!). These days it is very simple to commu- nicate between remote devices using ATM 18 \ PD4_XCK_T0 GND VCC PB6_XTAL1 PB7XTAL2 PD6_OCOA_AINO PD5 OCOB RFM12 H* 2 HD rw Timnininir ’ll G U (IS 8 Z CL < U. r I h- O CL O CD CL O O I CD CL CD O O CO CO I CN| CD Q_ CL CO I C D LU CO LU C£ I CD o CL CO O S l CO CD CL O CO CD CL * o co i in CD CL 080852 - 11 Figure 1. Connecting the RFM12 radio module to the ATM18 microcontroller module. 56 elektor - 1/2009 1 1 17 radio. Even computers, which once were invariably connected together using wires, have been affected by the wireless revolution: Bluetooth, WiFi, ZigBee and many other technologies have become standardised. Until now our tiny ATM 18 microcontroller has been left out: an omission which we will definitively correct in this article. ATM18 and RFM12 There is a range of easy-to-use low- cost radio modules on the market. We have selected a unit which com- bines transmitter and receiver on a single printed circuit board and which requires no external circuitry. It is capable of operating alternately in transmit and receive modes, and works in the 868 MHz band. Because more stringent restrictions are placed on operation in this band than in the 433 MHz band, more reliable operation is possible with less interference. The part number of the module is RFM12. Its frequency of operation is 868.3 MHz and a duty cycle of at most 1 % is allowed, and the unit has a maximum transmit power of around 2.5 mW. It is important to ensure that these restrictions are complied with, and that other users do not suffer inter- ference: in such cases the transmitter must be switched off immediately and a different frequency used. The 1 % duty cycle limit allows us to use only short data packets; however, even just one byte is enough to con- trol eight remote devices. The data transmission speed is high enough to allow remote measurement data 1/2009 - elektor 57 MICROCONTROLLERS Listing 1 Control pins for the RFM12 Nsel Alias Portb . 2 Sdi Alias Portb . 3 Sdo Alias Portb . 4 Sck Alias Portb . 5 to be communicated or, for example, for simultaneous control of the actua- tors of a robot and read-back of sen- sor data. Data communication using the RFM12 is covered in the article on the module elsewhere in this issue, as are details of the module’s pinout. When connect- ing to the ATM18 board the follow- ing pins on the ATMega88 should be used: NSEL to PB2 SDI to PB3 SDO to PB4 SEK to PB5 The radio module can be connected to the ATM 18 controller module using short lengths of wire. Figure 1 shows the required connections and Figure 2 Listing 2 Transmitting data Data_out(l) = 27 Checksum = 27 Data_out(2) = Pine Checksum = Checks- um + Data_out(2) Dat = Getadc(6) Hi = High (dat) Data_out(3) = Hi Checksum = Checksum + Hi Lo = Low (dat) Checksum = Checksum + Lo Data_out(4) = Lo Dat = Getadc(7) Hi = High (dat) Data_out(5) = Hi Checksum = Checksum + Hi Lo = Low (dat) Checksum = Checksum + Lo Data_out(6) = Lo Data_out(7) = Checksum Send_rfml2 Enable Inter- rupts 'Servo Waitms 500 Disable Interrupts shows our prototype: a compact micro- controller unit with radio capability. For the antenna an 8.5 cm length of wire is required. Example application An important goal for us was to use the transceiver module to extend the ATM18 project and broaden the range of possible applications. A sim- ple skeleton program provides for the exchange of data packets: for example, unit A transmits ten bytes to unit B and then unit B in turn transmits ten bytes back to unit A. Such a data exchange might take place every second. For one example we wanted to control a servo and read ana- logue data. This required two test boards, two microcon- troller boards and two trans- ceivers. The same program runs on each of the two systems. Infor- mation available to one unit is made available almost immediately to the other unit for further processing. For example, when a button is pressed on test board A, a LED or relay can be activated or deactivated on test board B. The data from two analogue chan- nels are also transmitted at the same time. This requires a total of five bytes in each data packet, obtained from the following ports: Input ports PC2 to PC5 (first byte) ADC6 (two bytes) ADC7 (two bytes) Further bytes are needed data packet to ensure able communication. The bytes in the data payload is received by the other sys which then sends them out at 19200 baud over the in the reli- tem serial inter- face, and so it is possible to connect a PC to the receiving ATM18 test board (itself remote from the transmitting ATM 18 test The basics of ISM The ISM (Industrial, Scientific and Medical) bands are radio frequency ranges freely available for industrial, scientific and me- dial applications, although there are also many devices aimed a private users that operate in these bands. ISM devices require only general type approval and no indivi- dual testing, and there are no fees for using the bands. The radio communication sector of the In- ternational Telecommunication Union (ITU- R) defines the ISM bands at an international level. WiFi and Bluetooth operate in ISM bands, as do many radio headphones and remote cameras, although these are not usually described as ISM devices. These de- vices are responsible for considerable inter- ference to radio communications, especial- ly in the 70 cm and 1 3 cm bands (i.e., at 433 MHz and at 2.4 GHz). ITU-R defines the following bands, not all of which are available in every country: 6.765 to 6.795 MHz 13.553 to 13.567 MHz 26.957 to 27.283 MHz 40.66 to 40.70 MHz 433.05 to 434.79 MHz 902 to 928 MHz 2.400 to 2.500 GHz 5.725 to 5.875 GHz 24 to 24.25 GHz 58 elektor - 1/2009 board) to acquire and display the received data and possibly carry out further processing. The received data can also be read from the microcontrol- ler’s ports as follows: Digital outputs: port D, outputs D2 to D5 Analogue 1: PWM output on OC1A Analogue 2: servo pulses on PBO 63 512 1000 When configuring the skeleton pro- gram to drive the radio module it is impor- tant to spec- ify the SPI bus pins that are used: as can be seen from List- ing 1, the SPI bus uses pins B2 to B5. A terminal emulator will always dis- play groups of three values, one byte for the port status and two words for the analogue channels. For example, the data might appear as follows: The data packet is framed by a start byte (27 decimal) and a checksum. This allows the receiver to detect reception errors. A typical message therefore appears as follows: 27 Start byte 63 Port state 1 ADC6 high byte 251 ADC6 low byte 1 ADC 7 high byte 252 ADC 7 low byte 83 Checksum Listing 2 shows how a data packet is sent. An array Data_out is filled with the required data and then Send_ rfml2 is called. The checksum is cal- culated as the sum of all the data bytes including the start byte (27). The checksum is only one byte long and so any carries out of this byte are lost: this is equivalent to logically ANDing the sum with 255. Listing 3 shows how a data packet is received and processed. The total time available is divided among the various tasks that are to be performed. Transmit: approximately 10 ms Wait and generate servo pulses: 500 ms Receive: normally 200 ms, timeout 400 ms to 1400 ms Wait and generate servo pulses: 700 ms However, if the two microcontrollers are transmitting asynchronously (as will invariably occur) it can happen that they transmit simultaneously with the result that neither receives 61 to 61.5 GHz 122 to 123 GHz 244 to 246 GHz Some countries allocate further ISM bands in addition to those above. ISM applications have the lowest priority within any given band. Many bands availa- ble for ISM are shared with other spectrum users: for example the 433 MHz ISM band is shared with 70 cm amateur radio com- munications. ISM users must not interfere with other users, but must be able to tole- rate the interference to their own commu- nications caused by higher-priority users in the same band. The band from 868 MHz to 870 MHz is often mistakenly characterised as an ISM band. It is nevertheless available to short range radio devices such as RFID tags, re- mote switches, remote alarm systems, and of course to our radio module. The RFM1 2 module uses the frequenci- es allocated to 'non-specific short-range devices' (SRDs), from 868.000 MHz to 868.600 MHz. There are no restrictions on channel width, and it is permitted to transmit at 25 mW with a duty cycle of 1 %. Higher duty cycles are permitted if the transmitter checks that the channel is clear first. Operating at a centre frequency of 868.300 MHz means that even at ma- ximum frequency shift and with worst-case tolerances the transmission will remain in the allowable band. The transmission times given in the article should not be exceeded to ensure that other nearby devices in the same band can operate reliably. Listing 3 Receiving and processing data For N = 1 To 10 Data_in(n) = 0 Next N Timeout = 400 + Rnd(1000) Receive_rfml2 If Data_in(l) = 27 Then Checksum = 27 For N = 2 To 6 Checksum = Checks- um + Data_in(n) Next N If Data_in(7) = Checksum Then Checksum = 27 Portd = Data_in(2) Print Data_in(2) Dat = 256 * Data_in(3) Dat = Dat + Data_in(4) Pwmla = Dat Print Dat Dat = 256 * Data_in(5) Dat = Dat + Data_in(6) Print Dat Dat = Dat / 11 Dat = Dat + 100 Servo (1) = Dat Print End If End If Enable Inter- rupts 'Servo Waitms 700 Disable Interrupts the other’s message. The problem then is to arrange things so that as many transmissions as possible are received successfully; unfortunately this requires considerable program- ming effort as well as the develop- ment of a suitable underlying protocol. Things are simplified if it is not essen- tial that every packet be received successfully, as we can simply set the two time delays in the program to different values. After the success- ful reception of a data packet the pro- gram waits for 700 ms before trans- mitting. After transmission there is a delay of 500 ms before the receiver is enabled. The receiver then waits for at least 200 ms and at most 1400 ms for a signal from the other unit. In nor- mal situations this process ensures that the two stations will synchro- nise with one another. If something goes wrong, or if the two units are not started up at exactly the same time, it 1/2009 - elektor 59 MICROCONTROLLERS -0 I / +5V «-© v NTC 10k / ' ■ .1© uH. — l N f ADC6 PD2 ADC7 PD3 ATM 18 PC2 PB0 PC3 PB1 o* o» -Q Servo -Q PWM 080852 - 12 Figure 3. Connecting the peripherals for the example application. can happen that the two units trans- mit simultaneously and fail to attempt to receive at the right moment. In this case, a random timeout delay of between 400 ms and 1400 ms comes to the rescue. After perhaps a few fail- ures the two units will get back into step and from then on will operate cor- rectly. In normal mode each side trans- mits for 10 ms every 1.2 s, and so the 1 % limit on transmission duty cycle is observed. Analogue readings and port states are thus updated about once per second on each side. For our example programs it is impor- tant to disable interrupts during transmission and reception, as they can interfere with the transceiver. For this reason servo pulses are only generated during the unit’s idle time, which is entirely adequate for our experiments. Interference It is a fact of life that radio links are subject to distortion and interference. Causes can include other transmitters on the same frequency, powerful trans- mitters on other frequencies, obsta- cles in the link path, metal in build- ings, multipath distortion resulting from reflections, or excessive distance between transmitter and receiver. Radio transmission is thus inherently unreliable, the distortion and interfer- ence leading to errors in the received data packet. It is therefore important not to rely on the received data being correct. The program includes dou- ble protection against errors. First, before the receiver code is called the whole of the receive buffer is cleared. This means that if no data packet is received the program will find zeros in the buffer, and the data can be discarded. If the first byte in the buffer is 27 (the start byte), there is a reasonable chance that the rest of the data in the buffer is also correct. The program evaluates the checksum of bytes 1 to 6 and compares it with the received checksum in byte 7. If the values agree the data packet can be used. The five bytes that com- prise the payload are sent out over the serial port, where they can be further processed by a connected PC. Then byte 2 is sent to the output port. The next two bytes are sent to the PWM generator, and the last two are sent to the servo controller. Since the servo requires a pulse lasting between 1 ms and 2 ms with a resolu- tion of 10 yL/s, the analogue value is first divided by 11 and then 100 is added, resulting in a value in the range from 100 to 200. This relatively low resolu- tion means that we could have used just one byte to transmit the servo value, but the full resolution is made available over the serial port in case it is needed. Peripherals To make a practical demonstration of the system we can, for example, con- nect a potentiometer to one of the ana- logue inputs and a potential divider including an NTC thermistor to the other, allowing us to measure temper- ature (Figure 3). Power for the servo can be supplied via the voltage regu- lator on the test board. Note that for reliable operation the servo should have its own power supply if the test board is being powered over the USB connector. It is also important to note that for reli- able power-on-reset operation the sup- ply voltage should rise rapidly when the unit is switched on. A simple way to achieve this is to use jumper JP1 on the ATM18 test board as a power switch, as voltage output from the regulator on the test board rises too slowly. When power is obtained via the USB/serial cable it is also best to fit the jumper only after the USB interface has been connected. And finally The simple experiments we have described give a quick introduction to how to use radio communications with AVR microcontrollers and will, we hope, prompt further interest in possi- ble applications. With a little imagi- nation you will be able to amaze your friends, family and pets with the magic of action at a distance! The software was in this instance developed using BASCOM-AVR. A corresponding C project has yet to be written, and we would welcome con- tributions from interested readers. ( 080852 ) The ATM18 project at Computerrclub 2 ATM18 is a joint project of Elektor and Computer:club 2 (www.cczwei.de) in collaboration with Udo Jursz, the editor in chief of www.microdrones.de. The latest developments and ap- plications of the ATM18 are presented by Computer:club 2 member Wolfgang Rudolph in the CC 2 -tv programme broadcast on the German NRW-TV channel. CC 2 -tv is broadcast live by NRW-TV via the cable television network in North Rhine-Westpha- lia and as a LiveStream programme via the Internet (www.nrw.tv/home/cc2). CC 2 -tv is also available as a podcast from www.cczwei.de and - a few days later - from sevenload.de. 60 elektor - 1/2009 INFO & MARKET ELECTRICAL SAFETY In all mains-operated equipment certain important safety requirements must be met. The relevant standard for most sound equipment is Safety of Informa- tion Technology Equipment, including Electrical Business Equipment (Euro- pean Harmonized British Standard BS EN 60950:1992). Electrical safety under this standard relates to protection from • a hazardous voltage, that is, a volt- age greater than 42.4 V peak or 60 V d.c.; • a hazardous energy level, which is defined as a stored energy level of 20 Joules or more or an available continuous power level of 240 VA or more at a potential of 2 V or more; • a single insulation fault which would cause a conductive part to become hazardous; • the source of a hazardous voltage or energy level from primary power; • secondary power (derived from internal circuitry which is sup- plied and isolated from any power source, including d.c.) Protection against electric shock is achieved by two classes of equipment. Class I equipment uses basic insu- lation ; its conductive parts, which may become hazardous if this insulation fails, must be connected to the supply protective earth. Class II equipment uses double or reinforced insulation for use where there is no provision for supply protec- tive earth (rare in electronics - mainly applicable to power tools). The use of a a Class II insulated transformer is preferred, but note that when this is fitted in a Class I equip- ment, this does not, by itself, confer Class II status on the equipment. Electrically conductive enclosures that are used to isolate and protect a hazardous supply voltage or energy level from user access must be protec- tively earthed regardless of whether the mains transformer is Class I or Class II. Always keep the distance between mains-carrying parts and other parts as large as possible, but never less than required. If at all possible, use an approved mains entry with integrated fuse holder and on/off switch. If this is not avail- able, use a strain relief (Figure, note 2) on the mains cable at the point of entry. In this case, the mains fuse should be placed after the double-pole on/off switch unless it is a Touchproof® type or similar. Close to each and every fuse must be affixed a label stating the fuse rating and type. The separate on/off switch (Figure, note 4), which is really a ‘disconnect device’, should be an approved double- pole type (to switch the phase and neu- tral conductors of a single-phase mains supply). In case of a three-phase sup- ply, all phases and neutral (where used) must be switched simultaneously. A pluggable mains cable may be con- sidered as a disconnect device. In an approved switch, the contact gap in the 1. Use a mains cable with moulded-on plug. 2. Use a strain relief on the mains cable. 3. Affix a label at the outside of the enclosure near the mains entry stating the eguipment type, the mains voltage or voltage range, the freguency or fre- guency range, and the current drain or curent drain range. 4. Use an approved double-pole on/off switch, which is effectively the ‘discon- nect device’. 5. Push wires through eyelets before soldering them in place. 6. Use insulating sleeves for extra protection. 7. The distance between transformer terminals and core and other parts must be >6 mm. 8. Use the correct type, size and current-carrying capacity of cables and wires - see shaded table below. 9. A printed-circuit board like all other parts should be well secured. All joints and connections should be well made and soldered neatly so that they are mechanically and electrically sound. Never solder mains-carrying wires directly to the board: use solder tags. The use of crimp-on tags is also good practice. 10. Even when a Class II transformer is used, it remains the on /off switch whose function it is to isolate a hazardous voltage (i.e., mains input) from the pri- mary circuit in the eguipment. The primary-to-secondary isolation of the transformer does not and can not perform this function. off position is not smaller than 3 mm. The on/off switch must be fitted by as short a cable as possible to the mains entry point. All components in the primary transformer circuit, includ- ing a separate mains fuse and separate mains filtering components, must be placed in the switched section of the primary circuit. Placing them before the on/off switch will leave them at a hazardous voltage level when the equip- ment is switched off. If the equipment uses an open- construction power supply which is not separately protected by an earthed metal screen or insulated enclosure or otherwise guarded, all the conductive parts of the enclosure must be protec- tively earthed using green/yellow wire (green with a narrow yellow stripe - do not use yellow wire with a green stripe). The earth wire must not be daisy- chained from one part of the enclosure to another. Each conductive part must be protectively earthed by direct and separate wiring to the primary earth point which should be as close as pos- sible to the mains connector or mains cable entry. This ensures that removal of the protective earth from a conduc- tive part does not also remove the protective earth from other conductive parts. Pay particular attention to the metal spindles of switches and potentiome- ters: if touchable, these must be protec- tively earthed. Note, however, that such components fitted with metal spindles and/or levers constructed to the relevant British Standard fully meet all insulation requirements. The temperature of touchable parts must not be so high as to cause injury or to create a fire risk. Most risks can be eliminated by the use of correct fuses, a sufficiently firm construction, correct choice and use of insulating materials and adequate cool- ing through heat sinks and by extractor fans. The equipment must be sturdy: repeatedly dropping it on to a hard sur- face from a height of 50 mm must not cause damage. Greater impacts must not loosen the mains transformer, elec- trolytic capacitors and other important components. Do not use dubious or flammable materials that emit poisonous gases. Shorten screws that come too close to other components. Keep mains-carrying parts and wires well away from ventilation holes, so that an intruding screwdriver or inward falling metal object cannot touch such parts. As soon as you open an equipment, there are many potential dangers. Most of these can be eliminated by discon- necting the equipment from the mains before the unit is opened. But, since testing requires that it is plugged in again, it is good practice (and safe) to fit a residual current device (RCD)*, rated at not more than 30 mA to the mains system (sometimes it is possible to fit this inside the mains outlet box or multiple socket). * Sometimes called residual current breaker - RCB - or residual circuit cur- rent breaker -RCCB. These guidelines have been drawn up with great care by the editorial staff of this magazine. However, the publishers do not assume, and hereby disclaim, any liability for any loss or damage, direct or consequential, caused by errors or omissions in these guidelines, whether such errors or omissions result from negligence, accident or any other cause. 3-core mains cable to BS6500 1990 with three stranded conductors in thick PVC sheath Max current 3 A 6 A 13 A conductor size 16/0.2 mm 24/0.2 mm 40/0.2 mm Norn cond area 0.5 mm 2 0.75 mm 2 1.25 mm 2 overall cable dia. 5.6 mm 6.9 mm 7.5 mm Insulated hook-up wire to DEF61-12 Max current 1.4 A 3 A 6 A Max working voltage 1000 V rms 1000 V rms 1000 V rms PVC sheath thickness 0.3 mm 0.3 mm 0.45 mm conductor size 7/0.2 mm 16/0.2 mm 24/0.2 mm Norn cond area 0.22 mm 2 0.5 mm 2 0.95 mm 2 overall wire dia 1.2 mm 1.6 mm 2.05 mm 3-flat-pin mains plug to BS 1363A 1/2009 - elektor 61 TECHNOLOGY CAPSENSE Capacitive Sensi No more bashing the soda vending machine Dave Van Ess (Cypress Applications Engineer and Member of Technical Staff) (USA) Elektor Reader Offer CapSense Evaluation kits The aim of this article is to illustrate not only how capacitive sensing can make devices more reliable, but also how the controller managing capacitive sensing can take on additional functions, to add further value to customers, as well as reduce maintenance expenses. To put it all in practice, Elektor has two CapSense evaluation kits on offer for you. When using mechanical spigots, a potentially huge problem, is that they can be forced on, or even broken off, causing all the water to be dispensed. It is also easy for a user to override a push button taping it ‘pressed on’ or by jamming some object into its housing to force it continuously on. Mechanical switches do wear out and also pen- etrate their product’s case, allowing contamination into crevasses or cran- nies. The advantage of choosing a capacitive sensor is they do not wear out. The sensor does not penetrate the case, so the crevasses remain clean. This makes them the ideal switch for a product that dispenses food, bever- ages or food grade products. All that is needed to make a capacitive sensor is a trace, a space, and a trace. These traces can be made part of a cir- cuit board with an insulated overlay placed directly over them. They can be made to conform to a curved surface. To construct the capacitive switch you will need: • a capacitor; • capacitance measuring circuitry; • local intelligence to translate this capacitance values to a sense state. Basic elements and parameters Let’s look at Figure 1 . A typical capaci- tive sensor has a value of 10 to 30 pF. Typical finger coupling capacitance to the sensor through 1 mm of insulating overlay is in the range of 1 to 2 pF. For thicker overlays the coupling capaci- tance decreases. To sense the pres- ence or absence of a finger, it is neces- sary to implement capacitance-sensing circuitry that can resolve better than 1 part in a 100 capacitance change. 62 elektor - 1/2009 Figure 2. Delta-Sigma modulator topology for measuring capacitance. Figure 3. Digitally measuring density. A delta-sigma modulator is an effec- tive and simple circuit for measuring capacitance, as shown in the typical topology in Figure 2. Phased switches cause the sen- sor capacitor to inject a charge into the integrating capacitor. This volt- age increases until it is greater than the reference voltage. The compara- tor goes High causing the discharge resistor to be engaged. This resistor is removed when the integrating voltage falls below the reference voltage. The comparator is supplying negative feed- back needed to make the integrator voltage and reference voltage match. Sensor charge current During Ol the sense capacitor (C sensor ) is charged to the supply voltage. Dur- ing 02 the charge is transferred to the integrating capacitor (C int ). Feedback is holding its value to the reference voltage (k-V dd ). Each time this switch combination is actuated, a quantum of charge is transferred. These quanta are transferred at the rate of the switch clock (/ c ) for a charge current shown in the equation below. I c C sensor dd ^ ^dd ) fc Discharge current The discharge current is implemented with a resistor. When the comparator is High it engages a switch to connect the discharge resistor. The comparator will cycle high and low in some ratio to attempt to keep the integrating capac- itor voltage equal to the reference volt- age. The percentage that this compa- rator is high is defined as its ‘Density- 0ut \ The charge is only removed this percentage of the time. The current is expressed by k * V ] d = ~ — • Density out ^ dis In steady state the charge and dis- charge current must match. Setting I c to I D results in the equation below: c sensor Density out • _k l_ 1 — k Rdis 1 The sensor capacitor is proportional to the density. The sample frequency, dis- charge resistance, and reference value (V dd k) are known. Measure the den- sity and the sensor capacitance can be calculated. The reference voltage was made proportional to the supply volt- age, so that the supply voltage would fall out of the capacitance/density equation. This makes the circuitry tol- erant to power supply fluctuations. Digital circuitry is used to measure this density; one such circuit is shown in Figure 3. The PWM gates the density input to the enable gate of a counter. This allows ‘m’ cycles to be counted. Sup- pose the counter accumulated ‘n’ sam- ples during this period, then the den- sity would be n/m. Running this for 100 cycles results in a resolution of 1 part in 100. Running 10 times longer results in a resolution of one part in 10,000. The greater the number of cycles observed, the better the resolution. Replacing spigots with solenoids In a typical water cooler the water is dispensed from a mechanical spigot, the level must be close to the nozzle. Using capacitive sensing, the lever is replaced with a solenoid valve. The switch can be placed for the ergomet- ric convenience of the user. The CPU can also recognize the length of time that the switch is pressed on for. This prevents misuse and stops the tap being continuously on. This vandal protection can be as simple or as com- plicated as you desired. This project is implemented with a Cypress CY24x94 PSoC device. One pin will be used for a sensor, one for the discharge resistor, and one for integra- tion cap for a total of three pins. One output is used to drive the water value. A block diagram appears in Figure 4. Capacitive sensing plus.... Let’s look at what can be added to the CapSense concept to arrive at a work- ing piece of equipment. 1/2009 - elektor 63 TECHNOLOGY CAPSENSE capacitance could be reconfigured to allow the temperature to be measured. When converted back to a tempera- ture, this value is used to determine if the refrigeration compressor should be turned on. Extra thermistors can be provided to measure the room temper- ature, and compressor temperature, as an overheated compressor can cause a premature failure. The sensing con- troller can disable its operation when a problem is detected, flag the user that the unit has malfunctioned, and wait for the unit to be repaired. Figure 4. Capacitive sensing controlled water valve. Temperature measurement A convention water cooler consists of: - a water tank; - a refrigeration compressor; - a thermal relay. The thermal relay monitors the tem- perature of the water in the tank. When the tank goes above a specific tempera- ture, the thermal engages, causing the compressor to run. Adjusting the water temperature requires adjust- ing a screw on the relay. It is an open loop, hit-or-miss operation. Instead of using a thermal relay, the same controller managing the capacitive sensor can be used to meas- ure the temperature and then control the power to the compressor. Rather than require a second controller, the first can be reconfigured to also take on the task of measuring temperature. Temperature can easily be measured using a ther- mistor. A thermistor is a semiconductor device that becomes less resistive as the tempera- ture increases. Measure the resistance and the temperature can be calculated. Figure 5 shows a circuit for measuring resistance. By measuring the voltages across the thermistor and the reference resistor it is possible to determine the thermis- tor’s resistance from: Multimeter(ing) So the compressor is running hot. One of the first troubleshooting suggestions is to measure the input voltage. This is a diagnostic that can easily be accom- plished with dynamic reconfiguration. Reconfiguring the controller to be a voltmeter enables measurement of the main voltage. Other system voltages can also be measured. Figure 6 shows Figure 5. Resistance measuring hardware. ^ther ^ref V 7 in ^ref- ^ref+ * in The same hardware used to sense Figure 6. Improved system with water temperature control. an expanded block diagram with all these extra features. The display With temperature being easy to meas- ure, it would be ideal if the user could also set the desired temperature. This requires a keypad and display. The keypad is simple as it can be built of capacitive sensors that use the capac- itive sensing user module already placed. The controller can also control a LCD driver chip using a standard industry protocol. It is now possible for the user to set the desired water temperature and be able to see it dis- played. 16 inputs will be reserved for a user interface. Timekeeping With the addition a clock crystal, the capacitive sensing controller can keep accurate time. This is an advantage, as the cooler can be turned off or the opera- tion temperature set point increased when it is tradi- tionally not used. Figure 7 shows an expanded block diagram with all these extra features. USB A major cost to ownership of a water cooler is the repair service calls. If the capaci- tive sensing controller also has a USB interface, this could be used for a diag- nostic port. When the repair technician visits, trouble- shooting begins by plugging a laptop into the service port. It would also be pos- sible that the owner’s PC be connected to the port and a remote technician could determine the problem. Capacitive sensing plus... whatever! The large number of I/O pins and dynamic reconfigurable of a capaci- tive sensing controller, there are end- less features that could be added. The addition of a stress gauge to measure the weight of the remaining water in the bottle or a wireless interface to allow even easier diagnostics are just a couple of possibilities. With no mechanical parts and easily conforming to curved surfaces, touch 64 elektor - 1/2009 Reader Offer: CapSense Touch Sensing Buttons and CapSense Touch-Sensing Sliders development By special arrangement with Cypress, Elektor offers two entry-level CapSense Express development kits to enable readers to get acquainted with capacitive sensing technology in a time efficient way. You can buy one or both at a special price from the Kits & Modules section of the Elektor Shop (www.elektor.com/shop) , or phoning customer services, of course. CY321 8-CAPEXP1 Evaluation kit (Elektor Shop # 080875-91) This kit is for learning about touch sensing buttons . The PSoC device used on the evaluation board has up to 10 I/Os for buttons, LEDs and general-purpose I/O devices. The kit contains the CY321 8-CAPEXP1 evaluation board, a retractable USB mini cable (A to mini B), a PSoC CY3240-I2 bridge board and an AA battery. Also included is the kit CD which contains PsOC programmer, .NET Framework 2.0, PSoC Ex- press 3, CapSense Express Extension Pack and the CapSense Express documentation. CY321 8-CAPEXP2 Evaluation kit (Elektor Shop # 080875-92) This kit teaches you implement capacitive sensing slider devices in electronic equipment. Contents as CY321 8-CAPEXP2, except CY32 1 8-CAPEXP2 evaluation board included in this kit. Both kits represent excellent educational value for all of you wish- ing to eradicate, once and for all, the weaknesses and failures of mechanical switches and slider pots traditionally fitted on consumer equipment that gets a bashing, like the pitiable soda vending ma- chine in the roadside motel! The manuals included in the kits concentrate not just on running the evaluation boards 'as is' but also cover developing your own capacitive sensing applications, combining hardware with software. With these boards you'll have a good time exploring the concepts of PSoC, program- ming, compiling, debugging, driver configuring and adapting the examples provided to meet your own requirements. The little CY3240-I2 bridge board in the kits is also valuable for entry-level dealings with other Cypress PSoC products. If ever there was a chance to get into PSoC and cap sense at a sensible price, it's right now. , or E\ew° r te f e Z) ^ . «.50 1 _ - sense capacitor switches can be an ideal technology for today’s product applications. With dynamic reconfigu- ration it is possible to reuse hardware to perform additional system functions with no additional cost. The Cypress CapSense Buttons and CapSense Slider evaluation kits on offer from Elektor and described in the inset are your perfect guides to better switches and slider devices. ( 080875 - 1 ) Figure 7. Complete water cooler block diagram. Figure 8. Complete water cooler block diagram with USB diagnostic port. 1/2009 - elektor 65 E-BLOCKS Moving up to 32 Bit With Flowcode for ARM and the ECRM40 John Dobson (Matrix Multimedia Ltd.) (United Kingdom) In the 'ARMee LPC2106 Development Board' article from 2005 we touched on the power of 32-bit ARM processors programmed with C. Complex stuff, it turned out to be! Here we look at how you can harness the power of 32 bit with an affordable and easy to use combination of ECIO ARM and Flowcode for ARM and we show you a range of new features that you can use to take advantage of these innovations. Project specs • Atmel AT91 SAM71 28 32-bit core • low-cost entry to ARM hardware and software • Flowcode / E-blocks based • directly USB programmable • available from Elektor Shop Single chip microcontrollers have been around as electronic components for around 30 years now. — maybe a bit longer! In this time there have been several step changes in the technology that have had significant impact on the way engineers develop products. There is a long list of innovations here but notable ones in my mind are: the move from masked products (long lead times & very expensive) to electrically programmable microcontrollers, the advent of parts that had A/D converters embedded in them, the development of low cost design tools that allowed even hobbyists to develop microcontroller circuits, and so on. What you may not realise is that we are entering a phase of one of the most significant changes in product development in the last 20 years - the advent of affordable 32-bit microcontroller technology. 32-bit core AT91SAM7128 For our first 32 bit core we have used an Atmel AT91 ARM 7 device. We chose an ARM be- cause we wanted a core that was supported by the GNU compiler and tool set, and because the ARM is a British design (J> God save our gracious Queen, long live... J3). We also wanted one that was directly USB pro- grammable and we decided to standardise on the Atmel AT91 SAM71 28 which has the following features: • 128 k flash ROM • 32 k RAM • 80 MHz internal clock speed • 2 USARTs • USB programming and communications interface • 32 I/O lines • 4 channel 1 6 bit PWM outputs • 32-bit processor • 8 x 300kHz 1 0-bit A/D converters The advantages of 32 bit In moving to 32-bit architecture proc- essors, the advantages over 8 bit is not readily apparent. Now whilst. . . • . . . I/O pin count for 32-bit families is larger, there are packages with simi- lar I/O count to 8-bit microcontroller families; • . . . A/D speed for 32-bit processors is faster, it is not dramatically so; • ... 32-bit cores tend to have more than one US ART, this is not a ‘must- have’ feature either; • . . . 32-bit microcontroller families do offer memories of 128 k ROM and 32 k RAM, and more, this is not unheard of in 8-bit family ranges. Still, the general trend here is that 32- bit microcontroller families do by and large offer ‘more’ of just about eve- 66 elektor - 1/2009 rything should you want it. This is the key point: 32-bit processors offer more I/O, more RAM/ROM, more inter- nal features, and more speed. Not all these points will be of interest to all engineers because they are operating effectively with current 8-bit (or 16-bit) families, but let’s have a look at a few applications that may give you an idea as to why engineers who are pushing the barriers are starting to look at mov- ing to 32 bit and ARM technology in particular. Actually, that took quite a while if you look at the pioneering stuff Elektor published in ref. [1]. Sensors made easy Most analogue sensors can be char- acterised by a mathematical formula. Take a temperature probe for example: a typical formula that converts a tem- perature sensor resistance to a tem- perature value would be given by the following equation: T = [ K 0 + K a (ln 1000R) + K 2 (ln 1000R) 3 ]- 1 - 273.15 Where T is the temperature, R is the resistance in kilo-ohms, K 0 is 1.02119xl0- 3 , K x is 2.22468xl0- 4 , and K 2 is 1.33342xl0- 7 . If you were incorporating temperature data into a control program, then the normal way you would deal with this in code is to use Excel to generate a series of values for each of, say, 256 separate A/D readings on your micro- controller into the corresponding tem- perature value. You would then use this data, or a subset of it, as a basis for making decisions in your program. If you had a program that needed to display the data in ‘human’ form you would either use further look up tables to allow you to display the decimal temperature reading, or you would implement floating point and a maths library in your 8 -bit micro which would have quite a significant impact in terms of code size and speed. In either case an ARM with floating point and maths functions built-in would allow you to simply enter the mathematical formula into a single line of code. For many applications this could mean the death of the lookup table? Way hay! Thank goodness! Speed, speed, speed The ARM chip operates off an exter- nal supply of 3.3 V and an internal sup- ply of 1.5 V. This reduces the power consumption of the chip and also means that each gate in the device can be made smaller - which in turn increases the speed of operation: our ARM devices are clocked at 18 MHz, but have an internal phase locked loop that boosts the clock frequency up to a whopping 47 MHz. (Actually the ARM can go faster but we keep the speed at 47 MHz because this is the fre- quency at which the USB connection works.) So how much faster, in practi- cal terms, is it? Well, funnily enough that is not a straightforward question: the answer is that it depends on just what the microcontroller is doing. For simple floating point mathematical operations you can expect the ARM to be between 5 to 10 times faster than 8-bit microcontrollers clocked at the same frequency. For more advanced mathematical operations - like Taylor’s series approximations - the ARM can be more than 100 times quicker. Our experiments here surprised us — we thought it would be universally much quicker for all operations — especially floating point. However we are relying on a compiler which may not be terri- bly well optimised for 32-bit operation. Still, the ARM is a multiple of at least a few times quicker than any 8-bit micro- controller we have tried. 1 I ARM 1 i Audio ! PWM1 1 330 Q| — 1 r—ot 1 i i 1 J 1 100n i 1 080632 - 11 Figure 1. Single-transistor resistor D/A converter. More memory There is a mindset for engineers work- ing with 8-bit processors: • keep code size small; • keep code efficient; • minimise the software development overhead. All this means that developers have to minimise the available features in products. However, a 32-bit fast core with almost-but-not-quite unlimited amounts of RAM and ROM, and more I/O should allow us to add radical fea- tures to a microcontroller and hence to our products. For example: let’s make our single-chip microcontroller talk. There are a couple of routes open to designers who want talking chips: either digitise speech using a com- puter, or generate speech inside the microcontroller itself. Let’s look at each in turn. Option 1: if you are digitising speech then for audio you should be able to get away with a bit rate of 8,000 sam- ples per second at 8 bits. 100 kBytes of ROM can therefore store around 12.5 seconds of audio. That’s not so use- Table 1. AT91SAM ARM 7 CPU family members. Part ROM RAM I/O pins Package Speed A/D Price (US$) AT91SAM7XC1 28-AU 1 28K x 8 32K x 8 62 1 00-LQFP 55M Hz 8x1 Obit 11.93 AT91SAM7X128-AU 1 28K x 8 32K x 8 62 1 00-LQFP 55MHz 8x1 Obit 10.97 AT9 IS AM 7 A3 -All 256K x 8 32K x 8 62 1 00-LQFP 60MHz 8x1 Obit 14.84 AT91SAM7SE256-AU 256K x 8 32K x 8 88 1 28-LQFP 48MHz 8x1 Obit 14.19 AT91SAM7SE256-CU 256K x 8 32K x 8 88 144-LFBGA 48MHz 8x1 Obit 15.7 AT91SAM7SE51 2-AU 51 2K x 8 32K x 8 88 1 28-LQFP 48MHz 8x1 Obit 16.77 AT91SAM7SE51 2-CU 51 2K x 8 32K x 8 88 144-LFBGA 48MHz 8x1 Obit 18.06 AT91SAM7S1 28-MU 1 28K x 8 32K x 8 32 64-QFN 55M Hz 8x1 Obit 10.32 1/2009 - elektor 67 E-BLOCKS Figure 2. Flowcode for ARM in action. tor and a capacitor to make a D/A con- verter by modulating the internal PWM circuit of the ARM. You can see this in Figure 1. This is the technique used for making audio on many mobile phones. So with 65 k of internal memory you can now add sound to your microcon- troller projects for just the cost of a few of passive components. The cost case Some of these applications can be done with faster and larger 8-bit proc- essors and you might be forgiven for thinking that these advantages are not worth the effort involved in moving to a new design target. However when you look at the costs of the chips then you may change your mind. Table 1 sets out the costs of the AT91 series of devices - these are the one-off prices from Digikey (May 2008) and these are around 50% cheaper than some of the larger 8-bit devices that you would need to implement these functions. Disadvantages of the ARM Of course there is a down side - or several: ful, but with 512 k ROM micros readily available, it is realistic. Option 2: a better alternative might be to split up human speech into ‘pho- nemes’ which consist of all the basic sounds used in human speech, to store these in the ROM and then to selec- tively stream sequential phonemes to make as many different words as you like. The 65 phonemes that make up human speech take up around 65 k of ROM space - not a lot for a 32-bit micro, but not practical in many 8-bit micros. The audio produced is defi- nitely computer generated, but is also quite acceptable for use in electronic equipment. In either case, the speed of the 32 bit devices allows us to use a single resis- • ARM devices (to us) are more diffi- cult to program: I/O lines, data direc- tion registers and the guts of these devices are addressed using a sys- tem of pointer registers which is just plain awkward, (or maybe it is just different!). • The main supply voltage is 3.3 V rather than the traditional 5 V. That’s not so much of a problem when start- VDD USB GND RESET RAO RA1 RA2 RA3 RA4 RA5 RA6/TX0 RA7/RX0 RC3/PWM4 RDO/TWCK RD1 RD2 RD3 RD4/TWD RD5/PWM3 RD6/PWM2 RD7/PWM1 080632 - 13 |2 13 351 371 15 351 ft 351 |7 3T1 Hi 371 H) 371 Ro 3T1 nf 351 nf m 251 m Wi Q? 271 Rs 251 Re 251 R 7 271 Q? 251 R9 271 Ro 271 Figure 3. The ECI0 ARM module (left) and its pin description (right) - free with Flowcode for ARM. 68 elektor - 1/2009 ing a development from scratch but it can have issues when upgrading existing systems, (however, the plus side here is that the power consump- tion is low). • The packaging is all SMD which has implications for the design cycle and - for small companies - also produc- tion implications. Easy adoption: hardware If some of the benefits we have high- lighted here are of interest to you then how do you get involved? We can sug- gest two routes! 1. Flowcode for ARM. Flowcode (Fig- ure 2) takes much of the pain away of using the AT91 ARM family of micro- controllers - it has been developed to allow users to easily port designs from 8 bit to 32 bits with a system of ports (A to E) that mirrors those found on smaller micros. This includes full soft- ware for handling floating point num- bers and a full mathematics library, and it is compatible with programs from Flowcode for AVR and Flowcode for PIC so porting your programs to this new platform should be easy. 2. ECRM40. Also available from the Elektor Shop is a 40-pin 0.6-inch ver- sion of the AT91 which fits into a standard 40-pin header. This one’s called ECRM40 and pictured in Fig- ure 3. The order code is 080632-91. To help you get started we are giving this away free with every Professional ver- sion of Flowcode for ARM. If you would like a more robust devel- opment kit then there is also a suite of ARM based E-blocks (Figure 4) that’s compatible with Flowcode which is available at a reduction of 30%. Free sample programs Some sample programs for the ARM edi- tion of Flowcode were developed and may be obtained free of charge from the Elektor website at [2]. The examples cover temperature calculation, phoneme based speech and ‘wav’ file speech. ( 080632 - 1 ) References and Internet links [1] LPC210x ARMee' Development System (parts 1 and 2), Elektor March and April 2005. [2] www.elektor.com/080632 Advertisement Prototype & small series PCB specialists Simple online pricing Fast online ordering Clear online order tracking Order pooling low pooling prices wide pooling choices 1-8 layers CIRCUITS All services - no tooling charges - no minimum order - from 3 working days - 100% DRC verification Call us: 020 8816 7005 Email: euro@eurocircuits.com www.eurocircuits.com full options service 1-16 layers UL marking 1/2009 - elektor 69 MICROCONTROLLERS Figure 1. ATmega88 Block diagram. BASCOM AVR Course ( 5 ) Memory, switch polling and time management Burkhard Kainka (Germany) In the microcontroller embedded scene, complaints about systems having too much memory or too much processing power are rare if not non-existent — we never seem to have enough! Microcontrollers in particular have limited resources with no possibility of expansion, so it's important not to squander them by using inefficient programming practices. Software engineers aim to produce efficient code. A sim- ple routine like reading the value of a switch could be pro- grammed in such a way that it uses up 1 00 % of the micro- controllers processing time. In this case there would be no capacity spare for the controller to perform any other tasks. It is important when designing any software that the proces- sor resources are used efficiently. We expand on this theme here and give some pointers to how the microcontroller can be better employed. H'rz: ■ ■W*.' HfcV-i t iruj i 3 p'Uh*. ri I 1023 Then Pwma = 1023 If S2 = 0 Then Pwma = Pwma - 1 If Pwma < 0 Then Pwma = 0 If S3 = 0 Then Pwma = 0 Waitms 20 Pwmla = Pwma If Pwma <> Pwmold Then Print Pwma End If Pwmold = Pwma Loop 'poll') the switch status to ensure we do not miss a press. A systematic approach to software design is also important; it can create many problems if you need to add a switch poll routine to existing software, much better to design it in from the start where each function can be built up logically. Another, more practical problem is that most switches suf- fer from contact bounce. When the contacts come together they do not switch cleanly but instead bounce, producing an output that looks like the button has been pressed several times off and on very quickly. It would therefore not be a good idea to use the switch input directly to clock a timer or counter. The bounce time is quite short, one common debouncing method is to filter out the bounce by reading the switch status say once every 1 0 ms. In the next series of examples we use three pushbuttons connected on D 5, D6 and D 7. The corresponding port bits are set high and the data direction register sets these pins to inputs so that internal pull-up resistors are connected. An open circuit input will be read as a and a 'O' when the button is pressed. The port pins are given aliases so that you can use statements like: if Si = 0 then (Listing 3). Test 3 actually uses just two buttons to toggle two outputs. 51 switches the first output high and the second low while 52 toggles them back. Each key press sends a message to the PC screen. The polling is repeated after a 50 ms wait. When either button is pressed continuously, a message is sent to the serial interface every 50 ms but the port outputs do not change state. Test 4 (Listing 4) uses two buttons to control the mark/ space ratio of a PWM signal OC1 A = PB1 . One button increases the PWM value while the other decreases it. An oscilloscope shows the variation in mark/space ratio and an LED connected at the output will change in brightness. Switch debouncing is not necessary here because the rou- tine only measures the time that the buttons are pressed. Test 5 (Listing 5) uses two buttons to toggle the state of two LEDs. Each press of SI causes the LED on Outl to change state; likewise S2 controls the LED on Out2 . Once a key SI i S2 i S3 i D6 D2 ATmega88 D5 D3 D7 B1 M OUT1 OUT2 PWM 080853-12 Figure 2. Input and output 1/2009 - elektor 71 MICROCONTROLLERS Listing 5 Two toggle flipflops Listing 6 Test5 : Two counters Do If SI = 0 Then Test6 : If Outl = 0 Then Dim Countl As Word Outl = 1 Dim Count2 As Word Else Do Outl = 0 If SI = 0 Then End If Countl = Countl + 1 Waitms 10 Print "Countl End If Print Countl Do Waitms 50 Loop Until SI = 1 Do If S2 = 0 Then Loop Until SI = 1 If Out 2 = 0 Then End If Out2 = 1 If S2 = 0 Then Else Count2 = Count2 + 1 Out2 = 0 Print "Count2 End If Print Count2 Waitms 10 Waitms 50 End If Do Do Loop Until S2 = 1 Loop Until S2 = 1 End If Waitms 100 Loop Loop Listing Switch polling using interrupt Test7 : Dim Ticks As Byte Dim Swl As Byte Dim Sw2 As Byte Dim Sw3 As Byte Dim Sw4 As Byte Dim Pwml As Integer Dim Pwmlold As Integer Dim Ledtimer As Byte Dim Ledblink As Byte Ledblink = 1 Enable TimerO Enable Interrupts Cls Led 0 Do If Ticks = 1 Then Outl = 1 If Ticks = 5 Then Outl = 0 Loop TimerOisr : Ticks = Ticks + 1 If Ticks = 1 Then If SI = 0 Then Swl = Swl + 1 Else Swl = 0 If Swl > 100 Then Swl = 100 If S2 = 0 Then Sw2 = Sw2 + 1 Else Sw2 = 0 If Sw2 > 100 Then Sw2 = 100 If S3 = 0 Then Sw3 = Sw3 + 1 Else Sw3 = 0 If Sw3 > 100 Then Sw3 = 100 End If If Ticks = 2 Then If Swl = 3 Then Pwml = Pwml + 1 If Pwml > 1023 Then Pwml = 1023 End If If Swl = 100 Then Pwml = Pwml + 1 If Pwml > 1023 Then Pwml = 1023 End If If Sw2 = 3 Then Pwml = Pwml - 1 If Pwml < 0 Then Pwml = 0 End If If Sw2 = 100 Then Pwml = Pwml - 1 If Pwml < 0 Then Pwml = 0 End If If Pwml <> Pwmlold Then Print Pwml End If Pwml a = Pwml Pwmlold = Pwml End If If Ticks = 3 Then If Sw3 = 3 Then If Ledblink = 1 Then Ledblink = 0 Else Ledblink = 1 End If End If End If If Ticks = 4 Then Ledtimer = Ledtimer + 1 If Ledtimer > 100 Then Ledtimer = 0 If Ledtimer = 1 Then If Ledblink = 1 Then Out 2 = 1 End If If Ledtimer = 50 Then Out2 = 0 End If If Ticks = 10 Then Ticks = 0 Return 72 elektor - 1/2009 press is detected the program switches the LED and loops until the switch is released. A 1 0 ms wait is used to filter any bounce otherwise the LED would change state on every edge of the switch bounce waveform, leaving the LED ran- domly on or off. The same routine can be used to increment the values of two counters (Test 6). Each time a counter value changes, its value is sent to the PC. Switch polling using tinier interrupt All of the preceding methods of switch polling do not use the processor resources efficiently, it spends its time either waiting or reading the switch inputs. In reality there will be more switches to read and other tasks for the firmware to take care of. The next stage is to take a more structured approach to software design so that resources are better managed. Test 7 (Listing 7) shows one method of how this can be achieved. Switch polling occurs in the background in a timer interrupt routine. The main program is now free to take care of other tasks. For each button SI , S2 and S3 there is an associated vari- able Swl , Sw2 and Sw3. While a button is not pressed its variable has the value zero. As long as a button is pressed the variable is incremented up to 100 where it stops. The variable indicates how long the key has been pressed, so you may for example wish to initiate some process only when its value reaches three. A long key press gives a value of 1 00. The timer routine uses a counter to produce short time inter- vals Ticks which is incremented each time the timer inter- rupts (it is reset when it reaches 1 0). The three switches are read only once every ten Ticks (when Ticks = l). The interval takes care of switch debouncing and occurs often enough not to miss any press. At other tick values different duties are performed. When Ticks = 2 switch counters are read and a PWM signal is generated. When Ticks = 3 the switch counter is read and Ledblink is toggled to switch a flashing LED. The LED output is produced when Ticks = 4. The sequential dis- tribution of tasks gives the impression that all the activities are performed simultaneously. The processor still has ample processing power in reserve for many additional tasks. The main program switches output Outl high for five ticks and low for five ticks. An LED connected to this output appears slightly dim; the on/off repetition rate is so fast that you can- not see any flickering. The LED brightness is constant, indicat- ing that the program is maintaining a 50:50 output clock. The mark/space ratio of the PWM output is controlled by buttons Swl and Sw2. The software determines if there is a short button press or a long one. A short press changes the value by one, a longer press changes the counter value con- tinuously. This allows the user to quickly reach the desired value. ( 080853 - 1 ) Downloads and further information The programming examples and more information for this course can be downloaded from the project page at www.elektor.com. We also look forward to your feedback on the Elektor forum. Advertisement \ Starter Kit Professional for ARM a low cost entry into ARM development This bundle is perfect for low cost entry into ARM develop- ment and is great for engineers who need to develop prototypes of electronic systems quickly using the super fast ARM 7 core from Atmel. The pack is fully compatible with the range of E-block accessories. Datasheets on each individual item are available separately. Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 r^lektor L~ SHOP Flowcode 3 for ARM (CD-ROM) E-blocks ARM board E-blocks LED board E-blocks LCD board E-blocks Switch board USB cable Power supply Total value Special offer £274.50 £ 162.00 T Free P&P'* Further information and ordering at www.elektor.comMm-kit 1/2009 - elektor 73 DESIGN TIPS Low-power crystal oscillator vcc c vcc Rainer Reusch (Germany) Digital CMOS integrated circuits in the 74HC and 4000 series dissipate almost no static power. Using one inverter, for example from a 74HC04 or a 4069, it is easy to construct a crystal oscil- lator (Circuit A). Unfortunately the current consumption of the device rises considerably. Not, we hasten to add, to rainforest- threatening levels: just to a few milliamps. This could be a signif- icant draw if the circuit is to be powered from a (rechargeable) battery. Two questions naturally arise: what accounts for this in- creased current consumption, and whether there are differenc- es in this regard between the var- ious logic families. It is well known that current con- sumption rises with frequency of operation. Here, however, that is only part of the answer. The other part is due to the fact that in the oscillator circuit we are abusing the CMOS inverter as a linear amplifier. The input and output voltages are on average approximately half the supply voltage, which means that both transistors in the complementa- ry output stage are conducting. This suggests the idea of build- ing the complementary output stage using discrete components and limiting the current flow with resistors. The CMOS 4007 in- tegrated circuit includes three such stages, in two of which the drain connections are brought out separately. Circuit B shows how this oscillator is constructed. Because the output is sinusoidal rather than rectangular, a second stage is added to square up the waveform. We can take the idea of using drain resistors further: instead of drain resistors we can use a further complementary stage. Circuit C shows a practical configuration. The current consumption of each circuit was measured using a 4 MHz crystal and a 16 MHz crystal, with a power supply of 5 V. Various drain resistor val- ues were tried in the 4007-based circuit. The Table shows the re- sults. It is apparent that at 5 V the 4000 family devices have difficulty coping with the 1 6 MHz crystal, with resultant unreliable start-up characteristics. The best results were obtained using an MC14069UB (i.e., a 4069UB), but unfortunately the circuit did not start reliably at 1 6 MHz. The 4007-based cir- cuit also gave good results. In- creasing the value of the drain resistors reduced the current con- sumption, although the effect is perhaps not quite as significant as hoped. Furthermore, there is an upper limit to the value that can be used, dependent on crys- tal frequency and supply voltage. Circuit C gave the same results as Circuit B with 1 kilo-ohm re- sistors, and there is also only a relatively low dependence of cur- rent consumption on temperature. One final note: the values in the table should be taken only as a guideline, as in practice results will vary from device to device. ( 080378 - 1 ) Table Circuit Integrated circuit, drain resistor (if any) 4 MHz 16 MHz A 74HC04 1.47mA 4.9mA A 74HCU04 1.99mA 3.5mA A 74HCT04 1 .50mA 5.2mA A 4069UBE 0.56mA 1 .4mA A MCI 4069UB 0.37mA 0.7mA* B 4007 /0Q 0.95mA 1 .8mA B 4007/ 100^ 0.93mA 1.7mA B 4007 / 470 £2 0.86mA 1 .4mA B 4007 / 1 kn 0.79mA (no operation) C 4007 0.79mA (no operation) * unreliable start-up 74 elektor - 1/2009 Store it quickly! ©- TR1 230V 'Xi ©- Rainer Reusch (Germany) The EEPROM in a micro- controller is often used to store collected data or device settings so that they are still avai- lable even if the device is switched off and then on again. However, the- re is a limit to the num- ber of write cycles that the EEPROM can endure and so it is not always a good idea to store data at the earliest opportu- nity: an alternative is to store the data away quickly just before power is lost. That leaves the problem of detecting when the on-off switch is flicked or a power failure occurs, a problem which the circuit described here is designed to solve. The circuit is at heart a classical linear power supply consisting of a bridge rectifier, reservoir capa- citor and voltage regulator. We have only added an extra diode (Dl) in the main supply path. In normal operation smoothed DC levels appear at the output of the voltage dividers, and hence at the inputs to comparator IC1 . The component values in the first volta- ge divider (Rl, R2 and Cl) must be selected so that its output volta- ge, in the range 0.5 V to 1 V, is a little higher than that of the second voltage divider. The output of the comparator is then high. When power is removed the out- put voltage of the first voltage di- vider falls very rapidly, as the time constant of the circuit is small. However, the voltage after diode Dl is maintained for some time thanks to reservoir capacitor C2. During this time the output of the comparator is low, generating an interrupt to the microcon- troller. In the microcontrol- ler, the interrupt is used to trigger the storage of es- sential data in EEPROM, and because it must com- plete this process using only the energy stored in reservoir capacitor C2, the value of this capacitor must be sufficiently large. The microcontroller can power down any connec- ted loads (relays, LEDs and the like) in order to gain a little more time. The circuit shown is in principle also suitab- le for devices powered by (re- chargeable) batteries, simply by dispensing with the transfor- mer and bridge rectifier. In this case, capacitor Cl can also be dispensed with. Capacitor C2 is also not strictly necessary, but it does suppress a brief low-going pulse on the output of the compa- rator when power is applied. ( 080379 - 1 ) Tel: 01635 40347 Fai: Cnoi WWJ i-mad. ciicmh £ i ivihiiiv lc.xi.tc uk Newbury Electronics lid Fhhif^I hMi/p um r*vi t4i rp G#K.4rohc l c*. u k Advertisement See your design in print! Elektor Electronics (Publishing) are looking for Freelance Technical Authors/ Designers If you have an innovative or otherwise original design you would like to see in print in Europe's largest magazine on practical electronics - above average skills in designing electronic circuits - experience in writing electronics-related software - basic skills in complementing your design with an explanatory text - a PC email and Internet access for effi- cient communication with our in-house design staff ... then do not hesitate to contact us for exciting opportunities in getting your designs published on a regular basis; Elektor Electronics - Jan Buiting, Editor 1/2009 - elektor 75 i: J INFOTAINMENT PUZZLE Puzzle with an electronics touch In the new year we cheerfully continue with our Hexadoku puzzle. We've stocked up and a new batch of these brain teasers should prevent boredom on a rainy day when faced with missing components, or lacking inspiration for the next groundbreaking project on the workbench. Send us your solution and enter a prize draw for an E-blocks Starter Kit Professional and three Elektor Shop vouchers. The instructions for this puzzle are straightforward. In the diagram composed of 1 6 x 1 6 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. All correct entries received for each month's puzzle go into a draw for a main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. The puzzle is also available as a free download from our website. SOLVE HEXADOKU AND WIN! Correct solutions received enter a prize draw for an E-blocks Starter Kit Professional worth £249 and three Elektor SHOP Vouchers worth £40.00 each. We believe these prizes should encourage all our readers to participate! The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. PARTICIPATE! Please send your solution (the numbers in the grey boxes) by email to: editor@elektor.com - Subject: hexadoku 01-2009 (please copy exactly). Include with your solution: full name and street address. Alternatively, by fax or post to: Elektor Hexadoku Regus Brentford - 1 000 Great West Road - Brentford TW8 9HH United Kingdom - Fax (+44) 208 2614447 The closing date is 1 February 2009. PRIZE WINNERS The solution of the November 2008 Hexadoku is: FC2B6. The E-blocks Starter Kit Professional goes to: John Riches (UK). An Elektor SHOP voucher worth £40.00 goes to: Elia Mady (UK), Marcel Haim (ISR), Ian Somers (UK). Congratulations everybody! A 5 B E 2 9 6 1 7 8 5 9 B 3 D 6 5 4 8 2 F 1 6 5 A 9 D 3 E 9 4 C E A 1 0 C 7 2 6 5 3 0 B A E 4 7 6 3 D 6 9 F 5 2 B 4 A 9 F 0 8 C 3 A 4 A 0 C 1 7 8 2 D 8 A 6 E 1 B E 8 3 D 9 A 5 4 0 2 7 F 8 9 D 6 B 1 2 9 C B E 3 1 9 B 0 F 2 6 A 8 F 4 E 6 1 3 0 A 7 (c) PZZL.com 4 1 A E 0 6 B F 3 C 7 9 D 2 8 5 0 F D 6 c 8 9 4 2 5 B 1 A E 3 7 C 3 9 5 2 E D 7 8 4 A 6 0 F B 1 8 7 2 B 1 3 5 A 0 D F E C 9 6 4 2 5 F C 3 A 8 0 D E 6 7 B 1 4 9 B D 4 1 7 C 2 9 F 0 8 3 5 6 A E 3 0 8 A E 5 6 1 9 2 4 B F C 7 D 6 9 E 7 4 B F D C 1 5 A 3 8 2 0 1 A 5 8 F 0 E 3 7 9 2 4 6 B D C F 2 0 4 6 D 7 5 E B 3 C 9 A 1 8 E 6 3 D B 9 1 C 5 A 0 8 7 4 F 2 7 B C 9 A 2 4 8 6 F 1 D E 5 0 3 D 4 1 3 9 F C 2 B 6 E 0 8 7 5 A 5 8 6 2 D 1 3 E A 7 C F 4 0 9 B A C 7 F 8 4 0 B 1 3 9 5 2 D E 6 9 E B 0 5 7 A 6 4 8 D 2 1 3 C F 76 elektor - 1/2009 RETRONICS INFOTAINMENT jtiWatch: return of the scientific calculator watch David L. Jones (Australia) The last few years have seen a retro watch revival, with 'geek' watches of all sorts — Nixie tube watches, LED watches, PONG game watches and so on. This month's Retronics page takes an unusual slant by present- ing pWatch, which beats all of the above hands down for DIY nerdiness. The last scientific calculator watch was the Casio CFX-400 way back in 1 985! It is so sought after today that even broken ones can fetch many hundreds of dollars. And a pristine one in working condition? — if you have to ask the price, you can't afford it. So not only has a sci- entific calculator watch not been available for 20 years (leaving engineers bereft), you've never been able to get the satisfaction of building your own, until now. By way of this short article, the pWatch project is a great occa- sion to rekindle memories of cal- culator watch use at University or College in the 1970s and 1980s. Raise your hands please! pWatch is a modern incarnation of the calculator watch, now built using contemporary components like SMDs and a PIC microcon- troller. It supports both Algebraic and RPN calculation modes. Why RPN? Why not! RPN is not only efficient to code and use, but it still has a big user base of HP calculator enthusiasts. RPN stands for Reverse Polish Nota- tion. It was invented by Hewlett Packard for use in some of their very first calculators, and they still sell RPN capable calculators today. I thought that no compre- hensive calculator watch would be complete without RPN func- tionality, so it's available as a user selectable option. The RPN mode is based on the classic HP 4-level stack with X/Y/Z/T reg- isters, with T register copy func- tionality, as follows: RPN Stack T Register Z Register Y Register X Register In RPN mode, values get 'entered' onto the stack by pressing the ENTER key. Oper- ators and functions will auto- matically perform the ENTER function if it has not already been done. All operators and functions work on either the X register or the X and Y registers. So to add 1 + 2 you would key in 7 ENTER 2 +. If a value gets into the T reg- ister it 'sticks' and stays there until manually cleared. This is a useful function for repeating calculations. The menu options are iden- tical for either RPN or Alge- braic mode, but they do dif- fer in the way they operate. As RPN works based on pre- entered values on a stack, so functions such as x^y are per- formed on pre-entered val- ues. This is known as 'postfix notation'. In Algebraic mode on the other hand, x is entered first, followed by the x^y com- mand, and then the routine must wait for the y value to be entered. This is known as 'infix notation'. Somewhat confusingly, in Alge- braic mode, some operations such as SIN and LOG use post- fix notation, just like RPN. So you enter 10 SIN, not SIN 10. This is a common method used on commercial algebraic cal- culators such as Casio's. This is why many people like RPN, it's consistently postfix notation, so there is never any confusion. If you compare the source code for the RPN and Algebraic modules, you'll notice that RPN is much simpler and easier to understand. With the RPN stack system, you can perform pow- erfully complex calculations using very simple commands. There is no operator prece- dence or parentheses to con- tend with. However, RPN does require that you think about how you do your calculation before you enter it, as it does not calculate the same way you see it written on paper. Algebraic on the other hand requires the use of nested parentheses and operator precedence, and this can get very complicated from a pro- gramming perspective. But the end result is that your calcula- tions are performed more like you see them on paper. The algebraic mode supports six levels of parentheses like most basic scientific calcula- tors. Full operator precedence is maintained with each level of parentheses. In the Algebraic 'stack' there is a basic working set of reg- isters containing X, Y and Z Registers. The Z register is used when operator precedence is called for. E.g. 1+2*3 would result in the 1 being shifted into the Z register. If a paren- thesis is opened then the entire contents of those working reg- isters and operators are shifted up one level into the parenthe- ses working registers. Likewise, when a parenthesis is closed the registers and operators are dropped back down one level. So in effect it is one big 7-level-deep-by-5-value-wide stack. Compare that with the simple 4-level-by- 1 -wide RPN stack. Yet the RPN stack, if used correctly, can be more power- ful than the Algebraic stack. Full details on construction and programming of n Watch may be found at the author's web- site [1 ]. The project was devel- oped entirely with the Micro- chip C30 C compiler within the MPLAB environment. ( 080816 - 1 ) Internet Link [1] www.calcwatch.com Retronics is a monthly column covering vintage electronics including legendary Elektor designs. Contributions, suggestions and requests are welcomed; please send an email to editor@elektor.com 1/2009 - elektor 77 ELEKTOR SHOWCASE To book your showcase space contact Huson International Media Tel. 0044 (0) 1 932 564999 AVIT RESEARCH www.avitresearch.co.uk USB has never been so simple... with our USB to Microcontroller Interface cable. Appears just like a serial port to both PC and Microcontroller, for really easy USB connection to your projects, or replacement of existing RS232 interfaces. See our webpage for more details. From £10.00. BETA LAYOUT www.pcb-pool.com Beta layout Ltd Award- winning site in both English and German offers prototype PCBs at a fraction of the cost of the usual manufacturer’s prices. ByVac www.byvac.com • USB to I2C • Microcontrollers • Forth • Serial Devices C S TECHNOLOGY LTD www.cstech.co.uk Low cost PIC prototyping kits, PCB's and components, DTMF decoder kits, CTCSS, FFSK, GPS/GSM, radio equipment and manuals. PCB design and PIC program development. DECIBIT CO.LTD www.decibit.com • Development Kit 2.4 GHz • Transceiver nRF24L01 • AVR MCU ATmega168 1 * u WWW. elektor. com DESIGNER SYSTEMS http://www.designersystems.co.uk Professional product development services. • Marine (Security, Tracking, Monitoring & control) • Automotive (A V, Tracking, Gadget, Monitoring & control) • Industrial (Safety systems, Monitoring over Ethernet) • Telecoms (PSTN handsets, GSM/GPRS) • Audiovisual ((HD)DVD accessories & controllers) Tel: +44 (0)1872 223306 Van rridi ■- " r.-.v .ti t i n r, ft- 1 1 EASYDAQ www.easydaq.biz • USB powered, 4 relays + 4 DIO channels • Will switch 240VAC @ 10 amps • Screw terminal access • LabVIEW, VB, VC • Free shipping • From £38 Design & supply of USB, USB Wireless, Ethernet & Serial, DAQ, Relay & DIO card products. info@easydaq.biz EASYSYNC http://www.easysync.co.uk EasySync Ltd sells a wide range of single and multi- port USB to RS232/RS422 and RS485 converters at competitive prices. ELNEC www.elnec.com • device programmer manufacturer • selling through contracted distributors all over the world • universal and dedicated device programmers • excellent support and after sale support • free SW updates • reliable HW • once a months new SW release • three years warranty for most programmers YOUR ELECTRONICS OPEN SOURCE http://dev.emcelettronica.com Website full of Projects and Resources for Electronics Engineers and DIY. • Tutorial • Hardware (Schematic & Gerber) ” • Firmware (Asm & C) • Reference Design Everyone can submit a story as a useful source! 'Share for life 1 A First Technology FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk/PICProTrng.html Microchip Professional C and Assembly Programming Courses. The future is embedded. Microchip Consultant /Training Partner developed courses: • Distance learning / instructor led • Assembly / C-Programming of PIC1 6, PIC1 8, PIC24, dsPIC microcontrollers • Foundation / Intermediate FLEXIPANEL LTD www.flexipanel.com TEAclippers - the smallest PIC programmers in the world, from £20 each: • Per-copy firmware sales • Firmware programming & archiving • In-the-field firmware updates • Protection from design theft by subcontractors FUTURE TECHNOLOGY DEVICES http://www.ftdichip.com FTDI designs and sells USB-UART and USB-FIFO interface i.c.’s. Complete with PC drivers, these devices simplify the task of designing or upgrading peripherals to USB LONDON ELECTRONICS COLLEGE http://www.lec.org.uk Vocational training and education for national qualifications in Electronics Engineering and Information Technology (BTEC First National, Higher National NVQs, GCSEs and GCEs). Also Technical Management and Languages. [EC LCDMOD KIT http://www.lcdmodkit.com Worldwide On-line retailer • Electronics components • SMT chip components • USB interface LCD • Kits & Accessories • PC modding parts • LCD modules 78 elektor - 1/2009 products and services directory MQP ELECTRONICS www.mqp.com • Low cost USB Bus Analysers • High, Full or Low speed captures • Graphical analysis and filtering • Automatic speed detection • Bus powered from high speed PC • Capture buttons and feature connector • Optional analysis classes OBD2CABLES.COM http://www.obd2cables.com • Thousands of OBD cables and connectors in stock • Custom cable design and manufacturing • OBD breakout boxes and simulators • Guaranteed lowest prices • Single quantity orders OK • Convenient online ordering • Fast shipping Visit our website, or email us at: sales@obd2cables.com ROBOT ELECTRONICS http://www.robot-electronics.co.uk Advanced Sensors and Electronics for Robotics • Ultrasonic Range Finders • Compass modules • Infra-Red Thermal sensors • Motor Controllers • Vision Systems • Wireless Telemetry Links • Embedded Controllers ROBOTIQ http://www.robotiq.co.uk Build your own Robot! Fun for the whole family! • MeccanoTM Compatible • Computer Control • Radio Control • Tank Treads • Hydraulics Internet Technical Bookshop, 1-3 Fairlands House, North Street, Carshalton, Surrey SM5 2HW email: sales@robotiq.co.uk Tel: 020 8669 0769 m 1 pi f RADIOMETRIX www.radiometrix.com The leading global developer of ISM band, low power radio modules for wireless data transmission: • Transmitters • Receivers • Transceivers • RF modems • Evaluation Kits WWW. elektor. com SCANTOOL.NET http://www.scantool.net ScanTool.net offers a complete line of PC-based scan tools for under £50. • 1 year unconditional warranty • 90 day money back guarantee • For use with EOBD compliant vehicles • Fast shipping • Compatible with a wide range of diagnostic software Visit our website, or email us at: sales@scantool.net USB INSTRUMENTS http://www.usb-instruments.com USB Instruments specialises in PC based instrumentation products and software such as Oscilloscopes, Data Loggers, Logic Analaysers which interface to your PC via USB. VIRTINS TECHNOLOGY www.virtins.com PC and Pocket PC based virtual instrument such as sound card real time oscilloscope, spectrum analyzer, signal generator, multimeter, sound meter, distortion analyzer, LCR meter. Free to download and try. SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business, Showcase - a permanent feature of the magazine where you will be able to showcase your products and services. For just £242 + VAT (£22 per issue for eleven issues) Elektor will publish your company name, website address and a 30-word description For £363 + VAT for the year (£33 per issue for eleven issues) we will publish the above plus run a 3cm deep full colour image - e.g. a product shot, a screen shot from your site, a company logo - your choice Places are limited and spaces will go on a strictly first come, first served basis. So-please fax back your order today! _ n I wish to promote my company, please book my space: • Text insertion only for £220 + VAT • Text and photo for £330 + VAT NAME: ORGANISATION: JOB TITLE: ADDRESS: TEL: PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 00-44-(0)1932 564998 COMPANY NAME WEB ADDRESS 30- WORD DESCRIPTION 1/2009 - elektor 79 BOOKS, CD-ROMs, KITS & MODULES A world of electronics from a single shop! Digital Volumes PDF tiles, with comprehensive^ 1 1 ft Usues erf Elektor magaiine, oi ch luattio a than 2,100 reedy lor hlgh'd circuits & protects iionics lor ent- ail areas thusiasts and specisg| 110 issues, more than 2,100 articles Elektor 1990 through 1999 This DVD-ROM contains the full range of 1 990-1 999 volumes (all 1 1 0 issues) of Elektor Elec- tronics magazine (PDF). The more than 2,1 00 separate articles have been classified chrono- logically by their dates of publication (month/year), but are also listed alphabetically by topic. A comprehensive index enables you to search the entire DVD. The DVD also contains (free of charge) the entire The Elektor Datasheet Collection 1 ...5' CD-ROM series, with the original full datasheets of semiconductors, memory ICs, microcontrollers, and much more. Modem technology for everyone FPGA Course FPGAs have established a firm position in the modern electronics designer's toolkit. Until recently, these 'super components' were practically reserved for specialists in high-tech companies. The nine lessons on this courseware CD-ROM are a step by step guide to the world of Field Pro- grammable Gate Array technology. Sub- jects covered include not just digital logic and bus systems but also building an FPGA Webserver, a 4-channel multimeter and a USB controller. The CD also con- tains PCB layout files in pdf format, a Quartus manual, project software and various supplementary instructions. ISBN 978-90-5381 -225-9 • £14.50 • US $29.00 Software Tools & Hardware Tips Ethernet Toolbox This CD-ROM contains all essential in- formation regarding Ethernet interfaces! Ethernet Toolbox includes a collection of datasheets for dedicated Ethernet inter- face ICs from many different manufac- turers. It provides a wealth of information about connectors and components for the physical layer (PHY) and specific software tools for use with the Ethernet (Software). To help you learn about the Ethernet in- terfaces, we have compiled a collection of all articles on this topic that have ap- peared in Elektor and complemented them with additional documentation and links to introductory articles on Ethernet interfaces. The documents are PDF files. ISBN 978-0-905705-76-7 • £69.00 • US$109.00 ISBN 978-90-5381-214-3 • £19.50 • US $39.00 v W \ J Prices and item descriptions subject to change. E. & O.E 80 elektor - 01/2009 From LED to graphical LCD Universal Display Book for PIC Microcontrollers This book begins with simple programs to flash LEDs, and eventually by stages to use other display indicators such as the 7-seg- ment and alphanumeric liquid crystal dis- plays. As the reader progresses through the book, bigger and upgraded PIC chips are introduced, with full circuit diagrams and source code, both in assembler and C. A tutorial is included using theMPLAB program- ming environment, together with the PCB design package and EAGLE schematic to enable readers to create their own designs. 192 pages* ISBN 978-0-905705-73-6 £23.00 • US $46.00 PIC Mi tro controllers Silent alarm, poetry box, night buzzer and more PIC Microcontrollers This hands-on book covers a series of exciting and fun projects with PIC micro- controllers. You can built more than 50 projects for your own use. The clear expla- nations, schematics, and pictures of each project on a breadboard make this a fun activity. The technical background infor- mation in each project explains why the project is set up the way it is, including the use of datasheets. Even after you've built all the projects it will still be a valuable reference guide to keep next to your PC. 446 pages • ISBN 978-0-905705-70-5 £27.95 • US $55.90 Design yumr awn EMBEDDED LINUX CONTROL CENTRE A DIY system made from recycled components Design your own Embedded Linux control centre on a PC This book covers a do-it-your-self system made from recycled components. The main system described in this book re- uses an old PC, a wireless mains outlet with three switches and one controller, and a USB webcam. All this is linked to- gether by Linux. This book will serve up the basics of setting up a Linux environ- ment - including a software develop- ment environment - so it can be used as a control centre. The book will also guide you through the necessary setup and configuration of a Webserver, which will be the interface to your very own home control centre. All software needed will be available for downloading from the Elektor website. 234 pages • ISBN 978-0-905705-72-9 £24.00 • US $48.00 More information on the Elektor Website: www.elektor.com Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 Email: sales@elektor.com Computer Vision Principles and Practice Computer Vision Computer vision is probably the most ex- citing branch of image processing, and the number of applications in robotics, au- tomation technology and quality control is constantly increasing. Unfortunately enter- ing this research area is, as yet, not sim- ple. Those who are interested must first go through a lot of books, publications and software libraries. With this book, howev- er, the first step is easy. The theoretically founded content is understandable and is supplemented by many examples. 320pages • ISBN 978-0-905705-71-2 £32.00 • US $64.00 n .-T- lor Electronics Engincerlm; nr plications 5.0, 6.0, VBA, .NET, 2005 Visual Basic for Electronics Engineering Applications This book is targeted towards those people that want to control existing or self-built hardware from their com- puter. After familiarizing yourself with Visual Basic, its development environment and the toolset it offers are discussed in detail. Each topic is accompanied by clear, ready to run code, and where nec- essary, schematics are provided that will get your projects up to speed in no time. 476 pages • ISBN 978-0-905705-68-2 £29.95 • US $59.90 01/2009 - elektor 81 PRODUCT SHORTLIST, BESTSELLERS LED Top with Special Effects (December 2008) If you fit a line of LEDs on a circular PCB and power them on continuously, they generate rings of light when the board is spun. If you add a microcontroller, you can use the same set of LEDs to obtain a more interesting effect by generating a 'virtual' text display. The article also de- scribes a simple technique for using the Earth's magnetic field to generate a syn- chronisation pulse. The potential appli- cations extend from rotation counters to an electronic compass. Kit of ports incl. SMD-stuffed PCB and programmed controller Art-Nr. 080678-71 • £39.00 • US $59.00 Remote control by Mobile Phone (November 2008) Remote control using mobile phones and SMS (Text Messaging) is in great demand but many systems on sale suffer from im- perfections. This ingenious new design combines powerful capabilities with low technical overheads. It has programma- ble AC mains switching outlets plus status reports by text message and alarm-acti- vated delivery of GPS data. Remote con- trol by mobile was never easier, cheaper or more reliable! Kit of parts, incl. PCB , programmed controller and all parts Art. # 080324-71 • £54.00 • US $99.00 y Prices and item descriptions subject to change. E. & O.E Elektor SMT Reflow Oven (October 2008) DCC Command Station (September 2008) The Elektor SMT reflow oven will faithfully handle most if not all your soldering of projects using surface mount devices (SMDs). The oven is particularly suited for use not just in Colleges, workshops, clubs and R&D laboratories, but also by the ad- vanced electronics enthusiast. This pre- cious workbench tool is at home where SMD boards have to be produced to a variety of requirements on size, compo- nents and soldering materials. Size:4 1 8x372x250 mm (16.5 x 14.6x 10 inch) Electronics is making more and more in- roads into the domain of model trains. Trains are now controlled with digital codes, and in many cases the entire sys- tem can be operated from a computer. Elektor presents a design for the device that forms the heart of a digitally control- led model railway: the DCC Command Station. The computing power in this de- sign is provided by a highperformance ARM7 processor. Kit of parts incl. programmed ARM module Art. # 080663-91 • £882.00 (Excl. VAT) US $1525.00 (Excl. VAT) Communicating with CAN (October 2008) Art. # 070989-71 • £88.50 • US$177.00 DigiButler (May & April 2008) The CAN (Controller Area Network) proto- col was originally developed for use in the automotive sector. It is now over 20 years old, but is still frequently used these days. It was specially designed for use in envi- ronments where you have a lot of elec- tromagnetic interference. Despite the fact that the CAN protocol is a serial protocol, it can't just be connected to (the serial port of) a computer. The all-round USB-CAN adapter described in last month's Elektor is a compact and simple solution. With the help of the accompanying software you can follow all data communications taking place and carry out operations such as fil- tering and storage at the flick of a (mouse) switch. PCB, partly populated Art. #071 120-71 • £54.90 • US$109.80 A low-cost home automation server based on a Freescale Coldfire 32-bit mi- crocontroller. The project has been de- signed with open source in mind and doubles as a powerful Coldfire develop- ment system using free CodeWarrior soft- ware from Freescale. DigiButler activates electrical appliances in and around the home, accepting on/off commands from a WAP phone, through an Ethernet net- work or via a webpage at an allocated IP address and with full access security. Kit of parts including SMD-stuffed PCB, programmed microcontroller, all leaded parts and CD-ROM containing both Elektor articles, TBLCF documentation , datasheets, application notes and source code files. Art. #071102-71 • £29.00 • US $58.00 82 elektor - 01/2009 Kits & Modules ■\ January 2009 (No. 385) Radio for Microcontrollers 071125-71 ....868 MHz module ATM18on the Air 071125-71 ....868 MHz module Meeting Cost Tinier 080396-41 ....ATmegal68, programmed Capacitive Sensing and the Water Cooler 080875-91 ....Touch Sensing Buttons Evaluation kit 080875-92 ....Touch Sensing Slider Evaluation kit Three-Dimensional Light Source 080355-1 Printed circuit board Moving up to 32 Bit 080632-91 ....ECRM40 module December 2008 (No. 384) PLDM 071 1 29-1 Printed circuit board Hi-fi Wireless Headset 080647-1 Printed circuit board: Transmitter 080647-2 Printed circuit board: Receiver LED Top with Special Effects 080678-71 .... Kit of parts incl. SMD-stuffed PCB and programmed controller November 2008 (No. 383) Motorised Volume Pot 071135-41 ....Programmed controller ATMEGA8-16PU Speed Camera Warning Device 080615-1 Printed circuit board 080615-41 ....Programmed controller PIC16F876A-I/SO.... Remote Control by Mobile Phone 080324-1 Printed circuit board 080324-41 ....Programmed controller ATMEGA8-16PU 080324-71 ....Kit of parts Tracking Hot Spots 080358-1 Printed circuit board AT meg a meets Vinculum 071152-91 .... VDIP1 module October 2008 (No. 382) Communicating with CAN 071 1 20-71 .... PCB, partly populated Elektor SMT Precision Reflow Oven 080663-91 .... Ready to use oven (230VAC only) Multi-purpose GPS Receiver 070309-41 .... Programmed controller PIC1 8F2520 ATM18 Relay Board and Port Expander 071 035-72 .... Relay PCB with all components and relays 071 035-95 .... Port Extension PCB, populated with SMD RF Sweep Frequency Generator / Spectrum Analyser 040360-41 ....Programmed controller ATmega8535 September 2008 (No. 381) DCC Command Station 070989-71 .... Kit of parts incl. programmed ARM module... £ US$ ...7.20 9.95 ..7.20 9.95 ..8.50 12.50 27.50 39.95 27.50 39.95 24.90 39.90 32.00 46.50 5.80 9.50 7.90 15.80 ,7.90 15.80 39.00 59.00 ..5.90 11.80 15.50 31.00 11.80 23.60 17.80 35.60 ..5.90 11.80 54.00 99.00 ..9.10 18.20 22.50 45.00 ..54.90 109.80 882.00.... 1525.00 ..11.60 23.20 ..36.90 73.80 ..13.40 26.80 ..21.80 43.60 88.50 177.00 Bestsellers O od 1 2 3 5 Universal Display Book ISBN 978-0-905705-73-6 £23.00. US $46.00 Embedded Linux Control Centre ISBN 978-0-905705-72-9 E24.00.....US $48.00 PIC Microcontrollers ISBN 978-0-905705-70-5 E27.95.....US $55.90 Computer Vision ISBN 978-0-905705-71-2 E32.00.....US $64.00 Visual Basic for Electronics Engineering Applications ISBN 978-0-905705-68-2 £29.90. US $59.90 3 Course ISBN 978-90-5381-225-9 £14.50. US $29.00 2 £17.50. US$35.00 4 m 1 2 3 4 5 ECD 4 ISBN 978-90-5381-159-7 Elektor 2007 ISBN 978-90-5381-218-1 £17.50. US $35.00 Ethernet Toolbox ISBN 978-90-5381-214-3 £19.50. US $39.00 USB Toolbox ISBN 978-90-5381-212-9 £19.90. US $39.80 LED Top with Special Effects Art. # 080678-71 £39.00.... US $59.00 Elektor SMT-oven Art. # 080663-91 £882.00 US $1525.00 Remote control by Mobile Phone Art. # 080324-71 £54.00.... US $99.00 DigiButler Art. # 071 1 02-71 E29.00.....US $58.00 Communicating with CAN Art. # 071120-71 E54.90...US $109.80 Order quickly and safe through www.elektor.com/shop July/August 2008 (No. 379/380) Solar-powered Automatic Lighting 080228-41 .... Programmed controller PIC1 2C671 9.00.... ....18.00 Battery Discharge Meter 070821 -41 .... Programmed controller PIC1 6F676-20I/P 5.90.... ....11.80 070821 -42 .... Programmed controller PIC1 6F628-20/P 9.00.... ....18.00 Operating Hour Counter 070349-41 ....Programmed controller PIC12F683 5.90.... ....11.80 Energy-efficient Backlight 080250-41 ....Programmed controller ATmega32 22.50.... ....45.00 Deluxe '1 23' Game 080132-41 ....Programmed controller ATmega8-PU 9.00.... ....18.00 v : : y or use the Order Form near the end of the magazine! Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH * United Kingdom Tel. +44 20 8261 4509 Fax +44 20 8261 4447 Email: sales@elektor.com 01/2009 - elektor 83 INFO & MARKET SNEAK PREVIEW Transistor Curve Tracer This project is sure to arouse interest from all of you frequently working with discrete transistors. The circuit allows different transfer characteristics measured on FETs and bipolar transistors to be shown on the PC display. It is linked to the PC via a USB cable and has an R8C/13 microcontroller for its 'brains'. The transistor types that can be measured include npn/pnp bipolars, n-channel and p-channel MOSFETs as well as n- and p-channel junction FETs. The instrument is suitable for 'matching' transistors. Measured values can be exported to an Excel spreadsheet for further processing. Model Coach Lighting Decoder One area that many model train enthusiasts have never been totally happy with is the lighting of coaches. Until now. The lighting controller described in this article is a combination of an SMD LED strip and a PIC12F683 for com- patibility with the Mdrklin system. The LEDs allow easy adaptation to different colours while three different lengths of the board enable the project to fit all common coach types. The controller can be assigned an address 'live' i.e., without removing it from the coach. Hardware designing with C Is the C programming language the hardware description language of the future? Very likely so, so long as better alternatives do not come in sight. Apart from being the de facto language for embedded systems, C is and remains a fine tool to describe integrated circuit hardware, and perfectly able to take on any challenge in the development of innovative products. Next month we show how a C based FPGA project may be realised using Altium's Innovation Station. Article titles and magazine contents subject to change, please check 'Magazine' on www.elektor.com The February 2009 issue comes on sale on Thursday 22 January 2009 (UK distribution only). UK mainland subscribers will receive the issue between 1 7 and 20 January 2009. w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektorj Elektor 33 the web All magazine articles back to volume 2000 are available online in pdf format. The article summary and parts list (if applicable) can be instantly viewed to help you positively identify an article. Article related items are also shown, including software downloads, circuit boards, programmed ICs and corrections and updates if applicable. Complete magazine issues may also be downloaded. In the Elektor Shop you'll find all other products sold by the publishers, like CD-ROMs, kits and books. A powerful search function allows you to search for items and references across the entire website. lektor kmtirov. Your Circuit DM190 Productivity electronics worldwide 7 RATIONAL •CTHUMWn Mtwi M«9 **hx> -- Cnoot* «n opusn * «. I'lfDonatitt artOtf Also on the Elektor website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Surveys and polls • FAQ, Author Guidelines and Contact »rm COe«er Svt i'k e*e» W t*»t week MtW SPIT Oven tar reflow during Study trip OS Workmop. PXnt tnt*- your «rrau g *ugu"« gdftl «• fMkter Credits gtMcrEMri [^paper Ofi MuMltlMl rtve« Ou* fAQ MCW Kloktorfobo Anc*M ldontiftcotion • PCB Design k Layout Elektor CftfflpkU your 10* circuits oertoe now! L«Ktro*(X Limited period otter tor MBS UnhrerMl Onp4y Book for PIC Microcontroller* TM DOOA to LlOt At m# reoflo* p'^r#w< through tf* BOM E oocr »~C WDOroseti PIC 84 elektor - 1/2009 I Description Price each Qty. Total Order Code DVD Elektor 1990 through 1999 frfS’TJl | £69.00 Universal Display Book for PIC Microcontrollers [ £23.00 LED Top with Special Effects (080678-71) [ £39.00 Starter Kit Professional for ARM £162.00 Design your own Embedded Linux Control Centre on a PC £24.oo PIC Microcontrollers £27.95 Free Elektor Catalogue 2009 Prices and item descriptions subject to change. The publishers reserve the right to change prices without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Sub-total P&P Total paid Name Address + Post code Tel. Email Date - - Signature EL01 Yes, I am taking out an annual subscription to Elektor and receive a free 2GB MP3 player*. I would like: I I Standard Subscription (11 issues) Subscription-Plus (11 issues plus the Elektor Volume 2008 CD-ROM) * Offer available to Subscribers who have not held a subscription to Elektor during the last 12 months. Offer subject to availability. See reverse for rates and conditions. Name Address + Post code Tel. Email Date - - Signature EL01 METHOD OF PAYMENT (see reverse before ticking as appropriate) □ □ □ □ Bank transfer Cheque (UK-resident customers ONLY) Giro transfer Expiry date: Verification code: Please send this order form to* (see reverse for conditions) Elektor Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com sales@elektor.com *USA and Canada residents should use $ prices, and send the order form to: Elektor US PO Box 876 Peterborough NH 03458-0876 Phone: 603-924-9464 Fax: 603-924-9467 E-mail: custservus@elektor.com METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer | Cheque (UK-resident customers ONLY) □ Giro transfer Expiry date: Verification code: Please send this order form to Elektor Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com subscriptions@elektor.com ORDERING INSTRUCTIONS, P&P CHARGES All orders, except for subscriptions (for which see below), must be sent BY POST or FAX to our Brentford address using the Order Form overleaf. Online ordering; www.elektor.com/shop Readers in the USA and Canada should send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Elektor US for applicable P&P charges. Please allow 4-6 weeks for delivery. Orders placed on our Brentford office must include P&P charges (Priority or Standard) as follows: Europe: £6.00 (Standard) or £7.00 (Priority) Outside Europe: £9.00 (Standard) or £11.00 (Priority) HOWTO PAY All orders must be accompanied by the full payment, including postage and packing charges as stated above or advised by Customer Services staff. Bank transfer into account no. 40209520 held by Elektor Electronics with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20. BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Giro transfer into account no. 34-152-3801, held by Elektor Electronics. Please do not send giro transfer/deposit forms directly to us, but instead use the National Giro postage paid envelope and send it to your National Giro Centre. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in this magazine. If difficulties in the supply of components are envisaged, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not guarantee this time scale for all orders. Returns Faulty goods or goods sent in error may be returned for replacement or refund, but not before obtaining our consent. All goods returned should be packed securely in a padded bag or box, enclosing a covering letter stating the dispatch note number. If the goods are returned because of a mistake on our part, we will refund the return postage. Damaged goods Claims for damaged goods must be received at our Brentford office within 10-days (UK); 14-days (Europe) or 21 -days (all other countries). Cancelled orders All cancelled orders will be subject to a 10% handling charge with a minimum charge of £5.00. Patents Patent protection may exist in respect of circuits, devices, components, and so on, described in our books and magazines. Elektor does not accept responsibility or liability for failing to identify such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, diskettes and software carriers published in our books and magazines (other than in third-party advertisements) are copyright and may not be reproduced or transmitted in any form or by any means, including photocopying and recording, in whole or in part, without the prior permission of Elektor in writing. Such written permission must also be obtained before any part of these publications is stored in a retrieval system of any nature. Notwithstanding the above, printed-circuit boards may be produced for private and personal use without prior permission. Limitation of liability Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in connexion with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser any money paid in respect of the goods. Law Any question relating to the supply of goods and services by Elektor shall be determined in all respects by the laws of England. January 2009 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION Standard Plus United Kingdom £44.00 £53.00 Surface Mail Rest of the World £58.00 £67.00 Airmail Rest of the World £74.00 £83.00 USA £59.95 See www.elektor.com/usa Canada £70.95 for special offers HOWTO PAY Bank transfer into account no. 40209520 held by Elektor Electronics, with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20. BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Giro transfer into account no. 34-152-3801, held by Elektor Electronics Please do not send giro transfer/deposit forms directly to us, but instead use the National Giro postage paid envelope and send it to your National Giro Centre. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL- protected for your security. SUBSCRIPTION CONDITIONS The standard subscription order period is twelve months. If a permanent change of address during the subscription period means that copies have to be despatched by a more expensive service, no extra charge will be made. Conversely, no refund will be made, nor expiry date extended, if a change of address allows the use of a cheaper service. Student applications, which qualify for a 20% (twenty per cent) reduction in current rates, must be supported by evidence of stu- dentship signed by the head of the college, school or university faculty. A standard Student Subscription costs £35.00, a Student Subscription-Plus costs £44.20 (UK only). Please note that new subscriptions take about four weeks from receipt of order to become effective. Cancelled subscriptions will be subject to a charge of 25% (twenty-five per cent) of the full subscription price or £7.50, whichever is the higher, plus the cost of any issues already dispatched. Subsciptions cannot be cancelled after they have run for six months or more. January 2009 r Elektor SMT Oven Multi-purpose and indispensable to professional and enthusiast • Selected, tested & certified by Elektor • Including Elektor-produced user manual • Fully menu controlled • Ideal for R&D laboratories, schools, small companies and. electronics enthusiasts • Product support from Elektor Customer Services r-]lektor LZ3shop Art. # 080663-91 • Price: £882 • € 1095 • US$ 1525 (Exd.VAT) Main technical specifications Line voltage: 230 V AC / 1 650 W Line frequency: 50-60 Hz Size: 418x372x250 mm (16. 5 x 14. 6 x 10 inch) Weight: 1 6.7 kg (net) Effective PCB area: 280 x 280 mm (11 x 1 1 inch) Further information and ordering at www.elektor.com/smtoven Index of Advertisers Antex Electronics Ltd www.antex.co.uk 27 Audio Amateur www.mothgroup.com 39 Avit Research, Showcase www.avitresearch.co.uk 78 Beijing Draco www.ezpcb.com 27 Beta Layout, Showcase www.pcb-pool.com 51, 78 Bitscope Designs www.bitscope.com 2 ByVac, Showcase www.byvac.com 78 C S Technology Ltd, Showcase www.cstech.co.uk 78 Decibit Co. Ltd, Showcase www.decibit.com 78 Designer Systems, Showcase www.designersystems.co.uk 78 EasyDAQ, Showcase www.easydag.biz 78 Easysync, Showcase www.easysync.co.uk. 78 Elnec, Showcase www.elnec.com 78 EMCelettronica Sri, Showcase www.emcelettronica.com 78 Euro circuits www.eurocircuits.com 69 First Technology Transfer Ltd, Showcase . . www.ftt.co.uk 78 FlexiPanel Ltd, Showcase www.flexipanel.com 78 Future Technology Devices, Showcase. . . . www.ftdichip.com 78 General Circuits www.pcbcart.com. 39 Labcenter www.labcenter.com. 88 Lcdmod Kit, Showcase www.lcdmodkit.com 78 London Electronics College, Showcase . . . www.lec.org.uk 78 MikroElektronika MQP Electronics, Showcase. . Newbury Electronics Nurve Networks Parallax Peak Electronic Design Pico Pro pox Sp Quasar Electronics Radiometrix, Showcase Robot Electronics, Showcase. Robotiq, Showcase RS Components ScanTool, Showcase Showcase USB Instruments, Showcase . Virtins Technology, Showcase www.mikroe.com 3, 11 www.mgp.com 79 www. newburyelectronics. co.uk 75 www.xgamestation.com 75 www.parallax.com 25 www.peakelec.co.uk 51 www.picotech.com 13 www.propox.com 51 www.guasarelectronics.com 17 www.radiometrix.com 79 www. robot-electronics, co.uk 79 www.robotig.co.uk 79 i/i/i/i/n/. rs i/i/i/i/i/i/. c o/?7/e c/p 51 www.obd2cables.com, www.scantool.net . ... 79 78, 79 www.usb-instruments.com 79 www.virtins.com 79 Advertising space for the issue of 19 February 2009 may be reserved not later than 20 January 2009 with Huson International Media - Cambridge Flouse - Gogmore Lane - Chertsey, Surrey KT 1 6 9AP - England - Telephone 01 932 564 999 - Fax 01932 564998 - e-mail: p.brady@husonmedia.com to whom all correspondence, copy instructions and artwork should be addressed. 1/2009 - elektor 87 than All levels of the Proteus Design Suite now include a world class fully integrated shape based autorouter at no additional cost. The Proteus Design Suite also incorporates ■ Professional schematic capture ■ Highly confi ■ Publication quality schematics ■ Interactive c ■ Fully configurable bill of materials ■ Polygonal a ■ Large component libraries for both ■ RS274X, E) simulation and PCB layout database e> Mixed mode SPICE circuit simulation 3D Viewer v ■ Co-simulation of PIC, AVR, 8051 and an d DXF ex ARM7 microcontroller firmware ■ Automatic component placement and gateswap optimization Prices start from just £1 50 - visit our website for full details or to download a free demo. Electronics Labcenter Electronics Ltd. 53-55 Main Street, Grassington, North Yorks. BD23 5AA. Registered in England 4692454 Tel: +44 (0)1756 753440, Email: info@labcenter.com exc. VAT & delivery