SPYDER & CODEWARRIOR GATEWAY TO FREESCALE MICROS MOBILE PHONE LCD FOR PC SCALE DEPOSIT FIGHTER ZIGBEE TRANSCEIVER 18 function generators i *T|" ^ r ‘ 3-360 , 444 R13 03 9 770268 451128 " throuy" Y^rfour 410+5 REE c0pV 0 nto our *e bsl ,a\°9' !°Scavcotu/ cata '° 9 „ ■£ ^es ««***- POST AND PACKING CHARGES: Order Value Cost Order Value Cos £20 - £49.99 £5 £200 - £499.99 £30 £50 - £99.99 £10 £500+ £40 £100 -£199.99 £20 Max weight 121b (5kg). Heavier parcels POA. Minimum order £20. Note: Products are dispatched from Australia, local customs duty and taxes may apply. ■ Powertool Battery x \ 1 'u ses J Charger Controller \cTJr tin9 KC-5436 £11.75 + post & packing Cordless drills are fantastic & cheap but, the batteries in them don't last with the simple charger supplied. This controller turns the cheap charger into a contractor grade intelligent charger. It incorporates charge timeout, min and max temperature monitoring, i~ Delta charge detection, / B power and charge LED "" ^ indicator, adjustable Delta V, temperature f m settings, and optional adjustable trickle charge. Suits both Ni-Cd _ and Ni-MH cells. Kit includes PCB ^"'^5-^./ with overlay, case, all electronic components and clear English instructions. Two-Way SPDIF/Toslink Digital Audio Converter Kit KC-5425 £7.25 + post and packing This kit converts coaxial digital audio signals into optical or vice-versa. Use this bit stream converter in situations where one piece of equipment has an optical audio input and the other a coaxial digital output. Kit includes Toslink optical modules, PCB with overlay, case with screen printed lid, all electronic components and I clear English instructions. Requires 9-12VDC wall adapter (Maplin #UG01 B £13.99) 1 Starship Enterprise™ Door Sound Simulator KC-5423 £11.75 + post & packing This easy-to-build kit emulates the unique noise made when the cabin doors on the Starship EnterpriseTM open and close. The sound emulator can be triggered by switch contacts (normally open), which means you can use a reed magnet switch, IR beam or PIR detector. Kit includes a machined, silkscreened and pre-l drilled case, speaker and all electronics components with \^- clear English instructions. Requires 9-12VDC 7 wall adapter 1— \ (Maplin #UG01B £13.99) I M I Speedo Corrector Mkll ypr KC-5435 £14.50 + post & packing When you modify your gearbox, diff ratio or change to a large circumference tyre, it may result in an inaccurate speedometer. This kit alters the speedometer signal up or down from 0% to 99% of the original signal. With this improved model, the input set-up selection can be automatically selected and it also features an LED indicator to show when the input signal is being received. Kit ^ supplied with PCB with overlay and all electronic # '• 4, . ■ % components with 4 clear English j g* instructions. Radar Speed Gun KC-5429 £29.00 + post & packing Mk jMm This Doppler radar gun reads speed (jLkSjW in km/h or mph up to 250 km/h or 155 mph. It has a resolution of 1 km/h or 1 mph with an accuracy of 1 %, and also has a hold switch so you can freeze the reading. There's a jiffy box to mount the electronics in, and the enclosure J for the radar gun assembly is made from 2 x coffee tins or / _ similar. Details included. Kit J includes PCB and all specified / components with clear / English instructions. / • Requires 12VDC power. M Magnetic Cartridge Pre-amp Am KC-5433 £11.75 + post & packing This kit is used to amplify the 3-4mV signals from a phono cartridge to line level, so you can use your turntable with the CD or tuner inputs on your Hi-Fi amplifier. The design is suitable for 12" LPs, and also allows for RIAA equalisation of all the really old 78s. Please note that the input sensitivity of this design means it's only suitable for moving-magnet, not moving-coil cartridges. Kit 1 * includes PCB with overlay and all electronic I * » (j components. • Requires 12VAC 0 power Ku c °nfus e I Theremin Synthesizer MKII KC-5426 £43.50 + post & packing V Model By moving your hand between the metal \ N > antennae, create unusual sound effects! The Theremin Mkll improves on its predecessor by allowing adjustments to the tonal quality by providing a better waveform. With a multitude of controls, this instrument's musical potential is only limited by the skill and imagination of its player. Kit includes stand, PCB with overlay, machined case with silkscreen printed lid, loudspeaker, pitch antennae, all specified electronic components and clear English instructions. DC Relay Switch KC-5434 £4.50 + post & packing An extremely useful and versatile kit that ( enables you to use a tiny trigger current - as low as 400pA at 12V to switch up to 30A at 50VDC. It has an isolated input, and is suitable for a variety of triggering options. The kit includes PCB with overlay and all electronic -l V components with , Jk J clear English v instructions. M 1 " I Requires 9-12VDC wall adapter (Maplin #UG01B £13.99) All prices M in £ Stg __T * 1 Free 410+ page Catalogue. Log on to www.jaycarelectronics.co.uk/elektor for your FREE catalogue! 0800 032 7241 M (Monday - Friday 09.00 to 17.30 GMT + 10 hours only). For those who want to write: 100 Silverwater Rd Silverwater NSW 2128 Sydney AUSTRALIA ' „ — J w 3 1- , .-jLi w _ J'ibX ■ Digital Storage Oscilloscope Up to 4 analog channels using industry standard probes or POD connected analog inputs. Mixed Signal Oscilloscope Capture and display up to 4 analog and 8 logic channels with sophisticated cross-triggers. Spectrum Analyzer Integrated real-time spectrum analyzer for each analog channel with concurrent waveform display. Logic Analyzer 8 logic, External Trigger and special purpose inputs to capture digital signals down to 25nS. Data Recorder Record anything DSO can capture. Supports live data replay and display export. Networking Flexible network connectivity supporting multi-scope operation, remote monitoring and data acquisition. Data Export Export data with DSO using portable CSV files or use libraries to build custom BitScope solutions. www .bitscope . com DSO Test Instrument Software for BitScope Mixed Signal Oscilloscopes 4 Channel BitScope BitScope DSO Software for Windows and Linux BitScope DSO is fast and intuitive multi-channel test and measurement software for your PC or notebook. Whether it's a digital scope, spectrum analyzer, mixed signal scope, logic analyzer, waveform generator or data recorder, BitScope DSO supports them all. Capture deep buffer one-shots or display waveforms live just like an analog scope. Comprehensive test instrument integration means you can view the same data in different ways simultaneously at the click of a button. DSO may even be used stand-alone to share data with colleagues, students or customers. Waveforms may be exported as portable image files or live captures replayed on other PCs as if a BitScope was locally connected. BitScope DSO supports all current BitScope models, auto-configures when it connects and can manage multiple BitScopes concurrently. No manual setup is normally required. Data export is available for use with third party software tools and BitScope's networked data acquisition capabilities are fully supported. 2 Channel BitScope Pocket Analyzer B if Scope PC Oscilloscopes <& Analyzers Microcontrollers all over the place When browsing this month's issue you will have a hard time finding editorial pages not covering microcontrollers in one way or another. Its intentional. A quick look at my pagination map for this month (an A3 sheet showing 88 rectangles with article titles and production numbers pencilled in and more rubbed out) tells me that Making Waves (page 20) and Scale Deposit Fighter (page 70) are the only articles not directly linked to the wonders of the modern microcontroller. Even Retronics covers a micro - and a famous one it still is. Hexadoku, we are told, can be solved with an ARM microcontrol- ler doing all the hard thinking - no, I cannot tell you where the program may be found. But then, I suspect that a surprisingly high number of the function generators kindly supplied to us for the purpose our test and market overview does contain some form of machine code chewing little monster, if only for the user interface. Compare that to the bewildering array of controls on an old HP benchtop function generator of the 1 970s and its hard to argue that there is no advantage in designing in a microcontroller, not just to make the ins- trument simple to use, but also to avoid 'silly' settings that are possibly harmful to connected equipment. Elektor is liked for its coverage of a wide variety of microcontrollers, each with its own strengths and weaknes- ses, be it 8051 , 6800, R8C, ARM, PIC, AVR, Freescale, FPGA, you mention it! However, the very same diversity on our pages is also criti- cised on occasions by readers be- wildered at the choice of devices on the market. To these readers I can only repeat that Elektor is an independent magazine. Also, having a wide range of devices to choose from is a fact of life - just do it. This month also marks the return of Mini Projects, see page 70. The pages are for the benefit of a younger audience we would like to see enjoying electronics too. This month the 'star component' in the project is none other than a 4049 1C from the junkbox suitably marked Microcontrollers - None Inside. 1 ' Here we present a USB I/O board based on a standard AVR microcontroller - without any special USB chips! ftl • i« page 1 2 •f- r r * iDwaRF brings together a Cypress WirelessUSB transceiver and an Atmel AVR microcontroller to create a networkable 2.4 GHz radio module featuring a free protocol stack and development environment. CF Card Crypto Puzzle fanstastic prizes, page 61 Jan Buiting, Editor CONTENTS Volume 33 March 2007 363 1 6 Attack of the SpYder This month you'll get to know Freescale MC9S08's cronies called SpYder, a USB plug-in programmer/debugger and CodeWarrior, the associated software suite. The two are contained in our SpYder Discovery Kit, which sells at just £ 6.45 including a sample of an MC9S08 8-pin PDIP micro. 58 Explorer- 16 (3) hr ‘PSPni-inS PIC24FJ128 More advanced (but still 100% free) simulation this month with a VSM model for media storage card devices added to our PIC24F system (all virtual, of course). To cap it all, solve a CF card crypto puzzle and win fantastic prizes sponsored by Microchip and Labcenter. hands-on 1 6 Attack of the SpYder 34 AVR Drives USB 40 U niversal USB Device Driver 58 Explorer-1 6 (3) 64 Mobile Phone LCD for PC 70 Scale Deposit Fighter (Mini Project) EtherMeter Design Tips Open CMOS inputs From 5 to 3.3 V technology 44 Wireless USB in Miniature 54 Zigbee Transceiver info & market 6 Colophon 8 Mailbox News & New Products 12 Elektor CD-ROM 2006 Maki ng Waves (function generators) 8 ' Elektor SHOP Sneak Preview infotainment 76 8052AH-BASIC Single-Board Computer (1987) 77 Hexadoku Advertisement lektor lectronics Volume 33, Number 363, March 2007 ISSN 0268/45 1 9 Elektor Electronics 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 Electronics (Publishing), Regus Brentford, 1 000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 www.elektor-electronics.co.uk The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor Electronics is published I I times a year with a double issue for July & August. Underthe name Elektor and Elektuur, the magazine is also published in French, Spanish, German and Dutch. Together with franchised editions the magazine is on circulation in more than 50 countries. International Editor: Mat Fdeffels (m.heffels@segment.nl) Editor: Jan Buiting (editor@elektor-electronics.co.uk) International editorial staff: Fdarry Baggen, Thijs Beckers, Ernst Krempelsauer, Jens Nickel, Guy Raedersdorf. Design staff: Ton Giesberts, Paul Goossens, Luc Lemmens, Christian Vossen Editorial secretariat: Fdedwig Fdennekens (secretariaat@segment.nl) Graphic design / DTP: Giel Dols Managing Director / Publisher: Paul Snakkers Marketing: Carlo van Nistelrooy Customer Services: Margriet Debeij (m.debeij@segment.nl) Subscriptions: Elektor Electronics (Publishing), Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 26 1 4509, fax: (+44) 208 26 1 4447 Internet: www.elektor-electronics.co.uk Email: subscriptions@elektor-electronics.co.uk Rates and terms are given on the Subscription Order Form Head Office: Segment b.v. PO. Box 75 NL-6 1 90-AB Beek The Netherlands Telephone: (+31)46 4389444, Fax: (+31)46 4370161 Distribution: Seymour, 2 East Poultry Street, London EC I A, England Telephone: +44 207 429 4073 UK Advertising: Fduson International Media, Cambridge Fdouse, Gogmore Lane, Chertsey, Surrey KTI 6 9AR England. Telephone: +44 1932 564999, Fax: +44 1932 564998 Email: r.disanto@husonmedia.com Internet: www.husonmedia.com Advertising rates and terms available on request. International Advertising: Frank van de Raadt, address as Fdead Office Email: advertenties@elektuur.nl Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photographs, 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 Segment, b.v. and may not be reproduced or transmitted in any form or by any means, including photocopying, scanning an recording, in whole or in part without prior written permission from the Publishers. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may exist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permis- sion to the Publishers to alter the text and design, and to use the contents in other Segment publica- tions and activities. The Publishers cannot guarantee to return any material submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Segment b.v. 2007 Printed in the Netherlands • Diagnose any car with EOBD • Based on the ELM327 1C • Supports all EOBD and OBD-II protocols ✓ ISO 1 5765-4 (CAN) ✓ ISO 1 4230-4 (Keyword 2000) s IS09I4I-2 SJI850VPW S JI850 PWM • 9600 or 38400 baud • Supported by more software than any other OBD interface • Inexpensive • Full Speed USB I . I • Automatic protocol detection • Package includes cables, software CD, and Quick Start Guide • Buy from your local UK distributors! www.ElmScan5.com/elekfor ClmScan 5 USB Scon Tool 6 elektor electronics - 3/2007 positions vacant Free-lance Deputy Publishers Our publishing house is growing fast and we aim at extending our current team of publishers. The successful candidate(s) will be responsible for - acquiring manuscripts and other material for books and digital media (CDs/DVDs) that can be published in English, German or French, and, if suitable, in other languages. - Staging workshops and masterclasses covering various areas of electronics. Requirements Higher Education or academic background coupled with good communicative skills. Formal education in, or strong affinity with, electronics, highly commended. Ability to read German or Dutch as a second language, commended. Payment based on hours contract or on commission basis. Information For further information, please contact English: Jan Buiting, (+44) 208 2614509, editor@elektor-electronics.co.uk German: Raimund Krings, (+49) 241 8890 915, r.krings@elektor.de French: Denis Meyer, (+31) 46 4389444, d.meyer@segment.nl Candidates are invited to first email or telephone the above persons. An interview with our CEO will be arranged after the initial contact. Applications in writing may be sent to Elektor b.v. Mrs. N. Adriaansen / Staff Office Peter Treckpoelstraat 2-4 NL-6191-VK Beek (Lb) The Netherlands Email: n.adriaansen@segment.nl Elektor aims at inspiring people to master electronics and information technology at any personal level by means of magazines, books, digital media, Internet, workshops, seminars and electronic products. The company is international with its head office based in The Netherlands Schaeffer FRONT PANELS & HOUSINGS Cost-effective single units and small production runs Customized front panels can be designed effortlessly with the Front Panel Designer. The Front Panel Designer is available free on the Internet or on CD. automatic price calculation delivery in 5-8 days 24- Hour-Service if required i r rrrr ■■ TiZ = . Sample price: 30,42 € plus VAT/shipping Schaeffer AG ■ Hohentwielsteig 6a • D-14163 Berlin ■ Tel +49 (0)30 8058695-0 Fax +49 (0)30 8058695-33 • Web info@schaeffer-ag.de ■ www.schaeffer-ag.de No Compromise Oscilloscope Olltfir in tfiii pr\Ct forr^ yog I n ^nmpmmiw nn -nnr n* “h^ ker specifications: SATipinfl.^ie, rrerrofy dc-jEh cf bjpdwdth The jVo5l ■; .y* 5-000 it'ici r. J PiO CompnjfnJw PC gsctflpJCOpi .i5 3 . eve fy engineer cj/* ilflwd pi Teehtialufry IGi's umjaQnE nft j MOHMjr bwidwadth IIHM i ample- twjlTcr mrmcH-jr I25H5 l II taH A WG built In PifoScope S103 (juffpr £IIM PicoScope 5104 DflM buffer £I 7?5 3/2007 - elektor electronics 7 INFO & MARKET MAILBOX Explorer-16 Hi Jan — very interested in the new series featuring the Explorer-16 project (January & February 2007, Ed.). In the summer I went to a Microchip 1-day seminar on the PIC24 and dsPIC devices. It cost me from memory, just over £90 and included refresh- ments, buffet lunch and a free Explorer-16 board plus PIC24 and dsPIC33 mounted PIMs. The presentation and demos were very good. They also gave out a voucher for 20% off Microchip products. Spurred on by the new series I have ordered an ICD 2 Debugger and have already uninstalled my MPLAB IDE to update to the latest version. One small erratum, on the inset panel on p.25, step 5 refers to the selection of Build All from the Debugger menu. I think that should be the Project menu. Looking forward to the next article, with thanks for an inte- resting magazine. I am a de- serting Electronics (Wireless) World reader! I stopped my subscription because the format changed completely and concentrated on 'waffle' articles. I am part professional, part amateur electronics engineer. I manufacture industrial mo- dems for the railways and uti- lities, slow speed 1 200 baud FSK V23 protocol and 300 Baud Dial up V21 duplex ty- pes. My interest in Microchip was to produce a firmware version based on a dsPIC. Microchip have already made the software available as a download but it is for another platform. Some work to do there! Andrew Binning Thanks for the feedback Andrew and hope you also en- joy Explorer-16 instalments 2 (February 2007 ) and 3 (this is- sue). We confirm the error in the text; a correction is published on the Explorer-16 project page on our website. Fortunately it does not seem to have deterred too many readers from successfully running the first simulation. ECG using a Soundcard Hi Elektor — I've read the ar- ticle in Elektor October 2006. The project looks simple and I want to build it. However, the software looks daunting. I downloaded the zipped files and when I opened them, there are many things inside. How do 1 make a start? I am familiar with Delphi, C++, Visual Basic, but have not tried out Java. Please advise. Norman Kim (Australia) Martin Klaper replies: Hi Norman , thanks for your e- mail from Sydney Australia. For a jump start , / recommend using the precompiled version , i.e. double-click on the EKG- MonitorVl .O.jar file. The only prerequisite is an installed JAVA runtime environment (JRE). Usually this is already on your computer. In case you need to install it , go to www.java.com/ de/download/index, jsp and download the JRE. Here you can download the Java development environment (J DK): h ttp :// java. sun. com/ ja- vase/downloads/index.jsp. If you are familiar with Delphi , Visual Basic and especially C++, it should not be too difficult to learn a fourth programming lan- guage. My project is structured in three parts: /O, GUI and sig- nal processing , so it should be possible to concentrate on one or another aspect. A good en- try point to Java is www.BlueJ. org, although many other excel- lent Java tutorials and books are available in bookstores and on the net. Some useful web links are in my Elektor article and on the Elektor website. A circuit board is available from Elektor ; see the project page on their website. [foto als NL mailbox 2/2007] Help batteries through the winter Dear Editor — I've a small question about the charger for sealed lead-acid batteries. Can I use this circuit as a charger for ordinary lead-acid batteries as used in vehicles? I mean the variety you can top up with distilled water. Or should I go for the lead-acid battery charge controller? The battery involved is a 1 2-V type for my motorcycle, and I really need a circuit to help the battery survive the winter period during which it is not used on the bike. Consequently it has to remain on the charger con- stantly over a period of about three months, will that be a problem? Roy (by email) A motorcycle battery is best used in combination with our Motive-Battery Charger from the October 1994 issue as that cir- cuit takes into account the lower capacity of a motorcycle battery as compared with a car battery. To prevent sulphation, you could connect the Lead-Acid Battery Revitaliser from the September 2001 edition of Elektor in pa- rallel. This circuit will charge the battery every few seconds with a short but strong pulse that serves to destroy sulphate cry- stals on the battery plates. Best results are obtained we believe , by first charging the battery with the charger and then allow the Revitaliser to improve the con- dition. Inevitably this circuit will draw a little current from the bat- tery to build up the energy for the pulses. If the battery is in danger of going flat, you charge it again using the charger. Nixie clock parts sourcing Dear Jan — I am happy to inform you that that those rare birds, the 74141 TL ICs for the Sputnik Timer Machine clock (January 2007, Ed.), are available from us under order number HLT0579. Suitable Nixie tubes like the types Z590M and B5870 are also in stock. Further offers relating to Nixie clocks are found on the web- site http://www.askjanfirst. com/r5.htm which is also the source of the picture showing the acrylic glass Nixie clock with blue socket lighting. Jan Wusten, Ask Jan First GmbH & Co. KG (Germany) Profiler (3) The 'Profiler milling machine from a kit' publication in our January 2007 edition has given rise to a number of questions that are asked repeatedly, by email or through our forum. Among these questions: whether or not aluminium can be milled with this machine? The answer is: yes it can. Milling harder materials is not recommended 8 elektor electronics - 3/2007 What can be done with Profiler • milling PCBs, including however as the construction of Profiler is not up to handling, say, steel. Another important aspect to keep in mind is the speed and force specification of the spindle motor you intend to use. The Ferm spindle motor contained in the kit is a basic tool that's definitely not up to high requirements. The circuit board inside the machine are supplied ready populated and tested. A sug- gestion received from a num- ber of readers to switch the drill and the vacuum cleaner on and off under control of the electronics has been forwar- ded to the kit manufacturer. At the time of writing, this option is not yet available. Another frequently asked question covers accuracy, as the milling bits have to be changed by hand. A calibra- tion method is available for this, allowing the bit to be fully inserted into the tool and then secured. Next, the soft- ware performs a calibration for the milling depth. This al- lows the spindle motor and/or the milling bit to be accurately positioned on the surface to be milled, — the tip of the bit just touching the surface. This position is stored as a reference, so replacing worn bits is not a problem during a milling job. For the sake of completeness we once more summarise the main specs of the milling machine. Spy Radio Stations Dear Editor — I was inte- rested to read the article 'Spy Radio Stations' in the December 2006 issue. However I was a little bemu- sed by the author's suggestion that Number Stations may be replaced by the Internet — will Security Services really send out e-mails which, tracks in between pads for DIL 1C pins. • milling aluminium front panels (using a suitable milling bit). • milling ABS enclosures. • milling ABS and wooden parts for modelling. What cannot be done with Profiler • milling PCBs with two tracks in between pads for DIL 1C pins. • milling hard materials like steel plate. The functionality of the user in- terface is limited to controlling the machine. Other software is required to create designs. Although Autocad is common- ly used (DXF format) for 2D and 3D objects, CorelDraw is likely to do the job too. Almost any PCB software can be used to design printed circuit board artwork. See our 'E-CAD' DVD (free with the November 200 5 issue). The exported files (Gerber & Excellon) can be read by the conversion program comprised in the Profiler user interface. Other file formats required the use of an add-on software tool called RAMS. Solution to Hexadoku January 2007 F 7 E B 8 A 2 6 3 5 0 C 9 D 4 1 1 0 4 8 9 5 3 E 6 D 7 B 2 F A C 2 D 3 6 4 7 C F A 1 9 8 5 0 B E 9 A 5 C 0 D B 1 2 4 E F 8 3 7 6 8 B A 0 6 F 4 7 C 2 5 3 E 1 9 D 6 5 2 1 D 0 E B 7 9 8 A 4 C 3 F 7 9 C E 3 1 5 2 D B F 4 A 6 0 8 3 4 F D A c 8 9 E 6 1 0 7 B 2 5 0 2 9 F 1 8 7 D B 3 4 6 C E 5 A B 8 6 7 2 4 A 5 1 C D E 0 9 F 3 E 3 1 A F B 6 C 5 0 2 9 D 4 8 7 5 C D 4 E 9 0 3 8 F A 7 6 2 1 B 4 6 B 2 7 3 1 8 0 A C D F 5 E 9 A F 0 3 C E D 4 9 8 B 5 1 7 6 2 D E 8 5 B 2 9 0 F 7 6 1 3 A C 4 C 1 7 9 5 6 F A 4 E 3 2 B 8 D 0 r ™ ™ ™ ™ ™ — — — —— — — — — — — — i — — — .... ! Corrections & Updates MP3 Preamp February 2007, p. 40-45, ref. 060237-1 The circuit diagram shown in Figure 2 should be corrected to reflect that the negative terminal of capacitor C3 is con- nected to junction R1 0/R1 8/T2 base, i.e., not to the emitter I of T2 as printed. The same applies to Cl 2 and T6. The I printed circuit board design (Figure 4) is correct. Also in the circuit diagram, the indication with connection point 'Cl ' should be moved one level down, i.e., from GND1 down to the same level as C9. when intercepted, carry the agent's email address at the start of every packet? Or will the agents give out the same information by logging onto a spy website? The advantage of using H.F. transmission is that the agent may be anywhere in a region covering about 1 /3 of the globe. Sebastian Linfoot (UK) Thanks for writing in Sebastian. Your interpretation of the arti- cle text is fairly wide and to be honest we do not see a suggesti- on by the author that Internet may replace radio for spy num- ber transmission. None the less , it is intriguing to know how alter- native methods could be made to work. The Enigma 2000 orga- nisation mentioned in the article is probably the best source of relevant information. MailBox Terms •Publication of reader's correspondence is at the discretion of the Editor. •Viewpoints expressed by corres- pondents are not necessarily those of the Editor or Publisher. •Correspondence may be translated or edited for length, clarity and style. •When replying to Mailbox correspondence, please quote Issue number. •Please send your MailBox correspondence to: editor@elektor-electronics.co.uk or Elektor Electronics, The Editor, 1 000 Great West Road, Brentford TW8 9HH, England. 3/2007 - elektor electronics 9 INFO & MARKET MAILBOX fiScope It is often said that the oscil- loscope is the most useful piece of test gear that the engineer can possess. Over the years 'scope' design has improved tremen- dously; they are now more portable, reliable and offer far better performance than their predecessors. More recently we have seen the introduction of the 'USB scope' which digitizes the analogue input signal and displays it on a laptop or PC screen, these offer a good range of features at a reasonable price. For the last 25 years the cost of even a low-spec scope has been beyond the reach of the average electronics enthusiast. During this period many designers with an ambition to own their own scope have risen to the challenge and produced their own design. Many of these home brew scopes appeared in the electronics press in the 1 960s and 70s, most of them used valves but in 1 975 the fully transistorised (excluding the CRT of course) 'Elektorscope' was published in Elektor Electronics. Despite the success of the design many people were put off by the cost of the CRT and special mains transformer. Way back in October 1978 Elektor Electronics addressed this problem by publishing the 'TV scope'. This design used a standard black and white TV set to display the waveforms while the input signal was sampled and stored in a 'bucket brigade' memory chip. One feature of the design was that the X axis (time) was drawn vertically on the screen. With the technology available at that time and an emphasis on a low cost solution it was still a rather complex project and required a number of PCBs containing many ICs. Thanks to progress in microprocessor technology it is now possible to produce the complete 'TV scope' concept using just a single 8-pin microcontroller. A brief scrutiny of the data sheet was sufficient to deter- mine that the PIC 1 2F675 microcontroller contained all the components necessary to build a modern day equivalent of the TV scope which we have called the 'pScope'. The aim of the exercise was to implement all the features of the original design in the controller's firmware. As we know there is no such thing as a free lunch, here the very simple hard- ware approach means that the software must be more complex. The processor needs to work hard just to produce a real-time video signal, when you take into consideration the oscilloscope functions and the user interface the processor has hardly any spare capacity at all. The on-chip memory is also barely enough; at 64 bytes the RAM is actually too small but luckily Timer 1 is not used so its two registers are employed as additional RAM space. The limited memory and chip clock speed call for some unconventional solutions to ensure success in this design application. It would of course be much simpler to use a higher- spec controller but then the project would be far less interesting and challenging. With so little hardware it goes without saying that the cost of the design will be absolutely minimal and the complete circuit can be accommodated on a small piece of solder- pad prototyping board. Software for the PIC 12F675 was written using the 'tait style' programmer. Communication with the PC is performed using the parallel computer (prin- ter) interface and the software runs by starting the 'PP06' program. Current consumption of the complete circuit is less than 10 mA so it is possible to use battery power. The sensitivity of the scope can be improved by adding some amplification to the input signal; the pScope is not a wide- band instrument, it has a bandwidth of only a few kilohertz so it is sufficient to use a standard specification opamp as an amplifier. Those of you who feel confident enough to alter the software can experiment by writing a program to generate signals for display on the scope. The assembler program EXAMPLE. PIC draws a white rectangular border and a dashed line on the screen. All of the relevant soft- ware can be freely downloaded from the Elektor Electronics website. The software is well documented and the operating principle is quite easy to understand so it shouldn't be too long before you are able to make the necessary modificati- ons to produce your own signals. The resulting waveforms can also be recorded onto a VCR if necessary. The 1 2F675 is one of the smallest members of the PIC controller family from Microchip. The 14-bit processor has a 1 024 word flash memory, 64-byte RAM together with a 1 28- byte EEPROM. Included with the built-in standard peripherals are timers and a watchdog. The 1 2F675 also has a 1 0-bit A/D converter with a sample and hold function, a voltage comparator and an adjustable voltage reference all of which can be configured by software. Ronald Dekker (Netherlands) ( 060278 - 11 ) The software for this project (060278-1 1 .zip) can be found on the Elektor Electronics website under magazine/2007/ March/Mailbox. The authors website also contains a more detailed description (in English) of the project: http://members.chello.nI/r.dekker49/ 10 elektor electronics - 3/2007 16 -bit Microcontrollers 16-bit PIC24 MCUs and dsPIC® Digital Signal Controllers Unified 16 -bit Architecture • PIC24F, low-cost entry level • PIC24H, 40 MIPS high performance • dsPIC30F/33F for seamless DSP integration Low-Risk Design • Easy migration from 8-bit MCUs • Common core instruction set and architecture • Peripheral and Pin compatible families • One development tool platform for all products • Free MPLAB® IDE Integrated Development Environment • Other tools include C-compiler, programmer and In-Circuit Emulator Visualise...1 6-bit Microcontrollers with 32-bit Performance and 8-bit Simplicity Today’s embedded systems demand more. The 16-bit hardware designs. For the most demanding applications PIC® microcontroller families from Microchip give you the dsPIC digital signal controller families seamlessly the performance and flexibility you need with 8-bit integrate high-performance DSP capabilities with the simplicity. Pin and code compatibility lowers risk, and PIC microcontroller core, allows re-use of development tools, software and Over 50 PIC24 Microcontrollers and dsPIC Digital Signal Controllers sampling today. For data sheets, samples and pricing go to www.microchip.com/16bit Compliant The Microchip name and logo, PIC, and dsPIC are registered trademarks of Microchip Technology Incorporated in the USA and other countries. All other trademarks and registered trademarks are the property of their respective owners. ©2007 Microchip Technology Inc. All rights reserved. ME154Eng/01 ,07-ELUK-B INFO & MARKET NEWS & NEW PRODUCTS Elektor CD-ROM 2006 New version has HTML user interlace The Elektor Volume 2006 CD-ROM that's published along with this March 2007 issue has a rather different look and feel than previous editions — it's gone through a makeover in more than one way. Elektor year volume CD-ROMs have appeared since 1996 and become a well-established prod- uct, eagerly awaited every year by thousands of our readers. In early years (1996 and 1 997) a homebrew user interface was ap- plied for lack of a suitable standard for reproduc- ing magazine articles on digital media. As of the 1998 edition, Adobe pdf was used and thanks to its general acceptance it has remained the standard ever since. Articles are displayed using the well- known Acrobat Reader program from Adobe, of which a current version was supplied on every Elektor annual CD-ROM. A user interface written to match Acrobat Reader was included to ensure simple and uncluttered op- eration while also provid- ing a search function for subjects and keywords. During the past ten years the user interface on Ele- ktor year volume CD-ROMs was modified quite a few times to meet the requirements of computer us- ers and, of course, new Windows versions introduced over the years. Still, problems occurred very now and then due to incompatibility is- sues. Also, installing multiple year volumes on hard disk proved com- plicated at times. During recent years, the DiskMirror utility was supplied on our CDs to help us- ers get it all organised in a simple manner. Starting with the 2006 edition, we switch to a completely new user interface based on HTML and employing the default web browser installed on every rea- sonably modern PC. In this way we hope to offer better, simplified control of the proqram while at the same time preventing hard- ware-related problems. A little getting used to The new user interface for the 2006 CD-ROM may look a bit un- familiar initially if you're used to the previous versions, and may require some time to get comfort- able with. Provided Autostart for CDs is en- abled on your PC, the 2006 CD- ROM will launch automatically when inserted in the drive. If not, you will need to run the program Server2Go.exe found on the CD. The computer will start a Web- server application (actually, an Apache Webserver and a MySQL database). Depending on the com- puter's speed, this may take some time to load and complete. Next, your PC's default web browser is started and the welcome page of the Elektor 2006 CD-ROM ap- pears. Here you can select from four languages followed by a number of menu options. Most texts, options and prompts are self- explanatory to the extent that no further advice is needed: an over- view of the 1 1 magazine issues, all articles per issue, all articles by heading and of course a search function across the entire CD con- tents, also allowing multiple search arguments (with an AND/OR selec- tion). One click on an article title is sufficient to open a new browser window in which the relevant pdf document will appear. All free, printed, supplements our readers got last year, like the Vis- ual Basic, C and i-Trixx booklets are also contained on the CD — they are found under Supplements. Printed circuit board artwork that was not printed in the relevant magazine issues (due to lack of space) are found under Extra PCB layouts. Finally, the CD also con- tains all News & New Products items published in 2006. Typically, less than 5 minutes worth of clicking around are needed to get the feel of new system. Putting it on the hard disk The new version is extremely easy to use from hard disk. All you have to do is create a new folder on your hard disk and give it a suitable name (like Elektor2006). Then copy the complete CD contents to that fold- er. Next, create a short- cut in the Start menu or on the desktop, to point to the application pro- gram Server2Go.exe in the folder. Future editions of the Elektor year volume CD may be added in this folder and are automati- cally included in the gen- eral overview. The only disadvantage of the new system is its incompatibility with the previous one — older year volumes are inac- cessible, hence cannot be searched, directly from the new menu. It's a sobering thought however that the PC world is changing so fast you have to say goodbye to a system at a certain stage and make a fresh start. We hope you like the new layout. If you have requirements or re- marks, or you wish to discuss the new CD with other readers, please feel free to do so in the special top- ic created on our Forum at www.elektor-electronics.co.uk. ( 070057 - 1 ) 12 elektor electronics - 3/2007 Vinculum 1C speeds USB flash drive connectivity to microcontrollers Figure 1. The VDRIVE2 snap-in module. By Fred Dart (MD, FTDI) Although this media has been readily available for a number of years, use of USB flash drives has, to date, been restricted to platforms with adequate processing power such as PCs and 32-bit embedded systems. FTDI has now opened up the use of USB flash disks to micro- controllers with the introduction of their Vinculum series of intelligent USB host controllers. The Vinculum VNC1L 1C pro vides USB host interface and data transfer, and supports the most popular device classes; mass stor- age, printer and human interface device (HID). HID class devices typically include USB keyboards, joysticks and mice. When inter- facing to flash drives, Vinculum manages the file allocation table (FAT) structure by using a straight- forward command set. The device has an 8-bit core together with a 32-bit co-processor, dual DMA controllers, 64 k embedded flash and 4 k internal SRAM memory. Vinculum features two USB 2.0 low and full speed, host and slave ports, universal asynchronous re- ceiver transmitter (UART), serial pe- ripheral interface (SPI) and parallel first in first out (FIFO) interfaces. It also has two PS2 legacy ports for keyboard and mouse, and up to 28 general-purpose input output (GPIO) pins depending on con- figuration. The current Vinculum handles both low and full speed USB 2.0, which provides data link at up to 12Mbytes/s and will in- terface to all USB2.0 peripherals, as well as older USB1 .1 devices. This is more than sufficient for USB flash drive applications and is de- liberately targeted to keep the size, cost and power down to a level that is acceptable for embedded applications. Power consumption is 25 mA for the 3.3 V core and the 5-V-safe I/O interface. Vinculum provides USB host ca- pability to microcontroller-based products that previously did not have the hardware resources avail- able. A wide range of consumer and industrial products, such as intelligent domestic appliances, meter readers and vending ma- chines, can now incorporate USB peripheral connectivity. For prod- uct designers this is now greatly simplified by the availability of FTDI s new VDRIVE2 module Packaged in a neat snap-in enclo- sure (Figure 1), VDRIVE2 consists of a Vinculum 1C, USB "A" socket and a few support components. Only four signal lines plus a 5V supply and ground are required. By using the Vinculum Disk Inter- face Firmware Specification (DIFS) the I/O interface can be selected between the serial UART and SPI using the on-board jumper pins. A bi-colour led provides power and status indication. Adding a PIC microcontroller and a few other components, the VDRIVE2 module can be turned into a flash disk based data log- ger. Figure 2 shows the sche- matic of a simple application. The AC signal input is connected to the 10-bit analogue to digital converter on board the Microchip PIC. The PIC code takes a pre- defined number of samples and then writes the corresponding ASCII values to a comma sepa- rated value (CSV) file on the USB flash disk attached to the VDRIVE2 module. Vinculum's DOS like AS- CII commands simplify the task of file handling. An extended ASCII command set is designed for use with a terminal during test and development, whilst a shortened hexadecimal version is used with a microcontroller. Currently, Vin- culum's command set has five cat- egories: Directory, File, Power management, Debug and Miscel- laneous. Table 1 illustrates some example commands. ( 070014 - 1 ) Figure 2. Connecting the VDRIVE2 to a PIC micro is as simple as this. Table 1. Vinculum — command monitor system examples. Extended ASCII command for terminal mode Hexadecimal command for microprocessor mode Command function Directory examples DIR $01, $0D Lists the current directory MKD $07,$20,,$0D Make directory CD $02,$20,,$0D Current directory is changed to the new directory File examples RDF SOB, $20, size in hex(4 bytes), SOD Reads the data oksize in hex> from the current open file 0PW $09,$20,,$0D Opens a file for writing with the command WRF Power management examples SUD $15, SOD Suspend the disk when not is use to conserve power WKD S16.S0D Wake disk 3/2007 - elektor electronics 13 INFO & MARKET NEWS & NEW PRODUCTS MPLAB® REAL ICE™ emulation system Microchip announces the MPLAB® REAL ICE™ emulation system to support the development of appli- cations that use Microchip's PIC® microcontrollers and dsPIC® Dig- ital Signal Controllers (DSCs). The MPLAB REAL ICE offers low-cost, next-generation emulation support, including faster memory interfacing and longer distance, higher speed target connections. The new emulation system is ful- ly integrated into the free MPLAB Integrated Development Environ- ment (IDE) used for writing code, building projects, testing, verifi- cation and programming. Within MPLAB, the new system supports a wide range of debugging facilities, such as complex break points, ap- plication code trace and data log- ging, code execution stopwatch, and real-time variable monitoring. Microchip developed the MPLAB REAL ICE emulation system along- side its next-generation microcontrol- lers and DSC devices to ensure tightly coupled emulation integration. On- chip resources support the emulation features for full-speed debugging, with real time variable monitoring. High-speed data interfaces rapidly upload large trace records, offering quick monitoring and instant adjust- ment of application parameters. The MPLAB REAL ICE emulation system offers the following ad- vanced features: • Full-speed, Real-Time Emulation. • Portable, USB-Powered, and CE and RoHS-Compliant • Trace Execution and Analysis: - Multiple execution trace and application logging features - Real-time watch and data capture - Trace data streamed via par- allel or serial interface • Rugged Probe Interface: - Protection circuits guard against power surges from the target • Legacy and High-Speed Connectivity: - Backward compatibility with the MPLAB ICD2 in-circuit de- bugger, or - A driver/ receiver pair for high-speed, noise-tolerant com- munications, supporting cable lengths up to 3 metres. • Logic Probe for External Triggers: - 14-pin header connects to logic probe for external triggers - Can also trigger an external logic analyser or oscilloscope The MPLAB REAL ICE in-circuit em- ulator (part number DV244005) is available now for $499.98 or the local equivalent excluding local tax. In addition, the MPLAB REAL ICE Performance Pak (part number AC244002) is available now for $159.98, and includes two plug- in high-speed driver boards to en- hance communications between the unit and target. The optional Processor Extension Paks, available shortly, will pro- vide an extension board that plugs directly into the target socket and releases debugging pins for use within the application. For additional information visit Microchip's Web site at www.microchip.com/realice (077029-11) Class-D chipset cuts parts count and board size by 50% International Rectifier recently in- troduced a new Class D audio chipset comprised of the IRS20955 200-V digital audio driver 1C and the IRFI4024Hx series of digital audio MOSFETs. Compared to typical designs, the new 1C reduc- es PCB board space by 50 per- cent for Class-D audio amplifiers up to 500 W, while the MOSFETs reduce power switch part count of the Class D stage by 50 percent for the entire mid-voltage range of mid- and high-power amplifiers for home theatre applications, profes- sional amplifiers, musical instru- ments and car entertainment. The IRS20955(S)(TR)PBF 1C re- duces external component count by up to 27 components and fea- tures a unique floating, 3.3V/5 V logic-compatible, PWM input that eliminates seven external level-shift components for Class D audio ap- plications using a half-bridge topol- ogy and dual power supply. Greater protection is achieved with an integrated programmable bi- directional current-sensing feature with self-reset function that allows the high-voltage 1C to sense the exact point of the switching cycle. Current is sensed at the correct mo- ment allowing the 1C to optimize the over-current protection circuit. In addition, this offers considera- ble space-saving benefits with the elimination of a large current-sense resistor. The 1C has built-in protec- tion control logic that eliminates 1 1 components and shrinks board footprint, compared to existing au- dio 1C reference designs. The new audio 1C has preset inter- nal deadtime generation to enable accurate and stable gate switch timing, while delivering optimum deadtime settings for improved to- tal harmonic distortion (THD) per- formance and high noise immunity. In addition to simplifying design, this deadtime feature reduces part count by as much as eight exter- nal components, and reduces board space by eliminating large package types. Operating up to 800 kHz, the IRS20955 digital audio 1C is also suitable for single- supply, full-bridge designs. In addition to low on-state resistance, the series of half-bridge N-channel MOSFETs provide optimized gate charge, body-diode reverse recov- ery and internal gate resistance to improve key Class D audio ampli- fier performance parameters such as efficiency, THD and EMI. For example, the IRFI4024H-1 17P fea- tures a typical R Ds(on) of 48 mOhms for high efficiency, and a typical Q of8.9nCandQ of 4.3 nC for im- sw proved THD. www.irf.com (077029-V) elektor electronics - 3/2007 14 Weatherproof LED data display Lascar Electronics has introduced the EM32-4-LED, a 4-digit LED data display well suited for use in micro- controller based applications. The display area comprises four 7-seg- ment LED digits and three decimal places, each of which can be in- dividually addressed using serial communication. The low-power red LEDs provide a vivid display that can be easily read in most lighting conditions whilst draw- ing just 20mA at 5V. Connection to the EM32-4-LED is via a 12-pin DIL connection with industry stand- ard 2.54mm (0.1") pitch. The EM32-4-LED is housed in an attractive round metal alloy and glass enclosure that provides envi- ronmental protection to IP-67 when correctly mounted. The EM32-4-LED is available imme- diately from Lascar Electronics with prices starting at £24.95 (£14.97 at quantities of 250+ pcs). For further information regarding this product, or to discuss a poten- tial application please contact the Lascar sales team on +44(0)1794 884567 or by e-mail: sales@lascar.co.uk or from the Lascar website www.lascarelectronics.com. (077029-IV) Cost-effective mid-power 24Vin micro modules Vicor announces the addition of seven mid-power Micro DC-DC converters to the 24Vdc input fam- ily: 50W models at 3.3, 12, 15, 24, 28, and 48Vout. The modules — which incorporate Vicor's pat- ented low-noise Zero-Current and Zero-Voltage Switching (ZCS/ZVS) — are appropriate for power sys- tem applications in industrial and process control, distributed power, medical, ATE, communications, de- fence, and aerospace. The addition of these modules dou- bles the size of the high-power den- sity 24Vin family, which previously consisted of 75W at 3.3Vout and 100W at 5, 12, 15, 24, 28 and 48Vout. The converters operate from 24V nominal input, with an input range of 1 8V to 36V and will operate down to 1 6V after startup. Efficiencies range up to 89% for the higher output voltages. These models, which are RoHS compliant (with F or G pin option) are 57.9 x 36.8 x 12.7 mm in size with a height above board of 1 0.9mm. These mid-power products provide customers a cost-effective solution for applications that do not require the full-power capability of the Mi- cro module, but would benefit from the low-noise performance and full- feature set provided by te Micro platform. Vicor's comprehensive line of pow- er solutions includes modular, high- density AC-DC and DC-DC mod- ules and accessory components, fully configurable AC-DC and DC- DC power supplies, and complete custom power systems. www.vicorpower.com (077029-1) Current sensors for automotive battery- monitoring applications LEM has introduced two new members of its IT family of cur- rent transducers to address high- current applications. The IT 400-S and the IT 700-S are specified re- spectively for 400 and 700 A RMS nominal. As with other members of the family, they offer very high accuracy, based on resolution bet- ter than 0.05 ppm, linearity better than 3 ppm and an initial offset between 30 and 50 ppm. Thermal offset drift is extremely low, at only 0.5 ppm/K. Featuring galvanic isolation, the IT 400-S and IT 700-S can be used for current measurement of any kind of waveforms (including DC, AC, mixed and complex). They have been designed to op- erate from a bipolar ±15 V DC power supply and will accom- modate round primary conduc- tors of 26 and 30 mm diameter respectively. In addition to their normal current output, the transducers offer an ad- ditional output indicating the trans- ducer state (opened or closed con- tacts), and an external LED show- ing the normal operation. With an operating temperature range of +10 to +50°C, the trans- ducers will find applications in high- precision power supplies and high- performance gradient amplifiers for MRI (Magnetic Resonance Imag- ing), as well as medical equipment such as medical X-Ray imaging, but also calibration test benches in laboratories and test departments. They can also be used as interfaces for power analysers when high ac- curacy is required. The transducers are CE marked and supplied with a two-year warranty. www.lem.com (077029-111) 3/2007 - elektor electronics 15 HANDS-ON FREESCALE MICROS Discover Freescale's MC9S08 micro, SpYder and CodeWarrior Jan Buiting & Luc Lemmens, in cooperation with Inga Harris (Applications Engineer, Freescale Semiconductor Inc.) In this short series of articles we add Freescale's powerful MC9S08 device to the diverse and colourful palette of 8-bit microcontrollers that have graced our pages these past two or three decades! This month you'll get to know MC9S08's cronies called SpYder and CodeWarrior; next month we have a nice application project for you to build. For your benefit we're going to use a micro housed in an 16-pin DIP case! Freescale Semiconductor ranks among the market leaders in microcontrol- lers — yet their tool set and distribu- tion networks were unattainable to the hobbyist market until 2006 as their tool solutions, both hardware and software, were price inhibitive. Since breaking off from Motorola they have placed a strong focus on the mass market and with the recent addition of an e-com- merce site, free samples, free of charge compilers and debuggers and low cost hardware tools Freescale’s microcon- troller families are now ac- cessible to all. Elektor Elec- tronics, in exclusive coopera- tion with Freescale, is happy to be instrumental in this. The latest tool, the SpYder, manufactured by SofTec Mi- crosystems with a normal resale price of about £ 20 ( 30) is another strong step into this marketplace. Where it all came from The roadmap shown in Figure 1 shows how Motorola/Freescale’s cores have evolved. The HC05 and HC11 8-bit cores were introduced in the 1980s and were widely used by all kinds of developers. In the late 1990s the HC08 (8-bit) and HC12 (16-bit) cores were in- troduced but were never widely adopt- ed by the mass market. In very early 2000’s the HCS12 16-bit core followed by the HCS08 8-bit core were intro- duced with the key new feature on the Background Debug Module (BDM). The 8-bit HCS08, and — introduced last year — the RS08 microcontrollers contain a single-wire background de- bug interface, supporting in-circuit programming of on-chip non-volatile memory and sophisticated non-intru- sive debug capabilities. It is this mod- ule which enables the development of these low cost, easy to use tools. The BDM connection will also be present on the 32-bit microcontroller 68K/ColdFire™ VI core products which will be available later this year. BDM: do-it-yourself or buy one In 2005 freegeeks.net (now integrated in www.freescale.net) provided the HCS12 microcontroller community with an open source tool named TBDML, and with 1454 downloads in the first 12 months it was hailed a great success. Now the equivalent tool for their 8-bit BDM ena- bled microcontrollers is avail- able in two forms. You can choose the OSBDM for the HCS08’s which you can find details of on the Freescale forums [1]. This self build tool has a BOM (bill of materials) of under $10. Alternatively, you can buy a ready made SpYder which supports MC- SpYder is a bug eating, MCU spying tool for 8- and 16- legged microcontrollers 16 elektor electronics - 3/2007 9S08QG, MC9S08QD and MC9RS08KA 8-bit microcontrollers to date, and as more microcontrollers are announced this list will grow. The SpYder Discovery kit will be sold through Elektor as of this magazine issue. OSBDM and SpYder essentially do the same thing. They interface between your development environment (Win- dows PC based) and your target micro- controller as shown in Figure 2. The key aim of these tools is to provide a tool which is cheap and easy for en- thusiasts, students etc. to use. j MC9S08QG4/QG8 features | • 4-8k Flash, capable of EEPROM emulation I • 51 2bytes of RAM • Internal Clock Source (ICS) | • Up to 1 0 MHz bus I • On-chip oscillator • Frequency locked loop to generate the CPU clock from the internal oscillator. I • External crystal support (16-pin only) up to 10MHz bus I • 2% accuracy over full operating range • Power saving modes I • Serial Communication I • l 2 C (synchronous), SPI (synchronous), and SCI (asynchronous) Timers J • 2-channel Timer/PWM Module (TPM) I • An 8-bit modulo timer module (MTIM) with 8-bit prescaler I • Analogue Modules • 8-channel, 10-bit ADC, including temp sensor I • Analogue comparator I • Development Tools: SpYder08 & CodeWarrior Special Edition (free) • On chip ICE and BDM I • 8-pin packages - PDIP (!), NB-SOIC, DFN I • 16-pin packages - PDIP (!), TSSOP, QFN Freescale & Elektor Elektor is proud and glad to acknowledge its exclusive cooperation with Freescale Semicon- ductor Inc. for the benefit of its readers. The cooperation covers not only publishing articles based on Freescale microcontrollers and other semiconductor devices, but also sales of SpY- der kits at a reduced price. There's more in the pipeline so stay tuned. More about SpYder and BDM The 2 g accelerometer we’ll describe in part 2 of this series is controlled by Freescale’s MC9S08QG8 MCU and the SpYder Discovery Kit. The Kit is a new USB-to-BDM develop- ment tool for Freescale’s MC9S08QG, MC9S08QD and MC9RS08KA 8-bit mi- crocontrollers (Figure 3). For those of you unfamiliar with BDM, it is Frees- cale’s version of ICD, debugWIRE, JTAG etc., used on their recent 8- and 16-bit products. The BKGD (BacKGrounD) pin on these devices provides this single-wire back- ground debug interface to the on chip debug modules. See the Develop- ment Tools chapter of any HCS08 or RS08 datasheet for more information about these debug modules and how c .2 '*■» 5 a 5 CD O c § CD 0 * HC12 Flash and ROM 8MHz S12/S12X Flash to 32MHz HC1 1 OTP and ROM 4MHz HC05 OTP and ROM 4MHz HC08 Flash and ROM 8MHz Past Present 060296 - 11 Figure 1. Core roadmap of a selection of Freescale micros released onto the market. 3/2007 - elektor electronics 17 HANDS-ON FREESCALE MICROS W Windows PC 1 CodeWarrior™ Development Studio for ' Freescale HC(S)08/RS08 v5.1 1 SofTec Microsystem SpYder Drivers USBSPYDER08 nnnnnnnn □ jbi6 □ □ Integrated □ LS USB in □ USB/BDM -I Firmware —1 □ □ uuuuuuuu □ □ □ □ 6 Wire BDM Target Board □ □ □ □ ooooooooo ooooooooo ooooooooo ooooooooo ooooooooo ooooooooo Figure 2. SpYder comfortably seated between the PC's USB and a Freescale microcontroller board with BDM connectivity. 060296 - 12 Figure 3. What's inside an MC9S08 micro — globally, that is! 1 2 BKGD [ ID □ GND NC □ □ RST/VPP NC [ □ □ VDD 5 6 Figure 4. Freescale BDM connector pinout. to use them. While the interface is sin- gle wire, typically a 6-pin connector, a BDM port is used to interface with the target as shown in Figure 4. The primary function of this pin is for bidirectional serial communication of active background mode commands and data transfer. During reset, this pin is used to select between start- ing in active background mode or by The tool takes the form of a USB Flash Memory Stick. Together with the CodeWarrior IDE, SpYder provides you with everything you need to write, compile, download, in-circuit emulate and debug user code. Full-speed program execution allows you to perform hardware and software testing in real time. The tool works up to bus speeds of 10 MHz, supports the 3.3 V operation range of the microcon- MC9S08QG8CPBE is just a long name for an 8-bit micro in a 16-pin PDIP case starting the user’s application pro- gram. Additionally, this pin requests a timed sync response pulse, allow- ing a host development tool to deter- mine the correct clock frequency for background debug serial communica- tions. BDC commands are sent seri- ally from a host computer to the BKGD pin of the target HCS08 or RS08 MCU. All commands and data are sent MSB- first using a custom BDC communi- cations protocol. With a single-wire background debug interface it is pos- sible to use a relatively simple inter- face pod to translate commands from a host computer into commands for the BDC. In the case of the SpYder Discovery Kit, a low-speed universal serial bus (USB) interface is used. trollers and has on board a socketed target microcontroller which can be replaced with other supported PDIP packaged parts available in small sam- ple quantities FOC from http://www. freescale.com. To increase the flexibil- ity of the tool, it has a BDM connector for off-board debugging of the support- ed products in other packages, or if you need to develop along with other board components. Meet CodeWarrior Freescale’s CodeWarrior™ Develop- ment Studio for HC(S)08/RS08 with its award winning integrated de- velopment environment (IDE) has a quick start guide which eases instal- lation and helps create a first example project, and more than 100 example \ What is the MC9S08QG8CPBE ■ microcontroller and how to get one I For next month's accelerometer project you will need to order up an MC9S08QG8CPBE as it will be the main controller in the system. It is a small (8 and 1 6 pin), fully featured micro- controller device from the Freescale S08 family. The device includes the main features shown ■ in the inset. The datasheet can be found at www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S08QG8. pdf You can get hold of free samples of the MC68HCS08QG8 DIP parts from here I www.freescale.com/webapp/sps/site/overview.jsp? 1 nodeld = 01 0984007869597059286929489&tid = FSH I Click on 8-bit microcontrollers and search for MC9S08QG8CPBE, then follow the instructi- ons to receive free samples. I YES it is a 1 6-pin DIP 1C! To place the order simply type the part number specified, click on the Order Sample button and follow the steps required to finalize the order. At any one time you can only order a maximum of four samples. Note: the supply of free samples is at the discretion and terms of Freescale and not in any way governed by Elektor Electronics 18 elektor electronics - 3/2007 Figure 5. CodeWarrior's Project Wizard in action. Full debugging on a running program can be seen here. projects are available to assist in your design efforts. The Project Wizard (Figure 5) can be used to create a working project (As- sembly or C) in as few as seven mouse clicks, and users can change target microcontrollers and the debug/Flash programming connection in an open project. The IDE features an intuitive project manager and build system; a high- ly optimized compiler; a graphical, source-level debugger; integrated pro- filing capabilities; a full chip simulator and more. The free ‘Special Edition’ of the Code- Warrior™ Development Studio for HC(S)08 and RS08 devices can be downloaded from the Freescale web site. It’s just not possible to print the exact url here as the file is behind an extensive login procedure. At the time of writing, the download is shown as a ‘Featured Tool’ on the Freescale 8-bit microcontrollers page [2]. It should be noted that the download is fairly large at about 283 Mbytes. Fortunately, the Special Edition is included on the CD- ROM you get with the Softec SpYder Discovery kit. Lots more information on CodeWarrior for various Freescale microcontroller families and platforms may be found on [3], including special releases for professional users. For a number of our readers invariably suspicious about special offers we print that CodeWarrior Special Edition allows projects of up to 64 k to be developed using assembler, and 16 k in C. An in-depth introduction to CodeWar- rior can be found in application note AN2616 [4]. In-circuit debugging can be achieved within the CodeWarrior IDE when your PC is connected to the target appli- cation with a BDM cable such as the SpYder. Next month In a follow-up article we’ll discuss set- ting up SpYder and CodeWarrior for the benefit of our first project, a 2 g, 2- axis accelerometer with LED readout, based on an MC9S08QG8CPBE micro- controller. The project will be built on two small PCBs which will come with a free gift. ( 060296 - 1 ) Web links [1] www.freescale.net/forums and http://forums.freescale.com/freescale/ board? board, id = 8BITCOMM [2] www.freescale.com/webapp/sps/site/ homepage. jsp?nodeld = 01 62468449& tid = FSH [3] www.freescale.com/webapp/sps/site/ overview.jsp?nodeld = 01 27269401 1 860 [4] www.freescale.com/files/microcontrollers/ doc/app_note/AN261 6.pdf SpYder Discovery kit Thanks to a special arrangement with Freescale Semiconductor, the Spyder Discovery kit is a available from Elektor at a price of just £ 6.45 (Euro 9.75 / US$ 1 2.70) plus postage & packing. SpYder al- lows you to program and debug code for MC9S08 micros, in conjunction with CodeWar- rior Development Studio for RS08/HC08 devices (free download or on enclosed CD-ROM). It should be noted that the photograph shows an early version of the Softec kit supplied to beta testers. The final version supplied to Elektor customers comes with an 8-pin PDIP MC- 9S08QG8 sample, and the SpYder plug-in board encapsulated in a plastic housing. 3/2007 - elektor electronics 19 INFO & MARKET GENERATORS ■jj * * “ T f'gH, i | * ir i ■ Pi Maki ■ h ► ’I -M.* 4* ¥ 1 ■ tf'i KJt w & O 0 18 function generators on * Rolf Blijleven If you want to know exactly what's happening in a circuit, you need more than just a multimeter and an oscilloscope. A signal generator that does exactly what you want is as least as important. That means you need a function generator. This article describes the technology of function generators, summarises what they must be able to do and why, and presents the results of a critical examination of 18 different models. What is the current state of the art in signal generators? To answer this question, we first did a bit of virtual shopping on the Internet. Besides 'traditional' function generators, we also found what are called 'arbitrary waveform generators (AWGs), which can be used to generate freely defined waveforms. The latter type of signal generator is frequently used in industrial applications, and it often has a price in the four- or five-figure range, with cor- responding performance (see Figure 1 for an example). Benchtop models are available starting at around £ 65, or you can use the soundcard in your PC to generate waveforms at a price of only £ 20 or less — or even for free. Such a wide range of prices makes you curious and suspicious at the same time: what can you actually do with the cheap solu- tions? Are the expensive ones perhaps too expensive? In this introduction, we try to sort out a few of these questions. The first thing we look at is the technology of function generators. Next we discuss the basic functions and the more advanced functions. We describe the indispensable features and features that are convenient, not so convenient, or actually unnecessary. Finally, we present the results of our examination of the 1 8 in- struments we were able to obtain for review. Generator electronics DD ■* j *i The tempestuous developments in the semiconductor industry in recent decades have also borne fruit for designers of signal generators. If we make a first distinction be- tween digital and analogue types, we see that the relatively inexpensive instruments fall in the analogue category. This is because nearly complete function genera- tors are available commercially in the form of ICs. Some examples are the Maxim MAX038 and the Exar XR2206. This type of 1C is built around a voltage-controlled oscillator (VCO). This is usually a relaxation oscillator (Figure 2a) with the feedback resistor R replaced by a controlled current source that charges the capacitor at an adjustable rate in order to set the frequency (Figure 2b). The oscillator produces triangular and square waveforms, and the triangle wave is tapped off to a stage that converts it into a sine wave. These three waveforms can be selected at the output.. The distortion and symmetry of the waveform can be adjusted using a po- tentiometer connected to two pins of the 1C, and there is also a TTL sync output. With only a few external components, you can easily achieve a frequency range of 0.2 Hz to 2 MHz. And as we already mentioned, it's inexpensive - the XR2206 sells for less than £ 3 in small quantities. The two most important techniques in the digital area have scarcely changed in the last ten years, but they have become less expensive. You get more waveform for your mon- ey than you did ten years ago. The 'arbitrary waveform generator' (AWG) technique takes the most direct approach. It's actually just a digital storage scope in reverse. Fig- 20 elektor electronics - 3/2007 Figure 1. The Agilent N5182MXG, a professional signal generator with maximum frequency of 6 GHz. Figure 2. Basic circuits of analogue signal generator ICs. 2a: The simplest circuit consists of an oscillator formed by an opamp, a few resistors, and a capacitor. 2b: The oscillator circuit is used as a voltage-controlled oscillator (VCO) in function generator ICs. The triangle wave is shaped into a sine wave in a separate stage. This yields a choice of three waveforms. Figure 3. Block diagram of an arbitrary waveform generator, which is actually a digital storage scope in reverse. fi 23118 3/2007 - elektor electronics 21 INFO & MARKET GENERATORS .1 I. waveshape memory 060312 - 13 Figure 4. Block diagram of a direct digital synthesis system. ure 3 shows a typical block diagram. The waveform is stored in a memory that serves as a look-up table. A clock drives an address generator that reads out memory loca- tions. The contents of the memory locations are fed to a D/A converter. Its output signal is smoothed by a filter to eliminate harmonics. The memory can be a ROM for fixed waveforms, but RAM can also be used for freely definable waveforms. In the latter case, there is always a microproc- essor or microcontroller in the picture to control the whole works. The number of bits per memory location determines the vertical resolution of the waveform. With 14 bits, each step of the waveform can assume 1 6,384 (2 14 ) different values. The number of memory locations determines the horizontal resolution of the waveform. Some instruments have clever control logic that allows segments of a wave- form to be repeated arbitrarily. A variable clock frequency or sampling rate is essential with this arrangement, since the clock has to run faster at higher frequencies. For very low frequencies, it is fairly common practice to 'freeze' each location for several clock pulses. The other digital technique is called 'direct digital syn- thesis' (DDS) (Figure 4). If you follow the signal path upstream from the output, the first things you see are the same as in an AWG: a filter, a DAC, and a waveform memory - but it's different when you get to the source. The heart of this system is the phase accumulator. It has two input signals: a clock and a number from a program- mable frequency register. It uses them to define a phase angle, which is the step size for stepping through the look- up table. For low frequencies, the number in the phase register is small, so every location (or nearly every loca- tion) of the table is accessed. The step size increases with the frequency, so the number of intermediate entries that are skipped on each step increases with the frequency. In theory, the maximum output frequency is one-half of the clock frequency, but at this point all that's left of the wave- form is the samples that define the fundamental frequency. The practical limit is thus lower. Depending on the ap- plication and the filter than is used, a frequency equal to 40% of the clock frequency can still be achieved. Figure 5. Some arbitrary waveforms produced by the M&R Systems WG-810. See the description of this instrument for details. Phase noise is an inherent aspect of DDS. The problem is that the period of the desired output signal cannot always be an integer multiple of the step size. If you try to fix this by truncation (ignoring the 'extra' portion and starting again at the beginning), you obtain a frequency error: the period is shorter, so the frequency is higher. This isn't what you want in a function generator. Another option is carrying the count, which means skipping a number of samples at the beginning of the table corresponding to the number left over at the end of the table. Although these issues must be taken into considera- tion in the design, the DDS approach has considerable advantages. First, frequency changes are very easy to implement with DDS - much easier than with an AWG. Sweeping is simply a matter of gradually increasing the frequency. Large steps and abrupt steps are dead easy (a few examples are shown in Figure 5). Second, as Figure 7. Overview of frequency ranges and related applications. 060312 - 16 22 elektor electronics - 3/2007 we already said, you get more waveform for your money nowadays, since everything (including the DAC) fits into a single 1C. The smallest member of the Analog Devices AD9800 family is the AD9833. It can handle clock rates up to 25 MHz, is housed in a 10-pin jiSOIC package, draws a scanty 30 milliwatts, and costs less than a tenner. Not so long ago, the average electronics enthusiast would have thought you were a bit crazy if you quoted specs like this. There is an abundance of potential applications for DDS ICs, such as the short-wave receiver featured in our December 2006 issue. It's thus hardly surprising that manufacturers can produce acceptable, inexpensive function generators that use a mixed form of the techniques described above, such as shown in Figure 6. Here a DDS-based clock generator drives a binary counter that reads out a fixed table from ROM. Just add a DAC and you're ready to go. Innumer- able variants are conceivable. Maybe this would be a good topic for our next design contest? This means that 1 degree of rotation corresponds to 5 Hz, so your chances of getting it right with a fiddly little knob are just about zero. The width of the frequency range is thus also significant. The total frequency range of the instrument is usually divided into several overlap- ping ranges that can be selected using a switch. A factor of 1 0 is commonly used for the for each range. For exam- ple, in the 100-kHz position you might be able to adjust the frequency from 20 kHz to 200 kHz. However, factors of 1 00 or 200 are also used. In the latter case, the range in the 1 0-kHz position could extend from 500 Hz to 1 00 kHz. The advantage if this is that you can make very broad sweeps, but the disadvantage is that it's difficult or impossible to adjust the output to a specific frequency. Before you decide on the total frequency range of a generator, you have to think about how you want to Golden Oldie Basic features What are the essential features? Every function generator worthy of the name can produce sinusoidal, triangular, and square waveforms. For the sake of completeness, a sine wave is the purest tone possible. In musical terms, it is a fundamental tone without any harmonics. This makes it the ideal waveform for making measurements on filters and determining bandwidths. A triangular waveform is a quick diagnostic aid thanks to its shape. Dips, dropouts, clipping and other forms of distortion are easy to see with a triangular waveform. It's thus a good tool for detect- ing distortion, but measuring distortion is a much more complex discipline (see inset). A square wave completes the trio. It simply switches quickly back and forth between two DC levels. This makes it suitable for use as a clock for digital circuits, but it is also indispensable for judging the stability of an amplifier stage. An amplifier stage that ex- hibits overshoot on a square-wave signal has a tendency to oscillate, and that is undesirable. One of the key qual- ity criteria for square waves is the edge steepness: the steeper the better. Adjustable duty cycle (the duty cycle is how long the signal is high during one period relative to how long it is low) is also handy for all sorts of digital applications.. Many generators incorporate this feature in the form of a symmetry adjustment, which you can use to distort the triangle wave into a sawtooth and (in many cases) to make the sine wave lopsided'. A variable DC offset rounds out the package of basic features. Countless function generator designs have been created using the Exar XR2206 1C. It also forms the basis for several especially popular instruments designed in the Elektor Electronics lab. The first design dates from December 1977, and it was exceptionally popular. We sold more than 1 0,000 PCBs for this circuit. Se- veral more designs appeared in the following years. A highly improved design appeared in the 1980s as part of our test equipment series, and we still have two working examples of this version in our lab. One of them is shown in the photo. All of the components for this circuit are still available (at least in princi- ple), so you can still build your own copy of this excellent function generator. If you visit our website, you can download a scanned copy of the article from the December 1 984 issue at no charge (look under the '1 8 Function Generators on the Test Bench' article in the March 2007 issue). Extras In many cases, you need to be able to sweep the fre- quency between two set frequencies (from low to high or the other way round). Some generators have a built-in sweep function, but many of them have a VCF input ('VCF stands for 'voltage-controlled frequency'). The volt- age applied to this input determines the frequency. This makes it possible to generate FM and FSK signals. Pre- cise frequency adjustment is in theory possible using the VCF input, and otherwise the controls must be suitable for this purpose. In the past, a large-diameter knob was often used for setting the frequency, and this was certainly not without reason. For example, suppose you want to adjust the frequency to exactly 440.0 Hz in a range that extends from 200 Hz to 2 kHz, and further suppose that the adjusting knob has a rotation range of 330 degrees. use it. Figure 7 presents an overview of the frequency ranges and typical applications in the various ranges. In this article, we describe instruments with ranges extending up to 2 MHz, with a few exceptions than reach to 1 0 or 20 MHz. Some of them show the frequency on a display, and some of the instruments with this feature also allow the frequency counter to be used with external signals. A few generators also show the signal amplitude on the display. Many generators produce a rather hefty sig- nal amplitude. A level of 1 0 V pp is not uncommon, but this is usually far too much. It must also be possible to reduce the amplitude of the output signal to the millivolt level. A built-in attenuator is convenient for this purpose, with set- tings such as -20 dB, -40 dB and -60 dB, along with a fine adjustment control. Now that we've described the technical background and features, it's time to look at the 1 8 individual instruments. 3/2007 - elektor electronics 23 INFO & MARKET GENERATORS H-Tronic FG-200 This is one of the least expensive signal gene- rators in the test. Built around a 2206, this in- strument generates sine, triangle and square waves in six selectable ranges extending from 1 Hz to 1 00 kHz, continuously adjusta- ble from 0.2 to 2.4 times the selected decade value. The frequency range thus extends from 0.2 Hz to 240 kHz. There is only one knob to set the output level, so the adjustment is rather coarse. There are two AC outputs with overlapping ranges extending from 1 0 mVpp to 1 2 Vpp, and a DC output with a range of 1 00 mVpp to 1 0 Vpp. The DC offset is conti- nuously adjustable from -5 V to +4 V. All of these measurements correspond exact- ly to the specs in the user's guide, which only amounts to two pages. The operating instructions are essentially nothing more than 'read what's next the knobs and eve- rything will be obvious'. The distortion spec is 1%. At the upper end of the frequency range, the sine wave is dented and the trian- gle wave looks like a tent with a strong side wind. Nevertheless, the FG-200 is distinctly better than the only less expensive option (soundcard function generators). If you can manage without luxury, this instrument offers outstanding value for money. Goodwill Instek GFG-801 5G It looks like something from the former East Bloc with its dark-grey case, sloping ed- ges and hooded panel, but it comes from Taiwan. The user's guide includes not only extensive specifications and an explanation of what the knobs do, but also a detailed description of the schematic. This is an analogue signal generator with all the standard features. The controls are laid out nicely and show evidence of ca- reful consideration: you can disable the offset instead of just adjusting it to zero, a two-position attenuator with steps of 20 dB enables minimum output levels be- low 1 0 mVpp, there is an inversion switch, and there is a VCF input that can be used with an external sweep signal. A small drawback is that the frequency ad- justment is rather coarse, but otherwise this is a very reasonable signal generator at a highly competitive price. ELV SFG-7002 M The German user's guide is very extensive and includes all the schematics. That's be- cause this instrument is designed as a kit, and it is also available as such (with a less expensive case) starting at about £ 90. Our test model was the most expensive (£ 138), ready-made version in a metal case. Our first impression was that it has to be located at eye level, since otherwise it's difficult to see what you're doing. It doesn't have any sort of tilt stand. It doesn't have a display, but it does have internal sweep capability in addition to the standard set of functions, as well as symmetry and off- set controls. The range switch has four po- sitions that don't do anything, but there aren't any markings on the panel for these positions, so it's probably supposed to be that way. The symmetry knob doesn't affect the sine wave, and the triangle wave turns into a DC voltage when you turn it fully to the right. Nevertheless, this is still a good choice for hobbyists in particular, since it offers a lot of capability at a low price. It is built around the MAX038, which has been discontinued, so don't wait too long. 24 elektor electronics - 3/2007 This signal generator makes a rather nice visual impression with its many pushbuttons and knobs, which can be used to set or ad- just just about everything imaginable - es- pecially if you look at the price at the same time: £ 152 ex VAT. A five-digit frequency counter provides direct readout of the fre- quency setting. We needed the spare fuse provided with this Voltcraft 7202, since it didn't do anything at first after we unpac- ked it (but it worked perfectly afterwards). The price is very competitive considering its extensive set of features (see the table), but on closer examination its specifications Voltcraft 7202 are rather weak compared with its closest neighbours in this price class. The square wave looks more like a sine wave in the upper portion of the frequency range, the adjustment is very coarse with a factor of 200 between the minimum and maximum frequencies, and the lowest output ampli- tude is 125 mVpp, which is rather high. It's made in Korea, presumably in the same factory as the FG8220, the Dynatek DSG 310 and the Voltcraft MXG-9802A. Alt- hough this is the best of the four in terms of ease of use, it unfortunately falls a bit short. Thurlby Thandar Instruments TG210 This is one of the lower-priced signal ge- nerators in the TTI product line. Compa- red with its more expensive brother, the TG513, it has a maximum frequency of 2 MHz instead of 3 MHz, no display, and only a 20-dB attenuator, but it does have a symmetry control, a DC offset control with a zero detent, a sweep input, an Aux output, and signal outputs with two different impe- dances (600 ohms and 50 ohms). The mi- nimum output level is 20 mVpp with the 20- dB attenuator selected, and it has a small dead zone when the knob is turned all the way to the left, but the knobs are still large enough for decently precise adjustment. A special feature in comparison with the other instruments is that it can also gene- rate very low frequencies - much lower than specified (we measured approxima- tely 5 milliherz). For the rest, it's a solid instrument that is pleasant to use and does what it promises plus bit more. In a word, good. It's a bit strange that although the FG200 is less expensive than the Digimess FG1 00 and has a slightly smaller feature set, it has several nice extras compared with the in- struments closest to it in its price class. It has built-in linear and logarithmic sweep functions and a frequency counter that can also be used with external signals. The fre- quency control is a ten-turn potentiometer, but unfortunately the suggestion of incre- ased accuracy is not borne out in practice. Maybe the problem is with the frequency counter, but the two least significant digits of the four-digit frequency display were al- Digimess FG200 most always flickering back and forth bet- ween two values. This was synchronised with the flashing of the Gate LED. The in- cluded user's guide is rather precursory. It doesn't say anything at all about the Gate LED, for instance, or about several other features. The instrument does have a lot of LEDs, but that's a matter of taste. Although it's a reasonably versatile instru- ment at a reasonable price, it doesn't live up to the legend of German solidity sugge- sted by its name. 25 3/2007 - elektor electronics INFO & MARKET GENERATORS Voltcraft MXG-9802A U-l iNniii'' m 5 Gw 3 This instrument is also available under the Metex brand name, and like the previously mentioned FG8220 and DSG 310, it co- mes from Korea. The four-language user's guide is limited to a brief description of the functions. The instrument has an RS232 port, but unfortunately there's no descrip- tion anywhere of how to use it. As a func- tion generator, it is reasonably complete with all the standard features and a built-in sweep function, which behaves the same way as the DWG 3 1 5 sweep (see the des- cription there). It has a 4.5-turn potentiome- ter for setting the frequency, which is better than what its companions have to offer and makes quite precise adjustment possible. Unfortunately, the frequency counter is very coarse below 1 kHz and requires a lot of juggling with the gate and reset controls. The longest gate time gives the best accu- racy, but then you have to wait around 20 seconds each time you change the frequen- cy before you can read the new value. It has two counter inputs. The high-frequency input works up to 2.7 GHz, but it gets tho- roughly confused if the input signal level drops below approximately 1 Vpp. Con- clusion: it can do a lot, but it has quite a M&R Systems WG-810 Modern styling with separate buttons for the basic functions and a menu button, selec- tion knobs, and a rotary knob for naviga- ting through the menus on the LCD screen. Everything is nicely arranged and functi- onal. Besides the standard set of signals, it can generate a sawtooth, noise, and much more: this generator can produce genuine arbitrary waveforms. It has seven built-in extra waveforms, of which two can be morphed (stretched out of shape). One of them is a square wave where you can pull the corners down toward the baseline until it changes into a sine wave, and the other is a sine wave with adjustable phase cut. With 8-bit resolution and an upper fre- quency of 1 0 MHz (hence the name), it has relatively modest resolution and distortion (see table), but its real power is hidden be- hind the rear-panel RS232 connector. In combination with the separately available Spro program or a terminal emulator pro- gram available on the Mair & Roher web- site, you can use it to download your own waveforms. A very versatile instrument at a competitive price: that's professional! B + K Precision 401 OA This rather sizeable instrument was desig- ned in the US, but it is made in Taiwan. It has a good front-panel layout. The scale of the frequency adjustment knob covers only half of its range of rotation, so there are 'dead zones' at each end. It has a sync output, which is a relatively rare feature, and it can be switched to CMOS mode. The output level can be adjusted between 4 V and 14 V in CMOS mode. The swit- ching levels of CMOS are 1 /3 and 2/3 of the supply voltage, so a lower limit of 4 V is too high if the supply voltage is 5 V or less - which is entirely possible with bat- tery-powered circuits. Maybe it's handy for working with relay control logic, but in our opinion it is of limited use. The INV knob doesn't do anything, which is irritating. The 401 OA falls short in comparison with other instruments in the same price class. The specifications are nothing special, the sine-wave distortion is quite high (4% at 1 kHz), and it takes up a lot of space on the bench. There are cheaper instruments available with better performance. 26 elektor electronics - 3/2007 Thurlby Thandar Instruments TG315 The TG315 is a midrange analogue sig- nal generator from the British firm Thurlby Thandar Instruments. It has a light-beige case and the standard set of waveforms (sine, triangle, and square), with a fre- quency range of 0.03 Hz to 3 MHz and an amplitude range of 20 mVpp to 20 Vpp. The frequency and amplitude or offset are shown on a numeric display. The frequen- cy can be adjusted over seven ranges, and the fine adjustment knob is where it should be: right below the frequency display. If you push in the symmetry knob, the frequency is divided by 1 0 and you can use a rotary knob to skew the waveform to the right or the left. This transforms the triangle wave into a sawtooth or adjusts the duty cycle of the square wave. The display shows either the peak-to-peak or RMS value of the output signal (selectable), and it is reliable even at high frequencies. That saves you an extra voltmeter. The amplitude can be attenuated by 20, 40 or 60 dB, and there are separate 50-ohm and 600-ohm outputs. It's a bit of a pity that it requires an external sweep sig- nal, but if you don't especially need sweep capability, this instrument is a good choice if you're looking for professional quality. The UK firm Vann Draper bought the Digi- mess product line of Grundig (Germany) in 2000. The FG 1 00 is also available un- der that brand name. It has fewer knobs and a smaller case than the Digimess FG 200, but it costs £60 more. For that money, you get a larger frequency range (up to 20 MHz) and an RS232 interface that can be used to control everything from a PC. Software that works with LabVIEW is available separately, but the extensive user's guide (in German and English) also includes a sample program in QBasic. The front-panel user interface is menu-driven Digimess FG 100 and reasonably intuitive, and with a bit of help from the user's guide you can master it in no time. The instrument is DDS-based; the sweep line shows distinct steps. Besides the standard set of signals, it generates ri- sing and falling sawtooth signals, and the duty cycle of the square wave is adjusta- ble. Thanks to the menu-driven interface, it cannot be set outside the specified limits (as is often the case with analogue signal generators). This is a compact, complete in- strument, and it can generate complex test sequences under software control. IDG - Oglpuli Hmj - r i mc SEG!!hL ex i i * y. 'J^SbU Q The look & feel of the case, display and knobs is the same as the FG8820, but then it comes from the same Korean factory. To summarise the differences: it costs £ 35 less, works up to 10 MHz, has a fine fre- quency adjustment, and has only one fre- quency counter input. The DSG 310 also has its own peculiari- ties. It can only sweep from low to high, and the sweep width depends on the se- lected frequency range. For instance, the range of adjustment with the 1 0-kHz setting is approximately 500 Hz to 10 kHz, which Dynatek DSG 310 is rather broad. If you set the generator to sweep mode, it starts at the set frequency and continues until the end of the selected range. In other words, with the frequen- cy knob rotated fully left, it sweeps from 500 Hz to 1 05 kHz. Naturally, your scope will throw up its hands at some point. The DG 310 is real do-it-all, but its charac- ter traits may not appeal to everybody. 27 3/2007 - elektor electronics INFO & MARKET GENERATORS ELV MFG 9001 M L $022= 1 p mm « 5 pp? f > m V v mS MS IT' * " - « B— * fr- ■ f * . The MFG 9001 comes from the German firm ELV and is available with several dif- ferent cases, either fully assembled or as a kit. The instrument we tested was housed in a solid metal case. The case is rather size- able, but the broad front panel provides a lot of functions. It has all the standard func- tions and built-in sweep. The lower and upper sweep limits can be set precisely, with a maximum width factor of 10. The built-in frequency counter can also be used with external frequencies, and it has a separate offset (a rare feature). It has a sweep output, and remarkably enou- gh, it can output signals at amplitudes down to the low millivolt level. It lacks a tilt stand, so it must be placed at eye level, and the positioning of the BNC connectors is somewhat cramped, but it is fairly easy to use - we didn't have to con- sult the user's guide (in German only). The MFG 9001 has an outstanding price/ quality ratio as a ready-made instrument, and it's a good deal better as a kit. Seintek G5100 This compact instrument is DDS-based, and it has eight programs that you can configu- re and recall as desired. That's apparently how it is intended to be used: set it up once and then leave it alone. Its capabilities are otherwise rather standard (see table). The user interface is on the difficult side: the twelve buttons for the regular functions and another eight for navigating the menu are inconveniently close together. It also has a rotary knob with clicks, but confusingly enough, only every second click does any- thing. As a result, selecting and configuring parameters takes a lot of button pushing and knob turning, but absolutely everything can be configured. Too much flexibility can create a maze. Unfortunately, the software provided with the instrument does not add any functiona- lity. You can't run a sequence of programs, which is truly a missed opportunity - this instrument is ideally suited for use in long- term testing under PC control, which ap- pears to be a more natural habitat for it than a lab bench. Goodwill Instek SFG-21 1 0 This synthesized function generator has all the standard functions and much more. It is DDS-based, so it the user interface is dif- ferent from the usual analogue generators. You can set the frequency quickly and pre- cisely by entering the value with a numeric keypad and pressing the appropriate units button. You can also select any digit of the display separately and increase or decre- ase the value by rotating a knob with a nice click action. It can also sweep, over a nar- row or wide range and slowly or quickly. Another handy feature is that you can store up to ten configurations and recall them as desired. The built-in frequency counter can also be used for external signals up to an impressive 150 MHz. It's true that the counter doesn't work properly below 9 Hz, although the specified lower limit is 5 Hz, but that's a minor detail. In terms of functi- onality, and especially in terms of ease of use, the SFG-21 00 stands head and shoul- ders above the other instruments in its price class. If you don't need an RS232 interface or frequencies above 1 0 MHz, but you do want to have a frequency counter, this is by far the best choice. 28 elektor electronics - 3/2007 FG-8220 The brand name of this instrument is un- certain. The front-panel logo can mean just about anything, and the user's guide is mum on the subject, but after a bit of detective work we figured out that it is made by the Korean firm Dagatronics. It is at the top end of the price scale, has an upper frequency limit of around 20 MHz, and has reasonably specifications (see ta- ble). All the standard features are present, and it can sweep with adjustable with and speed. You can also use it to generate FM and FSK signals: the generator provides the carrier frequency, and you provide the mo- dulation signal at the VCF input. The built- in frequency counter can also be used for external signals, and it has two inputs with separate frequency ranges.. It has a lot of bells and whistles, but we're not all that keen. The fan is noisy, the knobs are too close together, and the controls are rather coarse. The sweep profile is not a clean sawtooth, there is no amplitude display, and the frequency counter readout is in- stable and changes when you adjust the amplitude. This generator can do a lot, but there are lots of things you will have to get used to if you buy it.. Hameg's HM8000 series consists of a power supply (£ 145) in a modular case with room for two user-selected modules. Our test example was configured with a HM8030-6 function generator and a HM8021-4 1 .6-GHz frequency counter, but an LCR meter, a lab power supply, and a programmable multimeter are also avai- lable. The on/off switch is located on the mainframe, and the frames can be stacked up to 5 high. The user interface of the func- tion generator is clear and self-explanatory. It can sweep downward with a max/min frequency ratio of up to 1 0, and the sweep Hameg HM8030-6 period and limits can be set quickly and precisely. The duty cycle adjustment only affects the square wave, so you cannot use it to produce a sawtooth. There are two 20- dB attenuator buttons, and the output signal level is 5 mVpp with the total attenuation set to the maximum value of 40 dB. The specifications are impeccable, and the modular design is attractive for anyo- ne who needs at least two modules. Of course, quality and robustness rarely come cheap. This instrument at least wins the prize for the most unique styling. It has a rather high, shallow case with a front panel that leans backward slightly. It takes a bit of getting used to, but this shape makes the instrument easy to use and read. It has an especially large, clear display that shows everything at once: frequency, output voltage, offset voltage, and duty cycle. The user interface is limited to small number of buttons with clearly defined functions and a central ro- tary knob, which makes the instrument easy to use. The only thing that required a bit of puzzling was setting the sweep range. The Metrix MTX 3240 frequency range is 5 MHz, which isn't es- pecially large, but all the signals (including the square wave) look good right up to the maximum frequency. The duty cycle adjust- ment can be used skew the triangle and sine waves, as well as to adjust the sym- metry of the square wave. There is a con- nector on the back for an optical RS232 link, but the cable for this is an optional accessory. However, LabVIEW drivers are included with the instrument. Unfortunately, the user's guide doesn't say whether any other parameters can be set or program- med via the PC. 29 3/2007 - elektor electronics INFO & MARKET GENERATORS Brand & Model rrp £ (€) ex VAT f . 'nun [Hz] ^max [MHz] rise time 1 sq. wave distorsion sinewave to 1 00 kHz 2 Asymm . 3 sweep VCF in H-Tronic FG-200 76(110) 0.2 0.240 n.s. <1% X X X Goodwill Instek GFG-8015G 117(170) 0.2 2 <100 ns <1% / X ELV SFG 7002 138 (200) 0.1 10 < 12 ns <1% / lin X Voltcraft 7202 152 (220) 0.2 2 < 140 ns <1% / lin / TTi TG21 0 166 (240) 0.02 2 < 100 ns < 0.5% / X / Digimess FG200 176 (255) 0.2 2 < 100 ns <2% / lin, log / Voltcraft MXG-9802A 183 (265) 2 2 < 150 ns < 1% @ 1 kHz / lin, log / M&R Systems WG-810 197 (285) 1 2 < 50 ns <2% / lin, log / B+K Precision 401 0A 207 (300) 0.2 2 < 120 ns 4% @ 1 kHz / X / TTi TG31 5 207 (300) 0.03 3 < 100 ns < 0.5% in audio range / X / Digimess FG100 266 (385) 0.5 20 < 15 ns < 1% in audio range X lin X Dynatek DSG 310 266 (385) 0.1 10 < 35 ns <1% / lin X ELV MFG9001 M 266 (385) 0.1 20 < 12 ns 0.75% / lin / Seintek G5100 300 (435) 1 156 < 35 ns <1.5% / lin / Goodwill Instek SFG-21 10 310 (450) 0.1 10 <120 ns < -55 dBc to 200 kHz / lin, log / Uni FG8220 341 (495) 0.2 20 < 25 ns <1.5% / lin / Hameg MH8030-6 355 (515)4 0.05 10 1 5 ns typ. < 0.5% pulse lin X Metrix MTX-3240 393 (570) 0.1 5.1 < 40 ns <0.5% to 50 kHz / lin, log / Legend 5 frequency counter input for external signals / - present X = not present n.s. = not specified 6 pushbutton control for adjustable attenuation of output signal 7 Output at logic level synchronous with signal. T=TTL, C=CM0S, Cv=CM0S, variable 1 steepness of square wave 8 Displayed value for frequency (f) and amplitude (A) in volts 2 unless otherwise indicated peak to peak (pp) and/or volts effective (rms) 3 asymmetry control (duty cycle), pulse = for rectangular signal only 9 Manual supplied in language: English, German, French, Dutch, Spanish, Italian 4 £145 (€210) for mainframe + £210 (€305) for generator 10 B-c = BNC-croc clip cable; B-B = BNC-BNC cable; RS-232 = serial cable; s/w = software Brand & Model f-cnt in 5 DC offset [V] Vou, mii, [mVtt] attennation [dB ] 6 sync out 7 d f isplay 8 A manual 9 accessories 10 H-Tronic FG-200 X -4... + 5 10 X X X X E X Goodwill Instek GFG-8015G X ±10 n.s. - 20, - 40 T/Cv X X E B-c ELV SFG 7002 X ±7 n.s. - 20, - 40 T X X G X Voltcraft 7202 / ±10 125 -20 T/Cv / X E B-c TTi TG21 0 X ±10 20 -20 T/C X X E B-c Digimess FG200 / ±5 1 - 20, - 40, - 60 T / PP E,G B-B Voltcraft MXG-9802A / ±10 1 -20 T / X E, D, F, D B-B M&R Systems WG-810 / ±7 5 -20 T / PP E, G mainsadapter B+K Precision 401 0A X ±10 n.s. -20 T/Cv X X E B-c TTi TG31 5 X ±10 2 - 20, - 40, - 60 T/C / pp, rms E E Digimess FG100 X ±2,5 10 n.a. T / PP E,G B-B, B-c Dynatek DSG 310 / n.s. n.s. -20 T / X E B-c ELVMFG9001M / ±5 1 - 20, - 40, - 60 T / X D X Seintek G5100 X i+ 'Ll-! 5 -20 T / PP E B-B, RS-232, sw Goodwill Instek SFG-21 10 / ±10 24 -20 T/Cv / X E 2 x B-c Uni FG8220 / ±5 n.s. -20 T/C / X E B-c Hameg MH8030-6 / ±5 5 - 20, - 40 T / X E,G,F,Sp X Metrix MTX-3240 / ±10 1 X T/Cv / pp E, G, F, Sp, 1 X 30 elektor electronics - 3/2007 Velleman USB Function Generator • DDS generator with an 81 92-sample wave table; arbitrary waveforms can be composed on the PC • Maximum sampling rate 50 MHz Sample features: • Frequency range: 0.01 Hz to 2 MHz • Generator and PC optically isolated • Low sine-wave distortion (<0.08%) Velleman did not have any current-model function generators available in its test equipment line at the time of this review, but they indicated that an interesting new instrument would be available soon. It is a function generator with a USB port that is operated via the PC. Conclusion Regardless of whether you want to run a test signal through an amplifier stage every now and then or you spend several hours every day with your signal generator, you usually want to configure the desired signal quickly and then carry on with your work. And even if the specifi- cations of all the instruments are readily available to eve- ryone via the Internet, with the result that you can easily succumb to the temptation to buy based on specifications Using a PC as a function generator Do you like to bask in the glow of your PC monitor? You're not alone. With a bit of software, you can also use your soundcard to generate test signals. If you want more than this, you can con- sider acquiring a USB scope, since some models have a built-in function generator. Well come back to this shortly, but first let's have a look at what we found: freeware. You can't get frequen- cies above around 20 kHz from a soundcard, but the nice thing is that you can use the signals directly and you can hear what you're doing via the speakers. We found a handy little window at www.marchandelec.com, with two channels that can be set individually to output a sine wave, triangle wave, square wave, sawtooth, pulse, white noise, or pink noise. There are just three sliders: Frequency, dB Left, and dB Right. We had a look at the output with a scope. The sine wave maintains its shape nicely up to around 1 8 kHz, but the other waveforms show all sorts of dents and bumps even at low frequencies (which is something the maker warns about). A particularly handy feature of this program is that the frequency and amplitude are both continuously adjustable, so you can sweep them manually. Another program that is quite popular, although it isn't freeware, is the Soundcard Function Generator from Virtin (www.virtins. com). The demo version works for seven days, after which you can purchase a licence for $25. Here again you have two chan- nels and the standard set of signals, including two colours of noise. The frequency, amplitude, sweep time, and sweep start and end frequencies are all adjustable. Just set it up and go. It also comes with a simple scope program, but you can't make any adjustments while it's running, although you can play with the display parameters afterwards. However, we quickly deci- ded to use our own scope instead. The sine wave looks reaso- nably clean, but the amplitude starts to drop significantly above around 1 0 kHz. The program comes with a library of freely loa- dable waveforms, such as a realistic EKG pattern and a much nicer square wave than the built-in version. The file format is suitable for DIY modifications: 1024 lines containing a sample number and two Y-coordinate values. All in all, it's actually fairly versatile. If you don't have any objection to a limited frequency range, this is a nice option that costs next to nothing. On the other hand, if your ambitions are quite a bit hi- gher and you are also in- terested in acquiring some other test equipment, you should certainly consider a USB scope. We ran a comparative article on USB scopes in our September 2005 issue, but we menti- on them here because some models have a built-in func- tion generator. The HandyScope HS4 from TiePie Engineering in the Netherlands (www.tiepie.nl) is a good example. It is much more than just a signal generator, since the package also inclu- des a multimeter, oscilloscope (naturally!), transient recorder, and a spectrum analyzer. Measuring distortion according to good engineering practice, as described elsewhere in this arti- cle, is thus within the realm of possibility. The USB scope test article can be downloaded from www.elektor-electronics.co.uk. Go to the September 2005 contents page. 31 3/2007 - elektor electronics INFO & MARKET GENERATORS Measuring distortion It's surrounded by hype in the audio world, and in the telecom- munications world it can make the difference between intelligible conversation and rubbish on the line. Total harmonic distortion (THD) is the complex of distortions experienced by a signal on its way from the input to the output of an amplifier or ampli- fier stage. You can quantify it by measuring the input waveform and subtracting it from the output waveform. The difference is by definition the THD. This sounds simple, but it's far from easy. You can't do the subtraction honestly unless your measuring set- up can cancel out the effects of the gain and phase shift of the stage being measured. The compensation necessary to achieve this harbours a wealth of measurement error sources, and it is a difficult and above all time-consuming task to get them under control and keep them under control. Another technique is to employ a sinusoidal waveform as the test signal and use a notch filter to remove its frequency component from the output signal. What's left is THD. Although this ap- proach appears to be very elegant, there are lots of associated pitfalls and gotchas. For instance, the test signal must be a very pure sine wave. The average audiophile turns up his nose at anything more than 0.01% THD, so the test signal must have less than 0.05% distortion. You only find this in the more expensive class of generators. The modern technique uses a spectrum analyzer: you measure the spectrum of the test signal and run it through a Fourier anal- ysis. Here again, the input signal must have as little distortion as possible, since otherwise the distortion will appear again in the components of the analyzed output signal. alone, the 'ease of use' parameter is not something you can capture on a datasheet. Nevertheless, it is one of the most important factors - just as with every tool. That's why we focussed so much attention on it in assessing the 1 8 instruments in this test. How can you judge ease of use? To start with, the layout of the front panel must be logical, and everything must be easily accessible. This may sound obvious, but there are still instruments available where you can accidentally press two buttons instead of one, or with the knobs so close together that you sometimes nudge another one while adjusting the one you want. Next, suppose you have the instrument ready to hand, warmed up and all: how long does it take you to get a 440.0-Hz sine wave at the output? This may sound like a simple test, but the frequency adjustment of some instru- ments is so coarse that that you'll never get there. With some instruments, it's a matter of seconds, while with oth- ers it takes several minutes. The record here is held by the Seintek G5 100, which takes an especially long time to configure. However, you can recall the setting in less than 1 0 seconds once you manage to get it programmed. We also looked at functionality and quality relative to the price, and at innovative features. The situation here can be described as the history of the electronics industry in Manufacturer Type Manufacturer web address B+K Precision 401 OA www.bkprecision.com Digimess FG100/FG200 www.digimessinstruments.co.uk Dynatek DSG310 ELV SFG 7002/MFG 9001 M www.elv.de Goodwill Instek GFG-801 5G/SFG-21 1 0 www.goodwill.com.tw Hameg HM8001 + 8030 www.hameg.com H-Tronic FG-200 www.h-tronic.de Metrix MTX-3240 www.chauvin-arnoux.fr M&R Systems WG-810 www.mrsys.at Seintek G5100 www.seintek.com Uni FG 8220 www.seintek.co.kr TTI TG210/TG315 www.tti.co.uk Voltcraft 7202/MXG-9802A www.conrad.de the last three decades. The major players have survived by focussing entirely on professional users. They offer outstanding equipment, but with prices that are only suit- able for the budgets of captains of industry. We left them out of consideration here. European companies such as Thurlby Thandar Instruments and Metrix pursue the same strategy, but they still offer limited but reasonable functionality at the bottom end of their product lines, with outstanding specifications at an affordable price. Other manufacturers, such as Digimess and ELV, offer more ex- tensive options with acceptable specs, but they keep costs down by outsourcing production to the Far East. This sort of production has a history of more than 30 years in Tai- wan. Based on this experience, Goodwill Instek takes a clever approach to filling market niches. As far as we're concerned, its GFG-81 01 5G is a good choice as a basic instrument, with good specs and a very competitive price. The Koreans do not have this long experience yet, but they have an unbridled zest for work. Five of the eighteen instruments in the test come from Dagatronics in Seoul. Four of them are built around the same basic design, and they unquestionably offer a lot of functionality for a low price. They appear to be aimed at beginners, since all four have a user's guide with the same extensive section describing sample uses, and that is certainly very friendly. However, they are pervaded by an air of hasty work: the specs are mediocre and the user interface is not well thought out - you get knobs to adjust things that shouldn't be adjustable. They are also clearly oriented toward mass production: anyone can place an order today for a thou- sand generators with his own name on them and a few knobs more or less than the standard configuration, and your order will be delivered by aeroplane tomorrow. We leave the choice of the best instrument up to our read- ers, since it is ultimately a question of what you want to do with it and how much you're willing to spend. We can conclude with two honourable mentions: the Digimess FG100 and the WG-810 from M&R Systems. They are similar in terms of ease of use: clear and well thought out. The FG100 has slightly better specs, and it can perform quite complex tests under PC control, but what clearly dis- tinguishes the WG-81 0 from the rest is support for user- defined waveforms, and that at an affordable price. M&R Systems deserves to be better known. ( 060132 - 1 ) 32 elektor electronics - 3/2007 mikroElektronika DEVELOPMENT TOOLS | COMPILERS | BOOKS CAN-1 Board - Interface CAN via MCP2551 $18.00 USD CAN-2 Board - Make CAN network with SPI interface $21.00 USD RS485 Board - Connect devices into RS-485 network $17.00 USD Serial Ethernet - Make ethernet network with SPI Interface (ENC28J60) $28.00 USD Storage / RTC CF Board - Easy way to use Compact flash in your design $18.00 USD MMC/SD Board - Easy way to use MMC and SD cards in your design $18.00 USD EEPROM Board - Serial EEPROM board via I2C interface $9.00 USD RTC Board - PCF8583 RTC with battery backup $16.00 USD ADC Board - 12-bit analog- to-digital converter(ADC) with 4 inputs $22.00 USD DAC Board - 12-bit digital- to-analog converter(DAC) with SPI $18.00 USD Keypad 4x4 Board - Add keypad to your application $9.00 USD Accel. Board - Accel, is an electronic device that will measure acceleration forces $16.00 USD PICFIash with mikrolCD support PICFIash programmer - an ultra fast USB 2.0 programmer for PIC microcontrollers. Continuing its tradition as one of the fastest PIC programmer on the market, the new PICFIash with mikrolCD now supports more PIC MCUs giv- ing the developer a wider choice of PIC MCU for further prototype development. mikrolCD debugger enables you to execute mikroC / mikroPascal / mikroBasic pro- grams on a host PIC micro- controller and view variable values, Special Function Regi- sters (SFR), memory and EEPROM as the program is running $89.00 USD EasyPIC4 Development Board with on-board USB 2.0 programmer and mikrolCD 3 ini DGV6LOPM6NT SYSTEM HARDWARE ICD ON-BOARD USB 2.0 ON-BOARD PROGRAMMER HIGH DEVELOPMENT PERFORMANCE DEVELOPMENT BOARD trailers (it comes with a PIC16F877A). EasyPIC4 development board: Following in the tradition of the EasyPIC3 as one of the best PIC development systems on the market, the EasyPIC4 has more new features for the same price. The system supports 8, 14, 18, 20, 28 and 40 pin PIC microcon- mikrolCD is a highly effective tool for Real-Time debugging on a hardware level. The ICD debugger enables you to execute a mikroC/mikroPascal/mikroBasic program on a host PIC microcon- troller and view variable values, Special Function Registers (SFR), memory and EEPROM as the program is running. On-board USB 2.0 PICFIash programmer - an ultra fast USB 2.0 programmer for fast MCU programming. Continuing its tradition as the fastest PIC programmer on the market, the new PICFIash with mikrolCD now supports more PIC MCUs giving the developer a wider choice of PIC MCU for further prototype development. Package contains: EasyPIC4 development system, USB cable, Serial cable, User’s manual, MikrolCD manual, CD with software, drivers and examples in C, BASIC and Pascal language. Note: LCD, DS1820 temp sensor and GLCD are optional. EasyPIC4 Development System $119.00 USD Optional: 2x16 LCD and DS1820 temperature sensor $15.00 USD Graphic LCD 128x64 dots $17.00 USD mikroElektronika Compilers Pascal, Basic and C Compilers for various microcontrollers Supporting an impre- ssive range of micro- controllers, an easy- to-use IDE, hundreds of ready-to-use func- tions and many inte- grated tools makes MikroElektronika co- mpilers one of the best choices on the market today. Besides mikrolCD, mikroElektro- nika compilers offer a statistical module, simulator, bitmap generator for graphic displays, 7-segment display conversion tool, ASCII table, HTML code export, communications tools for SD/MMC, UDP (Ethernet) and USB , EEPROM editor, programming mode manage- ment, etc. Each compiler has many routines and examples such as EEPROM, FLASH and MMC, SD and CF card reading/writing, writing to charac- ter and graphic LCDs, manipulation of push-buttons, 4x4 keyboard and PS/2 keyboard input, generation of signals and sounds, character string manipulation, mathematical calculations, I2C, SPI, RS232, CAN, USB, RS485 and OneWire communications, Manchester coding management, logical and numerical conversion, PWM signals, inter- rupts, etc. The CD-ROM contains many ready-written and tested pro- grams for use with our development boards. Regular price: mikroBasic(PIC) mikroPascal(PIC) mikroC(PIC) Price with discount: $149.00 USD mikroBasic(PIC) (-30%) $149.00 USD mikroPascal(PIC) (-30%) $249.00 USD mikroC(PIC) (-30%) $99.00 USD $99.00 USD $175.00 USD - All of our products are shipped in special protective boxes. -On-line secure ordering provides a fast and safe way to buy our products. mikroBasic(AVR) mikroPascal(AVR) $149.00 USD rnikroBasic(AVR) (-30%) $99.00 USD $149.00 USD rnikroPascal(AVR) (-30%) $99.00 USD mikroBasic(dsPIC) $149.00 USD mikroPascal(dsPIC) $249.00 USD mikroC(dsPIC) $249.00 USD mikroBasic(dsPIC) (-30%) $99.00 USD mikroPascal(dsPIC) (-20%)$199.00 USD mikroC(dsPIC) (-30%) $175.00 USD Find your distributor: http://www.mikroe.com/en/distributors/ LV24-33 Development Board The Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD System supports 64, 80 and 100 pin PIC24F/24H/dsPIC33F microcontrollers (it comes with PIC24FJ96GA010 - PIC24 16-bit Microcontroller, 96 KB Flash Memory, 8 KB RAM in 100 Pin Package). Examples in BASIC, PASCAL and C are included with the system. You can choose between USB or External Power supply. LV 24-33 has many features that makes your development easy. Explore new PIC24F/24H/dsPIC33F PIC MCU's with LV 24-33 and experience all advantages of this microcontrollers. LV24-33 Development System $149.00 USD Uni-DS 3 Development Board with on-board USB 2.0 programmer System supports PIC, AVR, 8051, ARM and PSoC microcontrollers with a large number of peripherals. It is enough to switch a card and continue work- ing in the same development environment but with a different chip. UNI-DS3 has many features that makes your development easy. You can choose between USB or External Power supply. Each MCU card has own USB 2.0 programmer on it ! Uni-DS 3 Development System [with one MCU card] $199.00 USD dsPICPR02 Development Board with on-board USB 2.0 programmer System supports dsPIC microcontrollers in 64 and 80 pin packages. It is delivered with dsPIC30F6014A microcontroller. The dsPICPR02 develop- ment system is a full-featured development board for Microchip dsPIC MCU. dsPICPR02 board allows microcontroller to be interfaced with external cir- cuits and a broad range of peripheral devices. This development board has an on-board USB 2.0 programmer and integrated connectors for SD/CF memory cards, 2 x RS232 port, RS485, CAN, DAC etc.. dsPICPR02 Development System $239.00 USD EasyARM Development Board with on^board USB 2.0 programmer EasyARM board comes with Philips LPC2214 microcontroller. Each jumper, element and pin is clearly marked on the board. It is possible to test most of the industrial needs on the system: temperature controllers, counters, timers etc. EasyARM has many feature to make your development easy. One of them is on-board USB 2.0 programmer with automatic switch between ‘run’ and ‘programming’ mode. Examples in C language are provided with the board. EasyARM Development System $149.00 USD Easy8051A Development Board with on-board USB 2.0 programmer System is compatible with 14, 16, 20 and 40 pin microcontrollers (it comes with AT89S8252). USB 2.0 programmer is built in and programming can be done without removing the microcontroller. Many industrial applications can be tested on the system : temperature controllers, counters.. Easy8051A development system is a full-featured development board for 8051 microcon- trollers. It was designed to allow students or engineers to easily exercise and explore the capabilities of the 8051 microcontrollers. Easy8051 A Development System $114.00 USD BIGPIC4 Development Board with on-board USB 2.0 programmer and mikrolCD Following in the tradition of its predecessor, the BIGPIC3 as one of the best 80-pin PIC development systems on the market, BIGPIC4 continues tradition with more new features for same price. System supports the latest 64 and 80- pin PIC microcontrollers (it is delivered with PIC18F8520). Many ready made examples guarantee successful use of the system. Ultra fast on-board pro- grammer and mikrolCD (In-circuit Debugger) enables very efficient debug- ging and faster prototype developing. Examples in C, BASIC and Pascal lan- guage are provided with the board. BIGPIC4 Development System $132.00 USD EasyAVR4 Development Board with on-board USB 2.0 programmer System supports 8, 20, 28 and 40 pin microcontrollers (it comes with ATMEGA16). Each jumper, element and pin is clearly marked on the board. It is possible to test most of the industrial needs on the system: temperature controllers, counters, timers etc. EasyAVR4 is an easy to use Atmel AVR development system. On-board USB 2.0 programmer makes your develop- ment easy. Examples in BASIC and Pascal language are provided with the board. EasyAVR4 Development System $114.00 USD EasyPSoC3 Development Board with on-board USB 2.0 programmer System supports 8, 20, 28 and 48 pin microcontrollers (it comes with CY8C27843). Each jumper, element and pin is clearly marked on the board. EasyPSoC3 is an easy to use PSoC development system. On-board USB 2.0 programmer provides fast and easy in system programming. EasyPSoC3 Development System $169.00 USD EasydsPIC3 Development Board with on-board USB 2.0 programmer System supports 18, 28 and 40 pin microcontrollers (it comes with dsPIC30F4013 general purpose microcontroller with internal 12 bit ADC). EasydsPIC3 has many features that make your development easy. Many ready made examples in C, BASIC and PASCAL language guarantee suc- cessful use of the system. On-board USB 2.0 programmer allows for faster prototype development. EasydsPIC3 Development System $119.00 USD Please visit our web page for more info http://www.mikroe.com HARDWARE SOLUTIONS FOR EMBEDDED WORLD SOFTWARE AND HANDS-ON USB DESIGN Design: Michael Odenwald en Michael Keller, Commitor GmBH Is it possible to use a microcontroller from the pre-USB era to fashion a USB device without using additional ICs? The designers set themselves this question a while ago. Many long evenings later, the answer proved to be 'yes'. As a result, we can now present a USB I/O board based on a standard AVR microcontroller - without any special USB chips! USB interfaces in embedded devices are commonplace nowadays. A varie- ty of circuits with USB interfaces have already appeared in the pages of Ele- ktor Electronics. Particularly with the availability of special-purpose chips from our Scottish friends at FTDI (and other manufacturers), it has become very easy to include a USB interface in a design. If you are looking for a more tailored so- lution, you can also take advantage of several microcontrollers that come with built-in USB interfaces. However, this solution requires a rather good under- standing of the USB bus. The firmware must process the data packets received from the USB bus and transmit its own packets via the bus. If the device is not a standard USB device, you also need a special device driver - and you will have to write it yourself. 1 00% soft It’s also possible to fit a USB interface in an FPGA, as we showed in our FPGA Course published as a series of instal- ments from April 2006 through Febru- ary 2007. In that case, we put an 8051 microcontroller core with an additional USB interface in the FPGA. This was our first ‘100% software’ USB device. The device described in this article shows that a standard AVR microcon- troller can also communicate via the USB bus with the aid of only three re- sistors (Figure 1). Besides processing the data packets, the microcontroller handles communication at the bit level. The firmware looks after this entirely on its own. You may be thinking that the AVR has to run at high clock speed to manage all this, but that’s not true at all. The microcontroller operates with a 12- MHz clock here, but its maximum rat- ed clock speed is 16 MHz. It thus has room to spare. USB specifications The USB specifications [1] clearly in- dicate that the USB bus uses a serial data protocol. Data is transmitted on two bidirectional lines. These lines (D + and D-) transmit the data in differen- tial mode. This means that the signals on the D-l- and D- lines are opposite to each other. An exception to this rule is made for synchronisation purposes: the signal levels on both lines are set low in that case. Our device operates in the Low Speed mode, which means the data transmis- sion rate is 1.5 Mbit/s. Communication at the bit level thus places some spe- cific demands on the microcontroller. In physical terms, it must have at least two bidirectional ports. It must also be able to read and process the status of these ports very quickly in software in order to keep pace with the data rate. There are also numerous other require- ments, but for now the only thing you need to know is that each transaction is initiated by the host device (usually a PC). If the host wants to read data from the connected device, the device must respond by sending back the data. The data is transmitted in data packets, which must also comply with various requirements. There are also several built-in mecha- nisms to ensure that the host can de- tect new USB devices and assign them addresses. This is all related to the ‘plug-n-play’ concept. The idea is to minimize the actions that users must perform in order to use USB devices. Electronics The electronic portion of this design is fairly standard (aside from the USB connector). The AVR microcontroller (IC3) forms the heart of the circuit (see Figure 1). Crystal XI sets the clock rate to 12 MHz. The circuit has three analogue inputs and five digital inputs, which are avail- able on connector K2. These lines are routed directly to the I/O pins of the microcontroller, and they are fitted with 100-kQ pull-down resistors. The resistors prevent the inputs from gen- Figure 1. As you can easily see from the schematic diagram, the microcontroller forms the heart of the circuit. 34 elektor electronics - 3/2007 jay" UKI — — — U U -J ■-H - ■-j" A development board with a software-defined USB interface erating annoying problems due to stat- ic charges if they left open. The circuit also has a temperature sen- sor (IC2). This is a ‘1-wire’ chip, which means that only one I/O pin is neces- sary to use the sensor. The input op- tions are rounded out with five push- button switches. The circuit is fitted with an LCD that is driven using four data bits and the usual control signals. The microcontrol- ler can also drive five relays. There an LED for each relay to indicate whether the relay is actuated. The USB port is extremely simply with regard to the electronic components. Resistor R4 causes the host to recognise that a Low-Speed device is connect- ed to the USB port. Resistors R6 and R7 provide current limiting in case of problems. They also have the pleasant 5V o ici MC7805BT i S5 1 S4 S3 1 S2 1 SI | , , ©L- OL, ^Lj Q |, , ™ 0™ oP pP qP si S2 S3 S4 S5 AIN1 AIN2 AIN3 "NX cDcor-'-coLn-'d-cocNj R3 T GND 8x 100k GND 5V |R8 H 5 V 1 r K2 i "0 0 0 0 0 0 0 0 0 0 AIN1 2 AIN2 3 f AIN3 4 DIGIN 1 5 DIGIN2 6 DIGIN3 7 DIGIN4 8 DIGIN5 9 W— 10 5V AIN1 AIN2 AIN3 DIGIN1 DIGIN2 DIGIN3 DIGIN4 DIGIN5 GND OSV 22u 20V GND K4 PROG - ~ll — 100n CM CO o C C !> 6 ? 9 !> c ) d j> c j> 10 r*«- CD GND 5V o o o LI- LLI \ledi 1 > OZ < 40 AIN1 / \LED2 2 PB0 (XCK/T0) PA0 (ADC0) 39 AIN2 / \LED3 3 PB1 (T1) PA1 (ADC1) 38 AIN3 / \LED4 4 PB2 (AIN0/INT2) PA2 (ADC2) 37 SI / \LED5 5 PB3 (AIN1/OC0) PA3 (ADC3) 36 S2 / \mosi 6 PB4 (SS) PA4 (ADC4) 35 S3 / \miso 7 PB5 (MOSI) PA5 (ADC5) 34 S4 / \SCK 8 PB6 (MISO) IC3 PA6 (ADC6) 33 S5 / PB7 (SCK) PA7 (ADC7) D- 14 ATmega32-16PC 22 RS / \ LED1 1 D+ 15 PUU (KXU) PCU (SUL) 23 R/W / \ LED2 2 16 PD1 (TXD) PCI (SDA) 24 EN / \ LED3 3 \DIGIN2 17 PD2 (INTO) PC2 (TCK) 25 DIGIN 1 / \ LED4 4 \0NEWIRE18 PD3 (INTI) PC3 (TMS) 26 D4 / \ LED5 5 \DIGIN3 19 PD4 (OC1B) PC4 (TDO) 27 D5 / \ MOSI 6 \DIGIN4 20 PD5 (OC1A) PC5 (TDI) 28 D6 / V MISO 7 \DIGIN5 21 PD6 (ICP) PC6 (TOSC1) 29 D7 A SCK 8 PD7 (OC2) PC7 (TOSC2) \ RESET 9 9 RESET □ Q z z —1 iS —1 2 o o X X RESET S6 RESE7j GND : 1 C8 18p XI I I 12MHz / /// D4 D5 D6 [~D7 \ D 8 D IC4 C9 18p GND INI OUT1 IN2 OUT2 IN3 OUT3 IN4 OUT4 IN5 OUT5 IN6 OUT6 IN7 OUT7 IN8 OUT8 GND K 18 17 16 15 14 13 12 11 10 ULN2803A C7 I lOOn I RIO GND K5 LCD /// zzz/ COM NC NO COM NC NO COM NC NO COM NC NO COM NC NO 060276- 11 3/2007 - elektor electronics 35 HANDS-ON USB DESIGN proper- ty of reduc- ing reflections on the data lines, which helps reduce errors. The D+ and D- signal lines are connected to separate I/O pins of the microcontroller. D+ is also con- nected to the INTO input of the micro- controller. This makes it possible to generate an interrupt each time the signal level on the D+ line changes. Don’t be misled by the fact that the D+ and D- lines are connected to the UART pins of the microcontroller. The software uses these two pins as nor- mal I/O pins. The built-in UART of the microcontroller is not used for the USB interface. The PCB track and component layouts are shown in Figure 2. Power supply An AC mains adapter is suitable for powering the entire circuit. In princi- ple, it is also possible to power USB devices from the host, but this option is not suitable here. According to the specifications, the voltage on the USB bus can range from 4.4 V to 5.25 V. However, voltages seen in practice of- ten differ from the specifications. With regard to current consumption, the maximum current a device is allowed to draw before enumeration (see in- set) is 100 mA. During the enumeration process, the device states how much current it wishes to draw from the USB port (up to a maximum of 500 mA). In this case, we need a minimum voltage of 5 V for the microcontroller. Although it would be possible to use a step-up Figure 2. The microcontroller also occupies the central position on the circuit board. As you can see, there is a wealth of I/O options. 36 elektor electronics - 3/2007 con- verter to boost the voltage on the USB port to 5 V if it is too low, this would increase the current con- sumption. It could also gen- erate noise (and thus problems). Our aim here is to create a reliable DIY design that is also reliable in oper- ation, so we chose the simple solution of a standard power supply using an AC mains adapter. Diode D1 protects the voltage regulator (IC1) against re- verse-polarity connection of the mains adapter. Firmware Naturally, the driving force of this project is the firmware. The firmware consists of several modules, which are predominantly written in C. Assembly- language code is only used for driving the USB lines, since it is faster. The device descriptor is located in the usb.h file. During the enumera- tion process, the host uses the data in the device descriptor to determine what sort of device is connected. If you want to adapt the circuit to your own purposes (or just play with it), this is where you can ensure that the host recognises your device correctly. Of course, this requires a certain amount of knowledge of the USB protocol. The avr-usb.h file contains a list of re- quests that are supported by the con- nected device. The host can send a re- quest to the device, which performs the associated action in response. Some examples of typical actions are clearing the LCD, actuating or releas- ing a relay, and so on. In some cases, the request requires the device to re- turn data to the host. One example of this is reading the temperature. COMPONENTS LIST Resistors R1 = 4kQ7 R2,R4,R5 = IkQ R3 = SIL array 8x 1 OOkQ R6,R7 = 68D R8 = 1 OkQ R9 = SIL array 8x 470D RIO = 1 OOQk PI = 1 OkD preset Capacitors Cl = 22jnF 20V radial C2,C4,C5,C6,C7 = lOOnF C3 = 47juF 20V radial C8,C9 = 1 8pF Semiconductors D1 = 1N4001 D2-D1 1 = low-current LED, red, lead pitch 2.5mm IC1 = 7805CP IC2 = DS1820 IC3 = ATmega32-l 6PC (programmed, E- SHOP# 060276-41) IC4 = ULN2003A Miscellaneous K1 = 2.5mm mains adaptopr socket K2= 10-way PCB terminal block, lead pitch 2.54 mm (e.q. Phoenix contact # 1725737) K3 = USB-B connector K4 = 1 0-way boxheader K5= 1 4-way pinheader K6-K10= 3-way PCB terminal block, lead pitch 2.54mm (e.g. Phoenix contact # 1725669) Rel -Re5 = 5V relay (e.g. OMRON G5V-1-DC5) S1-S6 = pushbutton (e.g. OMRON B3F-1002) XI = 12MHz quartz crystal, HC49/U case LCD module, 2x16 characters PCB, E-SHOP # 060276-1 Compiling The complete firmware, including the assembly-language code, can be com- piled using the AVR GCC compiler [2], which is a (free) open-source compiler. There is also a downloadable ‘make’ file, which makes the compilation proc- ess a lot easier (see [3]). The circuit has a programming inter- face, so you can program new firmware into the microcontroller while it is fit- ted to the board (‘in system’). However, you must set the proper fuse bits for this, since otherwise the entire process won’t work. The palmaver site [4] de- scribes a convenient way to determine the proper configuration bytes. You can determine the right settings for this circuit by entering ‘0x3fDf’ in the box at the upper right (see Figure 3). This corresponds to programming the BOD- Figure 3. It's easy to determine the right fuse settings with this handy online tool [4]. 3/2007 - elektor electronics 37 HANDS-ON USB DESIGN Enumeration The host device must perform a process called 'enumera- tion' before it can use a connected USB device. The first step in the process takes place in he USB device, where a pull-up resistor in the device signals its presence on the USB bus. In the case of a Low-Speed device (1 .5 Mbit/s), the pull-up resistor must pull the D- line to +3.3 V. In the case of Full- Speed (12 Mbit/s) and High-Speed (480 MB/s) devices, the D+ line must be pulled to +3.3 V. In response to the change in the signal level on the data line, the host uses a predefined protocol to try to determine what sort of device is connected to the USB port. Besides the ex- pected data (such as the VID and PID), the device must also report which class it belongs to, along with other information such as its version number, name, and so on. A USB address is also assigned to the device. The host uses the addresses to distinguish the different USB devices. The information described above enables the host to deter- mine which device driver it needs in order to use the device. Figure 4. USBview gives you a bird's-eye view of everything connected to the USB. LEVEL, BODEN and SPIEN bits (set- ting them to logic 0) and leaving the other bits unprogrammed (logic 1). Assembly and testing The circuit should be easy to assemble if you use the accompanying PCB de- sign. The circuit does not include any difficult SMD components, and every- thing is readily available. The PCB is also available from our E-SHOP [3]. After soldering all the components in place, inspect the results careful- ly to ensure that all the solder joints are good and you haven’t created any shorts. It’s also a good idea to double- check the values of the resistors and capacitors and verify that all the ICs are oriented correctly in their sockets. Once you have completed the inspec- tion, you can start testing the board - cautiously of course! First connect an AC mains adaptor with a DC out- put voltage of 9-12 V. If everything is as it should be, LED D2 will light up. Next, connect the circuit to a PC via a USB cable. LED D3 should also light up now. Windows (assuming you are running Windows) will then start the enumeration process. You can skip installation of the driver for now, since you don’t yet have a spe- cific driver for this circuit. The driver (which is also open-source software) is described in the ‘Universal USB Driver’ article in this issue. USBview You don’t necessarily need a driver to test USB communications. Instead, you can use Microsoft’s USBview utility. This program is included in the Micro- soft Driver Development Kit (DDK) [5]. You can use it to view the data from the device descriptor of the USB device (see Figure 4). This program works without a device driver. You can test USB communica- tions by viewing the data from your de- vice in the USBview window. All the data you see there comes from the de- vice and is sent to the PC via the USB bus. If all the test results are positive, the hardware is ready and you can start working on the device driver. Refer to the ‘Universal USB Driver’ article else- where in this issue for the details. ( 060276 - 1 ) Web links m www.usb.org/developers/docs.html [2] winavr.sourceforge.net/ [3] www.elektor-electronics.co.uk [4] palmavr.sourceforge.net/cgi-bin/fc.cgi [5] www.microsoft.com/whdc/devtools/ddk/ default.mspx 38 elektor electronics - 3/2007 Paltronix Limited www .paltronix.com Microcontroller Development Tools PICmicro Starter Pack now with ICD — still £99 • High-quality development board with on-board USB programmer and built-in I/O devices. • Supports 8, 14, 18, 20, 28 and 40- pin PICs in 10F, 12F, 16F and 18F families. • Now features mikrolCD in-circuit debugger. • Supplied with PIC16F877A. The new EasyPIC4 development board now supports even more PICs including 8, 14, 18, 20, 28 and 40-pin devices from the 10F, 12F, 16F and 18F families. With its on-board USB programmer, mikrolCD in- circuit debugger and useful I/O devices, the EasyPIC4 must be the best-value development board on the market. Our Starter Pack in- cludes the EasyPIC4 board, USB cable, 16x2 LCD, 128x64 GLCD, DS1820 temperature sensor and a starter’s guide with example pro- grams in assembly language, BASIC, C and Pascal. PICmicro BASIC, C and Pascal Compilers — from £59.50 • Easy to use with user-friendly IDE. • Features simulator and mikrolCD in-circuit debugger. • Plentiful ready-written routines and example programs. • 30% discount for customers pur- chasing EasyPIC4/BIGPIC4 devel- opment boards. MikroElektronika’s popular mikroBASIC, mikroC and mikroPascal compilers now include the mikrolCD in-circuit debugger for use with the EasyPIC4 and BIGPIC4 development boards — programs can now be executed on a target PIC with variable values, special function registers, memory and EEPROM viewed on the PC screen. Great value at £85 each for mikroBASIC/mikroPascal and £145 for mikroC, or when bought with an EasyPIC4/BIGPIC4 only £59.50 each for mikroBASIC/mikroPascal, and £101.50 for mikroC. We also stock development tools for 8051, ARM, AVR, dsPIC, PICmicro, PSoC and other devices — please see our website for details Educational Products PICmicro Microcontroller Training System — £99 Digital Logic Training System — £99 • Teaches both assembly language programming and interfacing. • Based on the popular PIC16F877A. • Includes USB programmer. • Features built-in I/O devices and solderless breadboard. • Supplied with tutorial and program examples. • Ideal for learning about and experi- menting with digital logic devices. • Built-in logic and pulse switches, LEDs, 7-segment displays, piezo speaker, pulse generator, logic probe and solderless breadboard. • Supplied with useful range of ICs, jumper wire and mains adapter. The PICmicro Microcontroller Training System is an ideal platform for students and hobbyists alike to learn about PIC microcontrollers. The experiment board features a range of built-in I/O devices and a solder- less breadboard on which experiments may be conducted. Circuits are connected using the provided jumper wires. A USB programmer is also supplied and connects to the experiment board to program the PIC. Also included are a mains power adapter, 16x2 character LCD, connecting leads and a tutorial with example programs. The Digital Logic Training System makes learning about digital logic and experimenting with discrete logic ICs easy. The experiment board features a range of built-in I/O devices and a solderless breadboard on which experiments may be conducted. Circuits are connected using the provided jumper wires and the system includes features such as a power supply, pulse generator and logic probe. Also included is a mains power adapter, selection of ICs and a tutorial with example circuits. 1 We also stock other trainers, circuit labs and solderl l ess breadboards — please see our website for details Robots and Accessories Test Equipment Robo-BOX 3.0 Robot Kit — £99 PoScope USB Oscilloscope/Logic Analyser — only £99 • Complete robot kit including con- troller, programming software and all mechanical parts. • Build different robot configura- tions from one kit, including wheel-based and track-based. • Program intelligence to follow light, detect collisions and trace lines. • Low-cost PC-based instrument featuring oscilloscope, spectrum analyser, logic analyser, pattern generator, and chart recorder. • Decodes serial buses including UART, SPI, I2C and 1-wire. • Supplied with logic analyser test lead set, two oscilloscope probes, USB cable and software. Learn about, experiment and have fun with robotics with Robo-BOX 3.0 — an incredibly easy-to-build yet adaptable and expandable robot. Various wheel-based and track-based robots can be built from the standard kit including light-following, collision-detecting and line- tracing models. Programming is carried out in graphical Logo. A range of low-cost options allow for easy expansion and the development of more sophisticated robots. We also stock similar robot kits based on PICmicro, 8051 and 68HC11 microcontrollers. PoScope has to be one of the best-value pieces of test equipment available and features a dual channel oscilloscope (100Hz to 200kHz sample rate), 16 channel logic analyser (1kHz to 8MHz sample rate), and 8-channel pattern generator (1kHz to 1MHz). What makes the PoScope really useful to those working with microcontrollers is its ability to decode serial communications including RS-232, I2C, SPI and 1-wire. Priced at only £99, the PoScope comes with a USB cable, logic analyser test lead set, two oscilloscope probes and software. Tel: 0845 226 9451 Fax: 0845 226 9452 Email: sales@paltronix.com All prices exclude UK delivery (£5 standard/£10 next-day) and VAT. Major credit and debit cards accepted. Secure online ordering. TECHNOLOGY MICROCONTROLLERS Universal USB Device Michael Odenwald, Michael Keller and Paul Goossens Designing your own USB device can be an enjoyable task for electronics hobbyists. The main stumbling block is often the driver for the device. Writing this piece of software can be a bit too difficult for many people. A universal USB device driver, which is also open source, presents the solution! Figure 1. These are the steps you'll come across when creating the INF file for the universal USB driver. iM I I" ■H-r- 1 A n wi ra cm- Will MOM 0 i i i ■■ i ■ I J*l J ^3 "-Hi* I Ttl w*ih n* In* When designing USB devices you also need to write an associated device driver. For many designers this is a very tricky task and many won't even attempt such a project because of this. This is now all set to change! With the help of our AVR USB board well show you how we tackle this driver problem, using an existing universal open source device driver program. Connections Everything went smoothly as far as the hardware for our AVR USB board was concerned, until we connected it to the PC. Windows (XP) then politely asks us for a device driver, as expected. And this doesn't exist (yet) for our hardware. To help us out we made use of 'Iibusb-win32', a universal open source USB device driver [1]. This comes as a DLL and lets Windows applications communicate directly with a USB device. With this we can deal with the (device dependent) data stream in a Windows application and there is no need for a specially written device driver. Unlike the way a 'normal' device driver functions, Iibusb-win32 lets us use an API (Application Programming Interface) instead of having to communicate via a so-called IOCTL (Input/Output ConTroL). 40 elektor - 3/2007 Driver Say goodbye to connection problems Let's get busy! First we have to download Iibusb-win32 and extract all files from this ZIP file in their own folder. Before we can use this driver we first have to create an INF file. This file tells Windows which driver belongs to which device. The creation of this INF file is made very easy by the inclusion of a program in Iibusb-win32 ('inf-wizard.exe'). The INF file is created as follows: Power up the AVR USB board and connect it to the PC. Windows will now ask for the driver. Click on 'Cancel'. Start the program 'inf-wizard.exe'. In the first window click on 'Next', after which the second window appears. This contains a list of all the connected USB devices. Select our AVR USB board, with a VendorlD of 0x0C7D and a ProductID of 0x0006, and click on 'Next'. In the third window we can give the device a different name, if required. This isn't necessary, so we click on 'Next' again. The program now reports that it has generated an INF and a CAT file. Click on 'Finish' to close the program. (See Figure 1.) Initial test We now have to disconnect the AVR board from the PC and then reconnect it again. Windows will ask for the driver program once more. This time, select the option 'Specify a location' and browse to the INF file that we created with 'inf-wizard.exe'. If everything goes to plan, Windows will install the device driver. From the Device Manager in Windows you should now be able to see the AVR USB board. Applications We can now use the AVR USB board in our applications. On the Elektor Electronics website are a few downloads for this project, which contain several applications (in- cluding the source code) for controlling the AVR USB board. These applications have been written in C, . NET and a few other languages. You can use the source code as the basis for your own applications. The testing of all functions of the AVR USB board is very easy with the program 'AVR-USB-Windowsl .exe'. With this you can test all I/O capabilities of the hardware. A closer look at the source code To give you an idea how we can control our USB device from within an application, we'll show you a few parts of the source code. The saying 'a picture is worth a thou- sand words' also applies to source code! In Listing 1 you can see how the application searches for a specific USB device. If it is found, a connection with this device is initiated. In a for-next loop all of the available USB busses of the computer are interrogated. The VendorlD and Produc- tID of every USB device connected to each bus are requested. When both the VendorlD and ProductID have Listing 1 Globale variabele: usb_dev_handle *usbIODevice ; /* The usb device handle */ Funktie : int searchUSBDevice ( int vendorlD, int productID) { struct usb_bus *busses; struct usb_bus *bus; struct usb_device *dev; if (usbIODevice != NULL) { usb_close (usbIODevice) ; } usbIODevice=NULL ; /* Find the device for the given vendorlD and productID*/ usb_init ( ) ; usb_find_busses () ; usb_find_devices () ; busses = usb_get_busses ( ) ; for (bus=busses; bus; bus=bus->next) { for (dev=bus- >devices ; dev; dev=dev- >next ) { if (dev- >descriptor . idVendor == vendorlD && dev- >descriptor . idProduct == productID) { usbIODevice=usb_open (dev) ; if (usb_set_configuration (usbIODevice , 1)) return 0; if (usb_claim_interf ace (usbIODevice , 0)) return 0; return 1; } } } return 0 ; } the required values the program tries to 'open' this device. The 'handle' for this device is stored in the global variable 'usb_dev_handle'. The last step is to configure the device according to the USB standard and claim exclusive rights to the use of this device. When no unexpected errors occur the function will return the value '1 ' to indicate that everything went well. If any- thing went wrong the function will return the value 'O'. Hardware control Controlling the hardware is also very simple. In Listing 2 you can see how the status of the digital inputs is read. This assumes that the function 'searchUSBDevice' (from listing 1) has previously been called to assign a valid 3/2007 - elektor 41 TECHNOLOGY MICROCONTROLLERS handle to / usb_dev_handle / . With the help of 'sendUSBVendorCmdln' we send the command / AVR_USB_READ_DIGITAL / . This command can also be found in the source code of the firmware. With this we also specify from which port we want to read (the second parameter). The result is put into the array 'iodata'. The application can then use these returned values to determine what the status of the relevant digital input is. Experimenting The best way to familiarise yourself with this software is to go through the examples. The examples avr-usbl to avr-usb4 (which can be downloaded from [2]) can all be compiled using GCC [3]. (GCC stands for GNU Compi- ler Collection, a free ANSI-C compiler with support for K&R C, C++, Objective C, Java, and Fortran.) The other examples have been written in C#. With the many examples available, you should be able to write applications for the AVR USB board in other deve- lopment environments under Windows as well. And finally ... For ideas or help when you get stuck you should take a look at the forum for the open source driver [4]. In here you'll find many enthusiastic programmers who pass on useful information, and you can also ask questions. You can of course also use our own forum on the Elektor Electronics website to share your experiences with other readers. For those of you with a grasp of foreign langua- ges it would also be useful to visit the forums of our French, German or Dutch websites. Here you'll undou- btedly find other electronics hobbyists who'll make worth- while contributions to this project and who in turn would be interested in your experiences. ( 060226 - 1 ) Weblinks [1 ] http://libusb-win32.sourceforge.net/ [2] http://www.elektor-electronics.co.uk/ [3] gcc.gnu.org [4] http://sourceforge.net/forum/?group_id = 781 38 Listing 2 int digiportTest (void) { int i ; int result; unsigned char iodata [8]; printf ( "digiport : AVR-USB get value from digital input Port : \n\r" ) ; for ( i = 0 ; i < = 1 0 0 0 ; i + + ) { if ((result = sendUSBVendorCmdln ( AVR_U S B_READ_D I G I TAL , printf („Error sendUSBVendorCmd %d", result); printf ( „digital in status PI is %s\n\r", (iodata[0]) ? if ((result = sendUSBVendorCmdln ( AVR_U S B_RE AD_D I G I TAL , printf ( „Error sendUSBVendorCmd %d", result); printf ( „digital in status P2 is %s\n\r", (iodata[0]) ? if ((result = sendUSBVendorCmdln ( AVR_USB_READ_DIGITAL , printf („Error sendUSBVendorCmd %d", result); printf („digital in status P3 is %s\n\r", (iodata[0]) ? if ((result = sendUSBVendorCmdln ( AVR_USB_READ_DIGITAL , printf ( „Error sendUSBVendorCmd %d", result); printf ( „digital in status P4 is %s\n\r", (iodata[0]) ? Sleep (500) ; } AVR_USB_DIGITAL_P1 , „ close" : „open") ; AVR_U S B_D I G I T AL_P 2 , „ close" : „open") ; AVR_U S B_D I G I T AL_P 3 , „ close" : „open") ; AVR_U S B_D I G I T AL_P 4 , „ close" : „open") ; return 0 ; } 0, iodata, 0, iodata, 0, iodata, 0, iodata, 8) ) < 0) 8) ) < 0) 8) ) < 0) 8) ) < 0) 42 elektor - 3/2007 Jl_^ SERVICING YD U R COMPLETE PRDTDTYPE NEEDS 1 EUROCARD (160 x 100 mm) + Tooling + Photoplots + VAT €49 - Price example Any size and contour possible! Optional: • Soldermask • Fast-turnaround • Silkscreen • 4-Layer Multilayer • 6-Layer Multilayer KUMWt&Afr wt mruwrwnuifi Freephone Q) 0800-3898560 E_ j I. 1 , -tilM Simply send your files and order ONLINE: PC8-POOL.COM Kanda.com Bitwise SYSTEMS www.bitwisesys.com present Collect Real Time Data - Fast Live seminars in the UK featuring Q uickU SB www.quickusb.com Sign up NOW for one of these presentations: Mar 5 Mar G Mar 3 Open University, Milton Keynes 10am 3 2pm Lancaster University 10am B 2pm University of Glamorgan IDamG2pm To Register: > Call Kanda at 08707 44G 807 > Email: jackie@kanda.cam Web: http://www.kanda.CDm/register_sem.html N o1 Number One Systems Easy- PC for Windows The World Beating PCB design software Eaiy-PC version 10 sets another milestone; Winning accolade the world f&r Window? V | d 1c another r?ia|or milestone in iN? e-voluMfi of this ewc-mePy popular software cooP, Try i demoosiraiioo copy of Eaiy-PC and prepare to be a ma^ed If til# p-Dwer, versatility arid renwkaWe lor mow. ■ J i- I u Version 10 features ■ Intelligent Ge rber Import opci-Dn ■ Tr>£:k/ShjtfH' ll Hiii l fl ii d r " Rfeuiin-y ■ T«Mt C llloUEli ■ (Layer Ie Via Scjck Previews ■ Blind 4 Bur I td Vu Suppan ■ Teardrop f\i di ■ Dr i*t Spacing CJearafi cei- ■ SpIrilTrKHiiSH^i Fi in. many *ihjpi eacilkig leaturn.... Fufljr mrLtgrited Schematics ft PC & byDv( In a Single applicants complete with forward and back annotation. Deii&n and fulca checks at all St^gcl ensure integrity at ill tlrjiw, PlTyfr J&iOJifll manijf.ifT .rHi- gyqpwtt allow ygu to fitHtfo the design process with ease Stop prtis. h> Stop press.,, Stop press... Stop press. EiiyPC imports flits 1$ well aiTpen &o*r^mak*f 2 files ci r i ■'or i &rochure.|>ric« -fc CD ■■+* w *-m|ii HtaS^mberw^e wwi Cl" SJ W bu*d a 4t > rth from www. n u m be ron e .com Oak LanE.Bfedoo^Te^“«i Glot GL2& 7 LR Untied Kirgdarn 3/2007 - elektor electronics 43 TECHNOLOGY Wireless waRF: a network Dr. Erik Lins and Christian Meinhardt iDwaRF brings together a Cypress WirelessUSB transceiver and an Atmel AVR microcontroller to create a networkable 2.4 GHz radio module featuring a free protocol stack and development environment. Besides standard applications such as mobile radio, WLAN and Bluetooth, highly-integrated low power radio de- vices open up many new possibilities, Figure 1. The iDwaRF radio module with 2.4 GHz WirelessUSB transceiver and ATmegal68 AVR microcontroller. including wireless sensor networks and even radio-controlled robotic foot- ball teams able to orchestrate an off- side trap in the blink of an eye! And, with iDwaRF, we can do all this with- out complex protocols or licensing problems. An alternative to ZigBee For wireless sensor network applica- tions ZigBee [1] is often the protocol of choice. The protocol is relatively com- plicated, and only members of the Zig- Bee Alliance are permitted to use it in commercial products. Cypress [2] offers a simpler alternative in its WirelessUSB technology [3]. The devices are cheap and the radio protocol makes only mod- erate demands in terms of hardware and memory in the microcontroller. WirelessUSB supports wireless many- to-one links and is thus ideal for use in wireless sensor networks. The protocol details are freely available and can be used without restriction in combina- tion with Cypress radio chips. iDwaRF The iDwaRF-Net software that accom- panies the iDwaRF- 168 module (Fig- ure 1) is a port of the Cypress Wire- lessUSB protocol to the ATmegal68 AVR-family microcontroller [4]. The iDwaRF- 168 module can be freely re- programmed and can equally well play the role of hub or sensor in a many- to-one wireless sensor network. It is easy to add extra application-specific functions. WirelessUSB operates in the 2.4 GHz ISM band. Each WirelessUSB radio net- work uses a selection from a total of 79 channels: even when multiple Wireles- sUSB devices are operating simultane- ously the protocol will be able to find a free channel to use. Transmission uses a robust DSSS (di- rect sequence spread spectrum) modu- lation scheme [5]. Even at a 10 % error rate the data can still be received cor- rectly, and if there should be long-term interference the protocol provides for 44 elektor electronics - 3/2007 able WirelessUSB radio module an automatic change of channel. Like Bluetooth, WirelessUSB comes in short- range (up to 10 m) and long-range (up to 50 m) versions. The latter is used in the iDwaRF-168 module. Hub and sensors An iDwaRF module programmed to act as a hub forms the centre point of a star-topology many-to-one radio network, which can consist of many sensors (Figure 2). Normally the hub operates continuously and can be con- nected to a PC or another microcon- troller, acting as a host, using a se- rial link. For simple applications the iDwaRF module itself can be pro- grammed to carry out the required dedicated host functions. Figure 2. The star-topology radio network consists of a hub and several sensors. 3/2007 - elektor electronics 45 TECHNOLOGY WIRELESS Figure 4. The iDwaRF printed circuit board includes a printed antenna. Figure 6. The iDwaRF module is mounted on the hub printed circuit board. vcc Figure 5. Circuit of the hub board. A sensor unit consists of a suitably- programmed iDwaRF module with sensors attached. To save power we use the AVR’s internal RC oscillator. Also, the module is only activated at intervals (as determined by the ‘bea- con time’). Communications are initi- ated by the sensor and terminated by the hub; a reverse channel (transmit- ting information from hub to sensor) is also available. Module printed circuit board Figure 3 shows the circuit diagram of the iDwaRF-168 module. The Cy- press CYWUSB6935-LR transceiver is connected to an ATmegal68 micro- controller over SPI, using the MISO, MOSI, SCK and /SS (chip select) sig- nals. An interrupt signal (/INTO) from the radio device indicates the recep- tion of data. The ATmegal68 can put the radio chip into power-down mode using an I/O pin connected to the / PD signal, and can reset it using the /WUSBRESET signal. The radio chip needs just an external 13 MHz crystal (XI) and decoupling capacitors (C6 to Cll) for operation. The transmit and receive antennas are separate from one another and integrated directly into the circuit board layout as mean- der lines (Figure 4). Having separate antennas gives greater range and sim- Figure 7. Circuit diagram of the node board with temperature and light sensors. 46 elektor electronics - 3/2007 Table 1. CONI connection groups iDwaRF-168 CONI (port pin) First connection (ATmegal68 pin number) Second connection (ATmegal68 pin number) Third connection (ATmegal68 pin number) PORTO OCOB/T1 / PD5 (9) AIN1 / PD7 (11) ADC3 / PC3 (26) PORT1 OCOA/AINO/PD6 (10) ADC2 / PC2 (25) - PORT2 SCL/ADC5/ PC5 (28) - - PORT3 SDA/ADC4/ PC4 (27) - - PORT4 TXD / PD1 (31) - - PORT5 RXD / PDO (30) - - PORT6 INTI /OC2B/PD3 (1) XCK/TO/ PD4 (2) - PORT7 CLKO / ICP / PBO (1 2) OC1 A / PB1 (13) - plifies matching (LI, Cl and C4). The antennas are laid out in the manner recommended by Cypress. The microcontroller is equipped with a crystal in an HC49 package, and so it is straightforward to change it for a different frequency. As supplied the ATmegal68 is configured to use its in- ternal RC oscillator. A 14-way header (CONI) brings out the ISP (in-system programming) signals of the ATmegal68 (MOSI, MISO, SCK and /RST), power, and eight spare I/O port pins. Some of the header pins are connected to more than one signal on the microcontrol- ler to allow as many as possible of the peripheral functions of the device to be used. This means that you must ensure that any two microcontroller pins that are connected to the same header pin are never simultaneously configured as outputs, or damage to the microcontroller may result. Ta- ble 1 shows the CONI pinout and signals in detail. Application boards In the simplest wireless network sce- nario one iDwaRF-168 module is pro- grammed as a hub and one or more modules are programmed as sensors. It is of course necessary to build the necessary interfaces to the sensors themselves and connect them to the modules. To simplify building such systems we have developed three ap- plication boards, to each of which can be attached an iDwaRF-168 module: a hub board, a node board and a proto- typing board. Figure 9. Node board (rear) and hub board (front) with iDwaRF radio modules fitted. The hub board supports the iDwaRF module with a USB interface (the CP2102), a 3.3 V LDO voltage regula- tor, button and LED (Figure 5). The node board is used to make a sen- sor unit using an iDwaRF module. The circuit (Figure 6) includes an LDR as a light sensor, an LM75 temperature sensor, an (optional) AT45DB801D seri- al flash memory, a button and an LED. Power is provided by three AAA cells and a 3.3 V LDO voltage regulator. The two printed circuit boards (Fig- ure 7 and Figure 8) are chiefly popu- lated using SMD components. Figure 9 shows the boards with iDwaRF-168 modules fitted. Figure 8. The node board converts the iDwaRF module into a complete sensor unit. 3/2007 - elektor electronics 47 TECHNOLOGY WIRELESS Table 2. Example programs empty Empty program: framework for new applications. chat Creates a wireless serial connection between two host PCs, allowing 'chatting' between two terminal programs. tutorial Example program that switches the LEDs on the hub and sensor modules on and off remotely when a button is pressed. The imple- mentation of this example is explained step-by-step in a separate 'how to' document (see text box). terminal This basic sensor network application supports the components on the node board or iDwaRFSensorBox. Data packets (including battery voltage, potentiometer setting, button state and temperature) from several sensors are displayed in plain ASCII text. The ter- minal program can also send data to individual sensors. quad_adc This program reads four ADC channels and transmits the readings to the hub at regular intervals. K1 Figure 10. Circuit diagram of the prototyping board for dedicated iDwaRF module applications. Figure 1 1. The prototyping board has an experimentation area with SMD footprints on the reverse. The prototyping board has a gener- ous area for building your own cir- cuits and is suitable for creating more specialised applications using the iDwaRF- 168 module. There are SMD pads on the reverse of the board. The only active component in the circuit (Figure 10) is the LDO voltage regula- tor, in a TO-92 or TO-220 package ac- cording to the expected current draw. As well as the regulator and socket to accept the iDwaRF- 168 module there is an AVR programming connector, a battery holder and, as an alternative, a socket for a mains adaptor with a reverse polarity protection diode. The printed circuit board (Figure 11) is half-Eurocard sized and can be used in the place of a node board. For rea- sons of space we have made the parts lists for the circuit boards and layouts available for download from the Ele- ktor Electronics website. Software The iDwaRF-Net software package [6] includes a library of firmware for use in hub and sensor modules with corre- sponding header files (in the ‘iDwaRF’ directory), along with a few ancillary functions, for example to support seri- al communications (‘US ART’ directory). There are also four example programs which can either be used as they stand or form the basis for dedicated appli- cations. Table 2 gives more details of these example programs. Each example program consists of hub source code (userMain_hub.c) and sensor source code (userMain_sensor. c). The firmware provides the facility to register so-called ‘callback’ func- tions, which the firmware calls regu- larly in the course of normal operation. These functions can be used for appli- cation-specific code. The most impor- tant callback functions are explained in the text box. Ready, steady. . . Assembling the hardware is relatively straightforward. The SMD printed cir- cuit boards (the iDwaRF module, the node board and the hub board) are available as ready-made units (see the ‘Elektor Shop’ pages at the back of this issue). A kit of parts is available for the prototyping board. Separate- ly-ordered iDwaRF-168 modules are supplied unprogrammed and without header or crystal fitted in order to give the user maximum flexibility. The firmware for programming a hub or sensor module is freely available [6]. Modules ordered bundled with a 48 elektor electronics - 3/2007 node or hub board come ready-pro- grammed. A crystal is always required for baud rate generation on the hub board (a 7.3728 MHz crystal is sup- plied as standard), and the microcon- troller must be suitably programmed for crystal operation. The correct val- ues for the ATmegal68 with a crys- tal oscillator are: extended byte, 0xF9; high byte, OxDF; and low byte, OxFC. It is recommended to use the same values and same crystal frequency for the sensor, and the firmware is cur- rently set up to work on this assump- tion. If the frequency is to be changed (using a different crystal or the inter- nal RC oscillator) the relevant #define in the firmware must be changed and the code compiled afresh. The AVR ISP connectors have to be soldered on to the node board and hub board, and the node board also needs to be connected to the battery holder. Finally the iDwaRF module can be fitted and (in the case of the node board) the batteries inserted. The USB connection on the hub board re- quires the corresponding CP2102 vir- tual COM port driver to be downloaded and installed [6]. Drivers are available for both Windows and Mac OS X. A CP210x module is provided as stand- ard in current Linux kernels, allowing the iDwaRF module to be used with non-Windows PCs. The pre-compiled hex files [6] for hub and sensor are downloaded using the six-pin AVR ISP connector. Note that the supply voltage for the iDwaRF module on the node and hub boards is only 3.3 V, and so care must be taken to ensure that the programming adap- tor also works at this voltage. Sim- ple STK200-compatible programming adaptors that connect to the PC’s printer port, which draw power from the target device, do not always work reliably at 3.3 V. Modern USB program- ming adaptors (compatible with the STK500-V2) such as the CrispAVR-USB work without problems. Table 3. Commands available in terminal' program Command Description rst Restarts the hub firmware. All sensors are unregistered and lose their ID codes, and must register again with the hub. gps Returns an internal Cypress firmware state variable. bon Activates automatic bind mode on the hub. New sensors are probed for using PN code 0 and channel 0. In normal use automatic bind mode is activated. bof Deactivates automatic bind mode. New sensors can no longer register with the hub. enu Displays a list of the currently registered sensors on the hub. The list includes the sensor ID assigned during registration and the unique manufacturing ID stored in the radio chip. cln Cleans up the hub's list of registered sensors. Sensors which have registered more than once with the hub and which have there- fore been assigned different ID codes are removed from the list and only their current ID code remains valid. cnf Configures network parameters. There are 8 different PN codes and channel subsets, and this command allows the hub to be swit- ched to a new PN code and channel. The facility to change channel number is for test purposes only, as the channel is changed automatically in normal operation. The PN code, however, remains fixed. The format is cnf where 0 < pncode < 9 and 0 < channel < 80. The cnf command automatically deletes all registered sensors from the list. snd Sends beacon time and other data to a sensor. The data packet is buffered in the hub and when the sensor in question next makes a transmission the packet is sent back in the back channel to the sensor. All parameters are given in decimal. The format is snd cbeacon time> ... A beacon time of -1 indicates that the beacon time is not to be changed. del Removes a sensor from the list of registered sensors in the hub. The format is del hex Causes sensor data to be displayed in hex rather than as plain text. 3/2007 - elektor electronics 49 TECHNOLOGY WIRELESS The principal callback functions In the hub: cbSensorPacketReceived(): called when a packet is received from a sensor. Direct access to the current sensor data is possible, although if lengthy processing is to be carried out the data should be copied into a global buffer and the work done in the main program. cbSerialDataReceived(): called when a byte is received over the serial interface. Usually the byte is simply stored in a global buffer and its re- ception signalled using a flag, so that more time-consuming processing can be carried out in the main program. cbProcessRxData(): further processes the bytes received by cbSerialDataReceivedQ, for example to implement a complex communications pro- tocol with the host PC. In the 'terminal' example the commands entered on the host PC are parsed and processed in this function. In the sensor: cbConfigForSleep(): called shortly before the sensor switches into power-down mode. This allows for particular sensor devices to be switched off to reduce power consumption. cbExitFromSleep(): called when the sensor leaves power-down mode. At this point particular sensor devices can be powered up again. cbTxProcess(): assembles the data packet to be sent to the hub. At this point sensors can be read and the readings stored in the global trans- mit buffer. The current data packet is then automatically sent to the hub. cbBackchannelProcess(): called with data received from the hub in the reverse channel. This can be used to create an output signal on the sensor, or to generate an analogue voltage using PWM. The 'terminal' example switches on the LED when a data packet is received. ... go! The ‘terminal’ example program is the best one to use to demonstrate all the important functions of a wire- less sensor network. iDwaRF mod- ules programmed as sensors auto- matically connect to the module pro- grammed as the hub and transfer data. With one node board and a hub board connected to a PC it is possi- ble to see immediately on the PC’s screen when light falls on or is shad- ed from the light sensor, when the button is pressed, or when the tem- perature sensor is warmed or cooled. Setup proceeds as follows. Hub board The virtual COM port driver creates a virtual COM port when the USB cable is plugged in. The number of the port can be obtained from the Device Man- ager (reached from the Control Panel). Now we can run a terminal program, set to the relevant port, and talk to the hub in plain ASCII. If there are no sen- sors there will initially be no reports from the hub. The hub is reset by typ- ing the command ‘rst’ and pressing ‘enter’: the hub will then emit its start- up message. It is best to configure the terminal program to expect CR+LF at the end of each line and to enable lo- cal echo, as the hub does not echo the characters it receives. Data format S5 : ID 0 ldr 212 temp 22.5°C batt 2.9V button OFF (5 6 7 8 9 10) : 11 a) b) C) d) e) f) g) h) Legend: a) Packet type: SO (BIND_REQUEST); SI (BIND_RESPONSE); S2 (PING, hub only); S3 (ACK); S4 (DATA, hub only); S5 (DATA, sensor only) b) Sensor ID c) ADC value from the light intensity sensor d) Temperature e) Battery voltage f) Button state (ON or OFF) g) Six unused bytes displayed as decimal indices h) Data byte count The values from c) to g) above form the packet data payload. The standard packet size is set to 1 7 bytes, of which six are protocol overhead, leaving 1 1 bytes of payload. 50 elektor electronics - 3/2007 Sensor If a sensor is switched on the data packets received will be displayed line-by-line in the terminal window. The first packet is called a ‘bind re- quest’ where the sensor registers with the hub and, in return, receives an ID code assignment and a value called the ‘beacon time’. This period, which has a default value of five seconds, is the interval between the transmission of successive data packets. The format of the data packets is described in detail in the text box ‘Data format’. A brief flash of the LED on the sensor board shows when it is active; the LED is ex- tinguished when the sensor returns to power-down mode. If the node board is moved to a warm- er location, or if the ambient light in- tensity changes, the data packets dis- played will reflect the new sensor val- ues. If the button on the node board is pressed a data packet is transmitted immediately: this shows that it is pos- sible to react immediately to external events, without waiting for the preset beacon time to elapse. Command line Commands can be typed into the ter- minal window at any time. Typing ‘enu’ (‘enumerate’) lists the sensors that are registered with the hub, showing their ID code and unique serial number. Our first sensor will appear in this list with ID ‘O’. To send data to this sen- sor we use the ‘snd’ command. In its simplest form this has two parame- ters: ‘snd 0 40’ sends the value 40 to the sensor with ID code ‘O’. The first data byte is always interpreted by the sensor as a new beacon time, in units of 125 ms. In this example, the value of 40 corresponds to the default beacon time of five seconds. So, if we type ‘snd 0 8’ we will set the beacon time for sensor 0 to one second, and data packets from this sensor will be displayed in the terminal window at this rate. The command ‘snd 0 40 V sets the beacon time back to five sec- onds and also sends an extra data byte with value ‘1’, which will cause the LED on the node board to light. In the terminal example the code in the sensor simply checks whether there is an extra data byte beyond the beacon time or not, and sets the LED on or off accordingly. The actual value of the extra byte is not taken into account. The complete set of commands pro- vided by the hub in the ‘terminal’ ex- ample is listed in Table 3. If now a further sensor is activated another ‘bind request’ packet will ap- pear among the data packets being re- ceived from the first sensor, followed by a series of data packets. The ‘enu’ command can be used to list the regis- tered sensors, and should now display two entries with ID codes ‘0’ and ‘1’. We can test the new sensor by adjust- ing its beacon time: ‘snd 1 8’ will set it to one second, and we should now receive packets from sensor 1 at five times the frequency of those from sen- sor 0. If an ‘x’ is used in place of the ID code in the send command, the beacon times for all sensors are set simultane- ously. Using ‘snd x 40’ we can therefore reset the beacon times for both sensors to five seconds. If the data packets are to be proc- essed on the host PC, the ‘hex’ com- mand can be used to switch the dis- play from readable form to pure hex values. These can easily be read by another application, for example using the scanfQ function. Room for expansion The supplied programs can form the basis of dedicated applications using iDwaRF modules: the possibilities are endless. Often a couple of extra com- ponents are all that is needed, for ex- ample to make measurements using an ADC, generate PWM waveforms, scan keys or drive an LCD. The iDwaRF-Net software can in theory work with up to 255 sensors, although at present the limit is 32. For larger sensor networks the xHub is planned, using an ATmegal28 with more flash memory and an external SRAM. An ex- ternal antenna will increase the range of the hub. Users of the iDwaRF radio module [7] and the iDwaRF-Net firmware can use a forum [8] organised by the author. This is in addition to the forum on the Elektor Electronics website. Further ex- ample programs will of course appear for download at [6] as soon as they be- come available. ( 050402 - 1 ) References and links: [1 ] www.zigbee.org [2] www.cypress.com [3] Thomas Biel: 'Wireless USB', Elektor Electronics, September 2004, p. 8 [4] www.atmel.com/avr [5] Stefan Tauschek: 'Wireless Connectivity', Elektor Electronics, February 2005, p. 14 [6] www.elektor-electronics.co.uk or www.chip45.com/iDwaRF-l 68_Downloads [7] www.chip45.com/iDwaRF-168 [8] www. ch i p4 5 . co m/i Dwa RF- N et 3/2007 - elektor electronics 51 All Inlcrr nlion ip. 'If* wlverli&cireri subject la change. E J 0. E PS/GPRS MS Module Why buy TraceME products? 1. monitor your fleet with GP5fGPR5/SMS 2. monitor your staff in any country 3. send messages lodrom your people 4. monitor your machines wireless via internet 5. update machines worldwide with your PC 6 r sufficient I/O for sensors etc. ?. i Button auto start safety device 8. guard properties via mmi camera 9. unlimited applications possible 10. Dutch design 11. Dutch production and support 12. Satisfied customers' IMTEGH DUTCH POLICE FORCE PORTUGUESE FIRE DEPARTMENT AGGREKO GENERATORS SKYNET MOBILE UK GOVERNMENT MOTOROLA DUBAI AFRICAN OIL COMPANIES GERMAN ROADSERVICE and many others worldwide TraceME mini SPY camera watches over your belongings and transmits pictures via GPRS. Watch them via your web browser. lift IN MENU e u c # Communicate in youf car with the office or with another vehicle via a.o. SMS with the TraceME LCD module Secure your vehicle with the hetp of an (Button start. a! J1 " iUjcM VUrSPOn can be supplied for situation ^vbere no fixed power sourci i — is 0V£jlable r f I - • * ■■Mk Sec Saffeiy , Buildings with or without miniature cameras and/or sensors via wireless transmission. r* Measurement & Control engineering Wireless distance control of generators, ail equipment vjitJi an SPf or RS23-2-iriterface. ClfnUfe control. Medical: Monitor! ng ■ ran s po rt of o rg a n s r stern cells, blood, etc Ambulances snd 6l tier Sans ports. Tracing transports: Bosses, cars, lorries, l. fire engines, river craft engineering; Detection of temperatures during cold-storage Iran spoil and alarm sionels when deviations occur, trailers (also on solar ene (machine to machine) Pilul/contro! your machines/pumps ete, via the interne! wilhoul the help of mechanics. Various police services have already been equipped with T ra ceME modules + cameras in various countries. TECHNOLOGY WIRELESS Fabrice Andre We already introduced XBee in the November 2006 issue. These new wireless data transmission modules developed by Maxstream comply with the ZigBee standard. Now we present a circuit based on the XBee modules to show how they can be used in practice. As already indicated in the previous article, it’s time for a practical applica- tion based on the XBee modules. This article describes a ZigBee transceiver for connection to the serial port of a PC, along with a simple control program. Brief background Like WiFi and Bluetooth, ZigBee is a standard for wireless data transmis- sion. However, it differs from the first two of these standards in that it is purely intended to be used for indus- trial applications, and it was specifi- cally developed to satisfy the needs and requirements of the industrial en- vironment. It should thus hardly come as a surprise that ZigBee leaves the competition behind with regard to en- ergy consumption, transmission reli- ability, and cost. The catchy name us backed up by a whole consortium of large companies, which is known as the ZigBee Alliance. users to utilise the standard without having to be experts on the subject. The XBee module works via a con- ventional serial TTL link. Its job is to form the data into packets and send it to another XBee module or another node that complies with the ZigBee standard. The XBee module is easy to configure using several parame- ters that are sent to the module via the same erial link as the data. It has built-in intelli- gence so it can dis- tinguish parameters from data. ZigBee interface The circuit described here enables two computers to communicate reliably with each other via their COM ports. Transceiver Xbee in practice Maxstream, which has a good feel for the importance of wireless communi- cation trends for the industrial sector, has developed its own ZigBee trans- mission module, christened ‘XBee’. Its biggest advantage is that it enables Figure 1. A typical RS232/USB converter cable. 54 elektor electronics - 3/2007 Obviously, you will have to build two copies of the circuit (one for each PC) for this sort of link. Here we took the approach of not only establishing a wireless link between two PCs (which isn’t especially interesting by itself), but also developing a practical con- trol program that can serve as the ba- sis for an application that meets your own specific wishes. At this point, some of our readers may be worrying about the compatibility of this circuit with new PCs that may not be equipped with anything as old-fash- ioned as a serial port. This doesn’t have to be a problem, since a serial port em- ulated by a USB/serial converter(see Figure 1) is also perfectly satisfactory. The author checked this out using com- monly available converters fitted with chips made by FTDI and Prolific. Electronics The circuit can hardly be regarded as complicated. If you’ve already glanced at the schematic diagram in Figure 2, this won’t come as any surprise. There are three separate sections, viewed from left to right: the power supply, the transceiver (at the top), and the indica- tor portion (at the right). The supply voltage can lie anywhere in the range of 8-20 VDC, and it does not have to be especially well filtered or regulated. Any AC adapter you happen to have lying around is probably more than adequate. The first component the supply voltage encounters is diode D2, which protects the circuit against a re- verse-polarity connection. It is followed by a 7805, which provides a regulated 5-V supply voltage, and an adjustable regulator that generates a 3.3-V supply voltage for the XBee module. The out- put voltage of the LM317 is determined by voltage divider R10/R12. Although 5 V may seem rather low as an input voltage for a 3.3-V regulator, it does not present a problem with this arrange- ment, and it has the supplementary advantage that very little heat is dis- sipated in the regulator - in contrast to the 7805, which has to dissipate a considerable amount of heat and must be fitted with a small heat sink. The power supply section has buffer and filter capacitors in various places. The DB9 connector (Kl) is connected to one of the serial ports of a PC via a standard serial interface extension ca- ble. Be sure to use a 1-to-l cable in- stead of a crossover (null-modem) ca- ble. Data is sent in both directions via this cable. An RS232/TTL adapter cir- cuit (consisting of Rl, R2, Dl, Tl, and R3) is connected to pin 3. At the risk of stating the obvious, we must point out that the serial port of the computer work with symmetrical voltages and negative logic (see Ta- ble 1). This means that a voltage of - Table 1 Logic level PC XBee TTL 0 + 12 V 0 V 0 V 1 -12 V + 3.3 V + 5 V +5V +3V3 Figure 2. Schematic diagram of a transceiver based on the XBee module. 3/2007 - elektor electronics 55 TECHNOLOGY WIRELESS Operation 1 Command + + + Xbee reply ok (receive mode enabled) Command ATBDJ Xbee reply 3 ('3' corresponds to 9 600 baud) Operation 2 Command + + + Xbee reply ok (receive mode enabled) Command ATBD4J Xbee reply ok ('4' corresponds to 19,200 baud) Operation 3 Command + + + Xbee reply ok (receive mode enabled) Command ATWRJ Xbee reply ok (all changes stored) "AT" ASCII Space Parameter Carriage Prefix + Command (Optional) (Optional, HEX) Return Example: ATDL 1F Figure 3. Command structure. 12 V appears on the transmit data (Tx) line when the PC puts a logic 1 on the data out line, and that would quickly spell the doom of transistor Tl. This is the reason for protection diode Dl. It reduces this ‘hazardous’ voltage to a value of -0.6 V, which the 2N3904 can handle. This voltage causes the tran- sistor to be cut off, so a ‘normal’ log- ic 1 at a level of 3.3 V appears on the receive data line of the XBee module (pin 3) thanks to pull-up resistor R3. The XBee module (which operates ex- clusively from 3.3 V) also transmits sig- nals to the PC with a voltage of 3.3 V, so these signals must be adapted as well. This job is handled by R6, R5, T2 and R4, with the result that a 5-V sig- nal is sent to the PC. Although this is considerably less than the nominal 12- V level the PC expects, it works per- fectly in most cases. Now let’s look at pin 6 of the XBee module, which is the pulse width mod- ulation (PWM) pin. The XBee module uses this pin to indicate the strength of the most recently received signal. The PWM signal is a pulse waveform with a fixed frequency of 120 Hz and a pulse width that depends on the sig- nal strength. Here we use a low-pass filter formed by R9 and C3 to convert the PWM signal into a DC voltage. This network transforms the pulse width into an analogue value in the range of 0-3.3 V. For our mathematically in- clined readers, we can remark that the charging curve of a RC network is log- arithmic. This is ideal for our purpose, since we want to display the signal strength in dBm. The analogue signal is fed to an in- tegrated LED driver (IC1). This IC (an LM3914) displays the strength of the most recently received signal us- ing ten small LEDs. It is configured in ‘bargraph’ mode via pin 9. The LEDs do not have separate series resistors to limit the current flowing through them. No resistors are necessary, since each LED output is a current source that is configured by resistors Rll and R13. The current in each LED is thus lim- ited to 18 mA. It’s perfectly possible to use other types of LEDs, depending on your taste or what you have in your components drawer. However, it may be necessary to adjust the current in the LEDs according to the following formula: I LED = 12.5 / Rll Rll also has another function: in com- bination with R13, it determines the full-scale voltage of the display, which means the voltage at which all LEDs are lit up (3.1 V in this case). Each time you change the value of Rll, you have to calculate a new value for R13 using the following formula: R13 = Rll x 1.5 Data or command? This brings us to an important topic. The XBee module has a single pin for receiving data and commands. Data is received by the internal UART and out- put directly via the antenna, while com- mands must never be transmitted. The commands form the instruction set of the XBee module. They replace the commands used to communicate with a modem (Hayes or AT [A] [B] com- mands). The complete list is given in the device data sheet on the manufac- turer’s website. Figure 3 shows the structure of a typi- cal command. We are particularly inter- ested in one of these commands: ATBD. It consists of two terms: ‘AT’, which are the first two characters of every Hayes command, and ‘BD’, which stands for ‘baud rate’. The ATBD command refers the transmission data rate of the XBee module. As this is serial link, standard- ised data rates such as 1200 and 9600 are used here. As data must always be transmitted but commands must never be trans- mitted, the XBee module must be able to tell them apart. This is handled by an in-house protocol devised by Maxstream. The first thing you have to do is to put the XBee in the ‘wait for command’ state by sending three ‘ + ’ characters in a row ( + + + in ASCII), followed by the ATBD command and ending with a CR (Return) character to terminate the session. The XBee module analy- ses every command packet that it ‘un- derstands’. If the result is positive, the XBee module replies with a message consisting of ‘OK’ followed by a number that corresponds to the data communi- cation rate (normally speaking 3, which corresponds to 9600 baud). The data sheet includes a table showing the re- lationship between the numbers and the data rates (see operation 1). Here we queried the data transmission rate of the XBee module, but the rate 56 elektor electronics - 3/2007 can also be changed using the same procedure. Start by issuing ' + + + ’ again as described above, but this time add a data rate parameter between the ATBD field and the CR character (see operation 2). From now on, the XBee module will operate at 19,200 baud. There’s only one thing you still have to do: store this change in the internal memory of the XBee module so the setting will be retained even after power is switched off. Once again, you can do this using the same method as before (see operation 3). Software To make things more convenient for you, the author has written a small program in Visual Basic that consider- ably simplifies working with the XBee module. XBee Terminal (XBT) looks af- ter the entire communication process. You can download the software file (060348-11. zip) from the Ele- ktor Electronics website (www.elektor-elec- tronics.co.uk). XBT is available in the form of a simple executable file or an installable pro- gram. The execut- able is intended for readers who already have a VB environment on their computers, while everyone else can use the in- stallation program. Firmware dialog window and select ‘Read version’. This causes the pro- gram to ask the XBee module for the version number of its firmware, which will be shown in the ASCII field im- mediately afterwards. You will see the previously displayed ‘OK’ message and a number (probably ‘106’), which indi- cates a particular release. Now you can repeat the process of reading and setting the data rate of the XBee module, which we already described in detail above using com- mands. Click the ‘Baud Rate’ window and select ‘Read Baud Rate’. XBT will send a read command to the XBee module, and the response will be dis- played in the ASCII field. It will nor- mally be ‘3’, since the default setting is 9600 baud. Next you can chose a different data rate as described in the previous ex- ample, such as 19,200 bits/s. Click the ‘Baud Rate’ window and select ’19,200’. If you want to store the change in the XBee mod- cuits connected to a single PC. In this case, connect each circuit to a differ- ent port of your computer and launch XBT twice. Then link each instance of the program to one of the modules as described above. If you want to learn more about how XBT works, you’re welcome to snoop. Take a female DB9 connecter and wire pins 2 and 3 together. Connect it to one of the serial ports of your compu- ter and start the XBT program. All the commands you send using the XBT program will now be looped back and shown in the ASCII field. If you decided to use an XBee module with an external antenna (see the pre- vious article listed under ‘Referenc- es’), you may be wondering what sort of antenna is suitable for use with the module. The author recommends Yagi antennas, since they give good results and have a long range. You can also make your own antenna. A quick web search using ‘Wifi antenna’ as a key- word will turn up innumerable con- struction plans. Simply connect the circuit to your com- puter, switch on the supply voltage, and launch XBT. A message at the bot- tom of the window will inform you that the serial port that the circuit board is connected to has not yet been opened. You have to open it now. Start by con- figuring the correct data rate (9600 is OK), and then click the icon at the top of the window corresponding to the port the circuit is connected to. The serial port will be opened immedi- ately, as indicated by a brief message (otherwise an error message will ap- pear). To close the port, select ‘COM’ instead of a port number. A short mes- sage will also be displayed in this case. Don’t forget that you have to close the port before you can change the data rate. When the ‘Opened’ message appears, move the mouse pointer to the XBee ule, click the red button. When you change the data rate of the XBee module, the data rate of the serial port of the PC must also be changed. XBT does this for you. There are several other windows asso- ciated with ‘Baud Rate’, each belong- ing to an important command. If the command you need is not included, use ‘Send command’ or ‘Command’ with a suitable command, such as ‘ATBD’. Leave the parameter field blank for a read command, or specify a parame- ter for a write command (such as ‘3’ with the ATBD command to select 9600 baud). If you want to send a message, enter it in the ASCII field and then click the ‘Send’ button. Tricks and pitfalls You may be working with two cir- References [1] ZigBee with XBee, Elektor Electronics, November 2006, pp. 64 ff Web links Hayes command set: http://fan.nb.ca/cfn/info/help/com-prog/ modemcommandslist.html www.modemhelp.net/basicatcommand.shtml ZigBee: www.ZigBee.org All about WiFi: http://nl.wikipedia.org/wiki/Wifi Maxstream: www. maxstr earn . net/ 3/2007 - elektor electronics 57 HANDS-ON PIC24F DESIGN SERIES Explorer- 16 (3) Part 3: Speaking Thermometer, CF card simulation and Crypto Puzzle Jan Buiting & Luc Lemmens, in cooperation with Microchip Technology and Labcenter Electronics More advanced (but still 100% free) simulation this month with a VSM model for media storage card devices added to our PIC24F system (all virtual, of course). To cap it all, solve a CF card crypto puzzle and win fantastic prizes sponsored by Microchip and Labcenter. But let's first revert to last month's Speaking Thermometer project. Last month’s Speaking Thermometer is not just a simulation you can run using three main components: (1) Labcenter’ s Proteus VSM, (2) Microchip Technolo- gy’s MPLAB (both from your Explorer- 16 CD-ROM) and (3) Elektor’s archive file called Demo2.zip. All components, by the way, are free, the CD-ROM hav- ing come as a gift with the full print run of our January 2007 issue. If you haven’t done so already, please do run the January 2007 ‘Demol’ simu- lation of the Explor- er-16 board itself. In the virtual envi- ronment created by Proteus VSM, press buttons and click away on other con- trols to your heart’s content and see how the system responds with its vari- ous indicators. ‘Demo2’ from the February 2007 issue is funnier to see... and hear in actual use! Particularly if you simulate tem- perature variations and manage to cre- ate your own voice files. The aim of these simulations is to teach you how both simple and com- plex PIC24F MCU software can be created and debugged to the high- est possible level in combination with hardware devices like sensors and voice output (how’s that for an actuator device). The hardware/soft- ware interaction can be put through its paces in VSM/MPLAB without having real components cluttering your desk or even appearing on the boss’ Project Purchasing sheets. If you need still stronger encourage- ment: with simulation your PC does most of the design work for you, sav- ing time and money compared to working with hardware components to achieve a design goal. While awe stricken with the power of the simulations and the degree of inte- gration between the Labcenter and Mi- crochip Technology products, let’s not forget that the Speaking Thermometer design can be made to work in hard- ware too. For this, all you need to know is how to program the PIC24F PIM on the Explorer- 16 demo board that’s part of our Explorer- 16 Value Pack. Speaking Thermometer The following is described to help you become acquainted with the hard- ware contained in the Explorer- 16 Val- ue Pack. Extensive product descrip- tions, user manu- als and software installation guides being supplied on CD-ROMs in the Pack (take your time to read it all, it’s worth the effort), we can concentrate on our specific requirements. An up to speed description is given assuming of course that you are reasonably conver- sant with PCs. 1. Plug the Audio PICtail board into the PICtail bus connector on the Explorer- 16 board. Check that the PIC24F PIM is fitted on the demo board. the simulations teach you how both simple and complex PIC24F MCU software can be created and debugged 58 elektor electronics - 3/2007 2 . Plug the PICkit 2 module onto the 6-way pinheader on the Explorer-16 board observing that the LEDs are at the side of the Audio PICtail Plus board (see note supplied with Explor- er- 16 Value Pack). 3. Apply power to the Explorer-16 board (9-15 VDC at about 300 mA). 4 . Install the software that comes with the PICkit 2 from your Explorer-16 Value Pack. Check that version 2.0 or higher is available as earlier versions do not have support for the PIC24F MCU series. If necessary, updates can be downloaded from the Explorer- 16 project page on the Elektor website. 5. Plug the USB lead from PICkit 2 into a free USB outlet on your PC. Install the device by responding to the usu- al prompts and windows that appear. PICkit 2 will be automatically recog- nised from then on. 6. Run the PICkit 2 software (a shortcut will be available on your desktop). The program will report: ‘PICkit2 found’, and, importantly, ‘PIC Device found’ (in this case, the PIC24FJ128GA010 on the demo board). 7. Now click File — > Import hex — > Demo2. hex. You may need to Browse your sys- tem if you can’t remember where you put the .hex file (see part 2). Once the file has been found and se- lected, the PICkit 2 program says ‘Hex file successfully imported’ and you’ll see the usual controls for a program- mer like Write, Verify, Read, Erase. There is no need to activate either of the ‘VDD Target’ boxes. 8. Now click on Write and the hex file is sent off to the PIC24F target device on the demo board (Figure 1). The red LED in the PICkit 2 module will flash to indicate the system is busy. Wait for the process to complete. 9 . Remove power from the demo board, wait a few seconds and power on again. The Speaking Thermometer will start and you will hear the “degrees Celsius” message from the mini loud- speaker on the Audio PICtail board. In some cases, the reset button has to be pressed to launch the application. 10 . The current temperature can be re- quested by pressing pushbutton S4 on the demo board. Explorer-16 project highlights • Economic and educational gateway to 16-bit microcontroller technology and simulation • Explorer-16 Value Pack supplied at unbeatable price • Free Proteus VSM, MPLAB IDE and MPLAB C30 supplied on CD-ROM • Free simulation project files with instalments • Explorer-16 demo board accommodates PIC24F/H and dsPIC33 • PICkit 2 suitable for PIC baseline / midrange / 18F / 24F/ dsPIC33 (updates available) • PIC24F and dsPIC33 PIM modules available for standalone applications • Written and supported by experts at Microchip Technology, Labcenter and Elektor • Crypto Competition • Interactive support through project page and forum on Elektor Figure 1. PICKit 2 has successfully loaded the hex object code file for the Speaking Thermometer and is ready to transfer it to the PIC24F target device via the plug-on pod. 3/2007 - elektor electronics 59 HANDS-ON PIC24F DESIGN SERIES Figure 2. TC1047 temperature sensor on the Explorer-16 demo board. It is fully supported by the system software and easily addressed in C. Figure 3. Extract of the C source code written for the Speaking Thermometer. Here, the ADC is read and the temperature translated to speech. For better sound reproduction, connect a set of powered PC loudspeakers to the jack on the Audio PICtail board. TCI 047 So where is the temperature sensor? Although not shown on last month’s arrowed floorplan of the Explorer- 16 demo board, it is actually near the PIM, see Figure 2. The tiny TCI 047 device proves the simplicity of connecting sensors to a PIC24F MCU. The TC1047 datasheet is worth examining for your own projects hence it is available from the Explorer- 16 project page. Put your fingertip on the three-pin SMD for about five seconds and press S4 again. An educational gadget The Speaking Thermometer may look trivial but has a lot of potential for some really advanced programming in C. A code snippet of the program is shown in Figure 3. How about these challenges: 1. change the program to start speak- ing automatically when a tempera- ture change of more than half a degree C is detected. Ditto, make an alarm sound when a certain temperature is reached. 2. create your own voice files. A tuto- rial on how to do this will be available from the Free Downloads Area on the Explorer- 16 project page. You will find that this requires extra storage memo- ry and the section below on CF cards will prove useful. Figure 4. Directory table on a (virtual) Compact Flash card. The location 0x7A00 applies just to this sample image produced using UltraEdit. As you rise to these challenges you will be making extensive use the C30 compiler, Proteus VSM and the MPLAB environment. Remember, everything can be simulated, boosting confidence that the real thing will work spot-on. There is a lot to experiment with — let us know how you get on and post your findings in our online Forum. Onwards with media storage cards Now, let’s move on to working with media storage cards using the PIC24F MCU and the Microchip Media Storage Library. The virtual hardware for this part of the article is supplied and designed to be used with the demonstration ver- 60 elektor electronics - 3/2007 CSI Miami needs help COMPACT FLASH CRYPTO COMPETITION The compact Flash image (cfimage.bin) used in this month's Proteus VS M Simula tion was actually taken from a real CF card that belonged to a secret agent. It contains file a called 'SECRET.DAT' which in turn contains contact details lead- ing to a limited source of free Microchip ICD2 debuggers and Proteus VS M software. /m The first three readers of each of the four main language editions of Elektor (12 prizes in total) able to extract the information contained in the file and follow the instructions therein will be able to ob- jr tain a free ICD2 debugger and a copy of Proteus VS M for the PIC24FJ1 28GA01 0.* /JH" , Ut course, the tile bt^Ktl.UAI has been scrambled, but the secret agent was careless and left another file on the CF card that may prove helpful in cracking the code. All the infor- mation you need to perform a simple forensic examina- tion of the card image has been supplied in this article, and you should not need to use any specialist knowl- edge of cryptography. Via the Message Area on the Explorer- 1 6 project page we may or may not post some clues to cracking the code and getting at the informa- Have fun! i /"*°i it m a tt te »t a « i$ ts *r m ** i & fj & tt ts to Zf H If tr a u m M ** ( iw/ 44 t§& 40 n te es a st t> t* 4* u *t $9 * JJf *233 3 88 89 89 89 11 u ° ** ** *• B 1 ot a tf if te At t. to a n h a m to a a 1 e prizes sion of Proteus VSM supplied on the Explorer- 16 CD that came with your January 2007 issue. The design consists of a PIC24F, a simu- lated compact Flash card and an RS232 terminal. This is broadly equivalent to plugging in the Compact Flash PICtail plus card into the Explorer- 16 demo board, and then attaching an RS232 ter- minal or terminal emulator to UART2 - in real life. Also supplied is an example project, DEM03.MCW, which makes use of the Microchip Media Storage Li- brary. This library provides a simple file I/O API and implements an FAT 16 storage structure on the media card. The Media Storage Library can work with both Compact Flash and SD/MMC cards, although in this article we shall be using it with Compact Flash only. Useful background information on Compact Flash (CF) cards and the FAT 16 format may be found in Refer- ences [1], [2] and [3]. Things you need to know about these media include • the fact that a CF card is run in ATA mode whereas an SD card is run in MMC mode; • the Sector organisation of an ATA drive; • the need for a filing system; • the basics of FAT16 - directory ta- bles etc.; • the file CFIMAGE.BIN is a binary dump of the drive sectors. Figure 4 shows a hex dump of the di- rectory table at 7A00h. A lot of clues on how the system is implemented in software can be obtained from it. Note that the exact location of the directory table will vary according to the size of a CF card. Talking to the card in C Provided you are reasonably conversant with the C programming language, you can review the file FilelO.c contained in Demo3.zip for each of the func- tions listed above. This will tell you how the various technical requirements for CF cards could be implemented for our PIC24F system. It should be noted that the Me- dia Storage Library is still in the devel- opment phase at Microchip and the rel- evant disclaimers should be observed. Although Labcenter and Microchip have worked closely together to be able to of- the secret agent was careless and left another file on the CF card that may prove helpful in cracking the code 3/2007 - elektor electronics 61 HANDS-ON PIC24F DESIGN SERIES Figure 5. The CF card simulation again proves the sheer power and versatility of VSM combined with MPLAB. fer you this exclusive first, you must be aware that the firmware is by no means a finished product. This month's simulation As before, the archive file you’ll need to run this month’s free simulation can be found on the Explorer- 16 project page. Look for Demo3.zip in the Free Down- loads Area. Download, store and open it as the previous two simulations in this series. The code in the main file DEM03.C allows you to choose a filename and then type some text to be stored in it. Filenames must be 8.3 format be- cause it is a FAT16 storage system. The text entry mode can be ended by pressing Ctrl-Z. Once the file has been closed and ‘written’ to the CF card, the program re-opens the file and displays it on the terminal. The program uses some simple buffering so that data is written to and read from the storage device 512 bytes at a time. The simulation is shown run- ning in Figure 5. Next month We will close off the series by turning the Speaking Thermometer into a mul- ti-lingual device. This will nicely com- bine the methods of creating your own voice files from scratch and file stor- age on CF cards — with different cards used for each language. (060280-III) References [1] Compact Flash Interface for Microcon- troller Systems, Elektor Electronics December 2002 . [2] Data Storage on CompactFlash (CF) Cards, Elektor Electronics March 2004. [3] CompactFlash (CF) Interface, Elektor Elec- tronics June 2003. Where not indicated, trademarks (™) and co- pyrights (©) of Microchip Technology acknow- ledged for their PIC, dsPIC, MPLAB products. Project news, free downloads & updates for this are available from the Explorer- 1 6 project page at www.elektor-electronics.co.uk/explorer-l 6 and the 'Explorer- 1 6' topic on the Forum at www.elektor-electronics.co.uk/ default.aspx?tabid = 29&view=topics& forumid = 22 Explorer-16 Value Pack Elektor's Explorer- 1 6 Value Pack consists of four components packaged together in a single box: 1. Explorer-16 Demo Board 2. PIC Kit 2 Starter Kit 3. Audio PICtail Plus daughterboard 4. MPLAB C30 20% Discount Voucher The pack is available for £ 722.90 (€ 1 79.00 / US$ 232.50) from the Elektor SHOP, see www.elektor-electronics.co.uk or the SHOP pages in this issue. Labcenter Electronics have listed several Proteus VSM offers for Elektor readers following the Explorer-16 article series. Have a look at www.labcenter.co.uk/products/elektoroffer.htm. 62 elektor electronics - 3/2007 THE VERY BEST CCTV AT LOW PRICES SYSTEM , 4 mow CiLMiUS « bvft PAdAOE c leEtti'ih""! tel: 020 84 i i&PQ&i Easy wlj/rTo PCS ..j ' 1 ir *• * , r * f »J*' matures : + UL ProvdfcHf&h Quality ISO 9000 Certificated ISO 9000 Ceryficaled + Accept Orders from 3pcs to 1M Pc& ( ' i# § # * I* t ^Capabilities: 4 *? '** •*. >•**,’ ^4 Up to 40 ^yprs ' * a -** " * \ \ 2. 5mJ "ftflck/Sf^ce L * O'! Hole Size ’ V Blind And Buried Vias *RoHa And ,*W Compliant Prices: ^ * *- f * Only $50 For 5fccs 4^4 2L Only $160 For jjpcs 4' x ^V4L Only $280 F,p^3pcs 4' rf 4' jBL Free Solder Mask & Silkscreen Competitive Price For Bulk Orders Hllp: / . ezpcb. com 3/2007 - elektor electronics 63 1MB HANDS-ON MICROCONTROLLERS Michael Gaus Display characteristics Display type: Alphanumeric plus 8 annunciators Rows: Two plus annunciator row Characters per row: 1 2 Annunciators: 8 recycling Alcatel LCDs The biggest obstacle to reusing old mobile phone parts is usually the lack of datasheets. Undeterred, the author has managed to work out how to use the display from an Alcatel phone purely by analysing the printed circuit board and data protocol. As a result he has made it possible to drive the display from an ATmegal6 microcontroller. Interface: Operating voltage: approximately 3 V (in the mobile phone, 2.9 V) The display that we exper- imented with for this project came from an old ‘Alcatel OTE db’ mobile phone. The most important information about the display is given in the inset. The display is controlled serially using the SPI protocol and so only a few wires are required to drive it from a microcontroller. The pinout and protocol were deduced by ‘reverse en- gineering’ a (still working) phone with the aid of an oscilloscope to spy on the signal lines. This research enabled us to determine how to drive the display and its character set. The tangible re- sult of all this is the ATmegal6 board described here and the firmware re- siding in it, which together provide an LCD interface that can be connected to the serial port of a PC and controlled using a terminal program. The freeware program LCDHype lets the display be coupled to the Winamp MP3 player to display track title information. A plug- in is available for LCDHype that allows you to track the progress of Ebay auc- tions on the salvaged LCD, and you will no doubt think of other applica- tions (and post them on the Elektor Electronics forums ! ) . Mobileware In the mobile phone the LCD, keypad and LED backlight are all mounted on the same printed circuit board (see photograph). The simplest approach is not to try to desolder the LCD but to use the circuit board as it stands. The control signals can easily be attached to using the solder pads labelled J800 (Figure 1). It may even be possible to find a use for the keypad, which is wired in a matrix organisation. It is also possible to detach the LCD from the circuit board without damaging it 64 elektor electronics - 3/2007 Figure 1. Signal connections on the Alcatel printed circuit board. Figure 2. Wiring of the LCD on the original board. Table 1. LCD pinout on LCD connector J801 and on circuit board connector J800: Pin (J801) Pin (J800) Name Description 1 7 C/D Select command or data byte: 0 = command, 1 = data 2 15 CS Chip select, active low 3 26 DAT SPI data, MSB first 4 24 CLK SPI clock, maximum 1 .8 MHz; data are transferred on the rising edge of the clock 5 17 VCC Supply voltage, 2.9 V 6, 18, 20 5, 9, 18, 19, 22 GND Ground 21 32 RES Reset, active low, minimum pulse length 100 ps - 20 LED_V+ Supply voltage for LED backlight, approximately 3 V - 30 LED_CTRL Control input for LED backlight: 10 l [ ; H where is the row number as an ASCII value (0 = annunciator row, 1 = text row 1,2 = text row 2), and is the column number as an ASCII val- ue (from 1 to 12). Figure 6 shows an example screen- shot from a terminal program. In the lower window we can see the codes that need to be sent to the display to Figure 5. Display when the interface board is switched on. Figure 6. Terminal window showing cursor positioning command. move the cursor to column 3 in the sec- ond row: is the first code (hex OxlB, decimal 27), followed by the AS- CII codes for ‘ [’ (0x5B), ‘2’ (0x32, repre- senting the second row), (0x3B), ‘3’ (0x33, representing the third column) and finally the letter ‘H’ (0x48). The backlight is switched on us- ing 1 and switched off using 0, where 0 and 1 are binary val- ues (not ASCII!). Figure 7 shows the relevant part of the terminal window when the backlight is being turned on: other settings are as in Figure 6. The freeware program LCDHype [1] mentioned earlier provides a script- ing language to allow arbitrary text to be displayed on the LCD connected to the PC. For example, this might in- clude track title and artist information or spectrum analyser output from the Winamp MP3 player program. In prin- ciple any LCD could be used, as long as a suitable driver is available. A driver has been developed for the Al- catel display, and is available for free download from the Elektor Electronics website. If you follow the instructions in the accompanying readme.txt file, the display will show the title informa- tion and the spectrum readout in the lower row (see Figure 8). The LCD- Hype website describes further ap- plication, including the ‘Ebay display’ mentioned above. ( 060184 - 1 ) Figure 7. Part of terminal window showing the command to switch on the backlight. Reference: m www.lcdhype.de Figure 8. Display of artist name and spectrum analyser output from Winamp on the Alcatel LCD. 3/2007 - elektor electronics 67 lektor lectron ics Order now using the Order Form in the Readers Services section in this issue. Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Telephone +44 (0) 208 261 4509 Fax +44 (0) 208 261 4447 Email: sales@elektor-electronics.co.uk Step into the fascinating world of microcontrollers Microcontroller Basics Burkhard Kainka Microcontrollers have become an indispensable part of modern electronics. They make things possible that vastly exceed what could be done previously. Innumerable applications show that almost nothing is impossible. There’s thus every reason to learn more about them, but that raises the question of where to find a good introduction to this fascinating technology. The answer is easy: this Microcontroller Basics book, combined with the 89S8252 Flash Board project published by Elektor Electronics. This book clearly explains the technology using various microcontroller circuits and programs written in several different programming languages. In the course of the book, the reader gradually develops increased competence in converting his or her ideas into microcontroller circuitry. ISBN 978-0-905705-67-5 230 Pages £18.70 /US$33.70 Flash Microcontroller Starter Kit Elektor Hardware & Software Upgrade for Flash Microcontroller Board AT89S8253 supersedes AT89S8252 Enchancements AT89S8253 versus AT89S8252: •12 kbytes of flash memory instead of 8 kbytes • Page Mode for faster programming • Doubled processing speed using X2 clock option • Power-on reset function and brown-out detection • Supply voltage from 2.7 V to 5.5 V Step into the fascinating world of microcontrollers with the Elektor Electronics Flash Microcontroller Starter Kit. Order now the ready-assembled PCB incl. software, cable, adapter & related articles. Contents of Starter Kit: • 89S8253 Flash Microcontroller board (ready-assembled and tested PCB) • 300-mA mains adapter • Serial cable for COM port • Software bundle on CD-ROM Article compilation on CD-ROM £69.00 US$112.50 * 1 1 1 1 < I 1 ; n jga 1 P 4 ■ * i t i i l I ■ j fi Z 1 1 1 1 ■ 1 r 1 1 * 1 | * J .,u m : v. f t L ‘ ‘ ■ More information on www.elektor-electronics.co.uk QUASAR electron ics Quasar Electronics Limited PO Box 6935, Bishops Stortford CM23 4WP, United Kingdom Tel: 0870 246 1826 Fax: 0870 460 1045 E-mail: sales@quasarelectronics.com Web: www.QuasarElectronics.com Postage & Packing Options (Up to 2Kg gross weight): UK Standard 3-7 Day Delivery - £3.95; UK Mainland Next Day Delivery - £8.95; Europe (EU) - £6.95; Rest of World - £9.95 (up to 0.5Kg) iOrder online for reduced price UK Postage! We accept all major credit/debit cards. Make cheques/PO’s payable to Quasar Electronics. Prices include 17.5% VAT. Call now for our FREE CATALOGUE with details of over 300 kits, projects, modules and publications. Discounts for bulk quantities. 0871 7 Credit Card 177 168 Get Plugged In! Motor Drivers/Controllers Here are just a few of our controller and driver modules for AC, DC, unipolar/bipolar stepper motors and servo motors. See website for full details. Controllers & Loggers Here are just a few of the controller and data acquisition and control units we have. See website for full details. Suitable PSU for all units: Order Code PSU445 £8.95 NEW! PC / Standalone Unipolar Stepper Motor Driver Drives any 5, 6 or 8-lead unipolar stepper motor rated up to 6 Amps max. Provides speed and direc- tion control. Operates in stand-alone or PC- controlled mode. Up to six 3179 driver boards can be connected to a single parallel port. Supply: 9Vdc. PCB: 80x50mm. Kit Order Code: 31 79KT - £1 1 .95 Assembled Order Code: AS3179 - £19.95 NEW! Bi-Polar Stepper Motor Driver Drive any bi-polar stepper motor using externally sup- plied 5V levels for stepping and direction control. These usually come from software running on a computer. Supply: 8-30Vdc. PCB: 75x85mm. Kit Order Code: 3158KT - £15.95 Assembled Order Code: AS3158 - £29.95 NEW! Bidirectional DC Motor Controller Controls the speed of most common DC motors (rated up to 16Vdc/5A) in both the forward and reverse direction. The range of control is from fully OFF to fully ON in both directions. The direction and speed are con- trolled using a single potentiometer. Screw terminal block for connections. Kit Order Code: 3166KT - £16.95 Assembled Order Code: AS3166 - £25.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 - £13.95 Assembled Order Code: AS3067 - £20.95 Most items are available in kit form (KT suffix) or assembled and ready for use (AS prefix). 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 con- trol and sensing applica- tions. Controlled via serial port for programming (using our new Windows interface, terminal emulator or batch files). Includes plastic case 130x100x30mm. Supply: 12Vdc/500mA. Kit Order Code: 3108KT - £54.95 Assembled Order Code: AS3108 - £64.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 free software appli- cations for storing/using data. PCB just 38x38mm. Powered by PC. Includes one DS1820 sensor and four header cables. Kit Order Code: 3145KT - £18.95 Assembled Order Code: AS3145 - £25.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 - £44.95 Assembled Order Code: AS3180 - £51.95 NEW! DTMF Telephone Relay Switcher Call your phone number using a DTMF phone from anywhere in the world and remotely turn on/off any of the 4 relays as desired. 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 - £46.95 Assembled Order Code: AS3140 - £64.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 - £47.95 Assembled Order Code: AS3142 - £66.95 PIC & ATMEL Programmers We have a wide range of low cost PIC and ATMEL Programmers. Complete range and documentation available from our web site. Programmer Accessories: 40-pin Wide ZIF socket (ZIF40W) £15.00 18Vdc Power supply (PSU010) £19.95 Leads: Parallel (LDC136) £4.95 / Serial (LDC441) £4.95 / USB (LDC644) £2.95 NEW! USB & Serial Port PIC Programmer USB/Serial connection. Header cable for ICSP. Free Windows XP software. Wide range of supported PICs - see website for complete listing. ZIF Socket/USB lead not included. Supply: 16-18Vdc. Kit Order Code: 3149EKT - £37.95 Assembled Order Code: AS3149E - £52.95 NEW! USB 'All-Flash' PIC Programme^ USB PIC programmer for all ‘Flash’ devices. No external power supply making it truly portable. Supplied with box and Windows Software. ZIF Socket and USB lead not included. Assembled Order Code: AS3128 - £44.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 controllers. Free fully functional software. Blank chip auto detect for super fast bulk programming. Parallel port connection. Supply: 16-18Vdc. Assembled Order Code: AS31 17 - £24.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 - £24.95 Assembled Order Code: AS3123 - £34.95 \ i- www. QuasarElectronics. com Secure Online Ordering Facilities • Full Product Listing, Descriptions & Photos • Kit Documentation & Software Downloads HANDS-ON MINI PROJECT Hard water is still the cause of all sorts of problems, in spite of the fact that standard tap water these days is (partially) decalcified. Scale deposits can lead to the failure of heating elements in various appliances or cause blockages in boilers, with possibly not insignificant financial consequences. Fortunately it is quite easy to do something about it! Although the water supplied by nearly all utilities these days is (partially) de- calcified, it can still be worthwhile to soften the water a little more. Assum- ing a hardness of 8 German degrees (°D) — not uncommon in the UK — there is still a moderate amount of cal- cium hydrogen carbonate dissolved in the water. If the water is heated, then insoluble calcium carbonate is formed (this is popularly referred to as calcium or scale deposits). The very fine calci- um carbonate particles deposit mainly on the hot parts of appliances that heat water and form the notorious scale (for example on the heating element of a washing machine or the bottom of a cooking pot). There exist a number of methods to make hard water soft which make clever use of chemical processes. One method that does not involve chemis- try requires the application of a very strong magnetic field. When the water flows through such a field, larger calci- um particles are formed by coagulation which do not deposit quite so easily onto a surface. The result: no calcium stains on sanitary fittings and no scale deposits on heating elements. The water has not really been made any softer after this treatment because all the calcium is still there, it is just that it is not causing us any trouble any more. In addition, we don't really need to get rid of this calcium anyway because this mineral is only harmful to appliances but not to humans (quite the contrary). Whether such an (electro )magnetic wa- ter- ‘softener’ actually works is a topic of fierce debate with widely ranging opin- ions. Feel free to Google the Internet for more information on this subject. Whatever can be done with a magnetic field can also be done (or at least it ap- pears that way) with electromagnetic fields. With a handful of parts for just a few pounds we can make such an elec- tronic water softener ourselves. The circuit drives a couple of coils that function as transmitting antennas. They are wrapped around the water pipe, so that an electromagnetic field (the radio waves) is induced in the wa- ter. In order that both the magnetic as well as the electric field components of the radio waves can penetrate into the water it is best that the coil antennas are wound around a (section of) plastic water pipe. Schematic The operation of the circuit is as fol- lows (refer to Figure 1). An oscillator is built around two of the inverters in IC1 with R2 and Cl. This oscillator is tuned to about 2 kHz (t = 2.2 R2C1). This signal is subsequently buffered by two inverters connected in parallel and sent to coil LI. This signal is in- verted again and connected to coil L2, so that between the two coils there is a square- wave voltage with a peak-to- peak value that is double that of the power supply voltage. The supply volt- age is regulated with a 78L09. You can easily make the coils yourself from copper wire with a diameter of about 1 mm. Take two pieces of about a meter long (depending on the diam- eter of the water pipe and the desired number of turns) and make with each wire about 15 turns around the water pipe. It is best if the windings are sepa- rated from each other a little. Make sure that the winding direction is the same for both coils. Refer also to Figure 2. For the power supply you can use any 70 elektor electronics - 3/2007 IC1A IC2 Figure 3. The PCB layout is not very difficult at all with so few components. igure 1. The schematic comprises only 10 components and 2 connectors. spare mains wall adapter that supplies a DC voltage in the range from 12 to 15 V Experimenting There is of course plenty of scope to ex- periment with this circuit: you can put the windings closer together, increase the frequency, reverse the winding di- rection of the coils, change the loca- tion of the coils on the water pipe, try whether the coils work better around a copper pipe or a plastic one (the latter has our preference), and many more. How much effect this circuit ultimately has can only be established over the long term. Some users of such elec- tronic water softeners (which includes a few colleagues) are wildly enthusi- astic about them, while others assert that they notice absolutely no differ- ence. So just try it for yourself, you can build this circuit for a mere few pounds and that is considerably cheaper than similar read-made devices that can be bought in the shops for this purpose. ( 070001 - 1 ) Figure 2. The coils LI and L2 consist of about 15 turns which are placed next to each other. [ COMPONENTS LIST ] Resistors Rl,R2=lkQ Capacitors Cl = 220nF | C2,C4 = 47jllF 25V I C3,C5,C6 = lOOnF | I Semiconductors | I IC1 = 4049 | | IC2 = 78L09 | | Miscellaneous | I K1 = 2-way PCB terminal block, lead | 1 pitch 5mm I I K2 = DC adapter socket I I PCB, ref. 070001 -1 , from ThePCBShop I I (see www.elektor-electronics.co.uk) I 3/2007 - elektor electronics 71 HANDS-ON MODDING & TWEAKING Etnermeter An alternative netwerk cable tester Jeroen Domburg & Thijs Beckers Although wireless networks are becoming more popular these days, cabled networks are still in widespread use. They are usually faster, cheaper (equipment-wise), more secure and easier to configure. One disadvantage of such a hard-wired connection is that the information carrier (the cable) can sometimes give up the ghost. We have designed this circuit to provide a simple test of the connections. In larger networks it sometimes happens that a cable no longer makes a good connection or has simply been plugged into the wrong socket on the switch. This makes it more difficult to configure the network or to find out where the problem is when things go wrong. The number of components in this circuit is so small that it can easily be built on a left over piece of experimenter's board. An empty breath refreshers tin was used for the enclosure. It's just big enough to take three AAA batteries, the circuit board and the connector. Network problems For the first type of problem the average network techni- cian will have a useful tool in his toolbox: a cable tester. This usually consists of two boxes, which are connected to the ends of the cable to be tested. One of the boxes will then put a voltage on each of the eight cores of the ca- ble, one at a time. The box at the other end will indicate with LEDs if this voltage has been detected and if it came through the right signal line. In practice there can be many other causes of failure than just the cable. The connector on the switch may have oxi- dised or a spike induced in the cable by a nearby light- ning strike may have damaged the switch input. In places where several switches are used or where there are long cable runs it can be difficult to find the other end of the cable. In a perfect world all patch leads should be clearly numbered and for each number it should be docu- mented where the connection ends up. In practice you'll find that several undocumented mutations have occurred in the cabling. In those circumstances it is very difficult to find the other end of the cable and plug it into the second half of the cable tester. Analysis and implementation The circuit presented here has been designed to over- come these problems. It works as follows: The suspect cable is connected to the tester. If no problems are found with the cable the corresponding LED on the switch where the other end of the cable is plugged into will start flash- ing. This makes it easy to spot which connection belongs to the cable. You should be able to tell quickly if the cable (or at least the two cable pairs required for 10/100 Mbit communications) is faulty. Although the idea itself may appear simple, it doesn't mean that the implementation will also be easy. To make an LED flash on the switch you need more than just a cer- tain voltage on the cable or a continuity between cables. To understand how to do this we need to find out more about how an Ethernet link works at the physical level. An Ethernet cable consists of four pairs of conductors, of 72 elektor electronics - 3/2007 About the author Jeroen Domburg is a student at the Saxion Technical University in Enschede, the Netherlands. Jeroen is an enthusiastic hobbyist, with interests in microcontrollers, electronics and computers. In this column he displays his personal handiwork, modifications and other interesting circuits, which do not necessarily have to be useful. In most cases they are not likely to win a beauty contest and safety is generally taken with a grain of salt. But that doesn't concern the author at all. As long as the circuit does what it was intended for then all is well. You have been warned! which only two are used for 1 0 Mbit and the most com- monly used type of 1 00 Mbit. The method of commu- nications over these wires differs between 1 0 Mbit, the various versions of 1 00 Mbit and 1 000 Mbit Ethernet. But since we only want to test the cables and light up an LED on the switch, it is sufficient to look at just the 1 0 Mbit specification. The specification for the Ethernet protocol is known as the 'IEEE 802.3 LAN/MAN CSMA/CD Access Method'. This can be freely downloaded from the IEEE website [1]. Amongst other things, it describes the different trans- port layers for 1 0 Mbit Ethernet, such as coaxial cable, thicknet, glass fibre and UTP. From this document we've extracted a few specifications that are relevant to our UTP based tester. The four signal lines used are called Tx+, Tx-, Rx+ and Rx-. The transmission of data over UTP is differential. This means that when Tx+ becomes positive, Tx- becomes negative and vice versa. This is a standard method used to prevent electromagnetic interference (the same method is used for RS422/RS485). 1 0 Mbit makes uses of Manchester encoding to put 'ones' and 'zeroes' onto the signal line. This means that a '0' is represented by a low-high transition, while a '1 ' is represented by a high-low transition. This results in there always being enough transitions during a transmission to extract the clock signal. The average voltage on the sig- nal lines stays at 0 V. The voltage of the signals should be between 2.2 V and 2.8 V. To show when a link is active, use is made of so- called Link Integrity Test pulses (LIT, also known as Normal Link Pulse or NLP). These are pulses with a pulse-width of 1 bit period (1/10,000,000=100 ns). These pulses are sent every 1 6 ms, as long as there is no other network traffic. To send a link signal it is sufficient to put a 1 00 ns pulse onto the line every 16 ms. To check that there is a connection from the switch we have to detect signals with a voltage from 2.2 V to 2.8 V. If these are present we can assume that there is a switch at the other end of the cable that is sending either LIT pulses or network traffic. Another ATtiny231 3 Although it is possible to build a circuit that can create and detect the required signals using only discrete TTL ICs, to make life easy we decided to make use again of the Atmel ATti ny23 1 3 AVR (see Figure 1). This has a clock that runs at 20 MHz, so the sending and detecting of LIT signals shouldn't be a problem. Ethernet signals should normally be galvanically isolated, The circuit is at a working stage. Now we just add the supply (batteries) and mount it into a box. Using two cut-offs and a pair of battery springs from some old equipment you can make a passable battery holder. It fits exactly. The black cube on the left is the UTP connector. 3/2007 - elektor electronics 73 HANDS-ON MODDING & TWEAKING rO BT1 i 4V5 E C3 □ C4 lOOn R1 K1 RJ45 1 TX+ — I iooq| — i 1 1 I 16 2 3 6 16 2 TX- 17 3 RX+ RX pair 14 15 -@ +4V5 20 © RESET PD3 PDO PD4 IC1 PD1 PD5 PD2 PD6 ATTiny2313 PB4 PB7 PB5 PB6 PB2 PB1 PB3 PBO X o X Cl 22p XI iHi C2 20MHz EL, 7 _8 _9 11 19 18 13 12 ttDI R3 W-&I RX MD2 R4 -^| — I 470 n I — it TX 10 D3 R5 — — | 470 Q | — it POWER 075035 - 1 1 Figure 1. The circuit for the Ethernet tester is fairly small due to the use of an ATtiny2313. but because the circuit is battery-powered we can connect the UTP lines directly to the microcontroller. The TX lines are terminated with a resistor of 1 00 Q (as they should be), but for the RX lines this resistor has a value of 220 Q. The reason for this is as follows: With a 4.5 V supply volt- age the microcontroller can only be guaranteed to inter- pret a signal of 3.1 V as 'high'. Since Ethernet signals are normally in the range of 2.2 V to 2.8 V, this will not al- ways work. But by increasing the terminating resistor we increase the voltage level and the detection works well. An increase of this resistor would normally mean that the signal will become distorted, making reliable data trans- mission difficult, but in this application that doesn't matter. Something that is noticeable from its absence in the circuit diagram is an on/off switch. This has intentionally been left out. The microcontroller itself can determine when the tester should be turned on and off. When the circuit is not in use, the microcontroller is woken up once a second, when it checks if there is an electrical connection between the TX pins of the RJ45 plug. If this isn't the case, the mi- crocontroller goes back into sleep-mode. In this mode the circuit only uses a few tens of microamps, which means that a set of AAA batteries should last a couple of years. When the cable is connected to a switch the circuit jumps into action. A switch terminates the TX lines with a 1 00 £2 resistor, which produces an electrical connection between the TX lines. The user interface has been kept simple and consists of three LEDs. The bottom one shows that the circuit is turned on (meaning that the TX pair and terminating resistor in the switch appear to be in order). The top one shows that a signal is detected from the switch (meaning that the RX pair and the associated logic in the switch are in order). The middle LED indicates when the tester is sending LIT pulses. This LED goes on and off every 4 seconds. And because the presence of these LIT pulses is a sign for the switch that there is a network connection, the indicator on the switch will follow at about the same rate. The microcontroller obviously requires some firmware to function. This has been written in assembly language and both the source code and hex files are available from the author's [2] and Elektor Electronics' [3] websites, as long as the network cables hold out... ( 075035 ) Web links [1 ] http://standards.ieee.org/getieee802/802. 3.html [2] http://sprite.student.utwente.nl/~jeroen/projects/ethermeter/ [3] www.elektor-electronics.co.uk/ (March 2007) 74 elektor electronics - 3/2007 DESIGN TIPS HANDS-ON Open CMOS inputs Luc Lemmens As a consequence of poor solder- ing or an etching fault when mak- ing the PCB it can happen that there is no connection between two points. Etching faults in par- ticular can take an enormous amount of time when fault finding the PCB. Poor solder joints with through-hole PCBs are still rea- sonably easy to find by careful inspection of the solder job. With small SMD components this is al- ready a lot more difficult, often requiring the use of a magnifying glass. Since the arrival of lead- free solder, this visual inspection has become much more difficult anyway. Solder with lead gives a nice shiny finish to the connection to indicate that the solder flowed well, a dull surface indicates too much heat or too much time mak- ing the connection which is then likely to be of poor quality. Lead- free solder is always dull in ap- pearance and we therefore have lost a good indicator regarding the quality of the solder joint. CMOS inputs may never be left open circuit. There is a chance that the input ends up at half the supply voltage and the cur- rent consumption of the 1C will increase enormously. Besides, it can cause noisy interference that can be detected throughout the entire 1C or surrounding cir- cuit. Whenever the input is open, perhaps because of a design er- ror, poor soldering or a broken PCB track, it is important that this problem is fixed as soon as pos- sible since it is quite possible that the 1C will fail. The most thorough method is to test all connections on the PCB with a multimeter, but this is very time consuming and almost impracticable with all but the simplest of circuit boards. With a little trick, it is very sim- ple to check with an oscilloscope whether a CMOS-input is dan- gling free: Take the probe clip from the probe, measure at an input and at the same time touch the input with a finger. If the input is open we will see the 50-Hz (60-Hz) mains hum on the scope that we are picking up ourselves and ap- plying with our finger to the high- impedance input. Beware: the input has such a high impedance that it is also susceptible to static discharges. So make sure that you first dis- charge your hands and just to be sure touch the ground of the cir- cuit with your other 'free' hand. In this way the risk of damaging the circuit with this measurement is very low. ( 070054 - 1 ) From 5 to 3.3 V Luc Lemmens Many microcontrollers these days are powered from 3.3 V (or oven lower voltages) instead of the old, familiar 5 V. Lower- ing the dissipation and increas- ing the switching speed are the main considerations for reducing the power supply voltage. In ad- dition, the ever continuing min- iaturisation results in transistors inside the ICs that are so small that the breakdown-voltage has become much lower and a 5 - V power supply would cause problems. But many of the peripheral ICs have not (yet) followed this low- ering of the supply voltage, with the result that many circuits need two or more different power sup- ply voltages. Assuming that a 5-V power supply is already present, there are several simple methods that can be thought of to derive 3.3 V from that. The most obvious solution is to use a Low Drop Out (LDO) volt- age regulator with a 3.3 V out- put. This regulator must be an LDO type, because a 'normal' regulator has a drop-out voltage of 2 to 3 V and we don't have that much to play with. A second method (see Figure 2) is very cheap: a resistor and a 3.3-V zener diode. But since the zener voltage depends on the current through the zener, it is very important that the cor- rect value is chosen for R1 . R1 has to be low enough so that the power supply voltage of the mi- crocontroller is still high enough when the controller draws the maximum amount of current. Ad- ditionally, the value of R1 has to be such that the power supply voltage does not rise too much when the controller current is al- most zero (for example during reset) . We can see another simple solu- tion in Figure 2, where we use the voltage drop across a diode in conduction. This voltage drop is also dependant on the current through the diodes and R1 has to ensure that the voltage across the microcontroller does not be- come too high when its current consumption is negligible. The diodes have to be selected in such a way that the voltage drop across them is not too high when the microcontroller draws the maximum amount of current. And finally there is always the switching power supply (step- down converter) to make 3.3 V. There are also special ICs avail- able that can generate multiple output voltages at the same time. Which method you end up using will depend on a number of con- siderations such as cost, avail- able space on the PCB and the required regulation of the 3.3-V power supply voltage. In par- ticular with regard to the latter consideration, the solutions with diodes are inferior, but they are certainly very small and cheap! ( 070055 - 1 ) 3/2007 - elektor electronics 75 INFOTAINMENT RETRONICS 8052-AH BASIC Single-Board Computer (1987) Jan Buiting No flash memory devices, no USB, no JTAG and no Internet, but we did have those 27Cxxx windowed EPROMs, RS232 ter- minals or emulators, the odd PC and a few good friends in Intel's 1C distribution channels. The perfect circumstances, as it turned out, for Elektor to become the first electron- ics journal to not only publish a single- board computer based on Intel's 8052-AH-BA- SIC microcon- troller, but also to sell the associated high-quality double-sided PCB. The latter went in vast quantities, report- edly over 5,000 pieces were sold to enthusiastic users, ama- teur and professional, all over the globe. The instant success of the project proved that there was lots of in- terest in programming a micro- controller in BASIC rather than assembly language. Sceptics, aplenty immediately after the publication of the November 1 987 issue, soon fell silent when the actual code executed by the 8052AH micro was valued in terms of speed. The general ver- dict: "not bad at all, that inter- preter is worth its salt". The BASIC programs for this SBC were written using an ordi- nary ASCII savvy word proces- sor on a PC — in compliance, of course, with the relevant syntax described by Intel in their MCS BASIC-52 Users Manual, which was much sought after. Nor sur- prisingly, photocopies (138 pag- es thick) soon surfaced in the electronics retail trade. token i- sation took place, boiling down in essence to an interpreter (ROMed in the micro) convert- ing ASCII signs to 8051 ma- chine code. And a pretty good job it did, albeit that small bugs and imperfections were soon no- ticed by experts in 8051 family programming. One particularly well liked feature of MCS52 BA- SIC was the ability for program- mers to insert a chunk of assem- bly code straight into the BASIC program. The Elektor 8052AH-BASIC com- puter is likely to have helped an odd-looking frequency like 1 1 .0592 MHz become a stand- ard value for quartz crystals. The reason: the 8051 core divides the clock frequency down to en- able standard baud rates like 1200 or 2400 bits/s to be used on the serial line con- nected to the PC's RS232 port. The SBC design included an on-board EPROM programmer which was cheerfully supported by MCS-52 BASIC. Its orderly use comprised no more than the 8052AH faithfully programming 2764s and 271 28s. However a not so orderly application of the programmer came from simple combination of two facts: (1 ) the 8052AH-BASIC micro is a com- bination of a regular 8051 core and an in- terpreter in on- chip ROM, and (2) the device was fright- fully expensive com- pared to, say, a 80C32. Although the method was never described in detail in Elektor for fear of repercussions from Intel, keen users of the SBC were soon successful in making the 8052AH micro extract and transfer its own interpreter into a file! Next, eve- rybody started using 80C32 mic- ros running BASIC from external EPROM. The alternative was not only much cheaper, but could also be tweaked for speed and performance. At a much later date, I think it was around 1 992, Intel released MCS BASIC-52 into the public domain. A flurry of 80C32 SBCs was the result, including our own. Next, the text file containing the BASIC program had to be trans- ferred to the 8052AH micro by means of a communications pro- gram (a.k.a. terminal emulator) like Procomm or Telix. During handshake-driven downloading to the 8052AH, a process called Some IBM PC user on our staff must have learned the hard way that BRST at that time stood for Big Red Switch Time and he or she pencilled the equivalent on the reset pushbutton of the 8052- AH BASIC prototype in our lab, with due correction for colour. ( 075025 - 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-electronics.co.uk, subject: Retronics EE. 76 elektor electronics - 3/2007 PUZZLE INFOTAINMENT Hexadoku Puzzle with an electronic touch Hexadoku is drawing not just hundreds of correct answers every month but also encouraging feedback and other kind words from you all. Needless to say we're very pleased to see that Hexadoku has become an established part of the magazine. Participate! Please send your solution (the numbers in the grey boxes) by email to: editor@elektor-electronics.co.uk Subject: hexadoku 03-2007. Alternatively, by fax or post to: Elektor Electronics Hexadoku Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom. Fax (+44)(0)208 2614447 The closing date is 1 April 2007. The competition is not open to employees of Segment b.v., its business partners and/or associated publishing houses. The instructions for this puzzle are straightforward. In the di- agram composed of 1 6 x 1 6 boxes, enter numbers such that all hexadecimal numbers 0 through F (that's 0-9 and A-F) occur once only in each row, once in each column and in each of the 4x4 boxes (marked by the thicker black lines). A number of clues are given in the puzzle and these determine the start situation. All correct entries received for each month's puzzle go into a draw for a main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. The puzzle is also available as a free download from our website (Magazine -> 2007 -» March). Prize winners The solution of the January 2007 Hexadoku is: 038FA The E-blocks Starter Kit Professional goes to: Peter Hinchcliffe, Fleet (UK). An Elektor SHOP voucher worth £35.00 goes to: Bjarne Lassen (DK); Harold Paulsen (N); Andrew Col lister (UK) Congratulations everybody! D 6 8 A 2 B 9 F 2 1 3 6 7 8 4 3 C D 0 5 1 A 2 E 7 F 3 5 1 C B 3 F 4 5 8 7 1 9 8 0 D C 3 4 F 0 A 5 C 7 8 E D 6 5 C 2 B E F 1 9 7 A D F 0 7 2 1 9 C F 8 B D 4 7 3 5 8 1 D F 4 0 E 9 B C 1 8 D 3 1 2 7 C 5 4 F A 7 5 D 8 3 E 9 A 6 4 2 0 D F 5 7 8 9 2 (c) PZZL.com Solve Hexadoku and win! Correct solutions received enter a prize draw for an E-blocks Starter Kit Professional worth £248.55 and three Elektor Electronics SHOP Vouchers worth £35.00 each. We believe these prizes should encourage all our readers to participate! 3/2007 - elektor electronics 77 ELEKTOR SHOWCASE To book your showcase space contact Huson International Media Tel. 0044 (0) 1932 564999 Fax 0044 (0) 1 932 564998 ATC SEMITEC LTD www. atcse mitec.co.uk Thermal and current-sensitive components for temperature control and circuit protection; • NTC Thermistors • Current Diodes • Thermostats • Re-settable Fuses • Thermal Fuses • Temperature Sensors Call today for free samples and pricing Tel: 01 606 871 680 Fax: 01 606 872938 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 £15.00. BAEC http://baec.tripod.com "The British Amateur Electronics Club Archive Website. Archiving extracts from 140+ Newsletters from 1966- 2002. Currently have interesting and useful selected articles from 12 Newsletters. Also a section about built electronics projects with schematics and photos. Plus useful info., downloads and links. NO ADVERTS!" 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. CONFORD ELECTRONICS http://www.confordelec.co.uk Lightweight portable battery/mains audio units offering the highest technical performance. Microphone, Phantom Power and Headphone Amplifiers. Balanced/unbalanced signal lines with extensive RFI protection. EASYSYNC http://www.easysync.co.uk EasySync Ltd sells a wide range of single and multi- port USB to RS232/RS422 and RS485 converters at competitive prices. HEROS TECHNOLOGY LTD www.herostechnology.co.uk Introducing Modular Concept for microcontrollers. Suitable for Developers, Pre-production, Educational and Hobby applications. • WinPIC2006 USB full speed programmer. • CPU microcontroller modules. • Peripheral modules for all microcontrollers. ELNEC www.elnec.com • device programmer manufacturer • selling through contracted distributors all over the world • universal and dedicated device programmers • excellent support and after sale support • free SW updates • reliable HW • once a months new SW release • three years warranty for most programmers rwJwiatofly TramilWr tfd FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk/PICProTrng.html Microchip Professional C and Assembly Programming Courses. The future is embedded. Microchip Consultant /Training Partner developed courses: • Distance learning / instructor led • Assembly / C-Programming of PIC1 6, PIC1 8, PIC24, dsPIC microcontrollers • Foundation / Intermediate FUTURE TECHNOLOGY DEVICES http://www.ftdichip.com FTDI designs and sells USB-UART and USB-FIFO interface i.c.’s. Complete with PC drivers, these devices simplify the task of designing or upgrading peripherals to USB LONDON ELECTRONICS COLLEGE http://www.lec.org.uk Vocational training and education for national qualifications in Electronics Engineering and Information Technology (BTEC First National, Higher National NVQs, GCSEs and Advanced Qualifications). Also Technical Management and Languages. MODular ElecTRONics www.modetron.com • Plug and Program • FREE application s/w • Hobbyist ease-of-use • Professional finish with enclosure and LEXAN faceplate • We will design and brand your custom application • Growing range of PSU’s, i/o modules, displays and microcontrollers 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 electronics - 3/2007 products and services directory NEW WAVE CONCEPTS www.new-wave-concepts.com Software for Hobbyists: • Livewire - circuit simulation software, only £34.99 • PCB Wizard - PCB design software, only £34.99 • Circuit Wizard - circuit, PCB and breadboard design software, only £59.99 Available from all Maplin Electronics stores and www.maplin.co.uk PCB WORLD http://www.pcbworld.org.uk World-class site: Your magazine project or prototype PCB from the artwork of your choice for less. Call Lee on 07946 846159 for details. Prompt service. 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 SOURCEBOOST TECHNOLOGIES http://www.sourceboost.com Next generation C compiler and development products at highly affordable prices: • C, C++, and Basic compilers for PIC1 2, PIC1 6, PIC18 • Modern IDE, with PIC simulator, source level debugger and virtual devices. • RTOS for PICmicro. • PIC based controller and Development boards. • Download and try for Free from http://www.sourceboost.com SYTRONIC TECHNOLOGY LTD www.m2mtelemetry.com Supplier of wireless modules and accessories for remote monitoring M2M applications. • GSM/GPRS TCP/IP modules • Embedded GSM/GPRS modem • Development Kits • GPS modules • GSM/GPS antennas • Adapter cables Online ordering facilities. Tel: 01728 685802 ULTRALEDS |L/J tra 1 eda *.* http://www.ultraleds.co.uk tel: 0871 7110413 Large range of low cost Ultra bright leds and Led related lighting products. Major credit cards taken online with same day depatch. USB INSTRUMENTS http://www.usb-instruments.com USB Instruments specialises in PC based instrumentation products and software such as Oscilloscopes, Data Loggers, Logic Analaysers which interface to your PC via USB. VIRTINS TECHNOLOGY www.virtins.com PC and Pocket PC based virtual instrument such as sound card real time oscilloscope, spectrum analyzer, signal generator, multimeter, sound meter, distortion analyzer, LCR meter. Free to download and try. SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business, Showcase - a permanent feature of the magazine where you will be able to showcase your products and services. • For just £220 + VAT (£20 per issue for eleven issues) Elektor will publish your company name, website adress and a 30-word description • For £330 + VAT for the year (£30 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 £220 + VAT • Text and photo for £330 + VAT NAME: ORGANISATION: JOB TITLE: ADDRESS: TEL: PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 00-44-(0)1932 564998 COMPANY NAME WEB ADDRESS 30- WORD DESCRIPTION 3/2007 - elektor electronics 79 “Elektor? If our teachers knew just how easily some concepts can be explained...” - Daniel Judd, 23, student - lektor i o e tf *55 s < ! "' I r ProMcFi p HI t • “ Electronics at all the right Secure a head start in electronics with a Student Subscription!* levels Advantages to subscribers: www.elektor-electronics.co.uk/subs Tel. +44 (0) 208 261 4509 the world-leading network for electronics lektor Order now using the Order Form in the Readers Services section in this issue. CD-ROM £18.95 (US$ 34.95) USB TOOLBOX This CD-ROM contains techni- cal data about the USB inter- face. It also includes a large collection of data sheets for specific USB components from a wide range of manufacturers. There are two ways to incorpo- rate a USB interface in a micro- controller circuit: add a USB controller to an existing circuit, or use a microcon- troller with an integrated USB interface. Included on this CD-ROM are USB Basic Facts, several useful design tools for hardware and software, and all Elektor Electronics articles on the subject of USB. Home Automation This CD-ROM provides an overview of what manufacturers offer today in the field of Home Networking, both wired and wireless. The CD-ROM contains specifications, standards and protocols of commercially avai- lable bus and network systems. For developers, there are data- sheets of specific components and various items with application data. End-users and hobbyists will find ready-made applications that can be used immediately. Audio Collection 2 A unique CD-ROM for the true audio lover, containing no fewer than 75 audio designs from the past five year volumes of Elektor Electronics magazine. The articles on the CD-ROM cover test & measurement equip- ment, amplifiers, digital audio and loudspeaker technology. Highlights include the Crescendo Millennium Edition, Audio-DAC 2000, Audio-ADC 2000 and the IR-S/PDIF Transmitter and Receiver. Using the included Acrobat Reader you are able to browse the articles on your computer, as well as print texts, circuit diagrams and PCB layouts. £12.95 (US$ 22.90) £12.05 (US$ 21.25) Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Telephone +44 208 261 4509 Fax +44 208 261 4447 Email: sales@elektor-electronics.co.uk More information on www.elektor-electronics.co.uk PC-Interfaces under Windows PC Interfaces can be used for more than just the printer, mouse, modem and joy-stick! While it was relatively easy to directly access PC interfaces using a DOS computer, under Windows things are not all that simple. This book (CD-ROM incl.) shows you how it can be done. The authors describe the DIY construction and programming of a number of highly interesting circuits. Visual Basic for Electronics Engineering Applications This book is targeted towards those people that want to control existing or home made hardware from their computer. After familiarizing yourself with Visual Basic, its development environment and the toolset it offers are discussed in detail. Each topic is accompanied by clear, ready to ISBN 978-0-905705-68-2 run code, and where necessary, schematics are 476 Pages provided that will get your projects up to speed £27.50 (US$ 51.50) in no time. ISBN 0-905705-65-3 265 Pages £25.95 (US$ 52.00) BESTSELLING BOOKS Top-5 Visual Basic for Electronics Engineering Applications ISBN 978-0-905705-68-2 £27.50 (US$ 51.50) 2 ) Microcontroller Basics ISBN 978-0-905705-67-5 £18.70 (US$ 33.70) 3 ) PC-Interfaces under Windows ISBN 978-0-905705-65-1 £25.95 (US$ 52.00) 4) Modern High-end Valve Amplifiers ISBN 978-0-905705-63-7 £25.95 (US$ 52.00) 5) Handbook for Sound Technicians ISBN 978-0-905705-48-4 £20.75 (US$ 42.00) More bestsellers on www.elektoi^electronics.co.uk lektor Order o www.elektor-el Order now using the Order Form in the Readers Services section in this issue . SpYder Discovery Kit For Freescale MC9RS08KA, MC9S08QD, MC9S08QG and MC9S08SH microcontrollers (March 2007) Contains USB Prog ram mer/- Debugger BDM, CD-ROM and one MC9S08 8-pin PDIP microcontroller. 060296-91 Normal resale price: £ 20 ELEKTOR PRICE: £ 6 . 45 / $ 12.70 Explorer-16 Value Pack (January/February 2007) Thanks to an exclusive and one-off arrangement with Microchip UK, the Explorer-16 Value Pack is both unique (you won’t find it anywhere else in this configuration) as well as much cheaper than the individual components. Explorer-16 Demo Board Including PIC24F and dsPIC33F PIMs, CD-ROM, cable FREE WITH EVERY ELEKTOR KIT OR MODULE! PIC Kit 2 Starter Kit Including Low Pin Count Demo Board for 8-, 14-, and 20-pin PICmicros. Order an Elektor kit or module and receive a free SpYder Discovery Kit. Act fast as the offer is limited to stocks. Audio PICtail Plus daughterboard MPLAB C30 Discount Voucher Elektor Kits & Modules are listed on www.elektor-electronics.co.uk/kits 060280-91 £ 1 22.90 / $ 232.50 MORE READY-BUILT PROJECTS £ $ ClariTy 300-W Class-T Amplifier 030217-91 Amplifier board with SMDs pre-fitted; cores for LI & L2 34.50 55.70 Electrosmog Tester 050008-91 PCB, ready built and tested 50.00 94.25 050008-71 Matching enclosure 10.25 19.30 Flash Microcontroller Starter Kit 01 0208-91 Ready-assembled PCB incl. software, cable, adapter & related articles 69.00 1 12.50 Gameboy Digital Sampling Oscilloscope (GBDSO) 990082-91 Ready-assembled board, incl. the PC software and related articles 103.00 183.00 LPC210x ARMee Development System 040444-91 Processor board, ready-made and tested 25.50 48.05 Micro Webserver with MSC1210 Board 030060-91 Microprocessor Board, ready-assembled 75.90 142.95 044026-91 Network Extension Board, ready-assembled 44.50 83.95 044026-92 Combined package (030060-91 & 044026-91 & related articles) 117.50 220.95 No. 363 MARCH 2007 Attack of the SpYder 060296-91 SpYder Discovery Kit 6.45 12.70 AVR drives USB 060276-1 PCB, bare www.thepcbshop.com 060276-1 1 CD-ROM, project software incl. source code 5.20 9.75 060276-41 ATmega32-16PC, programmed 8.95 16.85 Wireless USB in Miniature 050402-1 PCB, bare, iDwarf prototyping board 8.30 15.60 050402-91 iDwarf -168 Transmitter module (built & tested) 24.10 45.45 050402-92 iDwarf Node Board (built & tested) 17.20 32.45 050402-93 iDwarf Hub Board (built & tested) 17.20 32.45 Mobile Phone LCD for PC 060184-1 PCB, bare www.thepcbshop.com 0601 84-1 1 CD-ROM, project software 5.20 9.75 060184-41 ATmega16-16PC, programmed 8.95 16.85 Scale Deposit Fighter 070001-1 PCB, bare www.thepcbshop.com No. 362 FEBRUARY 2007 ... 3, 2, 1 Takeoff! 050238-1 Transmitter PCB, bare www.thepcbshop.com 050238-2 Receiver PCB, bare www.thepcbshop.com MP3 Preamp 060237-1 PCB, bare www.thepcbshop.com A Telling Way of Telling the Time 050311-1 PCB, bare www.thepcbshop.com 050311-31 CPLD, programmed 35.50 66.95 FPGA Course (9) 060025-9-11 CD-ROM, course software incl. source code 5.20 9.75 Explorer-16 Value Pack 060280-91 Four components packaged together in a single box 122.90 232.50 No. 361 JANUARY 2007 Sputnik Time Machine 050018-1 PCB www.thepcbshop.com 050018-11 CD-ROM, project software (incl. source code) 5.20 9.75 050018-41 AT89C2051 , programmed 3.40 6.45 Very Simple Clock 060350-1 PCB www.thepcbshop.com 060350-1 1 CD-ROM, project software (incl. source code) 5.20 9.75 060350-41 PIC16F628-20, programmed 5.50 10.35 FPGA Course (8) 060025-8-1 Software (incl. source code) 5.20 9.75 No. 360 DECEMBER 2006 Shortwave Capture 030417-1 PCB, bare (receiver board) www.thepcbshop.com 03041 7-2 PCB, bare (control & display boards) www.thepcbshop.com 030417-41 AT90S8515-8PC, programmed 11.40 21.45 No. 359 NOVEMBER 2006 USB Stick with ARM and RS232 060006-1 PCB, bare 060006-41 AT91SAM7S64, programmed 060006-91 Assembled & tested board 060006-81 CD-ROM, all project software 11.00 20.75 27.60 51.95 79.90 149.95 5.20 9.75 nline at ectronics.co.uk Due to practical constraints, final illustrations and specifications may differ from published designs. Prices subject to change. See www.elektor-electronics.co.uk for up to date information. USB Stick with ARM and RS232 (November 2006) Assembled and tested board 060006-91 £ 79.90 / $ 1 49.95 GameBoy ElectroCardioGraph (October 2006) PCB, ready built and tested 050280-91 £ 55.20 / $ 1 03.95 Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 (0) 208 261 4509 Fax: +44 (0) 208 261 4447 Email: sales@elektor-electronics.co.uk Kits & Modules Elektor RFID Reader (September 2006) Ready-built and tested PCB with USB port for connection to the PC. Including USB cable; not including display and enclosure. - Read and write 13.56 MHz RFID cards - MIFARE and ISO 14443-A compatible - Programmable 060132-91 £ 41 .50 / $ 77.95 LC display 030451-72 £7.25/$ 13.65 Matching enclosure 060132-71 £8.90/$ 16.85 CD-ROM (all project software) 060132-81 £ 5.20 / $ 9.75 No. 358 OCTOBER 2006 PIC In-Circuit Debugger/Programmer 050348-1 PCB 5.20 9.75 050348-41 PIC16F877, programmed 17.90 33.75 050348-71 Kit, incl. PCB, controller, all parts 34.50 64.95 GBECG - Gameboy ElectroCardioGraph 050280-91 PCB, ready built and tested 55.20 103.95 ECG using a Sound Card 040479-1 PCB 5.20 9.75 040479-81 CD-ROM, all project software 5.20 9.75 No. 357 SEPTEMBER 2006 Elektor RFID Reader 060132-91 PCB, ready assembled & tested, with USB cable 41.50 77.95 030451-72 Standard back-lit LC display 7.25 13.65 060132-71 Matching enclosure 8.90 16.85 060132-81 CD-ROM, all project software 5.20 9.75 Experimental RFID Reader 060221 -1 1 Disk, all project software 5.20 9.75 060221-41 ATmegal 6, programmed 8.90 16.85 DiSEqC Monitor 040398-1 1 Disk, PIC source & hex code 5.20 9.75 040398-41 PIC16F628A-20/P, programmed 5.50 10.35 USB/DMX512 Converter 060012-1 1 Disk, all project software 5.20 9.75 060012-41 PIC16C745, programmed 6.90 12.95 No. 356 JULY/AUGUST 2006 RC Servo Tester/Exerciser 0401 72-1 1 Disk, project software 5.20 9.75 040172-41 PIC1 6F84(A), programmed 10.30 19.40 040172-71 Kit, incl. PCB, controller, all parts 22.70 42.85 LED Thermometer 0301 90-1 1 Disk, project software 5.20 9.75 030190-41 PIC16F873-20/SR programmed 16.50 31.00 Toothbrush Timer 0501 46-1 1 Disk, project software 5.20 9.75 050146-41 AT90S2313-10PC, programmed 6.90 12.95 Easy Home Control 050233-11 Disk, project software 5.20 9.75 050233-41 PIC16F84, programmed 10.30 19.40 Universal LCD Module 050259-11 Disk, project software 5.20 9.75 050259-41 AT90S2313, programmed 6.90 12.95 1-Wire Thermometer with LCD 060090-11 Disk, project software 5.20 9.75 060090-41 PIC16F84A-04CP, programmed 10.30 19.40 GBPLC - Gameboy PLC 050190-1+2 PCBs, bare, GBPLC Module & Programming Interface 11.70 22.00 050190-51 Programmed PAL, EEPROM and Flash 1C 11.00 20.75 050190-91 Ready-built and tested GBPLC Module and Programming Interface 84.95 159.95 GBPLC - I2C I/O Box 060098-1 PCB, bare 17.90 33.75 060098-91 Ready-built and tested board 84.95 159.95 Binary Clock 020390-11 Disk, project software 5.20 9.75 020390-41 PIC6C54-04/P, programmed 8.05 15.10 No. 355 JUNE 2006 FM Stereo Test Transmitter 050268-1 PCB 11.70 22.00 Network Cable Analyser 050302-1 PCB 8.20 15.55 050302-11 Disk, PIC source code 5.20 9.75 050302-41 PIC16F874-20/P 16.90 31.85 No. 354 MAY 2006 Onboard OBD-2 Analyser 0501 76-72 Kit of parts, incl. 0501 76-1 , 0501 76-2, 0501 76-42, all components, excl. LCD and Case 24.80 46.70 050176-73 LCD, 4x20 characters with backlight 28.80 54.50 Products for older projects (if available) may be found on our website www.elektor-electronics.co.uk home construction = fun and added value INFO & MARKET SNEAK PREVIEW Two-Axis Accelerometer The April 2007 issue will have our first, educationally aimed, application for the SpYder kit — an accelerometer with an LED readout for direction or and amount (up to 2 g) acceleration (+g ) or deceleration (-g). Install the circuit in your car, on your bike, motorbike or scooter and discover if your driving habits cause any of the red LEDs to light! The project is built on two small, stacked PCBs, purposely designed to take ordinary leaded components. It goes to show the ease of getting a Freescale MC9S08 microcontroller to work using the low-cost SpYder & CodeWarrior environment for programming and debugging. The two PCBs come with a free accelerometer device ready-mounted on a small carrier board. Freescale 68HC08 Programmer Apart from the microcontrollers described in this month's SpYder article, Freescale also produces devices from a heritage family known as 68HC08. We describe a small but useful programmer/debugger for connection between the serial port on the PC and the MON08 connector on the MC08 target board. Versatile Battery Charger / Discharger More and more battery-powered electronics devices appear on the market. Although portability is great in itself, manufacturers have a habit of using batteries with many different sizes and technologies, resulting in lots of different chargers being required at the customer end. In the April 2007 issue we describe a compact unit combining the functions of charger, discharger and capacity tester for NiMH, NiCd, LiPo and Lilon batteries. The unit supplies 0.2 A to 4.5 A in charger mode, and sinks 0.2 A to 5 A in discharger mode. Up to eight NiMH/NiCd cells, or two LiPo/Lilon cells may be charged or discharged in series. Also... Explorer- 16 (4); Free Energy?; Solar Cell Technology; Simple Solar Charger; Power Inverter; Mini Project; Hexadoku. RESERVE YOUR COPY NOW! The April 2007 issue goes on sale on Thursday 29 March 2007 (UK distribution only). UK mainland subscribers will receive the magazine between 24 and 27 March 2007. Article titles and magazine contents subject to change, please check www.elektor-electronics.co.uk. NEWSAGENTS ORDER FORM SHOP SAVE / HOME DELIVERY Please save / deliver one copy of Elektor Electronics magazine for me each month Name: Address: Post code: Telephone: Date: Signature: lectronics Please cut out or photocopy this form, complete details and hand to your newsagent. Elektor Electronics is published on the third Thursday of each month, except in July. Distribution S.O.R. by Seymour (NS). .elektor-electronics.co.uk www.elektor-electronics.co.uk www.elektor-electronics.ci Elektor Electronics S3 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 down- loads, circuit boards, programmed ICs and corrections and updates if applicable. Complete magazine issues may also be downloaded. In the Elektor Electronics 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 Electronics website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Surveys and polls • FAQ, Author Guidelines and Contact 84 elektor electronics - 2/2007 Order FdH Order Fdh Please supply the following. For PCBs, front panel foils, EPROMs, PALs, GALs, microcontrollers and diskettes, state the part number and description; for books, state the full title; for photocopies of articles, state full name of article and month and year of publication. PLEASE USE BLOCK CAPITALS. Description Price each Qty. Total Order Code SpYder Discovery Kit Explorer-16 Value Pack CD-ROM Elektor 2006 CD-ROM USB Toolbox (323 £ 6.45 £ 122.90 £ 16.25 £ 18.95 Visual Basic for Electronics Engineering Applications £ 27.50 Prices and item descriptions subject to change. The publishers reserve the right to change prices without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Sub-total P&P Total paid Name Address + Post code Tel. Date -2007 Email Signature EL03 Yes, I am taking out an annual subscription to Elektor Electronics and receive a free 1GB MP3 player. I would like: Standard Subscription (11 issues) Subscription-Plus (11 issues plus the Elektor Volume 2007 CD-ROM) * Offer available to Subscribers who have not held a subscription to Elektor Electronics during the last 12 months. Offer subject to availability. See reverse for rates and conditions. Name Address + Post code Tel. Date * cross out what is not applicable EL03 -2007 Email Signature METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer □ Cheque (UK-resident customers ONLY) □ Giro transfer “ □ Expiry date: Verification code: SWITCH ONLY: Start date: Issue number: Please send this order form to * (see reverse for conditions) Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 208 261 4509 Fax: +44 208 261 4447 www.elektor-electronics.co.uk. sales@elektor-electronics.co.uk *USA and Canada residents may (but are not obliged to) use $ prices, and send the order form to: Old Colony Sound Lab P.O. Box 876, Peterborough NH 03458-0876. Tel. (603) 924-6371, 924-6526, Fax: (603) 924-9467 Email: custserv@audioXpress.com q ^ o METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer □ Cheque (UK-resident customers ONLY) □ Giro transfer “ □ Expiry date: Verification code: SWITCH ONLY: Start date: Issue number: .... Please send this order form to Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 208 261 4509 Fax: +44 208 261 4447 www.elektor-electronics.co.uk. subscriptions@elektor-electronics.co.uk ORDERING INSTRUCTIONS, P&P CHARGES Except in the USA and Canada, 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. On-line ordering: http://www.elektor-electronics.co.uk Readers in the USA and Canada may (but are not obliged to) send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Old Colony Sound 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: UK: £4.00 Europe: £5.00 (Standard) or £7.00 (Priority) Outside Europe: £8.00 (Standard) or £12.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 (Publishing) / Segment b.v. 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 (Publishing) / Segment b.v.. 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-1 52-3801 , held by Elektor Electronics (Publishing) / Segment b.v. 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, Access, MasterCard, JCBCard and Switch cards 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 Electronics 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 Electronics (Publishing) 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 Electronics (Publishing) 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 Electronics (Publishing) 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 Electronics (Publishing) other than to supply goods as described or, at the option of Elektor Electronics (Publishing), 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 Electronics (Publishing) shall be determined in all respects by the laws Of England. January 2007 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION Standard Plus United Kingdom £41 .90 £48.80 Surface Mail Rest of the World £54.50 £61.40 USA & Canada US$ 95.50 US$106.50 Airmail Rest of the World £68.90 £75.80 USA & Canada US$120.00 US$131.00 HOWTO PAY Bank transfer into account no. 40209520 held by Elektor Electronics (Publishing) / Segment b.v. 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 (Publishing) / Segment b.v.. 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 (Publishing) / Segment b.v. 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, Access, MasterCard, JCBCard and Switch cards 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 perma- nent 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) reduc- tion in current rates, must be supported by evidence of studentship signed by the head of the college, school or university faculty. A standard Student Subscription costs £33.50, a Student Subscription- Plus costs £40.40 (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 2007 All articles in Order now using the Order Form in the Readers Services section in this issue. Elektor Electronics (Publishing) Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 208 261 4509 See also www.elektor-electronics.co.uk Elektor E lectron cs Volume 2006 on CD-ROM The DiskMirror utility on this CD-ROM allows your earlier Elektor year volume CD-ROMs (1997-2005) to be added to a large archive on hard disk for fast access and easy reference. A built-in search function allows you to find references in any article from the archive on hard disk, or from individual year volume CD-ROMs you have available. leading the way lectronics cd-rom Elektor 2006 This CD-ROM contains all editorial articles, with the exception of New Products items, published in Elektor Electronics magazine Volume 2006. Using the supplied Acrobat Reader program, articles are presented in the same layout as originally found in the magazine. £16.25 / US$ 28.75 ISBN 978-90-5381-207-5 Index of Advertisers ATC Semitec Ltd, Showcase www.atcsemitec.co.uk 78 New Wave Concepts, Showcase www.new-wave-concepts.com 79 Avit Research, Showcase www.avitresearch.co.uk 78 Newbury Electronics www.newburyelectronics.co.uk .63 BAEC, Showcase http://baec.tripod.com .78 Number One Systems www.numberone.com .43 Beijing Draco .www.ezpcb.com 63 Nurve Networks www.xgamestation.com .63 Beta Layout, Showcase www.pcb-pool.com 43, 78 Paltronix www.paltronix.com .39 Bitscope Designs www.bitscope.com 3 Bitwise .i/i/wi/i/.Mi/i//sesys.C0A?7 43 Conford Electronics, Showcase www.confordelec.co.uk 78 Cricklewood www. cctv centre, co. uk Easysync, Showcase www.easysync.co.uk . .63 .78 Elnec, Showcase www.elnec.com .78 Eurocircuits . www. eurocircuits, com 6 First Technology Transfer Ltd, Showcase .www.ftt.co.uk 78 Future Technology Devices, Showcase . . .www.ftdichip.com 78 Heros Technology, Showcase www.herostechnology.co.uk 78 Jaycar Electronics www.jaycarelectronics.co.uk 2 JB Systems, Showcase www.modetron.com .78 KCS TraceMe www.TraceMe.eu 52,53 PCB World, Showcase www.pcbworld.org.uk 79 Pico www.picotech.com 7 Quasar Electronics www.guasarelectronics.com .69 Robot Electronics, Showcase www.robot-electronics.co.uk 79 Scantool www.ElmScan5.com/elektor 6 Schaeffer AG www.schaeffer-ag.de 7 Showcase 78, 79 SourceBoost Technologies, Showcase . . .www.sourceboost.com 79 Sytronic Technology Ltd, Showcase www.m2mtelemetry.com 79 Ultraleds, Showcase www.ultraleds.co.uk .79 USB Instruments, Showcase www.usb-instruments.com 79 Virtins Technology, Showcase www.virtins.com 79 Labcenter www.labcenter.co.uk .88 London Electronics College, Showcase . .www.lec.org.uk 78 Microchip www.microchip.com 11 Mikro Elektronika www.mikroe.com .33 MQP Electronics, Showcase www.mgp.com 78 Advertising space for the issue of 23 April 2007 may be reserved not later than 27 March 2007 with Huson International Media - Cambridge Flouse - Gogmore Lane - Chertsey, Surrey KT 1 6 9AP - England - Telephone 01 932 564 999 - Fax 01 932 564998 - e-mail: aerrvb@husonmedia.com to whom all correspondence, copy instructions and artwork should be addressed. 3/2007 - elektor electronics 87 I rthcimlir EIh YOlUfl, fell 41 1 7Sb 1 Fax: □ 1 7SG Email: info*! lea Ltd., B3-B5 Marin Btirrt, braaaJnginn, 3 5 AA. RnyiKi^r^d In C-rjl^r^ 4692454 iibcent s r.ca.u k A modora Jind Inybut p-icHw whkti ^Hinfr^niv >lnfogrif^t with the ISIS caplyie icftwat«. Ftaty^i inch aa autajalaoemertf snd aut^outirtg, interactive PRC pnd sin intuilivu Interface all uarnr la mailmlia productivity and reduce lime- to market. lASCEMTEft ELECT ftQ M ICS LTD. A technelegy p-lan-rar in Ihc EP4 industry ■Fact- 1HA9. Technical support d-lract Irom the program author 1 -. F l^i ■ itlr M«h|tgH>f ft*# prl-tl-ng t«E|#fid t« r-ij-qulfe COf\ITACI US IUDW la tfl-sdu tt ru E|Uirci me-nla ar request m FREE tivaruallen copy. m'lf* * .a u ISIS SCHEMATIC I APT L RE A poworinE capture pacha Ejn tphfared far todays engineer and designed Ip plla-w rapid entry ol cottuplejc achematis* for b-lmuUilloii and PCD Layoul. P HOSPICE MIXED MODE SIMULATOR A customised mmiemnntali'Mi of fho industry standard Darkp-fay SPICE 3F5 engine with eaten-s-ivo opthnlutlofu an4tn^r^etntnl& lor true mixed modi 1 simulation and circuit ianimat ion. VSIW VIRTUAL SYSTEM MODEL LIM The worlds first and bu at ac hematic baaed m icroc □ n trolla r co-simu lotion aottwarou. Proteus VSM plIbWB you to f ImuE^tO the inters Hon between software running bn 41 microcontroller and any artalo$j nr digital dec ironic a connected to it. Thia streamline* the prcjftcl life eye lei and obviates ttw n«d far flupflnfl™ hardware! analysis laols. ARES PCD DESIGN