May 2009 AUS$ 12.90 - NZ$15.50 - SAR 88.70 £4.10 QUASAR electronics The Electronic Kit Specialists Since 1993 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 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 of 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 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 NEW! USB & Serial Port PIC Programmer kM USB/Serial connection. Header I cable for ICSP. Free Windows ^jXP software. Wide range of ' flPP supported PICs - see website for complete listing. ZIF Socket/USB lead not included. Supply: 16-18Vdc. Kit Order Code: 3149EKT - £49.95 Assembled Order Code: AS3149E - £59.95 NEW! USB 'All-Flash' PIC Programmer 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 (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 No.1 SKITS CHINA PCS SUPPLER We add value to RGBs when others Just sell it* D>nn S&ztp jViiiiiijJkr i iirlu^; r/M itlsri/liijlia Ci/wj}»yu?Jii '3 rOfi* }*imnsyping x&sniuniy GuiH'jJre.iw Design PrOlGJype '**►4 Production Designing Service *P ^it^nsufe Des4gntng Vlnual A5MTtf»ly PC# Qcggn CumponcnC Gufck Prototype Fdas AssemOTy Q-jEldk Fr cfo type ”jT 1 P| 8 5 1 j Fpz, Keypads www.EzPCB.com Email: sales@ezpcb.com GENERAL CIRCUITS CO., LTD QUALITY PCB & SERVICE PROTOTYPE TO PRODUCTION instant online quote shopping cart ordering system China competitive prices tree electrically test iVirb fottuttMMvpdeari turn 3-3 Efl'E-J'f C hTJahJ-T! -lCwTI m +»srt^ 7 iimt 3 F*x *»Wi- 8 \TQ 3$705 Am NQ.7$OtoOw hing^ipg. Courseware on course Boscom AVR (6), FPGA (9), Microcon- troller Basics (5) and Basic Stamp (7) are just a few courses published in Elektor over the past few years. The figures in brackets are the number of instalments eventually carried in the magazine. True, in some cases far fewer instalments were planned and the author(s) and editors simply got carried away. Those of you with a memory longer than our website (i.e. pre-2000) may recall equally winning courses like Figuring it Out, 805 7 Assembly Langu- age and Neural Networks. With hindsight the relative success of most of Elektor's courses is due to close interaction between the courseware elements: what's on paper, the hardware supplied, the (free) software, didactics and support from the tutoring party. Good interaction is a condition for reader involvement and the lot either 'taking off' or sinking into oblivion after two months or so. Only the very best of courses make it to the book, CD or 'product bundle' level. Although there is no shortage of books and online material on the C programming language, much of this is general-purpose at best, with a division between PC programming on the one hand and 'embedded' pro- gramming on the other. Still, C being very much a 'broadband' language — also for embedded applications — book authors for obvious reasons may not want to limit themselves to coverage of a specific processor. However, for a monthly journal like Elektor the strength is exactly there as it is better geared to acute focusing in the field. A good example is the pair of MSP430 articles in this month's issue. In good Elektor tradition, one article is the hardware show (page 1 8) while the other (page 22) kicks off a short course on C specifi- cally for Texas Instrument's best known 1 6-bit RISC micro at the electronics enthusiasts' level. As I was able to witness on several Embedded Systems Conference exhibitions, the MSP430 has a huge following particularly in the student area and Tl deserves cre- dit for not having lost the connection with the embedded community, which has strong tendency to disappear underground and into rucksacks for software (IP) and hardware respec- tively. The only disadvantage of Tl's student-aimed eZ430 stick is a lack of connectivity so Elektor teamed up with two automotive electronics teachers to churn out an MSP430 development system and a matching Embedded C course we hope you will actively participate in. Jan Buiting Editor ReKfior electronics worldwide 22 Getting Started with Embedded C I \ /4* This is the first instalment of a three part series which will introduce the fundamentals of programming a microcontroller in C. You can immediately try all the examples using the MSP430 hardware in combination with a PC or laptop which has a USB interface. The software we've used is available as a free download. ** . -I cilrf j/ CiM t . 1 . *4 • • UU* CU* *1 +A C bl# t*+*+M* Jj'J'j'jJ-J. UU*JjU** ius It ft it I * uljIu tftoldf f taric-rs. - tisrr** / •io’TUosjh // i^catuiexj eiuntr oft *££>£* - MXTX *am*aXTj0tI£T4t//»lVX*-‘JQt yi.l.Vl. X. VI XOUT - 333* // all pin* hlyh • (1 * (tx 1 c dSSJSx 1 + *) f //dftlyy yjOWT * O/ // *12 pin* let* for (J * 0/ J < o55J5x j ++) x //d*l*y J // t/hll*(J J // lUdlxt 48 V & I Calibrator It's difficult to be sure that your digital multimeter (DMM) is taking accurate measurements especially if it's a few years old. This handy calibrator gives full scale reference levels of both voltage and current, designed specifically for the scale ranges used by DMMs. CONTENTS Volume 35 May 2009 no. 389 the MSP430 \0 The I/O facilities of Tl's USB evaluation sticks for its low- cost MSP430 controllers being limited it's a good idea to design a dedicated experimenter's board. The board and the stick form the hardware basis for an Embedded C course also found in this issue. projects 18 Experimenting with the MSP430 Getting Started with Embedded C 32 Automatic Running-In Bench (2) 4 ( Brim Full (ATM18 series) 48 V & I Calibrator Pocket Calculator Control Interface the PicoScope 2203 and the Velleman PCSGU250. In this article we examine a pair of two-channel units that also include a built-in function generator: 132C/1 1 1 goes OLED With OLEDs it's not all plain sailing since driving them by microcontroller presents developers with a number of challenges. Continuing our series on the Renesas R32C, we trawl the theory to come up with a highly practical solution using the R32C carrier board. 66 R32C/111 goes OLED 72 RGB LED Driver technology 26 USB 3.0 Superspeed info & market 6 Colophon 8 Mailbox News & New Products 38 USB-on-the-go, OLED and capacitive touch pad 56 XMEGA Revealed 60 PC-Based Instruments (USB oscilloscopes review) 80 Elektor SHOP 8^ Coming Attractions infotainment 76 Hexadoku 77 Retronics: Elektor Mini Crescendo (1984) 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. Volume 35, Number 389, May 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, American English, German and Dutch. Together with franchised editions the magazine is on circulation in more than SO 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 stct 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 - 5/2009 I I 6* r Automatic Running-in Bench y for internal combustion model engines 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 combus- tion (i/c) engines and these need to be run in before they can go airborne. Elektor's April and May 2009 issues present an ambitious, unique project to auto- mate this important operation. Designed by an R/C modeller also steeped into electronics, the run-in bench enables a microcontroller and PC software to take over the tedious task of revving the engine up and down while measuring and logging temperature and rev count. The glow plug and fuel richness are also automatically controlled for the user's convenience and safety. Technical specifications • 32-bit ARM7 processor running at 59 MHz, 1 28 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-1 60 °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. Order now Kit of parts incl. PCB-1 with SMDs prefitted Art.# 080253-71 • £185.00 • US$270.00 ARMee plug-in board mk. II Art.#080253-71 • £50.00 • US $74.00 Further information and ordering at www.elektor.com/run-inbench 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 5/2009 - elektor 7 INFO & MARKET MAILBOX c+ + Dear Editor — I have crea- ted an engine for displaying 3D graphics with Direct3D9 and C++ Builder. The engine source code is free and all classes described are docu- mented at: http:/ /bcbjournal. org. The url for the engine is: www.gtokas.com/index. php?q=TCDX9en. If you think it worth writing an article about 3D graphics rendering along with technical documen- tation on how all those works, please respond. George Tokas (Greece) Well happily evaluate your arti- cle proposal George. Dear Elektor — just writing in to say we have a completely free online Science and Engi- neering Encyclopedia http:// www.diracdelta.co.uk and have a list of electronics topics at www.diracdelta.co.uk/sci- ence/ source/ e/I/ electronics/ source.html. A great resource for profes- sional and students alike. Charlie Hawkins (United Kingdom) Thanks for the tip Charlie! What CAD? Hi Jan — does Elektor use Eagle for its schematic capture and PCB layout work? If so, in addition to PCB artwork, can Elektor also provide Eagle libraries for the modules it cre- ates? I'm particularly interested in the ATM1 8 microcontroller module and want to use it in some of my own home-brew designs. David Bannister (Singapore) Elektor labs employ Altium Designer for their engineering- level schematics , BOMs and PCB designs. Altium is also used for most circuit diagrams you can see in the magazine. We also use McCAD for printed schematics and the odd block diagram. For both programs , Elektor employs large compo- nent shape libraries compiled and refined over many years , hence our house style which has remained basically unchanged since the mid 1970s. These libra- ries are proprietary. Our published circuits are copy- righted and intended for educa- tional and private use only see the Copyright Notice on page 7. Commercial use is subject to written approval from the Publisher. Arduino and Bascom Dear Editor — the March issue had an article on Arduino. I agree with you that the programming environment supplied with Arduino is easy to learn. However, sometimes you want to use programs from another source or use Basic (such as Bascom). In this case, Arduino is still an inexpen- sive and robust ready-to-use microcontroller module with a USB port. The following website provides some information on using Arduino in combination with Bascom: http://med.hro.nl/kemjt/ Send_Eng.htm Jos van Kempe (The Netherlands) PS: I used Arduino and Bas- com for a textbook on control engineering at the technical college level. Thanks for this information , which certainly deserves publi- cation in our Mailbox. An Eye for Distance Dear Editor — I noticed an inconsistency in this article (Optical triangulation with the ATM1 8, Elektor February 2009, Ed.). The voltage divider for the out- put signal is described at one point in the text as consisting of 4.7 kQ and 5.6 kQ resis- tors, which corresponds to the colour-code markings of the resistors in Figure 6. However, the voltage divider is twice described as consisting of 4.7 kQ and 6.8 kQ resistors, and these values are shown in the schematic diagram in Figure 7. To arrive at the refe- rence voltage of the ATMega (1.1 V) from the output level of 2.4 V (or 2.7 V), the value would have to be 5.6 kQ. Michael Kaiser (Germany) information available on the materials used to make disk platters? Carsten Bohemann (Germany) Your observations are correct and your bending experiments are very consistent. Your suppo- sition is also correct: the platters of hard-disk drives sometimes break like glass for the simple reason that they are in fact made from glass. Disk platters are made either from very stiff ■ lightweight aluminium alloys or from glass , which has the advan- tage of no eddy currents. You can clearly identify the actual platter material by using an inexpensive metal detector of the type used to locate electrical wiring (available in DIY building shops) or by using an ohmmeter to test the conductivity of the rim of the platter. Dr Thomas Scherer The correct values for the vol- tage divider are 5.6 kQ. (R2) and 4.7 kQ (Rl). Burkhard Kainka Hard-disk substrates Dear Jan — the current edition of i-Trixx (week 2/2009, Ed.) includes a fun construction project using platters from a discarded SCSI disk drive. In an aside, the author mentions that aluminium discs are used for data storage media. I have occasionally dismantled used disk drives in the past, but they did not always have aluminium platters. Some of them broke like glass when I tried to bend them. Is more detailed Lead-free soldering Dear Elektor — I recently bought two project kits from the Elektor Shop (for the ATM1 8 project and the Four- channel Logic Analyser). Now I wonder whether these kits conform to the RoHS regula- tions. Do I also have to use lead-free solder for assembly? I have already purchased new solder (Sn95.5Ag3.8Cu0.7) - can I use this? What is the best soldering temperature? Martin Baumberger (Germany) These kits , like all current Elektor kits and modules , conform to the RoHS regulations. As these kits are intended for private users instead of commercial equipment production , RoHS compliance actually not mandatory. As a non- com- 8 elektor - 5/2009 mercial producer (private user), you can and may use solder containing lead (such as SnPb 60/40) for all kits and modules , and such solder is still widely available commercially If you wish to use Sn95.5Ag3.8CuO. 7 solder in your projects , you should bear in mind that it has a melting temperature of 217 °C, which is 34 °C higher than the melting temperature of tin/lead solder (SnPb 60/40). In practice , this somewhat higher melting tempe- rature is hardly noticeable with the usual sorts of soldering irons for electronics assembly which typically have a soldering-tip temperature of 350 °C. Howe- ver ; the temperature should not exceed 380 °C. A temperature of around 350 °C is usually adequate. One thing that takes getting used to is that the sol- der joints are not shiny as with lead solder ; but instead turn dull as soon as the solder cools and hardens. You can solder as nicely as you please , but the results always look like 'cold' sol- der joints. Elektor published an extensive article on lead-free soldering in the May 2000 (!) issue , with additional articles in the June 2005 and May 2006 issues. Footprints in Eagle I'm presently working on a PCB design in Eagle, using the standard version (5.2.0). No matter what I try, I can't man- age to edit the footprints of my ICs and passive components. I would like to use somewhat larger pads (the connection points for the components), since I wouldn't be able to do anything with the finished PCB because the pads are much too small. Can someone tell me how to change my footprints when I am designing a PCB? Steven33 (Elektor Forum user) A component is called a 'device' in Eagle, and every device consists of a symbol and a package. The properties of the footprint are specified in the package. This means that if you want to modify the pads, you have to do so in the package. The procedure is not always especially intuitive, and you will have to consult the user guide more than once, but it is in fact described in the user guide. Here we can describe the pro- cedure with a brief example. Suppose you need a common garden-variety resistor, and you select 0309/1 2 from the RCL library. The size and lead spacing are OK, but the pads are much too small. To change this, use the menu bar to open the library: Library -> Open -> rcl.lbr. If you select the symbol icon for R-EU_, you will see a resi- stor symbol with a long list of possible packages. Here you have to look for 0309/1 2 and then edit it. Here it's a good idea to first make a copy and then edit the copy. To do this, type the following command line at the top of the window: copy 0309/1 2. pac@rcl.lbr 0309/1 2s. The package will be displayed after this, and you can edit it directly. First enter your desired settings for the size, shape and drilled hole diameter of the new pad. Then remove the old pads and place the new ones. Change the names of the pads from P$1 and P$2 to PI and P2, and then click 'Save All' to save your changes. Back at the device, click the 'New' button at the bottom left in the window. You will see a list of all the packages in this library. Find '0309/1 2s' in the list and click it. The new 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 package will be shown at the top right. Then click the 'Con- nect' button. This takes you to a window where you can link the pin numbers of the symbol to the pads of the package. In this case, click the large 'Con- nect' button twice. The new package is now pre- sent in the list, but a quotation mark is shown in the 'Variant' column. Right-click this, select 'Rename', and enter a name of your choice. Finally, update the library and (as a check) select Library -> Use -> rcl.lbr once again. The resistor with the new footprint should be available now. Good luck! petrus bitbyter (Elektor Forum user) 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 9EHEH, England. Corrections & Updates Transistor Curve Tracer February 2009, p. 24-31, no. 080068-1 In the circuit diagram (Figure 2, section a), the bussed con- nection between pin 22 (P3.0) of the R8C/13 module and resistor R24 is missing. This connection is however present on the circuit board, for which no modification is required. In the component list, transistor T2 should be a type BC557A, not BC547A. No modification is required to the PCB or the schematic. 5/2009 - elektor 9 INFO & MARKET NEWS & NEW PRODUCTS LV-67D mini-ITX motherboard based on Atom N270 BVM has added the LV-67D to its extensive family of mini-ITX form factor motherboards for embed- ded applications. The LV-67D uses the Intel 945GSE chipset and incorporates the 45nm Intel Atom N270 processor. The chip's power consumption is particularly low at 2.5 W, and with extensive I/O capability, the board is ideal for embedded applications such as digital signage, kiosks, point of sale terminals, thin clients, digital security, residential gateways and commercial and industrial control equipment where ultimate comput- ing power is less important than power conservation. The onboard Intel GMA 950 32-bit 3D graph- ics engine offers LVDS, DVI, CRT to 2 GB of RAM. The LV-67D pro- vides a comprehensive selection of I/O: two Giga LAN ports, 8x USB 2.0 ports, 5x RS232 and one RS485 serial port. 2x 150MB/s SATA interfaces give access to mass storage and the board has IDE support for a solid-state disk. Extended interface facilities include a PCI Express mini card socket, a Mini-PCI socket and a PCI slot. Sys- tem management functions include an 8-bit GPIO programmable inter- face and a 256-level watchdog timer. www.bvmltd.co.uk (090169-XI) or HDTV capability and multiple The N270 runs at 1 .6 GHz with graphics displays. a 533 MHz FSB addressing up CO Gas Sensor Module Parallax' CO Gas Sensor Module is designed to allow a microcon- troller to determine when a preset CO gas level has been reached or exceeded. Interfacing with the sensor module is done through a 4-pin SIP header and requires two I/O pins from the host micro- controller. The sensor module is mainly intended to provide a means of comparing carbon mon- oxide sources and being able to set an alarm limit when the source becomes excessive. The new module employs the MQ- 7 CO gas sensor, has an easy SIP interface and is compatible with most microcontrollers. The module costs $29.99 plus shipping. www.parallax.com (search '27931') (090231-1) OOOOOOOOO ^ oooooooooH 0300000 OOOOOOOOO 0000003000000000 0000003000000000 ooooooooooo 00300000000 ooooooooooo 300000 o ooooo oooooooooooo 0000000000030 0900000000000000 ooooooooooo Low-cost PIC1 8F4550-USB prototyping kit C S Technology Ltd. have released a PIC prototyp- ing board in kit form for 40 pin PIC microcon- trollers, including the 1 8F4550 USB version. The board includes a large prototyping area, RS232 and USB con- nectivity, a 5-pin pro- gramming header and Micro- chip ICD2 compatible connector, together with selectable on-board 5 V regulator and an LCD display connector. This new kit adds to CST's range of 18- and 28-pin PIC proto kits, CTCSS and DTMF kits. The complete kit of parts including PCB costs just £ 14.99 plus P&P. C S Technology also offer a PIC program development and proto- typing service. www.cstech.co.uk (090231 -IV) Industry's highest density transceiver FPGAs Altera's second member of the Stratix® IV GX FPGA family, the EP4SGX530 is 60 percent larger than the largest transceiver FPGA on the market. The device offers 530 K logic elements (LEs), up to 48 transceivers operat- ing at up to 8.5 Gbps, 20.3 Mbits of RAM and 1 ,040 embedded mul- tipliers. Stratix IV GX devices target numerous applications in the com- munications, broadcast, test, medi- cal and military markets. Stratix IV GX FPGAs incorporate up to four hard intellectual prop- erty (IP) cores for PCI Express Genl and Gen2 (xl , x4 and x8), and also support a wide range of protocols including Serial RapidIO®, 40G/100G Ethernet, XAUI, CPRI (including 6G CPRI), CEI-6G, GPON, SFI-5.1 and Interlaken. The Stratix IV GX EP4SGX530 and EP4SGX230 devices are currently shipping, with other family members scheduled to ship in 2009. www.altera.com /pr/ stratix4 10 elektor - 5/2009 AVR32 digital audio gateway reference design Atmel® Corporation recently announced the AVR®3 2 ATEVK1 105 Digital Audio Gate- way kit, demonstrating digital audio streaming, decoding and playback. These audio capabi- lities serve the exploding mar- ket of audio accessories and peripherals that connects home and car Hi-Fi audio systems to the digital age. This includes the popular iPod® docking stations. The kit is based on the AVR high performance AT32UC3A 32-bit Flash microcontrollers and pro- vides developers with a ready-to- use hardware/software platform and a variety of interfaces and evaluation capabilities to meet their audio systems requirements and get faster to market. The fast AVR32 CPU featuring DSP instructions is perfect for tion on the 2" QVGA onboard display. MP3 decoding from a USB mass storage device requires only a third of the AVR32's pro- cessing capacity, leaving plenty of headroom for running the ope- ration system, streaming the data and refreshing the display. Customers with a license from Apple® are able to interface the kit to a iPod or iPhone® using an authorized Apple authentication chip adapter. For applications where the on-chip 512 KB Flash and 64 KB SRAM is not sufficient, the EVK1 105 dem- onstrates how to connect an exter- nal SDRAM, serial DataFlash, SD card reader and USB hard disk or memory stick. The ATEVK1 105 also features connectors for future wireless expansion modules supporting aooooo □arr/i iiiinnTrr r . i • — mEt ;vto •V • •• f* • « .*• E 1 3 fiffig| : ?8 : □ A .. • •-** n I 1 □ 1*11' » rnr a : ; sl°s 111! I! U l U in ■ ««• _ * I vr. !■_—* 1 • : V/\ ■U LU' IIX ILJi V s "I® S: (£) @ C>) • A\W32 s. . ’ p ' audio decoding tasks, and the UC3A handles two audio inter- faces. For high quality stereo out- put, the chip has a stereo 16-bit bitstream audio DAC with internal FIR and Comb filters. For 4-chan- nel or full surround sound, an IIS interface is available for connec- tion to an external audio codec. Both interfaces are supported with drivers that make full use of the AVR32 peripheral DMA con- troller which significantly reduces the CPU overhead. The ATEVK1 105 board comes preloaded with software that demonstrates audio playback. A booted kit will scan any USB mass storage device for MP3 or other audio files, and play them back. The kit's software will even scan the ID3 tag and present album artist and song informa- IEE802. 1 5.4™/Zigbee®, and Bluetooth®. Atmel provides all the source code free of charge, including software drivers for all periph- erals, TCP/IP stack and various USB class drivers. This is avai- lable in the AVR32 Software Framework, a software library integrated with the AVR32 Stu- dio development suite. Atmel also releases the schematics and Gerber files to allow customers to easily incorporate elements of the kit into their own designs. The ATEVK1 105 Digital Audio Gateway kit will be available from Atmel's distributors in March 2009 with a resale price of US$179 plus shipping. www.atmel.com / avr32 (090231-11) Technology The new PicoScope 4000 Series high-resolution oscilloscopes n ■HU. mmm Smmk IU UUuyw ■1 The PicoScope 4224 and 4424 FHigh Resolution Oscilloscopes have true 12-bit resolution inputs with a vertical accuracy of 1%. This latest generation of PicoScopes features a deep memory of 32 M samples. When combined with rapid trigger mode, this can capture up to 1000 trigger events at a rate of thousands of waveforms per second. • PC-based - capture, view and use the acquired waveform on your PC, right where you need it Software updates - free software updates for the life of the product USB powered and connected - perfect for use in the field or the lab Programmable - supplied with drivers and example code Resolution 12 bits (up to 16 bits with resolution enhancement) Bandwidth 20 MHz (for oscillscope and spectrum modes) Buffer Size 32 M samples shared between active channels Sample Rate 80 MS/s maximum Channels PicoScope 4224: 2 channels PicoScope 4424: 4 channels Connection USB 2.0 Trigger Types Rising edge, falling edge, edge with hysteresis, pulse width, runt pulse, drop out, windowed www.picotech.com/scope1012 01480 396395 5/2009 - elektor 11 INFO & MARKET NEWS & NEW PRODUCTS USB Support for Renesas M16C/6C Microcontroller Renesas Technology Europe, its Gold Alliance Partner Thesycon and MS C Vertriebs GmbH sup- ply a complete USB stack to sup- port the Renesas Starter Kit (RSK) RSKM16C/6C, based on the M16C/6C. The M16C/6C is a part of the popular M16C microcontroller platform with added support for USB 2.0. The M16C/6C product group includes a total of 16 diffe- rent models, and the new compo- nents are completely compatible with earlier versions. The new USB 2.0 compliant, full-speed 12 MB/s interface supports standard Control, Bulk and Interrupt transfer types. The components include the M16C/60 16-bit CISC CPU core that works with clock rates of up to 32 MHz and a power supply of between 2.7 and 5.5 VDC. The software stack complies with the USB 2.0 specification and sup- ports Control, Bulk and Interrupt transfer modes at maximum speed. It also includes complete USB request processing and expan- ded error recovery mechanisms for faultless operation. The USB stack firmware is written in ANSI- C and supports Renesas' High-Per- formance Embedded Workshop (HEW) development environment. To facilitate integration, the soft- ware is designed as a library and provided in source code form. The library does not require specific operating system support, enabling it to be integrated into any embed- ded operating system and used in standalone applications. All products are available at the MSC webshop. www.msc-toolguide.com / renesas (090231-III) Energy meter survives raging fire George Municipality, in the West- ern Cape, South Africa, recently witnessed the power of Conlog's meter technology when one of the company's meters, the single phase BEC23PL/ T, survived a fire. The meter was discovered when a customer contacted George Munic- ipality to report that he was unable to read the remaining credit on the meter. When technicians visited the customer's home, they discov- ered that the meter had actually endured severe fire and survived! The meter was still completely functional despite its appearance and exposure to the exceedingly high temperatures. Remarkably, the meter technology and mem- ory had not been affected, which means the consumer could still buy and enter electricity credit into his meter. In addition, the Municipal- ity could also access meter infor- mation using the meter number as usual. Conlog meters are usually tested to withstand a maximum of 960°C. In this case, an average house fire can reach over 1 100°C. www.conlog.co.za (090231-V) GPS industry's smallest standalone receiver u AMY-S Actual size! Alpha Micro Com- ponents has added u-blox' AMY-5M to its portfolio of GPS components. The new AMY-5M is the GPS industry's smallest standalone receiver currently available on the market. AMY-5M is miniature in size (6.5x8x 1 .2mm) and allows integration into the smallest portable devices. The fully tested ROM- based solution features the high performance 50-channel u-blox 5 positioning engine and has been developed for easy design imple- mentation. The module also works as a standalone device which can operate at 1 .8 V or 3 V, and does not require host integration or addi- tional components to function. Designed to withstand a tempera- ture range of -40°C up to +85°C, the receiver integrates a standard crystal, which brings very fast acquisition and tracking perfor- mance at an economical price. Furthermore, AMY-5M handles u-blox' Assisted GPS (AssistNow- Online and AssistNow-Offline) providing even better startup and tracking performance under weak signal conditions. AMY-5M can be assembled on a 2-layer PCB, which leads to additional cost savings. www.alphamicro.net /amy (09023 l-X) 12 elektor - 5/2009 THE ORIGINAL SINCE 1994 PCB-Pnoi; Beta LAYOUT Specialising in Prototype PCBs Free Laser Stencil on all Prototype PCB orders 1 WD prototype service Chemical Tin Finish (no extra cost) \ 2 \ Free Phone UK 0800 389 8560 GD Simply send your layout files and order ONLINE PCB-POOLCOM • sales■ Glcd_Box ! • Glcd_Circle \ Glcd_Dot 1 Glcd Fill Glcd_H_Line Glcdlmage Glcd Init Glcd_Line GlcdReadData Glcd_Rectangle GlcdSetFont Glcd_Set_Page Glcd_Set_Side GlcdSetX ]■■■ Glcd_V_Line Glcd_Write_Char Glcd_Write_Data Glcd_Write_Text + 0 Keypad4x4 1 Lcd_Constants V char txt[768]; signed int latitude, longitude; char ^string; int i; unsigned short ready; extern const unsigned short world_bmp[1 024]; char GLCD_DataPort at PORTD; sbit GLCD_CS1 at RB0_bit; sbit GLCD_CS2 at RB1_bit; sbit GLCD_RS at RB2_bit; sbit GLCD_RW at RB3_bit; sbit GLCD_EN at RB4_bit; sbit GLCD_RST at RB5_bit; void interrupt) { if (PIR1.F0== 1){ //Stop Timer 1: T1CON.FO = 0; ready = 1; i - 0; PIR1.F0 = 0; } if (PIR1.F5 == 1) { txt[i++] = UART1_Read(); if (i == 768) i = 0; //Stop Timer 1: T1CON.F0 = 0; //Timerl starts counting from TMR1 L = OxBO; TMR1H = 0x3C; //Start Timerl: T1CON.F0 = 1; PIR1.F5 = 0; } } sbit GLCD_CS1_Direction at TRISB0_bit; sbit GLCD_CS2_Direction at TRISBl_bit; sbit GLCD_RS_Direction at TRISB2_bit; sbit GLCD_RW_Direction at TRISB3_bit; sbit GLCD_EN_Direction at TRISB4_bit; sbit GLCD_RST_Direction at TRISB5_bit; //if interrupt is generated by TMR1 IF //SetTMRION to 0 //set data ready //reset array counter //Set TMR1 IF to 0 //if interrupt is generated by RCIF //SetTMRION to 0 15536: //SetTMRION to 1 //Set RCIF to 0 void Display_Cursor(signed int lat, signed int Ion) { unsigned char latitude_y, longitude_x; //Latitude and Longitude scaling for 1 28x64 display: //Latitude: Input range is -90 to 90 degrees //Longitude: Input range is -1 80 to 1 80 degrees latitude_y = ((61 *(90 - lat))/1 80) + 1; longitude_x = ((1 25*(lon + 1 80))/360) + 1 ; //Cursor drawing: Glcd_Dot(longitude_x,latitude_y,2); //Centar dot Glcd_Dot(longitude_x-1,latitude_y,2); //Left dot Glcd_Dot(longitude_x+1,latitude_y,2); //Right dot Glcd_Dot(longitude_x,latitude_y-1,2); //Uper dot Glcd_Dot(longitude_x,latitude_y+1,2); //Lower dot Delay_ms(500); Functions used in the program Glcd_box() Draw filled box Glcd_circle() Draw circle if J Glcd_Dot() Draw dot* Glcd_Fill() Delete/fill display* Glcd_H_Line() Draw horizontal line Glcd_lmage() Import image* Glcd _lnit() LCD display initialization* Glcd_Line() Draw line Glcd_Read_Data() Read data from LCD Glcd_Rectangle() Draw rectangle Glcd_Set_Font() Select font* Glcd_Set_Page() Glcd_Set_Side() Glcd_Set_X() Glcd_V_line() Glcd_Write_Char() Glcd_Write_Data() Glcd_Write_Text() Select page Select side of display Determine X coordinate Draw vertical line Write character Write data Write text Glcd library functions used in the program Other mikroC PRO for PIC functions used in program: Usart_lnit() strstr() Usart_Read() Delay_ms() 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 website: www.mikroe.com/en/article/ void main() { ADCON1 = OxOF; GLCDJnitO; Glcd_Set_Font(font5x7, 5, 7, 32); Glcd_Fill(0x00); Delay_ms(100); ready = 0; // Set AN pins to Digital I/O //Set TCKPS1 to 1 //SetTCKPSO to 1 //Set Timerl Prescaler to 1:8 T1CON.F5 = 1; T1CON.F4 = 1; //EnableTimerl interrupt: PIE1.F0= 1; //Set TMR1 IE to 1 //Timerl starts counting from 15536: TMR1 L = OxBO; TMR1H = 0x3C; //ClearTimerl interrupt flag: PIR1.F0 = 0; //Set TMR1IF to 0 //Note: Timerl is set to generate interrupt on 50ms interval UART1 _lnit(9600); //Enable Usart Receiver interrupt: PIE1.F5 = 1; //Set RCIE to 1 //Enable Global interrupt and Peripheral interrupt: INTCON.F7 = 1; INTCON.F6 = 1; //Start Timer 1: T1CON.F0 = 1; Glcd_lmage( world_bmp ); while(l) { RCSTA.F1 =0; RCSTA.F2 = 0; //Set GIE to 1 //Set PEIE to 1 //SetTMRION to 1 //Display World map on the GLCD //Set OERR to 0 //Set FERRto 0 //if the data in txt array is ready do: if( ready = 1){ ready = 0; string = strstr(txt,"$GPGLL"); if(string != 0) { //If txt array contains "$GPGLL" string we proceed... if(string[7] != '/) { //if "$GPGLL" NMEA message have " sign in the 8-th //position it means that tha GPS receiver does not have FIXed position! latitude = (string[7]-48)*1 0 + (string[8]-48); longitude = (string[20]-48)*1 00 + (string[2 1 ]-48)*1 0 + (string[22]-48); if(string[1 8] == 'S') { //if the latitude is in the South direction it has minus sign latitude = 0 - latitude; } if(string[32] == 'W') { //if the longitude is in the West direction it has minus sign longitude = 0 - longitude; } Display_Cursor(latitude, longitude); //Display the cursor on the world map } } } unsigned char const World_bmp[1 024] = { 255.129.1.1.1.129.129.129.129.193.129.129.129.129.129.129.129.129.129.129.129, 225.161.161.97.97.209.209.129, 49, 49,201, 201,201,201, 97,205,205,129,137, 25,5 7.57.57.1 21 .249.249.249.249.249.253.253.1 2 1.121.11 3.9.9. 1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 7.1 7, 145.145.145.145.129.129.129.1.1.1.1.9.73.73.73.73.193.65.65.129.129.193.193.129, 1 93.1 93.241 .241.241 .241.225.225.225.1 93.1 93.1 93.1 93.1 93.1 93.1 93.1 93.1 93.1 29, 193.193.225.225.129.129.129.129.129.129.129.129.129.129.129.255.255.1.33.17.17, 1 5.1 5.1 5.1 5.1 5. 7. 7. 7. 7.1 5.1 5.31 .63.63.63.63.255.255.255.255.255.255.255.255.251 .2 51 .240.240.240.240.226.252.252.249.249.250.240.240.1 .1.1.1 .3.1.1 .0. 0.0.0.0.2.2.0.0, 0,24,24,224,224,224,224,244,239,239,255,255,255,255,255,255,255,255,255,254,25 4,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,95,95,3,3,3,3,63,15,15,3,3,3, 3.3.1.255.255.0. 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.15.63.63.255.255.255.255.255.63, 63,63,63,63,63, 63,135,135,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,192,192,243,243,2 5 1 ,25 1 ,25 1 ,251 ,251 ,247,23 1 ,23 1 ,243,247,247,247,230,236,1 24,1 24,255,255,220,60, 61 .61 .63.1 26.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.255.2 55.255.255.59.59.3.7.3.27.1 2.7.7.0. 0.0.0.0.0.0.0.0.0.0.0.0.255.255.0.0.0.0.1 .1 .0.0. 0.0.0 ,0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1,1 ,3, 6, 6,1 3,1 3,1 3,1 3,1 7,242,242,242,242,240,224,224,1 92, 192.192.192.0. 0.0.0.0.0.0.0.0.0.31.31.31.63.63.63.63.63.63.255.255.255.255.255.255 ,255,255,255,255,248,248,247,247,55,3,3,3,3,0,1 ,1 ,3,3,1 5,1 5, 7, 0,0,1 ,1 ,3,3,239,1 5,1 5, 1.1 29.224.1 74.46.1 28.0. 1 28.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.255.255.0.0.0.0.0.0.0.0.0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,63,63,255,255,255,255,255,255,255, 255.255.255.254.254.1 2.1 2. 0. 0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0.1 .255.255.255.255.255.255.25 5.255.255.63.63.1 93.1 93.240.0. 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.3.4.9.1 29.1 93.1 92, 225.224.226.224.242.227.227.228.228.8.8.0. 0.0.0.0.0.0.0.0.255.255.0.0.0.0.0.0.0.0.0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,31 ,31 ,1 5,1 5,1 5,1 5,1 , 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,3, 3,1 5,1 5,1 5,1 5,1 5, 3, 3, 0,0,1 ,1 ,0,0, 0,0, 0,0, 0,0, 0,0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,7,1 5,1 5, 7, 7, 7, 7, 7, 3 1 ,3 1 ,1 27,1 27,70,70,0,0,0,0,0,0,208,208,0,2 55.255.0. 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.135.135.1 93.64.68.0. 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0. 1 28. 1 28 ,1 28,1 28,1 28,1 28,0,0,0,0,0,0,0,0,0,0,0,0,0,1 28,1 28,1 28,1 28,1 28,1 28,0,0,0,0,0,0,1 28,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,240,240,240,240,248,248,248,248,248,248,248,2 48.248.252.252.252.252.252.252.252.252.252.252.252.252.252.252.252.252.252.25 2,252,252,252,252,254,254,255,255,255,252,252,248,248,248,248,248,248,248,248, 248.248.248.252.252.252.254.254.254.254.254.255.255.255.255.255.255.255.255.2 55.255.255.255.255.255.254.254.255.255.255.255.255.255.255.255.255.255.255.25 5,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 ,255,255,255,255,255,255,255,255,255,255,255,255,250,250,250,216,216,248,255}; Microchip®, logo and combinations thereof, PIC® and others are registered trademarks or trademarks of Microchip Corporation or its subsidiaries. Other terms and product names may be trademarks of other companies. MICROCONTROLLERS Experimenting with Low-cost development system with a USB interface Emile van de Logt, MA MSc (The Netherlands) Texas Instruments supplies handy USB evaluation sticks with related software for its low-cost MSP430 controllers. Unfortunately the I/O facilities are somewhat limited. These can be substantially enhanced with the help of the experimenter's board described here. This combination forms the hardware basis for a mini-course 'Starting with embedded C', which can be found elsewhere in this issue. Sometimes several initiatives converge at just the right time to create a new concept. For some time Rotterdam Uni- versity had been looking for a low-cost development system for its students in Automotive and Electronic Engineer- ing, which could be put to use in micro- controller tuition. In addition, for logis- tical reasons Elektor was looking for a more practical replacement for the very popular E -blocks for its Embedded C Programming workshops. So both Rot- terdam University and Elektor were effectively looking for the same thing, although for different reasons. Once contact was established between Rotterdam University and the Elektor labs, it didn’t take long before it was decided to combine forces. The advan- tages of both the E-blocks as well as the configuration used by Rotterdam University were examined and a joint specification was produced. For students it is obviously important to obtain the hardware and software as cheaply as possible. The accom- panying development system should ideally be included free of charge. It should also be easy to use so that new students can quickly create their first program. Preferably not in assembly language, but in C using a full-featured C compiler! It should be enjoyable to work with, so preferably it should be Figure 1. The eZ430 evaluation stick, around which this experimenter's system is based. able to create sound (buzzer), display numbers (7-segment display), flash (LEDs), work via the USB port rather than the parallel port (modern laptops no longer have these) and also include further expansion possibilities (I 2 C, SPI). It would also be nice not to use an 8 -bit system any more, but rather something with a bit more muscle (16 or 32 bits). History Not that long ago an average electron- ics department would have to raise an expense request to obtain such a microcontroller system. These systems were often large dedicated computers, which required expensive software suites to develop embedded applica- tions. Via an ICE (In-Circuit Emulator) the program could then be debugged on the target system. If we said at the time that we could obtain such a system for less than 50 euros (or the equivalent in pounds or dollars) we would have been met with looks of disbelief. Despite this, there are currently students walking around with such a system in their backpack and they have lessons in programming such a microcontroller! The MSP430 series All the big electronics manufactur- ers supply microcontrollers offering a wide range of functions. However, 18 elektor - 5/2009 ^r».w /■ »«< c.vij 'f #i t **•> .'W « yp/cM*» «.*.<•* ■iB ft ^mii ’. fOffi****** f f—a~4».\ 4 0*2 (AM AIM I CJO.’.’O 4Cf; API* 0PM «o I l «or? oo : a aaji mi / J AP0?«C fJff PMO «J* | OOO.'IO K0> )l»0 I 0992ft if 92 9290 tm: 999234, 99D2 2710 0200 cap cootie far a j*c I ««f]» lori opic op.’ i mv ( OOP. 44 4»»f AMO cl* 444144 XOJ j*p 000MA 1)41 O.’OO im • II m C ^^,9 4200 jg*. I 9492ft *9f2 4411 4N| aov I I MM c } £ ' j 090292 iff 2 0299 ,,»*- . | j s/a isj” 1 * •«• AAAMf 4.’FJ 00 J | ,<*, ■FiM t; r» .'*4 // *11 j*** **** 4 «4» I 4 444441 l«| j - 1 • Mf *V *11 j*m 4|<4 ■•'/!« IV) 1 . *»:*/ • 4*4 // *11 1*4*1* liv ■IK •' ■•'1 l«) 1 .VI*)*/ • U // *11 |>*M *1*4 • P4 » 4 I4WJ1 »**> | //A),* • *1) // *11 JIM l» • 4) 1 4 14440) )M) * //**J*j » !* » » 0 when the above criteria are taken into account there is one manufacturer that stands out a bit from the rest, and that is Texas Instruments (TI). The MSP430 series in particular consists of a range of full-featured microcontrollers with a large number of I/O facilities. The most important properties are that they require very little power to run and that they contain a 16-bit proces- sor core. To keep things as simple as possible for the average electronic engineer, TI has designed evaluation ‘boards’ for this type of controller, where the complete hardware environment is housed inside a USB stick (Figure 1). This hardware environment is known as the eZ430. To this you can connect (via a so-called Spy-Bi-Wire connec- tion) various target boards. A complete system like this, including a C compiler, can be obtained for the unbelievably low price of under £20! After installing the software and plug- ging in the USB stick you can immedi- ately start with programming this fas- cinating microcontroller. But are there any disadvantages with this system? Unfortunately there are, since the eZ430 system only has lim- ited I/O facilities. The target board inside the USB stick is very small and therefore has only a single LED and Specifications • Experimenter's board with several I/O possibilities • Powerful 16-bit MSP430F2012 controller running at 16 MHz, 2 KB Flash and 128 bytes RAM • 4 indicator LEDs • 7-segment display • Piezo buzzer • Three pushbuttons • l 2 C/SPI connector • Powered via the USB stick or an external adapter one connector. This is not enough if it is to be used as a training tool or in microcontroller workshops. The Elektor MSP430 board There are basically two ways in which the number of I/O facilities can be increased in this system: 1. Add a new I/O board to the target board using the existing connector. 2. Design a new target board with the number of required I/O facilities and connect this to the USB stick using the Spy-Bi-Wire interface. For various reasons it was decided to go with the second option. A separate I/O board using a connector isn’t very stable and could sometimes give rise to connection problems. Furthermore, the target board is cheap enough that it makes little difference to the total cost whether the microcontroller is or isn’t part of the I/O board. The circuit diagram of the MSP430 board designed by Elektor and the lec- turers from Rotterdam University can be seen in Figure 2. The most impor- tant part on this I/O board is of course the microcontroller itself, an MSP430- F2012 (IC2). The reason for using this particular microcontroller and not the F2013 as supplied by TI in the eZ430- F2013 kit is that the F2012 has a dif- ferent type of A/D converter that has a greater range. Apart from that, both microcontrollers are identical. The experimenter’s board has a set of three pushbuttons that are connected 5/2009 - elektor 19 MICROCONTROLLERS K2 K3 R16 JP2 R13 ho o o 3V6 eZ430 R15 R14 III S3 6 O S2 K1 o o o o SI kkh V CC O C2 lOOn GND 11 10 R12 VCC IC2 MSP430F2012 TEST P1.0 RST P1.1 PI. 7 P1.2 PI. 6 PI. 3 PI. 5 P1.4 XIN XOUT GND green green IC1 V CC L 15 -|>C1/-> EN3 C2 ID 2D 9_ 10 74HC4094 JP1 O 1 BUZ LED RIO 3V GND Optional 4 R1 5 R2 6 R3 7 R4 14 R5 13 R6 12 R7 11 R8 150RI T50r1 150r1 150r1 T50r1 150r1 T50R1 TsorI V CC O © IC1 © GND 10 LD1 LTS4301E u ; (LI dp « o o T GND Cl lOOn 080558-11 Figure 2. The circuit diagram for the MSP430 experimenter's board. to PI. 5, PI. 6 and PI. 7. Most of the pins actually have several functions, depending on how they’ve been config- ured via the software. Four LEDs have also been included, two green and two red. The green LEDs are connected to the positive supply via a resistor and the red LEDs are connected to GND via a resistor. To light up a green a logi- cal zero has to be programmed on the relevant I/O pin. For red LEDs this is the exact opposite: with these a logi- cal one has to be programmed. It was done this way to quickly give students an insight into the differences of the common configurations that can be found. JP1 can be used to manually select either the red LED (D2) or the buzzer (BZ1). When the buzzer has been selected via JP1, it is possible to create a tone by quickly switching between logic zero and logic one on pin PI. 2. Increasing or decreasing the rate at which the level switches causes the frequency of the tone to change. 7- segment display LD1 is connected to the microcontroller via shift reg- ister IC1 (a 74HC4094). To display a digit on LD1 you first need to send an 8- bit code serially to IC1, after which input C2 of IC1 is made high via Pl.l. The serial transmission of data to IC1 is done via pins PI. 5 (clock) and P1.0 (data), where the most significant bit is sent first. The board gets its 3.3 V supply volt- age via the Spy-Bi-Wire interface (K3). There is therefore no need for a sep- arate power supply, except in cases Table 1. I/O pins for external communications I/O pin SPI l 2 C ADC PI. 5 clock ADC 5 PI. 6 serial data out clock ADC 6 PI. 7 serial data in serial data ADC 7 where the board is used in stand-alone applications. In those cases the setting of JP2 has to be changed so that the 3.3 V supply voltage can come via K3 (pins 1 and 5). We have also thought about expansion possibilities. The microcontroller has a Universal Serial Interface (USI), which can function as either an SPI or an I 2 C serial communications interface. These signals have been made available on both K2 (standard I 2 C connector) as well as K3 (expansion connector). The required I/O pins are listed in Table 1 . We haven’t described the A/D con- verter yet. The F2012 has a built-in 10- bit analogue-to -digital converter with eight input channels. It is also able to read the state of an internal tempera- ture sensor and measure the value of the supply voltage. Construction Now that we’ve given an overview of the experimenter’s board and its various functions, it’s time to put this I/O board to work. We decided early on to populate the I/O with standard components and not SMDs, so that the construction wouldn’t present any problems for less experienced constructors. In Figure 3 you can see the PCB that was designed for the I/O board. Sol- dering all the parts should be quite straightforward. As usual you should take care with the polarity of the LEDs and ICs. Elektor also supplies a com- pletely populated board, including the sometimes difficult to obtain connector for the connection with the USB stick (Elektor Shop # 080558-91). The EZ430 USB stick can also be obtained from Elektor (Elektor Shop # 080558-92). The board is connected to the USB 20 elektor - 5/2009 COMPONENT LIST Resistors R1-R8 = 150D 0.25W R9-R12 = 330£2 0.25W R13-R16 = 47kQ 0.25W Capacitors C1,C2 = lOOnF C3,C4 = optional, not fitted here (see Tl Appl. Report SLAA322) Semiconductors D1,D2 = low-current LED, red, diam. 3mm D3,D4 = low-current LED, green, diam. 3mm LD1 = 7-segment LED display, common cathode (e.g. Lite-On LTS4301 E) IC1 = 74HC4094 IC2 = MSP430F201 2IN (Tl) Miscellaneous S1,S2,S3 = PCB mount pushbut- ton, 5x5mm (e.g. Tyco FSM4JH) K1 = right angled 4-pin connector, lead pitch 1 .27mm (Mill-Max # 851-93-004-20-001000) K2 = 6-way RJ1 1 connector, PCB mount (Molex # 95009-2661) K3 = 5-way SIL pinheader JP1,JP2 = 3-way pinheader and jumper BZ1 = passive piezo buzzer (e.g. Kingstate# KPEG242) XI = 32.768kHz quartz crystal 1 6-pin 1C socket for IC1 1 4-pin 1C socket for IC2 PCB, # 080558-2 Ready assembled and tested board: Elektor Shop # 080558-91 Tl eZ430-F2013 evaluation kit: Elektor Shop # 080558-92 Figure 3. PCB layout for the board. Mini-connector K1 is used to connect the USB stick (via the middle four pins!). stick via the Spy-Bi-Wire interface. It’s easiest if you open the plastic hous- ing of the stick and remove the circuit boards; the target board can then be removed and in its place you can con- nect the experimenter’s board. In practice Does it work? Certainly! Although in this context by ‘work’ we don’t mean if the hardware functions correctly, since that won’t be a problem in most cases. Instead we mean if it works well in an educational environment, where stu- dents have to familiarise themselves with the complexities of program- ming in the C language on embedded systems. The results, both at the Rotterdam University as well as in the Embed- ded C Programming workshops at Elektor, are very positive. It appears that participants can quickly learn to write simple programs in the C lan- guage and can get them to work on the experimenter’s board. Most of the participants of these courses won’t have had much experience in program- ming in C, but it isn’t long before they start to delve into complex tasks such as writing timer interrupts, creating functions and driving the hardware on board. In subsequent projects, for courses both in Automotive as well as Electronic Engineering, we often come across the same hardware again! In the Embedded C programming workshop of Elektor a completed and tested version of the board is used, obviously in conjunction with the eZ430 kit from Tl. This complete kit can also be ordered by students, so there is no need to order them separately. Do*it-yourself After reading this article we wouldn’t be surprised if many readers would also like to try their hand at embed- ded C with the help of this experiment- er’s board. A description of the software needed to drive all hardware in this I/O board will be covered in a short three-part course, again in collaboration with Rotterdam University. The first article can be found in this issue of Elektor. It covers the first few steps: the installa- tion of the development environment and the testing of the completed board using the first example program. ( 080558 - 1 ) The author Emile van de Logt is an Electronic Engi- neering training manager at Rotterdam University. He studied Electronic Engineering at the Technical University in Eindhoven and Management Studies at the Open University. Emile spends his spare time designing electronic circuits and he is an ama- teur beer brewer. He also takes care of the Embedded C Programming work- shop and the FPGA-VHDL workshop for Elektor. 5/2009 - elektor 21 EMBEDDED C PROGRAMMING Getting started with Part 1: IAR Embedded Workbench and flashing LED AJ. (Bert) Korthof (The Netherlands) This is the first instalment of a three-part series which will introduce the fundamentals of programming a microcontroller in C. You can immediately try all the examples using the MSP430 hardware, which is also described in this issue, in combination with a PC or laptop which has a USB interface. The software we've used is available as a free download. In this way you will learn step by step how you can use the higher programming language C in all kinds of electronics projects. C is a genuine general-purpose programming language (there are over 400 different languages for computer sys- tems). C is a small, compact language, which is not all that difficult to learn. These days C is used mostly in embed- ded microcontroller applications. This means devices that contain a microcontroller doing one specific task, such as a coffee maker (compare that to the processor in a PC which runs a variety of programs). The Java language is also quite frequently used for this, but it places much higher demands on the hardware, specifically in terms of speed and memory. One or more C compilers are available for virtually every commercially available processor. An international standard Figure 1. The instructions of a higher programming language are converted into machine language that the processor can understand. Higher programming language Assembly Machine language Java Basic \ / Instruction set Object code Code example: 3 . &=b LD R1 , a LD R2 , b AND R1 , R2 ST a , R1 0110100111 081041-11 for C has been established: ANSI-C (end of 1988). There are standard library functions, function declarations and definitions. You can really only learn C++ once you know C. As a little known fact, C evolved from the language B. Windows and Unix operating systems are typically written in C or C++. The C language is close to the hardware on which the program will run. The C program lines are con- verted by the C compiler into assembly language: this lan- guage is the closest to the hardware: the (micro)controller (see Figure 1). Nowadays, programming in assembly language is usually only done if the code needs to be extremely compact or run very quickly. Every family of processors, such as those made by Atmel, Microchip and Texas Instruments (Tl) has their own unique instruction set and you have to know all the registers and memory locations really well and write much more code yourself, such as for tasks like multiplica- tion or division. Processor For this course we chose the MSP430 family made by Tl. These are powerful 16-bit processors which are eminently suitable for battery-powered applications such as measuring instruments and intelligent sensors. The specific processor that we use here is the MSP430F201 2. Here are a few of its salient features: • Power supply voltage from 1 .8 to 3.6 V • Internal clock up to 16 MHz • A 32 kHz watch crystal can be connected directly • 2 timers which can be used for accurate timing measurement or pulse generation. • 2 Kbyte flash memory for code and the storage of parameters (non-volatile) • 1 28 bytes of RAM for variables • 1 0-bit A/D-converter at up to 200 ksamples per second • USI (universal serial interface), can be used for SPI and l 2 C 22 elektor - 6/2009 * * t r * t r lfr-ff ** L J J Jl embedded* UJJ* -*s/ Jn £ J/ .V^rrV.ft*v* v> CJJCJ C^J Jfowrf- ££S^ Otf ca«f r,;. &A+JQ Uiffii J-etsCG-^jr g ■>****/ J. UJJ £*^4*5^^'-. { HU/SCSit d> «W* // n/JCi'Ai^^ SiHHST Ot£ -« *Uirj*yXTJ *tiST/j//S>iaXX-‘3Qj itl.l.Pl. 2, &2.3.SH. i oucpt •saJJe t2J // ijiizileaa iaop f uii&Jgu&zi Inc j / flour - .7,07/ // J_'_' pjzu# itig* /b.- fJ a 0, 1 « -J55J5; J++J J //delay flow -, 0, // all plaa lots /OJT (J * 0/ j < 05533 / jrr) / //delay J // while ( ) J // maJzt The amount of memory available for your own programs is quite small, but you will be surprised how many useful programs (such as interfacing with sensors, controlling sim- ple machines (state machine) data conversion, counters, security applications, etc.) can be made to fit in this small space. The C compiler used here is supplied by IAR and converts code efficiently into machine language. Just about anything that is possible in C you can learn using this com- piler. In addition, you can use the same software for the bigger and more powerful processors from the MSP430 family as well! Hardware and software This first article describes the organisation of the develop- ment environment for programming in embedded C, so that you can easily begin writing your own simple programs and debug them in real time or single step by executing the code in the microcontroller on the Elektor PCB, number 080558-2. The board contains, of course, a microcontroller to run the code and also several examples of sensors (push buttons) and actuators (LEDs, 7-segment display, buzzer), see Figure 2. For the development environment we use the IAR Work- bench KickStart software, which is supplied by Tl accom- panying the eZ430 USB stick. Making a start with C We cannot cover an entire book worth of C in these three articles, but there are already plenty of C books and very good courses are available on the Internet (see [1] and [ 2 ])- The C language is not all that difficult to learn, there are only 32 keywords (Table 1), C simply does not know any more words — compare that to English or any other nor- mal language. Figure 2. The experimenting board contains several sensors and actuators for interaction with the user. Table 1. The standard version of ANSI-C has only 32 keywords. auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while 6/2009 - elektor 23 EMBEDDED C PROGRAMMING Figure 3. The file BlinkingLeds.c is linked to the project in IAR Embedded Workbench. Here we cover the details that are specific to our hardware and software, details which are not in a C book because the C language is universal! We learn the basic rules for C programs which can run on an ordinary PC. To do this we use the standard header file: # include "stdio.h", which contains the definition for the commands printf and sconf. This is used to define the standard input and output chan- nels for the hardware that is used. A standard C program consists of declarations of variables and functions. The function main/) must always exist. This contains the statements that are carried out sequentially, one after the other. Main begins with a left brace and ends with a right brace. Every statement is terminated with a semicolon (;). The names of variables can be chosen freely, but in the C language we have to indicate clearly what type it is, for example the variable /: unsigned int i. To the MSP430 processor this means an integer in the range from 0 to 65535, the processor by default works with 1 6-bit numbers. IAR Em be dried Woikljtmuli IDE □@[X) | Fjfc Edit Wow Project Emulator Took Wndow Hc|p □ e? m ■ u'B W — F ■ jJ v V | = r j LL' V ip/ lip | - t, & y Debug - Files hj, " * *-Si 0£jTcstt - Debug ■J m i H 0 1 Dulput i«r y dr df : rf- £ rf- £ dfr £ rf- rf- £ £ rf- £ £ Jr £ £ dfr £ rf- Jr dfr £ £ £ Jr £ £ £ Jr £ dfr £ £ £ ** Fila : BliukiugLads . c ** Author .■ Bart Korthof ** Da ire : 25-2-2009 ** Compilar: JAR Fmhaddad V4. 6. 0. 0 ** This program tas ts the four lads of tha T. I. EzJ 30 USB s t iok ** aiKi tha Flaktor axtausion hoard 030553-2. £>' inc lude ' r msp430K2OK2 . h' r imsiijnetl int i ; void main (void) ( HEmCTL - WMT&T I WDTHOLEi; // watchdog timar off PlIiIP. ■= Em+EIT2+EIT3+EIT4://P2DIE=30 r - 21.1,21. 2, FI . 3, FI. 4 output while ( 1 ) ZZ audios s loop unsigned int j ; P10UT = 255; // all pins high tor (i = 0; i < 55535; i-H-j : //dal ay V 1 fltlT b i ; // all pi ps 1 oto fnr (j = i; j <" >55535; j-H-] ; Z/dalay } ZZ uhilo.Q } ZZ iva t n tion registers are cleared, so that the ports are initially con- figured as inputs! First program Our first little C program will drive four LEDs. When we look at the schematic in the construction article we can see that the LEDs are connected in different ways via resis- tors to microcontroller port PI ! To turn the red LEDs on, the microcontroller has to put a logic High level (power supply voltage, 3.3 V) on port pins PI .1 and PI .2. This is called active High. To turn the green LEDs on, port pins PI .3 and PI .4 have to be made Low (0 V), because a pull-up resis- tor is used here. These are therefore active Low. As a pro- grammer we have to keep these things in mind. To prevent time-consuming mistakes in the code the 'software guy' will therefore also have to be familiar with the hardware. Launch the IAR Workbench, incorporating the C compiler, simulator and debugger. Then create a new workspace for a new project which contains the C statements in a text file which you call BlinkingLeds.c, so that the C compiler can recognise this as a C program. In addition you have to tell the compiler which hardware this program will run on. Because this requires going through a number of steps and the selec- tion of various options, we have described this process in some detail in a supplementary article Getting storted with IAR Work- bench which is available free from the Elektor website. We will assume that you have done all this and have opened the file BlinkingLeds.c and have linked it to your project, as can be seen in Figure 3. The program (the source code) is compiled (translated into machine code) by clicking on: ► Massages UpJaJriy Liurld li t: «... BlinkingLeds.c I inking Total number of errors: 0 Total number o>f warnings: 0 File U A < > Reariy Frmro 0, Wnrningc ll /BOB'. All text between /* and */ is treated as a comment by the compiler. We can also add comments after //. We obviously do not have a microprocessor board to which we can connect a printer or keyboard (this requires a much more powerful processor). However, we can 'print' by showing numbers on the display and scan the state of the push buttons (read). Each of the port pins of this processor can be individually configured as either an input or an output. We can con- nect logic-level signals (0 or 3.3 V) to an input, for example using a switch. You cannot do this to an output of course! (Take note: you can get a high current when you connect an output pin set to a High level, to 0 V through a switch!) For safety, the default values of the bits in the port pin direc- At the bottom of the window we can see that there are no C lan- guage errors in the code and how much code and data mem- ory we have used. Although there are no syntax errors in the program, the C compiler can- not, of course, tell us whether the program operates as it should! This we have to check for ourselves! In the code we can see words such as BIT1 (binary for 0 ... 010), P 7 OUT (outputs of port 1) and WDTCTL (control register for the watchdog timer, this will reset the processor if the program gets stuck). The definitions for these words are in the header file msp430x20x2.h. This also contains all the features of the processor that we are using, such as the addresses of the ports, memory size, special registers for the timers, clock generator, etc. With the statement PI DIR = 30 (=2+4+8+16) the correct bits in the port direction register are set High so that the port pins for the four LEDs (PI .1 through PI .4) are set to outputs. A port pin which is configured as an output can supply up to about 5 mA, sufficient to drive an LED directly! 24 elektor - 6/2009 With the instruction PI OUT = 255 (binary 11111111) we make all eight bits of port 1 High. Only the port pins to which the LEDs are connected will go High. The other pins do not go High because they are not configured as outputs. Structure of the BlinkingLeds program As already noted, the statements between the braces of the 'main' function are executed sequentially. If this were the only option then our program would be very long. In C we can also make program loops and program jumps: with the statement while(condition = true) all the code between the braces is repeated until the condition is no longer true. Here we use while(l), were 1 means 'true' (0 means 'false'). The while-loop is therefore repeated forever (or until the power supply is disconnected or the reset pin of the processor is activated). In addition we also see a for(... loop, with which we let the processor count from 0 to 65535 (this is the largest positive number that we can represent with 1 6 bits; 2 16 -1). This loop is added twice to create a software delay of about 2x0.5 seconds, so that we can clearly see that the LEDs are flashing. For this we declared the vari- ables i and j, where j is a temporary variable, the memory location of which is available to be reused for other vari- ables (this reduces the amount of the — limited — RAM that is used). After this brief explanation we continue with IAR Work- bench to 'flash' the program into the microcontroller by clicking on C-Spy: goes from 0 to 1 (if it was already 1 then it remains 1 ). In the C language we can indicate these two operations as follows: PI OUT (new value) = PI OUT (old value) I BIT 1 ( / is in C the bit-wise OR function). The C language is well- known for its concise notation, so it can therefore also be written shorter: PI OUT 1= BIT1 . Another example of this compact notation: i++ means: read the value of / from its memory location, add 1 and write the result to the original location (the original value is there- fore lost). The OR function is necessary for setting a bit (making it High). For resetting (0) we require the AND function (bit- wise AND; in C the symbol for this is &). Say we want to make the third bit Low. We need to make a mask with the inverse of 00. ..01 00 and use this in an AND function, the bit-wise operator for inversion is the ~. The short notation therefore becomes: PI OUT &= ~BIT2. Example: P 1 OUT = 0 1 0 1 0 1 0 1 . We want to reset the last bit only. Use a mask that is the inverse of 00000001 (this is 11111110 and use this number in a logic AND func- tion with the o d value of the port: 01 01 0101 & 11111110 = 01010100 . Finally an interesting exercise: Change the program Blink- ingLeds. c so that you obtain a running light where each of the LEDs turn on one after the other. Don't forget the for-loop to obtain a delay, otherwise the LEDs will change every few microseconds and it will appear that they are all on at the same time, because of the persistence of our eyes. Try it for yourself!! We assume that the board is connected to the USB port via the MSP-eZ430 USB interface board and all settings are configured according to the document: Getting started with IAR Workbench. We now arrive in the debug mode and can manually run through the program step by step and watch the values of the variables at the same time (Figure 4). We can open a Watch window by selecting Watch in the View menu and adding the variables 'i' and 'j' in the dashed rectangles. You can experiment for yourself with Single-step-mode, the RUN mode (we can now see the red and green LEDs flash!), Break (the next statement which is ready to be executed is shown in green) and stop using a reset. Running through the for-loop in single-step mode gives little information and will take a very long time. We can change the variables 'i' and 'j' in the Watch window by clicking on their value and typing 65534, for example... and with only a few more steps we're out of the loop! Masking of bits The C language can do many things, but we cannot, for example, directly change a single bit to logic High (1 ) or Low (0)! For example, using the statement PI OUT = BIT1; (or PI OUT = 2;) we can make the second bit High, the red LED D1 will turn on, but th is will cause the other port pins to be Low! This could result in other impor- tant actuators such as an alarm or motor to be turned off or even on. We can solve this annoying problem by the masking of bits: If P 1 OUT has the value, for example, of 01 ... 1 01 and we only want to make BIT1 High and leave the other bits unchanged then we first use a logical-OR func- tion with 00. ..01 0 and send the result to the port pins. With the OR function all bits remain the same, except BIT1 which ? IAR Embedded Workbench IDE Figure 4. In de debug-mode we can run through the program step by step and at the same time examine the values of variables. The example program BlinkingLeds. c can be downloaded from the web page belonging with this article (www.ele- ktor.com/08 1 041 ) filed under number 081041-1 1 . The supplement Getting started with IAR Workbench can also be found here, filed under num ber 081 041 -W. ( 081041 - 1 ) About the Author Bert Korthof is a Lecturer in the department of Automotive Tech- nology/Electrical Engineering at Rotterdam University. Internet Links [1 ] www.lysator.liu.se/c/bwk-tutor.html [2] www.cprogramming.com/tutorial/c/lessonl .html 6/2009 - elektor 25 TECHNOLOGY USB The Universal Serial Bus (USB) was introduced in 1996 to allow easy connection of different devices to a computer by means of a fast serial link. Since then, USB has gradually become the widest used connection system for PCs, forcing at least two traditional connection systems, RS232 and Centronics, to take a distant back seat. USB has seen many speed increases and other enhancements over the years and release 3.0 seems to hold another promise. Although USB has evolved since its introduction, its princi- pal advantages have remained unchanged from the first version and can be summarized as: • 'Live' connection / disconnection (hot swap). To connect or disconnect a USB device it is not necessary to switch off the computer. Figure 1. The USB 3.0 logo. • Bus Power: the USB can, in most cases, power devices. • Plug and Play: the device connects to the USB and is almost instantly ready for use. In some cases, it is neces- sary to install a driver. The USB Implementers Forum (USB-IF, [1]) is in charge of developing USB regulation in its entirety. USB-IF is formed by several companies: Hewlett-Packard Company, Microsoft Corporation, Intel Corporation, NEC Corporation, ST-NXP Wireless and Texas Instruments. Today, the USB is so widespread that it has practically elimi- nated the parallel (Centronics) and serial (RS232) inter- faces from our computers. The current USB version is 2.0, but very soon we will have version 3.0 with SuperSpeed. Although USB 3.0 devices and computers are expected on the market by the end of 2009 or the beginning of 201 0, Windows 7 is not expected to support USB 3.0, at least in its initial version. USB interface evolution USB version 1 .0 evolved to 1 .1 and from there to version 2.0 (Table 1). Version 3.0 does not substitute 2.0 but rather complements it. USB 3.0 includes version 2.0 plus a feature called SuperSpeed (for practical purposes, a data transfer speed of 400 MBytes/s is expected). The impressive speed of USB 3.0 will help to rapidly transfer large amounts of data in devices like hard disks and high definition video cameras released on the market in the near future. Another important advantage of USB 3.0 that it supports higher current supplied to devices ('Bus Power'). In addi- tion, a computer with USB 3.0 will have complete USB 2.0 support and SuperSpeed on top of that. If we connect a 26 elektor - 5/2009 HOST 3.0 device we have SuperSpeed. If a 2.0 device is con- nected, the speed would be either Low Speed, Full Speed or High Speed. USB 3.0 architecture The USB architecture is arranged by tiers. Figure 2 shows the first tier ('root') at the top of the architecture and below we find tiers 2, 3, etc. At the first tier we only find the host (physically allocated to the computer) which is the bus controller having several downstream ports (DS PORT) to connect the USB hubs and the USB peripherals. Peripherals are the USB devices (printer, hard disk, etc.) and they have an input upstream port (US PORT). Each periph- eral can have more than one device internally. Devices are marked by data origin and data destination, and the trans- fer is between the host and the logical function or functions of each device along the function interfaces. We can think of a keyboard with associated card reader; this would be the peripheral. Inside this peripheral we have two devices: keyboard and card reader. In a logic-driven way, the host will communicate with the keyboard function and the card reader function by means of their interfaces. Table 1. USB interface evolution Version USB 1.0 USB 1.1 USB 2.0 USB 3.0 Date 1996/01 1998/09 2000 / 04 2008 / 1 1 Speed Low Speed 1.5 Mbits/s Full Speed 12 Mbits/s High Speed 480 Mbits/s Super- Speed 5 Gbits/s The hubs have an upstream input port which turns to the host or to a hub output. The hubs also have several down- stream output ports to expand the BUS (they are the cen- tre of the USB architecture stars). The hubs are situated on lower USB architecture tiers (tier 2, tier 3, etc.). They are special peripherals. The terms 'port input' and 'port output' should be taken to refer to the position in the architecture since data can travel in both directions, i.e., upward and downward, via any port. The number of devices is 127 maximum, while up to 5 hubs can be inserted between the host and a device. For this reason, on the last tier, # 7, there can only be devices but no hub. Upstream and downstream port connectors are different to avoid connection mistakes. With USB 3.0 compatibility is guaranteed with previous releases thanks to its double bus architecture. This way, there is the possibility to run at Superspeed alongside 'older' speeds (like for USB 2.0). In Figure 3, an example is shown which includes a 3.0 host, a 3.0 hub and a two peripheral functions, one USB 2.0 and another USB 3.0. The topology of the double bus is also shown. SuperSpeed and non-SuperSpeed (USB 2.0) connections are physically comprised together in the USB 3.0 cable. A definite improvement in the USB 3.0 standards is that the dataflow heads to a correct device only, while USB 2.0 TIER 1 TIER 2 TIER 3 TIER 4 TIER 5 TIER 6 TIER 7 HUB DEVICE HUB DEVICE DEVICE HUB DEVICE HUB DEVICE HUB DEVICE DEVICE HUB DEVICE DEVICE 080880-52 Figure 2. USB 3.0 architecture. used to distribute the information across the entire bus. The USB 3.0 host For compatibility the 3.0 host (Figure 4 and Table 2) com- prises one SuperSpeed host and another non-SuperSpeed host (i.e. USB 2.0). Therefore the 3.0 USB bus can work simultane- ously at SuperSpeed and non-SuperSpeed (USB 2.0). HOST USB 3.0 USB 2.0 SuperSpeed DS PORT DS PORT HUB USB 3.0 USB 2.0 CABLE - — SuperSpeed CABLE — COMPOSITE CABLE USB 2.0 CABLE- —SuperSpeed CABLE US PORT HUB SuperSpeed DS PORT DS PORT DS PORT DS PORT PERIPHERAL DEVICE FUNCTION SuperSpeed 080880-53 Figure 3. The example shows the double bus topology. 5/2009 - elektor 27 TECHNOLOGY USB Figure 4. USB 3.0 host. Figure 5. USB 3.0 hub. 080880-55 Figure 6. USB 3.0 peripheral device PERIPHERAL DEVICE USB 3.0 SINGLE FUNCTION SINGLE INTERFACE US PORT X FUNCTION SuperSpeed 080880-56 Table 2. USB 3.0 Host Meaning Connection direction Where can it be connected? DS PORT Downstream Port Downward Hub (US Port) Peripheral (US Port) Table 3. USB 3.0 Host Meaning Connection direction Where can it be connected? US port Upstream Port Upward Hub (DS Port) Host (DS Port) DS port Downstream Port Downward Hub (US Port) Peripheral (US Port) Table 4. USB 3.0 Host Meaning Connection direction Where can it be connected? US port Upstream Port Upward Hub (DS Port) Host (DS Port) The USB 3.0 hub Figure 5 and Table 3 show that a 3.0 hub actually has two hubs inside, one for USB 2.0 and another for Super- Speed. That way, the USB bus expansion obtained from the use of hub is compatible with SuperSpeed and non-Super- Speed (USB 2.0). Figure 7. USB composite device. 080880-57 The USB 3.0 peripheral Peripherals with a single device can consist of one or more topologies (just one function, or several): • a peripheral with a single function and a single interface constitutes a single device (Figure 6 and Table 4). • a peripheral with multiple functions and multiple inter- faces constitutes a composite device (Figure 7). There are also peripherals with more than one device. These devices are permanently connected to an integrated hub: Figure 8. USB compound device. 080880-58a 080880-58b 28 elektor - 5/2009 Table 5. USB 3.0 Cable D Letter Comment Conductor Name A Jacket — B Braid Shield C Filler — D UTP (unshielded twisted pair) signal differential pair UTP_D-, UTP_D+ E 2 x SDP (shielded differ- ential pair) First pair: SDP1-, SDP1 + Second pair: SDP2-, SDP2 + F Power PWR G Ground GND_PWRrt • a peripheral with multiple devices constitutes a compound device (Figure 8). If a peripheral internally comprises a USB 3.0 function alongside a 2.0 function, these functions will not be able to function simultaneously. USB 3.0 wires and connectors USB 3.0 wiring has all the USB 2.0 conductors plus new ones for SuperSpeed — see Figure 9 and Table 5. The UTP pair belongs to USB 2.0 and the two SDP pairs belong Table 6. USB 3.0 cable types Type and size Plug 1 Type and size Plug 2 A-Standard B-Standard A-Standard A-Standard A-Standard B-Micro A-Micro B-Micro A-Micro B-Standard to SuperSpeed. The positive and the negative wires already existed in USB 2.0 version and remain unchanged in ver- sion 3.0 (Figure 10). The UTP pair allows half-duplex transmission: however the two pairs together allow dual-simplex, which is a great advantage. Data traffic can exist simultaneously in both directions. The nominal differential voltage on both SDP data pairs is 1 V . The USB 3.0 cable reveals a plug on each side. Depend- ing on the plugs used, five different cable types exist (Table 6). It can be seen that there are only two types of plug, A and B. Type A connects upwards (i.e. to DS PORT) and B, down- wards (i.e. to US PORT). Besides, there is the standard size and 'micro'. All the cable types, except for one, have an 'A' type plug at one end and a 'B' on the other, to connect the computer (host) with the peripherals or the hubs, and the hubs with other hubs or peripherals. The exception is the cable with an A type plug at both ends (it becomes something like a crossover cable). According to the USB 3.0 standards, this cable will be useful to connect one host with another (computer-to-computer link). This is something new because under USB 2.0, only two computers could be interconnected Figure 9. USB 3.0 cable section. Figure 10. USB 3.0 cable. Figure 11. USB 3.0 cable and connectors. 5/2009 - elektor 29 TECHNOLOGY USB Figure 12. The SuperSpeed logo. rent, and will communicate status to the peripheral. USB version 3.0 increases the supply capacity for periph- erals, allowing many of these to rely on external supply, being powered directly from the USB bus. If a peripheral needs even more current, it has to provide its own power source, internally or externally ('self powered'). by such a link (Figure 11). The USB 3.0 standards mention that cables must fulfill pre- determined electrical specifications — based on these, the maximum cable length can be assumed to be about 3 meters (10 feet . The USB 3.0 p ugs and sockets (receptacles) are different from USB 2.0 ones (though similar), due to more wires being connected. The cable plugs must be connected to the sockets. The sockets can be A or B type, and standard or micro sized. We will typically find the A type in the computer (host) and in the hub output. The B type will be located in the peripherals and on hub inputs. The A or B type sockets allow both USB 3.0 and USB 2.0 cables to be connected (in the latter case, without SuperSpeed). USB 3.0 bus power As will be generally known to Elektor readers, the USB interface powers peripheral devices connected to it with a nominal 5 VDC (4 VDC minimum), see Table 7. The USB standard employs the term unit load to express the amount of current carried: • USB 2.0: one unit load equals 100 mA. If the current demand remains under one unit load, the current supply is Table 7. Bus Power current Type unit load mA minimum maximum minimum maximum USB 2.0 1 5 100 500 USB 3.0 1 6 150 900 guaranteed and it is a low-current peripheral. If it is higher — up to 5 unit loads (500 mA) — it is a high-current periph- eral. The host will determine if the bus is able to deliver that current, and will communicate status to the peripheral. • USB 3.0 : one unit load is 1 50 mA. If the current demand remains under one unit load, the current supply is guaran- teed and it is a low -current peripheral. If it is higher — up to 6 unit loads (900 mA) — it is a high-current peripheral. The host will determine if the bus is able to deliver that cur- More about power USB 2.0 or 3.0 can power peripheral devices (positive: VBUS, negative: GND), but in the USB 3.0 regulation there is an important novelty: a peripheral device can for- ward supply power to other elements. For that, the periph- eral device uses a specially powered type B socket which includes all known signals (positive, negative, one UTP pair and two SDP pairs) but adds two new ones: dpwr and dgnd, with a 5 VDC nominal voltage between them and 1 A DC maximum current draw. This new supply is delivered by the peripheral device, not by the bus. If, for instance, we have a USB 3.0 printer with a powered B socket, instead of connecting with a cable to the USB bus (to the host or to some output from some hub), it will be pos- sible to connect it to a wireless USB adaptor and power it at the same time. In this way the USB adaptor will receive its supply voltage from the printer and does not need another source. As a matter of course, the USB adaptor will have a powered B plug (i.e. a normal powered plug with two more terminals, to take the dpwr and dgnd lines presented by the printer socket). 'Pipe', 'endpoint', 'transaction' A few words about USB lingo used by experts: • Pipe: virtual data path between host and endpoint. • Endpoint: the destination of each pipe. These are memory buffers to store multiples bytes. Physically they usually are memory registers or mere positions inside the devices. End- points are numbered from 0 to 1 5 (EP0, EP1 , EP2, ... EP1 5 each being an input or an output, from the host's point of view. All of them are optional, except EP0. EPO's input or output is used to access device configuration data. Since EP0 always exists, a pipe also exists between EP0 and the host called default control pipe. • Transaction: this refers to the data exchange between the host and the endpoint from the device across the pipes. The endpoints, besides being an input or an output, are also classified as: control, bulk, interrupt or isochronous , giving rise to four types of transaction as summarized Table 8. If a device input endpoint has to send data to the host, it notifies the host and starts the transaction. This protocol is called asynchronous traffic flow — new and better than the polled traffic flow within USB 2.0: the host is periodi- Table 8. Transactions Control Bulk Interrupt Isochronous Typical use Configuration Printer Scanner Keyboard Audio Video Mouse Essential Yes No No No Corrective Yes Yes Yes No Data flow directione Bidirectional 1 or O 1 or O 1 or O Message type Control Data Data Data 30 elektor - 5/2009 cally checking if some device wants to send data to it. The poll is a worse technique because it adds to the traffic on the bus. Descriptors on USB 3.0 The devices have certain descriptors, i.e. data lists which the host uses to configure and manage devices. The most important are: • Device descriptor: there is only one. It includes general information from the device's VI P/PI D (number pairs that identify the device) and number of different configuration ways shown. • Configuration descriptor: one for each way of configuring the device. It includes specific information about the device, number of interfaces and maximum current consumption (in 8 mA increments). Remember that data transfer occurs between the host and the device function interfaces. • Interface descriptor: one for each interface. It basically contains the number of Superspeed and non-Superspeed endpoints of this interface. In practice, each interface is a collection of virtual data paths (pipes), one for each endpoint. • Endpoint descriptor: one for each SuperSpeed or non- SuperSpeed endpoint, it describes if it is input or output, and the kind of transaction (control, bulk, interrupt or iso- chronous), etc. • Superspeed endpoint companion descriptor: one for each SuperSpeed endpoint. Specific to USB version 3.0: former descriptors are also found in USB 2.0. Device enumeration under USB 3.0 A process called enumeration is launched when connecting a device to the USB bus. Several things start to happen: • Default Control pipe is established between the host and endpoint 0 on the device. For the moment, the maxi- mum current a device is allowed to draw is one unit load (150 mA). • The host allocates an address to the device (1 to 1 27). • The host reads the descriptor device by means of the default control pipe to know the VI P/PI D and the number of possible configurations the device offers. • The host reads the configuration descriptor by means of the default control predetermined pipe. It will have as many configuration descriptors as possible configurations offered by the device. The rest of the descriptors (interface, end- point and Superspeed endpoint companion) are also read at that time as they are associated with the configuration descriptor. Using all this information, the host configures all the endpoint and establishes all the pipes. According to the data read from the device, the host can respond to the device's supply current requirement, ranging from one unit load (150 mA) to 6 (900 mA). ( 080880 - 1 ) Internet Link [1 ] www.usb.org Advertisement Unmanned aerial vehicle by Jason Edelberg Internet relay chat application by Harrison Pham T - * Prop-6502 Laptop by Dennis Ferron Prop 128 Light Controller by Gregory Bartlett Propeller Chip With eight 32-bit processors in one chip and deterministic control over the entire system, the Propeller microcontroller is inspiring a wide range of projects. Z n www.parallax.com Milford Instruments www.milinst.com Spinvent www.spinvent.co.uk 5/2009 - elektor 31 MODELLING Automatic Running for internal combustion model engines Part 2: the test bench, actuators and detectors Michel Kuenemann (France) Last month, we began constructing a running-in bench for i/c engines for scale models with the description and wiring of the electronics boards. Now we need to build a chassis capable of housing our new boards, the engine to be run-in, and all the essential accessories. Building the boards led us to make intensive use of the soldering iron and measuring instruments in our electro- nics lab. This month, the saw, drill, and screwdrivers are coming to the fore. To get the best out of these boards, it’s vital to have a bench that is perfectly readily available commercially. Most of them can be replaced without any problem by equivalents, depending on what you may already have, and your needs. After describing the chassis of the bench, we’ll tackle fitting, testing, and The bench... ...has been specially designed for our application by experienced model enthusiasts (Figure 1) — the plans for this bench are available for download [1]. The base of the bench, the chassis, Figure 1. The prototype of our bench, without fittings. Figure 2. The compartments for the electronics, batteries, and cables. suited to this very specific activity of running-in model engines. Throughout this article we’ll be guid- ing you step-by-step through building your version of the bench. We have checked that the components used are adjusting all the bench’s actuators and detectors. Before getting down to things, we strongly advise you to read the inset about the basic precautions relating to using model i/c engines. is made entirely from 10 mm plywood. The bench is compact enough that you can put it away on a shelf between two running-in sessions. This chas- sis takes the engine, the fuel tank, the electronics boards, and all the neces- 32 elektor - 5/2009 worldwide Running-in bench Motoren-Priifstand Banc de rodage Motor-testbank Banco de rodaia 080253 &*rf. I M&SztM f r £rtf*rr. r as abr.t j sary peripherals. The engine is fixed using a robust aluminium mount specially designed for the purpose. You’ll have no problem finding this sort of acces- sory in model shops or on the Inter- net. This mount is able to take most single-cylinder engines up to 20 cc. It is of course pos- r sible to make do without a mount of this type, but in all cases, make sure you have a solid fixing, and secure the engine fixings with thread locking compound (Loctite, etc.) or using self-locking nuts. charge of the gases, and all you have to do is put a container filled with old rags under this elbow to collect all the oil given off and thus avoid polluting the environment, at the same time making cleaning up after each run- ning-in session a lot easier. The fuel tank is slightly raised to meet the height requirements (see box). It may be necessary to adapt the fuel tank mount to the dimensions of your particu- lar tank. Let's talk safety! The strange plastic elbow on the left of the bench, you’ll no doubt have guessed, is used to channel the oil-laden exhaust gases that the engine emits during running-in. This simple, cheap arrangement proved highly effective during our trials. The large diameter of the tube means that it doesn’t in any way affect the dis- Contrary to what their appearance might lead us to think, model engines are not toys. Their considerable power and the presence of the propeller makes them potentially dangerous, and every year there is a regrettably large number of serious accidents, particularly to people's hands. If you are new to modelling, seek advice and help from an experienced model-maker during your trials. They will be able to guide you and perhaps avoid an ac- cident. If you are an experienced model-maker, but new to elec- tronics, then ask the advice of an experienced electronics hobbyist who will help you build, test, and wire up your bench. And if you are familiar with both fields, then think like two people and check your board and all the electrical connections and mechanical tightening three times before carrying out your first trials. Under no circumstances may either the authors or Elektor be held liable for accidents following use of this board. To the right of the engine, there’s enough space for the speed detector and for the richness-setting motor. Behind the engine, behind the parti- tion we find a little mount, designed for a ‘standard’ size servo. This actua- tor can be posi- tioned according to the type of engine being run-in. Two wood screws are used to fix this mount onto the bench’s chassis. A special two-level compartment is set aside for the electronics boards and possible batteries (Fig- ure 2). The CBRM board [2] has its own ‘tailor-made’ space in the top of this compartment. Connect- ing the bench’s detectors and actuators to the board really is child’s play. A few judiciously placed holes, approx. 16 mm diameter, (see photo) let you thread the cables through easily with their connectors. The compartment below the board is designed for stor- ing the cables between sessions. Amongst oth- ers, you’ll probably want to store a USB cable, a DSC cable, the pocket terminal cable, and maybe a cigar- lighter plug. The second pair of compartments has been designed to hold the batteries that allow the bench to operate in a stand-alone fashion. In the top part, you can fit a 5- or 6-cell NiMH bat- tery, or a 2s or 3s LiPo (Lithium Poly- mer) battery. A capacity of 1500 mAh 5/2009 - elektor 33 MODELLING Figure 3. The display once the bench is powered up. Figure 4. The engine mounted and fitted with a propeller. is enough to operate the bench for sev- eral hours. The battery for heating the glow-plug or for the electronic ignition will go into the bottom compartment. Wrap your batteries in foam to wedge them in place and protect them from engine vibrations, thereby avoiding their falling off the bench. Once the woodwork is finished, don’t forget to apply a coat of cellulose var- nish to your chassis to protect the wood from the fuel and the oil it con- tains. With the help of the photos, drill the holes for the cables, glue on the 100 mm diameter PVC elbow, and fit the engine and fuel tank mounts. Don’t fix the servo mount for the time being. Functional testing software The next step consists of fitting, con- necting up, and then testing the opera- tion of the actuators and detectors. But before starting, ‘flash’ the CBRMtest_ sensors. hex software [2], then fit the board to the bench. Connect up the pocket terminal, power up the board and check that the software starts up correctly. The terminal display should look like Figure 3. The first line of the display shows the current position of the servo. By turn- ing the encoder knob, the servo moves through an angle of 80° (from —100% to +100%). By pressing the push-but- ton alongside the first line, the display changes and the encoder knob now acts on the stepper motor. The first line of the display now shows the current position of the motor and the position set for it to go to. The current position updates as the motor rotates. The second line of the display perma- nently shows the engine speed. The third line permanently shows the board supply voltage and the glow- plug supply voltage. As a safety pre- caution, if the board supply voltage drops below 6 V, the servo is set to the 0% position and the program hangs in this condition. The start of the fourth line indicates the state of the glow-plug: on or off. The glow-plug can be turned on or off by operating the push-button along- side the fourth line. The end of the line shows the engine temperature. Fitting the engine to be run-in When seen from the front, most engines have their throttle controls on the left and the richness screw (or nee- dle-valve) on the right. If this is not the case, it may be possible to turn the car- burettor to achieve this situation. Fix the engine firmly to the mount, taking care that the exhaust comes within the discharge elbow (Figure 4). When eve- rything is properly in place, connect a Figure 5. The throttle servo in its mount. Figure 6. Connecting the stepper motor. 34 elektor - 5/2009 2 mm clevis with its rod to the throttle control and feed it through the oblong opening you’ve made in the parti- tion behind the engine. It will also be very helpful to fit your engine with a new, good-quality glow-plug. You’ll fit the propeller and its cone just at the moment of starting the tests. Throttle control Fit the servo into its mount using the rubber grommets and spacers sup- plied with the servo (rounded part downwards. Fit a piece of ‘choc-block’ to the servo rod (see Figure 5). This is probably the most effective and prac- tical way of connecting the control rod to the throttle servo. Position and fix the mount in such a way that all the moving elements are correctly aligned Richness setting The fuel mixture (richness) screw must be capable of being operated over sev- eral turns during the running-in. In this situation, a servo, whose travel is lim- ited to around 120 degrees, i.e. a third of a turn, is not at all suitable for the task. What’s more, the richness screw must be adjusted ‘carefully and accu- rately’, although the actual speed of this adjustment is not very critical. A sin- gle-pole stepper motor with reduction gearing meets these requirements per- fectly. The type used, with 2400 steps per revolution, will operate the richness screw of your precious engine gently and accurately. The stepper motor is connected to the CBRM board via six wires. Look at the April 2009 article [2] for details of this connection. Instead of ‘glow clip’ — a sort of removable con- nector that works a bit like a syringe. This connector is hooked onto the engine by hand at the moment of start- ing. This method is perfectly suitable when you’re starting before taking a flight or going for a lap of the circuit, depending on whether the model is a plane or a car. But in a running-in situ- ation, the model-maker generally has to start the engine several times. Repeatedly handling a glow clip close to a moving propeller is not very con- venient and certainly dangerous. The CBRM board looks after powering the glow-plug for you, so you can leave the glow clip in place permanently, or replace it, as we have, with a little rubber connector specially intended for the purpose (Figure 7). A cheaper Basic precautions Using i/c model engines does require some basic precautions. Mechanical mounting of the engine It is vital to make provision for a sturdy, reliable mechanical mount, as these engines vibrate a lot and produce a tractive force that can reach several tens of newtons. This point is particularly important, as it's not hard to imagine the damage and injuries that an engine fitted with its propeller could cause if it came adrift from its mounting at full speed! Don't use vices or G-clamps for holding the engine. Fuel supply The bench's fuel tank must be designed to hold methanol-based fuel and include a pressurization point. The fuel tank must be positioned in such a way that the level of the engine carburettor is half-way up the fuel tank. What's more, you should take care to fit the fuel tank as close as possible to the engine, to minimize the length of piping. An unsatisfactory fuel supply will cause difficulties in starting and erratic running of the engine. This type of fuel tank, holding around 500 ml, is readily available form model shops. They'll also be able to supply the silicone 'hose', the pump for filling the fuel tank, and of course, the right sort of fuel for your dear little gem... Exhaust Model engines running on methanol operate with a fuel containing around 20% oil. This oil, mainly unburnt, gets into the exhaust gases. No need to point out that unless certain 'health' precautions are taken, this oil ends up invading everything around the exhaust outlet, with the unpleasant consequences that can be imagined. To make matters worse, during running-in, the engine operates with a very rich mixture, increasing the emission of oil very significantly. and operate without any tight spots. Connect the servo to the board via K5, then set it to the neutral position (i.e. 0%) using the pocket terminal encoder. Position the servo rod in such a way that it is perpendicular to the servo, then fit the rod screw. By turning the encoder knob, you’ll be able to check that the control functions gently and operates over the whole travel of the throttle control for a con- trol variation between approx. —100% and + 100%. The butterfly valve should open as the control increases, by turn- ing the encoder clockwise. If this is not the case, position the configuration jumper JP4 so as to invert the sense in which the servo acts. Adjust the posi- tion of the choc-block on the servo rod to arrive at a suitable travel. a long-winded explanation, Figure 6 will guide you in building the bracket and coupling between the richness screw and the stepper motor. Check that the supply jumper JP11 is in the VHV posi- tion. Once fitted and connected, test the operation of your project using the encoder knob on the terminal. The motor should turn in the same direction as the encoder. Rotating the encoder anticlock- wise should make the stepper motor turn in such a way as to open the needle valve. If this is not the case, correct the motor wiring. If the motor doesn’t turn at all, check that jumper JP3 is not fitted. If it is fitted, remove it. Glow-plug supply Traditionally, model enthusiasts power their engine’s glow-plug by means of a alternative to this connector is a sim- ple electrician’s choc-block, stripped of its insulation, which will connect the -I- pole of the glow-plug to its sup- ply cable, which should have a cross- section of around 0.5 mm 2 . Don’t for- get to connect the engine mount to ground, using an eyelet terminal and wire of the same gauge as the wire to the glow-plug. These two wires will be connected to connector K1 1 on the board. The glow-plug supply bat- tery (not more than 2 V!) will be con- nected in the same way to connector K13. Make sure you observe the power source polarity correctly! A polarity error won’t cause any dam- age, but the glow-plug will be pow- ered all the time, which is very dan- gerous, as the engine may start unex- 5/2009 - elektor 35 MODELLING Figure 7. Detail of the glow-plug. Figure 8. The speed detector, consisting of a phototransistor and an infrared LED inside a PVC tube. pectedly while you are priming it! Test the proper operation of the glow-plug several times using the pocket termi- nal. To do this, you can temporarily connect a glow-plug to the connector and ground and check that it glows and goes out clearly according to your commands. When the glow-plug is on, LED D15 on the CBRM board lights. If the LED doesn’t light, check that jumper JP3 is not fitted. If it is fitted, remove it. The glow-plug power system must be totally reliable, or else the run- ning-in sessions will become a real nightmare! Speed detector The speed detector consists of a pho- totransistor and an infrared LED. Fit these two components side by side on a small, rectangular piece of prototype board, just the right width to fit inside the 16 mm PVC tubing (Figure 8). Depending on the ambient lighting, the extra (invisible) light provided by the LED may not be needed, or may actually be a nuisance. By crimping both a 3-pin connector and a 2-pin connector to the end of the cable, you can choose whether or not the LED is powered, according to which connector is connected to the CBRM board A 5 cm length of PVC tub- ing provides effective mechanical protec- tion for this detector. Once it is in place, wave a sheet of white paper rapidly in front of the detector. The terminal display should indicate a speed of a few hundred RPM, varying. Tip: The ‘camera’ func- tion of your mobile phone will let you see the infrared light from the LED. If it is not visible in the form of a white dot on the screen of your phone, check the polarities and quality of the wiring to the detector and LED. Engine temperature detector The KTY81-210 temperature detector is easy to use, as it comes in a standard 2-pin T092 package, and is thoughtful enough not to be polarised. After con- necting it to a 2-core cable and insulat- ing the joints with heatshrink sleeving, plug the detector onto connector K17 and test it by checking the plausibil- ity of the temperature it shows on the terminal. If you grasp it with your fin- gers, the temperature indication should change. Then cut off a short length (approx. 3 cm) of 5 mm inside diam- eter brass tubing. Flatten one end of the tube and drill it with a 3 mm hole. Check that you can easily fix this bit of tube under one of the engine block screws (Figure 9) to ensure very good thermal contact. Once the mechanical Figure 9. The temperature detector and its brass fixing. Figure 10. The emergency stop button needs to be accessible! 36 elektor - 5/2009 assembly is finished, insert the detector all the way into the tube and stick it in place with epoxy resin. Emergency stop push button It’s vital to fit our magnif- icent bench with a con- trol that will let us shut off the engine throttle control quickly in the event of a problem. Cutting the power to the bench is not a good idea, as the throttle servo will stay in its last posi- tion at the moment of los- ing power and the engine will continue to run. The system we’ve adopted has the merit of being simple and effective. The emergency stop button (refer to Figure 10 for fitting) is simply con- nected in parallel with the CBRM board reset button, via connector K4. As soon as you release the button, the microcontroller will restart, and will lose no time putting the throttle servo into the ‘throttle closed’ position, thereby stalling the engine. You should use a simple normally-open (NO) push button, sturdy enough to withstand ‘beefy’ pressing. A locking industrial- type ‘emergency stop’ button will not be suitable for this use, as it locks into Figure 1 1. A solid panel of wood lets you fix the bench onto trestles. the contact closed position and the microcontroller won’t reboot until the button is unlocked, which is unaccept- able here. Check that this button works properly before carrying out your first trials with an engine running. Mounting the bench We recommend mounting your bench on a solid panel of 19 mm thick chip- board so you can rest the bench on two trestles during your trials. You can use four sturdy G -clamps to hold the bench firmly on the trestles. First trials with an engine After you have checked sev- eral times that all the detec- tors and actuators of your new bench operate correctly, we recommend getting used to it by doing some trials with an engine that’s already been run- in. The terminal will let you control its settings manually without ‘sticking your fingers in’. So handy! To be continued... Next month, we’ll be rounding off this 3-part article with the description of the automatic program. ( 081187 - 1 ) Acknowledgements The author would like to thank Guillaume and Dominique Dobler for designing and building the mechanical part of the bench. Internet Links [!]• www.elektor.com/081 1 87 [2]. www.elektor.com/080253 5/2009 - elektor 37 INFO & MARKET REVIEW PLED and c apacitive touch pad Microchip Starter kit for the PIC24F family MPLAB Starter Kit for PIC24F MCU Clemens Valens (Elektor France) MPLAB Starter Kit for PIC24F MCUs / o 0 r © ^'CPOCHlp c *ooa K ° s «7 Z?-* The new evaluation board for the PIC24F 16-bit microcontroller family is supplied in a DVD box and has a very comprehensive set of features. It has an integrated programmer and debugger, a capacitive touch pad, a small OLED display, a processor and, above all, no fewer than three USB ports! Figure 1. The PIC24F starter kit. The new starter kit for the PIC24F microcontroller family comprises only a few parts. In the DVD box that con- tains everything, we find the evalua- tion board in pink bubble wrap, a USB cable and a CD-ROM. The installation of this kit is just as uncomplicated as its contents, the CD-ROM goes in the CD-ROM drive of a PC and the sup- plied programs will be installed. The evaluation board is now connected with the USB cable to the PC and the job is complete. One thing you will have to observe, is that there are two mini USB connectors on the board and it is important that you use the correct one. The one you need to use is on the section of the board which is labelled DEBUGGER. The CD-ROM supplies the well-known software tools from Micro- chip, such as the integrated develop- ment environment MPLAP IDE and the student version of the C -compiler MPLAB C30. This version is fully func- tional for the first 60 days. After that the functionality is limited, but that does not affect the results of the pre- vious 60 days. According to the doc- umentation, the evaluation board can only be used in combination with the version of MPLAB (V8.ll) supplied on the CD-ROM. In addition, these tools only work under Windows (XP Pro- fessional in our case) so that MAC or Linux users will need to use a Win- dows simulator or emulator. Hardware Before we start to experiment, we will take a closer look at the board itself. As already mentioned, this board consists of two parts: a programmer/debug- ger with (mini) USB port, based on a PIC18F67J50, and the actual appli- cation, based around a PIC24FJ256- GB106. We are mostly interested in this second part. Here we find a very small (15 X 25 mm) OLED display with a res- olution 128 x 64 pixels, a capacitive touch pad with five buttons, an RGB LED, a potentiometer and a further two USB connectors, a miniature male con- nector (type mini B) and a standard female connector (type A). These two USB connectors are positioned in such a way that they cannot be used at the same time. The board obtains its power supply either from the USB connector on the debugger part or from the mini- USB connector on the other side. The most interesting aspect of this board, as you will already have realised, are the USB connections. The microcontroller conforms to the USB 2.0 On-the-Go standard (see inset) and the board is supplied with a C library which contains everything you need to develop USB applications (both OTG and standard). Another interesting part of this board is the capacitive touch pad. The pro- cessor has an interface specifically for this type of keyboard built in, which makes the implementation of such a keyboard much simpler. To complete the board, Microchip have added a small OLED display with 38 elektor - 5/2009 accompanying graphics library (in C), which makes it very quick to imple- ment a graphical user interface. In fact only an MP3 decoder is missing, otherwise you would have been able to make your own iPod! The only drawback of this board is that it is not possible to control any- thing with it. There are no expansion connectors and there is also no bread- board space. But okay, this is really a starter kit and not a development kit. Software If the board is connected correctly it will start without problems. Two green LEDs in the debugger part will turn on, the OLED display will initially turn completely white, which is then followed by a welcome message. The three-colour LED (RGB) turns on with such a brightness that it is painful to the eyes. Fortunately it turns off again at the start of the demonstration. This demonstration, incidentally, is quite impressive. At the top of the ini- tial screen there is a menu with four options and showing the date and time. This menu offers the options of Flash Drive, Utilities, Demos and Games, and the navigation is done with the aid of the capacitive touch pad. After selecting the Flash Drive option, the board asks you to insert a USB stick. Once the stick has started up, a scroll window appears which contains all the names of the folders and files that are on the stick and it is possible to browse the contents of the USB stick. The Utilities option offers the possibil- ity of setting the date and time (with the + and - buttons), to calibrate the capacitive touch pad (this becomes noticeably more sensitive) and to start a test for the board. From the Demo option there is a choice of three different demonstrations. In the RGB LED screen the brightness of the three colours can be adjusted individually with arrows. The Graph demonstration shows a moving curve, which can be influenced using the potentiometer on the board. The speed of the scrolling movement can be adjusted with the capacitive touch pad. The Capture demonstration looks a bit like Graph, except that the curve does not move and the values are stored on the USB stick. Unfortunately this demo stops after a few times, the file that is created on the USB stick is empty and cannot be deleted, even when using a PC. Another USB stick, 8 GB in size, which already contained a few files, caused an error message “ cannot open file”. Finally, the Games option in the main menu offers three intuitive graphical games: ShuBox, Shapelet and Blaster. The complete source code for the dem- onstration program is available on the CD-ROM. On the CD-ROM we also find the MPLAB Starter Kit for PIC24F MCUs, which during installation splits into MPASM Suite, MPLAB ASM30, MPLAB C30 and MPLAB IDE. In addi- tion a folder is created with three libraries: graphics, USB and memory card. The source code (in C) is also supplied, as well as the documenta- Technical Features PIC24F Starter kit DM24001 1 • Microcontroller PIC24FJ256-GB1 06 • USB 2.0 OTG • 256 KB flash memory • 16 KB RAM • OLED display 128x64 pixels • Capacitive touch pad • RGB LED • Potentiometer • Integrated programmer/debugger • Includes MPLAB, ASM30, C30 and source code geted at different applications; The Explorer 16 is intended more for elec- tronics engineers while the board Assembly No.: 02-02023 SmHJ • . M w « a PIC24F Starter Kit 1 PIC 24F Starter Kit Hov 01, 2007 Tu* 10:51:1 7 Microchip j Ml ■rta |l ji J— M - i y - >4^ JW 1 1 JAjfc p- wo ~, n . ■ L\ - Figure 2. The board in operation, in the middle is the miniature OLED display. tion and even a few tools, such as for example one which will convert bit- map-files (BMP) and font files (FNT, TTF and OTF) into hex files that can be used by the graphics library. After starting MPLAB the board is quickly recognised. The project that allows the demonstration software to be changed and then compiled again is found quickly, and the compilation is without errors. Downloading to the controller takes about ten seconds, after which the board will start up again and run the program. Conclusion The PIC24F starter kit is very compre- hensive, solidly constructed and very quick to get started. Compared to the Explorer 16, also based on a PIC24F and familiar to Elektor readers, this board is much easier to use. That is where the comparison ends however, because these boards are clearly tar- described here is mainly for software engineers. ( 080927 - 1 ) Internet Links www.microchip.com/stellent/ idcplg?ldcService=SS_GET_PAGE&nodeld = 1 406&dDocName=en535092 USB On-the-Go (OTG) USB On-the-Go is an extension to the USB standard. A device that conforms to this standard can take the function of both a USB-host as well as a USB-slave, and can change between these two while in use. Two USB-OTG compatible devices can communicate with each other without the need for a separate host. This is the case, for example, with digital cameras that can send pictures directly to a printer, or store directly to a hard disk. 5/2009 - elektor 39 MICROCONTROLLERS Full Capacitive liquid-level measurement Wolfgang Rudolph (Germany), Rudolf Pretzenbacher (Austria), and Burkhard Kainka (Germany) Electronics enthusiasts are sometimes a breed apart. Most people simply look at a bottle when they want to know how full it is, but we want to measure it. iciiifttiti Of course, it doesn’t have to be a bottle. Situations that involve measuring the level of a liquid stir the creative juices and fos- ter true acts of genius, and there are countless applications for liq- uid-level sensors, ranging from rain barrels to heating-oil tanks. We’re sure that our readers can come up with many other situa- tions where the liquid-level sen- sor described here can be put to good use. However, let’s first consider the question of how to measure a liquid level accurately and reliably. Measuring methods A wide variety of measuring meth- ods are used. Many lavatory cis- terns have a float valve that first reduces the inflow of water when the float rises to a certain level and finally stops it completely. In elektor - 5/2009 Table 1 Inductor specifications (vertical package with moderate rated current) Manufacturer: Fastron; type number 09 P-103 J-50 Dimensions: 0 9.5 mm, height 14 mm, lead pitch 5 mm Inductance: 10.0 mH (at 20 kHz) Self-resonant frequency (SRF): 0.41 MHz Rated DC current: 90 mA Resistance: 35.0 £2 Tolerance: ±5 % Q (min): 70 this case, the float is not only the sen- sor but also the actuator, which con- trols the valve via a lever mechanism. Although this is a very reliable prin- ciple, it can’t be used to measure the liquid level. The same principle was used in the past (and is sometimes still used) to measure the fuel level in petrol tanks of cars. In this case, the float moves the wiper of a potentiom- eter instead of actuating a valve. This variable resistance forms part of a volt- age divider that drives a milliammeter, which indicates how full the tank is. In some cases, the accuracy of this gauge leaves a lot to be desired. Nowadays a wide variety of modern measuring methods are used in many different situations. They include hydrostatic and differential pressure measurement, conductivity measure- ment, light absorption measurement, transit time measurement using ultra- sound, distance measurement using microwaves, and even transit time measurement using radar pulses. From an electronic perspective, capaci- tive measurement is also interesting. This method involves measuring the change in the capacitance between two electrodes. If these electrodes are located in a container with a liquid that covers them more or less depend- ing on its level, the capacitance of this ‘capacitor’ changes accordingly. The capacitance depends on the dielectric constant of the liquid, and it increases as the level of the liquid rises. Capacitive sensing You’ve probably guessed that this is the method we intend to use here. After all, we’re used to working with capacitors. However, it’s not as sim- ple as it seems at first glance. We have to do a bit of maths first. This article is based on a capacitive liquid-level sensor built by Rudolf Pretzenbacher, which uses a simple but remarkably stable oscillator for the sensor circuit and an AVR microcontroller for the sig- nal processing. His liquid-level gauge provided the inspiration for this ATM 18 article, and it delivers truly astound- ing results. This setup can be used to measure capacitances in the range of nanofarads (nF) to femtofarads (fF). In case you’ve forgotten, a femtofarad is 10 -15 F or a thousandth of a picofarad. How can such high sensitivity be achieved? The answer is that the ‘sense capacitor’ in the liquid is one of the frequency-determining com- ponents of a resonant loop, which in turn is part of an oscillator circuit. If an object to be measured is brought in the vicinity of the capacitor, the resonant frequency of the loop changes. The more the capacitance of the capacitor is increased by the object, the lower the resulting frequency. The task of the microcontroller on the Elektor ATM 18 board is to measure the fre- quency and then calculate the value of the capacitance from the measured frequency and the known value of the inductance. This sounds quite simple, but there are still a few details to be sorted out. Oscillator The oscillator circuit can affect the res- onant loop due to its own capacitance or as a result of excessively strong coupling. To keep this effect as small as possible, the resonant loop should have a high quality factor (Q) and the excitation level should be kept low. It is also important to choose a suitable inductor. In this case, we decided on a fixed inductor made by Fastron. This induc- tor (type number 09 P-103 J-50; avail- able from Reichelt and other sources) has an inductance of 10 mH, a DC resistance of 35 Q, and a self-resonant frequency of 410 kHz. This means that it has a remarkably low stray capac- itance of 15 pF. In addition, it has a specified Q factor of 70 (max.). Its char- acteristics are listed in Table 1. The higher the Q factor of a resonant loop, the lower its damping. A Q fac- tor of 70 means that the amplitude of a ‘free’ (damped) oscillation is reduced by a factor of e after 70 cycles, which +5V 080707 - 16 Figure 1. Schematic diagram of the oscillator used for capacitance measurement. can be seen very nicely on an oscillo- scope. The damping results from the resistive losses in the wire and the magnetic losses in the core. A resonant loop with an inductance of 10 mH and a capacitance of 6300 pF has a resonant frequency of 20 kHz, and the inductive and capacitive impedance are both 1260 Q. The ratio of this impedance to the DC resistance (35 Q) yields a theo- retical Q factor of 36, which means that the resonant impedance of the circuit is 45 kQ (1260 Q x 36). The Q factor and the resonant impedance increase as the capacitance is reduced and the frequency rises. For a high Q factor, we have to aim for a high L/C ratio. At around 3000 pF and 30 kHz, the calcu- lated value of the Q factor is approxi- mately 70. The core losses increase at very high frequencies, which causes the Q factor to drop. However, the oscillator circuit has an even larger effect, since a resonant loop with a high resonant impedance is especially sensitive to external influences. Figure 1 shows the oscillator circuit used here, which is built around an LM311 comparator. It compares the input voltage with a reference voltage and converts the sinusoidal signal from the resonant loop into a square- wave signal at its output. This signal excites the resonant loop via a feed- back resistor. A voltage divider at the non-inverting input of the comparator provides a voltage equal to half the supply voltage. The inverting input is fed by a comparison voltage obtained by integrating the output voltage. As a 5/2009 - elektor 41 MICROCONTROLLERS Listing 1 Capacitance measurement Config TimerO = Timer , Prescale = 64 Config Timerl = Counter , Edge = Falling , Prescale = 1 On OvfO TimO_isr On Ovfl Timl_isr Enable TimerO Enable Timerl Do Ticks = 0 Enable Interrupts Waitms 1100 Disable Interrupts Lcdpos = 2 : Lcdline = 1 : Lcd_pos Lcdtext = "Freq = " Lcdtext = Lcdtext + Str (freq) Lcdtext = Lcdtext + " Hz \\ Lcd_text Print Freq; Print " Hz" C = Freq / 10000000 C = 1 / C C = C * C C = C / 39.48 If Pinb.O = 0 Then CO = C C = C - CO Print Fusing(c , "#.###"); Print " pF" Lcdpos = 2 : Lcdline = 2 : Lcd_pos Lcdtext = "Cap =" Lcdtext = Lcdtext + Fusing (c , "#.###") Text = Fusing (c , "#.###") Lcdtext = Text Lcdtext = Lcdtext + " pF \\ Lcd_text Waitms 10 Loop Tim0_isr : '1000 pis TimerO = 6 Ticks = Ticks + 1 If Ticks = 1 Then Timerl = 0 Highword = 0 End If If Ticks = 1001 Then Lowword = Timerl Freq = Highword * 65536 Freq = Freq + Lowword Ticks = 0 End If Return Timl_isr : Highword = Highword + 1 Return result, the operating point of the oscil- lator is set automatically, and it starts reliably and produces a symmetric square wave at the output. With regard to the effect of the oscil- lator circuit on the resonant loop, the main consideration is the resistor val- ues. The voltage divider formed by the two 100-kQ resistors loads and thus damps the resonant loop with an effective value of 50 kQ. There is also the resistance of the negative feed- back resistor (100 kQ) divided by the effective voltage gain. As a result, sta- ble oscillation is possible with sensor capacitance values of up to 100,000 pF (or more). The open-circuit frequency is approximately 350 kHz, which yields an effective capacitance of around 20 pF. The inductor accounts for 15 pF of this, while the input capacitance of the LM311 and the stray circuit capaci- tance add another 5 pF. If you use an oscilloscope to view the signal on the inductor, you will see an amplitude of approximately 1 V at the highest frequency and a somewhat distorted sinusoidal waveform. This means that the excitation level could be reduced even further. However, with increasing sensor capacitance the amplitude decreases noticeably and the signal becomes more sinusoi- dal. The oscillator still works at 100 nF, with a frequency of 4.9 kHz and a sig- nal amplitude of 0.1 V. It stops operat- ing suddenly somewhere above this figure. The next issue to be considered is frequency stability. The fact that the circuit only contributes 5 pF to the capacitance of the resonant loop is in itself favourable. This leaves us with the difficult question of the tempera- ture dependence of the inductance. The only way to answer this question is to perform experiments. To make a long story short, we can say that the stability of the prototype version built on stripboard in the Elektor labs (Fig- ure 2) is sufficient to achieve a sensi- tivity of 0.001 pF, or in other words 1 fF (1 femtofarad - what an uncommon term!). Incidentally, frequency meas- urement is not the limiting factor. At 350 kHz and 20 pF, a change of 1 Hz corresponds to a capacitance change of only around 0.1 fF. However, the effec- tive constancy is somewhat lower. Frequency measurement Now we come to familiar ground. Fre- quency measurement was already described in instalment 4 of the Bas- com AVR series (Elektor Decem- ber 2008). The counter input is T1 (PD5), and the frequency in hertz can be obtained directly with a gate period of 1 second. It is sent directly to the PC at 9600 baud, without any correction or window dressing. All that’s left is to convert the frequency into capaci- tance. We use a single-precision vari- able for this. The conversion formula must be broken down into individual operations in Bascom. Here you have to ensure that the intermediate values do not become too large or too small, since this would degrade the accuracy This means that the sequence of the operations is somewhat important. The 10 mH of the inductor is expressed as a factor of 10,000,000. The underlying Body capacitance If you move your hand close to the oscil- lator (Figures 1 and 2), you will see the measured capacitance change by a few femtofarads, even if no sensor cable is con- nected. We measured the following approx- imate results at various distances between the board and our hand: 5 cm 0.005 pF 4 cm 0.009 pF 3 cm 0.020 pF 2 cm 0.040 pF 1 cm 0.100 pF This is interesting from a physics perspec- tive. The phenomenon of body capacitance is both familiar and notorious among radio hobbyists. If a DIY receiver is not adequate- ly screened, it is often possible to detune it slightly by moving your hand toward it. Some people make handy use of this effect for fine tuning when receiving SSB signals. Musicians who use Theremin instruments also take advantage of body capacitance. reason for this is to arrive at a value in picofarads at the end. If comparative measurements indicate that the actual value of the inductor is slightly differ- ent, such as 1% higher or lower, this is the place to make the correction. The inductor has a rated tolerance of 5%, which means that the capacitance can be measured with a potential error of approximately 5%. The open-circuit capacitance C 0 is around 20 pF. Of course, the exact value depends on several factors, including component tolerances, PCB construc- tion, and perhaps even the type of sol- der that is used, since the dielectric 42 elektor - 5/2009 constant of solder flux can have an effect on the order of a few femtofar- ads. The only solution to this is to per- form a zero-point calibration. Nothing could be easier: when the user presses a button connected to port BO, the current zero-point capacitance C 0 is measured and stored. This is any- how necessary, because if you use a cable to connect the sensor it can eas- ily contribute another 10 pF. Conse- quently, we measure and store the zero offset before making the actual meas- urement, and this way we obtain the best possible accuracy The measured values are output in two different ways: via the serial interface and on the familiar LCD with its two- wire interface. At first this was a bit Their hand movements alter the frequency of an oscillator and thus change the audio frequency in a smooth, continuous manner. You can try this for yourself with this oscilla- tor. Connect a copper-plated board in Eu- rocard format (1 OOx 1 60 mm) to act as the sense electrode. This adds approximately 17 pF to the capacitance of the resonant loop, and the frequency drops to around 260 kHz. This is in the long-wave radio band, and you can pick up the signal on a radio. With a bit of luck, you can find a long-wave broadcast signal that interferes with the oscillator signal to produce a beat frequency. Then you can start making mu- sic, assuming you have the knack. All the neighbourhood cats will probably run for cover, but that shouldn't stop you from trying out the effect and learning to understand it, even if you'll never compete with Theremin virtuoso Lydia Kavina, a great-niece of the inventor of the Theremin. The most effective variation in capacitance, around 0.1 pF, occurs at a distance of around 5 cm due to the relatively large size of the sense electrode. too much for the LCD routine, which didn’t want to cooperate with the timer interrupts. The problem was found to arise from passing variables to the subroutines, and it was cured by declaring all variable as global. In addition, the timing was improved to make data transfer even more reliable (see Listing 1). Now the program displays the current frequency and the capacitance. This enables us to make some experimental measurements of temperature stability. For example, you can warm the induc- tor with your hand and observe the change. With a temperature increase of approximately 20 °C (to around 30 °C), the measured capacitance increased by approximately 0.15 pF. This means that if your objective is to measure the value of an unknown capacitor, the temperature is scarcely important. However, if you actually want to meas- ure capacitance with an accuracy of a few femtofarads, you must first allow the oscillator to stabilise for a few min- utes and then make a zero-offset read- ing. The measured value changes by less than 5 fF over the course of sev- eral minutes. Capacitance measurement People who play around with RF cir- cuits almost always have something to measure, such as a variable capaci- tor. Before a true radio hobbyist tosses an old radio in the bin, he at least sal- vages the variable capacitor, since they are not so easy to come by nowa- days. Naturally, you have to measure the salvaged part to know what you actually have. If it has a range of 8 pF to 520 pF, it’s brilliant. You can also measure unknown SMD capacitors, variable-capacitance diodes, the input capacitances of FETs or valves, and cable capacitances. You can even determine the length of a cable by measuring its capacitance. For example, suppose you have a par- tially used roll of coax cable and you want to feed it down a disused chim- ney. Before you start, it’s a good idea to know whether it’s long enough to reach the bottom. We’ve all heard enough stories about cursing men on high roofs. This question is easily answered with our capacitance meter. The capaci- tance per metre is stated on the data sheet. For example, popular 50-Q RG58 cable has a capacitance of 100 pF/m. If you don’t have a data sheet, you can simply measure the capacitance of a known length, such as 1 metre, to determine the number of picofarads per metre. Once you know this value, you can easily calculate the cable length from the measured cable capacitance (cable capacitance divided by capaci- tance per metre yields cable length in metres). The fact that the cable also has an inductance doesn’t matter, since the measuring frequency is much less than the quarter-wavelength fre- quency. For example, at 100 kHz the wavelength is 3 km. Liquid level measurement Figure 2. Prototype version of the oscillator, built on a piece of perforated circuit board. ▲ ▲ L h T 080707 - 11 Figure 3. The liquid-level sensor is a tube with an insulated inner electrode that forms a cylindrical capacitor. Here L is the length of the active portion of the tube (wrapped with aluminium foil) and h is the height of the water in the tube. 5/2009 - elektor 43 MICROCONTROLLERS Figure 4. The concentric capacitors of the sensor tube structure. were sealed watertight (Figure 3). The conductor of the hookup wire must be fully insulated (galvanically isolated) from the space inside the tube. Then we wrapped the length of the tube between the two stubs with aluminium foil applied as uniformly as possible and attached a bare connecting lead to the aluminium foil (held in place by electrician’s tape). The bare lead and the end of the hookup wire protruding from the tube form the terminals of our sense capacitor. A cylindrical capacitor is a rotation- ally symmetric form, so its capaci- tance can be calculated rather accu- rately by using the following formula if the length is much greater than the diameter: c = 2 * Jt * * £ r * l LN 1 od^ v id / CiL CxL CaL 080707-13 Figure 5. The equivalent circuit of the sensor tube. £ 0 = dielectric constant of vacuum and air (8.854 x 10- 12 As/Vm) £ r = relative dielectric constant (mate- rial constant) L = cylinder length od = diameter of the outer electrode (here od2) id = diameter of the inner electrode (here idl) If we combine the constants and con- vert metres to millimetres, we obtain the following formula: To make our liquid-level sensor, we fit- ted a small Plexiglas (polycarbonate) tube with two connection stubs. A length of polyethylene-insulated hookup wire was stretched through the tube and centred as well as pos- sible, and then both ends of the tube 0.0556* c = LN ' od^ \ id j pF/mm If a cylindrical capacitor consists of several concentric layers, each layer forms a separate capacitor (here C Q , C x , and Cy. The total capacitance is then 350 0.000 10.000 20.000 30.000 40.000 50.000 60.000 capacitance [pF] osozoz- 14 Figure 6. The capacitance increases linearly with the liquid level. Table 2 Sensor tube data (for Figure 6) Standpipe outside diameter: 1 2 mm Standpipe inside diameter: 8.5 mm Standpipe length: 300 mm Inner electrode conductor diameter: 0.4 mm Inner electrode outside diameter: 0.6 mm Standpipe tube dielectric constant: 3.0 Inner electrode dielectric constant: 2.3 Electrolyte dielectric constant: 83 determined by the series connection of the individual capacitors (Figure 4). If we divide the cylindrical capacitor into a portion filled with water or another liquid (C w ) and a portion filled with air (C A ), the total capacitance of the tube is C T = C w + C A (parallel connection), with the portion filled with water hav- ing a length h and the portion filled with air having a length L - h. The equivalent circuit of this arrangement is shown in Figure 5. The relative dielectric constant (£ r ) of air is 1.0, while the relative dielec- tric constant of water depends on the temperature and ranges from 55 to 88 (approximately 83 at 10 °C). The die- lectric constant of transparent plastic is around 3.0 (polystyrene and poly- carbonate) or 3.2 (acrylic), and the dielectric constant of wire insulation is around 2.3 (polyethylene) or 4 to 5 (polyvinyl chloride). This is excellent for our intended meas- uring applications because it means that there will be a rather large differ- ence between the values of the capaci- tance Cx in air and in water. The capacitances in the air-filled por- tion of the tube are: CiA = 0.0556 • 2.3 * (/ — /z) LN 'idl} \ idl ) Cxi = 0.0556*1 •(/ — /*) LN 1 odV v id 2 ) Co A = 0.0556* 3* (l-h) LN ' odl \ \ odl j 44 elektor - 5/2009 oscillator 0+5 V OGND LCD 20x4 Figure 7. Wiring diagram of the Elektor ATM18 board for the liquid-level gauge. while the capacitances in the water- filled portion are: CiW = 0.0556 * 2.3 * /z LN f idl ' \ idl CxW = 0.0556-83 -h LN ' odV v idl ) CoW = 0.0556- 3- h LN t odl \ \ od 1 between the total capacitance and the water level, you will discover that it is fully linear if you use a fixed dielec- tric constant for water. Figure 6 shows the capacitance as a function of liquid level for a standpipe sensor with the dimensions given in Table 2. Now we can use our standpipe sense capacitor and an inductor with a more or less known value to form a resonant loop, measure the resonant frequency, and use the well-known resonant-loop formula 1 2 • Jt • V(Z • C) If you use a spreadsheet program to to calculate the capacitance of the calculate and plot the relationship standpipe and thus determine the Figure 8. Simplified sensor construction using a stainless-steel or copper outer tube and an insulated brass tube as the inner electrode. height of the water in the standpipe. We first measure the capacitance Cmin with the standpipe empty (h = 0) and the maximum capacitance Cmax with the standpipe full (h = L), after which we can use the straight-line formula to calculate the height: j L C measured ^min ) c - c ^max ^ min Listing 2 Calibration and calculation of the liquid level Hmin = 0.0 Hmax = 300.0 Getminmax If Cmax <= Cmin Then Cmin = 7.0 Cmax = 52.0 End If Sub Calclevel 'ensure that: Hmax>Hmin and Cmax>Cmin If Cap < Cmin Then Cap = Cmin K = Hmax - Hmin D = Cmax - Cmin If D = 0 Then D = 0.01 'avoid division by zero K = K / D D = -k 0=0* Cmin Y = Cap * K Y = Y + D Yfix = Y End Sub 'Calibrate Minimum Value Sub Calibmin Print "Minimum Calibration Bitwait Pind.7 , Set Cmin = Cap Print "Cmin" ; Cfix ; " pF Eadr = Eadrcmin Writeeeprom Cmin , Eadr End Sub 'calibrate Maximaum Value Sub Calibmax Print "Maximum Calibration Bitwait Pind.6 , Set Cmax = Cap Print "Cmax" ; Cfix ; " pF Eadr = Eadrcmax Writeeeprom Cmax , Eadr End Sub Here the mechanical accuracy of the construction and the accuracy of the reference inductor do not matter, and the absolute accuracy of the frequency measurement, the presence of para- sitic capacitances, and the dielec- tric constants of the materials used to construct the sensor are equally irrelevant. The oscillator module (Figure 2) should be located as close to the sen- sor as possible in order to minimise the parasitic capacitance of the cable and reduce the effects of nearby objects on the sensor cable capacitance. Software The Bascom project Level. bas also uses the serial interface and the LCD. In addition to the frequency and the capacitance, it shows the liquid level in millimetres on the display. A pair of buttons connected to PD6 and PD7 can be used for calibration, with the 5/2009 - elektor 45 MICROCONTROLLERS calibration values being stored in EEPROM. The default values assign a height of 0 to a capacitance of 7 pF and a height of 300 mm to a capacitance of 52 pF. If you adjust the liquid level to a height of 0 mm and press the first but- ton (PD7), the measured capacitance is copied to Cmin and stored in mem- ory. After this, you can fill the sensor tube to the 300-mm level and press the second button (PD7) to copy the cor- responding value to Cmax. This data is held in non-volatile memory, so it is available the next time you switch on the instrument (see Listing 2). If the parasitic capacitance of the cable (approximately 33 pF) is taken into account, the measured values are amazingly close to the theoreti- cally determined values. From this we can conclude that a method based on purely theoretical calculation (without calibration of the minimum and maxi- mum levels), and taking the tempera- ture dependencies of the electrolytes into account, could be implemented with a reasonable amount of effort. As already mentioned, the simple approach only works if you assume that the dielectric constant of the elec- trolyte (in this case water) remains more or less the same after calibration. The error due to electrolyte tempera- ture variation depends on the dimen- sions of the sensor tube, and with the prototype arrangement it is approxi- mately 1 mm per 20 °C. If this is not acceptable, you will have to measure the temperature of the electrolyte as well and use a table to determine the actual dielectric con- stant. Unfortunately, the simple cali- bration procedure is no longer feasi- ble in this case, and the liquid level must be determined using the theo- retical formulae. With this approach, the accuracy of the sensor tube con- struction, the exactness of the dielec- tric constants of the tube insulation and the insulation of the centre elec- trode, and the accuracy of the reference inductor and the frequency measure- ment are very important for obtaining good results. In addition, the parasitic capacitance of the connecting cable must be measured exactly. Choice of materials A wire with polyethylene (PE) insula- tion is a better choice for the inner con- ductor than one insulated with poly- vinyl chloride (PVC) because the die- lectric constant of polyethylene has a very small range of variation and lies between 2.28 and 2.3. A good way to obtain such a wire is to remove the sheath and braid from a length of coax cable. If the dielectric is transparent, it is solid polyethylene with £ r = 2.3. Nat- urally, you can also use a glass tube ( r range: 6 to 8) for the sensor. It’s even easier if you can allow the electrolyte to make electrical contact with a sensor electrode and the elec- trolyte is electrically conductive (which is the case with normal water). In this case the electrolyte acts as the outer electrode of the capacitor (see Fig- ure 8). Here again there is a linear relationship between the capacitance and the liquid level. The temperature dependence of the electrolyte is largely irrelevant as long as the conductivity of the electrolyte is much greater than the conductivity of the insulation of the inner electrode. This is always the case with tap water. Constructing the sensor is a bit tricky in this case because the inner electrode cannot be clamped at both ends. The best approach is to use a thin brass tube (from a DIY shop) and insulate it with heat-shrink tubing so the brass does not come in contact with the electrolyte. Now the trick is to devise brackets that hold the inner tube and the outer tube of the sensor (the outer tube can be made from stainless steel or copper) such that they are accu- rately concentric. Depending on the diameter of the outer tube, an arrange- ment using plastic champagne corks with a hole drilled through the centre is reasonably effective. Don’t forget to also drill a vent hole. ( 080707 - 1 ) 46 elektor - 5/2009 j>iri :?hi iAMuTHfi . L I ‘-.l P. j L X K Prototype & small series PCB specialists CIRCUITS Instant online pricing and ordering Low order-pooling prices - 1-8 layers Full options service On demand - 1-16 layers Deliveries from 3 days Stencil service PROTO - 2 boards in 5 days - No tooling charge - Low PCB-Proto prices E.g. 2x 160x100 mm: 2 layers 49€ each* 4 layers 99€ each* - Immediate online ordering - No minimum order charge ^excluding transport and VAT Call us: 020 8816 7005 Email: euro@eurocircuits.com www.eurocircuits.com NEW show - Earls court, stand H31, 16-18 June Artificial Intelligence m>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 how to 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 your PC. ijlektor SHOP 256 pages • ISBN 978-0-905705-77-4 £32.00 • US $46.00 Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 Further information at www.elektor.com/books \ W 5/2009 - elektor 47 TEST & MEASUREMENT Dr. Thomas Scherer (Germany) It's difficult to be sure that your digital multimeter (DMM) is taking accurate measurements especially if it's a few years old. This handy calibrator gives full scale reference levels of both voltage and current, designed specifically for the scale ranges used by DMMs. V & I Calibrator Have faith in your measurements DMMs which claim to have a basic accuracy better than 1% can these days be found for less than £20. Even instru- ments with better than 0.5 % accuracy are selling for less than £100. At the other end of the scale you can find low-spec ‘no name’ digital multi- meters for just a few pounds at ‘bar- gain basement’ outlets and jumble sales. You may have doubts about the accuracy of these instruments. Even the better known brands do not give any figures regarding long term accu- racy. Periodic recalibration is recom- mended. You can of course blindly trust the display readings but as they say ‘confidence comes with calibra- tion’. This calibration circuit is small enough to find a space on any work- bench and will facilitate speedy and precise multimeter (re)calibration. Voltage reference devices The basic requirements for the cali- bration circuits are that it must supply a known stable DC reference voltage level. The multimeter to be calibrated is connected to the reference supply and adjustments are made to its cali- bration preset (see Figure 1) until the displayed value is the same as the known voltage level. Both the DC volt- Figure 1. A simple low-cost multimeter with the back removed to reveal the calibration preset (red arrow). Figure 2. Block diagram of the LM4050 precision zener. 48 elektor - 5/2009 Figure 3. The volts calibrator has a voltage regulator, voltage reference, switchable voltage divider networks and a dual op amp used as a buffer and voltage/current converter. age range and current range can be checked. The most important compo- nent in this circuit will undoubtedly be the device which generates the stable reference voltage. Fortunately there are a number of suitable ICs availa- ble which offer good precision at low cost. The LM4050 from National Semi- conductor [1] was eventually chosen for this application. The LM4050A-4.1 acts as a high-precision zener diode producing a 4.1 V reference with an accuracy of 0.1%, the device is priced at around £2.00 and is available in a two-pin SMD-SOT23 package. The internal block diagram of the LM4050A is shown in Figure 2. In its simplest form the calibration cir- cuit can be made by connecting the LM4050 in series with a suitable resis- tor across a supply voltage (higher than the reference voltage). The multi- meter to be tested then measures the voltage produced across the IC and its calibration preset is adjusted. The 10 to 20 MQ input impedance of the multimeter will not impose a signifi- cant load on the reference voltage. OK, job done. . .1 knew this was going to be a short article. Reference voltage level That certainly would do the job but to make a more useful universal cal- ibration device requires a bit more thought and planning. High precision voltage reference ICs are available with a range of fixed reference volt- age outputs. The part number suffix usually indicates the reference volt- Technical Specifation • 0.1 % accuracy at 25°C • Temperature stability: 50 ppm/°C • Output voltage: 3.9 V/1 .9 V switchable • Output current: 3.9 mA/1 .9 mA switchable • Power requirements: 6 to 18 VAC or 9 V battery • Current consumption: 5 mA age. A typical range of standard volt- age references would include 1.024, 1.200, 1.240, 2.000, 2.048, 2.500, 3.000, 3.300, 4.096, 5.000 and 10.000 V, none of which are ideally suited to our needs here. Reference levels of 1.000 V, 2.500 V and 5.000 V are fine for ana- logue multimeters but for digital mul- timeters it is necessary to produce a level just below full-scale. To find the optimum voltage reference we need to look more closely at the way DMM scale ranges work. A standard 3V2 digit DMM can display readings in the range from 0 to 1999 while a better 3 3 A digit device can show 0 to 3999. Using a meter with manual range selection and a refer- ence value of 2.000 V (or 4.000 V for 3 3 A digit) will cause the DMM display to indicate an overflow. This is not too much of a problem; you can turn the calibration adjustment on the DMM until the display is on the point of alter- nating between full scale and over- flow. The DMM will then be calibrated with sufficient precision. Meters with automatic range select however will switch up to the next range, so a ref- erence level of 2.000 V (or 4.000 V) will be displayed as 02.00 V (or 04.00 V). The resulting reduction in measure- ment resolution caused by the loss of a decimal place amounts to 1/200 = 0.5% (or 1/400 = 0.25%). This would signifi- cantly reduce calibration precision; the reference voltage has an accuracy of 0 . 1 %. Testing various makes of autorang- ing DMMs showed that they do not all behave identically as the meas- ured voltage approaches full-scale. Some of them switch up to the next range at 1.950 V (or 3.950 V) while others display up to 1.999 V (3.999 V) before they switch. This influences the choice of reference voltage level, it was found that all the meters tested remained stable in the lower range (giving best resolution) with a volt- age level of 1.900 V (or 3.900 V). The resulting resolution at this level now shows an improvement to the more acceptable figure of 1/1900 = 0.053% (or 1/3900 = 0.026%). Precision circuitry The circuit diagram (Figure 3) shows that precision resistors are used in two voltage divider networks to derive the 1.900 V and 3.900 V voltage levels from a reference voltage of 4.096 V produced by the LM4050A-4.1 (IC3). An AC mains adapter with an output voltage in the range of 6 to 18 V will make a suitable supply for this circuit. Regulator IC1 produces the 6 V supply voltage. Full wave rectifier B1 on the input ensures that the polarity of the 5/2009 - elektor 49 TEST & MEASUREMENT supply voltage is not important. The circuit draws low current so for occa- sional use a 9 V battery is also a suit- able power source. Jumper JP1 is used to select between the two different output levels to cater for both 3V 2 and 3 3 A digit meters. The current through R1 is 1.27 mA. The cur- rent through IC3 is either 1.22 mA or 0.71 mA depending on the position of JP1 but both of these values lie around the middle of the optimum operating curve specified in the IC3 data sheet. It can be difficult to find a supplier who stocks the complete E96 series of 0.1% tolerance resistors so R3 and R4 are both made up of two resistors in series. This allows resistor values from the more popular E12 series to be used and also makes it easier to select situated quite close to several sources of radio frequency interference which can sometimes be troublesome. Construction and use IC3 is only available as an SMD outline so with the exception of the precision resistors and both electrolytic capaci- tors all the remaining components use SMD packaging. The finished PCB is just 40 mm square (Figure 4). To make it easier to mount the SMD components R1 and C3 to C6 use the larger 1206 package outline. The author recommends using the fol- lowing procedure to mount the ICs and Bl: firstly tin just one of the pads on the PCB where the IC will be fit- ted. Move the IC into position over the pads, clamp it down tightly with one 3.900 mA. Calibrating the DMM is just as simple: Open-up the DMM case and identify the scale calibration preset (Figure 1). Select the correct scale on the DMM and switch it on. Connect the calibrator output to the DMM inputs and adjust the preset until the DMM display value is correct. It is usually sufficient to cali- brate just one range, all the measure- ment ranges are normally linked by cascaded resistor networks and it is very difficult to make any individual changes. Once the voltage range is calibrated the current reference can be used to test the DMM current reading. It is usually not possible to make any adjustment to the displayed current value. You will at least get an indica- tion of how accurate the current read- ings are and how far the meter read- Mercury “standard” cell The Weston standard cell Reference voltage sources have traditionally been called 'standard cells'. Similar to a battery, they use a combination of galvanic materials to produce a precise reference vol- tage which is relatively stable and temperature independent. The Weston cell (1893) was the work of the American physicist Edward Weston (1850-1 936) and was adopted as the international standard for EMF (electromotive force) in 1911. Like all galvanic elements the cell has two electrodes suspended in an electrolyte solu- tion. The cathode is mercury and the anode is a cadmium/mercury amalgam while the electrolyte is a solution of cadmium sulphate (see illustration). The Weston cell produces a nominal voltage of 1 .01 865 V at 20 °C. It has a very low temperature coefficient of less than 1 O’ 4 V/°C. The photo at the beginning of the article shows a cell which was made in the second half of the last century. According to the label it produces a voltage of 1 .01 93 V with an ac- curacy of 0.1 %. This is better than we have achieved here with our low-cost silicon alternative but it has to be said that our version is less toxic, more robust and much more versatile. resistor combinations to give exactly the right output voltage. The resulting reference voltage is now filtered by C4 and connected to the noninverting input of IC2A. This Rail- to-Rail Input and Output op amp fea- tures a low input offset voltage typi- cally less than 0.2 mA. It is configured here as a buffer for the voltage refer- ence [2]. The second op amp in the package (IC2B) with the help of R5 is configured as a voltage to current converter. The position of JP1 not only switches the output reference voltage but also switches this precise refer- ence output current generator between 1.900 mA and 3.900 mA. This feature allows you to check the meter’s current measurement accuracy; it is often the case that the current ranges are less accurate than voltage ranges. C5 and C6 are used to attenuate any RF signals which may be picked up by the circuit. The author’s home lab is fingernail then using the other hand bring the soldering iron tip in contact with both the tinned pad and IC leg until a joint is formed. Once cool the IC will now be correctly fixed in posi- tion. Now after double-checking the IC orientation, solder the remaining leads. Lastly check that you have not accidentally created any solder bridges between pads. Once the board is fully populated and you have carried out a careful visual check of your soldering handiwork it is time to test the circuit. Connect the supply input pins to the output of an AC mains adapter capable of supply- ing 6 to 18 V (the circuit consumption is less than 10 mA) or alternatively use a 9 V battery. A DMM can now be con- nected between ‘U H- ’ and ‘U-’ where either 1.900 V or 3.900 V can be meas- ured. Connect the multimeter leads to T + ’ and T-’ and switch the range to DC current to measure 1.900 mA or ings can be trusted. This also applies to the AC measurement ranges of volt- age and current which are not cali- brated. To calibrate resistance ranges there are no prizes for guessing that a precision resistor of value 1.8 k or 3.9 k can be used as a reference. Variations The circuit will also work with a 5 V voltage regulator in place of the 6 V version used for IC1. In this case it will be necessary to reduce the value of R1 to 820 Q. This modification will how- ever prevent the circuit from supplying the reference current to test the current ranges. A current of 4 mA produces a voltage drop of more than 400 mV. The author has a 3 3 A digit DMM in his pos- session which (curiously) produces a voltage drop of just over 1 V at this level of current. In this case the sup- ply voltage to IC2B will be too low. The component values given in the circuit 50 elektor - 5/2009 COMPONENT LIST Resistors R1 = 1 kQ5, SMD R1 206 R2 = 3kQ9, 0.1% R3A = 68ka 0.1% R3B = lOkQ, 0.1% R4A = 2kf27, 0.1% R4B = 680Q, 0.1% R5 = IkQ, 0.1% Capacitors Cl = 100jL/F 35V, radial electrolytic C2 = 10jL/F 35V, radial electrolytic C3,C4 = lOOnF, SMD Cl 206 C5 = 1 OnF, SMD Cl 206 C6 = InF, SMD Cl 206 Semiconductors B1 = B40S, SMD bridge rectifier, 40V/ 1 A IC1 = 78L05SMD, SO08 IC2 = LT1490, SO08 IC3 = LM4050A-4.1, SOT-23, e.g. Farnell # 1468851 Miscellaneous JP1 = 3-way SIL pinheader, lead pitch 2.54mm (0.1") with jumper PCB, # 080894-1 Figure 4. At 40 mm x 40 mm the Volts Calibrator PCB is very compact. diagram will be suitable to cater for the majority of situations. If you really want to cover every possible case you can use an 8 V regulator for IC1, R1 will now need to be 3.3 kQ and a mini- mum AC input supply of 9 V will be required. In many cases a less precise reference is acceptable; the B version of the LM4050 can be used here. It has a pre- cision of 0.2 % but the price difference between the two chips is only a matter of a few pence. Alternative op amps for IC2 (the LM4050) are the OPA2343 from Burr-Brown or the AD822 from Analog Devices. The circuit can be fitted into an enclo- sure; a single pole changeover switch can be wired to the pins of JP1 to replace the jumper. Those of you who would prefer the volts calibrator to pro- duce the more traditional reference val- ues of 1 V and 1 mA can use a value of 750 Q for R3A and 510 Q for R3B. Both 0.1%, of course. ( 080894 - 1 ) Internet links & Literature [1] www.national.com/mpf/LM/LM4050.html [2] www.linear.com/pc/ productDetail.jsp?navld = LTl 490 Advertisement See your project in print! Elektor magazine is looking for Technical Authors/Design Engineers If you have v' 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 v' 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 f. 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 Suiting MA, Editor Regus Brentford, 1 000 Great West Road, Brentford TW8 9HH, United Kingdom Email: editor@elektor.com 5/2009 - elektor 51 CALCULATOR INTERFACE Pocket Calculator Control Interface Communicating with a TI-83(Plus) or TI-84 Plus Koen Kempeneers (Belgium) A-LDCK liuk ALPHA. XJ,S : n 5TAT ANGLE DRAW DISTR PBOirt VAAS STOt- lATALM Programmable calculators used to be exotic, but now they are standard equipment in almost every school or polytechnic. The TI-83 (Plus) and TI- 84 Plus are especially popular. Both models have a 'link port' for exchanging data. If you connect the right hardware to this port, you can do much more with it. Every technician or engineer has a pocket calculator somewhere on their desk. Although the internal processes of these calculators are hardly suitable for control tasks, some of them can be used to build a nice robot. All TI graphic calculators have a ‘link port’, which takes the form of a 2.5-mm (0.1") stereo headphone socket that enables the unit to exchange data and programs with other units and send commands to a calculator-based lab- oratory (CBL) system or a calculator- based ranger (CBR). However, these machines can do even more. The inter- face described here gives the calcula- tor access to 16 digital I/O lines and four analogue inputs linked to 10-bit converters. Link port The headphone connector has two signal contacts and a ground contact (GND). However, it uses a non-stand- ard communication protocol specially 52 elektor - 4/2009 devised by TI for this purpose. Fortunately, the protocol is remarka- bly simple. In the quiescent state, the measured signal level on each com- munication line is around 3.3 V. When data is to be sent, the transmitter pulls one of the two lines to 0 V, and the receiver then pulls the other line to 0 V in acknowledgement. To send a ‘O’, the transmitter pulls DO (the white lead of the cable) to 0 V first, and to send a ‘1’ it pulls D1 (the red lead) to 0 V first. It is also important to know the order in which the individual bits leave the link port. Instead of the usual practice of sending the LSB first, with the link port the MSB is sent first. Technical specifications • 32 ESD-protected inputs/outputs including connectivity for l 2 C, AVR-ISP, JTAG, RS485 and general I/O. • Supply regulation using 7805 • Firmware all in C • Simple to program R4 RESET 1 V C C © ISP PB6 O O O O o o Vcc © Jc3 ^^00n j- I RESET PBO 1 posy PB7S V CC © 1 r\. 2 PBO 3 _r\ r\. 4 PB1 y f PB2 5 -T\ r\. 6 PB3y f PB4 7 r\. 8 PB5y f PB6 9 -r\ r\. 10 pb7 y PORT D 1 r\. 2 PDO 3 r\. 4 PD1 y ' PD2 5 _r^ r\. 6 PD3S ' PD4 7 Lr r\. 8 PD5S ' PD6 9 r\. 10 pd7 y PB1 2 PB2 3 PB3 4 PB4 5 PB5 6 PB6 7 PB7 8 f PDO 14 PD1 15 PD2 16 PD3 17 PD4 18 PD5 19 PD6 20 PD7 21 32 10 LI 1 10|uH ADC ^^00n ADCO 30 AREF VCC AVCC RST IC2 PB0(XCK/T0) (ADCO)PAO PB1(T1) (ADCI)PAI PB2(INT2/AIN0) (ADC2)PA2 PB3(OCO/AIN1) (ADC3)PA3 PB4(SS) (ADC4)PA4 PB5(MOSI) (ADC5)PA5 PB6(MISO) (ADC6)PA6 PB7(SCK) (ADC7)PA7 AT MEGA32-P PDO(RXD) (SCL)PCO PDI(TXD) (SDA)PCI PD2(INT0) (TCK)PC2 PD3(INT1) (TMS)PC3 PD4(OC1 B) (TDO)PC4 PD5(OC1 A) (TDI)PC5 PD6(ICP) (TOSC1)PC6 PD7(OC2) (TOSC2)PC7 GND XTAL1 XTAL2 GND 11 13 12 C 11 ( H > C9 C6 18p 8MHz 18p > 40 ADCO 39 ADC1 ' 38 ADC2 ' 37 ADC3 ' 36 ADC4 ' 35 ADC5' 34 ADC6 ' 33 ADC7 ' V 22 SCL 23 SDA 24 TCK 25 TMS ' 26 TDO ' 27 TDI 28 PC6 ' 29 PC7 ' 31 ADC2 ADC4 ADC6 O O O O o o o o- o o ADC1 PB7 ADC3 ADC5 10 ADC7 V CC © |~m i W R3 S l 2 C □ Vcc twice. You will then see the following screen: Now press ENTER to start the editor. First enter the name of the new program, and then start entering the program. PROGRAM Hame-BLIWKH The following program causes a LED to blink on the I/O interface: : 0 - >A :While getKey=0 : A xor 1->A : Send (A) : For (B , 0 , 5 0 ) : End For first-time programmers, the key combinations necessary to enter this pro- gram are listed below: fol fsTo»1 FalphaI A reTTERl [frgm] hh fpRGMi rn m itesti rnroi fENTERl I ALPHA] A Hod) [CATALOG] X fENTERl 0 |5T0*1 I ALPHA I A fENTERl [PHGMl 0 (ALPHA] B I ALPHA] A (T| I ENTER I [PRGMi m iALFHAI B □ 0 Q GD G3 CD fENTERl fPHGMl [7] (ENTER If everything has been entered cor- rectly, this is what you should see on the calculator: I PROGRAM: BLINK : 0+ft : While 9etKey=W :fi xor 1+fi : Send (A) : For Zir[ElUQOOOOZO^^^^^^^ CLCLD.CLD.D.CLD.CL nnnnnnhhnnhnnnnnhhnnnnnnn 2 < < CL CL O0)00N(Din'tC0(MT-O0)00N©in^C0W'-O0)00NCD OCTioajooaioaioajooaocooooooocooooooor'^r^r'^i'^ o Port R Port Q X DATA BUS < £ ADC A DAC A AC AO AC A1 Fbrt B ADC B DAC B AC BO AC B1 OSC/CLK Control Power Control BOD VREF POR TEMP || RTC OCD Reset Control AV* CPU DMA FLASH RAM E 2 PROM Watchdog Interrupt Controller Event System Ctrl Port K Port J Port H DATA BUS EVENT ROUTING NETWORK Port C Port D Port E Port F (DNooaiOi-CMn^tncDMDrooi-cjco^tntDSooroo (MCMiMCMCocococococococococO'd-'si-^'d-'d-'d-'d-'d-'d-^Ln uuuuuuuuuuuuuuuuuuuuuuuuu - ---- — Oi-c\ico^tin in co ^ in to n n QQQQQQQ^o clclclclclclclS^ O Oi-wco'tmmN LULLILULULULULULU oo CLQ-CLQ-Q-CLQ-CL£;S^Q-Q-Q-Q-CLQ- 0 > 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 □ PKO Il-vcc- □-GND — PJ7 PJ6 PJ5 PJ4 PJ3 PJ2 PJ1 PJO □-VCC- □-GND- PH7 PH6 PH5 PH4 PH3 PH2 PHI PHO >vcc- □-GND- □ PF7 □ PF6 +3V3 © □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ 080753 - 1 1 Figure 2. Only a few components are needed to construct a test bed for XMEGA controllers. with no less than 78 I/O lines in a 1 00-pin TQFP package. To construct our test set-up we first soldered the controller to an adapter board, which was then attached to a piece of perf board (Figure 1). Very little more is needed for this test bed; only a power-on- reset-switch (a 10-kQ resistor and a 100-nF capacitor suffice for this) and a stabilised power supply. At this stage we encounter one of the important differences from the familiar AVR microcontrollers. The XMEGAs cannot be powered from a 5 V supply; instead they must be fed with a voltage between 1 .6 and 3.6 V. The best solution is an integrated voltage regulator like the LM1 1 17-3.3V, using two electrolytics naturally. This is the easy way of producing 3.3 V from the 5 V available on a USB connector. the AVR ISP Mk II and the AVR Dragon. An LED (with series resistor) provides a simple output indica- tor on our perf board 'XMEGA Tester', the circuit of which is shown in Figure 2. Software As with the AVR controller you can find the complete 'tool chain' (compiler, linker, IDE, programmer and debugger) for the XMEGA free of charge on the Internet. Note that the two separate software packages need to be installed together: firstly WinAVR [3] (compiler complete with linker etc.) and secondly the development environment, AVR Stu- dio [4] (editor, project control, integration of compilers, debugger, etc.). It is best to install the Open Source pro- 5/2009 - elektor 57 INFO & MARKET MICROCONTROLLERS Figure 3. Successful entry of JTAGICE Mk II into the system control. 0 — Device Manager ran File Action View Help 1*] (S if m a AOPI Multiprocessor PC - ** Disk drives Hitachi hDP725U£5QLA38fl Display adapters NVIDIA Quadra FX 570 i= ^ OVD/CD-P.OM drives . Optiarc DVD+-RW AD-72005 i Human Interface Devices •+ Jj IDE ATA/ATAPI controller + IEEE 1-394 Bus host controllers E 3§l Jungo JTAGICE iFikll =$ WinDriver + -Keyboards + Mfce and other poirttinq devices it ' Monitors + Network adapters + V Ports (COM &LPT) •+ Processors i±- Sound, video and game contrclers Program: 1024 bytes (0.8% Full) (.text + .data + .bootloader) Data: 0 bytes (0.0% Full) (.data + ,bss 4- .noinit.) Figure 4. The status window of AVR Studio following a compiler run. Build succeeded with 0 Warnings.. Build ©Message . Find in Files 1 .Breakpoints and Tracepomts Listing 1 • LED Flasher test program #INCLUDE "AVR_COMPILER.H" # INCLUDE " PORT_DRI VER . H" #INCLUDE "CLKSYS_DRIVER . H" #INCLUDE #INCLUDE INT MAIN ( VOID ) { /* ACTIVATE INTERNAL OSCILLATOR */ CLKSYS_PLL_CONFIG ( OSC_PLLSRC_RC2M_GC , 30 ) ; CLKSYS_ENABLE ( OSC_PLLEN_BM ) ; CLKSYS_PRESCALERS_CONFIG ( CLK_PSADIV_1_GC , CLK_PSBCDIV_1_2_GC ) ; DO {} WHILE ( CLKSYS_ISREADY ( OSC_PLLRDY_BM ) = = 0 ); CLKSYS_MAIN_CLOCKSOURCE_SELECT ( CLK_SCLKSEL_PLL_GC ) ; /* PORT A IS OUTPUT */ PORT_S ET P I N S AS OUT PUT ( &PORTA, 0XFF ) ; WHILE (TRUE) { /* 1 SECOND PAUSE */ _DELAY_MS (1000) ; /* CHANGE VALUE OF PORT A */ PORT_TOGGLEPINS ( &PORTA, 0XFF ) ; } } ject WinAVR (actively supported by Atmel) first. Note that only XMEGA-compatible versions (2008041 1 onwards) should be used. After WinAVR comes AVR Studio. Here too only XMEGA- compatible versions (4.14 and higher) are suitable. The USB drivers needed by JTAGICE Mk II are installed along with WinAVR, so long as you tick the corresponding boxes (don't forget, this is important!). After running up JTAGICE Mk II for the first time you can call up Windows Installer to search for suitable drivers. To check how the installation went, just look at the entry in Windows Explorer, see Figure 3. After this, as soon as you boot up AVR Studio, it should automatically offer you the opportunity to create a C-Project. If so, WinAVR has been found and integrated successfully. Figure 5. The dialogue window of AVR Studio for selecting the flasher hex file. Commissioning At start-up AVR Studio offers you the choice of retrieving an existing project or starting a new one. Logically your first test needs to be to launch a new project and assign it a project name. The next task is to select the controller (here we want ATXMEGA1 28A1 ) and the programming and debugging interface (in this case JTAGICE Mk II with USB connection). At this stage it can happen that AVR Studio may want to introduce new firmware into JTAGICE Mk II. In this situation just follow the software requirements. If everything is still in order the internal signature of the chip can be selected by selecting 'Read Signature' using the tab 'Main'. If this doesn't work you should look for errors as follows: • Is the power supply voltage correct? • Are the VCC and GND pins connected the proper way round? • Are the JTAG connections correct? • Is the Reset line connected to the JTAG socket via TRST? Once the process of reading out of the signature functions 58 elektor - 5/2009 properly, then downloading software into the controller is no longer a problem. 'Flasher' test program For our first (admittedly simple) test it will suffice to make an LED flash on and off. The source code (written in C) of the program shown in Listing 1 can also be downloaded from location [5]. After the typical introductory Include statements the program first activates the internal oscillator and the prescaler and then in the second block defines Port A as output. In the endless loop that follows, Port A, to which the LED is con- nected, is alternately set Low and then High. And that's it. The program is interpreted with a click on the Compiler icon or with a key press on F 7. If no errors are indicated in the status window (see Figure 4) the result can be transferred into the controller via the programmer. After successful compilation the programmer window appears (see Figure 5). The Hex file that results from the compiler run is found normally in the 'debug' folder of the project directory. Once the file is transferred into the con- troller the program starts there immediately and in our test, hurray, the LED really did start to flash! The verdict Working with XMEGAs is no different from ATmegas or ATtinys and is just as straightforward, with no unpleasant surprises. An attractive feature is the event system, which enables simultaneous processing of data between peri- pherals during operations without burdening the proces- sor. In this way for example a timer can initiate directly measurement of an analogue value, without adding to the load of the CPU. Thanks to cryptographic functions such as AES and DES some new and very interesting application areas can be exploited. In practical terms the XMEGAs offer nothing but advantages over the preceding ATmega con- trollers, meaning that these new microcontrollers be recom- mended wholeheartedly to all AVR users looking for extra performance. ( 080753 - 1 ) Internet Links [1] BASCOM for XMEGA: www.mcselec.com [2] Datasheet for the ATXMEGA1281 A1 : www.mcselec.com [3] WinAVR: http://winavr.sourceforge.net/ [4] AVR Studio: www.atmel.com/dyn/products/tools_card.asp?tool_id = 2725 [5] Test program LED Flasher: www.elektor.com/080753 and www.embedded-projects.net/myxmega.zip The new XMEGAs — facts and data The new XMEGA microcontroller represents a significant further development of the well-known 8-bit controller of the ATtiny and ATmega type. The computation module is funda- mentally unaltered but has been expanded with some 16-bit operations. The upper clock speed has been raised and the processing performance has been optimised by a hardware multiplier among other things. It has also been enhanced with additional, improved and expanded peripherals as well as a properly configured event system. Voltage range 1 .6 to 3.6 V without limitations (the maximum clock speed of 32 MHz is feasible already at 1 .6 V). Clock speed Maximum 32 MHz. 4 internal ULP oscillators: 32 MHz, 2 MHz, 32 kHz and 32 kHz External crystals: 32 kHz and. 0.4 to 16 MHz. Internal PLL with factors up to 1:31. Prescaler with factors from 1 to 2048. Timer with maximum of 1 28 MHz. Following reset the XMEGA starts at internal 2 MHz. DMA A total of four DMA channels make it possible for example to realise Interrupt-driven analogue to digital conversion without putting any additional load on the CPU. Encryption Integrated CPU-sparing hardware cryptography with DES or AES algorithms. Memory The XMEGAs provide integrated program memory up to a planned maximum of 384 KB. In addition up to 16 MB of ex- ternal memory can be addressed. ADC The resolution of the A-to-D converter is increased to 1 2 bits. Increased number of channels and maximum sampling rate of 2 MS/s. DAC In the same way the XMEGAs are provided with integrated D- to-A converters with 12-bit resolution as standard. Up to one million transformations a second are feasible. Timer All timers are provided with 1 6-bit resolution. The number of times can be raised to eight. Pins A greater number of more flexibly applicable I/O lines. An interrupt can be allocated to each pin. Output loading is re- stricted to 1 0 mA. Interfaces The integrated USART is, as with the SPI, fully duplex-capable. I2C now uses 1 0-bit addresses. Interrupt and Events Thanks to the integrated multi-level interrupt controller it is possible to prioritise interrupts to up to eight levels, which simplifies the more complex event-triggered applications considerably. In addition the CPU loading can be reduced by hardware routing. 5/2009 - elektor 59 INFO & MARKET REVIEW A USB oscilloscope is a good alternative to a normal oscilloscope in a home lab. These instruments are handy and a good deal less expensive than a normal oscilloscope. In this article we examine a pair of two-channel units that also include a built-in function generator: the PicoScope 2203 and the Velleman PCSGU250. USB oscilloscopes are available nowadays in all price ranges and quality levels. The idea behind these instruments is simple: why not use the computing power and display capabilities of a PC (which in most cases is already avail- able) to display the signal waveforms? After all, a modern oscilloscope is not much more than a dedicated computer with a screen (not especially large in some cases) and a few buttons and knobs. A USB oscilloscope module doesn't look very impressive on the outside: just a small box with a couple of BNC connec- tors on one end and an USB port on the other end for the link to the computer. As this module does not need controls and indicators, a powerful processor, a display or a power supply, it can be produced and sold at a much lower price than a full oscilloscope. Of course, you operate a USB oscilloscope with a keyboard and mouse, which is quite different from using a normal oscilloscope. This takes a bit of getting used to if you are accustomed to working with a 'real' oscilloscope. For an electronics enthusiast who regularly puts together electronic circuits at home or a designer who sometimes works at home, a USB oscilloscope is a good, affordable alternative to a real oscilloscope. For this test, we selected two inexpensive USB oscilloscopes that are also equipped with a built-in function generator, which gives you a complete 'mini-lab' on your bench. This is very handy for jobs such as measuring the frequency response of a circuit. Both units cost around 200 euros or the equivalent in pounds or dollars, which fits within an enthusiast's hobby budget. The main specifications of the two units are shown side by side in Table 1 . PicoScope 2203 The UK firm Pico Technology specialises in USB oscillo- scopes and has a broad range of products in this category, 60 elektor - 5/2009 truments sci loscopes with nerator including some with sampling rates of several gigasam- ples per second. The model we selected for our review, the 2203, is housed in a small blue-grey box slightly larger than a cigarette pack. There are three BNC connectors and an LED at the front, with a USB-B connector for the link to the PC at the back. The box is powered via the USB connec- tion, so a separate AC mains adapter is not necessary. In addition to the box, you receive a brief user guide, a CD- ROM with the software, a USB connection cable, and two probes that turn out to be of reasonably good quality. This is certainly not always the case with relatively inexpensive USB oscilloscopes. After the PicoScope6 software and the drivers are installed, everything works smoothly. The layout of the user interface (Figure 1) takes some getting used to. It consists of a large display window for the waveforms, with narrow bars at the top and bottom for the controls. The settings for most tasks, such as selecting the horizontal or vertical scale, are configured using drop-down menus. This feels a bit strange at first if you're used to turning knobs on a normal oscil- loscope. However, after a while it becomes fairly natural, and the overall layout remains clean and uncluttered with this approach. The software provides three main functions: a two-channel oscilloscope, a spectrum analyser, and an arbitrary wave- form generator (AWG). You can use the generator to pro- duce a signal, feed it into a circuit or device, and then examine the signal in the circuit or at the output. You can easily adjust the size of the PicoScope program window. The measured signal is normally shown in the whole window, but you can also display several windows at the same time. For example, you can show the measured signal along with its spectrum or show the two input sig- nals in separate windows. In addition to the 'normal' oscil- loscope display, there is a 'persistence' mode that imitates the operation of a storage oscilloscope, with several wave- forms displayed superimposed using a sort of slow-decay effect, just like a storage oscilloscope with a long-persist- ence phosphor. In the oscilloscope mode, the 8-bit reso- lution can be mathematically increased to as much as 1 2 bits. This gives the waveform a smoother appearance and makes everything look nicer, but you should bear in mind that it can cause certain details to be hidden. In prac- tice, increasing the resolution by 1 .5 to 2 bits proves to be enough to largely eliminate the originally visible effect of the sampling increments while still retaining all the relevant waveform details. The built-in autoranging function for the input amplifiers and attenuators responds to changes in the input signal level quickly and reliably; there is rarely any need to change the settings manually. All sorts of mathematical operations can be performed on the input signals, such as addition, multiplication, and sub- Figure 1. Screen shot of the PicoScope user interface. The number of windows is user-configurable. 5/2009 - elektor 61 INFO & MARKET REVIEW Figure 2. The user interface of the Velleman oscilloscope. Unfortunately, the screen size cannot be adjusted. traction. You can even write your own formulas. The spectrum analyser provides the most commonly used settings, such as the number of calculated points, selection of a measuring window (such as Blackman or Hamming), and a variety of scales. The FFT analysis runs especially fast on a modern PC, giving you the impression that you can monitor the composition of the measured signal in real time. Finally, a few words about the user interface of the built- in generator. In contrast to the other functions, it is rather spartan. A button in one of the toolbars opens a small menu where you can set the frequency and select one of several waveforms (sine, triangle, sawtooth, etc. - most commonly used types are available). The output voltage can be adjusted in several steps from 1 25 mV to 2 V peak- to-peak, or you can enter a value directly, and the offset can be adjusted over a range of ±1 V. A sweep function is also available. You can also use the generator to produce a user-defined waveform specified by a text file with a list of values. In addition, there is an 'Arbitrary' button that opens a sepa- rate window with a signal editor. It's very easy to use the mouse in this window to create a waveform or modify an existing waveform. This works very well. All in all, the generator has a lot to offer, but the interface is not especially user-friendly and a separate mute button on the main toolbar would certainly be convenient. In use, the PicoScope has a distinctly 'hands-on' feel. The display is clear and responds quickly — you almost feel like you're working with a normal oscilloscope. The built-in generator works well and produces very nice waveforms. In practice, this unit is a good alternative to a normal oscilloscope. Velleman PCSGU250 Velleman supplies a large range of electronic products, but it is primarily known for its own electronic kits and instru- ments. The PCSGU250 is the smallest member of a new family of recently introduced USB oscilloscopes. The housing has modern styling and is approximately twice as large as the PicoScope box. It is designed so it can stand upright next to a monitor or computer. Unfortunately, this makes it a bit unstable when a probe or set of probes is attached, since they sometimes get tugged in use. To help prevent the unit from tipping over, the designers fitted a sheet of lead at the bottom of the enclosure, and a trian- gular support for attachment to the rear of the enclosure is included. The box also contains a USB cable, a short user guide, a mini-CD with the software, a probe, and a Cinch/BNC adapter. The probe is made by the same manufacturer as the PicoScope probes, and there's nothing wrong with it, but it's a pity that there's only one in the box. Here again, installation of the PcLab2000LT software and the USB drivers was trouble-free on our Windows XP machine (the software for both units is only suitable for Windows systems). The user interface of the program (Figure 2 is entirely different from that of the PicoScope. Just as with the enclo- sure, it appears that a deliberate effort was made to depart from the standard design. Whether you like this is a matter of taste. The left-hand part (the larger part) of the screen is reserved for the oscilloscope function, with a display win- dow (not especially large) surrounded by all the controls. The control panel for the built-in generator is on the right. Almost all user settings are made using buttons. For instance, there are six buttons for each input to select the input sensitivity, 21 buttons for the time base, and several additional buttons for the trigger settings and a few other things. Although this may appear convenient at first glance, it makes the overall layout very cluttered and somewhat confusing. Despite the fact that the generator portion is designed in the same manner, it is well organised and easy to use because it has only a limited number of buttons. One of the first things you notice when using the program is that that the size of the program and display windows cannot be changed. On a modern high-resolution monitor, they are simply too small. The software has roughly the same features as the Pico- Scope software, namely a two-channel oscilloscope, a spectrum analyser, and an arbitrary waveform generator (AWG). It also has some extras in the form of a Bode plot generator (for automatic measurement of frequency and phase characteristics) and a transient recorder for making measurements over long time intervals. Large buttons above the display select the individual func- tions. This area also has a button to select a special display mode for digital signals. When making measurements in oscilloscope mode, it's a good idea to start by pressing the Autoset button, which 62 elektor - 5/2009 Table 1. Main specifications. PicoScope 2203 Velleman PCSGU250 Oscilloscope: Max. sampling rate 40 Msamples/s (1 ch.) 25 Msamples/s 20 Msamples/s (2 ch.) Input bandwidth 5 MHz 12 MHz Resolution 8 bits 8 bits Internal buffer 8 Ksamples 8 Ksamples Input range 1 0 mV/div to 4 V/div 1 0 mV/div to 30 V/div Max. input voltage 20 V 30 V Time-base range 200 ns/div to 20 s/div 1 00 ns/div to 2000 s/div Generator: Frequency range DC to 1 00 kHz 0.005 Hz to 500 kHz Internal clock 2 MHz 12.5 MHz Resolution 8 bits 8 bits Output voltage 125 invito 2 V p p 1 00 mVpp to 1 0 Vpp Offset -1 to +1 V -5 to +5 V Output impedance 600 a 50 £2 causes the system to try to find usable settings for the X and Y scales and triggering in order to produce a clear wave- form display. The autoset function does not work continu- ously; if the input signal changes significantly, you have to adjust the settings manually or press Autoset again. Several times during the test, I wasn't sure whether I was looking at the current input signal or the samples stored in the buffer. In most cases, this doubt was resolved by again pressing the Run or Autoset button. You can call up markers and use the mouse to position them in the display window. The markers can be used to measure various signal parameters (this can be done with the Pico- Scope by clicking points in the display window). Several mathematical operations are possible, but they are limited to the most essential. Like the PicoScope, the Velleman unit allows the resolu- tion to be increased artificially with a few mathematical tricks, but it is not clear whether both devices use the same method for this. During several practical tests, the Velleman oscilloscope proved to respond rather slowly to changes in the input signal. It looks like some sort of internal pre-processing must take place before the signal is shown on the screen. This must be taken into account if you want to make a series of measurements at different points in a circuit. The spectrum analyser is certainly usable, but not as detailed or fast as the PicoScope spectrum analyser. It also has somewhat fewer configuration options. The Bode plotter is an especially convenient addition to the program. You can use it together with the built-in function generator to record a frequency or phase characteristic quickly and automatically. You can set the start frequency and frequency range, the step size, and even a start delay. This is very handy for quick checks. The generator portion is quite nice. Practically every desired frequency in the output range of the generator can be entered directly or adjusted in fine steps using a slider. The shape of the output waveform can be selected with a few large buttons, which also enable or disable the output signal. The output voltage can be adjusted from 1 00 mV to 1 0 V peak-to-peak, with an adjustable offset range of ±5 V. In addition, the generator can produce special waveforms such as sin x/x and user-defined waveforms. For the lat- ter function, there is a small utility program that helps you compose the waveform and shows a preview based on the entered numerical values. Internal affairs Both units have a few features that I haven't described, but the main features have been described here. Naturally, we were also curious about the hardware inside the boxes. Figures 3 and 4 show the internals of the Pico- Scope and Velleman units, respectively. The designs appear completely different at first glance, but if you examine the components that are used, you will find quite a few simi- larities. In both oscilloscope modules, the 'intelligence' is housed in a Xilinx Spartan FPGA, although different types are used in the two units. The Pico designers chose an XC3S250E (250 kgates), while their counterparts at Velle- man chose an XC3S50 (50 kgates). In addition to the FPGA, there is a microcontroller that looks after USB communication. Velleman uses a PIC1 8F2450 for this purpose, while Pico uses a Cypress CY7C6801 3A with an 8051 core and high-speed USB. The component used for analogue-to-digital conversion, which is largely respon- sible for the price and performance of a USB oscilloscope of this sort, is the same in both cases: an Analog Devices AD9288. Both units have several relays (or reed relays) for selecting the input range and DC/AC setting. From this, we can conclude that in both cases you receive hardware with quite respectable performance and process- ing power for a price of around 200 euros. The choice After you've had a chance to play with these modules for a few days, you have to answer the question: which one do you prefer? 5/2009 - elektor 63 INFO & MARKET REVIEW Figure 3. The compact PCB in the PicoScope 2203 module. As so often with such comparisons, the best solution would be a combination of the two. If I could, I'd like to have the oscilloscope portion of the PicoScope with the generator portion of the Velleman. Unfortunately this isn't possible, unless the two companies decide to join forces sometime in the future. In terms of specifications, some differences between the two modules can be seen in both the oscilloscope and the generator portions, but they are not large enough to form the sole reason for choosing one or the other. The Velleman module has somewhat better specifications overall, espe- cially the generator portion. Nevertheless, for me the oscilloscope functionality is the most important aspect of a USB oscilloscope, and here the PicoScope is clearly better than the Velleman. It has fast response and a good autoranging function. In practical measurements, it works nearly the same way as a normal oscilloscope. Given this, I'm willing to accept the fact that the function generator software has a somewhat less con- venient user interface (perhaps this could be addressed in a future software update?). The Velleman oscilloscope is primarily attractive for audio enthusiasts, due to its built-in Bode plot generator. All in all, although it's nice to be spoilt for choice, the trou- ble is, sometimes you have to make up your mind! ( 090164 - 1 ) Internet Links PicoScope 2000 series: www.picotech.com/picoscope2000.html Velleman PCSGU250: www. velleman.be/product/view/? id = 3 77622 Figure 4. The Velleman PCB has a similar design. Both circuits use a Xilinx FPGA. 64 elektor - 5/2009 * { Things of the past E-'-v'jSBE ■ Be-** Ml >; O O O IL oo Vss Xin C i ■ %C-p if f f __ r mr r r V V, “\J . 1* -"i • y, ,: - I I Elektor is now & tomorrow , l ei mi(T-ui Cover Glass Organic EL . ; ' Polarizer (Bottom) Bottom Emission LC = Liquid Crystal ; thickness ™ 4 inti : filtering backlight : Basically ineffective Organic EL = Electro Luminescent : thickness ~ 0.2um : Light Emitting Diodes : no Backlights / one Polarizer : very effective display Figure 1. TFT LCD and AM-OLED (Active Matrix OLED) construction compared. down to 50 per cent brightness loss has a bearing here as well. Direct com- parisons are pretty meaningless, how- ever, since with OLEDs the manner of use has a clear influence on these met- rics. For this reason the specification for OLEDs is set out for mixed-mode operation using all pixels and all col- ours: measurement taken with hun- dreds of randomly selected images produce an average performance of 30 per cent, which is used as the basis for this specification. For other types of usage we need to examine the situation more precisely; judicious operation to minimise exces- sive use may lead to significantly higher values. This is because unlike LCDs, it is only the active pixels in OLEDs that deteriorate in brightness. Optimisation A solution arises from the extremely high contrast available from OLEDs. If we considered poor viewing condi- tions (such as in direct sunlight) and wanted to state what which maxi- mum brightness might be optimal, we could obviously ‘turn down the wick’ under normal conditions, without det- riment to visibility of display and to the advantage of extended operational lifespan. By skilled design, for exam- ple by vertical scrolling or sideways Figure 2. The S6E63D60LED controller from Samsung is located 'on glass' integrally with the display and provides a variety of control interfaces. 5/2009 - elektor 67 MICROCONTROLLERS shifting of static images, the number of pixels employed could be increased to increase the life span of individual pixels. The resulting specification is thus directly dependent on the way we plan to use the display, meaning it could vary pronouncedly The way OLEDs are influenced and behave under differing parameters is not always entirely lin- ear, which is why Glyn has developed various sample set-ups to show up what users might expect under speci- fied conditions of current consump- tion and lifespan. These can be used for operational specifications and also for interpreting test results. OLEDs in operation As already mentioned, the OLED requires a dual-polarity power supply. For this reason the test set-up shown has the display mounted on an OLED adapter board with the extra power supply components onboard. Special voltage regulators are used, devel- oped for the particular requirements of OLEDs. As Figure 2 shows, the smaller dis- plays (in our case a 2.4-inch OLED from CMEL) can be driven in a number of ways. In one case the display is pro- vided with an SPI interface and in the other with a parallel data bus. In our case we are using the parallel input. A variety of bus widths is available. According to the depth of colour levels and data transfer rate required, we can select between 8, 9, 16 or 18 bits wide. To keep things simple, our sample set- 2.4" OLED Q CO f. §> _So_Sa.^o_So_S CC CC O O Z t— y — i— i—_icocopoco < <>>ooooo>oooo 5 5 ns O ° ° r r- (fl “ Cp _l J CM CM 0 < a. > > o o > 2 w m o o ®05oor~tom^-t*5CMT-o>-> GQ CD CO DO 00 DO 00 0Q0Q0QCQ0QCQGQCQGQGQ0CIC/)(/) qoqoqod ooooooooooo>x m IT o m H < - o m o z o Q (/) o LU C/> C/) O m m h a lli cc C/J C/3 | LU cc LU 0C 3 o Q (3 cm o LU I J o > CC O o o z s > > > > 0 o o o o 2 2 2 2 +4V6 (±H 0 +3V3 0- 10 ii 12 13 14 ? % 15 16 17 18 19 20 BAS40-04 21 <> • m 22 1 23 1 24 1 25 1 26 I 27 1 28 I 29 1 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 -4V4 EPM/P81 PL1 +5V 0 10 12 14 O O O o o o o +5V 1 ■\ R1 11 R2 CLK1 / CNVSS / BUSY/P64 / RXD1 / 13 RESET / E8a Debugger \\\\\\\\ 47 48 49 50 51 52 53 54 55 56 •— » 57 58 59 60 61 +3V3 -0 \ CNVSS v RESET CE/P80y y CE/P80 R32C Carrier R3 TXD1 y \ EPM/P81 16 \ TXD1 17 1 ® 1 i 20 21 _ 22 23 24 25 V RXD1 26 V CLK1 27 BUSY/P64 28 29 30 31_ 32 o VDC1 VDC0 O o NSD TB3IN/P93 O o CNVSS AVCC O o XCIN/P87 VREF O o XCOUT/P86 AN0/P100 O o RESET AVSS O o XOUT AN1/P101 O o VSS AN2/P102 O o XIN AN3/P103 O o VCC AN4/P104 O o NMI/P85 AN5/P105 O o INT2/P84 AN6/P106 O o INT1/P83 AN7/P107 o o INT0/P82 AN00/P00 o o U/TA4IN/P81 AN01/P01 o o U/TA4OUT/P80 AN02/P02 o o TA3IN/P77 AN03/P03 o o TA30UT/P76 INT3/P15 o o W/TA2IN/P75 INT4/P16 o o W/TA20UT/P74 INT5/P17 o o V/TA1IN/P73 AN20/P20 o o V/TA10UT/P72 AN21/P21 o o TB5IN/P71 AN22/P22 o o TA0OUT/P70 AN23/P23 o o TXD1/P67 AN24/P24 o o RXD1/P66 AN25/P25 o o CLK1/P65 AN26/P26 o o CTS1/P65 AN27/P27 o o TA1IN/P33 TB0IN/P60 o o TA10UT/P32 TB1IN/P61 o o TA30UT/P31 TB2IN/P62 o o TA0OUT/P30 TXD0/P63 o 64 63 62 J 51 60 59 58 57 56 55 54 53 52 . 51 50 49 RESETB y 48 E RDB y 47 _Rsy 46 RW WRB y 45 cssy 44 DB1 y 43 _DB2y 42 _DB3y 41 _DB4y 40 _DB5y 39 _DB6y 38 _DB7y 37 DB8 36 35 34 33 081029-13 Figure 3. Circuit diagram showing the connections between the R32C carrier board, E8a debugger and 2.4-inch OLED display. 68 elektor - 5/2009 Data[7:0] Data(8bit) D8-D1 MCU RS, WRB, RDB, RESET Driver 1C CPU 8080mode 8bit data but 262K color Data format and pin definition Index : DB8-DB1 Parameter : DB8-DB1 Image Data : DB8-DB3 1 pixel I — 1st Transmission ||— : 2nd Transmission |— 1st Transmission 1 — 2nd Transmission- 1 — 3rd Transmission INPUT DATA RGB Arrangement OUTPUT 081029-14 Figure 4. OLED display initialisation in 8-bit mode. up employs 8-bit operation. Besides the data lines the display requires five additional control lines. The schematic in Figure 3 shows how the OLED and the E8a debugger are connected. The debugger has already been mentioned briefly in the previous article of this series. Using this cost- effective tool we can carry out debug- ging with much greater ease than with the serial KD100. The E8a is incorpo- rated in the HEW, so we can view everything on a single screen. The E8a is applicable to all Renesas controllers of the M16C family, from the R8C right up to the R32C. Getting back on-topic, the OLED requires just a few additional capaci- tors, which are already provided on the OLED adapter board from Glyn. This arrangement matches with the one on the R32C application board from Elektor that we are using and will be the subject of the next two articles (see inset ‘Coming soon’). The power supply is not included in Figure 3, as there are many voltage regulators that can deliver a nega- tive voltage of -4 V for V- to pin 2 of the OLED. That’s it for the hardware need to control the OLED in our sam- ple system. Initialisation To drive the display in 8-bit parallel mode we need to divide the address and data information, then transfer them sequentially. Taking for example the three primary colours red, green and blue, transferring them in 8-bit mode, there are differing configura- tions according to the number of colour levels to be defined (see Figure 4). Our sample software transfers colours using 5-bit colour levels. For all three colours together this adds up to 15 bits per pixel. The first step is to initialise the dis- play, which requires the supply volt- ages to be powered up in a specific three-stage sequence. We begin by activating the 3.3 V for the logic modules. Next we initialise the display and in the third step we connect the bipolar voltage for the pixels. Powering up the display with- out going through this three-stage sequence can damage it, since then all the pixels will light up in a white of undefined brightness, causing danger- ously high current flow. The initialisation routine is given in Listing 1. Only in the last line is the negative voltage regulator activated. Following successful initialisation the OLED will be black overall. Rectangle and logo Even if ‘black is beautiful’ we’d prefer to see something more interesting on the display. So let’s look how easy it is to produce a simple rectangle in a sin- gle colour (see Listing 2). The S6E63D6 display controller from Samsung, located on-glass integrally with the display, enables the use of ‘frames’. Within this frame definition system we can use the ‘auto-incre- ment’ function for the pixel addresses, so that all we need to specify is the parameters for the colours of the rows. This takes place in the lower loop, which defines the data by means of the function Pixel _out(r,g,b). We’ll begin by defining the start and end points of our frame, using the functions Index _out and Parameter _ out. These values need to be included in the corresponding register of the displays. Just like the long-established alpha- numeric dot-matrix displays, the drive commands are distinguished from the actual data by level and control line. A High level on the RS line specifies data 5/2009 - elektor 69 MICROCONTROLLERS Listing 1 Initialisation of the OLED display void init_S6E63D6_240X320_8Bit_80Mode (void) { unsigned long i; Init ; WRB = 1 ; RDB=1; NCS_H ; NRESET_L ; NRESET_H ; Index out (0x24); Index_out (0x02) ; Parameter_out ( 0x0000 ) ; Index_out (0x03) ; Parameter_out (0x4120) ; // 262k colour mode (3Bytes) ) SS=1 0x4031 Index_out (0x10) ; Parameter_out ( 0x0000 ) ; Index_out ( 0x05 ) ; // display on Parameter_out ( 0x0001) ; Index_out (0x22) ; clearscreen ( ) ; Power=l; // switch -NCP5810- power supply on for display } Listing 2 Define frames and fill with colour Parameter_out ( ( int ) ( ( int ) HSA<<8 ) | (int) HEA); //HSA/HEA - here y // for (i=0 ; i<0x500 ; i++) asm ( "\tNOP" ) ; void OLED_RECT (uch HSA, uch HEA, uin VSA, uin VEA, uch r, uch g, uch b) { unsigned long i; ulo X; /*** Set Window address ***/ Index_out (0x3 5) ; //Start point VSA Parameter out (VSA) ; Index_out (0x3 6) ; //Start point VEA Parameter out (VEA) ; Index_out (0x37) ; //Start point VSA /*** Start address set ***/ Index_out (0x20) ; Parameter_out (HSA) ; Index_out (0x21) ; Parameter_out (VSA) ; /*** Index write ***/ Index_out (0x22) ; // for (i=0 ; i<0x500 ; i++) _asm("\tNOP"); f or (x=0 ; x< ( (ulo) VEA- (ulo) VSA+1 ) * (ulo) (HEA HSA+1 ) ; x++ ) { Pixel_out(r, g, b) ; } Index_out (0x00) ; } Listing 3 Operating instructions void Index_out (unsigned char wert) { DB_0UT ; DB=value ; RDB=1; RS = 0 ; NCS_L ; WRB=0 ; WRB = 1 ; NCS_H ; } Listing 4 Display data output void Parameter_out (unsigned int value) { DB_OUT ; RDB=1 ; //high value Byte DB=value>>8 ; RS = 1 ; NCS L; WRB = 0 ; WRB = 1 ; // accept data NCS_H ; //low value Byte DB=wert ; NCS L; WRB=0 ; WRB = 1 ; NCS_H ; } //accept data 70 elektor - 5/2009 Listing 5 DB=g<<2 ; Display pixel output NCS_L ; WRB=0 ; void Pixel out (uch r, uch g, uch b) WRB = 1 ; { NCS_H ; DB_OUT ; RDB=1; DB=b<<2 ; DB=r<<2 ; NCS_L ; RS = 1; WRB=0 ; NCS_L ; WRB = 1 ; WRB=0 ; NCS_H; WRB=1; NCS_H ; } transfer, whereas a Low level indicates an instruction (see Listing 3). This straightforward arrangement lets us transfer control command and parameters to the display. The 16-bit instructions are split into two bytes in the function shown in Listing 4. This function enables data to be trans- ferred to the display. As we are deal- ing with words of 16 bits, the high value byte is sent first and then the low value one. Changing level on pin WRB transfers the data from the dis- play controller. Finally here is the Pixel_out function (Listing 5). Each successive colour is passed to the display, after which the frame is initialised using the OLED_ RECT function. You can extract all other functions from the source code, which can be downloaded from the website under this article reference (www.elektor. com/081029). Listing 6 gives the code you will require finally for creating the rectan- gle and a small logo on the display. The leader photo shows the carrier board with E8a debugger connected and adapter board for the 2.4-inch OLED. The logo on the OLED can be con- verted from a bitmap file into an array file with the aid of some free tools and then included direct into the source code. The sample files can be downloaded from Glyn (www.glyn.de/r32c) as well. You can use either the Renesas development environment or the IAR Embedded Workbench from IAR with this project. ( 081029 - 1 ) Our authors Marc Oliver Reinschmidt is an application engineer at Glyn's head office at Idstein, Ger- many, and has special responsibility for the Ml 6C/R32C microcontroller family. In the fol- lowing articles he will show how the universal application board developed by Elektor for the R32C carrier board can be programmed to act as an oscilloscope. Martin Muller is a Field Application Engi- neer for display products and a specialist in the field of OLED displays. He is based at Glyn's Swiss office in Esslingen. Coming soon Elektor R32C application board with: • 2.4-inch OLED display • SD card reader interface • l 2 C • Slot for LAN module WIZ81 2MJ • 2-channel oscilloscope input • Rotary encoder with switch • 4 LEDs • 4 switches Listing 6 / ************************************************ / /* */ /* FILE : R32C_example . c [R32C_sample . c] */ /* DATE :03.13.2009 */ /* DESCRIPTION :main program file. */ /* CPU GROUP : R32C111 */ /* */ / ************************************************ / #include "sfrlll.h" #include "hwsetup.h" #include "oled28.h" #include "elektor. c" void main (void) { unsigned long i; Conf igureOperatingFrequency ( ) ; for ( i = 1 ; iclOOOO ; i + + ) ; init_S6E63D6_24 0X3 2 0_8Bit_8 0Mode ( ) ; { OLED_RECT (00, 240, 00, 320, 0, 0, Oxf f ) ; //blue rect OLED_RECT (10 0, 190, 50, 270,0, Oxf f , 0 ) ; / /green rect OLED_RECT (110, 180,60,260,0, 0x00, 0) ; //black rect picture (121, 151, 101, 200, elektor); while ( 1 ) ; } 5/2009 - elektor 71 LED DRIVER Fred Splittgerber (Germany) Seemingly straightforward projects can turn into a 'money pit' or 'component graveyard' if you are not careful. This can easily come true if you intend driving colour LEDs in RGB mode with infinitely variable colour mixing and individual control over the brightness of each LED. Conventional control circuitry tends to produce quite bulky systems too. On the other hand, using a microcontroller and a specialised 1C keeps the space footprint under control and eliminates all the uncertainties... Specifications • RGB LED driver module for universal application • Straightforward serial control • Operating voltage from 2.7 V upwards thanks to charge pumps • LED maximum current (total) 40 to 180 mA • 4,096 colours • 16 stages of total brightness • Low-interference operation at constant frequency • Flicker-free illumination thanks to 1 MHz PWM frequency Listing every possible application for infinitely variable control of individ- ual RGB LEDs is an impossible task. What is not in dispute is the fact that the variety of RGB LEDs (one each in red, green and blue on a single car- rier or in a single package) has risen significantly in recent years. Anyone planning to put these colourful semi- conductor light sources to practical use needs to think carefully about the con- trol electronics to be used. RGB control The rules covering LEDs in general apply also to RGB LEDs, the most fun- damental being that LEDs need pow- ering with constant current rather than constant voltage. This is because the threshold voltages of LEDs are strictly temperature-dependent and without constant current, stable operation is impossible. Simple logic indicates that achieving infinitely variable (step- free) current setting requires the use of infinitely variable current sources. If energy saving is important, then the recommended approach is to use switched constant current sources with adjustable duty cycles. An important characteristic of RGB LEDs to note is that as a result of their physical structure, red, green and blue LEDs display differing for- ward voltages, ranging from less than 1.5 V for red LEDs up to nearly 4 V for blue ones. Without some kind of intel- ligent switching arrangement it’s obvi- ous that significant energy losses will arise if your driver circuitry provides the same voltage for R, G and B LEDs (which will be far too high for the red ones). Pulse-width modulated current sources are totally unsuitable, espe- cially in battery powered applica- tions. But before you bash your brains in looking for suitable solutions based on switching regulators, take it easy. Industry has already come up with a solution for this problem and embed- ded it in silicon. AAT3129 As well as its switching regulators and other power supply ICs, the firm 72 elektor - 5/2009 +u B Figure 1. Block diagram of an RGB LED driver using the AAT3129. +5V Figure 2. Control diagram with microcontroller and connector for the breakout board. Analogic Tech has lately brought out a whole range of chips intended to simplify the operation of all manner of LEDs. And with the IC AAT3129 [1] every control problem that might occur with RGB LEDs has been eliminated with a single chip. The IC has a serial digital control input and integrated charge pumps with fac- tors of 1, 1.5 and 2, enabling it to oper- ate with supply voltages from 2.7 V to 5.5 V. Among other features are built-in logic for avoiding thermal overload and — important for battery operation — a standby mode with current consump- tion typically less than 0.1 pA. In oper- ation the IC draws around 1 mA. Maxi- mum current for the LEDs — shared across all three LEDs — can amount to 180 mA. LED brightness is set indi- vidually in 16 logarithmic stages each, producing in total 2 4 x3 = 4,096 differ- ent colours. On top of this there are 16 steps of overall brilliance. The IC operates at a clock rate of 1 MHz and with 12 pins and dimen- sions of just 2.4 X 3.0 X 1 mm it is extremely compact. The only external components required are four small 1 pF ceramic capacitors. A functional diagram is given in Figure 1. All we need to complete the circuit is a small microcontroller to provide the AAT3129 with data. AS 2 Cwire Data for the AAT3129 is presented in the Simple Serial Control (S 2 C) pro- tocol, AS 2 Cwire [2], The S 2 Cwire™ single-wire interface offers a very straightforward control technique for programmable power IC devices, using just a single wire. Data is trans- mitted as a series of negative-going pulses having a length of between 50 ns and 75 /is. Between pulses the level remains High for up to 500 ps. Greater values are treated as separ- ator signals between pulse trains (see data sheet [1]). Sequences with 16 to 21 pulses are interpreted as addresses for the registers R, G, B, T (total inten- sity) and M (operational mode) (see Table 1). The sequence that follows afterwards with 1 to 16 pulses is the actual data. To summarise, the address follows a High level of >500 ps, after which comes the data to be transmitted. Whether a value is to be executed straightaway or synchronised only once all the colour values have been defined, depends on the value placed in the M register. Control driver In order that we can select the colours and the overall brightness easily with rotary or slider pots, we need to use another small microcontroller with a built-in multi-channel A/D converter. This transforms the analogue potenti- ometer values into corresponding dig- ital values, converts them and passes Table 1 Register Address Range of values Meaning R (Intensity, red) 17 1-16 1: unlit 16: maximum brightness G (Intensity, green) 18 1-16 B (Intensity, blue) 19 1-16 T (Overall intensity) 20 1-16 1 : maximum brightness 1 6: darkest state M (Operating mode) 21 1-2 1 : Value is converted immediately 2: Value is converted after writing to the T registers 5/2009 - elektor 73 LED DRIVER 080178 - 13 Figure 3. The circuit of the breakout board consists of just the AAT31 29, four capacitors and an RGB LED if required. the result to the driver IC. The small 8-pin ATtiny controllers from Atmel make this task a breeze. Four pins are configured as analogue inputs for R, G, B and T, whilst a changeover switch defines the operating mode. Apart from the two pins for +UB and ground, just one pin remains, the serial output that controls the AAT3129 chip. The software for the chosen microcontrol- ler type, ATtiny 25, is covered here in a separate inset. Control circuitry The control circuitry can be seen in Figure 2 and described in very few words. Apart from a 5-V voltage reg- ulator this comprises a microcontrol- ler, four 100-kQ pots, a switch (operat- ing with a pull-up resistor integrated in IC2), an IC socket for connecting a breakout board and finally another RGB LED if required. The breakout board is a small plug-in board equipped with the AAT3129 chip and the four capaci- tors mentioned previously. The circuit is so simple that you can build it on a scrap of perfboard with- out difficulty. As not everybody feels comfortable with soldering the ‘fine- pitch’ arrangement of the pins of the AAT3129, the author hit on the idea of laying out the breakout board men- tioned for the AAT3129 complete with the capacitors (and optionally an RGB LED in PLCC4 form factor) to enable it to be plugged simply into a DIL IC Figure 5. With the ATtiny it is vital to get the fuse settings correct, as this screenshot illustrates. socket or a breadboard device or else soldered onto some 2.54 mm (.1 inch) pitch Veroboard or perfboard. The cir- cuit of this breakout board is shown in Figure 3. You can download the lay- out files for this tiny board in KiCAD and Gerber format at the web page for this article on the Elektor web- site. This mini PCB does not have to be used exclusively with the microcon- troller recommended here and can also be integrated into other circuits with- out difficulty. Figure 4 shows a hook- up corresponding to the circuit in Fig- ure 2 in which this little PCB is placed onto perfboard along with an ATtiny25 in a DIL package. Last but not least The use of a 78L05 (IC1) means the whole circuit can be powered using any direct voltage between 7.5 and 10 V. On account of the broad supply Figure 4. The author's trial set-up looks like this, with the breakout board and microcontroller built on a piece of perfboard. 74 elektor - 5/2009 Software There are two important things to note in this software written in C. Firstly, the reset pin of the ATtiny25 is used as an input pin, meaning that the fuse value RSTDISBL (see Figure 5) must be defined. Once this has been done, no further SPI programming is possible. Special care is vital, as your nice new controller will turn out useless if it contains any software errors Secondly, during colour changes the software optimises the display of uncommon greyscale hues during the transformation of one colour to another. Colour saturation is calculated ac- cording to the HSV colour model [3] and the transition between colours of low saturation is accelerated. The serial control signal for the AAT31 29 is generated using the following function: void tx_pulses (uint8_t n) { for (i=n; i>0 ; i--) { P I N_AAT = 1 < < AAT_B I T ; P I N_AAT = 1 < < AAT_B I T ; } } This generates 'n' pulses on Bit 'AAT_BIT' of output 'PORT_AAT'. This connection needs to present a 'high' level whenever no data is being transmitted. Here is the initialisation of the Port of the ATtiny25: #def ine PIN_AAT PINB #def ine AAT_B I T PBO #def ine PORT_AAT PORTB #def ine DDR_AAT DDRB PORT_AAT | =1< //... #def ine CHANNEL_RED 17 //... tx_pulses ( CHANNEL_RED) ; / / CHANNEL_RED pulse select RED register _delay_ms (0.5) ; tx_pulses ( 10 ) ; // Data RED register (brightness 10 from 1-16) _delay_ms (0.5) ; If the GCC compiler [4] is used the optimisation option '-02' must be used. About the author Fred Splittgerber has been involved with hardware-specific programming continu- ally since the first 8-bit CPUs appeared. He works as a technical author and translator. voltage range of the AAT3129 and ATtiny25 chips, you could also use a 3.3-V voltage regulator — or even omit the voltage regulator altogether and power the rest of the electronics direct from a stabilised 3.3 V supply. In this case the fuse for the brown-out detec- tor needs to be matched correctly. On the breakout board we have pro- vided a socket for connecting an RGB LED as well as room for soldering a PLCC4 RGB LED direct. However, you should never connect two LEDs in par- allel, as otherwise the necessary cur- rent splitting will not be achieved. If the switch connected to port B1 is closed, then you will activate the col- our transformation mode preset in the firmware, in which the overall bright- ness is set by variable resistor P4. When the switch is open circuit the RGB LED illuminates with constant brightness with the colours set with pots PI to P3. Source code of some sample firmware for the ATtiny25 is available for down- loading free of charge from the Elektor web page [5] (see also the inset ‘Software’). ( 080178 - 1 ) Internet Links and Literature [1] AAT3129 Data Sheet: www.analogictech.com/products/digitalfiles/ AAT3129.pdf [2] AS2Cwire application notes: www.analogictech.com/resources/applicati- ons/appnotes/ANl 1 0_S2Cwire_TLAT.pdf [3] HSV Colour Space and Colour Space Conversion: http://en.wikipedia.org/wiki/HSV_color_space http://www.cambridgeincolour.com/tutorials/ color-space-conversion.htm [4] GCC Compiler for AVR: http://winavr.sourceforge.net [5] www.elektor.com/0801 78 5/2009 - elektor 75 INFOTAINMENT PUZZLE Puzzle with an electronics touch Sure, we've seen Sudoku puzzles that can be solved online and yes there are many nifty programs around to crack these brain teasers but Elektor's Hexadoku should remain a pencil-paper-brain exercise. Do participate! All correct solutions we receive enter a prize draw for an E-blocks Starter Kit Professional and three Elektor Shop vouchers. The instructions for this puzzle are straightforward. In the diagram composed of 1 6 x 16 boxes, enter numbers such that all hexadecimal numbers 0 through F (that's 0-9 and A-F) occur once only in each row, once in each column and in each of the 4x4 boxes (marked by the thicker black lines). A number of clues are given in the puzzle and these determine the start situation. 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 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. PARTICIPATE! Please send your solution (the numbers in the grey boxes) by email to: hexadoku@elektor.com - Subject: hexadoku 05-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 June 2009. PRIZE WINNERS The solution of the March 2009 Hexadoku is: 813D2. The E-blocks Starter Kit Professional goes to: J.C. Launay (France). An Elektor SHOP voucher worth £40.00 goes to: Jurgen Ackelbein (Germany); Eloi Dranka Jr (Brazil); Doug Blansit (USA). Congratulations everybody! 6 0 7 2 3 A C 9 F C 9 8 B 0 4 5 A 2 6 E A 3 E 7 6 4 B 4 E A 6 D C 9 8 3 0 5 4 0 7 2 3 1 8 F C 6 3 A 0 5 9 D 6 B C 9 4 1 F 7 D 3 1 3 A B D 6 C E 9 E B 4 1 F 0 3 A 1 C D 7 E 8 2 0 C E 6 9 2 4 8 F 9 8 3 D 9 E C 6 B A F 3 4 5 3 9 0 E 1 D 9 0 7 3 5 4 B 8 B A 6 F 4 (c) PZZL.com 2 6 8 3 D C B 9 1 7 E 5 4 A 0 F C 4 B 1 7 5 A F 0 6 D 2 9 E 8 3 F E A 0 1 6 8 2 3 9 4 B 5 C D 7 7 D 9 5 E 4 3 0 A 8 C F 2 1 6 B B 9 F 6 A D 2 7 8 4 0 E 1 3 5 C 0 5 7 C 8 F 6 4 2 1 A 3 D B 9 E 4 3 E 2 0 9 C 1 7 5 B D 8 6 F A 1 8 D A B 3 5 E F C 9 6 0 7 4 2 5 7 2 8 F 0 E 6 B A 3 4 C 9 1 D 3 1 C D 4 A 7 5 E 0 6 9 B F 2 8 9 F 0 B C 8 1 3 D 2 5 7 E 4 A 6 E A 6 4 2 B 9 D C F 8 1 3 0 7 5 A C 1 F 5 7 0 B 4 E 2 8 6 D 3 9 8 B 5 E 9 1 D A 6 3 7 0 F 2 C 4 6 2 4 7 3 E F 8 9 D 1 C A 5 B 0 D 0 3 9 6 2 4 C 5 B F A 7 8 E 1 76 elektor - 5/2009 RETRONICS INFOTAINMENT Elektor Mini Crescendo (1984) Eric Bogers (The Netherlands) 'With a good ampli- fier, all you hear is the music/ cuit board, construction did not present any insurmountable problems, but there were two aspects of the project that I will never forget. The first was fitting the output transistors, which was rather dif- ficult. The circuit board of the final amplifier was attached to a generously sized heat sink by an aluminium angle and a few screws, and the transistors were bolted to the aluminium angle with their leads passing through carefully drilled openings in the aluminium to the holes in the PCB. As the transistors had to be electrically isolated from the alu- minium but at the same time fit- ted to it with the lowest possible thermal resistance, it took a few hours to get this job right. The second aspect was the power supply. When the time came for final assembly, it was naturally the first part of the amplifier to be fitted in the enclosure and tested. After carefully check- ing the wiring, I switched on the power, which fortunately did not result in any explosions or clouds In December 1 982, Elektor surprised the world with a top-class MOSFET final amplifier boasting a hefty output power: the Crescendo. With a rated power of 180 watts into 4 ohms and a harmonic distor- tion level that remained well below 0.01% over the frequency range of 20 Hz to 20 kHz, it was a design that could please even the most pampered ear. However, such a combination of quality and power did not come cheap. With four MOSFETs per channel (the famous Hitachi 2SK135 and 2SJ50) and with each channel powered by a sep- arate DC supply with a heavy- duty (and correspondingly heavy) toroidal transformer and several 'fat' electrolytic filter capacitors, it added up to a tidy sum. A complete Crescendo would eas- ily cost upwards of 250 pounds or the equivalent in dollars at the time. As a result, there was a flood of requests for a design with simi- lar features but a more modest price. They found a ready ear, and in May 1 984 Elektor proudly presented the 'baby brother' of the Crescendo: the Mini-Cre- scendo - although here 'mini' is only relative, since two chan- nels rated at 70 watts each into 4 ohms is still more than enough to let you neighbours share in your musical pleasure. With 'only' two power MOSFETS per channel, a single power transformer, and somewhat smaller and less expensive elec- trolytic capacitors, this version was within my budget. I pur- chased the components in early 1 987, and it was all put together a few weeks later. Thanks to the carefully designed printed cir- of smoke, and meas- ured the output voltage. The no-load voltage was approximately ±65 V — exactly as specified. However, I forgot to con- nect a bleeder resistor across the capacitors to discharge them after the power was switched off, probably because my thoughts were already on a well-deserved beer. When I resumed work on the amplifier the next evening, I received a rather strong shock (something that has probably happened to every electronics hobby- ist at some time). Obvi- ously the capacitors did a damned good job of holding their charge. I built my Mini-Crescendo, com- plete with the combined switch- on delay and DC protection circuit described in the Janu- ary 1983 issue of Elektor, into a sturdy 19-inch rack. During the course of 1 987, I augmented my sound system with the Preamp described in the December 1986 and January 1987 issues (prob- ably the best high-end preampli- fier ever to leave the Elektor labs) and the unsurpassed class-A headphone amplifier described in the February 1983 issue. Now, twenty-five years after the publication of the original design and twenty-two years after I assembled the various compo- nents, this system (along with two Magnat Viva loudspeakers, an excellent CD player, and an outstanding turntable) is still in service. After all these years, I still take considerable pleasure in reading Elektor, and I still lis- ten to music from my Mini-Cre- scendo every day. Incidentally, the SKI 35 and SJ50 output transistors were discontin- ued many years ago, but the UK mail-order company LittleDiode (www.littlediode.com) apparently still has a good stock on hand. That's a comforting thought. ( 081096 - 1 ) 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 5/2009 - elektor 77 ELEKTOR SHOWCASE To book your showcase space contact Huson International Media Tel. 0044 (0) 1932 56 Fax 0044 (0) 1 932 564998 AVIT RESEARCH www.avitresearch.co.uk USB has never been so simple... with our USB to Microcontroller Interface cable. Appears just like a serial port to both PC and Microcontroller, for really easy USB connection to your projects, or replacement of existing RS232 interfaces. See our webpage for more details. From £10.00. BETA LAYOUT www.pcb-pool.com Beta layout Ltd Award - winning site in both English and German offers prototype PCBs at a fraction of the cost of the usual manufacturer’s prices. EASYDAQ ■ U'fAV". IHJUV www.easydaq.biz L — • USB powered, 4 relays + 4 DIO channels • Will switch 240VAC @ 10 amps • Screw terminal access • LabVIEW, VB, VC • Free shipping • From £38 Design & supply of USB, USB Wireless, Ethernet & Serial, DAQ, Relay & DIO card products. info@easydaq.biz EASYSYNC y*'- 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. 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 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 ByVac www.byvac.com • USB to I2C • Microcontrollers • Forth • Serial Devices C S TECHNOLOGY LTD www.cstechnology.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 (AV, 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 ELNEC www.elnec.com • device programmer manufacturer • selling through contracted distributors all over the wc • 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 ffpriAf FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk • Training and Consulting for IT, Embedded and Real Time Systems • Assembler, C, C++ (all levels) • 8, 16 and 32 bit microcontrollers • Microchip, ARM, Renesas,TI, Freescale • CMX, uCOSII, FreeRTOS, Linux operating systems • Ethernet, CAN, USB, TCP/IP, Zigbee, Bluetooth programming 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 lit 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 - 5/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 W»' 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! _ 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 5/2009 - elektor 79 BOOKS, CD-ROMs, DVDs, KITS & MODULES of electronics Completely updated Elektor's Components Database 5 The program package consists of eight databanks covering ICs, transistors, diodes and optocou- plers. A further eleven applications cover the calculation of, for example, zener diode series resistors, voltage regulators, voltage dividers and AMV's. A colour band decoder is included for determining resistor and inductor values. Each databank contains the following on (almost) any component: enclosure drawing, pin connections, technical data (as far as known). Also included is a search en- gine acting on user supplied parameters. The ECD gives you easy access to design data for over 5,400 ICs, more than 35,800 transistors, FETs, thyristors and triacs, just under 25,000 diodes and 1 ,800 optocouplers. All databank applications are fully interactive, allowing the user to add, edit and complete component data. This CD-ROM is a must-have for all electronics enthusiasts! 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-5381 -225-9 • £14.50 • US$29.00 Embedded USB Know How USB Toolbox This CD-ROM contains technical data about the USB interface. It also includes a large collection of data sheets for specific USB components from a wide range of manufacturers. There are two ways to in- corporate a USB interface in a microcon- troller circuit: add a USB controller to an existing circuit, or use a microcontroller with an integrated USB interface. Both options are available on this CD-ROM. Included on this CD-ROM areUSB Basic Facts, several useful design tools for hard- ware and software, and all Elektor articles on the subject of USB. ISBN 978-90-5381-159-7 • £24.90 • US$39.50 ISBN 978-90-5381-212-9 • £19.90 • US$39.00 v w \ j Prices and item descriptions subject to change. E. & O.E 80 elektor - 5/2009 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,1 00 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. ISBN 978-90-5381 -235-8 • £17.50 • US$35.00 EMBEDDED LINUX eaUTROL CENTRE « n i SHE ■\ 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 $42.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 Bring your microcontroller to life Artificial Intelligence 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 micro- controller, and howto make the network self-learning. Or discover how you can breed robots, and how changing a fitness function results in a totally different behav- ior. Several artificial intelligence techniques are discussed: expert system, neural net- work, subsumption, emerging behavior, genetic algorithm, cellular automata, rou- lette brains etc. 256 pages • ISBN 978-0-905705-77-4 £32.00 • US $46.00 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 $52.00 5/2009 - elektor 81 Books BOOKS, CD-ROMs, DVDs, KITS & MODULES Learn by doing C Programming for Embedded Microcontrollers If you would like to learn the C Program- ming language to program microcontrol- lers, 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 program 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 down- loaded from the Internet. 324 pages • ISBN 978-0-905705-80-4 £32.50 • US $52.00 Connect your mouse into new embedded applications Mouse Interfacing This book describes in-depth how to con- nect the mouse into new embedded appli- cations. It details the two main interface methods, PS/2 and USB, and offers appli- cations guidance with hardware and soft- ware examples plus tips on interfacing the mouse to typical microcontrollers. A wide range of topics is explored, including USB descriptors, a four-channel, millivolt-preci- sion voltage reference all with fully docu- mented source-code. 256 pages • ISBN 978-0-905705-74-3 £26.50 • US $53.00 / Prices and item descriptions subject to change. E. & O.E Automotive CAN controller (April 2009) Since cars contain an ever increasing amount of electronics, students learning about motor vehicle technology also need to know more about electronics and mi- crocontrollers. In collaboration with the Timloto o.s. Foundation in the Nether- lands, Elektor designed a special control- ler PCB, which will be used in schools in several countries for teaching students about 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. Kit of parts, incl. PCB with SMDs prefitted M16C TinyBrick (March 2009) 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. 080671-91 • £52.00 • US $79.00 The 32-bit Machine (April 2009) With this attractively priced starter kit you get everything you need for your first hands- on experiments with the new R32C/ 1 1 1 32-bit microcontroller. The power sup- ply is drawn from your computer via the USB connection, which simplifies things rather nicely. The starter kit consists of an R32C carrier board (a microcontroller module equipped with the R32C/1 1 1 chip) and a software CD-ROM containing the necessary development tools. As with the earlier R8C/1 3 'Tom Thumb' project in Elektor Electronics (November 2005 through March 2006), the R32C carrier board is an in-house-development of Glyn, an authorised distributor for Renesas in Germany. Art-Nr. 080719-91 • £54.00 • US$87.50 LED Top with Special Effects (December 2008) If you fit a line of LEDs on a circular PCB and power them on continuously, they generate rings of light when the board is spun. If you add a microcontroller, you can use the same set of LEDs to obtain a more interesting effect by generating a 'virtual' text display. The article also de- scribes a simple technique for using the Earth's magnetic field to generate a syn- chronisation pulse. The potential appli- cations extend from rotation counters to an electronic compass. R32C/1 1 1 Starterkit (32-bit-Controller- board & CD-ROM) Art-Nr. 080928-91 • £27.00 • US $42.50 Kit of parts incl. SMD-stuffed PCB and programmed controller Art-Nr. 080678-71 • £42.00 • US $59.00 82 elektor - 5/2009 its & Modules ■\ May 2009 (No. 389) £ US $ Experimenting with the MSP430 080558-91 .... PCB, populated and tested 35.00 55.00 080558-92 ....Tl eZ430-F2013 Evaluation Kit see www.elektor.com RGB LED Driver 080178-41 ....Programmed controller 8.90 13.75 April 2009 (No. 388) The 32-bit IVlachine 080928-91 .... R32C/1 1 1 Starterkit (32-bit-Controllerboard & CD-ROM) 27.00 42.50 Automotive CAN Controller 080671 -91 .... Kit of parts, ind. PCB with SMDs prefitted 52.00 79.00 Automatic Running-in Bench 080253-71 .... Kit of parts incl. PCB-1 with SMDs prefitted 1 85.00 270.00 090146-91 ....ARMee plug-in board mk. II 50.00 74.00 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 1 5.80 080647-2 Printed circuit board : Receiver 7.90 1 5.80 LED Top with Special Effects 080678-71 .... Kit of parts incl. SMD-stuffed PCB and programmed controller 42.00 59.00 November 2008 (No. 383) Motorised Volume Pot 071135-41 ....Programmed controller ATMEGA8-16PU 5.90 11.80 Speed Camera Warning Device 08061 5-1 Printed circuit board 15.50 31 .00 08061 5-41 .... Programmed controller PIC1 6F876A-I/SO 1 1 .80 23.60 Remote Control by Mobile Phone 080324-1 Printed circuit board 1 7.80 35.60 080324-41 ....Programmed controller ATMEGA8-16PU 5.90 11.80 080324-71 ....Kit of parts 54.00 99.00 Bestsellers i C Programming for Embedded Microcontrollers ISBN 978-0-905705-80-4 £32.50. US $52.00 o od Microcontroller Systems Engineering ISBN 978-0-905705-75-0 £29.00. US $52.00 Mouse Interfacing ISBN 978-0-905705-74-3 E26.50.....US $53.00 Artificial Intelligence ISBN 978-0-905705-77-4 £32.00. US $46.00 PIC Microcontrollers ISBN 978-0-905705-70-5 E27.95.....US $52.00 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 FPGA Course ISBN 978-90-5381-225-9 £14.50. US $29.00 USB Toolbox ISBN 978-90-5381-212-9 £19.90. US $39.00 O rnet Toolbox ISBN 978-90-5381-214-3 £19.50. US $39.00 LED Top with Special Effects Art. # 080678-71 £42.00.... US $59.00 The 32-bit Machine Art. # 080928-91 £27.00 .....US $42.50 Transistor Curve Tracer Art. # 080068-91 £55.00 .....US $82.50 Evaluation Kit CapSense Buttons Art. # 080875-91 E27.50.....US $39.95 M16C TinyBrick Art. # 08071 9-91 £54.00.... US $87.50 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 lektor SHOP 5/2009 - elektor 83 INFO & MARKET COMING ATTRACTIONS NEXT MONTH IN ELEKTOR Campground Current Regulator Mains receptacles in campgrounds can usually supply only a limited current. If you draw too much current, a circuit breaker trips, and it has to be reset by the campground manager. You have to pay for this (a sort of fine). To avoid this problem, the Elektor labs have developed a special current regulator that ensures that the amount of current actually drawn is limited to a present value. The regulator circuit is built around an Atmel U2008B. This 8-pin phase-control regu- lator needs only a few external components, and it senses the load current internally. I Battery Monitor This device was originally developed to monitor the charge state of batteries used with a solar panel, but it can also be used with other types of rechargeable batteries. The circuit measures the charge and discharge current, nominal voltage, momentary capacity, and the energy supplied or accumulated by a battery. The battery monitor is built around an LPC21 03 microcontroller, which can be programmed via a serial inter- face. A 22-bit A/D converter provides very accurate current and voltage measurements. The measurement data is shown on a two-line LCD. Portable Solar Panels If you like to spend a few days out of doors with a rucksack or a bike, you often discover that the batteries of your electronic travelling companions such as your mobile phone or GPS receiver, or even your pocket light, are empty just when you need them. And of course, there's no mains receptacle in sight. Fortunately, portable solar panels are available nowadays in various sorts and sizes, and you can use them to recharge a couple of batteries or your mobile phone. In next month's issue, we examine several of these modules and test their effectiveness. * Note: we regret that " True RMS Voltmeter with Frequency meter and "Mini PWM Audio Amplifier" could not be accommodated in the April 2009 issue as planned. Article titles and magazine contents subject to change, please check 'Magazine' on www.elektor.com The June 2009 issue comes on sale on Thursday 21 May 2009 (UK distribution only). UK mainland subscribers will receive the issue between 1 6 and 1 9 May 2009. w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektorj Elektor on 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. 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 lektor c-lc-c^rcmics worldwide Homo Nows Kapnzinn ■ r;| ECTROMC t Du sign your awn btxpofen enclosure fihnp Sutincnfar now Forum — CFggjc an epiien Arl£d*t v form a live v p *|KS wifohd flealliire clack aKilateruses QhUEME l i dl w i njy Miniature inductn* cnc«>*' irwies Cvrnjill* UttHU r*>iO tank IG-b: D3Ci target Minor oon*rriion ji;jp! millin'*. ** N+w* factf* I® Pradudi v ClnoLi jf eo-zcvo-ft+iYi* k nnrf.,ir-t V f-tiwn vKh «* C.rnrWWrc ■tt CdiVt w i ieuioi Oku* ** iulJ«ripll$n!L SMf’Ovwn Hulll-^uipa^c find indn[irnvitir !n prclesdiDnal and drAhusiaMJ formula Flamnd* Huflov I S l ihi ;ii ays .vim-.: r- tr loherl ucht (bid, CD RQMJ Mnir |@ Spub-acrib-ar* a-rify l' S Dm muni nrd Irrr I'M' an Ihr nt# C Pragfarr*mrtg tnsipkP |C i-wauarrAMMiNa Hnrr (tj- BruTirk p Dr-i.yi Enyinrrr Prnfi I Hilling mjKhinn Fm m .a kil A ■Eriki ng gadget Spin (hf Lf D log Ip Av progromnirti Eral ' 1 Eloktar ■ Technical Auttwra/Desrgncrs- ■ Your nrnwet in tiektor'-c Cnifir ft* E-'nail address.; B 84 elektor - 5/2009 f Description Price each Qty. Total Order Code DVD i-TRIXX Freeware Collection 2009 rM jffl £27 - 50 CD-ROM ECD 5 SrtTTl£24.90 C Programming *■*- for Embedded Microcontrollers r*\4Ti £32 - 50 Artificial Intelligence TT\dJfl £32 -°° Mouse Interfacing £26.50 Microcontroller Systems Engineering £29.oo DVD Elektor 2008 £17.50 Free Elektor Catalogue 2009 Sub-total Prices and item descriptions subject to change. The publishers reserve the right to change prices P&P without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Total paid Name Address + Post code Tel. Email Date - - Signature EL05 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. Email Date - - Signature EL05 METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer j Cheque (UK-resident customers ONLY) □ Giro transfer □ T55T □ 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 ( C Programming for Embedded Microcontrollers Learn by doing 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 microcontrollers. 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 program 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 micro- controllers from Atmel, the C programming language applies 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! ijlektor ISHOP 324 pages • ISBN 978-0-905705-80-4 £32.50 • US $52.00 Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 V J Further information and ordering at www.elektor.com/books Index of Advertisers Avit Research, Showcase www.avitresearch.co.uk 78 Beijing Draco www.ezpcb.com 3 Beta Layout, Showcase www.pcb-pool.com 13, 78 ByVac, Showcase www.byvac.com 78 C S Technology Ltd, Showcase www.cstechnology.co.uk 78 Decibit Co. Ltd, Showcase www.decibit.com 78 Designer Systems, Showcase www.designersystems.co.uk 78 EasyDAQ, Showcase www.easydag.biz 78 Easysync, Showcase www.easysync.co.uk. 78 Elnec, Showcase www.elnec.com 78 Eurocircuits www.eurocircuits.com 47 First Technology Transfer Ltd, Showcase . . www.ftt.co.uk 78 FlexiPanel Ltd, Showcase www.flexipanel.com 78 Future Technology Devices, Showcase. . . . www.ftdichip.com 78 General Circuits www.pcbcart.com 3 FlexWax Ltd, Showcase www.hexwax.com 78 Labcenter www.labcenter.com. 88 Lcdmod Kit, Showcase www.lcdmodkit.com 78 London Electronics College, Showcase . . . www.lec.org.uk 78 MikroElektronika www.mikroe.com 16, 17 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.mgp.com 78 www. cananalyser. co.uk 79 www.newburyelectronics.co.uk 47 www.xgamestation.com 47 www.parallax.com 31 www.peakelec.co.uk 13 www.picotech.com 11 www.guasarelectronics.com 2 www.robot-electronics.co.uk 79 www.robotiq.co.uk 79 www.obd2cables.com, www.scantool.net .... 79 78, 79 www.usb-instruments.com 79 www.virtins.com 79 Advertising space for the issue of 25 June 2009 may be reserved not later than 26 May 2009 with Huson International Media- Cambridge Flouse- Gogmore Lane- Chertsey, Surrey KT 1 6 9AP- England - Telephone 01 932 564999 - Fax 01932 564998 - e-mail: p.brady@husonmedia.com to whom all correspondence, copy instructions and artwork should be addressed. 5/2009 - elektor 87 Powerful EDA §oftware at Affordable Prices PROTEUS DESIGN SUITE ■ 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 5uite now include a world class fully integrated shape based autorouter at no additional cost - prices start from just £150 exc. VAT & delivery www.labcenter.com 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