SUPER COMPUTERS ... FM STEREO DECODER ... C DISPLAY ... LED DRIVERS SPICED ... AVR MACROS www.elektor.com April 2009 AUS$ 12.90 - NZ$15.50 - SAR 88.70 £ 4.10 090146-91 9 770268 45114 2 USB in the Future Technology Devices International Ltd. (FTDI) www.ftdichip.com FT2232H / FT4232H High Speed USB Interface ICs FEATURES FT2232H (Dual High Speed USB to Multipurpose UART/ FIFO 1C) has 4k bytes Tx and Rx data buffers per interface. FT4232H (Quad High Speed USB to Multipurpose UART/MPSSE 1C) has 2k bytes Tx and Rx buffers. Multi-Protocol Synchronous Serial Engines (MPSSE), capable of speeds up to 30Mbits/s, provide flexible interface configurations. Entire USB protocol on a chip with integrated LDO regulator and PLL. Extended temperature range (-40°C to +85°C). FTDI Chip » s Other uw illnu: u|.i(‘ , j ill Ehi r . price -r.n l£e you cornprcmiw on orw oJEhe key specilScaticm^: iilipfrlg rjfte, lirwnxjfy LlLr;:'h cy Li'n icth'iT'iJTh r?M7 Pic^opr- SQQQ KfiH i* 4 ng cctfnpnonn.-se PC ok£||(mcqim- at a pnce &t£ty ^n^-neer - can afTord. IG5 * sampling rate ISOMHi bandwidth l^iM sample 1 buffer 4Tiernbr|r 1 15 MS £ II bit AWG built irt PlcaScope 5203 32M buffer £H95 w ww , p i cote ch . com/ scope 504 01480 39639 S PltoScope 5204 TOM buffer *1795 Kryp&d u w ft Quick Pi^otfflS * T- wr FF www.EzPGB.com Email: sales@ezpcb.com We add value to PCBs when others just sell it. Djii yjyj* r/M £ldf uiudtfi Ciu jjj^EJwsrjji j rrsu? *j LU r/ Design Prdlatype Production ■ ■* Designing Service W Enclosure fcesdgnmg Virtual AsMiT^ly p^Peslgii CnmpcncnE e-China If you want to understand electron- ics, you read Elektor, and if you want to understand the electronics market, you have to visit China. Over the New Year, I was in Shen- zhen for the testing of the new batch of Elektor SMD ovens. If you really want to know how the electronics market is developing, not only in China but also in the rest of the world, there's no substitute for being there, looking around, and talking to the people. Everything that the world has to offer in the way of way of electronics is available in Shenzhen, as well as everything that China supplies to the rest of the world. In our March issue, our lab manager Antoine Authier described his impressions during a visit to this hotbed of electron- ics, such as thousands of people working and (literally) living amidst boxes, stacks, and whole floors full of electronic components and other hardware. You can see the same picture in the electronics high street of Shanghai. However, the electronics market is more than just hardware and components. To make a deal work, especially in China, you need a good knowledge of the culture, banking matters, transportation, and logistics. Doing business in China takes a completely different approach. It works well if you know how to do it right, but otherwise you shouldn't try. The people who have joined us on the China tours organised by Elektor in the past years can say a thing or two about this. In order to form a realistic picture of the possibili- ties, you have to see the factories from the inside, shake hands with the people there, and discover that they share your fascination with the electronics market. Things can go so fast there that some of our tour par- ticipants managed to put together specific business deals during their visit. Elektor's next 'get acquainted' tour to China is scheduled for the 3rd to the 1 1th of April. For more informa- tion, surf to www.elektor.com/china Wisse Hettinga International Editor lekto r electronics worldwide Come see us at Embedded Systems Conference Silicon Valley, San Jose USA, March 30 — April 3, 2009. Th is universal microcontroller board was designed, in the first instance, for use by students studying automotive technologies, but it can also be used for other applications, of course. The heart of this board is an Atmel AT90CAN32 with a fast RISC core. CONTENTS Volume 35 April 2009 388 unning-in Bench 24 While an electric motor can be used at full power immediately it is brought into service, an internal combustion engine needs a period of running in before it is capable of delivering its maximum power. The idea of the project described here is to automate this important operation. Maybe soon, owning a supercomputer at home will no longer be just a dream. Indeed, inventive solutions enabling a wider public to have access to enormous computing powers do already exist... A Supercomputer on your Desk These pages will familiarise you with the tools required for programming and debugging the R32/C1 1 1 micro. Those of you already familiar with the R8C/1 3 from Renesas will recognise plenty of similarity in the way all this is handled. projects 24 Automatic Running-in Bench 34 Automotive CANtroller 46 The 32-bit Machine C Display FM Stereo Decoder 58 Get a Grip on LED Drivers 62 Scoping with the ATM1 8 68 Rocket Engine Test Rig 72 Design Tips: Macros for AVR programming Protection for voltage regulators technology 20 Fully Automated 4C A Supercomputer on your Desk info & market 6 Colophon 8 Mailbox News & New Products 18 okisec: multiplayer online robohockey See your project in print New Annual DVD 2008 80 ElektorSHOP 8^; Coming Attractions infotainment 74 Hexadoku 76 Retronics: An old radio brought back to life TOR 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. glekior -- C.-L -'ll Volume 35, Number 388, April 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, Eduardo Corral, 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 Subscriptions: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 Internet: www.elektor.com/subs 6 elektor - 4/2009 Visit China with E ektor y combine electronics and culture Elektor's third Study Trip to China is planned for 3-1 1 April 2009. And you can join us! Check your diary today and visit the Elektor website for more detailed information. During this 9-day trip we will visit the China Electronics Fair in Shenzhen, a professional industrial electronics fair with an area of no less than 60,000 m 2 . We will also pay at least one visit to the well-known 'electronics high street' in Shanghai. As the name suggests, this street is entirely dedicated to electronics shops, each vying to be the largest. In addition, a variety of interesting company visits are on the itinerary (with a tour of the production department). We are also organising a business conference where you can obtain a wealth of infor- mation about doing business (and how not to do business) in China. Naturally, there's also time for culture. We will visit the Bund, French Confession and the Shanghai TV tower. There's also a Shanghai sightseeing tour planned. 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 4/2009 - elektor 7 INFO & MARKET MAILBOX A boxful of Dekatrons and the hunt for ‘Trochotron’ In response to the publication of our article The Dekatron decimal counter valve" in Elektor March 2008, Mr Roger Ellis of London, UK, kindly offered to send some of these rare counter tubes to the author of the article , Mr Jean Herman in Belgium. The shipment was arranged to go by way of Elektor and your Editor took the liberty of photographing the contents of the box for all readers to admire. Thanks are due to both correspondents for allowing us to publish about these rare components dating back to the dawn of digital electronics. Apart from ZM1020 tubes and a dozen unused sockets (originally intended for the Belgian national railway Authority SNCB), the box also contained an interesting leaflet from a French compo- nent distributor. It lists Decatron types Z303C, Z502S, the E1T (also covered in Retronics) and a device called Tro- chotron ET51 which immediately aroused our curiosity. Can anyone help with further information , aiming of course, at a short article for the Retronics section in Elektor? Does anyone have real life specimens of Trochotrons lurking in a drawer or a lab cabinet? Replacement type for BB112 500-pF varicap diode Dear Editor — an alternative to the BB1 1 2, which is no longer readily available, is the 1SV149, which is compatible and has similar specifications. The BB1 1 2 has a capacity range of 20 to 500 pF and is mainly used in tuned circuits for the low and medium short-wave bands, such as the automatically tuned preselector for the DRM receiver described in the November 2004 issue of Elektor Electronics. The 1SV149 is available from www.ak-modul-bus.de. The direct link is: www.ak-modul- bus.de/ stat/kapazitaetsdi- ode_l svl 49.html. Burkhard Kainka (Germany) Games Computer in Retronics Dear Jan — I would like to comment on the Retronics instalment on the Games Computer in the October 2008 issue of the magazine. I found it especially interest- ing because it was one of my main jobs during the period when I worked as a designer and member of the editorial staff of Elektor (April 1 976 to July 1979). To the best of my knowledge, the picture of the little train at the top of page 76 is one of my creations. It was a nice design - ahead of its time actually - but I think it was a bit on the expensive side for the hobbyists of that time, especially the younger ones. I maintained many contacts with the technical specialists at Philips at that time, and there may be someone on your editorial team who can still remember this. During those days I attended a course on the 2650 microprocessor at Philips, along with one of my co-workers, Karel Walraven. We used a 2650 development kit in the course, the 'Instructor 50'. I still have the marketing brochure for this kit, which has a picture of a class with sev- eral students including Karel and myself. However, the Games Com- puter was not the first article involving microprocessors to appear in Elektor. It was pre- ceded by a series of articles on the SC/MP computer - 30 years ago now - to which I also made a major contribu- tion. I don't know whether you have already mentioned it under this topic, since I don't see every issue of Elektor. If not, I hope it will appear sometime. I still have a pristine example of the SC/MP, the first Elektor computer, which is available for taking photos if desired. I also have one of the blue 'gramophone records' for the SC/MP. It wasn't especially reliable, but it did work! Andre Pauptit (France) It's nice to hear from a former colleague , and it's especially rewarding to be able to publish this in our Mailbox. As regards the SC/MP, I already described it Retronics, April 2005; other- wise I would be pleased to accept your offer. US clock speaks German Dear Editor — lama new subscriber to Elektor USA and I would like to find someone to help with a project. I was particularity interested in the articles on the Tri-state Time and the Model Railway Car Lighting Decoder in the 2/2009 issue of Elektor. Back in the early 80s I worked for Diehl Research Center in Stamford. I am now a retired electronic engineer. This com- pany was part of Diehl GmbH based in Nurnberg, Germany. The director and I went to the German Language School in Westport to learn German. 8 elektor - 4/2009 I can understand more than speaking as my parents were German. We used a book called Deut- sch 2000 and on page 1 56 they have "Die Uhrzeit" (the Time of Day). At the time I was working for a clock company and said why not put this into digital format. I did make a prototype which is still working to this day. This prototype is a done the old fashioned way by wiring the hardware counters, CD4029s since they can count up and down. I would to make a new version using a microprocessor and perhaps a VF display. I would like to find someone who would like to do a program and help make this a joint project for Elektor. I could give hardware support and the other person could write the write a program and together we could build a sample. My prototype has two digits for the minute, two digits for the hours and four indicators lights for the words "nach, vor, viertel, and halb", but this new version could be a 16-digit VF display. There could be a lot of poten- tial for this. As a learning tool we could combine it with an analog clock so the Viertel vor', Viertel nach', Vor halb', and 'nach halb' fit in. I have mine next to an analog clock. Perhaps in a German class it would be useful. I have my prototype with LED digits and HP light bars for the words. A 1 6-digit vacuum fluorescent display might be nice, as the digits and words are all in line. I hope you can put me in touch with a programmer who would like this project. Maybe we can get a company to produce it. George Fischer (USA) A cordial welcome to the Elektor experience , George and hope you continue to enjoy Elektor's new USA edition. Anyone willing and able to help George , please contact the Editor. When SMD was young Dear Editor — I have been an enthusiastic reader of Elektor for about 30 years and I eagerly await the new edition every month. I have built a fair number of your projects. I par- ticularly like the mix of unortho- dox ways to tackle problems, circuit development and the odd page of nostalgia. Prompted by your articles on the SMD Oven in the October 2008 issue I'd like to add a little something to the above theme: a photo- copy of an article from Siemens Component Information , edition 1 968, and an origi- nal SMD integrated circuit from the early 1970s. I wish your team every success. Fritz Lackner (Germany) 2003 by Dr. Gyora Benedek, Avi Olti, Shai Seger and Robert Fuhrer. (US Pat. no. 70371 69). Itop was and still is sold worldwide with a new model coming soon. The design presented in the article looks like a perfect copy of our product except for the double row of LEDs. Our group together and separately invented and devel- oped several hit games such as Lights Out (video game), Hidato (www.hidato.com), KenKen (www.kenken.com). I hope you will find a way to correctly attribute this toy and mention us in your next issue. Dr Gyora Benedek (Israel) www.doo-bee-toys.com proposal received. The author of the Spinning Top project was not aware of the inventor or his patent(s). The US patent mentioned by Dr Benedek was awarded in 2006 and has a very broad content. We were unable to find details of practical circuit implementati- ons or indeed control software , which , from our experience , is the crux of the development. The patent does however describe the operating principle of a spinning top with a rotating LED bar ; as well as synchronization by detection of a magnetic field (as an example , the earth's mag- netic field is mentioned) using "rotation data measuring means including an induction coil." 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. Many thanks for responding Fritz and for the rare example of an antediluvian SMD chip from Siemens. It proves that the con- cept of SMD is older than some readers complaining about the technology being used in DIY projects. LED Spinning Top Dear Editor — I was very pleased to see the 'Messaging spin Top' article in the 2008 December issue of Elektor (pp 16-21). However, when I read the arti- cle I was very disappointed to find out that the original inven- tors of this 'striking gadget' were not mentioned. Please note that iTop was invented and patented in Dr. Benedek's email was copied to the Ger- man author and editors respon- sible for the 'Messaging Spin Top' project. In reply ; they would certainly have mentioned Dr. Gyora Benedek , Avi Olti , Shai Seger ; Robert Fuhrer and the relevant patent(s) if such information had been available to them. When publishing contributions about developments in electronics , a trade journal like Elektor has no legal obligation to identify patent(s) or other protection describing similar approaches (see also the Copyright Notice on page 7). In practice , it is impossible for the Elektor team to do extensive patent research work for every circuit or article 4/2009 - elektor 9 Peak: more distributors Peak Electronic Design have recently expanded their sales net- work with the appointment of five new distribution partners. Now the famous Peak Atlas range of automatic component identifi- cation and measurement tools are easier to get hold of in Australia, Holland, Germany, USA and the UK. This is in addition to a world- wide network of established dis- tributors, so buying Peak products is even faster and easier. To assist with the UK hobbyist mar- ket, a new UK distribution partner has also come on board with Peak. JPR Electronics Ltd in Dunstable offer the full range of Peak prod- ucts as well as many other prod- ucts aimed at hobbyists, education and industry. To find your nearest distributor in the UK or overseas, simply visit the website below and click on the dis- tributors tab. If you can't find a dis- tributor near you then you can of course order from Peak directly. www.peakelec.co.uk (081108-IX) Montavista: Google Android support MontaVista® Software, Inc. recently announced that it will support developers running MontaVista Linux for use with the Google Android platform. The company demonstrated the Android mobile platform running on a Tl OMAP3 processor, one of the processors supported by MontaVista Linux at Embedded Technology 2008 in Yokohama, Japan. MontaVista's advanced power management, fast startup, and advanced connectivity provide the features mobile device manufac- tures require. In addition to pow- ering a majority of today's Linux handsets, MontaVista Linux: • is the only Linux to demonstrate support of and integration with all major Linux mobile software stacks • is the only mobile Linux certified as being ready for IPv6 • provides support for new mobile device processors from Freescale Semiconductor, Intel, Texas Instru- ments and others • was awarded 'Best Software Innovation of the Year" for 2007 by EDN. www.mvista.com (081108-X) 16-bit micro draws 400 nano-amps Maxim Integrated Products intro- duces the MAXQ2010, a 16- bit mixed-signal microcontrol- ler with a unique power-saving stop mode. Stop mode reduces power consumption to 370 nA typical and 6.5 pA maximum at +85°C, thus extending the life of battery-powered devices. Designed on a RISC architecture, the MAXQ2010 balances high- speed execution (up to 10 MIPS at 10 MHz) and data sampling (up to 3 1 2 ksps ADC conver- sion at 12 bits) with a low-power active-mode current (3.1 mA, typ- ical, at 10 MHz). An integrated regulator allows direct operation from a single lithium coin cell at 2.7 V to 3.6 V. With its many integrated analogue and digital capabilities and its multiple power-saving modes, the MAXQ2010 is an optimised sin- gle-chip solution for battery-pow- ered data acquisition applications. The device's low-power stop mode makes it especially valuable in equipment that spends the major- ity of its life inactive, only waking up once every few minutes to take measurements. Typical examples include many types of sensors, data acquisition systems, or envi- ronmental data-loggers. The MAXQ2010 offers multiple power-saving operating modes. A key feature of the device is its industry-leading stop mode, which allows the microcontroller to reduce power consumption to less than 400 nA (typ.) by halting code execution. Depending on the needs of the application, the inte- grated LCD controller and real time clock (RTC) can optionally remain active during stop mode. For additional power savings, the MAXQ2010 consumes only 3 . 1 mA (typical) at 1 0 MHz oper- ation in active mode. The MAXQ2010 provides addi- tional features critical for portable, battery-powered applications. For a user interface, an integrated LCD controller can drive up to 1 60 seg- ments directly in a ] A-muxed con- figuration. A supply-voltage moni- tor measures the power supply against a programmable threshold from 2.7 V to 3.5 V in 0. 1 V incre- ments, enabling an application to detect low power and notify the user to replace the battery. For rapid application development, a MAXQ2010 evaluation (EV) kit is available. www.maxim-ic.com (081028-VI) 10 elektor - 4/2009 World's smallest, high capacity, rechargeable thin battery r PowerPlane MX™ Lithium-ion Rechargeable that require compact geom- etry, mAh capacities and longer term duty cycles. The battery, when integrated with Planar's RF wireless charging module Planar Energy Devices announced their PowerPlane™ MX lithium ion battery. The bat- tery, available in a demo kit which includes an on-board wireless RF harvesting/charg- ing system, delivers the ultimate solution for applications that require self-sufficient milli-amp- hour (mAh) energy storage. Planar combines advanced bat- tery technology with integrated RF wireless charging technol- ogy. The combined battery and wireless charging system, called the PowerPlane™ MXE, features charge circuitry that requires a footprint only slightly larger than that of the battery, making the entire power source extremely compact. The PowerPlane™ MX battery is the first rechargeable battery of its kind to host a high capac- ity within its thin form factor. With a capacity of 10 mAh in a 29x25x0.5 mm package, it is ideal for many applications seeking both power from a small form factor and long cycle life from its rechargeable nature. The battery has an operating volt- age range of 3 to 4.2 V. Users of the PowerPlane™ MX can expect over 500 full cycles. In a pulsed scenario, thousands of cycles can be expected with negligible deg- radation in the capacity. The Pow- erPlane™ MX has a proven 1 sec- ond pulse capability of up to 50 mA. The only power solutions in a thin, similar geometry and capac- ity available in the market today are primary cells. The PowerPlane™ MX battery is ideal for many applications (PowerPlane™ MXE), is an ideal solution for wireless sensor sup- pliers seeking power sources for systems or networks where con- stant maintenance is undesired. Similarly, active RFID tag suppliers find these attributes appealing for applications in medicine, wander prevention, remote toll payment or security that have service lifetimes of over 1 year. Depending on the current-time schemes of the appli- cations, the PowerPlane™ MX can provide a solution that lasts over 30 months in operation. The PowerPlane™ MXE demo kit will include a charge sta- tion pad and one PowerPlane™ MX mounted on a charging cir- cuit board combining a planar antenna coil and charge/dis- charge control circuitry. The sys- tem's control circuitry provides under/over voltage protection, charge control, and a charge indicator light. The charge station pad can accommodate more than five battery boards simultaneously. The battery can be trickled charged continuously or entirely charged in under 3 hours. The PowerPlane™ MXE can be directly connected into the required applications. The accompanying battery is protected in a laminated pack- aging, adding further to the rug- ged nature of the system. The demo kit can be purchased for $350 from Planar's website. www.planarenergy.com. (091069-11) RoboThespian: lifelike movement from Festo Engineered Arts Ltd, a UK-based company which specialises in hi- tech multi-media, has created an interactive robot named RoboThes- pian capable of lifelike movement using Festo fluidic muscles. Initially developed to provide entertaining theatrical performances, the life- sized robot's capabilities have recently been expanded to enable higher levels of audience interac- tion. The robot's siblings are now much in demand at science and technology centres as animated public orators, tireless front-of- house presenters, and generally all-round benevolent funsters. The first generation of RoboThes- pian robots was developed in Jan- uary 2005, and the first interactive RoboThespian was exhibited in Los Angeles in November 2007. The robot's repertoire included a series of song and dance rou- tines, and for the first time, it could respond to its audience vocally and by reactive physical move- ment. This wowed the audience - but of course, after a while peo- ple wanted even more, such as shaking hands with RoboThespian or having the robot perform their own routines. The robot has now been upgraded to include articulated hands, an -fluid muscles additional axis in each arm, and feedback sensors on all movement axes, with a total of 31 powered axes, each featuring full propor- tional control. The robot contains six dc motors, but all its major movements are controlled by Festo DMSP fluidic muscles. These pneu- matic actuators boast a very high power-to-weight ratio and essen- tially consist of a flexible tube with a mesh of reinforcing fibres. They contract when they filled with com- pressed air and elongate when the air is removed. www.robothespian.com (091069-III) 4/2009 - elektor 11 INFO & MARKET NEWS & NEW PRODUCTS New Parallax sensor - infrared thermometer Module (10° FOV) defaults 1 0° Field Of View The new Parallax MLX90614 Infrared Thermometer Module (10° FOV) is an intelligent non- contact temperature sensor with a 10 degrees field of view and a serial interface for easy connec- tion to host microcontrollers. The MLX90614 sensor is designed for non-contact temperature measure- ments of objects placed within the sensor's cone of detection. The sen- sor is comprised of an integrated ASIC and infrared sensitive ther- mopile detector. The sensor com- municates with an SX20AC/SS-G coprocessor over a digital SMBus, which Parallax has programmed to simplify an otherwise fairly com- plex communication protocol. Features: • Outputs continuous data flow with an active alarm running in background • 16-bit digital temperature out- put data, ranging from -70°C to 380°C • Auto-baud detection (2400, 4800, 9600, 19. 2K, 38. 4K) for microcontroller-to-MLX9061 4 communications • SIP module for- mat fits easily in breadboards or through-hold proto- type areas • Multiple modules can be connected from a sin- gle I/O processor pin for serial data flow • Module can act as a stand alone sensor for alarm control • Sleep setting for low power consumption • Starts up active without pre-pro- gramming using preset writeable Parallax also carries the MLX90614 Infrared Thermometer Module with 90° FOV. www.parallax.com (search: 28042, 28040) (091069-1) HF SPECTRAN revision V4 claims -170 dBm world record Aaronia's SPECTRAN® 'V4' RF spectrum analyser is by no means a revised Rev.3 SPEC- TRAN, but a fully redeveloped instrument which utilises the full potential of Aaronia's patented spectrum analysis algorithm. The V4 is claimed to surpass even the most modern and most expensive 'handheld' analyzers in terms of sensitivity — not just by a few dB, but by leaps and bounds (up to 20 dB). Compared to the Spectran HF- 6060 Rev.3, the new HF-6060 V4, HF-6080 V4 and HF-60100 V4 instruments deliver many improvements and new features, depending on model: frequency range extended by 3.4 GHz, up to 9.4 GHz sensitivity increased by up to 80 dB, down to -170dBm (1 Hz) vastly improved sample time, up to 1 OOx faster, down to 1 ms (new, super-fast PLL) super low-noise 15 dB pream- plifier, switchable via a TRUE RF switch (Option 020) vastly improved dynamic range thanks to a 14-bit Dual ADC significantly improved phase noise (jitter) thanks to a new 0.5 ppm TXCO time base developed specifically for SPECTRAN® (Option 002) razor-sharp DDC hardware filter, as used on the LF models much faster DSP (150 MIPS) with significantly enhanced mem- ory (128 K) improved IF filters significantly increased demod- ulator bandwidth, listening to broadcast stations is no problem anymore... true switched attenuator with improved IP3 (switchable in 0.5 dB steps) improved LCD display with more room for markers among other improvements faster battery charger Further new features include: PEAK/RMS detector, audio sniffer for detecting bugs / wire taps, EMC filter (9 kHz, 120 kHz etc.), enhanced limits display, new logger options, improved and enhanced demod- ulation modes and more. Pricing starts at £ 999.95 for the HF-6060 V4 (10 MHz - 6 GHz, -150 dBm(l Hz), min. RBW=10 kHz) inch HyperLOG 7060. Options & accessories include a 0.5 ppm TCXO time base, an internal ultra-low noise 15 dB pre amplifier, 1 MB memory expansion, 1 0 GHz peak power meter (3 versions). Further acces- sories are under development. The new SPECTRAN® V4 range comes with a 1 0 year warranty and the right to return the instru- ment for up to 30 days after purchase. www.spectran.com (090169-IV A New 'Intelligent' 2.4 GHz Transceiver The new low-cost 2.4 GHz trans- ceiver type CYRF7936 from Cypress Semiconductor Corp. is specially designed for home auto- mation, health- care applica- tions, remote con- trols and wireless sensor networks. With its volt- age range from 1.8 V to 3.6 V the device is ide- ally suited for battery powered sys- tems. A special feature protocol was developed based on the PSoC® microcontroller. It has a memory requirement of only 5 kBytes for a node and 8 kBytes for a hub. The highly effective CYFi Star Network Protocol recognizes the optimal data transfer rate and output power. In case of interruptions, it switches automatically from the highest data transfer rate of 1 Mbps in Gaussian Frequency Shift Keying to the safe Direct Spread Spectrum transmis- sion method at 250 kbps. Output performance is increased to the maximum +4 dBm as soon as the connection is interrupted. When operating with two AA bat- tery cells, the typical lifetime is 4 years due to the power saving pro- tocol and technical parameters of the transceiver. The associated demo kit no. CY3271 is from available from Cypress online or authorised distributors. www.cypress.com (091069-V) 12 elektor - 4/2009 A fresh approach to edge lit acrylic signs Also, because the light Tape can Edge lit acrylic signs have tra- ditionally been illuminated with bulky fluorescent tubes which lim- ited their application and were expensive to run and maintain. Now with Light Tape you can pro- duce stunning edge lit acrylics and have the viewers asking "where is the light coming from?" Light Tape's flexibility and ultra thin profile mean it can be adhered to the edges of an acrylic sign allow- ing the Light Tape to flood the acrylic sheet with light, any text, logo or shape engraved into the surface of the acrylic is instantly illuminated producing a stunning effect. be fixed to all sides of the acrylic the light is contained within the sheet concentrating the effect and not spilling out on the bottom and sides like the traditional methods of illumination. Light Tape is available in a wide range of colours and widths go to. The products is not limited to square or oblong panels ether, it can light circles, ovals and com- plex shapes just as easily. Light Tape is also becoming popular as a source to edge light acrylic shelves in retail stores. Light Tape is made up of metal rib- bon coated in Sylvania phosphor and encapsu- lated in a Hon- eywell laminate. The products has no glass, no gas, and no mer- cury/heavy met- als and so is user and environment friendly, pro- viding 85-90% energy saving against other light sources such as Neon and Cold Cathode. Light Tape uses 1 watt per meter at 25 mm (1 ") wide, a 1 00 m length of 25 mm wide Light Tape only uses the same power as a 1 OOw light bulb. Development kits for Light Tape enabling systems to be easily developed, tried and tested are now available. www.lighttape.co.uk (091069-VI) mikroPascal PRO for AVR® 2008 mikroElektronika have recently launched a new PASCAL compiler for AVR® microcontrollers: mikroPas- cal PRO for AVR® 2008. The IDE features project- based design and supports an impressive range of AVR® microcontrollers. mikroPascal PRO for AVR® 2008 offers a set of librar- ies which simplify the ini- tialisation and use of AVR® MCU and its modules. The libraries comprise ADC, CANSPI, Compact Flash, EEP- ROM Library, Flash Memory, LCD, Manchester Code, Multi Media Card, OneWire, Port Expander, PS/2, PWM, PWM 16 bit, RS-485, soft-l2C, soft-SPI, soft-UART, sound, SPI, SPI Ether- net, TWI, UART, Button, Conver- sions, String, and more. MikroPascal PRO for AVR® comes with plenty of prac- tical examples and a com- prehensive documentation which allows a quick start in programming AVR. AVR hardware development tools, that completely sup- ports the mikroPascal PRO for AVR® 2008, are also available. A fully functional demonstration version (hex output limited to 2k of pro- gram words) is available on the mikroElektronika web site. www.mikroe.com (091069-VII) LED lighting for largest commercial lighting market Cree, Inc. announces the volume avail- ability of the LR24, a 24-inch square, recessed LED lumi- naire. The LR24 delivers high-qual- ity, energy-efficient light for suspended- ceiling applica- tions traditionally addressed by linear fluorescents, also known as lay-ins or troffers. The LR24 is the newest addition to the Cree family of recessed LED fixtures and delivers the uni- form, high light levels required for offices, schools, hospitals and retail environments while consum- ing less electricity than most linear fluorescents. The LR24 features superior colour rendering, with a colour-rendering index (CRI) of 92 — compared to a CRI of 70 to 80 for fluorescents. It is also dimmable to 5 percent with standard protocols — provid- ing additional design flexibility and further energy-saving potential. The LR24 delivers high light lev- els at only 0.5 to 0.75 watts per square foot. With an elegant 24-inch square form, the LR24 offers architects and designers a modern lighting aesthetic, freeing them from the design constraints of linear-fluores- cent technology. he innovative lens is recessed above the ceiling — reducing glare and creating an attractive and comfortable environment. www.CreeLighting.com. (091069-IX) 4/2009 - elektor 13 INFO & MARKET NEWS & NEW PRODUCTS conga-ARkit, a reference platform for automation port. This makes the well-priced interfaces through standard con- conga-QA the ideal platform for nectors. Manufacturer-specific 1/ the majority of control and visuali- O components can then be flex- congatec AG presents the conga- ARkit, a complete solution pack- age for the implementation of PLC functions. This comprehensive package was developed in conjunction with 35- Smart Software Solutions GmbH, Real-Time Systems GmbH and OSCAT ('Open Source Commu- nity for Automation Technology'). It addresses PLC manufacturers and companies that intend to inte- grate PLC functionality in their applications. The conga-QA, a Qseven Com- puter-On-Module with the Intel® Atom™ Processor Z530, was cho- sen as the hardware basis. Due to its compact dimensions of just 7x7cm 2 , this module can be easily integrated via top-hat rail housing. Additionally, it provides capable, future-oriented interfaces and can simultaneously run two separate operating systems thanks to hyper- threading and virtualization sup- zation tasks. The kit includes a suitable evalu- ation carrier board to facilitate the use of the Qseven module. This provides access to all Qseven ibly configured and controlled via Ethernet/Ethercat or another suit- able field bus. The software package, which has been compiled on an entirely application-oriented basis, comes pre-installed on a bootable USB stick. This device uses hypervi- sor software to boot a Microsoft Windows XP operating system and a real-time capable OSADL Linux. The system resources of the Qseven module are assigned exclusively to each of the operat- ing systems. These two subsystems communicate with each other via a virtual Ethernet port. On the real-time side of things (the OSADL Linux system), a CoDeSys SP is operated as the PLC runtime system. The complete and real-time capable virtualization means that the PLC handler is entirely inde- pendent of the Windows system. Even a Windows 'Blue Screen of Death' or a fatal application error cannot affect the reliability of the control. www.congatec.com (091069-X) MIAC industrial control operate off 1 2 V or 24 V. It has 8 analogue or digital inputs, 4 high current relay outputs and 4 motor outputs. The MIAC is housed in an attrac- The Matrix Industrial Automotive Controller (MIAC) is an industrial grade control unit which can be used to control a wide range of different electronic systems. It has a number of applications in indus- try and learning. MIAC is flexible and expandable, easy to pro- gram with flowcharts, C or Assembly code, and physically and electrically rugged. MIAC's main features include: • Programmable from USB • Shipped with a free copy of Flowcode • Compatible with third party C compilers • 8 digital or analogue inputs • 4 relay outputs, 4 motor outputs with speed control • 4 line LCD display and control keys tive, rugged, • Lab View and Visual Basic anthra- cite grey plastic mould- compatible ing. It has two physical mounting options: it can be mounted onto MIAC is a fully specified industrial a 30mm 'top hat' DIN rail, or it electronic controller designed to can be mounted directly onto any surface using the 4 screw holes provided. screw terminal connec- tor inputs across the top and bot- tom of the unit, has several input buttons for user control, and also has a 4 line by 16 character alphanumeric display on the top of the unit to display system status and assist users. MIAC is a fully specified industrial controller suitable for a wide vari- ety of system control applications in automation, manufacturing, test, and control. The physical characteris- tics allow for mounting on industry standard DIN 'top hat' rails or the device can be mounted directly onto any surface. The input output circuitry has been developed with industrial control in mind, taking into account the noisy electrical environments and the rugged physical and electrical require- ments of the shop floor. The flex- ibility of the unit make it a useful addition to the industrial engineer's standard toolbox kit. MIAC is certified to DVE063 1 and EN501 78/EN60068. www.matrixmultimedia.com (09 1 069-VIII) 14 elektor - 4/2009 Quasar Electronics Limited PO Box 6935, Bishops Stortford CM23 4WP, United Kingdom Tel: 08717 1^7168 Fax: 07092 203496 E-mail: sales@quasarelectronics.coi Web: www.quasarelectronics.com Postage! & Packing Options (Up to 0.5Kg gross weight): UK Standard i i 3-7 Day Delivery - £3.95; UK Mainland Next Day Delivery - £8.95; Europe (EU) - £6.95; Rest of World - £9.95 (up to 0.5Kg) SOrder online for reduced price UK Postage! ELBOCABD We accept all major credit/debit cards. Make cheques/PO’s payable MasterCard to Quasar Electronics. Prices include 15.0% VAT. Please visit our online shop now for details of over 500 kits, V!SA projects;, modules and publications. Discounts for bulk quantities ■ | Electron | QUASAR elect ronics The Electronic Kit Specialists Since 1993 8717 Credit Card otor Drivers/Controllers I Controllers & Loggers Here are just a few of our controller and Iriver modules for AC, DC, Unipolar/Bipolar stepper motors and servo motors. See Lebsite for full range and details. Computer Controlled / Standalone Unipo- lar Stepper Motor Driver Drives any 5-35Vdc 5, 6 or 8-lead unipolar stepper motor rated up to 6 Amps. Provides speed and direc- tion control. Operates in stand-alone or PC- controlled mode for CNC use. Connect up to six 3179 driver boards to a single parallel port. Board supply: 9Vdc. PCB: 80x50mm. Kit Order Code: 3179KT - £15.95 Assembled Order Code: AS3179 - £22.95 Computer Controlled Bi-Polar Stepper Motor Driver Drive any 5-50Vdc, 5 Amp bi-polar stepper motor us- ing externally supplied 5V levels for STEP and DI- RECTION control. Opto- isolated inputs make it ideal for CNC applica- tions using a PC running suitable software. Board supply: 8-30Vdc. PCB: 75x85mm. Kit Order Code: 3158KT - £23.95 Assembled Order Code: AS3158 - £33.95 Bi-Directional DC Motor Controller (v2) Controls the speed of most common DC motors (rated up to 32Vdc, 10A) in both the forward and re- verse direction. The range of control is from fully OFF to fully ON in both directions. The direction and speed are controlled using a single potentiometer. Screw terminal block for connections. Kit Order Code: 3166v2KT - £22.95 Assembled Order Code: AS3166v2 - £32.95 DC Motor Speed Controller (100V/7.5A) Control the speed of almost any common DC motor rated up to 100V/7.5A. Pulse width modulation output for maximum motor torque at all speeds. Supply: 5-15Vdc. Box supplied. Dimensions (mm): 60Wx100Lx60H. Kit Order Code: 3067KT - £17.95 Assembled Order Code: AS3067 - £24.95 I lost items are available in kit form (KT suffix) r assembled and ready for use (AS prefix). Here are just a few of the controller and data acquisition and control units we have. See website for full details. Suitable PSU for all units: Order Code PSU445 £7.95 8-Ch Serial Isolated I/O Relay Module Computer controlled 8- channel relay board. 5A mains rated relay outputs. 4 isolated digital inputs. Useful in a variety of control and ^sensing applications. Con- trolled via serial port for programming (using our new Windows interface, terminal emula- tor or batch files). Includes plastic case 130x100x30mm. Power Supply: 12Vdc/500mA. Kit Order Code: 3108KT - £64.95 Assembled Order Code: AS3108 - £79.95 Computer Temperature Data Logger 4-channel temperature log- ger for serial port. °C or °F. Continuously logs up to 4 separate sensors located 200m+ from board. Wide range or Tree software applications for stor- ing/using data. PCB just 45x45mm. Powered by PC. Includes one DS1820 sensor. Kit Order Code: 3145KT - £19.95 Assembled Order Code: AS3145 - £26.95 Additional DS1820 Sensors - £3.95 each Rolling Code 4-Channel UHF Remote State-of-the-Art. High security. 4 channels. Momentary or latching relay output. Range up to 40m. Up to 15 Tx’s can be learnt by one Rx (kit in- cludes one Tx but more avail- able separately). 4 indicator LED ’s. Rx: PCB 77x85mm, 12Vdc/6mA (standby). Two and Ten channel versions also available. Kit Order Code: 3180KT - £49.95 Assembled Order Code: AS3180 - £59.95 DTMF Telephone Relay Switcher Call your phone num- ber using a DTMF phone from anywhere in the world and re- motely turn on/off any of the 4 relays as de- sired. User settable Security Password, Anti- Tamper, Rings to Answer, Auto Hang-up and Lockout. Includes plastic case. Not BT ap- proved. 130x110x30mm. Power: 12Vdc. Kit Order Code: 3140KT - £74.95 Assembled Order Code: AS3140 - £89.95 177 1 68 Infrared RC Relay Board Individually control 12 on- board relays with included infrared remote control unit. Toggle or momentary. 15m+ range. 112x122mm. Supply: 12Vdc/0.5A Kit Order Code: 3142KT - £59.95 Assembled Order Code: AS3142 - £69.95 PIC & ATM EL Programmers We lave a wide range of low cost PIC and ATMEL Programmers. Complete range anc documentation available from our web site. Programmer Accessories: 40-pin Wide ZIF socket (ZIF40W) £14.95 18Vdc Power supply (PSU010) £18.95 Leajls: Parallel (LDC136) £3.95 / Serial (LDC441) £3.95 I USB (LDC644) £2.95 NEW! USB & Serial Port PIC Programmer USB/Serial connection. Header cable for ICSP. Free Windows XP software. Wide range of ;upported PICs - see website for -fl- _ complete listing. ZIF Socket/USB lead' hot included. Supply: 16-18Vdc. Kit Order Code: 3149EKT - £49.95 Assembled Order Code: AS3149E - £59.95 NEW! USB 'All-Flash' PIC Programme^ USB PIC programmer for all ‘Flash’ devices. No external power supply making it truly portable. Supplied with box and Windows Software. ZIF Socket and USB lead not included. Assembled Order Code: AS3128 - £49.95 “PICALL” PIC Programmer " “PICALL” will program virtu- ally all 8 to 40 pin serial- , mode AND parallel-mode j (PIC16C5x family) pro- ' grammed PIC micro control- lers. Free fully functional software. Blank chip auto detect for super fast bulk programming. Parallel port connection. Supply: 16-18Vdc. Assembled Order Code: AS31 17 - £29.95 ATMEL 89xxxx Programmer Uses serial port and any standard terminal comms program. Program/ Read/ Verify Code Data, Write Fuse/Lock Bits, Erase and Blank Check. 4 LED’s display the status. ZIF sockets not included. Supply: 16-18Vdc. Kit Order Code: 3123KT - £27.95 Assembled Order Code: AS3123 - £37.95 ji i — No.1 S KITS www. quasare/ectronics. com Secure Online Ordering Facilities • Full Product Listing, Descriptions & Photos • Kit Documentation & Software Downloads ADVERTISEMENT El MikroElektronika DEVELOPMENT TOOLS I COMPILERS I BOOKS By Milan Rajic MikroElektronika - Software Department SmartMP3 module connected to EasyPIC5 Development System Now you need an ... The adoption of the MP3 format caused a revolution in digital sound compression technology by enabling audio files to become much smaller. If you want audio messages or music to be part of your project then you can easily make it happen. You just need any standard MMC or SD memory card, a few chips and a little time... Before we start, it is necessary to format the MMC card and save the soundl. mp3 file on it (the card should be for- matted in FAT16, i.e. FAT format). The quality of sound coded in MP3 format depends on sampling rate and bitrate. Similar to an audio CD, most MP3 files are sampled 44.1 kHz. The MP3 file's bitrate indicates the quality of the compressed audio compared to the original uncompressed one, i.e. its fidelity. A bitrate of 64 kbit/s is suffi- cient for speech reproduction, while it has to be 128 kbit/s or more for music reproduction. In this example a music file with a bitrate of 1 28 kbit/s is used. Hardware The sound contained in this file is coded in the MP3 format so that an MP3 decod- er is needed for its decoding. In our ex- ample, the VS1 01 1 E chip is used for this purpose. This chip decodes MP3 records and performs digital-to-analog conver- sion of the signal in order to produce a signal that can be fed to audio speakers over a small audio amplifier. Considering that MMC/SD cards use sections of 512 bytes in size, a micro- controller with 512 byte RAM or more is needed for the purpose of control- ling MP3 decoding process. We have chosen the PIC1 8F4520 with 1 536 byte RAM. Software The program controlling the operation of this device consists of five steps: Step 1 : Initialization of the SPI module of the microcontroller. Step 2: Initialization of the compiler's Mmc_FAT1 6 library, which enables MP3 files to be read from MMC or SD cards. Step 3: Reading a part of the file. Step 4: Sending data to the MP3 decod- er buffer. Step 5: If the end of the file is not reached, jump to step 3. Testing PIC18F4520 Figure 1 . Block diagram of Smart MP3 module connected to a PIC 18F4520 It is recommended to start testing the device operation with low bitrate and increase it gradually. The MP3 decod- er buffer has a size of 2048 bytes. If the buffer is loaded with a part of MP3 file with 128 kbit/s bitrate, it will contain twice the number of sound samples than when it is loaded with a part of file with 256 kbit/s bitrate. According- ly, if the bitrate of the file is lower it will take twice as long to encode the buf- fer content. If we overdo the bitrate of the file it may happen that buffer con- Advertising article by MikroElektronika www.mikroe.com mikroC® and mikroC PRO® are registered trademarks of MikroElektronika. All rights reserved. ... WbjJU SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD WWW.mikroe.COm VCC IK O— □- lOOnF VCC O — 22pF 8MHz 22pF MMC CARD VCC-3.3 O CS Din GND —| +3.3V SCK GND Dout PIC18F4520 VCC-3.3 MMC-CS#-3.3 MOSI-3.3 SCK-3.3 \ DREQ-3.3 MMC-CS# MP3-CS# / MP3-RST# | SCK DREQ BSYNC MCLR/RE3 □ RAO [ RA1 [ RA2 [ RA3 [ RA4 [ RA5 [ REO [ RE1 Q RE2 VCC GND OSC1/RA7 Q OSC2/RA6 C RCO C RC1 Q RC2 RC3 RDO RD1 PGD/RB7 PGC/RB6 PGM/RB5 RB4 RB3 RB2 RBI RBO VCC GND RD7 RD6 RD5 RD4 RC7 RC6 RC5 RC4 RD3 RD2 : : : : : =! VCC 1 ] ] ] ] ] ] > T > 22pF 1M 25 MHz 22pF DREQ-3.3/ VCC-3.3 Q 74LVCC3245 lli H DIR [ AO £ A1 MISO-3.3 MOST MISO SDATA DCLK HI VCCA VCCB NC OE BO B1 B2 B3 B4 B5 B6 B7 GND [ A2 £ A3 £ A4 £ A5 £ A6 £ A7 i— £ GND H GND VCC ] ] > ] > ] ] ] ] >4 DREQ MISO MP3-RST#-3.3 DCLK-3.3 SDATA-3.3 BSYNC-3.3 MP3-CS#-3.3 SCK-3.3 MOSI-3.3 MISO-3.3 1 FERRITE BEAD 220uF VS1011E H £ 4 £ DREQ DCLK SDATA BSYNC DVDD DGND XTALO XTALI DVDD DGND XCS SCLK SI SO DVDD DGND XRESET AGND LEFT AVDD RCAP AGND RIGHT AVDD AGND TEST2 TEST1 TESTO ]-l } } D4 } P-T Q 10K lOuF lOOnF LEFT 2xl00K RIGHT lOuF VCC LM386 220uF 220nF 2 - r \ 56nF | li 100nF J_°0nF PI 10 . T T 74LVCC3245 VCC O VCC-3.3 O £ VCCA VCCB r£ DIR NC D -Q AO OE h \MMC-CS#-3.3 \MP3-CS#-3.3 \MP3-RST#-3.3 \ SCK-3.3 \ MOSI-3.3 \BSYNC-3.3 \DCLK-3.3 \SDATA-3.3 Z £ A1 £ A2 £ A3 £ A4 □ A5 £ A6 £ A7 H GND "-£ GND BO B1 B2 B3 B4 B5 B6 B7 GNDp-" +5V O O VCC MMC-CS# MP3-CS# 3xlK MP3-RST# SCK OVO- MOSI BSYNC DCLK SDATA POWER VCC \\ i Id 3 J N 1 L= 470uF y — i 100nF MC33269DT-3.3 £ Vin £ GND Vout ± -OVCC3.3 lOuF Schematic 1. Connecting the Smart MP3 module to a PIC18F4520 tent is encoded before the microcontroller can manage to read the next part of the file from the card and write it in the buffer, which will cause the sound to be discontinuous. If this happens, we can reduce the MP3 file's bitrate or use a quartz-crystal 8MHz or more. Refer to Schematic 1 . Anyway, you don't have to worry about this as our program has been tested on several microcontroller families with different crystal values and it is capable of decoding MP3 files of average and high quality. On the other hand, a low bitrate means that buffer decoder is filled with sound of longer duration. It may happen that the decoder doesn't de- code the buffer content before we try to reload it. In order to avoid this, it is necessary to make sure that the decoder is ready to receive a new data before it has been sent. In other words, it is necessary to wait until decoder's data request signal (DREQ) is set to logic one (1 ). Enhancements This example may also be extended after being tested. The DREQ sig- nal can be periodically tested. A routine for volume control or built-in Bass/Treble enhancer control etc. may be incorporated in the program as well. The MMC library enables you to select a file with a different name. In this way it is possible to create a set of MP3 messages, sounds or songs to be used in other applications and send appropriate MP3 files to the decoder depending on the needs. Below is a list of ready to use functions contained in the Mmc_FAT16 Library. This library is integrated in mikroC PRO for PIC compiler. Library Menager ?□ vs* □ □ n i □ I2C + J Keypad4x4 Lcd_Constants i □ Led + Manchester - 0Mmc_FAT16 /s Mmc_Fat_Append Mmc Fat Assign Mmc_Fat_Delete Mmc_Fat_Get_File_Date Mmc_Fat_Get_File_Size M mc_Fat_Get_Swap_Fi le Mmc_Fat_lnit Mmc Fat QuickFormat Mmc_Fat_Read Mmc_Fat_Reset Mmc_Fat_Rewrite Mmc Fat Set File Date Mmc Fat Write + 0 Mmc + One_Wire + Ij Port_Expander ± □ PS2 ± □ PWM + RS485 V <1 ni> Mmc_Fat_Append() Write at the end of the file Mmc_Fat_Assign()* Assign file for FAT operations Mmc_Fat_Delete() Mmc_Fat_Get_File_Date() Mmc_Fat_Get_File_Size() Mmc_Fat_Get_Swap_File() Delete file Get file date and time Get file size Create a swap file Mmc Fat lnit()* Init card for FAT operations 1 Mmc_Fat_QuickFormat() Mmc_Fat_Read()* Read data from file | Mmc_Fat_Reset()* Open file for reading 3 Mmc_Fat_Rewrite() Mmc_Fat_Set_File_Date() Mmc_Fat_Write() Open file for writing Set file date and time Write data to file * Mmc_FAT16 functions used in program Other mikroC for PIC functions used in program: Spi_lnit_Advanced() Initialize microcontroller SPI module GOTO Code for this example written for PIC® microcontrollers in C, Basic and Pascal as well as the programs written for dsPIC® and AVR® microcontrollers can be found on our web site: www.mikroe.com/en/article/ Example 1 : ^Program to demonstrate oper ation o f Smart MP3 module 4 char filename[14] ="sound1.mp3"; unsigned long i, file_size; const BUFFER_SIZE = 512; char data_buffer_32[32], BufferLarge[BUFFER_SIZE]; sbit Mmc_Chip_Select a t RCO_bit; sbit Mmc_Chip_Select_Direction a t TRISCO_bit; //Writes one byte to MP3 SDI void SW_SPI_Write(unsigned dataj { RD1_bit- 1; RD2_bit = 0; RD3_bit = data_ RD2_bit = 0; RD3_bit = data_ RD1_bit = 0; RD2_bit - 0; RD3_bit = data_ RD2_bit = 0; RD3_bit = data_ RD2_bit = 0; RD3_bit = data_ RD2_bit = 0; RD3_bit = data_ RD2_bit - 0; RD3_bit = data_ RD2_bit = 0; RD3_bit = data RD2_bit - 0; } //Writes one word to MP3 SCI void MP3_SG_Write(char address, unsigned int datajn) { RC1_bit = 0; SPI1 _Write(0x02); //Set Filename //Set BSYNC before sending the first bit RD2 _bit= 1 data_ »= i; // Send data_ LSB, data . RD2! _bit= 1 data »= 1; // Send data .1 // Clear BSYNC after sending the second bit RD2 _bit- 1 data_ »= i; // Send data. .2 RD2 _bit= 1 data_ »=i; // Send data. .3 RD2 _bit= 1 data_ »= i; // Send data. .4 RD2 _bit- 1 data_ »= i; // Send data. .5 RD2 _bit= 1 data_ »= i; // Send data. .6 RD2 _bit= 1 data_ »=i; // Send data. .7 //select MP3 SCI // send WRITE command } SPI1_Write(address); SPI1_Write(data_in » 8); SPI1 _Write(data_in); RC1_bit= 1; Delay_us(5); //Send High byte //Send Low byte //deselect MP3 SCI // Required, see VS1 001 k datasheet chapter 5.4.1 // Reads words_count words from MP3 SCI void MP3_SCI_Read(char start_address, char words_count, unsigned int *data_biiffer) { unsigned inttemp; } RC1 Jait = 0; SPI1_Write(0x03); SP1 1 _Write(start_address); while (words_count--) { temp = SPI1_Read(0); temp «= 8; temp += SP1 1 _Read(0); *(data_buffer++) = temp; } RC1_bit= 1; Delay_us(5); // select MP3 SCI // send READ command // read words_count words byte per byte // deselect MP3 SCI // Required, see VS1 001 k datasheet chapter 5.4.1 //Write one byte to MP3 SDI void MP3_SDI_Write(char dataj { while (RD0_bit == 0) ; SW_SPI_Write(dataJ; } // Write 32 bytes to MP3 SDI void MP3_SDI_Write_32(char *data J { chari; while (RD0_bit == 0) ; for (i-0; i<32; i++) SW_SPI_Write(data_[i]); } //Set clock void Set_Clock(unsigned int clock_khz, char doubler) { // wait until DREQ becomes 1 // wait until DREQ becomes 1 clock_khz/= 2; if (doubler) dock_khz I- 0x8000; MP3_SCI_Write(0x03, clock_khz); //calculate value //Write value to CLOCKF register // set all AN pins to digital // Clear SW SPI SCK and SDO // Set SW SPI pin directions // Deselect MP3_CS // Configure MP3_CS as output // Set MP3_RST pin // Configure MP3_RST as output // Configure DREQ as input // Clear BSYNC // Configure BSYNC as output } void lnit() { ADCON1 1= OxOF; RD2_bit = 0; RD3_bit = 0; TRISD2_bit - 0;TRISD3_bit = 0; RC1_bit = 1; TRISC1 Jait - 0; RC2_bit=1; TRISC2_bit - 0; TRISDOJait = 1; RD1_bit = 0; TRISD1 _bit = 0; } //Software Reset void Soft_Reset() { MP3_SCI_Write(0x00, 0x0204); // Write to MODE register: set SM_RESET bit and SM_BITORD bit Delay_us(2); // Required, see VS1 001 k datasheet chapter 7.4 while (RDOJait == 0) ; // wait until DREQ becomes 1 for (i-0; i<2048; i++) MP3_SDI_Write(0); // feed 2048 zeros to the MP3 SDI bus: } voidmain(){ // main function lnit(); SPI1 Jnit_Advanced(MASTER_OSC_DIV64, DATA_SAMPLE_MIDDLE, CLKJDLE_LOW, LOW_2_HIGH); Spi_Rd_Ptr = SP1 1 _Read; ' // Set clock to 25MHz, do not use clock doubler // SW Reset Set_Clock(25000,0); Soft_Reset(); if (Mmc_FatJnit() == 0) { if (Mmc_Fat_Assign(&filename, 0) ) { Mmc_Fat_Reset(&file_size); while (file_size > BUFFER_SIZE) { for (i=0; i s :>■ W r . / pi. y&fn mm K -lOc .Jr P I Sr ■ ■ QUALITY PCB& SERVICE PROTOTYPE TO PRODUCTION instant online quote shopping cart ordering system China competitive prices free electrically test jif •••- V Fr* *3fr5ri-87&X7Q& AM Nq. 7$ GifCu j HdnSEEbOU, Chiiiff WWW.PCBCART.COM 4/2009 - elektor 19 TECHNOLOGY AUTOMATION Process control with PLCs R.A. Hulsebos (The Netherlands) Mass production is an important part of our modern society. Every production process involves actions that are repeated innumerable times, and these actions are often controlled by PLCs. What exactly are PLCs, and how are they used? Programmable logic controllers (PLCs) are the workhorses of industrial automation. Originally developed as software simulations of relay control circuits, PLCs have developed into a platform that forms the basis for control applica- tions generated using structured programming languages (IEC 61131), including high-speed motion, machine vision, networking, and integration with databases and logistics systems. From an electronics perspective, a PLC is simply a pro- cessor with memory, I/O channels (digital, analogue, and/ or serial), some counters and logic circuitry, and a network interface. What transforms this into a PLC is the PLC oper- ating system (OS). Using a programming package running on a PC, programmers generate PLC application software to control machines and production lines. The electronic configuration of a PLC varies from one sup- plier to the next. A wide variety of processor types can be used for the processing function, such as ARM, X86, NIOS, and so on. Although PLCs are industrial equipment instead of consumer products, there is considerable price pressure, so suppliers devote a lot of attention to cost-effi- cient development. Some suppliers take a different approach. They start with a PC, install a PLC OS, add some I/O, and the result is a PLC. This is called a 'software PLC'. The difference between this and a 'real' PLC is that it also has all the capabilities of a normal PC. However, from a hardware perspective a PC is not entirely the same as a 'real' PLC. Some of the specific features are discussed below. Fast up and running A PLC must operate all the time, 24/7. If a PLC fails, the result is usually dramatic: production grinds to a halt. In most companies, the maintenance department has only one priority when this happens: getting production up and run- ning again. If power cycling (off/on) doesn't help, the PLC is replaced by a spare unit. It must be possible to install and 20 elektor - 4/2009 connect this unit quickly. Software installation is often a tricky problem in this situ- ation. It is increasingly common practice for controllers to fetch their software from a central server. However, central servers are not always available, so some suppliers use memory sticks instead. Memory sticks resemble USB sticks, but they are different. An example of a memory stick is the C-Plug (Figure 1) for the Siemens S7 family of PLCs. A memory sticks holds all the required software and configura- tion data, and it can simply be unplugged from the old PLC and plugged into the new one. This technique is also being used more and more often with peripheral equipment. A problem with Ethernet is that the new controller has a new MAC address, since the Ethernet standard requires every device in the world to have a unique MAC address. This creates difficulties in an industrial environment, because the Ethernet network address depends on the MAC address. In a network environment, this means that the new controller is invisible until the other network devices have been con- figured to use the new MAC address. Naturally, this is very inconvenient in an industrial environment. For this reason, many suppliers allow customers to configure the controllers with their own MAC addresses. This increases flexibility, but it also creates responsibility: since every MAC address must remain unique worldwide, the old controller must never again be used with its original MAC address. No more battery backup PLCs rarely have hard-disk drives. In the first place, hard disk drives are far too expensive, and the vast majority of their storage capacity would remain unused. The moving parts of hard disk drives also make them too vulnerable, and they are very sensitive to hard shocks and strong vibra- tions. As a result of rapid technological evolution, hard disks are quickly replaced by newer models with even more capacity. Figure 1. A Siemens C-Plug with a capacity of 32 MB. Source: Siemens lems due to software errors. If a controller fails due to a bug in its application software, there's little point in switching to another one, since the other processor has the same soft- ware with the same bug. There is only one way to avoid this problem, which is to develop all software redundantly using teams that are not allowed to communicate with each other. The idea here is that the two versions of the software will have completely different designs, so it is unlikely that the same conceptual error, and thus the same bug in the same routine, will be present both versions. This approach is used in the control systems of Airbus aircraft, among other examples. Most PLCs need only a few megabytes of memory, and until a few years ago many of them used static RAM (SRAM) for this. However, static RAM requires a battery, and bat- teries have a limited operating life. The situation changed with the advent of flash memory, which is now more or less standard for program code storage. However, it is not always practical for data storage because it does not sup- port write transactions for individual bytes. Ferromagnetic RAM (FRAM) is much more suitable for this purpose. Watchdog It's always possible for an application program to hang or the underlying core routines to stop working. In order to prevent the entire system or machine from coming to a halt when this happens, a watchdog is always present. A watchdog is nothing more than a simple timer that resets the processor if it times out, which causes the controller to execute a restart. The watchdog is reset periodically by the application code or a core routine, so it never times out under normal conditions. Dual processors are used in applications where controller failure is intolerable. One of the processors is the active or 'hot' processor, while the other one is the standby pro- cessor. Both processors execute the same code and receive the same input data, but only the hot processor drives the outputs. If the hot processor fails, the standby processor can seamlessly take over control. Naturally, dual processors cannot eliminate the risk of prob- Windows The enormous popularity of Windows makes it a natural candidate for use as the internal operating system of con- trollers. This is entirely hidden from users because the PLC's control application completely conceals the OS. Microsoft provides two products for this purpose: Windows CE6 and Windows XP Embedded (XPe). Windows CE is primarily intended for embedded applications, such as small PLCs. It has a very low licence fee (a few pounds) and can run on all sorts of processors. XP Embedded is more suitable for rel- Figure 2. A DiskOnChip flash disk with wear levelling, which can be plugged directly into an IDE connector. Source: Coresolid Storage 4/2009 - elektor 21 TECHNOLOGY AUTOMATION Figure 3. A Siemens ERTEC 200 processor with a built-in ARM processor and two Ethernet interfaces. Source: Siemens atively large PLCs with networking capability, video, image processing and data handling capability, but it requires a more powerful processor (500 MHz minimum) and more memory (at least 256 MB of RAM), and it is much more expensive (around £100 / $145 per licence). On the other hand, with XPe you can do everything you can do with a normal PC, because XPe is essentially the same as XP Pro- fessional. The only difference is that you can choose which parts to leave out, which yields major savings in storage space: an XPe installation can fit into 100 MB. Up until a few years ago, this was ideal for working with flash disks, although their capacity has increased enormously in recent years to the point that a few megabytes more or less are no longer a major issue. However, flash memory suffers from the limitation of a finite number of write cycles per sector. For example, many flash chips can only be written 1 million times. This is too little for Windows XP, especially in areas of the file system that are written very often, such as folders and the Registry. The NTFS file system is also very active source of write transactions. For this reason, Microsoft has an option for XPe called 'Embedded Write Filter' (EWF), which stores disk transactions in RAM. The disk appears entirely normal to the application software, but all changes are lost when XPe restarts. For many applications, this does not pose a serious problem. In fact, it can be an advantage to always start with a clean slate. For applications where EWF is too restrictive, flash disks that spread write transactions over the entire disk must be used. This is called 'wear levelling', and it is available from a variety of suppliers. One example is DiskOnModule from Coresolid Storage, which can be fitted directly to an IDE connector (Figure 2). Even if an application constantly writes data to a disk of this sort, wear levelling provides an acceptable service life. Windows sees a DiskOnModule as a normal hard disk, and no special driver is necessary. If you wish, you can experiment with XP Embedded free of charge. All of the software can be downloaded from the Microsoft website, and applications will run for 90 days without a licence. Copy exactly Some industries demand 'copy exactly' from their suppliers. This means that a controller that they buy today must be exactly the same as one they bought several years ago. In this way, customers are not repeatedly confronted with new controllers that require the installation of different software or make it necessary to revise drawings, modify connect- ing cables, rewrite documentation, and so on. There are also companies that put together a production line in one country and then want to copy it in other countries, so that the same product can be made everywhere in the world in the same way. Naturally, 'copy exactly' places heavy demands on logis- tics chains. It prevents the use of components with short market lives, which is a frequent phenomenon in the PC world. Industrial PCs also suffer from this phenomenon. If you want to avoid it, you must explicitly look for a PC sup- plier that can guarantee long-term deliverability. As this is requested relatively often by industrial customers, there are Figure 4. Developer's kit for the Digi/ME controller. The controller is fitted in the middle of the PCB. Source: Digi 22 elektor - 4/2009 in fact suppliers (such as Advantech) that can do so. Intel can also provide long-term delivery guarantees for some processors, including Celeron. If you want long-term deliverability, you're looking in the wrong place if you constantly focus on the leading edge of industrial PCs. Instead, you should be thinking in terms of a 500-MHz Intel Celeron processor. Although this may sound rather archaic, it isn't. Many industrial applications do not require especially high processing power, and 500 MHz is already more than enough for such applications. Another helpful factor is that industrial IT programmers are often used to working with controllers that have limited resources. This is quite different from the situation in business IT, where nobody thinks twice about another gigahertz or an extra gigabyte. Networks A modern PLC is equipped with suitable interfaces, includ- ing network interfaces. This naturally includes Ethernet, which makes it very easy to use a PC to download program code and correct bugs in the software. Ethernet can also be used for quick, inexpensive linking to a supervisory control and data acquisition (SCADA) system. Operators can use a SCADA system to run the machine or system, check the cur- rent status, enter production orders, collect statistical data, and analyse error messages. Many PLCs also have an RS232 interface, although this interface is being used less and less often. RS422 and RS485 are also quite common because they can be used over much longer distances (up to 1 200 metres). In top-end units, these interfaces always have galvanic isolation with short-circuit protection. This is often missing in inexpensive controllers, or they may only be able to withstand a one- second short circuit. As it is very easy to cause a short cir- cuit, especially with 9-way D-Sub connectors, inexpensive controllers often turn out to be a costly choice. On top of this, you will be faced with a failed controller, and thus pos- sibly a production shutdown, if the short circuit causes the transceiver to fail. This requires special Ethernet interfaces. The idea here is to execute the entire Ethernet protocol in hardware so that it is very fast and real-time (deterministic). Siemens supplies an ARM-based ERTEC-400 controller (Fig- ure 3) for its ProfiNet protocol, and Beckhoff supplies spe- cial ASICs for its Ethernet protocol. This makes it possible to drive Ethernet I/O directly without processor involvement. The author managed to do this at a frequency of 30 kHz using a standard desktop PC. There is ongoing develop- ment activity in the Ethernet world, and gigabit industrial Ethernet is expected to be available fairly soon. USB Due to the popularity of USB on PCs, this interface is also being used more and more in industrial applications. Much longer distances than the usual 5 metres can be bridged by using USB extenders. This means that keyboards and mice can be located much further away than usual, which makes it considerably easier to install a PC (or an industrial PC) in a system. USB is hardly used for I/O. With its short cable Figure 5. A Lantronix XPort/AR controller, which is scarcely larger than an RJ45 plug. Source: Lantronix. In addition to the RSxxx interfaces, there are all sorts of fieldbus interfaces available. The fieldbus market is highly fragmented, with more than 500 different bus systems. A few of them are very well known, such as Profibus, CANbus and AS Interface, but there are also many systems with only a small market share. As each system has not only its own cabling and connectors but also its own range of products, including I/O modules, motor controllers, dampers, valves, serial interfaces, repeaters (amplifiers) and so on, the mar- ket can be regarded as highly fragmented. Consequently, before you buy a PLC you must carefully consider which fieldbus you want to use and whether all of the necessary functionality is actually available for it. Ethernet A trend toward using only Ethernet instead of the hundreds of different fieldbus systems has developed in recent years. As certain adjustments are made to make this interface suitable for control applications, it is also referred to as 'industrial Ethernet'. Two different philosophies can be seen here. Some com- panies use the TCP/IP protocol as much as possible with standard Ethernet, while other companies want to use Eth- ernet in high-speed motion control systems to drive as many motors (servos) as possible and run them as fast as possible. lengths and star topology, it is not a good fit with typical industrial applications. However, it is used in instrumenta- tion systems, such as with Matlab or Labview. No PLC Despite the popularity of PLCs, there are a fair number of automation specialists that prefer not to not use them. Lim- ited memory capacity, the low-level programming languages specified by IEC 61131 (which among other things do not support object-oriented programming), and strict encapsu- lation in typical application architectures make them unsuit- able for use as high-end machine controllers. Instead of PLCs, such applications employ several small embedded controllers linked to an industrial PC by a network. In this arrangement, the non-real-time portions of the application are executed on the PC. Two examples of small embedded controllers are the XPort from Lantronix and the Digi/ME from Digi (Figures 4 and 5). Actually, these devices are small only with respect to their dimensions (the size of an RJ45 connector) and their prices (a few dozen pounds); they both have a powerful processor, lots of memory, ample I/O, and networking capabilities. They also come with a (hard) real-time kernel. Program code can be downloaded via the Ethernet interface or the JTAG port. 4/2009 - elektor 23 MODELLING Automatic Running for internal combustion model engines Michel Kuenemann (France) Part 1: the hardware Even though brushless electric motors have largely replaced internal combustion engines in small- and medium-sized radio-controlled model aircraft, many model enthusiasts are still attached to internal combustion (i/c) engines. But while an electric motor can be used at full power immediately it is brought into service, an i/c engine needs a period of running in before it is capable of delivering its maximum power. The idea of the project described here is to automate this important operation. Technical specifications • 32-bit ARM7 processor running at 59 MHz, 128 kB flash memory and 64 kB RAM. • Throttle control by standard model servo. Configurable travel and direction of movement. • Microcontroller-driven glow plug heating. • Engine speed measurement from 0 to over 30,000 rpm. • Engine temperature measurement from 0-160 °C. • Ambient temperature measurement • Mixture adjustment managed by the on-board software. • Mobile pocket terminal with 4-line / 20 character alphanumeric LCD display, push buttons and encoder knob. • USB link • Direct Servo Control (DSC) interface • Emergency stop push button • Power supply: 7-1 5 Vdc. A miniature i/c engine can be run in either in the model it is destined for, or on a test bench dedicated to this purpose. Running-in consists of running the engine, loaded with a propeller of suit- able pitch and diameter, and putting it through controlled cycles of accelera- tion and deceleration. These alternat- ing high and low speeds cause con- trolled ‘wear’ (particularly of the pis- ton and cylinder wall) that enables an accurate fit to be achieved between these components. The way these cycles are achieved depends on the engine specifications, the manufactur- er’s recommendations, and individual habits. The key parameters to be man- aged are: • Engine speed • Engine temperature • Richness of the air/fuel mixture Traditionally, the speed is controlled by using the throttle, often operated by hand when running-in on a test bench. The engine speed is monitored using a hand-held rev counter, or just by ear. The engine temperature is often monitored by ‘feel’ and the richness of the mixture adjusted by hand. Under these conditions, the running-in opera- tion is performed 100% manually with little objective feedback about how the process is progressing. The idea of the board described here is to offer automation and repeatabil- ity in this phase, by managing the main parameters of the running-in Figure 1. Running-in bench block diagram. 24 elektor - 4/2009 automatically. The board also offers extended possibil- ities for testing and adjusting i/c engines (already run in) or electric motors for which we want to measure, estimate, or compare characteristics like static thrust, the power supplied, fuel curves, or torque and power curves. The board can also be helpful for adjusting the needle-valve level (acceleration). The software and the functions of this project will be described in detail in Part 2 of our article to be published next month. Block diagram The block diagram of the running-in bench is given in Figure 1 . At the heart of the system is a 32-bit microcontrol- ler board which manages the engine and gathers the ‘engine’ parameters required for the running-in. The throttle is operated by way of temperature ambient temperature sensor [ temperature engine temperature sensor [ glow plug heating ^ throttle control standard servo stepper motor i engine speed engine to run in optical sensor float valve/needle control engine run-in board AT AT X emergency stop i DSC (direct servo control) connector portable terminal < — > □ □ □ □ power supply USB 080253 - 11 4/2009 - elektor 25 MODELLING Table 1. Microcontroller specifications and resources used for the application. Resource Specification Notes Central unit ARM7-TDMI, 32-bit central unit. RISC-type central unit, one instruction per clock pulse. Clock 60 MHz Clock frequency used in the application: 58.9824 MHz RAM 64 kB Flash memory 128 kB UARTO 1 6C551 compatible Used for programming and communication with a PC UART1 1 6C551 compatible Available on expansion connector Multi- plexed, with PWM generation SPI Available on expansion connector l 2 C #2 Up to 400 kbps Available on expansion connector 'bit bang' PC Up to 400 kbps Used for the pocket terminal and tempera- ture detector. Expandable. 3 connectors available I/O port 3 ports available on expansion connector a standard servo. The engine speed reached is measured using an opti- cal detector. The board also man- ages the heating of the glow-plug and adjusts the mixture needle via a stepper motor. To complete the task, the board monitors the engine and ambient temperatures. A pocket terminal comprising an LCD display, a coding button, a few push- buttons and a sounder, to let you con- trol the running-in bench without need- ing a computer. The USB link (full speed @ 12 Mbps), Figure 2. Running-in bench driver board block diagram. obligatory these days, lets you pro- gram the board, control it, and read off the recorded data. The bench has a DSC (Direct Servo Control) interface, which lets you con- nect a remote-control transmitter and control the servo by means of the throt- tle control. This is also how you access the functions associated with optimis- ing the fuel curve. Provision has been made for an ‘emer- gency stop’ button in order to stop the engine quickly in the event of an criti- cal problem. With these facilities; the board lets you control the running-in of all types of 2- or 4-stroke, single- or multi-cylinder i/c engines, running on methanol or petrol, with glow or spark (electronic) ignition. Block diagram of main board The board, the block diagram for which is given in Figure 2, is designed around a microcontroller that may already be familiar to Elektor readers, the LPC2106 from NXP This 32-bit processor using RISC ARM7 architecture has ideal char- acteristics for this project (see Table 1). Since the LPC2106 is only available in a 0.5 mm (0.02”) pitch SMD package, we thought it advisable to use a module that readers will be able to buy ‘ready- made’, in this case, the ARMee board described in our April and May 2005 issues [ 1 ] [2] . On the left of Figure 2 we find the ‘sys- tem’ interfaces and the interfaces with the engine to be run in. The board works correctly with a power supply from 7-15 V. So the board can be powered from a mains adaptor, a car cigar lighter, or a 7-cell NiCd, NiMH or even 2S or 3S lithium polymer battery, which modelling enthusiasts will be familiar with. The throttle servo is controlled quite conventionally by way of a PWM sig- nal. Naturally, the board supplies the power for the servo, and the connector used is the same type as is found on all radio-control receivers. Hence the throttle control can use any ‘standard’ off-the-shelf model servo. The engine speed detector comprises a phototransistor and an LED. The signal from the phototransistor is processed before being fed to one of the micro- controller’s data capture inputs. 26 elektor - 4/2009 As the microcontroller doesn’t have any analogue inputs, it was necessary to make provision for an external ana- logue/digital convertor for inputting the temperature data. A type with an I 2 C interface was chosen. The single-pole stepper motor plus gearbox for adjusting the mixture is governed by an open-collector driver, controlled in turn by four of the micro- controller’s I/O port lines. Circuit diagram of main board It’s only a small step from the block diagram to the ‘real’ circuit diagram of the controller board (Figure 3). The large number of connectors and pro- tection components make the circuit pretty impressive, but it’s still rela- tively easy to pick out the elements of the block diagram. Pride of place right in the middle of the circuit goes to the ARMee module fitted with an 1.8 V for the microcontroller core), all the microcontroller’s unused I/O pins (including an SPI bus, a UART, a PWM generation port and two I/O ports) and the #1 1 2 C bus with interrupt. The #1 PC bus is a ‘bit bang’ type, i.e. the pulse trains required by the PC protocol are generated in software by the driver. This has the advantage of being able to convert any pair of the microcontroller’s ports into an PC bus. 090146-91 lilLI W > mi ]f i » v ■ i«< * CJT ‘ JT • \ W' • M _ ■Ik * A T - - - » ll** wjt Sr> Ok r m« mi* £ : irS WTryrrwz & rv if a;#; i i mm Pb 1 pi v/ -- tor ' HSflV lV rftr ■v rv i tf 111 • v tv r - afl EJP' r i ■■ » ■*j. j 7 1 _ Q22 J # • NOf a| \ K? if • ] !• - , ■ • < ■ • •! m m r %j Glow-plug heating is taken care of by a power MOSFET, driven again from one of the microcontroller’s I/O port lines. On the right of the board block dia- gram we find a few LEDs that tell you the status of the board, a few jumpers, a reset button, the USB port and the DSC interface. A pocket terminal... ...for controlling the board is con- nected to the main board via a 6-way cable with RJ11 connectors. This cable carries a 400 kbps PC bus, an interrupt signal, and the power for the terminal (5 V). LPC2106/01 microcontroller and a 14.7456 MHz crystal. Do note that these components are different from the ones on the board described in 2005 [ 1] [2] . If you want to use the 2005 board, all you have to do is change the original crystal. The ARMee module is powered from 5 V only, as the 1.8 V and 3.3 V rails required by the core and the inputs/outputs respectively are gener- ated on the ARMee board itself. The 3.3 V supplied by the ARMee board is used (sparingly) by certain compo- nents on the main board. A 20-pin expansion connector (K3), unused for the moment, carries all the board’s supply voltages (except the However, this type of bus represents a not inconsiderable load on the micro- controller if the bus is used intensively, and even more so if we want to use the bus in slave mode. To get round these drawbacks, we operate the #1 PC port in master mode only, and we’ve added an interrupt signal (INTO) to this bus so as to avoid scanning the push buttons and coder in the pocket terminal. This reduces the transactions on the PC bus to the strict minimum. To finish, it may be noted that this interface includes one active device (IC3), a PCA9517A . This device serves three functions: 4/2009 - elektor 27 MODELLING 28 elektor - 4/2009 • adapting the voltage swing of the microcontroller (3.3 V) to the levels of the external bus (5 V); • offering a protective barrier against ‘onslaughts’ from the outside world; • buffering the signals from the micro- controller, thereby making it possible to get round the 400 pF limit speci- fied for the I 2 C bus. A number of 100 Q series resistors, in association with 5.6 V zener diodes, round off the protection for this bus. The jumpers (JP5-JP8) let you power — or not — the peripherals connected to the three connector K6, K7, and K10. The pocket terminal can be connected to either K6 or K7, it doesn’t matter which. K10 makes it possible to connect an expansion board using HE- 10 connec- tors, far more practical than RJ11 con- nectors when the board is hand-wired on 2.54 mm (0.1”) ‘breadboard’. This connector supplies a 5 V rail, along with the unregulated board supply (via JP8). The #2 PC bus is connected to the microcontroller’s ‘official’ PC periph- eral, with master and slave modes, and is capable of a maximum speed of 400 kbps. From a hardware point of view, it is just like the #1 PC bus, except without the interrupt signal and HE -10 connector. Given the pos- sibilities, this bus offers for expand- ing the system, we’ve opted to keep it free and make do with just the #1 PC bus. Readers may leave out IC4 and its associated components. The 12 Mbps full-speed USB inter- face is achieved using a device that may already be familiar to Elektor readers, the FT232RL from FTDI, con- nected directly to the microcontroller’s UART0 interface. Diode D1 allows the board’s power to be derived from the USB bus. This is particularly useful during programming or when recover- ing the data stored on the board when no other power source is available. In ‘normal’ operation, powering the board from the USB bus is not recommended, as this power source is not powerful enough. Port P0.25 makes it possible to Figure 3. Circuit diagram of main board. 4/2009 - elektor 29 MODELLING detect if the USB bus is connected and active. Junipers JP1 and JP2 work in tandem: if they are fitted, the ‘program- ming’ mode is active. In this mode, it is possible to easily and quickly load new software into the microcontroller through the intermediary of the (free) flashing by NXP [3] (see box). Without these jumpers, the USB link operates as a simplified conventional serial link, but with a markedly higher transmis- sion speed (3 Mbps maximum). Management of the microcontroller’s reset is entrusted to a specialized device, the LM3724 from National Sem- iconductor. This ensures correct start- as little as 7 V, which means the board can be powered from a battery of dual- element lithium polymer accumulators, delivering a nominal voltage of 7.4 V. Diode Dll protects the circuit against possible reverse polarity. The VHV volt- age is tapped off at the regulator input and used to power the stepper motor (see below). The ‘engine’ and ‘external ambient’ temperature measurements are made using KTY81-210 linear two-terminal detectors in TO-92 packages. These detectors, whose active element is made of silicon, have the advantage of exhibiting a virtually linear variation in the subject of the project ‘Rev counter for models’ [4]. The optical detector, a phototransistor, works by reflection and should be positioned a few cen- timetres from the propeller. The LED built into the detector provides a lit- tle local light source. Depending on the ambient lighting, the conduction of this device varies considerably, and it is impossible to detect the movement of the propeller unless the process- ing stage allows for these variations. To do this, operational amplifier IC7A holds the voltage at the emitter of T4 at an average value of 1.4 V, which sets the phototransistor’s operating point and compensates for the varia- up when the board is pow- ered up and allows addi- tional reset push-buttons to be added; a feature that we have made use of, since the board has two reset buttons (one on the board, the other external one connected via K4). The throttle servo is controlled by the microcontroller’s P0.7/SSEL/PWM2 output. Rll and D5 protect this pin in the event of an external voltage being injected onto the control line. The servo is powered from the board’s 5 V rail or via a jumper (JP12). This jumper lets you choose not to power the servo socket, so as to avoid an external volt- age being injected. This can occur if the user connects an electric motor speed controller with a BEC (Battery Eliminator Circuit) function to this output. In this way, either a servo or a speed controller with BEC can be con- nected to this output. Powering of the board is entrusted to a ‘low voltage drop’ linear regulator. Thus the board works correctly from their resistance. Biasing resistors R28 and R34 linearise their values over a huge temperature range. Since the microcontroller doesn’t have any ana- logue inputs, it was necessary to resort to an external convertor. The convertor chosen for this task is an AD7417 from Analog Devices (IC6). This convertor, with four 10-bit inputs, and connected to the #1 1 2 C bus, has an internal 2.5 V reference. The device has an internal temperature detector that provides the device temperature — which is also the prevailing ambient tempera- ture around the board. This convertor is kind enough to return this tempera- ture directly in degrees Celsius, with- out needing any scaling or calibration. The interrupt line to which the conver- tor is connected makes it possible to warn of any possible overheating. The remaining two inputs are used to mon- itor the supply voltages to the board (VHV) and the glow plug (VGP). The engine speed detector is one of the key elements of the circuit. The signal processing circuit for this detector was designed by Paul Goossens and was tions in ambient lighting. If the volt- age at the emitter of T4 falls, the con- duction of T3 increases, which causes the voltage on the detector terminals to increase, and hence likewise on the emitter of T4, as it is connected as a follower. The low-pass filter formed by R39 and C33 slows down this control loop to avoid the short pulses associ- ated with the movement of the propel- ler in front of the detector moving the operating point. These pulses, present at the emitter of T4, are picked off by a high-pass filter C35/R47 which elimi- nates the 1.4 V DC component and any slow voltage variations. IC7B, wired as a comparator, looks after shaping these analogue pulses to make them ‘microcontroller-compatible’. A logic-controlled power MOS transis- tor has the job of controlling the heat- ing of the glow plug. The transistor gate is biased with the board input voltage in order to take advantage of its ‘high’ value. However, zener diode D14 prevents this voltage reaching 10 V, the maximum gate voltage. When heating of the glow plug is activated, 30 elektor - 4/2009 a red LED lights to warn the user. The power source for the glow plug can be either a NiMH cell (1.2 V), a lead-acid cell (2 V), or the glow plug heating out- put of a model ‘power panel’. The Direct Servo Control (DSC) input is particularly simple, as a single NPN transistor is all it takes to interface with the microcontroller. The resistor values in the circuit have been tested using a Graupner MX16s transmitter. If your transmitter is a different type, you may need to adjust some values. The stepper motor driver output allows you to drive a stepper motor with gear- box with a rated voltage of 5 V or 12 V. The values of resistors R54 and R55 may need adjusting, depending on the motor you’re using. If you’re not plan- ning to use a stepper motor in your application, these four open-collector outputs can be put to other uses, such as driving lamps, LEDs, DC motors, or relays. Pocket terminal The electrical circuit of the pocket ter- minal (Figure 4) is very simple, thanks to the high level of integration in the devices used. The heart of this board is an MCP23017 port expander with I 2 C bus from Microchip, which provides no fewer than 16 I/Os, ideal for producing a handy user interface. The 6- way RJ11 input connector pro- vides the MCP23017 with power, the I 2 C bus, and an interrupt signal. The IC is protected from electrostatic dis- charge and over-voltage by three zener diodes (D1-D3). The MCP23017’s three address select lines have been connected to the same number of jumpers, which means you can select the terminal’s bus address. The alphanumeric display is interfaced in 4-bit mode and it takes up the whole of the MCP23017’s port B. Incremental encoder S5 gives the user the impression of an analogue control, arguably much more ergonomic than a pair of + / — buttons when you’re driving a servo. The MCP23017 has an ‘interrupt-on-change’ mode, which means that a change of state on any of its 16 pins generates an interrupt. Hence the incremental coder doesn’t have to be scanned: the software will only launch a read cycle on the PC bus after receiving such an interrupt, which reduces the load on the bus to a strict minimum. Pushbuttons S1-S4, along with the pushbutton on S5, employ the same type of event-driven processing. No pull-up resistors are needed, as they are built into the MCP23017. And lastly, the terminal’s sounder is controlled by a P-channel MOS transistor. Construction To make building the boards easier, we’ve chosen traditional through-hole components wherever possible. Start by soldering the SMD devices IC1- IC6, IC8, and Tl. Take care not to over- heat them, and to remove any shorts between pins using desoldering braid once soldering is finished. Then fit the through-hole components and end with the connectors. Check the orienta- tion carefully for all the polarised com- ponents like the ICs, electrolytic and tantalum capacitors, and diodes. The ARMee module is fitted with the help of the board’s component overlay. Building the pocket terminal board is quick and easy and doesn’t call for any special remarks. Depending on the type of display you’ve chosen, it may be necessary to adjust the value of R2 to suit the backlight current for it. At the end of building, fit the three jump- ers JP1-JP3 in the ‘5 check’ position. Testing the boards Testing takes place in four steps: • Power up for the first time to check supply rails; • Fit the ARMee module and flash-in the test firmware; • Operating test of the main controller board (‘CBRM’); • Operating test of the pocket termi- nal (‘GMMI’) Powering up for the first time Do not connect any peripherals to the board connectors, remove all the jumpers and the ARMee module, then 4/2009 - elektor 31 MODELLING Firmware flashing procedure First install the free LPC2000 Flash Utility from NXP [3] on your computer. Power up the controller board and connect it to the PC via a USB cable. Check that the operating system has correctly recognised the new USB serial port. If the number assigned to the port is higher than COM5, change it. Start LPC2000 Flash Utility In 'Connected To Port', select the COM port to be used and select a speed of 1 1 5,200 baud. Check the 'Use DTR/RTS for Reset and Boot Loader Selection' box. In the box 'Device:', select the LPC2 1 06 and enter the value 1 4745 in the 'XTAL Freq. [kHz]:' box. On the controller board, fit jumpers JP1 and JP2 and remove jumper JP3. Click the 'Read Device ID' button. The 'Part ID' and 'Boot Loader ID' should get filled in. If not, go back through the procedure step by step - it is vital to get through this stage successfully, otherwise it won't be possible to program the controller. Use the button alongside the 'Filename' box to select the .hex file to load into the controller. Click the 'Upload to Flash' button and wait for the operation to finish. Exit the tool to free up the serial port and remove jumpers JP1 and JP2. All this seems very long-winded, but as the software saves the selected options, flashing is very quick after the first time. Figure 5. How to configure the LPC2000 Flash Utility programming utility. JTAG If you have a JTAG probe, you'll be able to program the microcontrol- ler after connecting your probe to K1 (Keil Ulink compatible connec- tor) and fitting JP3. Don't forget to remove JP3 afterwards. If JP3 is fitted while the JTAG probe is disconnected, the program will work, but ports P0.22 and P0.31 will remain in Embedded Trace Macrocell (ETM) mode and so won't be accessible to the program. This will mean that the RUN LED, the 'user' jumper, the glow plug drive, USB status reading, and the stepper motor driver won't work. power the board up from a bench sup- ply set to 8 V / 200 mA. The current consumption should not exceed 70 mA. The green power LED should light, and you should check with a multimeter the value of the 5 V supply to pin 3 of IC5, which must be between 4.9 V and 5.1 V. If all is well at this stage, move on to the next; if not, check once again for solder bridges or reversed components. Now let’s add the ARMee board The next step is going to consist of powering down the board and fitting the ARMee module, taking care not to get it the wrong way round. Check that it is correctly fitted with a 14.7456 MHz crystal. If not, it is vital to change it before proceeding. Power the board up again and check the presence of the 3.3 V rail on pin 1 of IC3. The cur- rent consumption should remain under 70 mA if the microcontroller has never been programmed or while the reset button is pressed. That’s the hardest part over! Now we need to test that all the stages on the board are working correctly and check that the microcontroller is able to communicate with the outside world. To do this, the microcontroller needs to be ‘flashed’ with the CBRMtest.hex software, available by download. Refer to the box for this operation. Once the board has been programmed, unplug the USB cable and check that there are no jumpers fitted. Power the board up again. The current consumption should now settle at around 100 mA. Pressing the reset button causes the current to drop to around 60 mA. The red ‘RUN’ LED should be flashing regularly. Now disconnect the power. Testing the main CRBM board If not already there, install the Tera- T COM5:115200baud -Tera Term VT 0[5][X File Edit Setup Control Window Resize Help 17229 - Type ESC to get help - Type * contend -> ilwklur prujut.1 D80253 - 1 freak- in bench for nodel engines MW i GhHl Hardware Test V2.00 - Feb 8 2009-21:05:54 Jsage: I = Test of USB pouer status input I = lest ot 12UJ and 12U1 bus J = Test of UseT jumper input S = Test of RPH input ) = Test of the analog inputs r = Test of tenperature analog inputs If = Test of batteru voltages analog inputs 5 = Test of servo connand output 1 = Test of Direct Servo Cotmand (DSC) input H = Test of Glou Plug Heater connand output = Tost nf Stepper nntnr outputs = Test of Spare I/O’s = Test of GhHI Ruttnns : = Test of GHHI Encoder 2 = Tost of GHHI Buzzor . = Test of GHHI Display E - Tcet of all GHHI features 18242 - Type ESC to get help - Type o comt&id -> Opening screen for CBRMtst_v200.hex. Term Pro [5] freeware on your PC. Connect the board to one of the USB ports on your PC. The green power LED should light and the red ‘RUN’ LED should flash. Run TeraTerm and in the Setup -> Serial port menu, con- figure the port to which the board is connected as follows: Baud rate: 115200 Data: 8 bits Parity : none Stop: 1 bit Flow control: none Close the configuration window and press the Escape key on the PC key- board in order to get the screen in Figure 6. Select the parts to be tested in turn by pressing the corresponding letter on the PC keyboard. The software is self- documented and explains what should be happening with the hardware as each element is tested. An oscilloscope and multimeter are required. For the time being, don’t activate the tests for the GMMI board (pocket terminal). Testing the pocket terminal (GMMI) Unplug the USB cable and power the CBRM board up again using the bench 32 elektor - 4/2009 A few words about the author A graduate from the National Institute of Applied Sciences at Lyon, France, Michel Kuenemann has been an independent electronics consultant for about 20 years. Michel currently works on electrical supply systems for a large transport aircraft and enjoys building much smaller ones in his spare time. supply set to 8 V / 500 mA. Fit jumper JP8 and connect a ribbon cable fitted with 6/6 RJ11 connectors to K7 and the GMMI board. The current consump- tion should not increase significantly. Adjust the contrast pot PI until lit- tle dark rectangles appear on lines 1 and 3 of the display. Check that the three jumpers JP1-JP3 are in the ‘5 V’ position. Connect the board to the PC again under TeraTerm and now run the tests devoted to the GMMI board and follow the instructions. It will prob- ably be necessary to adjust the con- trast and possibly R2 which sets the backlight current. The rest You now have a powerful 32-bit ARM7 microcontroller board and a handy data entry terminal. In Part 2 of this article, we’ll be looking in detail at how to connect the board to its detec- tor and actuators, together with the application software for this project. In the meantime, good luck with the construction! ( 080253 - 1 ) References and Internet Links [1] LPC210x ARMee' Development Board (1), Elektor Electronics March 2005. Online: www. elektor.com/080444-1 . [2] LPC210x ARMee' Development Board (2), Elektor Electronics April 2005. Online: www. elektor. com/080444-2. [3] LPC2000 Flash Utility: www.nxp.com/ products/microcontrollers/support/software_ download/lpc2000/ [4] Rev counter for R/C Models, Elektor Elec- tronics November 2003. Online: www.elektor. com/0241 1 1 . [5] TeraTerm: ttssh2.sourceforge.jp/ [6] www.elektor.com/080253 Note: in view of the length of the components list, this is being offered as a free download from the website for this article [6]. That way, you can download it at the same time as the software you'll need to make the board work. Advertisement See your project in print! Elektor magazine is looking for Technical Authors/Design Engineers If you have ✓ an innovative or original project you'd like to share with Elektor's 1 40 k+ readership and the electronics community above average skills in designing electronic circuits experience in writing electronics-related software ^ basic skills in complementing your hardware or software with explanatory text a PC, email and Internet access for efficient communications with Elektor's centrally located team of editors and technicians then don't hesitate to contact us for exciting opportunities to get your project or feature article published. Our Author Guidelines are at: www.elektor.com/authors. Elektor Jan Buiting MA, Editor Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, United Kingdom Email: editor@elektor.com 4/2009 - elektor 33 AUTOMOTIVE ELECTRONICS Automotive CANtrol Car electronics exposed Chris Vossen (Elektor Labs) and Ep Gernaat (Timloto, The Netherlands) This universal microcontroller board was designed, in the first instance, for use by students studying automotive technologies, but it can also be used for other applica- tions, of course. The heart of this board is an Atmel AT90CAN32 with a fast RISC core. Technical Specifications • Microcontroller: Atmel AT90CAN32 • Fast RISC -architecture with 133 instructions • Clock speed: 12 MHz • 32 KB flash, 2 KB RAM and 1 KB EEPROM available • 53 programmable I/O lines • Integrated CAN2.0 controller • 8-channel 10-bit A/D converter • SPI interface • JTAG interface • 2 USARTs • Two-Wire interface • 8 DIP switches and 8 LEDs available for experimental applications • Power supply: 5 V Since cars contain an ever increas- ing amount of electronics, students learning about motor vehicle tech- nology also need to know more about electronics and microcontrol- lers. In collaboration with the Timloto o.s. Foundation in the Netherlands, Elektor designed a special controller PCB, which will be used in schools in several countries for teaching stu- dents about automotive technologies. Particular attention was paid to issues such as universal design, cost, con- nection options, expandability and the availability of free development soft- ware for various platforms. Cars and electronics About 20 years ago, teachers of the subject of motor vehicle techno- logy introduced the topic of microcontrollers into the curriculum of automotive technicians. In those days they used a teaching kit that was based on the Z80, which was appropriately named the Microprofessor. This kit has been used intensively for at least 1 0 years, at the higher grades of technician training and teachers united in the TIM working group (TIM = Technical Informatics Motor Vehicles) have made many automotive applications over the years. However, at some stage a Veal' automotive microcontroller was selec- ted, the Motorola 68HC1 1 , which at that time was frequently used in various automotive computers. The educational programs which were originally developed for the Z80 were ported across and expanded. An engineering consultant developed a 68HC1 1 controller board based on the specifications from the TIM group. One of the prerequisites was that the already developed Z80 hardware applications could be used again. A textbook was written and the teachers were given further trai- ning. Even now the 68HC1 1 is still used successfully as an educational controller within the context of motor vehicle technology. The TIM working group evolved into the Timloto o.s. foundation, a wor- king group of teachers which sets itself the purpose of closely monito- ring the technical developments in cars and make these available as teaching resources to other teachers and students as soon as possible and at no cost. New times, new opportunities: the Timloto website with open-source licence became a fact. See www.timloto.org. In the meantime the CAN bus became common and car computers started receiving Flash memory upgrades while the cars were being serviced. Again there was a call for a new(er) controller and this time the editors at Elektor were approached for advice. The choice for the Atmel AT90CAN32 was quite quickly made because of its reasona- ble purchase price, the many features and the programmability under Windows and Linux (Ubuntu). Thanks to the ingenuity of the Elektor designers all the requirements from the Timloto specifications could be met. The demands were considerable. Because Timloto works together with another automotive teachers initiative (the 'GoforAfrica' founda- tion) it also had to be possible to use the controller in technical schools in Senegal and Gambia. The computers there run the Ubuntu opera- ting system so that a Linux development environment was an absolute requirement. Costs also play an important role. The approach was to keep the cost of the controller board as low as possible so that it could be added to 34 elektor - 4/2009 A significant amount of teaching material is already available, which is freely available to anyone via the Timloto website. You can therefore also use this project at home. But the design of this circuit is so universal that it will also be excellent for all kinds of other home, or should we say, garage, projects. Choice of microcontroller When searching for a suitable micro- controller we soon arrived at the AT90CAN32 made by Atmel. This con- troller is packed with many features. It has 32 KB of Flash memory and 2 KB of RAM. An EEPROM of size 1 KB is also available. In addition to a 10-bit A/D-converter with eight channels, the controller also has multiple timers, an SPI interface and two USARTS (one of which is used as the programming interface). There is also a TWI interface and a CAN2.0 controller. The latter makes this controller eminently suitable for applications in an automotive environ- ment. The core of this controller has a RISC architecture with an instruction set consisting of 133 instructions. The AT90CAN32 is available in both 64-pin TQFP and QFN packages. For this design we choose the TQFP version. This package type has all the pins accessible around the out- side edge of the package, which makes it much easier to solder by hand. Finally we would like to mention that this controller is completely com- patible with its bigger siblings the AT90CAN64 and AT90CAN128. For a detailed description of all its features (such as the TWI) we refer you to the datasheet [1]. the book list of the automotive science stu- dents and in this way each student also has the opportunity to practise in his or her own time. The switches in particular were a hurdle initially. Eight toggle switches would increase the price of the design considerably. A clever Elektor solution was found by using a sepa- rate expansion board for use in class, which contains the switches. The module is plugged into the expansion board. In this way, during classes at school the robust switches on the expansion board are available. Using the first Elektor prototypes, members of the Timloto working group could translate the first (educational) 68HC1 1 programs into AT90CAN32 assembly language. For this purpose, use was made of AVR Studio 4 and gcc-avr, avrdude and kontrollerlab for Linux. The lesson materials are now organised in a matrix and can be found at www.timloto.org/ nl/matrix/matrix_atmel.html In the spring and autumn Timloto will or- ganise training courses for automotive technology teachers in Gambia, Senegal and the Netherlands to show them the educational use of the AT90CAN32. Tim- loto aspires to international cooperation between all (automotive) technical educa- tion and would like to see as many people as possible supporting this Elektor-Tim- loto project. Help is required to translate programs (comments and questions) into English and French. Program ideas and new applications are also very welcome. Consideration can also be made to use the C programming language instead of as- sembly language. We would like to appeal to teachers, elec- tronics and information technology experts to cooperate and develop things further, all in the spirit of open-source. 4/2009 - elektor 35 AUTOMOTIVE ELECTRONICS GND SO oo SI I- “V / S2 to / S3 w ( S4 ( S5 co ( S6 \ - 37 \ 12 CO oo \ ” 39 \ ? 40 \ 15 -p^ 16 6 PE7 9 PE6 8 / PE5 7 / PE4 6 / PE3 5 / PE2 4 / MISO 3 / MOSI 2 / PD4 29 / 30 31 PD7 32 AREF AVCC VCC VCC (ADO)PAO (ADI)PAI (AD2JPA2 (AD3)PA3 (AD4)PA4 (AD5)PA5 (AD6)PA6 (AD7)PA7 (A8)PC0 (A9)PC1 (A10JPC2 (A11JPC3 (A12JPC4 (A13JPC5 (A14JPC6 (A15JPC7 RESET PG4(T0SC1) PG3(TOSC2) PG2(ALE) PG1(RD) PGO(WR) PEN (OCAO/OC1C)PB7 (0C1B)PB6 (0C1A)PB5 (OC2AJPB4 (MIS0)PB3 (M0SI)PB2 (SCK)PBI (SS)PBO AT90CAN32 IC1 20 RESET 19 PG4 18 PG3 V 43 PG2 s 34 PG1 s 33 PGO V J_ V 17 PB7 16 PB6 s 15 PB5 s 14 PB4 s 13 PB3 s (ICP3/INT7)PE7 (T3/INT6)PE6 (OC3C/INT5)PE5 (OC3B/INT4)PE4 (OC3A/AIN1)PE3 (XCK0/AIN0JPE2 (TXDO/PDO)PE1 (RXDO/PDIJPEO PF7(ADC7/TDI) PF6(ADC6/TDO) PF5(ADC5/TMS) PF4(ADC4/TCK) PF3(ADC3) PF2(ADC2) PFI(ADCI) PFO(ADCO) (ICP1 )PD4 (TXD1/INT3)PD3 (TXCAN/XCK1)PD5 (RXD1/INT2JPD2 (RXCAN/T1)PD6 (SDA/INT1 )PD1 (T0)PD7 (SCUINTO)PDO AGND GND GND XTAL1 XTAL2 CO CD CO m CM CM CO CM C4 XI ifll CM 12 PB2 11 SCK 10 PBO ■\ / 54 PF7 55 PF6 ■\ / 56 PF5 57 PF4 C5 ^ ( 22ppl2MHz^ 22p GND K6 PGO 1 58 PF3 ^ ' PG2 3 59 PF2 ^ ' PG4 5 60 PF1 > ' PD1 7 61 PFO > ' PD7 9 S 28 TXD1 ' PB6 11 ' PB4 13 27 RXDp ' PB2 15 26 PD1 ^ ' PE7 17 25 PDO > ' PE5 19 S ' PE3 21 ' RXD1 23 ' PFO 25 ' PF2 27 ' PF4 29 ' PF6 31 £ +5V 33 O O o o o o o c> c> o o o o o o o o GND 2 PG1 4 PG3 6 PDO S 8 PD4 S 10 PB7 s 12 PB5 s 14 PB3 s 16 PBO s 18 PE6 s 20 PE4 s 22 PE2 s 24 TXD1 s 26 PF1 s 28 PF3 s 30 PF5 s 32 PF7 s 34 1 GND LI C9 lOOn rLED8 +5V A O CIO lOOn +5V +V Co re GND GND 080671 - 11 GND Figure 1. The schematic for automotive CANtroller module. Schematic The schematic for this module is a relatively simple design (Figure 1). The heart of the circuit is formed by the AT90CAN32 (IC1). The Reset pin is connected to an RC network (Rl/ C3) which provides a reset when the power supply voltage is turned on. S8 provides the option of manually reset- ting the circuit. A crystal of 12 MHz is used for generating the clock fre- quency. To use this crystal the con- figuration fuses of the microcontroller have to be programmed with the cor- rect settings. Using AVR Studio, the SUT_CKSEL bits can be configured for an external crystal with 8 MHz mini- mum frequency. To enable the CAN controller to com- municate with a real CAN bus a CAN transceiver is required. This can be found on the schematic in the form of a PCA82C251 (IC2). This IC is quite well known by now and conforms to the ISOH898-24V standard. This trans- ceiver can therefore be used with both 36 elektor - 4/2009 Stepper motor control The example below shows how a bipolar stepper motor can be connected to the control module. Bipolar stepper motors contain a number of windings which need to be driven according to a certain pattern. In our example this is the following continuously repeating pattern : 0101 1001 1010 01 10. In the initialisation routine of this example, Ports A and F are con- figured as outputs. The stack pointer is initialised before any subrou- tines are used. Port C is entirely configured as inputs, because this is where the switches are connected. The switches are not used in this example, however. In the main program the four steps, one at a time, are continuously written to Port F, with a small pause between each one. The stepper motor will rotate as a result. When step 4 is completed the software will begin again with step 1 . The controller will repeat this pattern over and over again. The stepper motor is connected to the microcontroller using the fa- miliar ULN2003A (see schematic). This 1C contains a number of Dar- lington transistors which can deliver sufficient current to get a small stepper motor to turn. K6 The example program is available as a free download from the Elektor website filed under number 080671 -1 1 .zip. /* Program name: TESTPORTF . ASM Program for de AT90CAN32 Elektor-Timloto board Port F output Port A output and drives LEDs This program uses AVR Studio 4 The program runs from flash memory */ .DEVICE AT90CAN32 .INCLUDE "can32def . inc" / definition of ports are in a separate file RJMP RESET ;jump to starting address /* INITIALISATION*/ RESET: LDI R16 , $FF /set all pins of Ports A and OUT DDRF , R16 F to outputs OUT DDRA, R16 LDI R16 , high (RAMEND) OUT SPH, R16 LDI R16 , low (RAMEND) OUT SPL,R16 /stack pointer initialisation is necessary for subroutine /is not yet used here LDI R16 , $FF /activate the pull-up OUT PORTC , R16 resistors /by writing ones the the LDI R17 , $00 output port ,-set all pins of Port C to OUT DDRC , R17 inputs /not really necessary NOP (default value) /* MAIN PROGRAM*/ BEGIN: LDI R17 , ObOOlOOOlO ;0101 Step 1 OUT PORTF , R17 OUT PORTA, R1 7 RCALL WAIT1 LDI R17, OblOOOOOlO OUT PORTF, R1 7 OUT PORTA, R1 7 RCALL WAIT1 /1001 step 2 LDI R17, OblOOOlOOO OUT PORTF, R1 7 OUT PORTA, R1 7 RCALL WAIT1 ,•1010 step 3 LDI R17, ObOOlOlOOO OUT PORTF, R1 7 OUT PORTA, R1 7 RCALL WAIT1 ,•0110 step 4 RJMP BEGIN /* DELAY SUBROUTINE*/ WAIT1 : LDI R20,0x0F / OF (01 for debugger) WAIT: LDI R18,0xFF / 0x7 7 (01 for debugger) AGAIN: LDI R19,0xFF LOOP: SUBI R19 , 0x01 / OxFF (01 for debugger) BRNE LOOP SUBI R18 , 0x01 BRNE AGAIN SUBI R2 0 , 0x0 1 BRNE WAIT RET /return to main program 4/2009 - elektor 37 AUTOMOTIVE ELECTRONICS Figure 2. Component layout for the PCB that was designed for this circuit. 12-V as well as 24-V systems. Using sub-D9 connector K2 or pin header K7 it is poss- ible to connect the board to the CAN-bus. The pinout of this connector cor- responds with that of the USB -CAN adapter which was published in our October 2008 issue. Considering the educa- tional character of this project, the board is also provided with eight switches (SO to S7) and eight LEDs (LEDO to LED7) which can be used when doing pro- gramming exercises. There is also a potentiometer (PI) on the board. You can, for example, let the microcontroller read the position of the potentiometer and depending on the measured value turn on a number of LEDs. You need to fit jumper JP1 to connect the potentio- meter to the microcontroller. K4 is the familiar header for the USB- TTL cable which we have used in sev- eral earlier Elektor projects (080213-71, see Elektor Shop). The power supply for the circuit is built around a classic design using a LD1117S50. This is a linear low-drop 5-V regulator which requires very few external components. With K3 you can choose whether the circuit is powered COMPONENT LIST Resistors RIO = 1 20 D (SMD0805) R2-R9,R1 3 = 330 Q (SMD0805) R12 = lkQ (SMD0805) R1 ,R1 1 = lOkD (SMD0805) PI = 1 OkD potentiometer (RK09K1 1310KB) Capacitors C1,C2,C3,C8-C1 1 = lOOnF (SMD0805) C4,C5 = 22pF (SMD0805) C6 = 47jL/F 20 V (CASE D) C7 = 10jL/F 16V (CASE B) Semiconductors D1 = MBRS130 (SMB) IC1 = AT90CAN32-1 6AU (TQFP-64) IC2 = PCA82C251/N4 (S08) IC3 = LD1 1 1 7S50CTR (SOT223) LED1-LED9 = SMD LED (SMD0805) XI = 1 2MHz quartz crystal Miscellaneous JP1 ,JP2 = 2-way SIL pinheader + jumper K1,K7 = 6-way DIL pinheader K3 = 3-way SIL pinheader + jumper K6 = 34-way DIL pinheader K4 = right angled 6-way SIL pinheader K5 = DC adapter connector K2 = right angled 9-way sub-D plug (male), PCB mount S0-S7= one 8-way DIP switch S8 = pushbutton Kit of parts, contains SMD-prestuffed board and all through-hole components. Elektor Shop # 080671-91. from the USB -connection or from volt- age regulator IC3. The PCB layout for the circuit is shown in Figure 2. We won’t discuss the details of assembling the PCB. Experi- enced electronics enthusiasts are cer- tainly capable of assembling this board by hand, but most users would prob- ably order the ready-made board from Elektor instead. Programming In order to program the microcontroller you need to have a programmer. You can do this by, for example, connecting the Elektor USB AVRprog to Kl. This programmer was featured in the May 2008 issue. This pro- grammer is still available from the Elektor Shop (no. 080083-71). For the program- ming software you can use AVR Studio from Atmel [2]. This is available as stand- ard with an assem- bler. Those of you who are fond of C can use the WinAVR open-source toolset [3]. Bascom AVR [4] and Code- vision [5] are a couple of com- mercial alternatives. These have evaluation versions available that you can download. The Automotive CANtroller module is available from the Elektor Shop and has the catalogue number 080671-91. All SMD parts are already fitted on the board. Only the through-hole parts and the connectors still need to be soldered. Finally, a comment about the power supply for the module. As you will have noticed already, this can be pow- ered from either the USB connection or from a mains adapter. Make sure you have the correct setting for the jumper on connector K3. ( 080671 - 1 ) Internet Links m www.atmel.com/dyn/resources/prod_doc- uments/doc7682.pdf [2] www.atmel.com/dyn/Products/tools_card. asp?tool_id = 2725 [3] http://winavr.sourceforge.net/ [4] www.mcselec.com [5] www. h pi nfotech . ro/htm l/cvavr. htm 38 elektor - 4/2009 r — iii<( ifll PCBiEQBL Specialising in Prototype PCBs ■ Instant online Quotations & Ordering ■ From Singlesided to 6 layers ML ■ Leadtimes from 48 hrs ■ Full DRC included on all orders ■ No Tooling or Set-up Charges Simply send your layout files and order online www. pcb-pool.com Free Phone UK: 0800 389 8560 Email: sales@pcb-pool.com hi; i J tel. 01298 70012 ^^Ej&1298 70046 c . c o . u k sales@peakelec.co.uk iVATi! VAT Reduction AND Offers! Atlas DCA includes new premium probes! Atlas ESR Atlas DCA Model DCA55 Atlas ESR Model ESR60 Semiconductor Analyser Identifies type and pinout! ESR and Capacitance Meter Resolution of 0.01 ohms! Atlas LCRJ||||I LCR40 Atlas SCR flodelSCRI 00 Inductor, CapacitoS Resistor Anaiyl e^Briac ani!|^^^^®|alyser Automatic pait identification. Auto gate tejEMBBIpBIE to 1 0QUA UK: Please adf 1 £2 p&p to your order. P rices Please see website for overseas pmliBM CZ>23 projects to bring your microcontroller to life! This book contains 23 special and exciting artificial intelligence machine- learning projects, for microcontroller and PC. Learn howto set up a neural network in a microcontroller, and how to make the network self-learning. Discover how you can breed robots, and how changing a fitness function results in a totally different behavior. Find out how a PC program exposes your weak spots in a game, and ruthlessly exploits them. Several artificial intelligence techniques are discussed and used in projects such as expert system, neural network, subsumption, emerging behavior, genetic algorithm, cellular automata and roulette brains. Every project has clear instructions and pictures so you can start immediately. Even after you have built all the projects contained within, this book will remain a valuable reference guide to keep next to vour PC. lektor SHOP 256 pages • ISBN 978-0-905705-77-4 £32.00 • US $46.00 Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 L ' Further information at www.elektor.com/books 4/2009 - elektor 39 TECHNOLOGY SUPER COMPUTERS Supercomputer Dream or Reality? Franck Bigrat (France) 1105 Teraflops! Behind this strange term there hides a record, one that's been held by Roadrunner, the world's fastest computer, since June 2008. Built by IBM for the US Department of Energy at the National Laboratory in Los Alamos, it beats the previous record of 839 Teraflops held by the NEC SX9 since late 2007. Maybe soon, owning a supercomputer at home will no longer be just a dream. Indeed, inventive solutions enabling a wider public to have access to enormous computing powers do already exist... Flops! Tera! What on earth...? FLOPS is the acronym for Floating Point Operation Per Sec- ond. Perhaps we'd better just explain that floating-point numbers are used in computing to represent values that are not whole numbers. And Tera is a multiplier corresponding to 1 0 12 , i.e. a trillion. Armed with this information, we can say that Roadrun- ner [1] (Figure 1) is capable of performing a little over a thousand trillion floating-point operations in one second! So the legendary bar of the Petaflops has been crossed (Peta corresponds to 1 0 15 ). To give a concrete idea of Roadrunner's speed, let's make a simple comparison: the IBM computer can perform, in one day, calculations that would take 6 billion people (i.e. the entire population of the world) working 24/7 on an ordi- nary scientific calculator 46 years to perform! Why Supercomputers? How can we define a supercomputer? It's a computer designed to achieve very high performance in terms of cal- culation speed and power. They are used in scientific and engineering applications that require enormous calculat- ing powers. Simulating the behaviour of aircraft structures, determining the shapes and profiles for aircraft wings so as to obtain maximum lift, designing engine turbines, simulating defor- mations in car bodywork, meteorological forecasting, cli- mate changes, predicting earthquakes, research in biol- ogy, particularly on the human genome, simulating nuclear explosions, research into nuclear fusion, or decoding secret codes... The list of their uses is a long one. Here are two examples of applications in the field of scientific research: A fierce competition The current record is held by Roadrunner [1 ] with its 20,000 or so processors (1 2,960 IBM PowerXCell 8i + 6,480 AMD Opteron dual-core, running at 3.2 GHz and 1 .8 GHz respec- tively), but let's just mention a few other recent technological feats that illustrate the competition between the major manu- facturers of large-scale computer systems (IBM, Bull, NEC, etc.) to create the fastest supercomputer in the world. - NEC 8X9: based on vector floating-point processors and a memory of 1 TB (Terabytes), it can reach a speed of 839 Teraflops. - Blue Gene L: held the record in 2005 with a speed of 367 Teraflops. Built by IBM, it comprises 1 31 ,072 'Power PC' ASIC processors, 1 6 TB of RAM and 400 TB of storage capacity. - Tera 10: Brought into service in 2006 by Bull for the French Commissariat a I'Energie Atomique (Atomic Energy Commis- sion). It is made up of 602 Bull 'NovaScale' servers using 8 Intel Montecito dual-core processors. This represents a total of 8,704 cores enabling a speed of 64 Teraflops. The RAM capacity is 30 TB! 40 elektor - 4/2009 1 . The Blue Brain project, the ambition of which is to model the human brain by simulating the operation of the billions of neurons it comprises using IBM's BLUE GENE L. 2. The Horizon project which allows simulation of galaxy formation, thus making it possible to verify the validity of the models astronomers develop to describe the evolution of th e universe. One of the main motivations for developing these high-per- formance computers is simply the fact that developing a reliable computer simulation model and using a high-per- formance computer to run it cost infinitely less than carrying out incredible numbers of tests or scientific experiments in the laboratory. But above all — and the Horizon and Blue Brain projects are good illustrations of this — they make it possible to simulate phenomena that are difficult, if not utterly impos- sible, to reproduce in the laboratory. This is often referred to as 'in silico' testing, just as we speak of testing in vivo or in vitro. A games console converted into a supercomputer! Certain scientists, limited by their budgets and so unable to have access to a supercomputer (one simple simulation may cost several thousand euros), have found a solution that is radical to say the least: putting together their own supercomputer. A team of researchers under Gaurav Khanna from the Uni- versity of Massachusetts (USA) carrying out astrophysical research into gravitational waves and black holes have used eight Play Station 3 games consoles connected to a network in order to create a supercomputer at a reason- able cost [2]. Although perhaps an odd choice at first sight, this turns out to be entirely appropriate, since the PS3's CELL processor (Figure 2), designed by IBM and Toshiba, is identical to the one used in Roadrunner. This eight-core processor is capable of amazing feats. Judge for yourself: 200 Gigaflops in single precision (32 bits) and 20 Gigaflops in double precision (64 bits). The computing power obtained by the 'cluster' (we'll explain this term later) of PS3s is equivalent to around 400 computers. This example shows that it is possible — provided of course you possess the appropriate knowledge in electronics and computing — to put together a supercomputer for yourself; with modest performance, certainly, but adequate for cer- tain applications. Repurposing graphics processors A different solution is offered by NVIDIA, well known for its graphics processors. It has announced the marketing of the Tesla (Figure 3), a product intended for scientists. Here, a new generation of graphics processors (GPUs), the G80 (better known under the name GeForce 8800 Ultra), made up of 128 cores working in parallel, is repurposed from its original function (generating images), via dedicated software, CUDA, to exploit all its computing power and convert workstations into personal supercomputers. In this way, it is the manufacturer's intention to rival the current supercomputers by offering powerful calculating solutions at 'affordable' cost. NVIDIA will be offering its products in three forms: 1 . The Tesla C870: a PCI Express format card with a GPU using 128 parallel processors, and 1,500 MB of memory, allowing a power of 500 Gigaflops. - Mare Nostrum ( see photo): Built by IBM for the Barcelona Supercomputing Center. It reaches a speed of 94 Teraflops. - Dawning 5000: China has entered the field with this com- puter using 7,680 AMD Opteron quad-core processors running at 1 .9 GHz This is the fastest computer running under Windows HPC 2008. The official list of the 500 fastest computers in the world is main- tained by the TOP500 project [9]. 4/2009 - elektor 41 TECHNOLOGY SUPER COMPUTERS Figure 1. Roadrunner, the fastest computer in the world. Figure 2. A CELL processor in a natural setting. 2. The Tesla D870: this external unit houses two C870 cards and is connected to a workstation by way of a PCI Express card. Power: 1 ,000 Gigaflops. 3. The Tesla S870: this is a server with either four GPUs (i.e. a power of 2,000 Gigaflops) or eight (4,000 Giga- flops), depending on version. However, the prices — said to be between $1 ,300 and $12,000 — mean these products are still very much con- fined to large companies or research laboratories. Lastly, let's just mention Cray [4] which is coming back onto the scene by marketing the CXI at a price of $25,000. This is a workstation fitted with 1 6 Intel Xeon 4-core processors and running under the Windows HPC (High Performance Computing) Server 2008 operating system [5]. The secret of supercomputers' speed: their architecture Modern supercomputers are based on a parallel architec- ture that can be regarded as several powerful computers working at the same time, each performing one small part of the final calculation and linked together in a group by a communication network. Network specialists use the term 'cluster' to describe this type of organization. At the end of the line, one computer centralizes the results (Figure 4). This type of architecture has been made possible thanks to increased mastery of microprocessor manufacturing proc- esses, performance improvements, and reducing costs due to massive production. The architecture found in the most recent dual- and four-core processors fitted to the latest gen- eration of PCs is comparable, on a more modest scale. The communication network needs to have characteristics that match the performance of the system in order to trans- fer the incredible quantity of data processed quickly and without loss. For example, the Blue Gene L network is made up of 1,024 1 GB/s Ethernet adaptors. In addition, the operating system for these machines obviously needs to be powerful and multi-tasking. This is why supercomputers usu- ally operate with a UNIX operating system, or its general public version Linux [6]; but Windows too is beginning to make a place for itself I 5 1. Internal structure The vast majority of supercomputers are based on the fol- lowing principle (see Figure 5): - Several processors are integrated onto the same chip; - Several chips are fitted onto one board; - Several boards are built into the same cabinet. But the engineers designing these machines found them- selves confronted with one problem that is simple enough to solve for an office computer, but takes on gigantic pro- portions in this type of machine: cooling. Let's look at one concrete example. The TERA 10 supercomputer consumes around 1 .8 MW! Since consuming this much power inevi- tably involves very significant heating of the circuitry, so as not to affect system performance and to avoid malfunctions, the engineers have quite simply added a 2 MW refrigera- tion unit — so a total consumption of almost 4 MW for a single computer! Calculation grids and distributed calculation The growing number of computers being sold around the world, whether they are PC or Mac types, has given the engineers the idea for an original solution to the need to have access to substantial computing power: to get geo- graphically-separated computers to work in tandem, linked together by a super communication network. This virtual infrastructure is called a 'calculation grid' and 42 elektor - 4/2009 Building your own PS3 cluster For highly-motivated DIY-ers who want to build their own machine, the ps3cluster website shows the various steps that will let you create a cluster based on the PS3 games console. The software needed is free, so all you have to do is get hold of a few PS3 consoles. Here's a summary of these steps: 1 . Download, burn to DVD-ROM, and install the Linux-based 'Fedora' operating system. 2. Install the MPI (Message Passing Interface). This interface makes it possible to run remote computers running parallel programs in distributed-memory systems. 3. Install the CELL SDK (Software Development Kit) which pro- vides the resources needed to develop and compile programs for the CELL processor operating under Linux. www. p s 3 c I u ste r. o rg FlashMob Supercomputer A 'flash mob' is the gathering of a group of people in a public place to perform actions agreed in advance, before quickly dispersing. In the case of a flash mob supercomputer, the action agreed upon is to set up a cluster using computers brought along by the participants and measure its speed. In this way, the first flash mob supercomputer was set up in San Francisco in the USA in April 2004. Within a few hours, 150 computers (out of the over 700 computers available) were net- worked to achieve a sustained speed of 77 Gigaflops. This is still a long way from the performance of real supercomputers, but it did demonstrate the validity of the principle. The software used is available free from the website of the inventors of this 'game', all you have to do is burn it onto a CD-ROM (230 MB), boot up the computers using it, and con- nect them onto a network. www.flashmobcomputing.org The Beowulf cluster A Beowulf cluster is a calculation grid made up of cheap PCs. The system was originally developed by Donald Becker at NASA, but is now regularly used around the world in applica- tions requiring a large number of calculations. The computers usually operate under Linux or other free operating systems. A Beowulf cluster does not involve the use of special software, only the system architecture is defined [source: Wikipedia]. So it is possible to use any hardware platform to create a Beowulf system. One good example of this is the Furbeowulf, a cluster built around Furbies. A Furby is a little moving furry toy, fitted with detectors that enable it to hear sound, feel when you touch it, and see light; what's more, they can com- municate between themselves. The Furbeowulf runs under Linux Furby and doesn't really have particularly high perform- ance. Another handicap of this system is the fact that you have to 'feed' the Furbies, regularly, otherwise they fall asleep... www.trygve.com/furbeowulf.html www.beowulf.org rt7r *±Vt 4/2009 - elektor 43 TECHNOLOGY SUPER COMPUTERS Figure 4. Block diagram of a cluster. Figure 5. The principle of a supercomputer. Figure 6. The Jaguar from Cray. card card 1 1 1 1 1 card casing 090067-12 makes distributed calculation possible, where each compu- ter performs one small part of a complex calculation. Via the Internet (the super network in question), 'inter-soft- ware' manages the exchanges between the various units, thus giving the appearance of a supercomputer at work. Some very serious scientific programmes are using this resource. Let's mention principally: - SETI (Search For Extra-Terrestrial Intelligence) [7] which is trying to spot a possible message coming from an extra-ter- restrial intelligence within the incredible quantities of radio signals (generated by the stars) coming from space. - GIMPS ( Great Internet Mersenne Prime Search) [8] which is researching Mersenne prime numbers: prime numbers equal to a power of 2 minus 1 (2 X -1 ). Conclusion Quite apart from the technological feats that supercomputer represent, the competition between the big companies to design the most powerful computer reflects some important scientific stakes. Scientists around the world are counting a great deal on the capacities of these machines in order to advance their work. For the manufacturers, this competition is a fantastic showcase for their know-how and their skill in designing and producing powerful machines. Although the winner for the moment is IBM with its Roadrunner, a new claimant to the title has entered the race: is the Cray XT5 Jaguar (Figure 6, the name chosen by its designers speaks for itself...) going to be able to push the current limit still further? We'll find out the answer when the new official list of the 500 fastest computers in the world is published in June 2009 [9]. ( 090067 - 1 ) References, Notes, Internet Links [1 ] Roadrunner is the common name of the Greater Roadrunner (Geococcyx Californionus), a species of running bird that lives in the arid regions of North America (Texas, Nevada, Utah, etc.) It was made popular in the character of Beep-Beep, the hero of the cartoons produced by the Warner Bros studios. [2] www.ps3cluster.org [3] www.nvidia.fr/page/tesla_computing_solutions.html [4] www.cray.com [5] www. microsoft.com/uk/wi ndowsserver2003/ccs/default.mspx [6] www.linuxhpc.org [7] setiathome.berkeley.edu [8] www.mersenne.org [9] www.top500.org Anton Instead of using standard hard- ware to solve a complex prob- lem, it is also possible to adapt the hardware to the problem. This is exactly what's been done at the D.E. Shaw Research lab (New York, USA) in order to produce a specialized computer for molecu- lar dynamics simulations. The system, based on a home- made 8x8x8 3D grid of ASICs christened Anton' in honour of the 1 7 th -century scholar Anton van Leeuwenhoek, contains around 100 billion transistors and consumes a mere 100 kW. It seems that a prototype of Anton is operational, but has not yet achieved its maximum performance: it is intended to be up to 200 times faster than a supercomputer working on the same problem. www.deshawresearch.com 44 elektor - 4/2009 Electronics inside out! The free e-magazine about internet, computers, hacking, tweaking, modeling, gadgets, geekstuff, gaming and DIY electronics. The e-zine you have to check out now! Receive i-TRIXX in your mailbox FOR FREE V each Wednesday From the Elektor labs: Simple, useful and fun electronic circuits! Play the i-TRIXX Quiz and win! Test your knowledge about internet, computers and electronics. Take your chance now and play the i-TRIXX Quiz. There are great prices to win! Check i- TRIXX.com and subscribe now! Powered by MICROCONTROLLERS The 32-bit Machine Program development with the R32C sta rter kit Tek J"L D T rig'd M Pos: 0.000s 9 e .EUBR32C111-CARRIER-USB Ul.l ' R9 rU3 03 SJ-t SJ3 K . 1IHIH1HI1II W0 m. ^ * — P2 EL '_1_S v. ; si — i ■,-Te' 1 i v V o.oov Cursor 1 448ms 2.36V Cursor 2 ,00V M 10.0ms CRT 7 2.00V 27- Jan-09 14:33 22.5002Hz Marc Oliver Reinschmidt (Germany) Having introduced the R32C/1 1 1 32-bit microcontroller in our previuous issue, it's time to roll up our sleeves for some practical experiments. A keenly priced starter kit is the basis for our work with this controller. These pages will familiarise you with the tools required for programming and debugging. Those of you already familiar with the R8C/13 from Renesas will recognise plenty of similarity in the way all this is handled. The starter kit consists of an R32C carrier board (a microcontroller mod- ule equipped with the R32C/111 chip) and a software CD-ROM containing the necessary development tools. As with the earlier R8C/13 ‘Tom Thumb’ project in Elektor Electronics (November 2005 through March 2006), the R32C car- rier board is one of Glyn’s in-house developments. Glyn Jones GmbH & Co as the company is officially called is an authorised distributor for Rene- sas in Germany. With the attractively priced starter kit (available through the Elektor Shop) you get everything you need for your first hands-on experi- ments with the new 32-bit controller. The power supply is drawn from your computer via the USB connection, which simplifies things rather nicely. Figure 1 shows the circuit of the R32C carrier board, with the printed circuit board (PCB) in Figure 2. Placing the components on the PCB (upper photo) is pretty straightforward. On the left side are two LEDs (LED1 and LED2 on the circuit diagram). LED1 (green) indicates that power sup- ply is present. LED2 can be made to respond by software, being connected to the port P3_0. Being tied to V cc , this LED can be made to light up when pin P3_0 is switched ‘low’. The two LEDs can be uncoupled from these functions if you open the solder bridges SJ3 and SJ4. At the centre of the PCB is the R32C/111 positioned by its 64 pins. All connections are taken out to the con- nector strips along the edges of the board. Once you have soldered in the pin-arrays provided the board can then plug into a standard 64-pin IC socket. The PCB is also equipped with two crystals. The 12 MHz crystal is needed for the USB serial transceiver module from Prolific. This IC (PL-2303X) ena- bles the use of a virtual USB port on the PC for debugging or for simple 46 elektor - 4/2009 vcc vcc © I T " |C5 C6 ^OOn^^ OOn SJ7 0 -S c 0 O O 1— CM CM CM CM CM CM 1N4148 SI H RESET D1 14^ :.r vcc © 1" R5 Cl 3 • • • |C9 ^^OOn 8 17 Cl 2 pOOn pOu X 24 20 m m n < n n, n, n co 1 ! co IQ® I 5 Q > g RST > EE_CLK EE DATA TXD RXD U$3 osci OSC2 27 Q I 3 I 1 H 12IV 1 1Hz J[ 19 13 14 i- T [22011 X JP5 MD1 — < 1 ll O R12 1 I V 1— T 0 - 1 1 R16 12 22 R17 I o I o I Q1 8MHz C2 22p Cl 22p R8 ,_X © vcc 23 26 25 18 28 1 CIO lOp SJ6 SJ5 VCC 1 ^^00n Cl 5 VCC © LED2 R6 — | 10k 1-T R13 SJ4 -a 0 - o o- ^o-*- *L=o-s. i°-o— !® 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 A L _ 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 32 U$2 DIL64 II 4^7 VDC1 VDC0 NSD TB3IN/P93 CNVSS AVCC XCIN/P87 U$1 VREF XCOUT/P86 AN0/P100 RESET AVSS XOUT AN1/P101 VSS AN2/P102 XIN AN3/P103 R32C111 vcc AN4/P104 NMI/P85 AN5/P105 INT2/P84 AN6/P106 INT1/P83 AN7/P107 INT0/P82 AN00/P00 U/TA4IN/P81 AN01/P01 U/TA4OUT/P80 AN02/P02 TA3IN/P77 AN03/P03 TA30UT/P76 INT3/P15 W/TA2IN/P75 INT4/P16 W/TA20UT/P74 INT5/P17 V/TA1 IN/P73 AN20/P20 V/TA10UT/P72 AN21/P21 TB5IN/P71 AN22/P22 TA0OUT/P70 AN23/P23 TXD1/P67 AN24/P24 RXD1/P66 AN25/P25 CLK1/P65 AN26/P26 CTS1/P65 AN27/P27 TA1IN/P33 TB0IN/P60 TA10UT/P32 TB1IN/P61 TA30UT/P31 TB2IN/P62 TA0OUT/P30 TXD0/P63 lOOn LED1 POWER 080928-11 Figure 1. Circuit diagram of the R32C/1 1 1 carrier board. inputs and outputs. The second crystal is provided for the R32C. In fact an actual crystal is not crucially necessary, given that the R32C contains its own internal 50 MHz oscillator, but for best stability over wide temperature ranges a crystal is inevitably better, particularly for appli- cations where time-critical accuracy is vital. Right next to the crystals is Jumper JP5, which is used to switch between programming mode and run mode. Like all other Renesas microcontrollers, the R32C is equipped with an internal boot loader, which makes program- ming via the serial interface possible. This mode is always operational when this jumper is set, meaning that the CNV SS pin is at V cc level and a Reset has been called. When you remove the jumper, the CNV SS pin is taken down to GND via a pull-down resistor. Fol- lowing a Reset or Power-up the pro- gram that has been loaded is executed automatically. To the right of the jumper is the Pro- lific IC mentioned, connected to the Mini-USB connector. The push-button directly next to the connector is the Reset switch (SI). Monitor and debugger As supplied, the R32C carrier board comes with a monitor program already loaded into flash memory. What does this mean in reality? Let’s take a look at the various methods of getting a project up and running. The more complicated and demanding a project is formed, the more necessary it is for the developer to be able to see what’s actually going on inside the system. It’s often inter- esting to see which values the varia- bles have assumed or which registers have been set, which way the program is going following a polling request or branching — or simply where every- thing is hiding out. If we were to burn our program straight into the chip, we would have very little access to these parameters, for which reason we use a so-called Figure 2. Component placement and track layout of the PCB. 4/2009 - elektor 47 MICROCONTROLLERS Figure 3. The Windows control panel reveals the number of the virtual COM port. Figure 4. Setting the COM port and the baud rate in the KDlOO's initialisation window. Figure 5. This window indicates that the debugger is linked to the carrier board. debugger (debugging software). There are a number of approaches, according to the budget available. Here we shall look at the simplest solutions: the E8a Debugger, a low-cost hardware tool (see inset), and the software solution using a monitor program and KD100 software. Since it is provided on the CD in the starter kit, the KD100 software debug- ger from Renesas is worth close inspec- tion. Fans of the R8C13 should pay attention here. In its time the R8C13 used the old KD30 debugger, which bears a strong visual resemblance to the KD100. Skill sets built up with the KD30 can be re-used with the KD100. In contrast to hardware debuggers, the KD100 requires a monitor program to be loaded separately into the con- troller. This monitor program takes over the complete debug function and, as with the R8C/13, controls data exchange via the serial interface. The application itself then runs as a kind of sub-program of the monitor. At this point we should explain that we have resorted to using some ‘special’ pro- gramming techniques to deal with the vector tables. The reason is this. Operating the KD100 means that two programs are running in parallel within the controller: the monitor and also our application pro- gram. Both programs operate with vec- tor tables, which are necessary for exe- cuting the interrupts. As a rule these tables exist only once, but not in our situation. We therefore need to shift or displace the vector table of our appli- cation program so that after each inter- rupt, the microcontroller can access either the vector table of the monitor or that of the application program. The debugger requires the interrupt of the UART1, to make debugging poss- ible at all. As a result this interface is unfortunately unavailable for other uses. We shall put up with this sacri- fice and turn our attention to the other UART interfaces. The only way we can make all of our UARTs available with- out restriction is if we flash our appli- cation program directly and do without any debugging. First signs of life That’s enough of theory for now. Let’s hook up the board to the PC the sim- ple way, using the USB connection. The Prolific transceiver announces its presence with the Windows message ‘New Hardware Found’ and once we have loaded the driver from the CD supplied, Windows provides a virtual COM port. At this stage it is important to note which number is assigned to the port. The simplest way of check- ing this is to look in Windows Control Panel under the heading Hardware (Figure 3). This done, we can now launch KD100 (assuming you have already installed this on the PC). In the initialisation window (Figure 4) we select the COM port and the baud rate. Under MCU you can select the corre- sponding microcontroller family. Now we should check once again whether jumper JP5 on the carrier The E8a debugger The E8a is a hardware tool for all microcontrollers of the Ml 6 family from Renesas (R8C, M16C, and R32C), with which you can both flash and debug microcontrollers. The E8a is hooked up to a PC using the USB link plus a 1 4-conductor flat cable connected to the appli- cation. The 1 4-way connector provides the interface to your hardware. Apart from a few resistors no other components are needed. For applications that do not require much current the E8a can supply up to 300 mA via the USB port. The voltage can be set at your choice of 5 V, 3.3 V or 1.8 V. The E8a's debugging software is integrated in the Renesas development environment HEW, meaning that throughout production of a project only one development environment is used. This makes operation extremely simple and fast to learn. Key characteristics: • Usable across a broad voltage range from 1 .8 to 5 V. • Debugging with HEW. • Ideal programming tool with the gratis Flash Development Toolkit. • Hardware and software break points. • Software tracing available. • Compact, cost-effective and convenient. • Usable also for on a production basis. 48 elektor - 4/2009 KD1OT - fdt Umm (MDratrt Dofe-s OpOori H nra »v»» n C«a^rdM * * V 1 «l * * in ■no J C^r **vm PM V " Pio*r«n Window £ s □ 1 Ivn- Rddress BRK PASS Obicode Label Mnemonic FFFFBB08 - LDC 08800000011. ISP FFFF00DF 3FFR6884M l DC MOOO00080H. FIG FFFF0OE4 3FER8C0OO LDC HO0OO070OH. SP FFFTBBEB - 3FEAE8800 LOC N0OO0O400II. SB FFFF0OF0 - 4088 FSII B FFFF00F2 - 3FERE8008 LOC NOO800400H , SB FFFF00F7 • 4C88 FCLR B FFFF00F9 - 3FER2C007 LOC 00FFFF 7B00H. 1HIB FFFF01O0 - 10 MOV.B HOOH. R0L FFFF0101 B2AC0064O MOV.L HOOQ00400H. 01 f f FF 0107 B26C80OOO MOV.L H0OOO0000H. R7R5 FFFF010D - D4G8 SS1R.B FFFF01OF - 10 MOV.B HOOII. RBL FFFF011O B2AC0O640 MOV.L NO0O0O400H. 01 FFFF0116 MOV.L MOO000000H. R7R5 FFFF011C - D408 SSTR.B IFFF011E 10 MOV.B HOOH, RBL FFFF011F - B2RC804MM MOV.L HO0000O00H. 01 FFFF0125 - 826088888 MOV.L NOO000O00II. R7R5 FFFF012B - D408 SSTR.B FFFF012O 10 MOV.B NOON. RBL FFFF012E - B2RCO0O08 MOV.L HOO80O000H. 01 FFFF0134 - B26CO8OO0 MOV.L NO0O00000II. R7R5 FFFF 013FI - D408 SSTR.B IFFFB13C • 10 MOV.B HOOH. RBL FFFF013D B2RC 06640 MOV.L NO8880400H. 01 FFFF0143 B26C00800 MOV.L K0OOO00OOH. R7TTS 1 WIMIUU1H | pin.. 1 . i « IRM i 1 »*«•] fRwi 0 m< | B« 1 Rddress Label Register »8 ♦4 ""♦5 ^ nscTl FFFFFBO0 FD627F2C ER3F7F38 3F7F34C0 7T38FDE0 . .07.4?. .8. FFFFF8E0 00618840 4DB17F3C 20B17F4B 60617F44 N,..<. M8..-0. .■ FFFFFBF0 8061 Tf 48 C0B17F4C OOB17F5B ED617F54 H . L. P...1.. FFFFFC80 8082 IF 58 RDB27F5C CDB27F60 E0627F64 X. ,.\, . . . . .d. . . FFFFFC10 E83F7F68 3F7F6CCD 7F70EDEO F03F884C h.?. . 1 .?. .p.L.?. FFFFFC20 3F7F8420 7F884DFA 8C0DE03F 80063F7F -. .?.M. .?. . . .7. . FFFFFC30 3F03/F90 7F 940006 0OO63FB7 3F0F 7F98 ..? ? ? FFFFFUO 7F 908006 0DO63F 1 1 31 1F7F00 7F 04 0006 ? ?.... ins' FFFrrcse 0OA63T02 3F0fi7F«8 7TRC8Dfl6 0W63T12 .? ? ?. NtlBC Value R.. PC FT FI 0008 H R0 0000 H. R1 0000 H. R2 0000 H. R3 0000 M R4 0000 H R5 0000 H_ R6 0000 H. R7 0000 H. 00 00000086 H. 01 00000004) H. 0? 00000004) H 03 00000004) H. SB 80888888 M FB 00000004) H. USP 00000004) H. ISP OBBOflflOO H. 1NIB 00000804) H SVF 00000000 H. SVP 00000000 H. VC1 00000000 H. DHD0 00000800 M. DHD1 00000000 H. DHD? 00000004) H., DM03 00000004) H DC 10 00000800 M. DCT1 00000000 H. 0CT2 00000000 H. 0CI3 00800000 H. DCR0 00000000 H. DCR1 0000O00O H. DCR2 00000000 H DCR3 00000000 H DSO0 00080000 H DSfll 00000000 H. DS02 08000000 H 0S03 00000008 H. I1SR0 00000004) H 0SR1 00000800 It. DSR2 00000800 H. ncR't 00000004) H RND DP IPL F0 FUUI 0BSZDC 0 8 0 0 0 00000008 MQ0i fit* Qrr in- 4| « Oiai Figure 6. The KD100 on the screen. The monitor file is loaded and the controller is ready to respond. board is open-circuit and press enthu- siastically on the reset button. Follow- ing a click on ‘OK’, the debugger now links up to the carrier board. We can confirm this is happening in the fol- lowing window (Figure 5), in which the debug parameters remain to be defined and the microcontroller unit status can be read. After a further click on OK the KD100 signs on (Figure 6). This confirms that the controller is functioning properly and can be activated, also that the monitor file can now be loaded. Only one further program needs to be loaded and tested for now. For speed and simplicity we will use a ready- made sample project for taking our first steps with KD100. We can experiment with a project of our own afterwards. All necessary files are provided on the starter kit CD. For debugging we need to load a debug file into the controller. With the KD100 the protocol is File -> Download -> Load Module, at which stage we look for the file X30 in the Debug folder of the Workspace Project and load it using the KD100. The tension mounts as the code is loading and when this is complete, the yellow cursor halts at the address FFFF00D8h (see Figure 7). And when you click on the control panel Go (upper left), the red LED on the board starts to flash — the program works! SineWave Now it’s time to write a program of our own. Our mission is to use the R32C as a simple sine wave generator — which is why we have named our first appli- cation program ‘SineWave’. All necessary resources are integrated in the Renesas development environ- ment known as the High-perform- ance Embedded Workshop or HEW for short. The HEW is a top level ele- ment, a so-called front end combining project management, Editor, Compiler, Assembler and Debugger. The benefits are clear: there’s only one top-level ele- ment to come to terms with — and this does not take very long really. If you have installed HEW from the CD and launched it by hitting Start -> Pro- gram -> Renesas -> High-performance Embedded Workshop, you are offered the choice of opening an existing project or else creating a new one. We’ll opt for starting a new project. Using the ‘Create new workspace’ command we will shape this project for the R32C (Figure 8). A quiet word in your ear (sirrah): even in this era of modern operating systems it still makes sense to avoid the use of special symbols and long path names. These can confuse the compiler on occasion, making the hunt for errors afterwards extremely slow and tedious. In the next step you need to select the precise type of microcontroller accu- rately. Here this is the R32C/100 and the Group is 118. This includes the R32C/111. The other parameters on the following pages can be re-used with- out alteration. Now comes the programming of the simple sine wave generator, for which the D/A converter included with the R32C is extremely handy. The D/A converter employs a simple 8- bit R-2R network (Figure 9), in which Figure 7. A click now on Go — and the red LED on the R32C board flashes! 4/2009 - elektor 49 MICROCONTROLLERS Figure 8. Workspace set-up for the sinewave generator project. Figure 9. The integrated D/A converter uses a simple 8-bit R-2R network. a digital value is transformed into an analogue output voltage. The output voltage can lie within the range from AV SS to V REP The AV SS pin (pin 59) is linked via SJ2 to GND and the V REF pin (pin 61) via SJ8 to VCC. Depending on how the DAO register is defined the output voltage on the DAO pin varies according to the following formula: VREF X n V = 256 (n = 0 to 255) VREF = reference voltage Now for the programming. To make use of the D/A converter we first need to activate the output. We do this by set- ting the register bit ‘daOe = l\ Now we can connect up the ’scope to the out- put pin, in this case being pin 63 on the carrier board. So that our output signal can represent a sine wave curve, it’s necessary to integrate the library (see Listing 1). The file sfrlll.h integrates the Spe- cial Function Register with the code written in C. The function hwsetup.h embraces all the functions that are nec- essary for configuring the clock-unit of the microcontroller. The actual program is set out in the annexe below. To produce a variable frequency, the frequency output is executed within a Timer Interrupt Routine. The period duration is calculated using the short function void set -frequency (unsigned int fre) and passed to the timer for use as the timebase. Calculation of the sine values takes place in increments of 0.2. This is a compromise to achieve fine signal resolution without being forced to calculate an unreasonable number of values. With the floating point unit (FPU) enabled a frequency of up to 3 kHz can be produced, which is quite impressive for this number of sampling points. The default values run from 0 Listing 1 #include "sfrlll.h" #include "hwsetup.h" #include // Interrupt declaration #pragma INTERRUPT TimerA0_int // functions void Init_timer (void) ; void set_f requency (unsigned int fre) ; // globals float y; unsigned int speed; / / main function void main (void) { Conf igureOperatingFrequency ( ) ; // init oscillator and pll da0e=l; // enable DAO converter set_f requency (2500 ) ; // set sine frequency (Hz) Init_timer ( ) ; // init timer for frequency calculation while (1); // endless while loop } / / +++++++++++++++++++++++++++++++++++++++++++++++ / / ++++++++++++++++ set_f requency ++++++++++++++++ / / +++++++++++++++++++++++++++++++++++++++++++++++ void set_f requency (unsigned int fre) { speed= 24000000/ (fre* 3 0.75) ; // timer base div output frequency } // divided by DAC steps / / +++++++++++++++++++++++++++++++++++++++++++++++ / / ++++++++++++++++++ Init_timer +++++++++++++++++ / / +++++++++++++++++++++++++++++++++++++++++++++++ void Init_timer (void) { ta0mr=0x00; // Timer mode, f8 @ 20MHz PClock ta0=speed; // Timer reload register asm (« FCLR I») ; // Disable all interrupts ta0ic=0x03; // Set timer interrupt level to 3 asm(«FSET I») ; // Enable all interrupts ta0s=l; // start Timer A0 } / / +++++++++++++++++++++++++++++++++++++++++++++++ / / ++++++++++++++++++ Interrupt ++++++++++++++++++ / / +++++++++++++++++++++++++++++++++++++++++++++++ void TimerA0_int (void) { y + = 0 . 2 ; // sine signal steps if (y> = 6.28) y = 0 ; // set to 0 if 2pi reached da0= ( 128*sin (y) ) +128 ; // calculation of sine (offset by 128) 50 elektor - 4/2009 to 271 (0.628) and are then reset once more to zero. In this way a complete sine wave period is calculated. All that needs be done now is to shift the sine wave upwards, as we don’t want any negative values to be out- put by the D/A converter here. This off- set is achieved by adding + 128 to the resulting value. After loading the program into the controller you can connect an oscillo- scope to DAO (pin 63) and if you do, the result is the sine wave signal shown in Figure 11. ( 080928 - 1 ) Internet Links www.glyn.de/r32c http://eu.renesas.com/fmwk.jsp? cnt=r32cl 1 l_root.jsp&fp=/products/ mpumcu/ml 6c_family/r32cl 00_series/ r32cl 1 l_group/ Figure 10. Test set-up with the carrier board. No additional parts are needed for this sine wave generator; just make the USB connection and hook up the probe to pin 63. Advertisement uri. ^ re Sensors Bring your project to life with Parallax sensor modules. Collect data, detect objects and motion, navigate autonomously, respond to environmental changes, enhance human interaction, and more. www.parallax.com z n 1 " 4 a. oi o r Milford Instruments (+44) 1977 683665 http:/ / www. milinst.com 4/2009 - elektor 51 CONTROLLER Development by Chris Vossen Our May 2008 issue featured a very straightforward graphical control and measurement device using the compact M16C Display Board and its built-in BASIC interpreter. Readers who prefer programming in C can also use the design if they build this mini circuit and download some free software from the Web. To begin: The M16C Display-Board [1] (Figure 1) from Elektor comes preloaded with a TinyBasic Interpreter [2] . Readers who are happy to carry on using TinyBasic — for educational and experimentation purposes or perhaps because they have already developed some handy programs for the board — need not read the rest of this arti- cle. That’s because flashing the micro- controller with a compiled C program (as we shall do) overwrites the BASIC interpreter. No worries if you do this by accident, because we can reprogram the Interpreter as part of our after-sales service (for a modest charge). Coming back on-topic, this article is aimed at the readers who do not need the TinyBasic-Interpreter and prefer to program in C. We have a shortcut for these readers as well! Many of you are already familiar with the well-known R8C microcontroller and the M16C version [3] we’re using for this project is really just a kind of big brother of the R8C. In fact the M16C is nothing more than a beefed-up ver- sion of the R8C, sharing the same core. In contrast to the R8C, however, the M16C uses a 16-bit wide Bus between core and peripherals, being also inte- grated with a DMA Controller. Consequently the powerful advan- tages of the smaller 16-bit devices, which we have already discussed in the context of our major R8C project [4], apply equally to the M16C. Even better, there’s a cost-free, yet Figure 1. The M16C Display Board is an entry-level solution for monitoring, control and measurement with a graphic output. 52 elektor - 4/2009 extremely powerful C compiler. No extra programming device is neces- sary because it can be flashed very simply via the RS-232 interface. Even better, the Elektor website contains a project page [4] plus a well frequented forum [5] that’s full of listings, answers to queries, and tips and tricks for this popular controller! Software Pain always precedes pleasure so we must first install the software before we can start to enjoy the delights of programming. This means stick- ing rigidly to the prescribed order of tasks. First we must install the Moni- tor/Debugger (KD30) and after this the C Compiler (NC30) with the develop- ment environment (HEW). Installing the Debugger first enables the HEW to tie in with it properly. The next instal- lation task is the Debugger package, in order to integrate the Debugger into the IDE. After this, all you need do is boot up the HEW and you’ll have everything visible on the screen. Last of all we must install the Flash Devel- opment Toolkit (FDT) from Renesas, used for loading finished programs into the Controller. The Renesas software can be down- loaded conveniently from the Elektor website — the noted distributor Glyn [6] has kindly compiled this package especially for this project. The project page for this article [7] contains not just downloads but also an installa- tion manual. Circuitry The M16C contains an integrated Debugging interface that handles both synchronous and asynchronous Ports. The asynchronous mode is par- ticularly simple to use because all we need do is match this to RS-232 levels. For this we use a couple of transistors, with our old friend the MAX232 also making an appearance in this circuit. The CLK input of the ICs must be tied to ground whenever asynchronous mode is employed. The hook-up (see Figure 2) is really very simple. The PC is connected to K1 and the Display Board to K2. A piece of 10-way flat ribbon cable is ideal for this purpose, equipped with the necessary connec- tors (pins connected like-for-like or 1:1). The ‘CNVss’ and ‘CE’ pins deter- mine what the processor does after applying operating voltage or a Reset command. If both are logic High, then +5V O K2 O O o O o o 10 si M C2 1 u 16V 11 C4 1 u 16V _10 12 CM Cl 1u 01 16V C1+ a a > IC1 vcc C1- T1 IN T10UT T2IN T20UT R10UT RUN R20UT R2IN C2+ MAX232CPE C2- m GND LU > CO C5 ■01 1u 16V +5V O 16 14 7_ 13 8 15 C3 1u 16V GND 080422-11 Figure 2. Just a handful of components is all you need for our programming interface. the Processor starts up in program- ming mode. If the CNVss pin is low, the application software licks into action (we use a jumper plug to set the CNVss pin to either logic High or Low). Without the jumper, the input is taken to ground via a 10 kQ resistor. To put the device into programming mode the jumper JP1 must be in place and then the Reset button pressed. After the application software has been flashed, the jumper is removed again. Follow- ing a second push of the Reset button the program will begin. Your first project When you start up the ‘High-perform- ance Embedded Workshop’ a selec- tion window appears, with a choice of starting a new project or loading and existing one. The command ‘File/Open Workspace’ opens an existing project. To try this out you can use our test pro- gram, which you can download from the project website [7]. Opening this displays all the files that belong to the project. The source text is in the file that ends in .c (see Figure 3). Before compiling you are asked whether you wish to produce a Debug version or a Release version. For the Release version choose ‘Build/Build Configurations’ and select ‘Release’. You can now start the conversion with ‘Build/Build AH’. The C source code is translated, linked and written as a .mot file in the example directory \Release. The whole process is listed below in the Build window. After all this you will hopefully see the desired message: Build Finished 0 Errors, 1 Warning. The alert message ‘ Warning (ln30): License has expired, code limited to 64K (10000H) Byte(s )' is nothing to worry about, by the way. Although the free version of the compiler is lim- COMPONENTS LIST Capacitors C1-C5 = ljL/F 16V Semiconductor IC1 = MAX232CPE Miscellaneous K1 = 9-way sub-D socket (female) K2 = 1 0-way AMP Micro-MaTch connec- tor, PCB mount JP1 = jumper SI = press-button switch PCB, ref. 080422-1 from www.thepcb- shop.com 4/2009 - elektor 53 CONTROLLER Figure 3. Here's a shot of the development environment HEW. ited to 64 kB, this should be more than enough for most projects! Time to fire it up! The ‘Flash Development Toolkit’ is the way to load a completed program into the Controller. The program comes in both a complete version and also in a compact ‘Basic Version’, which will suit most purposes. Starting the first time you will need to enter the necessary settings (you can alter these later using the menu via ‘Options/New Settings’). Next, select the Controller type (M30291) and the upper of the two Kernel protocols offered (see Fig- ure 4). The next window is for selecting the interface to be used. The third window requires you to enter a Baud rate for the link to the Con- troller (select 9,600 baud). Now we link up the M16C Display Board to the pro- gramming interface and to the interface with the COM port indicated. Insert jumper JP1 and give the Reset but- ton a short push. The micro- controller is now in Boot mode and waits for you to give it some data. Programs in Motorola-Hex-Format (note the .mot file suffix) can be loaded into the Controller direct. Having indicated the path to these files, you can start the loading process with the com- mand ‘Program Flash’. The whole thing takes just a couple of seconds. First the Flash is cleared, then the new program is transferred. If all goes well, a ‘suc- cess’ notification will appear. Remove jumper JP1 and operate the Reset but- ton briefly. And that’s it — your pro- gram is up and running! (080422-1) Note TheM16C Display Board 'Display-Computer' is available in the Elektor Shop as item no. 070827-91 [1]. Choose Device And Kerne! - SP **£***** CJ device ltnaq m J Target files LCD, mot Li3 Kayb&ird.n- 1 jjrnms.mot Motor Control I Device ! maac ■ _j rarest files 1^3 Drive. mot i -jl D-pta i mot Ahjr""- 1 ' • i 41 ' r ^ Ji Ff in. The FLASH Development Toolkit supports a number of Renesas FLASH devices. Select the device you wish to use with this project from the list Select Device: M30231FC ! Other... F'rotocol Compiler Kernel Path Kernel Version D FoUSB embedded C AProgram Files\Renesas\FDT3 .A Ken 1_0_00 ■ Protocol Compiler Kerne! Path Kerne! Version D Renesas embedded C:\Program Files\Renesas\FDT3.4\Ker 1_0_00 sir L Back Next > Cancel Figure 4. The free-of-charge Flasher FDT enables you to set the type of Controller device. Web Links [1] www.elektor.com/products/kits- modules/modules/display-compu- ter-(070827-91 ). 4261 30. lynkx [2] www.tinybasic.de [3] www. ml 6c.de [4] www.elektor.com/maga- zines/2006/january/the-r8c-fam- ily.5801 1 .lynkx [5] www.elektor.com/forum/ elektor-forums/archive/r8c-l 6- bit-micro-starter-kit-(february- 2006).! 64479. lynkx [6] www.glyn.de (click on English flag) [7] www.elektor.com/080422 [8] http://en.wikipedia.org/ wiki/Ml 6C (M16C); http:// en.wikipedia.org/wiki/R8C (R8C). 54 elektor - 4/2009 MINI PROJECT For our Mini FM Receiver Ton Giesberts (Elektor Design Labs) In February 2009 we published a monaural mini FM receiver. A matching stereo decoder will naturally make this receiver complete. In this mini project we deploy an 1C for this purpose. This 1C has been available for quite a few years already and has by now amply proven its capabilities. The VHF FM radio published last month (Elektor February 2009) has a mono output only. At the time we mentioned that it was also possible to make a stereo version and that we would describe the details in a future mini project. Promise is debt, so hereby we present a stereo decoder which is intended to be used in combination with our FM radio to make a stereo FM receiver — a kind of ‘upgrade’, if that’s okay with you. BLEND Vp Figure 1. In this block diagram we see the internal design of the TDA7040. Old but not yet worn out The stereo decoder we use here is a TDA7040T made by NXP (formerly Philips Semiconductors). The design of this chip has not changed since 1986 (!). This IC, just like the chip in the receiver, is now only available in an SMD version. The old, familiar DIP package is no longer produced. Just as with the FM radio, we have also designed a miniature PCB for this circuit to make building much easier. We have attempted to make the PCB as small as possible. The result of this is that SMD parts have been used as much as possible. The only through- hole components are a few electro- lytic capacitors. As a consequence the dimensions of this PCB are only 2.5 by 4 centimetres (approx. 1 by 1.6 inches). Signal processing The decoder works according to the PLL (phase locked loop) principle and 4/2009 - elektor 55 MINI PROJECT Figure 2. The schematic of the decoder does not differ much from the test circuit in the data sheet. hardly requires any additional compo- nents. Figure 1 shows the block dia- gram. You connect the output from the tuner (via a filter) to the MPX input of the chip. After amplification and filter- ing the signal is split into three. First, there’s with the pilot tone detec- tor. This determines whether we have a stereo signal and operates the (inter- nal) mono/stereo switch accordingly. Switching to mono can also be done manually, with SI, but that’s an aside. From the filter the signal also goes to the PLL, which con- sists of a phase detector, a voltage controlled oscillator (VCO) and a divider. The out- put of the divider comprises the frequencies that are used to decode the stereo informa- tion. This decoding is done in the third and final block to which the filtered signal is sent. The (stereo) audio signal finally leaves the chip via two buffers. To make the signal suitable for driving headphones or two small loud- speakers, we use a TDA7050T. This is a small amplifier IC that, at a power supply voltage of 3 V, can deliver two times 5 mW into 32 ohms . Circuit The entire schematic for the circuit can be seen in Figure 2. The design differs only slightly from the example in the data sheet, and just like the circuit for the receiver, there is not much scope for improvement here either. K1 of the decoder is connected to K1 of the receiver, and K3 is connected to K2 (the circuit also works without this connection). The mono/stereo switch SI is connected to K2 (even though Figure 3. The decoder PCB is not much bigger than the receiver PCB. the schematic only shows SI, this is actually K2). Output K4 is intended to drive headphones with an impedance of 32 Q or more, but for testing you can also connect a couple of small loud- speakers. Output resistors R7 and R9 protect the outputs of IC2 against over- loading. R8 and RIO ensure that Cll and C12 are always charged so that a switch-on plop is prevented when the headphones are plugged in. The output power of the TDA7050 is inadequate for serious use with loud- speakers, and it would be better in that case if you used an additional power amplifier. The stereo potenti- ometer for the volume control (P3) is connected to a 6-way pinheader. If the wires are kept short there is no need to use screened cable. All connections are imple- mented as pinheaders. But you can also insert the wires directly into the correspond- ing holes and solder them. Because the use of pinhead- ers also allowed the use of other through-hole compo- nents, we used ordinary radial electrolytic capacitors. These use a little less space and are generally of a better quality than their SMD coun- terparts. Make sure you take note of their maximum diam- eter (is shown in the parts list). The component overlay is shown in Figure 3 and the copper track layout can be down- loaded from the Elektor website. At 6 V the total current consumption of the receiver and decoder together is a little higher than at 3 V: 17.3 mA instead of 12.5 mA. For testing we connected two 8 Q loudspeakers to the outputs. The current consumption at highest volume peaked at 70 mA. 56 elektor - 4/2009 The average was a lit- tle over 40 mA. You will have to decide for your- self whether you would like to use two or four penlight batteries. If you use four you will get more from the batteries because together they will only have to sup- ply a minimum of 2 V (minimum power supply voltages for the stereo decoder and receiver are 1.8 V and 1.6 V respec- tively). During testing it was found that the tuning is a little more dependent on changes of the supply voltage when the voltage is low than when it is high. Correction To ensure that the FM radio works correctly with the decoder mod- ule, a small correction needs to be carried out: C15 and C16 must be removed and a 100 pF capacitor must be con- nected between pins 14 and 15 of the IC. If you use a 0603 size SMD capacitor for this, it can be soldered directly between these two pins (see Figure 4). The reason for this modi- fication — which is nec- essary because without it the decoder won’t work — is that the output filter in the receiver no longer needs de-emphasis (Cl 5) and also requires less gain (C16). In its place Figure 4. A few changes have to be made to the receiver board, such as fitting a capacitor between the pins of the TDA7021T. the filter is changed to a second-order low-pass type with a bandwidth of about 53 kHz. This bandwidth is necessary to pass the entire multi- plex signal (AM modula- tion at 38 kHz with a sup- pressed carrier) to the stereo decoder. Calibration In the stereo decoder the multiplex signal is accentuated with a pas- sive network (P1/R1/C1) and must be adjusted for optimal channel separa- tion (the first of two cali- bration points). An incor- rect setting for PI means either a mono sound- ing sound or the effect of a stereo base width control. With the latter the mono information is suppressed more and the stereo effect sounds somewhat exaggerated. The best setting (with- out test equipment) is somewhere in between. This, of course, requires a good stereo broadcast signal and ditto music. The second calibration is also easy to do. With a strong signal, the cor- rect setting for the VCO can be found by turning P2, midway between the positions where the decoder switches to mono. ( 080907 - 1 ) COMPONENT LIST Resistors (all SMD shape 0805) R1 = 47\, jrfT* * >.io TGI* Ml V IBJ t E ILJ I Jlkl L .V! J ' |'.*,L J I .-.’.jJ VTflrt I L'.l J J f. h. L I '■ Jl P. J L J. K HX'i 1 - 4/2009 - elektor 61 MICROCONTROLLERS A digital storage oscilloscope based on the Mega88 Wolfgang Rudolph and Burkhard Kainka (Germany) Although oscilloscopes are less expensive now than a few years ago, we can devise something even more economical. Our ATM18 project gives you everything you need for a simple oscilloscope, and even if you already have a 'scope, the ATM18-digiscope is a welcome addition. Many of our readers can doubtless remember how EEGs and ECGs were recorded not all that long ago, using an instrument fitted with moving pens to trace curves on a sheet of paper trav- elling at a constant speed. This instru- ment made it possible to observe time- varying electrical signals. As electron- ics specialists, we have something in common with medical specialists: we cannot see or hear currents or volt- ages, although we can feel them if they aren’t too weak. Our problem is that we work with something we can- not perceive with our five senses. The first attempts to display and record voltages date back more than 150 years. The earliest oscilloscope was an electromechanical instrument. It was coarse, insensitive and slow, but it could make voltages visible. With the invention of the cathode ray tube by Karl Ferdinand Braun, the mechanical oscilloscope yielded to the electronic version, which embarked on a trium- phant career that only now, after more than 100 years, is slowly coming to an end. The seventh sense Voltmeters are unquestionably useful instruments. However, in most cases we are dealing with AC voltages or time-varying signals. With a video signal, for example, a simple voltage measurement is not of much use. We have to see the course of the signal over time in order to decide whether it is OK. Even signals at relatively low frequencies, in the audio range, can only be viewed with an oscilloscope. When you’re used to working with a ‘scope, you also use it to measure DC voltages, and in many cases you notice that your DC signal also has some sort of AC component. Nowadays there are basically two types of oscilloscopes: beside the tried and true analogue instruments, we encounter digital oscilloscopes more and more often. Analogue With an analogue oscilloscope, the signal is first amplified by an adjust- able amount and then used directly to deflect an electron beam. The simplest types have only one channel and can thus display only one signal. However, we often need to compare two or more signals. A dual-channel oscilloscope is currently the most common type, and such instruments are affordable even for electronics hobbyists. The bandwidth of the instrument is important. It specifies the maximum signal frequency that can be displayed. Time-varying signals with a frequency no more than 10% of the bandwidth of the oscilloscope are represented faith- fully. Another important factor is the triggering capability. Here you can chose a positive or negative level for starting the display. With a variable time base, you can display the signal stretched in time. Analogue oscillo- scopes are best suited to displaying periodic signals, which means signals that constantly repeat themselves and thus appear as an essentially static image. Digital A digital storage oscilloscope, or DSO, uses an analogue-to-digital converter to digitise the input signal and stores the digital values. It can thus display instantaneous samples of a signal and one-time events. Especially with dig- ital circuitry, it is often helpful to be able to study the stored signals after- wards at your leisure. Nowadays the stored signal is presented on a liquid- crystal display, and it can be edited and printed out as desired. An important factor with digital oscil- loscopes is the sampling rate, which specifies how often the signal is dig- itised. For good representation of the measured signal, the sampling rate should be ten times the signal frequency. 62 elektor - 4/2009 ATM1 8 Scope [TOT |Tigga* ♦ _^J f~ _fl 1 20 rwiAJv | Chi 0...5V w | |Ch2 0...5V ^ | The storage depth and A/D converter resolution are also important factors. An oscilloscope with a resolution of 8 bits and a 1024 x 8-bit storage capac- ity can store 1024 samples. This corre- sponds to a display with a resolution of 1024 x 256 pixels. Various methods are used for conver- sion and storage. Simple (older-model) oscilloscopes use CCD memories. With this arrangement, the measured signal is first stored in analogue form and then digitised. This results in a high noise level, limited storage depth, and dead times, since converting the meas- ured signal from the analogue memory to digital form takes longer than stor- ing the signal. More expensive (and more recent) models convert the measured signal to digital form in real time and store the measured data directly in work- ing memory. With this arrangement, the storage depth is only dependent on the amount of memory available. Especially fast DSOs use A/D convert- ers with sample-and-hold stages. Sig- nal samples can be stored in several sample-and-hold stages and then digi- tised by slower A/D converters. DIY The ATmega88 can be used to put together a nice little digital oscillo- scope. A project of this sort always arouses the desire for more channels, more bandwidth, better triggering, the ability to record slowly changing sig- nals, long-term recording, and so on — a long list. You might also ask yourself whether it’s worth the effort of devel- oping a microcontroller project when you can use a PC sound card instead. This is a valid question; some sound cards can even manage a higher sam- pling rate than the ATmega88. How- ever, the input voltage range is very limited with a sound card, and excess voltages at the input can damage not only the sound card, but also the entire computer. In addition, true DC meas- urements are not possible with a sound card, and you are limited to two chan- nels. The microcontroller scores better in this regard. With this issue out of the way, we can get started with building our own digital oscilloscope. ATM18DS0 Speed is good, and more speed is bet- ter. How fast can an ATmega88 sample signals? To answer this question, we can run a simple program (Listing 1) that does nothing more than sample a single channel as fast as possible. It stores 500 samples and then transmits the data at 115,200 baud. Each meas- urement series is initiated by a start Listing 1 Basic code for an M88 'scope. 'Bascom ATmega88, Scope Speed Test $regfile = "m88def.dat" $crystal = 16000000 Baud = 115200 Open "coml:" For Binary As #1 Dim D As Word Dim B As Byte Dim Ram (500) As Byte Dim Adr As Word Config Adc = Single , Presca- ler = 32 , Reference = Off 'ADC clock = 500 kHz Start Adc Config Portb = Output Do Get #1 , B If B = 1 Then Portb .0=1 For Adr = 1 To 500 D = Getadc ( 0 ) Shift D , Right , 2 Ram (adr) = D Next N Portb .0=0 For Adr = 1 To 500 D = Ram (adr) Put #1 , D Next N End If Loop End 4/2009 - elektor 63 MICROCONTROLLERS Listing 2 Pulse generator (1 kHz on PD3) Config Timer2 = Pwm , Pre- scale = 32 , Compa- re B Pwm = Clear Down Start Timer2 0cr2b = 128 Listing 3 Interrupt-driving measurement Config Timerl = Ti- mer , Prescale = 8 Start Timerl On Ovfl Timl_isr Enable Timerl Enable Interrupts Timebase = -20 Oneshot = 0 Channels = 1 Trigger = 0 Saveram = 1 Timl_isr : '50 ps Timerl = Timebase Portb .0=1 'Chan 0 D = Getadc ( 0 ) Shift D , Right , 2 If Saveram = 1 Then Ram(adr) = D Adr = Adr + 1 Else Put #1 , D End If Listing 4 Sending the measured data If Adr > 501 Then For Adr = 1 To 501 D = Ram (adr) Put #1 , D Next Adr Adr = 1 If Oneshot = 1 Then Stop Timerl End If End If Listing 5 The second measuring channel If Channels > 2 Then 'Chan 2 D = Getadc (2 ) Shift D , Right , 2 If Saveram = 1 Then Ram (adr) = D Adr = Adr + 1 Else Put #1 , D End If End If command from the PC. All we need to run this test is a terminal emulator pro- gram. We send a single byte (‘1’) to the board and receive 500 data bytes. The test program uses port B.O to indi- cate the measuring time. With an oscil- loscope, we measure a pulse length of 17 ms here. In this time interval, a total of 500 samples are acquired, con- verted into bytes (shifted left by two bits), and stored in RAM. This corre- sponds to 34 /is per sample, or a sam- pling rate of approximately 29 kHz. If a signal with a known frequency is con- nected to the analogue input, the sam- pling time can also be seen from the measurement results. The crucial factor here is the setting of the prescaler for the A/D converter clock signal. The following command sets the prescaler to 32: Config Adc = Single , Pres- caler = 32 , Reference = Off With this setting, the A/D converter clock rate is 16 MHz -s- 32 = 500 kHz. The data sheet recommends a clock rate in the range of 50 kHz to 200 kHz when high resolution is important. However, a higher clock rate can be used if the resolution is less than 10 bits. Consequently, we used a 500 kHz clock for our initial tests with the ‘scope project. Each sample requires 13 A/D clock cycles, which yields a sample time of 26 /is. As we previously measured a sample time of 34 /is, apparently 8 /is is taken up by processing the sample. However, the data sheet also speci- fies the conversion time as 13-260 /is. From this, we can conclude that an A/ D converter clock rate of 1 MHz should not cause any problems. A test with a prescaler value of 16 shows that a sampling rate of approximately 50 kHz can be achieved with this setting, with the result that it takes around 10 ms to acquire 500 samples. Maybe it can go even faster? There’s no harm in trying, so we ran a test with the prescaler set to 8, which yielded an A/D clock rate of 2 MHz. With this setting, we did not see any signs of degradation of the 8-bit results. The measurement time for 500 samples was reduced to 6.5 ms, corresponding to approximately 13 /is per sample. A sampling rate of up to 77 kHz is noth- ing to sneeze at, so let’s do it! Not everyone has all the instruments on hand that are actually necessary for developing an oscilloscope. Here the PD3 ATmega88 ADC0 080944 - 1 1 Figure 1. Generating a rounded sawtooth waveform. Figure 2. A measurement made at the highest sampling rate. Figure 3. Two-channel measurement. Figure 4. A triggered measurement. 64 elektor - 4/2009 Karl Ferdinand Braun was born on June 6, 1850 in Fulda (Germany) and attended upper secondary school there. In 1865, he began a course of study in the sciences and mathematics, at first in Marburg and then (after one year) in Berlin. There he worked in the private laboratory of Heinrich Gustav Magnus, and after the death of Magnus he continued his studies as the assistant of the physicist Hermann Georg Quincke. Among other things, he studied vibrations of strings, and he was awarded a PhD degree in 1 872. In Marburg, Braun sat the state exam for upper secondary school teachers, and in 1 873 he accepted a position as a teacher at the Thomasschule in Leipzig. In his free time, he pursued scientific studies of the conduction of vibrations and electricity. He discovered the semiconductor effect in metallic sulphur compounds, although this did not especially interest him or his scientific contemporaries. Karl Ferdinand Braun (1850-1918). In 1 877, Braun was appointed to the position of extraordinary professor of theoretical phys- ics in Marburg. In 1 880 he moved to Strasbourg, and in 1 883 he was appointed to the posi- tion of regular professor of physics at the University of Karlsruhe. In 1 887 he was called to Erberhard-Karls University in Tubingen, where he was active as one of the leading found- Construction of a cathode ray tube. ers of the Physical Institute. In 1 895 he was appointed director of the Physical Institute and a regular professor at the University of Strasbourg. Braun is presently known as the inventor of the cathode ray tube (CRT), which is often named after him in German-speaking countries. He developed one of the first functional proto- types in Karlsruhe in 1 897. This early model had a cold cathode and a weak vacuum, and it required an acceleration voltage of 1 00,000 V to produce a visible trace on the screen us- ing a magnetically deflected beam. Magnetic deflection was used in only one direction, with deflection in the other direction provided by an externally mounted rotating mirror. In 1899, Braun's assistant Zenneck added magnetic deflection in the Y direction using a sawtooth waveform. This was subsequently followed by a heated cathode and the Wehnelt cylinder, and the tube was further developed into a high-vacuum version. In this form, the cathode ray tube formed not only the basis for oscilloscopes, but also for television sets (after 1 930). After the invention of 'his' tube, Braun began research on wireless telegraphy. He replaced the 'coherer' commonly used at that time with a crystal detector. Crystal detectors were used for a considerable time after this, until they were replaced by thermionic valves. Braun also researched transmitter technology and made major contributions to the progress of radio en- gineering. In the area of antenna technology, he was one of the first to succeed in achieving directional radiation. In 1909, Braun and Guglielmo Marconi were jointly awarded the Nobel Prize in Physics for the development of wireless telegraphy. In 1 898, Braun was one of the founders of Funken- telegrafie GmbH in Cologne (Germany), and 1 903 he was one of the founders of the Ge- sellschaft fur Drahtlose Telegrafie Telefunken (the Telefunken Wireless Telegraphy Company) in Berlin. He died on 20 April 1918 in New York (USA) as a result of an accident. Mega88 can be of further service. In addition to its main task, it can quite easily - and without affecting the com- putation time - generate a square- wave signal at around 1 kHz (List- ing 2). For this purpose, we use Timer 2 as a PWM unit with the PWM2b sig- nal on PD3. The exact frequency is 977.6 Hz (16 MHz - (32 x 256 x 2)), which is reasonably close to 1 kHz. To get a better idea of the performance of the oscilloscope, we pass this signal through a low-pass filter (Figure 1). This converts the square-wave signal into a rounded sawtooth waveform (Figure 2). As with the R8C/13 ‘Tom Thumb’ arti- cle published in the April 2006 issue of Elektor Electronics, the PC software for the oscilloscope is written in Visual Basic. We borrowed the simple Fou- rier analysis routine from the previ- ous application for our present ‘scope application. What we have now is only a single- channel oscilloscope. For each meas- urement, we send it a single byte (‘1’) and receive 500 bytes, which are then plotted on the screen. In this case approximately seven cycles of the waveform are plotted, which means that the measuring time is approxi- mately 7 ms. There are still several features that we want to have in the final version of the ATM18 oscilloscope: - More input channels - Variable input range - Adjustable time base - Triggering The actual sampling process runs in a timer interrupt routine (Listing 3). This gives it the required timing accuracy and allows the sampling rate to be adjusted. For this purpose, Timer 1 (a 16-bit timer) is clocked at 2 MHz. Each time the timer overflows, the timer reg- ister is first loaded with the timebase value. The time increment is 0.5 /is, so with a timebase value of -40 the interrupt occurs every 20 jl/s. This cor- responds to 10 ms for a full set of 500 samples, or 1 ms/div on the screen. In theory, the time increment can be extended to approximately 16 ms. For this purpose, the main routine must set the Timebase to the appropriate value and then start Timer 1. In addition, val- ues must be assigned to the following variables: Channels (the number of channels desired; range 1 to 4), One- shot (record a single event), and Sav- eram (intermediate storage). If Saveram is set to 0, the samples are transmitted immediately, while if it is set to 1, the samples are stored in memory. The timer is then stopped as soon as 500 samples have been taken. In addition, the program trans- mits the data via the serial interface (Listing 4). The timer routine provides almost all the desired features. If more than one channel is configured, the samples 4/2009 - elektor 65 MICROCONTROLLERS Figure 5. Five measuring ranges. are acquired sequentially and stored (Listing 5). All we need now is a suitable main routine (Listing 6). Its function is to receive commands from the PC, inter- pret them, and execute them. The most Listing 6 The Start command and parameters Do Get #1 , Command If Command = 1 Then Oneshot = 1 Adr = 1 Saveram = 1 Start Timerl End If If Command = 10 Then Get #1 , Hi Get #1 , Lo Timebase = 256 * Hi Timebase = Timebase + Lo Timebase = 0 - Timebase End If If Command = 20 Then Get #1 , B Channels = B End If Loop important command is ‘1’. It starts a measurement session with the current set of parameters. The samples are first acquired and then transmitted. The timer is then disabled, so that a new measurement session can be started by the next ‘1’ command. Another command (‘10’) is used to con- figure the sampling interval. The pro- gram receives an integer value in two bytes (high byte and low byte) and assigns it to the Timebase variable as a negative number. Finally, there is the command ‘20’, which is used to set the desired number of channels. Triggering You’re probably familiar with the trig- gering functions of analogue oscillo- scopes. They have lots of knobs and buttons that you can play with, and usually you get it wrong and the screen remains blank. This is because the trig- gering condition can be set such that it is never satisfied. For this reason, it’s always a good idea to first make a measurement without triggering. After this, you can select the appropri- ate trigger slope and adjust the trigger level to obtain a visible signal. In the worst case, a software oscillo- scope can wait forever if the trigger conditions are set incorrectly, with- out giving you any opportunity to cor- rect the situation. This is certainly not what we want, so it must be possible to interact with the program while the microcontroller is waiting for a trigger event. The obvious way to achieve this is to use another interrupt. No sooner said than done: the triggering proc- ess runs as an interrupt routine with Timer 0 (one timer was still free — see Listing 7). Now you can adjust the trig- ger level ‘live’ in the main routine until you get it right. Here’s how it works: when the pro- gram is supposed to look for a trig- ger, the main routine starts Timer 0. Timer 0 in turn starts Timer 1 when the desired event occurs. The ‘Trigger’ control byte is set to 1 for triggering on a positive slope (rising edge). The first time that a measured value below the trigger threshold is found, the value of ‘Trigger’ is changed to ‘11’. This arms the routine for the next trigger edge. As soon as a measured value above the trigger level occurs, the trigger timer is stopped and the measuring session is started. If you want to trigger on a negative slope (falling edge), ‘Trigger’ is assigned an initial value of ‘2’ and changes to ‘12’ when it is armed. Listing 7 Triggering Tim0_isr : D = Getadc ( 0 ) Shift D , Right , 2 If Trigger = 1 Then If D < Triggerle- vel Then Trigger = 11 End If If Trigger = 11 Then If D >= Triggerlevel Then Stop TimerO Timerl = -1 Start Timerl End If End If If Trigger = 2 Then If D > Triggerle- vel Then Trigger = 12 End If If Trigger = 12 Then If D <= Triggerlevel Then Stop TimerO Timerl = -1 Start Timerl End If End If Return The main routine now recognises two additional start commands (‘2’ and ‘3’) for triggered measurements, as well as a command (‘30’) for passing the setting of the trigger level parameter (Listing 8). Incidentally, the first chan- nel is always used for triggering. Measuring range Have you noticed that there’s still something missing? That’s right — Listing 8 Trigger commands If Command = 2 Then Oneshot = 1 Adr = 1 Saveram = 1 Trigger = 1 Start TimerO End If If Command = 3 Then Oneshot = 1 Adr = 1 Saveram = 1 Trigger = 2 Start TimerO End If If Command = 30 Then Get #1 , B Triggerlevel = B End If 66 elektor - 4/2009 0 ieeeee©K 5 igii =«.My?i3 T K9 ®®®* 30000] -h- — 8 Testboard ktor / Computer:club 2 R1 0893UJ ki0®3©32®3®® KQrltNDI-ntlfi Ten ommmzojQQcQCD ior ^ CLCLCLQ.tDttQ.aa / ' [• • 080944 - 17 Figure 6. The four inputs of the ATM 18 DSO. Figure 7. Wiring diagram of the circuitry connected to the ATM18 module. Figure 8. AC measurement using two channels. a normal ‘scope has several input ranges. One way to select input ranges is to use relays or analogue switches, but another option is to use the regular I/O pins of the ATmega88 as analogue switches. This is because they have three usable states: 1. High-impedance 2. Low-impedance connection to GND 3. Low-impedance connection to V cc They can thus be used to control a volt- age divider. Figure 5 shows the poss- ible combinations with three resistors and two I/O pins if the A/D analogue input has a range of 0-5 V. A coupling capacitor is also necessary for true AC measurements. Figure 6 shows the implementation using port C. The third and fourth channels are connected to the ADC 6 and ADC 7 inputs and oper- ate with a fixed input voltage range of 0-5 V. The program can be used to perform one-shot (Single) or repetitive (Auto) measurements with a repetition rate of two measurements per second. It also includes a frequency analysis (Spec- trum display) function. For meaning- ful results, this can only be used with j| Figure 9. Plot of the frequency spectrum of a square-wave signal. single-channel measurements. By con- trast, the normal oscillograms show the signals plotted versus time (Time display). (080944-1 « AIM IB Scope USART R T * R4 R6 RBRlflRllR12Rl3 K9 -’,"4 in in as pc,t |S|S«2|£«£f§|> end' ■ v + 5U( * i mm * 1 l ■■■'■■*% Ke 1C2 ooooooo PD^( ' , , ; reg = rl 6 . . r31 ; k = initial value ; ibl = any name (but the same as that used in Next) ********************************* / .Macro For ldi @0,01 .set @2 = PC . endm • ★^^^■3k ,, j>r , 3lr-3>r , 3>r-3>r‘3lr-3>r-3>r , 3lr , 3lr-3>r-3k , -3>r , 3lr-3>r-3>r , 3>r , 3lr-3>r-3>r-3>r‘3lr-3>r-3>r-3>r , 3>r , 3>r / The accompanying Next macro has the same parameters as the For macro, but here the constant holds the final value of the counter. This macro increases the counter by one and then compares it with the final value. As long as the value of the counter is smaller, the pro- gram jumps back to the address immediately following the For macro. / ; Next r ; Usage Next , , ; reg = rl 6 . . r31 ; k = final value ; ibl = any name (but the same as that used in For) ********************************* / .Macro Next inc @0 cpi @ 0 , low (@1 + 1) breq Enxt r j mp @ 2 Enxt : . endm / The macros can be used in the following manner: For r 1 6 , 0 , movedata 1pm rO , Z + st Y+,r0 For r20 , 200 , nxloop 1 s 1 r2 1 eor r2 1 , r 1 8 Next r2 0 , 2 4 5 , nxloop Next rl 6 , 255 , movedata Because of the additional labels the instruc- tions can be nested in combination with other macros. Indenting the lines creates a clearer structure as is often seen in for example Pas- cal and C. It is somewhat unusual to add structure to assembly language in this way, but it almost becomes second nature when you use these macros. Another example of a macro where a clear structure appears is the 'if-then-else' macro. The following example illustrates that the use of indentations with nesting also creates a clear structure, as is often found in higher- level languages. if r 1 7 , he_, 1 9 begin label nop nop nop end label else lz2 if r 1 7 , eq, r 1 8 begin nxt nop end nxt_ else nnl2 mov r 1 7 , r 1 8 inc rl6 end nnl2 nop nop end lz2 We can't really think of any disadvantages, except that labels have to be used with the begin and end instructions. Although these labels can be given any name, if we use names that are appropriate to the function of the code, they'll even improve the readabil- ity of the code when it is referred to again at a later date. ( 070888 - 1 ) 72 elektor - 4/2009 DESIGN TIPS Protection for voltage regulators Ton Giesberts (Elektor Design Labs) In many cases, the load con- nected to a voltage regulator is not returned to ground but to an even lower voltage or perhaps even the negative power supply voltage (here we make the assumption of using positive voltages; when using voltage regulators with neg- ative output voltages the reverse is true). H |jA78l_xx v ° [=□ <£> 080943 - 12 2 Opamps, level-shifters, etcetera come to mind. In such cases, a diode (1N4001 or equivalent) connected across the output of the regulator 1C usually provides suf- ficient protection (see Figure 1). Polarity inversions which could occur, for example, during power on or during a short circuit could prove fatal for the regulator 1C, but such a diode prevents the output of the 1C going lower than ground (well, minus 0.7 V, to be accurate). A short-circuit proof voltage regu- lator (such as the 78xx series) sur- vives such a situation without any problems. It is also possible for the input volt- age of a voltage regulator to drop quicker than the output voltage, for example when there is a protec- tion circuit which shorts the input power supply voltage as a result of an overvoltage at the output. If the output voltage of the regula- tor is more than 7 V higher than the input voltage then the emit- ter-base junction of the internal power transistor can break down and cause the transistor to fail. To prevent this condition a shunt diode can be used (see Figure 2). This ensures that any higher volt- age at the output of the regulator is shorted to the input. (080943-1) New Annual DVD 2008 VLT JJX1 f he international electronics magazine #i All articles from Volume 2008 an DVD-ROM Jahrqnng Annee Jpurgpny Anual s * TTo.j r ioo< i 1 Elektor's new annual DVD 2008 appeared at the same time as the March 2008 issue. The DVD con- tains all the articles published dur- ing the previous year in pdf for- mat. Since our magazine is pub- lished in an increasing number of languages, the capacity of a CD is now insufficient to store them all on one disk. The annual CDs from Elektor are a very convenient way of storing all the issues of Elektor and search through all of them quickly, without the need to store stacks of paper and thumbing through many pages. Any particular article is located very quickly and displayed on the screen using Adobe Reader. This is the first time that the entire Elektor annual vol- ume is published on a DVD instead of the usual CD. Up till now all the articles were published in four languages: Dutch, German, Eng- lish and French. Beginning last year a Span- ish version was added. All of this together no longer fits on a disk with a capacity of 650 MB. Because changing to a DVD immediately increases the available capacity to 4.7 GB, this also gave us a great opportunity to improve the quality of the pdf files compared to those of last year. The result is a disk, containing Elektor in 5 languages, with a total file size of about 2.2 GB. The structure of the annual DVD is unchanged from last year's CD. You only need and Internet browser which can use ActiveX or a compu- ter which has the Java environment installed. Also make sure that these are enabled in your browser. The DVD has an auto-start func- tion for Windows computers. If this doesn't work, or you use another operating system, find the file index.html in the root of the DVD file structure and double-click this file. The default browser will open and display the start page. First select the desired language. By ticking the box at the bottom of the page, the selected language will be stored in a 'cookie' and the next time the program is started up it will start automatically with the selected language. Should you want to change the language after that, then click on the Elektor logo to return to the start page. The features and usage of the DVD are identical to last year's version, so we do not need to say much about that. There is also an index function for older annual volumes, so that you can easily find older articles. It is possible to copy all the articles from the annual CDs since 1998 to the hard disk. This saves you from having to change the CD all the time. From the hard-disk Make a folder on you hard disk (for example C:\Elektor). Copy the entire contents from the 2008 DVD to this folder on your hard disk. The folder \Elektor now contains five sub folders. Click the folder for the desired language (in our case \uk). At the top of the list of ELEKTOR 2008 DVD Harry Baggen (Elektor Netherlands Editorial) NEWS sub folders that now appears there will be the folder named \articles. This folder contains a number of sub folders with are named 1998 through 2008. The folder named 2008 is already filled with the articles from last year. If you have older annual CDs then you can copy the pdf files from those CDs to the folders with the corresponding year. For the 2005 annual CD you go to sub folder articles and then to sub folder E. In this folder select all files that have the pdf exten- sion and drag these to the folder C:\Elektor\uk\articles\2005. If the question pops up whether to overwrite the existing files, answer with Yes (to all). This is because all these annual folders already con- tain a number of dummy pdf files, which will now be overwritten with the actual articles. In this way you can combine the contents of the older annual CDs starting from 1998 into the new system. If, when you are search- ing for an old article, you arrive at an article that you do not have, then you will have the opportu- nity to click through to the Elektor website where you will have the option of buying and download- ing the article. (090170-1) 4/2009 - elektor 73 INFOTAINMENT PUZZLE Puzzle with an electronics touch Sure, we've said it before: puzzle solving is good for brain stimulation. A Hexadoku is just the ticket — it's free, fun and represents a mental challenge if solved the hard way. So put your grey matter to work! All correct solutions we receive enter a prize draw for an E-blocks Starter Kit Professional and three Elektor Shop vouchers. Have fun! The instructions for this puzzle are straightforward. In the diagram composed of 1 6 x 16 boxes, enter numbers such that all hexadecimal numbers 0 through F (that's 0-9 and A-F) occur once only in each row, once in each column and in each of the 4x4 boxes (marked by the thicker black lines). A SOLVE HEXADOKU AND WIN! Correct solutions received from the entire Elektor readership automatically enter a prize draw for an E-blocks Starter Kit Professional worth £300 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. 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 the Elektor website PARTICIPATE! Please send your solution (the numbers in the grey boxes) by email to: hexadoku@elektor.com - Subject: hexadoku 04-2009 (please copy exactly). Note: new email address as of this month! 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 May 2009. PRIZE WINNERS The solution of the February 2009 Hexadoku is: 3097D. The E-blocks Starter Kit Professional goes to: Davy Van Belle (Belgium). An Elektor SHOP voucher worth £40.00 goes to: Andres Tabernero Garcia (Spain); Hans-Jorg Buning (Ger- many); Dudley Nichols (UK). Congratulations everybody! 8 C E 7 B 0 9 2 9 4 8 F A 0 E 6 2 3 F 4 1 4 A 8 0 9 6 5 7 3 B 2 4 A 1 2 C 5 3 7 D 3 6 4 D 8 B B F D 4 C E 6 B 3 C A 8 A 5 C B 0 6 8 7 2 4 B 1 D F A 9 9 5 0 8 1 2 3 E F A 7 E D 6 2 8 E 0 3 D F 4 5 9 D 6 7 2 F E 4 B 3 A 0 3 E F D A B C (c) PZZL.com D 2 6 1 F 9 A 7 E 4 C 5 B 8 3 0 5 A E 0 1 C 8 B 3 6 2 F 4 9 7 D 4 8 C F D 0 6 3 B 7 9 1 5 E A 2 3 B 9 7 2 5 E 4 A D 0 8 F C 6 1 B 0 2 5 4 1 7 C 6 3 8 E 9 F D A C 6 4 A 9 2 B 5 1 F 7 D 0 3 8 E 8 9 7 D 3 F 0 E C 5 A 2 1 B 4 6 F E 1 3 A 8 D 6 0 B 4 9 C 7 2 5 A 5 8 6 B 4 C F 2 0 D 7 E 1 9 3 1 3 0 9 7 D 5 A F E 6 C 8 2 B 4 E 4 B C 0 3 9 2 5 8 1 A D 6 F 7 7 D F 2 E 6 1 8 4 9 3 B A 5 0 C 6 1 3 8 5 E 4 9 D 2 F 0 7 A C B 9 7 A E 6 B 3 D 8 C 5 4 2 0 1 F 0 F D B C 7 2 1 9 A E 3 6 4 5 8 2 C 5 4 8 A F 0 7 1 B 6 3 D E 9 74 elektor - 4/2009 “Elektor? Prescribed reading for our R&D staff because that’s where we need professional guidance for microcontroller technology.” - Frank Hawkes, 39, development engineer - Electronics at all the right levels loaUVfr fsTil subscription! Advantages to subscribers . 4 v4 e\* otae -c 3 -in- 1 rtlaV^’ S 9 ' Voice L ® K I® Cheaper than 1 1 issues from the newsstand With every issue subscribers get up to 40% discoi on selected Elektor products As a welcome gift you get a free 2GB MP3 player worth £31 .50 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 www.elektor.com/subs • Tel. +44 (0) 20 8261 4509 Or use the subscription order form near the end of the magazine. INFOTAINMENT RETRONICS An old radio brought back to life Joseph Kreutz (Germany) A two page instalment of Retron- ics this month, originally written in French. Ed. My colleague Giancarlo came into my office telling me he'd picked up an old valve radio that had been sitting for ages in his parents' kitchen. It wasn't working any more, and he asked me if it was possible to get it going again. I asked him to bring it to me. The patient I had to revive was a Telefunken model T 33 B RFS in a wooden cabinet, fitted with a turntable, and made in Italy around 1 953. Lots of Internet sites offer circuits for these old receivers [1 ] [2], so I had no trouble getting hold of one for it. The Internet also enabled me to download the datasheets for the valves it was fitted with [3]. Surprisingly, cer- tain firms still sell hardware for valve radios, among them [4]. Of course, these websites are far from being exhaustive. A few hours spent exploring the Internet is bound to turn up a lot more information, and will get you in touch with a fraternity marked by cheerful comradeship and old fashioned gentlemanly behaviour for the most part. After several decades in the kitchen, the inside of the radio was covered with a thick layer of dust (photos 1, 2 , 3) and the varnish on the cabinet had been dulled by a film of grease. So the first thing I had to do was dust out the receiver using a paint- brush and a vacuum cleaner (photo 4) Once this had been done, I removed the turntable and withdrew the chassis so I could clean it carefully, taking care not to rub off the mark- ings on the components. I also cleaned the grease off the cabi- net using isopropyl alcohol. I left the glass dial bearing the names of the stations and frequency indications well alone. The paint used for these markings usually becomes sticky or fragile as it ages, and any attempt to clean it ran the risk of destroying them for good. The turntable fitted to the receiver was also given a thorough cleaning. The original rubber belt had gone hard and was unusable. Luckily enough, I was able to find a substitute for it. I couldn't find out the make and type of the crystal cartridge fitted, and we weren't able to find any replacement styluses. Once I'd finished these cosmetic operations, I was able to turn to the electronics (photo 5). As always, safety first! Valves typi- cally operate at voltages between 150 and 300 V, and instead of having power transformers, many of these old receivers are supplied directly from the AC power line. Even with the ones that do have a transformer, you never know if it may not have an insulation fault. So there's a real danger of getting a nasty shock, and you really can't take any risks! In the case of the Tel- efunken T 33 B RFS, the valve heater voltage is tapped off the primary of the transformer (!) whose secondary provides the HT supply. The first operation was to replace all the electrolytic capacitors. These components don't last long, and typically fail after 20 or 30 years owing to degenera- tion, deformation or drying out of the electrolyte inside. The dial lamps were changed and the receiver powered up. The glow of the valve heaters showed they were working... but there was no sound coming out of the loudspeaker. The voltmeter showed the HT supply to be at its nominal value. Closer inves- tigation revealed that one of the power resistors in the supply rail was open-circuit. Replacing this brought the receiver back to life. The UM35 'magic-eye' tuning indicator had lost its brightness, 76 elektor - 4/2009 so a new tube was fitted. All that now remained to be done was to re-align the IF stage for best selectivity. But here, a nasty sur- prise was awaiting me — the adjustable cores of the IF trans- formers were secured using a little strip of rubber, which had hardened with age. It was impossible to loosen the cores with causing damage, so the adjustment could not be made (1) . As the receiver was already functioning very satisfactorily, we left things as they were. All that remained was to adjust the RF and local oscillator stage to maximize the sensitivity and to make sure that the dial indica- tions corresponded to the fre- quency actually being received. Now it was time to reassemble the receiver (photos 6, 7 , 8). The chassis and turntable were fitted back into the cabinet and the connections re-made. The manufacturer hadn't provided any short-circuit protection for the receiver supply — in those days, such a precaution was not considered necessary. For safe- ty's sake, two fuses were added into the power line cables. Fol- lowing this rejuvenation, the receiver is now sitting in my col- league's flat, where I trust it will continue to give good, loyal ser- vice for several more years yet. These old broadcast receivers have just as much of the charm of objects steeped in history as old items of furniture. And restor- ing them can be very educational too. When they were made, the engineers had to come up with an optimum but economically- viable result using just five or six active components. A far cry from today's MP3 players with tens of millions of transis- tors that fit in your pocket... Of course, valve technology is obsolete — but don't think of it as being more primitive than transistor technology. Quite the reverse — the engineers who developed it based themselves on an intimate knowledge of the laws of physics, and their sole resources were a sheet of paper, a pencil, their slide-rule... and lots of bright ideas. A long way from the digital methods now- adays that mean our computers can find the solutions to complex problems in just a few minutes. Finally, this story covers the way the radio was made to operate again — no attempt was made to do a full restoration job. Sev- eral excellent books are avail- able on restoring vintage radios and other venerable audio equipment; [5] and [6] are highly recommended. ( 081140 - 1 ) Internet Links and References [1] www.justradios.com [2] www.oldradioworld.de [3] www.tubedata . i nfo [4] www.tubesworld.com [5] Electronics Classics , Collect- ing , Restoration and Repair (sec- ond edition). Andrew Emmerson, Newnes (ISBN 0-7506-3788-9). [6] : Valve Radio & Audio Re- pair Handbook. Chas E. Miller, Newnes (ISBN 0-7506-3995-4). (1) Editor's note: apply a drop of baby oil to the top of each ferrite core and allow the oil to travel down along the core thread. When the oil emerges at the underside, heat up the core gently with a blow dryer and attempt to loosen it with two non-metallic adjustment tools accurately fitting the slots provided, turning simultaneously at the top side and underside of the core. 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 4/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. EASYDAQ ■ u ■ piV.Xn' i a ira Jm a . www.easydaq.biz p — i • 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 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 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 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 EASYSYNC S'- 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. HEXWAX LTD www.hexwax.com World leaders in Driver-Free USB ICs: • USB-UART/SPI/I2C bridges • TEAleaf-USB authentication dongles • expandlO-USB I/O USB expander • USB-FileSys flash drive with SPI interface • USB-DAQ data logging flash drive 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 FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk/PICProTrng.html Microchip Professional C — and Assembly Programming Courses. r r priXv^. 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 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. 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 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 78 elektor - 4/2009 products and services directory www. elektor. com 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 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 war www. elektor. com 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. CANDO - CAN BUS ANALYSER http://www.cananalyser.co.uk • USB to CAN bus interface • USB powered • FREE CAN bus analyser • Receive, transmit & log. CAN messages • IS011898 & CAN 2.0a/2.0b compliant • Rugged IP67 version available 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 £242 + VAT • Text and photo for £363 + 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 4/2009 - elektor 79 BOOKS, CD-ROMs, DVDs, KITS & MODULES Going Strong A world of electronics from a single shop! Learn by doing C Programming for Embedded Microcontrollers New microcontrollers become available every year and old ones become redundant. The one thing that has stayed the same is the C programming language used to program these micro- controllers. If you would like to learn this standard language to program microcontrollers, then this book is for you. No programming experience is necessary! You'll start learning to program from the very first chapter with simple programs and slowly build from there. Initially, you pro- gram on the PC only, so no need for dedicated hardware. This book uses only free or open source software and sample programs and exercises can be downloaded from the Internet. Although this book concentrates on ARM microcontrollers from Atmel, the C programming language ap- plies equally to other manufacturer's ARMs as well as other microcontrollers. This is an ideal book for electronic enthusiasts, students and engineers wanting to learn the C programming language in an embedded environment! 324 pages • ISBN 978-0-905705-80-4 • £32.50 • US $52.00 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 the MPLAB 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 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 V J V J Prices and item descriptions subject to change. E. & O.E 80 elektor - 4/2009 45 projects for PIC, AVR and ARM Microcontroller Systems Engineering This book covers 45 exciting and fun Flow- code projects for PIC, AVR and ARM microcontrollers. Each project has a clear description of both hardware and software with pictures and diagrams, which explain not just how things are done but also why. As you go along the projects increase in difficulty and the new concepts are ex- plained. You can use it as a projects book, and build the projects for your own use. Or you can use it as a study guide. 329 pages • ISBN 978-0-905705-75-0 £29.00 • US $58.00 Connect your mouse into new embedded applications Mouse Interfacing This book describes in-depth how to con- nect the mouse into new embedded ap- plications. It details the two main interface methods, PS/2 and USB, and offers ap- plications guidance with hardware and software examples plus tips on interfacing the mouse to typical microcontrollers. A wide range of topics is explored, includ- ing USB descriptors, a four-channel, millivolt-precision voltage reference and a variety of examples all with fully docu- mented source-code. 256 pages • ISBN 978-0-905705-74-3 £26.50 • US $53.00 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 110 issues, more than 2,100 articles DVD Elektor 1990 through 1999 This DVD-ROM contains the full range of 1 990-1 999 volumes (all 1 1 0 issues) of Elektor Electronics magazine (PDF). The more than 2,100 separate articles have been classified chronologically 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 con- tains (free of charge) the entire The Elek- tor Datasheet Collection 1 ...5' CD-ROM series, with the original full datasheets of semiconductors, memory ICs, microcon- trollers, and much more. ISBN 978-0-905705-76-7 • £69.00 • US$109.00 All articles published in 2008 DVD Elektor 2008 This DVD-ROM contains all editorial arti- cles published in Volume 2008 of the English, Spanish, Dutch, French and Ger- man editions of Elektor magazine. Using Adobe Reader, articles are presented in the same layout as originally found in the magazine. The DVD is packed with features including a powerful search en- gine and the possibility to edit PCB layouts with a graphics program, or printing hard copy at printer resolution. m ISBN 978-90-538 1-235-8 • £17.50 • US$35.00 4/2009 - elektor 81 BOOKS, CD-ROMs, DVDs, KITS & MODULES Modern 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-538 1-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-90-5381-214-3 • £19.50 • US $39.00 J Prices and item descriptions subject to change. E. & O.E M16C TinyBrick (March 2009) LED Top with Special Effects (December 2008) A TinyBrick is a small self-contained mi- crocontroller module fitted with a power- ful Renesas 1 6-bit Ml 6C microcontroller. A BASIC interpreter is installed in the module to simplify software develop- ment. Beginners will find it an ideal start- ing out point while more experienced users will appreciate its power and con- venience. With this evaluation board (to- gether with a TinyBrick) you can build an intruder alarm that sends SMS texts. Kit of parts incl. TinyBrick-PCB with SMD parts and microntroller premounted plus all other parts Art-Nr. 080719-91 • £54.00 • US$87.50 CapSense Buttons Evaluation Kit (January 2009) This kit is for learning about touch sens- ing 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 bat- tery. Also included is the kit CD which contains PsOC programmer, .NET Framework 2.0, PSoC Express 3, CapSense Express Extension Pack and the CapSense Express documentation. Art-Nr. 080875-1 • £27.50 • US $39.95 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 parts incl. SMD-stuffed PCB and programmed controller Art-Nr. 080678-71 • £39.00 • US $59.00 Elektor SMT Reflow Oven (October 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) Art. # 080663-91 • £962.00 (Excl. VAT) • US$1665.00 (Excl. VAT) 82 elektor - 4/2009 ■\ April 2009 (No. 388) £ us$ RGB LED Driver 080178-41 ....Programmed controller 8.90.... ....13.75 The 32-bit Machine 080928-91 .... R32C/1 1 1 Starterkit (32-bit-Controllerboard & CD-ROM) 27.00.... ....42.50 Automotive CAN Controller 080671 -91 .... Kit of parts, incl. PCB with SMDs prefitted 52.00.... ....79.00 Automatic Running-in Bench 080253-71 .... Kit of parts incl. PCB-1 with SMDs prefitted see www.elektor.com 090146-91 ....ARMee plug-in board mk. II see www.elektor.com March 2009 (No. 387) M16C TinyBrick 08071 9-91 .... Kit of parts: TinyBrick-PCB with SMD parts and microntroller premounted; plus all other parts 54.00.... ....87.50 February 2009 (No. 386) Model Coach Lighting Decoder 080689-1 PCB, long (1 = 230 mm) 7.30.... ....10.95 080689-2 PCB, medium (1 = 190mm) 7.30.... ....10.95 080689-3 PCB, short (1 = 110mm) 5.80.... 8.95 080689-41 .... PIC12F683, programmed 6.20.... 9.50 Transistor Curve Tracer 080068-1 Main PCB 26.50.... ....42.00 080068-91 ....PCB, populated and tested 55.00.... ....82.50 January 2009 (No. 385) Radio for Microcontrollers 071125-71 ....868 MHz module 7.20.... 9.95 ATM18on the Air 071125-71 ....868 MHz module 7.20.... 9.95 Meeting Cost Timer 080396-41 ....ATmegal 68, programmed 8.50.... ....12.50 Capacitive Sensing and the Water Cooler 080875-91 ....Touch Sensing Buttons Evaluation kit 27.50.... ....39.95 080875-92 ....Touch Sensing Slider Evaluation kit 27.50.... ....39.95 Three-Dimensional Light Source 080355-1 Printed circuit board 24.90.... ....39.90 Moving up to 32 Bit 080632-91 ....ECRM40 module 32.00.... ....46.50 December 2008 (No. 384) PLDM 071 1 29-1 Printed circuit board 5.80.... 9.50 Hi-fi Wireless Headset 080647-1 Printed circuit board: Transmitter 7.90.... ....15.80 080647-2 Printed circuit board: Receiver 7.90.... ....15.80 LED Top with Special Effects 080678-71 .... Kit of parts incl. SMD-stuffed PCB and programmed controller 39.00.... ....59.00 November 2008 (No. 383) Motorised Volume Pot 071135-41 ....Programmed controller ATMEGA8-16PU 5.90.... ....11.80 Speed Camera Warning Device 080615-1 Printed circuit board 15.50.... ....31.00 080615-41 ....Programmed controller PIC1 6F876A-I/SO 11.80.... ....23.60 Remote Control by Mobile Phone 080324-1 Printed circuit board 17.80.... ....35.60 080324-41 ....Programmed controller ATMEGA8-16PU 5.90.... ....11.80 080324-71 ....Kit of parts 54.00.... ....99.00 Tracking Hot Spots 080358-1 Printed circuit board 9.10.... ....18.20 ATmega meets Vinculum 071152-91 ....VDIP1 module 22.50.... ....45.00 i Microcontroller Systems Engineering ISBN 978-0-905705-75-0 £29.00 .....US $58.00 ISBN 978-0-905705-74-3 E26.50.....US $53.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 Universal Display Book ISBN 978-0-905705-73-6 £23.00. US $46.00 DVD Elektor 2008 ISBN 978-90-5381-235-8 £1 7.50.....US $35.00 Elektor 1990 through 1999 ISBN 978-0-905705-76-7 £69.00... US $1 09.00 Course ISBN 978-90-5381-225-9 £14.50. US $29.00 Ethernet Toolbox ISBN 978-90-5381-214-3 £19.50. US $39.00 4 ISBN 978-90-5381-159-7 £17.50. US $35.00 LED Top with Special Effects Art. # 080678-71 £39.00.... US $59.00 Transistor Curve Tracer Art. # 080068-91 £55.00 .....US $82.50 Evaluation Kit CapSense Buttons Art. # 080875-91 E27.50.....US $39.95 Elektor SMT Oven Art. # 080663-91 £962.00 US $1665.00 Evaluation Kit CapSense Sliders Art. # 080875-92 £27.50..... US $39.95 Order quickly and securely through www.elektor.com/shop 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 4/2009 - elektor 83 INFO & MARKET COMING ATTRACTIONS NEXT MONTH IN ELEKTOR MSP430 Low-cost Development System Together with Rotterdam's Technical College Elektor developed a low-cost development system that should appeal to those of you just starting out into microcontroller land. The basis of the system is the MSP-eZ430 USB-stick from Texas Instruments, a chip graced by a free development platform and a programming language (C). The associated experiment- er's board easily accommodates the hardware for the project examples like a buzzer, a 7-segment display, some LEDs and pushbuttons. I 2 C and SPI connectivity is also provided. True-rms Voltmeter with Frequency Meter Test and measurement equipment for home construction is among our all-time favourites. Next month we present a digital voltmeter with four ranges covering 0.1 to 100 V. The instrument can show the rms value of sinewave inputs signals up to 1 MHz, while the frequency meter reaches up to 30 MHz. The circuit consists of a screened instrumentation am- plifier and a readout section based on an R8C/1 3 micro linked to a 2-line LCD and an RS232 interface. Mini PWM Audio Amplifier Admit it — you too have one or more MP3 players idling about. Although these are great for train journeys or jogging tracks, you sometimes want to play that MP3 stuff out loud without having to use the headphones, or linking the player to the PC. A small amplifier is then called for, preferably one with high efficiency so why not go for state of the art PWM (pulsewidth modulation). The circuit is extremely simple and marked by sound reproduction not unlike that of a small tube amp. Battery-powered, this little amp can supply up to 1 .5 watts into 4 ohms. Article titles and magazine contents subject to change, please check 'Magazine' on www.elektor.com The May 2009 issue comes on sale on Thursday 23 April 2009 (UK distribution only). UK mainland subscribers will receive the issue between 1 7 and 20 April 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 aloctronlc. worldwide FTDI launches new high speed USB Interface IC's Nome 1 ■ Choose »n option w . W We. motive ..title. M Pvo;««ti UhQ M«fOC*p indwttry i low**.! veiUf* HMOMl Borometric pressure senior 3-0 sen so- P0«c.» eoturc ItV»rp4A« fuajy v-J.O 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 Visit China with llsktor I Subscribers only m Book! CO-/OVO- Herns W KlU 1 Module, v (-Work. «PC»« %f Controller. W MlttimM «# Offer. « (lektor Credit, w 5utwtter, EiMai Enter your C-mie .99 'ess: 84 elektor - 4/2009 f Description Price each Qty. Total Order Code C Programming for Embedded Microcontrollers fggfll £32.5° Artificial Intelligence £32 -°° Mouse Interfacing £26 - 50 Microcontroller Systems Engineering £29 -°° DVD Elektor 2008 SS3 £i7 - 50 DVD Elektor 1990 through 1999 £69.00 ! 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 EL04 g O CO •Q CO 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 2009 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. Date Email Signature EL04 METHOD OF PAYMENT (see reverse before ticking as appropriate) □ □ □ □ Bank transfer Cheque (UK-resident customers ONLY) Giro transfer n emrjicp, fltaltrfaW 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 □ Ttf&r □ 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-usa.com 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 DVD Elektor 2008 All articles in Elektor Volume 2008 This DVD-ROM contains all editorial articles published in Volume 2008 of the English, Spanish, Dutch, French and German editions of Elektor magazine. Using Adobe Reader, articles are presented in the same layout as originally found in the magazine. The DVD is packed with features including a powerful search engine and the possibility to edit PCB layouts with a graphics program, or printing hard copy at printer resolution. Elektor ISHOP ISBN 978-90-5381-235-8 • £17.50 • US$35.00 Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 v Further information and ordering at www.elektor.com/shop Index of Advertisers Avit Research, Showcase www.avitresearch.co.uk 78 Beijing Draco www.ezpcb.com 3 Beta Layout, Showcase www.pcb-pool.com 39, 78 ByVac, Showcase www.byvac.com 78 CS 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.easydaq.biz 78 Easysync, Showcase www.easysync.co.uk. 78 Elnec, Showcase www.elnec.com 78 Euro circuits www.eurocircuits.com 61 First Technology Transfer Ltd, Showcase . . www.ftt.co.uk 78 FlexiPanel Ltd, Showcase www.flexipanel.com 78 FTDI www.ftdichip.com . Future Technology Devices, Showcase. . . . www.ftdichip.com 78 General Circuits www.pcbcart.com. 19 Flexwax Ltd, Showcase www.hexwax.com 78 Labcenter www.labcenter.com. 88 Lcdmod Kit, Showcase www.lcdmodkit.com 78 London Electronics College, Showcase . . . www.iec.org.uk 78 MikroElektronika MQP Electronics, Showcase. . Netronics, Showcase Newbury Electronics Nurve Networks Parallax Peak Electronic Design Pico Quasar Electronics Robot Electronics, Showcase. Robotiq, Showcase ScanTool, Showcase Showcase USB Instruments, Showcase . Virtins Technology, Showcase www.mikroe.com 16, 17 www.mqp.com 78 www. cananalyser. co.uk 79 www. newbury electronics, co.uk 61 www.xgamestation.com 61 www.parallax.com 51 www.peakelec.co.uk 39 www.picotech.com 3 www.quasarelectronics.com 15 www. robot-electronics, co.uk 79 www.robotiq.co.uk 79 www.obd2cabies.com, www.scantooi.net .... 79 78, 79 www.usb-instruments.com 79 www.virtins.com 79 Advertising space for the issue of 21 May 2009 may be reserved not later than 21 April 2009 with Fluson International Media- Cambridge House- Gogmore Lane- Chertsey, Surrey KT 1 6 9AP- England - Telephone 01 932 564999 - Fax 01 932 564998 - e-mail: p.brady@husonmedia.com to whom all correspondence, copy instructions and artwork should be addressed. 4/2009 - elektor 87 -PROTEUS WSIVI Training Courses « eO-Mtid April ■ in i 'a h WW u U H M r Powerful EDA Software at Affordable Prices PROTEUS DESIGN SUITE Features: ■ Easy to use, standard Windows interface. ■ ■ Publication quality schematics. ■ Fully configurable bill of materials. ■ ■ Large component libraries for both ■ simulation and PCB layout. ■ ■ Mixed mode SPICE circuit simulation. ■ ■ Co-simulation of PIC, AVR, 8051 and ■ ARM7 microcontroller firmware. ■ ■ Integrates with MP-LAB and AVR Studio. ■ Automatic component placement and gateswap optimization. Highly configurable design rules. Interactive design rule checking. Polygonal and split power planes. World class shape based autorouter. Automatic mitre/unmitre commands. Industry standard CADCAM & ODB++ output. Integrated 3D Viewer with 3DS and DXF export. All levels of the Proteus Design Suite now include a world class fully integrated shape based autorouter at no additional cost - prices start from just £150 exc. VAT & delivery 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 Visit our website or phone 01756 753440 for more details