e* April 2011 AUS$ 14.50 - NZ$17.50 - SAR102.95 - NOK99 + 3 GHz/-40 dBm Frequency Meter www.elektor.com I R Thermometers Tested pitfalls theory 1 1 r 1 1 1 1 1 1 1 1 1 1 1 L m m sl ■■ hIh m ■ Ik mm mm JiLk , m kJ k k ■ Ik b b J 1 1 1 1 ilr 1 t 1 hands-on rrgt Rig: Pico C Meter 1 low-cost instrument r-ii ■ covers 0.1 - 2500 pF \ f # o c. o /. c : a 'ill 5 We're changing how engineers think about design, with Cortex-MO™ solutions that let you save power, reduce cost, shrink your design, and get to market fast. ► Lowest active power — as low as 130|jA/MHz ► Superior Code Density — 50% less code for most tasks ► Higher performance — LCP1 100 runs at over 45 DMIPS ► Smallest size — the LPC1 1 02 has a footprint of 5 mm 2 ► Low-cost toolchain — LPCXpresso for less than USD 30 Show us how you switched from your old 8-/1 6-bit habit to the new 32-bit NXP Cortex-MO solution and we'll send you a FREE LPCXpresso development board. www. nxp . co m/co rt ex- m 0 EVERYONE Buy any PIC32 development board to get discount on compilers. GET IT NOW www.mikroe.com MikroElektronika is the first compiler manufacturer in the world to bring PIC32 microcontrollers to both beginners and professionals. Choose between , W^and programming language. If you need more power, just switch over from PIC or dsPIC to PIC32 easily. We have been carefully planing backward compatibility for so you will be able to literally copy-paste your existing codes and build them with just a few adjustments. DEVELOPMENT TOOLS COMPILERS BOOKS -j- Our community website offers you the possibility to directly participate in discussions and trace the path of the future compiler development. It is a portal for PIC32 freaks like us, and a place to share projects, suggestions, meet talented people and seek their assistance. Our developers are waiting for you to challenge them with your ideas. Together we can build better compilers. http://www.pic32compilers.com mikrn mikro Pico farad -mega prospect With trade magazines it is customary for the editorial planning for the year to be based on themes or a slight focus defined for each edition. However the theme plan- ning is not just a crucial bit of information to the magazine editors — it also offers guidance to press and PR agencies, adver- tisers and, importantly, potential authors who will typically use the list to submit a relevant article to... the editor! Elektor’s theme plan for 2011 is available for all & sundry to view at www.elektor.com if you click on the Service tab. For sure, a number of our themes can be accessed from so many angles that they can easily fill the magazine pages on their own strength. The March 2011 edition had a strong focus on System-on-a-Chip (SoC), covering the theme in ways that can be described as exploratory, hands-on, hardware-based, software-based and fun. For this month, test and measurement forms the plot, unmista- kably. Immediately after releasing our theme plan, articles and projects on T&M got initia- ted to the extent that they could easily have filled the pages of an Elektor issue exclusively on electronics testing. Test and Measurement is a diehard subject as we’ve noticed from the response to relevant news items on our News & New Products pages and in the Elektor E-weekly. Many of our readers thoroughly enjoy building and using their own test equip- ment and I’m happy to say Elektor has a long record of success stories in this field. However with the arrival of both the microcontroller on the one hand and the cheap DMM on the other, the focus has shifted from the classic ohm/volts/amps & farads cluster to more specialized applica- tions like OBD, gigahertz RF and contact- less temperature monitoring to mention but three examples found in this edition. The farad and the microcontroller are happily united in Pico C (page 24) , a jewel of a test instrument that beats most DMMs hands down in terms of small capacitance measurements, say below 10 picofarads. Some say such values are “irrelevant”, oth- ers, “in the realms of RF wizardry” or even “black magic”. At the same time, there’s a pile of worrying reports on my desk about a serious lack of RF-educated engineers in the industry, everyone having gone embedded. The humble picofarad may have a lot of potential. Enjoy reading this edition, Jan Buiting, Editor 6 Colophon Who’s who at Elektor magazine. 8 News & New Products A monthly roundup of all the latest in electronics land. 12 The Five Rules... when Choosing a DSO Factors to consider when you think it’s time to move from a CRT to a digital ‘scope. 16 Non-Contact Temperature Measurement Things to pay attention to when buying or using an infra-red thermometer. 24 Pico C As opposed to most DMMs and other C meters this low cost instrument is totally at ease with capacitances below 10 pF. 30 Wireless OBD-II Here’s a car diagnostics interface with Bluetooth or Zigbee — that’s right, it’s all cordless. 36 Asteroids & E-Blocks Here we look at how Microchip’s 16-bit dsPIC from can be persuaded to run the classic game of Asteroids. 40 Guitar Input for Multi-Effects Unit Showing how the Elektor Multi-Effects Unit can be matched to an electric guitar, with an overdrive effect added. 43 E-Labs Inside: Here comes the bus (4) This month we discuss some reader feedback received for the project. The level is surprisingly high. 46 E-Labs Inside: A quick temperature measurement... Pitfalls and other things to watch out for when doing IR-gun temperature measurements. 4 04-2011 elektor CONTENTS Volume 37 April 2011 no. 412 16 Non-Contact Temperature Measurement With an infrared (‘gun’) thermometer, you can quickly measure the tempera- tures of all sorts of objects at a reasonable distance. Thermometers of this sort are available with prices starting at a few dozen pounds. What do you need to pay attention to when buying or using an infrared thermometer? Here’s our critical answer and verdict. 24 Pico C RF and radio repair fans probably do need to be told, but when it comes to measurements below 200 pF or so, modern DMMs will produce coarse if not ridiculous results. Elektor’s purpose-designed Pico C does a far better job. Beating many DMMs hands down, this little instrument easily and accurately measures capacitances down to fractions of a picofarad. 30 Wireless OBD-II If you hate cables in connection with cars (literally) an interesting option is a wireless OBD interface with a radio interface to a (laptop) PC. The all-homebrew solution described here allows the choice of using either Bluetooth or ZigBee. 48 3 GHz Frequency and Signal Level Meter Here’s a treat for all fans of top notch test and measurement equipment you can build and use in the workshop or at college. Keywords: 50 MHz to 3 GHz, 10 ppm accuracy and a signal level range of -40 dBm to +10 dBm. Readings are displayed on a three-line LCD module, and the instrument is powered by three standard AA cells. 48 3 GHz Frequency and Signal Level Meter A sophisticated instrument capable of measuring frequencies from 50 MHz to 3 GHz with an accuracy of 10 ppm and signal levels between -40 dBm and +10 dBm. 56 Altimeter for Micro-Rockets Ultra lightweight, this circuit has a data recorder logging atmospheric pressure every 25 ms, with a memory capacity of 16 Rvalues. 62 GPIB-to-USB Converter Just when you thought Hewlett-Packard’s GPIB bus reached ‘vintage’ status, watch how it gets retrofitted with a USB interface. 68 MIDI Step Sequencer A low-cost but extremely versatile back beat generator that responds to MIDI commands from your sound processing equipment. 70 ATM18 Catches the RS-485 Bus Apparently there’s no end to what the Elektor ATM18 module is capable of doing. This month it takes the RS-485 bus. 75 Hexadoku Elektor’s monthly puzzle with an electronics touch. 76 Retronics: 137 Years of Solid-state Electronics Regular feature on electronics ‘odd & ancient’. Series Editor: Jan Buiting 84 Coming Attractions Next month in Elektor magazine. elektor 04-2011 5 elektor international media bv Elektor International Media provides a multimedia and interactive platform for everyone interested in electronics. From professionals passionate about their work to enthusiasts with professional ambitions. From beginner to diehard, from student to lecturer. Information, education, inspiration and entertainment. Analogue and digital; practical and theoretical; software and hardware. ANALOGUE • DIGITAL MICROCONTROLLERS & EMBEDDED AUDIO • TEST & MEASUREMENT _ - m Wfli -Mw.fl Uh + 3GHiJ“40dBm Frequency Meter .ririLor ei. - m IR Thermometers Tested pitfalls — theory — hands-on Pico C Meter * low-cost instrument covers 0.1 - 2500 pF + Wireless OB D -2 + GPIB-to-USB Converter + Altimeter for Micro -Rockets Vi 1 1 ir«±r i Volume 37, Number 412, April 2011 ISSN 1757-0875 Elektor aims at inspiring people to master electronics at any personal level by presenting construction projects and spotting developments in electronics and information technology. Publishers: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+ 44 ) 208 261 4509, fax: (+44) 208 261 4447 www.elektor.com The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor is published 11 times a year with a double issue forJuly& August. Elektor is also published in French, Spanish, American English, German and Dutch. Together with franchised editions the magazine is on circulation in more than 50 countries. International Editor: Wisse Hettinga (w.hettinga@elektor.nl) Editor: Jan Buiting (editor@elektor.com) International editorial staff Harry Baggen, Thijs Beckers, Eduardo Corral, Ernst Krempelsauer, Jens Nickel, Clemens Valens. Design staff Christian Vossen (Head), Thijs Beckers, Ton Ciesberts, Luc Lemmens, Jan Visser. Editorial secretariat: Hedwig Hennekens (secretariaat@elektor.nl) Graphic design / DTP: Ciel Dols, Mart Schroijen Managing Director / Publisher: Paul Snakkers Marketing: Carlo van Nistelrooy Subscriptions: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 Internet: www.elektor.com/subs 6 04-2011 elektor Elektor PCB Prototyper S A professional PCB router with optional extensions! This compact, professional PCB router can produce complete PCBs quickly and very accurately. This makes the PCB Prototyper an ideal tool for independent developers, electronics labs and educational institutions that need to produce prototype circuits quickly. The PCB Prototyper puts an end to waiting for boards from a PCB fabricator - you can make your own PCB the same day and get on with the job. In addition, the PCB Proto- typer is able to do much more than just making PCBs. A variety of extension options are available for other tasks, and a range of accessories is already available. Specifications • Dimensions: 440x350x350 mm (WxDxH) • Workspace: 220x1 50x40 mm (XxYxZ) • Weight: approx. 35 kg (78 lbs) • Supply voltage: 1 1 0-240 VAC, 50/60 Hz • Integrated high-speed spindle motor; maximum 40,000 rpm (adjustable) • Integrated dust extraction (vacuum system not included) • USB port for connection to PC • Includes user-friendly Windows-based software with integrated PCB software module Ordering The complete machine (including software) is priced at € 3,500 / £3,1 00 / US $4,900 plus VAT. The shipping charges for UK delivery are £70. Customers in other countries, please enquire at sales@elektor.com. ) [Sektor Further information and ordering at www.elektor.comjpcbprototyper Email: subscriptions@elektor.com Rates and terms are given on the Subscription Order Form. Head Office: Elektor International Media b.v. P.O.Box ii NL-6114-ZG Susteren The Netherlands Telephone: (+31) 46 4389444, Fax: (+31) 46 4370161 Distribution: Seymour, 2 East Poultry Street, London ECiA, England Telephone:+44 207 429 4073 UK Advertising: Elektor International Media b.v. P.O.Box 11 NL-6114-ZG Susteren The Netherlands Telephone: (+31) 46 4389444, Fax: (+31) 46 4370161 Email: t.vanhoesel@elektor.com Internet: www.elektor.com 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 Elektor International Media b.v. and may not be reproduced or transmit- ted in any form or by any means, including photocopying, scan- ning an recording, in whole or in part without prior written per- mission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may exist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publisher to alter the text and design, and to use the contents in other Elektor International Media publications and activities. The Publisher cannot guaran- tee to return any material submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2010 Printed in the Netherlands elektor 04-2011 7 NEWS & NEW PRODUCTS Electrical Vehicle (EV) cup to launch summer 2011 The EV Cup, the world’s first circuit race series exclusively fea- turing zero-emission electric vehicles, unveiled plans today for the launch of its inaugural 201 1 season and announced a newly- formed partnership with CAA Sports, a division of Creative Art- ists Agency. CAA is the world’s leading entertainment and sports agency, representing many of the most successful professionals working in film, television, music, sports, video games, theatre, and the Internet, and provides a range of strategic marketing and consulting services to corporate clients. The historic seven-race green motorsport series, the EV Cup, will include two princi- ple classes of zero emission electric cars — the City EV cars, where driv- ers will compete in carbon-free, race- prepared urban THINK cars, and the Sports EV class, which will fea- ture teams racing 1 85 kph Westfield iRacers. A third category, the Prototype EV class, will not feature races, but rather base its results on time trials that showcase the latest non-production electric vehicles on circuits through street and race courses. Models of the THINK City EV Cup Edition and the Westfield iRacer are on display at the International Autosport Show. Planned races in the EV Cup are being staged in the UK, Portugal, Spain, and the United States, with a city street race also expected to take place in the near future. Several tracks and dates in the UK have already been confirmed, including Silverstone (6 August), Snetterton (20 August), Rockingham (1 0 September) and Brands Hatch (23 October). Race day will include qualifying rounds and all car batteries will be recharged at on-site facilities. Each sprint race will be contested over 20 to 30 minutes of competitive laps. The EV Cup will have access to CAA Sports’ global resources and expertise to create innovative opportunities for the circuit across V a wide array of areas including corporate partnerships, business development, brand marketing, event management, and media advisory, among others. Former Formula One British champion Damon Hill is a supporter of the EV Cup. “I think the time is fast approaching when we will have to rethink our expectations regarding private road transport generally. The advantages of electric vehicles in urban environ- ments are too many to miss. Less noise and less direct pollution are just two. The race is to save the planet from us! Racing elec- tric vehicles should convince the wider public of their potential. Racing was initially used to develop and prove a new product called the motorcar. I see no reason why elec- tric vehicle devel- opment will not benefit in the same way. Who knows what is ultimately possible?” Ben Collins, who appeared in the popular television series Top Gear as The Stig, and who will attend the launch and plans to be a regular EV Cup driver, said: “Electric Vehicles represent a new dawn in motor- ing by running on clean energy that can be sourced as locally as organic sausages. It’s surprising that mankind has taken so long to embrace the technology. “Motorsport still offers the purest research and development plat- form to deliver the true potential of electric power and dynamic energy recovery; perhaps to a level that will shame the carbon combustion engine the way rubber tyres did the wooden cart- wheel. EV is developing fast and the current crop of road cars are superb to drive. With a dedicated racing series that encompasses both road and racecar development, the next steps will be more like a quantum leap.” (110048-XI) www.evcup.com wv-w.evcup.ocxn Serial protocol host adapter supports dual- and quad-SPI protocols Saelig Company, Inc. has introduced SPI Storm — an advanced Serial Protocol Host Adapter from Belgian company Byte Para- digm — controlled from a PC through a USB interface. SPI Storm can access ASICs, SoCs, FPGAs and other digital embedded systems that use serial protocols at speeds of up to 1 00 MHz at the I/O lines. Various serial pro- tocols can be chosen from a standard library that includes: SPI (Serial Peripheral Inter- face), variants of SPI on 3 wires, and for the first time, dual-SPI and quad-SPI protocols. SPI Storm Studio software, provided free with SPI Storm, allows user-specific defini- tion of custom protocols, including those requiring bi-directional signal lines. In addition, SPI Storm features an 8-bit gen- eral-purpose output port that can be syn- chronized with the serial port, to extend the number of available signals for even more complex interfaces. With 32 MB memory, 1 00 MHz operation and 3 specialized ports (a flexible serial port, 8-bit GPO and an 8-bit input trigger port), SPI Storm targets ASIC, SoC, FPGA and embedded system testing and debugging, when there is a need to access and interact in real time with inter- faces that use standard and user-defined serial protocols. Powered either from the USB bus or from an external power supply, SPI Storm is a ver- satile 3- and 4-wire SPI exerciser/analyzer which uses a USB 2.0 high speed interface. This permits very fast signal analysis for debug, programming and testing of chips and electronic boards that use SPI for chip- to-chip communications. SPI Storm can act as both a PC-controlled master (exerciser) and as a SPI protocol sniffer (analyzer). 8 04-2011 elektor Concept-to-testing expertise for Electric Vehicle charging system design TRaC has announced that its comprehensive offer- ing of test and analysis for the automotive indus- try is fully prepared and ready to assist makers of Electric Vehicle Charging Systems. As electric vehicle use expands, attention is turn- ing to the development of an infrastructure for charging of automotive battery solutions, so that drivers of electric vehicles will be able to achieve re-charging as safely, easily and universally as today’s drivers obtain petrol and diesel fuel. During 201 0, the European Commission issued a Mandate to the European standardisation bodies — CENELEC, CEN and ETSI — to develop a common European solution for the charging of electric vehi- cles. The mandate aims to ensure the widespread availability of safe charging facilities and services, including the necessary measures to ensure that chargers and the vehicles themselves can interoperate with the electricity supply sys- tem; and, further, that emergent standards take into account ‘smart charging’ archi- tectures that will enable drivers to recharge their vehicles at off peak rates. TRaC has been closely involved with the evolution of standards in this area: TRaC’s Director for EMC and Safety, Steve Hayes, is nominated as the UK expert for the Com- mission’s Mandate on Vehicle Charging. Building an infrastructure for electric vehicle charging will involve issues extending far beyond simply replenishing the batteries. Substantial amounts of energy are involved, and standards will have to ensure the safety of both users and equipment — on both the mobile and fixed side of the process. Systems will have to meet numerous stand- ards already established in both electrical and vehicle domains, as well as complying with whatever new regulations emerge as the standardisation programme proceeds. Issues will range from the straightforward — defining and enforcing use of a common charging connector, for example — to much more complex and subtle matters such as ensuring that the equipment causes no electro-magnetic interference, or disturbance to the electricity supply grid, and that communication between the vehicle and the infrastructure conforms to standard protocols. www.tracglobal.com (110048-II) SPI Storm was introduced at the recent DesignCon conference and exhibition in Santa Clara on February 1 -2, 201 1 . Target applications include both in-lab develop- ment and on-site, after-installation servic- ing for: chip-to-chip communication emu- lation, SPI-based flash memory access, SPI system development and debug, custom 3- and 4- wire serial protocol communica- tion, RF chip characterization and test, SPI sniffing, IP evaluation, etc. Made in Europe by Byte Paradigm, a leading embedded test equipment manufacturer, SPI Storm will be available in March 201 1 with cables, standard options and SPI Storm Studio software at the introductory price of $999, from Saelig Co. Inc. Pittsford NY. www.saelig.com (110048-I) Online: a ten minute tour of The National Museum of Computing at Bletchley Park A new video made by TVUK gives everyone the chance to have a ten-minute tour of The National Museum of Computing at Bletch- ley Park. It gives a glimpse of a few of TNMOC’s growing number of displays: from the code- breaking Colossus through the restoration of the Harwell-WITCH computer, the Elliot 803, the ICL2966, to the home comput- ing revolution in the PC gallery and the NPL Technology of the Internet gallery. “This is not just a techie museum with machines in glass boxes. This is a work- ing environment to show how machines worked — that’s the essence of The National Museum of Computing. As the Museum continues its rapid growth, there are many opportunities for new sponsors, new mem- bers and volunteers,” said Tony Sale, a trus- tee and director of The National Museum of Computing. The National Museum of Computing warmly thanks Phil Fothergill of TVUK for creating the video. The National Museum of Computing at Bletchley Park, an independent charity, houses the largest collection of functional historic computers in Europe, including a rebuilt Colossus, the world’s first electronic programmable computer. The Museum complements the Bletchley Park Trust’s story of code breaking up to the Colossus and allows visitors to follow the development of computing from the ultra-secret pioneering efforts of the 1940s through the mainframes of the 1960s and 1 970s, and the rise of personal computing in the 1 980s. New working exhibits are reg- ularly unveiled and the public can already Advertisement PCBs Muuuuch Cheape No-frills policy 16,94 EURO 5 pcbs, 1 00 mm x 1 00 mm *per piece, incl. UHT (2 1 %) + shipping costs e. g. Germang 1 0,71 EURO * Ja&altac LULum.jackaltac.com elektor 04-2011 9 NEWS & NEW PRODUCTS view a rebuilt and fully operational Colos- sus, the restoration of the Harwell / WITCH computer, and an ICL 2966, one of the workhorse mainframes computers of the 1 980s, many of the earliest desktops of the 1 980s and 1 990s, plus the NPL Technology of the Internet Gallery. In June 201 0 TNMOC hosted Britain’s first-ever Vintage Computer Festival. Funders of the Museum include Bletchley Park Capital Partners, lnsightSoftware.com, PGP Corporation, IBM, NPL, HP Labs, BCS, Black Marble, and the School of Computer Science at the University of Hertfordshire. You can follow The National Museum of Computing on Twitter and on Facebook. (110048-VIII) http://www.youtube.com/watch?v=_ Swi5F2QzMQ&feature=player_profilepage www.tnmoc.org Triangle Research: Embedded PLCs with Ethernet The FMD88-1 0 and the FMD1 61 6-1 0 PLCs are Triangle Research International’s (TRi) latest Ethernet-equipped programmable logic controllers for OEMs. With the new FMD PLCs, Triangle Research now has a full range of highly integrated ‘Super PLCs’, starting from the compact Nano-1 0 to the powerhouse F-series. This super PLC series combines the powerful and easy-to-use i-TRiLOGI Ladder+BASIC software with a wide array of features, including but not limited to: built-in digital and analog I/Os, PWM, PID, encoders, stepper controls, and on-board communication ports for con- necting to other devices. As the model name implies, the FMD88- 10 comes with 8 digital inputs, 8 digi- tal outputs and 10 analog I/Os while the FMD1 61 6-1 0 comes with 1 6 digital inputs, 1 6 digital outputs and 1 0 analog I/Os. Both models are equipped with an I/O expansion port, a LCD display interface, RS232 and RS485 serial ports, and of course, the Eth- ernet port, which has become increasingly indispensable today. Triangle Research’s iTRILOGI client/server software and the sup- port of MODBUS TCP/IP protocols not only make the FMD model PLCs remotely acces- sible for machine monitoring and OEM trou- bleshooting/reprogramming, but also ena- bles their easy integration into mixed-brand PLC environments and networks. The sub-$300 pricing of the FMD PLCs is rare for full-feature, Ethernet PLCs in this popular I/O range, making this PLC a partic- ularly accessible choice for value-conscious OEMs. The FMD88-1 0 and the FMD1 61 6-1 0 single unit prices are $229 and $295 respec- tively, and are further discounted with OEM quantity price breaks. (110048-VI) www.tri-plc.com/fmd-ek.htm First development kit for NXP LPC1227 microcontroller IAR Systems announced that IAR KickStart Kit for LPC1227 is now available. The kit includes a development board with an ARM Cortex-MO based LPC1227 microcontroller, peripherals and connectors, an IAR J-Link Lite debug probe providing SWD debug- ging, software development tools and board support packages for various RTOSes. This is believed to be the world’s first com- mercial starter kit for the ARM Cortex- MO-based LPC1227 microcontroller. The strong partnership and tight cooperation between NXP and IAR Systems during the development project has led to IAR Systems latest starter kit being the first to the market. Included in the kit is a code size limited ver- sion of IAR Embedded Workbench, a set of development tools for building and debug- ging embedded system applications using assembler, C and C++. It provides a com- pletely integrated development environ- ment that includes a project manager, edi- tor, build tools and the C-SPY debugger. IAR KickStart Kit for LPC1 227 is priced at € 1 29 / $ 1 69. It can be bought online at www.iar.com/eshop. (110048-V) www.iar.com Carbon nanotache with 3D symmetry Researchers at the University of Surrey show the controlled synthesis of nanomaterials by subjecting pure organic molecular gas to high temperatures and pressures that allow symmetry breaking events to create the different carbon nanostructures. Spheres, nanotubes and mirrored spirals can be cre- ated under the appropriate isovolumet- ric conditions that show the versatility of this unique growth system. The report was published in the January 201 1 issue of the premiere journal in nanotechnology, Nano Letters. Self-organisation of matter is essential for natural pattern formation, chemical syn- thesis, as well as modern material science. Mechanisms governing natural formation of symmetric patterns have long intrigued scientists and remain central to modern science from attempts to understand spi- rals and twists of climbing plants to the studies of bacterial macrofibers and DNA. Self-assembly of atoms and molecules is the key to understanding the natural shape formation and is elemental to the produc- tion of modern materials, such as silicon, synthetic polymers, and various nano- and microstructures. Dr Hidetsugu Shiozawa, of the Advanced Technology Institute (ATI) at the Univer- 10 04-2011 elektor NEWS & NEW PRODUCTS sity of Surrey, said: “The work represents a concept to experiment with self-assem- bly process and demonstrates how mor- phological symmetry of nano- and micro- structures can be controlled. The study of such physical phenomena helps us under- stand why certain symmetry of structure emerges amongst others, and how this is correlated with physical quantities of ther- modynamic equilibrium such as tempera- ture and pressure.” Professor Ravi Silva, FREng, Director of the ATI and co-author, indicated: “The creation of new technologies and businesses are highly dependent on this ability to create designer materials of the highest quality. The UK is renowned for its highly creative and innovative research force, for which this is a prime example. To create a strong man- ufacturing base, we must back high quality research that has potential to create new markets and novel products such as those enabled by these symmetric carbon nano- structures. It will lead to transformative technologies.” The work appears in: DOI: 10.1021 /nil 032793 http://pubs.acs.0rg/d0i/abs/10.1021/nh032793 (110048-III) Higher reliability and efficiency for ultra- compact LED lamps The first in a new family of mains-operated LED lamp drivers from STMicroelectronics will enable designers to deliver more relia- ble and efficient LED retrofit lamps featuring primary-side current regulation. LED lighting, including retrofit bulbs, is expected to account for 80% of the lighting market by 2020 or sooner. Primary-Side Regulation (PSR) cuts bill-of-materials costs for retrofit bulbs, thereby reducing the pay- back time, while also simplifying design and reducing the space occupied by LED control circuitry. The new HVLED805 integrates an 800 V ava- lanche-rugged MOSFET, achieved using ST’s high-voltage integration process, which is higher than in competing devices and hence offers greater reliability. The high-voltage on-chip startup circuitry allows the device to start reliably when the AC line voltage is applied to the lamp. Primary-side regulation maintains the con- stant LED current that is needed to ensure consistent light output, without requiring the current-sensing components and opto- coupler used in conventional secondary- side regulation. The elimination of these components decreases the cost and size of the LED driving circuitry and saves current- sensing losses, improving overall efficiency. Using PSR, the HVLED805 guarantees LED current regulation to within 5% accuracy. Reli- ability is also enhanced, due to the elimination of the opto-coupler in the secondary side, whose degradation can sig- nificantly decrease the mean-time-between- failure of the lamp. The HVLED805 PSR con- troller integrates high- voltage startup for effi- cient power-on, and the robust 800V power MOS- FET allows a reduction of the snubber network. The highly efficient quasi-resonant (QR) operating mode fur- ther boosts energy savings for LED lighting and dramatically reduces the EMI filtering required, saving space and costs. Major features of HVLED805: • 800V avalanche-rated MOSFET power switch • 5%-accurate constant-current regulation • Quasi-resonant operation • High-voltage startup circuitry • Open- or short-circuit LED string management • Automatic self supply • Input voltage feed-forward for mains-independent constant-current regulation The HVLED805 is in mass production now in the SO-1 6N narrow package. (110048-IV) www.st.com Advertisement Proto's & kleine series PCB specialisten EURO PCB proto STANDARD pool TECH pool CIRCUITS IMS pool On demand beste prijs voor 2- en 4 laags protos meest uitgebreide pooling service tem 8 lagen 100|jm technologie pooling tem 8 lagen ALU protos betaalbaar door pooling Uw print onze uitdaging tem 16 lagen Bel ons: +32 15 281 630 Email: euro@eurocircuits.com Electronics & Automation, 25 tem 27 mei, Jaarbeurs Li ALLE SERVICES Online prijsberekening Online bestellen Attractieve pooling prijzen Geen vaste kosten Leveringen vanaf 2 werkdagen Stencil optie in alle services www.eurocircuits.nl elektor 04-2011 11 TEST EQUIPMENT The Five Rules... ...when choosing a DSO vcpmcji. ch rtatnew Jifroc By Andreas Grimm (Germany) r HL I The oscilloscope marketplace has not become any clearer over recent years. Their capabilities have been expanded with the addition of many new and innovative features to increase their usefulness. More recently new manufacturers have also appeared. The oscilloscope is the hub of any test and development environment, it will most likely be in daily use for many years to come so it is vital to consider as many factors as possible before you choose a new model. The majority of Elektor readers will be able to tell you that the most important things to look out for when buying a digital oscilloscope (DSO) is its bandwidth and sample rate. These are indeed two of the most important or key features but there is also a list of other things that need to be considered. An oscilloscope is such an important piece of test gear that it’s worth investing some time to make sure you will not be disappointed. i. The key features Your choice of bandwidth and maximum sample rate will depend on the fastest signals that you anticipate will need to be observed. Digital signals are more prevalent in circuits these days so the rise time of the input stage is very important. As a real world example you may be working on a system con- taining a processor running at 8 MHz. The rise and fall times for the clock will typically be 1 0 ns. The rise time of the scope’s input amplifier must be faster than the input signal otherwise you will just be displaying the characteristics of the scope’s input amplifier rather than the observed signal. A practical figure for the rise time is that it should be about 30 % of the signal under observation. In this example observing an edge with a 1 0 ns rise time indicates that the scope’s input amplifier must have a rise time T r of 3 ns or better. Using the formula B = 0.3 / T r indicates a 100 MHz oscilloscope is needed. Figure 1 shows the effect of the input rise time of a 1 00 MHz DSO on a signal with a 10 ns rise time. Once the bandwidth has been calculated we can turn our attention to the required sample rate. We can use the formula SR = 8 to 1 0 x B where B is the scope’s analogue bandwidth. For a 1 00 MHz scope this results in a sample rate of 1 GSamples. This ensures that the square wave fundamental and a sufficient number of harmonics can be captured in accordance with signal theory. Why do we so often get feedback from engineers who have just used these two basic criteria to select a DSO and are unhappy with their scope when they come to use it? The answer is usually because they have overlooked the importance of memory depth. We may indeed be interested in the step response of a circuit to a single repetitive edge but more often than not in digital circuits we also need to capture a complex sequence of edges or a data stream. This is where the third criterion, the size of the waveform memory, plays an important part. A very simple formula can be 12 04-2011 elektor TEST EQUIPMENT used here to give the necessary memory depth, which is equal to the product of the sample rate and the observed time window. The optimal time window length is determined by the types of signals to be observed. For example in a mains powered switched mode power supply we will need a window in the millisecond range to observe the switching control signals but to observe effects over several mains cycles we would require a window of around 100 ms. Analysing microprocessors systems will typically require the display of data transfers occurring over a few mem- ory cycles. The observation window will be in the sub- microsecond range, or in the millisecond range to take in several transfers. To sum up, a display window of 1 to 1 00 ms is a good practical value. Taking the example given above (8 MHz processor clock, T r = 1 0 ns, SR = 1 GSamples/s) and displaying a 1 ms time window gives: Memory = 1 GSamples/s x 1 ms = 1 MPoint i.e. one million memory points (see Figure 2). Conversely with a fixed recording time (1 ms) and a given memory depth using the above formula we get the resulting sample rate. This can be seen to decrease dramatically with a smaller memory depth as shown in the table. Time window Memory depth resulting sample rate 1 ms 2M Points 2 GSamples/s 1 ms 100l< Points 0.1 GSamples/s = 100 MSamples/s 1 ms 10k Points 0.01 GSamples/s = 10 MSamples/s 1 ms 2,5l< Points 0.004 GSamples/s = 4 MSamples/s From this we can see that the memory depth is a very important property of a DSO and one which is all too often overlooked. 2. Measuring properties The usefulness of the scope is largely determined by the properties of the input analogue amplifier stages and its triggering properties. The analogue signal path should offer high sensitivity and low noise. The best models on the market offer a maximum input sensitivity of 1 mV/DIV but this is by no means the standard value. To make use of this high sensitivity it’s important that the input amplifier intro- duces as little noise as possible to the measured signal: even at its most sensitive setting the noise should be less than one quarter of a scale division. These properties for example allow meaningful meas- urement of ripple levels (small signals superimposed on much larger signals) to be made. Trigger sensitivity is also important here to enable measurements to be made on the waveform of interest. The Figure 1 . The effect of input rise time of a 100 MHz DSO measuring a signal with a 1 0 ns rise time (white), the resulting curve is shown in yellow. Figure 2. Fast signal changes (<1 0 ns) can be resolved with a one million point acquisition memory and a recording time of 1 ms. trigger sensitivity should be much better than one scale division. Particularly during the development of power electronic systems it can be useful to perform mathematical analysis on the channel waveforms. Any high frequency interference can first be eliminated with a low pass filter then the energy value can be calculated by mul- tiplying the voltage channel by the current channel and then inte- grating the result. The ‘chained math function’ capability is often an optional feature and is not seen in scopes under 6,000 Euros. A standard feature of the DSO is the cursor measurement function. It is especially useful if the cursor can follow the waveform whilst displaying in real time the values of time information and voltage level. This is far more convenient than switching back and forth between the time and amplitude cursor. In addition it is also useful elektor 04-2011 13 TEST EQUIPMENT 67|j.s. A ifKit emhj CiJMtLV 2 SI MHi; 200 MS =t Cursor cm zoo fl IfUIMH- PIjIHT^ j 1 ~ "i riT^inv 65536 12 2 WMH. j m-h m mv winnow if i99l^fZ &L 25 3.0S mV Ro: L.jn'/'.- 1 ■ ■ | ■ V-SCAUNfl dDm dDV a. - J .ft rrr ijrf it 'A c I r i CHi 50 rnV Figure 3. An FFT feature is only really practical if it uses a sufficient number of points for the calculations (left 2048 Points, right 65536 Points). to be able to configure Automatic parameter measurements allow- ing say signal pulse width or overshoot to be calculated. The advan- tage of using parameter instead of cursor measurements is that it only needs to be switched on once and gives reproducible results. A pass/fail test is useful to continuously monitor the observed signal waveform by means of a configurable mask. The reference waveform mask plus tolerances is first defined and when a viola- Figure 4. A mixed signal oscilloscope. tion occurs the scope can be programmed to stop measurement, output a signal or perform a screen print. Meanwhile almost all DSOs come with an ability to perform fre- quency domain analysis in the form of the FFT function. This can be used to identify the source of any in-band interference. In prac- tice however with some budget scopes this feature is poorly imple- mented using too few points to be of any use. The number of points used in the calculation (together with the time period) determines the FFT resolution. Using just 1 ,000 points is insufficient and mean- ingful results can only be achieved using 32,000 or more points (see Figure 3). 3. User friendliness In addition to the hard facts and figures of the scopes specification there are also features which can best be appreciated by using the equipment. The display size and resolution would be in this cat- egory. While 6 inch (and above) colour TFT screens are the norm today what often is disappointing is the screen resolution. A VGA display (640 x 480 pixels) with almost full horizontal and vertical viewing angles and high contrast should be the minimum require- ment. QVGA displays (320 x 240 pixels) are generally disappoint- ing especially on a MSO (Mixed Signal Oscilloscope) where up to 20 channels of information may need to be displayed. A port for con- nection of an external mon itor or LCD projector may be beneficial. During the development of complex hardware designs it doesn’t take long for the work bench to fill up with test equipment. Equip- ment which can be stacked or which have a small footprint will therefore be advantageous. Other factors such as high fan noise can be irritating especially as the equipment will typically be run- ning continuously throughout the day. 4. Future proofing The proliferation of embedded systems seems is relentless and with them comes the need for engineers to display time-synchronous analysis of analogue and digital signals. While memory is usually connected to the processor using a parallel bus other peripherals such as FPGAs, sensors or displays are often connected over a serial bus such as a UART, I2C or SPI. During development of such designs 14 04-2011 elektor Logic Analyzer & Digital Signal Generator it is useful if the oscilloscope can display parallel data and also trig- ger and decode serial data (Figure 4). The oscilloscope will prove far more useful if it offers the flexibility to work in MSO operation or has the capability to decode serial data protocols in common usage or those which may be introduced in the future. With a tight test equipment budget it is worth consid- ering whether the decoding and triggering from serial protocols is necessary on both analogue channels and if the external trigger is necessary on the dual channel scope. Documentation is an important part of project development and it is advantageous to be able to include test results. The DSO should provide at least a USB port for connection of an external PC to trans- fer data. With the DSO in an automated test environment a GPIB (or more increasingly Ethernet) will be necessary to connect to the test control computer. If not fitted as standard it should at least be available as an optional upgrade. Before purchase it is also worth considering after-sales support, good support will be easy, fast and low-cost to protect your investment for at least five years or more. 5. The price/ power trade off It is clear that your choice of DSO should not just be made on the basis of its most important technical features and cost. There are a number of other factors that also need to be considered. To sim- plify the process we have collected them together in the form of a checklist: • Bandwidth (rise time), sensitivity and noise of the input amplifier. • Sample rate, Memory depth • Trigger modes and sensitivity • Display size, resolution and viewing angle, external monitor port • Functions such as cursor and parameter measuring and ‘math’ channels • Pass/ Fail waveform test • Mixed-Signal-Option (or as an optional upgrade) • Triggering and decoding of serial protocols (or as an optional upgrade) • Interfaces such as USB, LAN, GPIB (or as optional upgrades) • Service und support for as long as possible to achieve maximum lifetime from your investment. The majority of the most important equipment characteristics can be found on the equipment’s data sheet or user’s manual. Other properties such as the noise level produced by any fan fitted to the equipment or the screen viewing angle can often be answered by calling the appropriate customer services. Best of all is to arrange a hands-on test of the DSO before purchase. (100896) Andreas Grimm is head of product management for HAMEG Instruments GmbH (www.hameg.com). QJ cn OJ □ ED LOGIC SCANALOGIC-2 , quickly. Analyze, In depth. Learn, easily. 49 ONLY! Ind. Tax ruTi ti | 1 TO-T ! | 7.1 I r - I □■17 ;! " " 11 I T | Key features: Works on USB 1 or 2 without any drivers needed (Plug-n-Play) Compatible with Windows XP, Vista (x32 & x64), 7(x32 & x64) Decodes USART, SPI™, 1-WIRE™, I2C™, LIN™ 1.x, LIN™ 2.x, Maple™ and 4 Channels, Input or Output, 256K memory per channel 20MSPS with on-board ultra-precise quartz based timings [□! Generate PWM, FM and Serial USART sequences JJG Analyze FM and PWM signals using Fast Fourier Transform (FFT) Record, save and playback data captures. ‘pjj more* ‘Full specifications and more info, at www.ikalogic.com/scanalogic2/ MUA 201 S Hu 4 t; A-ip ecom Class D Audio Amplifiers Elip It Qua lily. High tJHeckiicy DC/DC Converters High Ejrcckmj. No IE cut Sink FM Audio Transmitters HU E Sumid Qujldy Evaluation Boards Low Cost, Readj-to-Ufre Features: odiilc.com rm R 2.562707 c A integrated design e Ulba campacl e A rn&st no ex Lem a I parts c RolrJm-ort ny SMT oi by hand e Lew cost o HigTi Reliability c Many ready- ro-nse EVR Consumer Auto accessories Instruments industry Toys Gommunjcation Equipments And maiy more elektor 04-2011 15 IR THERMOMETERS Non-Contact Temperature Measurement What about that heat sink: is it the right size? With an infrared thermometer, you can quickly measure the temperatures of all sorts of objects at a (reasonable) distance. Thermometers of this sort are available with prices starting at a few dozen euros/pounds. What do you need to pay attention to when buying or using an infrared thermometer? This article sets you on the right path and provides information on a selection of meters priced under 200 euros/pounds. By Harry Baggen (Elektor Netherlands Editorial) At first glance, IR thermometers appear to be very handy instru- ments for measuring temperatures at a distance with high accuracy over a wide temperature range. Furthermore, they are now available at relative modest prices, so quite a few people buy one without giving much thought to the significance of the various features and how to use them properly. It’s the same as what happens with a lot of consumer goods nowadays: just press the buttons and see what happens. Nobody bothers to read through the user guide, and most people ignore it until they run into a problem that can’t be sorted out any other way. Fortunately, the situation is better among electronics enthusiasts. We are all aware of the importance of knowing what we are meas- uring, and most of us also want to know what we need to pay atten- tion to when using a measuring instrument. Although an IR thermometer can be very handy, you can’t expect to obtain good results unless you use it properly and its specifications match what you want to use it for. It makes a difference whether you simply wish to measure a variety of objects with no need for espe- cially high accuracy, or you need to know the exact temperature of a small surface located a metre away from the instrument. You need two different types of meters for these tasks. Accordingly, you should read this article before you buy an IR thermometer. Radiant heat All objects radiate infrared energy. The warmer an object is, the faster the molecules in the object move about, and as a result the more infrared energy it radiates. The wavelength of this radiation lies roughly between 0.5 and 1 00 pm. This depends on the tem- perature: the higher the temperature, the shorter the wavelength of the radiated IR energy, as illustrated in Figure 1 for several dif- ferent temperatures. This means that an IR thermometer must be able to detect energy radiated in a specific spectrum in the IR band in order to be able to measure temperatures accurately over a wide temperature range. In addition, you should bear in mind that only perfect radiators (in technical terms, ‘black bodies’) actually radiate all of their thermal energy. With other types of objects, the amount of energy radiated also depends on factors other than the tempera- ture of the object, such as the properties of the material and surface reflection. This is expressed by the emissivity or emission coefficient of the material, and it can strongly affect the accuracy of IR temper- ature measurements. See the inset for more about this. Features What features should you look for when you buy an IR thermom- eter? To start with, the price will naturally be a major factor. For professional use, you need an instrument that is more reliable and better calibrated than what you need for home or hobby use. Aside from this, the price is largely determined by two factors: the meas- uring range of the instrument and its angular field of view (open- ing angle). A large measuring range imposes more severe demands on the IR sensor. Most inexpensive instruments can easily handle tempera- tures up to around 200 to 300 degrees. Nowadays you can also find instruments with ranges up to 500-1000 °C at reasonable prices. There are some models priced as low as 1 00 euros/pounds that can manage 1 000 °C, at least if the manufacturer’s specifica- tions can be taken at face value. However, most of the money goes into the optics, and instruments with a small angularfield of view are significantly more expensive. Whether you actually need a small field of view (FOV) depends on the intended use. A small FOV is certainly worthwhile for making measurements on electronic components, such as small heat sinks and the like, where the rule is ‘the smaller the better’. The angularfield of view is usually stated as a ratio, with 1 0:1 being a common value. This means that the diameter of the measuring spot is one-tenth of the measur- ing distance (see Figure 2). With this ratio, at a distance of 1 0 cm 16 04-2011 elektor IR THERMOMETERS Wavelength [|im] Figure 1 . IR radiation emitted by a black body at various temperatures (source: Scitec Instruments). the diameter of the measuring spot is 1 cm, while at a distance of 1 m it is 1 0 cm. Incorrect estimation of the size of the measuring spot during an IR temperature measurement is the most common cause of incorrect readings. An IR thermometer indicates the cor- rect temperature only if the spot lies fully within the area to be measured (Figure 3), and usually the spot area accounts for only 90% or so of the measured energy. Accordingly, if you want accu- rate readings you should hold the instrument as close as possible to the object being measured. A good rule of thumb is that for high-accuracy measurements, the area to be measured should be at least twice as large as the measuring spot. Spot diameter 10 50 100 200 mm Figure 2. The angular field of view of an IR thermometer is specified as the ratio of the distance and the diameter of the measuring spot. Another key factor with regard to the accuracy of the readings is the properties of the material whose temperature is being measured. The reflectivity of the material is indicated by the previously men- tioned emission coefficient. Simple IR instruments are permanently calibrated for a value of 0.95. This is suitable for a wide variety of materials, including wood, plastics, rubber, stone, water, concrete and ceramics, but metals in particular have significantly lower emis- sion coefficients, especially if they have a shiny surface. This can lead to measurement errors as large as 50%. This means that there’s no point in measuring the temperature of an aluminium heat sink with a natural finish if your IR thermometer does not support emissivity The following companies kindly supplied products for this test: Amprobe (www.amprobe.eu) BASETech: Conrad (www.conrad.com) Bl< Precision (www.bkprecision.com) Black & Decker (www.blackanddecker.com) ELV (www.elv.de) Extech (www.extech.com) Fluke (www.fluke.com) HT Italia (www.htitalia.it) Optris GmbFI (www.optris.com) Peaktech (www.peaktech.de) Testo (www.testo.com) Uni-Trend (www.uni-trend.com) Velleman (www.velleman.eu) Voltcraft: Conrad (www.conrad.com) elektor 04-2011 17 IR THERMOMETERS Most accurate Correct Measuring measurement measurement error! 100913 - 13 Figure 3. Always hold the thermometer close enough to the object Figure 4. We used this Fluke 572 IR thermometer as a reference for to measured that the entire measuring spot is located within the our tests. It has a 50:1 FOV. area to be measured. adjustment. To check this in practice, we ground one side of a small black ano- dised heat sink down to bare metal, warmed the heat sink, and measured the temperature on both sides. The reading on the black side was 65 °C, but on the bare side it was only 40 °C. To obtain a reasonably accurate indication of the temperature on the bare side with the instrument, it would be necessary to reduce the emission coefficient to approximately 0.15. Methods for obtaining more accurate readings There are three different methods for obtaining more accurate read- ings with materials for which the emissivity is not known or deviates too much from the default value of 0.95: - Stick a piece of thin, matt black tape on the surface to be meas- ured; it will have an emissivity fairly close to 0.95. Of course, this works only at temperatures that the tape can withstand. Some man- ufacturers of IR thermometers offer special tape for this purpose. - Paint the surface to be measured matt black. Radiator paint can be used for temperatures up to around 80 °C, and special heat-resistant paints can be used for higher temperatures (up to 600 °C). - Drill a hole in the object to be measured, with a depth at least five times its diameter. Using the thermometer, measure the tem- perature inside this hole (the hole diameter must be greater than the measuring spot diameter). With materials whose emissivity is greater than 0.5, this hole forms a nearly ideal black body. Unfortu- nately, this is a relatively destructive method. If it is possible to adjust the emissivity setting of the thermome- ter (this is indicated in the summary table), you still need to know the right value for the material to be measured. The user guides for most instruments usually include a table of values for a large number of materials, and the values for various materials commonly used in electronics are shown in a table in the inset. This gives you a more or less reliable reference point, but you still can’t be entirely Figure 5. Some IR thermometers have a single laser pointer, while others have two and a few even have three. 18 04-2011 elektor IR THERMOMETERS certain of the value. The best way to determine the exact value of the emissivity of a particular material is to use an accurate contact temperature sensor and compare the value measured with this senor to the value indicated by the IR thermometer. Then you can adjust the emissivity setting until the IR thermometer shows the same value. From economical to affordable To see how usable IR thermometers are for various purposes, in the Elektor lab we tried out a number of instruments of different makes with prices below 200 euros/pounds, testing them under a variety of conditions. We intentionally selected models covering a wide range of prices, extending from 23 euros/pounds for the least expensive model to 1 75 euros/pounds for the most expensive. Incidentally, it’s remarkable how many different types of IR thermometers are available. It looks like they’re just as indispensable as multimeters. As most IR thermometers are very similar in terms of appearance, operation and features, there’s no need to describe them all individ- ually. The key features, such as field of view, temperature range and emissivity adjustment, are summarised in the accompanying table. To provide a reference standard for all of this, Fluke kindly loaned us a model 572 IR thermometer, which sells for around 700 euros / pounds (ex VAT) and has a field of view of 60:1 (Figure 4). In the near future we also plan to present a comparison of measurements with an IR thermometer and a thermal imaging camera; unfortunately we weren’t able to complete it in time for this article. The differences So what are the biggest differences? As already mentioned, they can be found in the measuring range, field of view and adjustment options. A measuring range up to 200 °C or so is more than ade- quate for most home-and-garden variety electronics applications, and nearly all of the tested models are suitable for this. The field of view varies considerably among the different models. For instance, the cheapest models have a field of view of 1:1, with which it is prac- tically impossible to make selective measurements unless you hold Advertisement r Take out a free subscription to E-weekly now Do you want to stay up to date with electronics and computer technology? Always looking for useful hints, tips and interesting offers? Subscribe now to E-weekly, the free Elektor Newsletter. Your benefits: • The latest news on electronics in your own mailbox each friday • Free access to the News Archive on the Elektor website • You’re authorized to post replies and new topics in our forum e weekly * i it’ -A ■. <3---: !. Ueter. nSAtfu.Cifeujtt i _ii i— i .L lU i 1- a _ _ ri:a« ■■trtSKi"; si.icsninM i a -ai-i * « O e c e ~iQ Ik By yfi I fi ■TWft . ttekto? a vft I hly - i 34 K 1 flqwoooe Rapid d< tTlflp ym tjcfjjjtoiojif&Ea;' a-td coni rlcgjsysit ns. SjnflviHFM! ir-iiih: Ircrinriilw L.ipc ciibbcLTcj ‘r *' 1 -* 4 " 1 l - jPft ftu I ft £»■ t* irfw i*i«. “c.m fprf ■■■*.+ i-n *v ipfr cmar-i tw -T1 nfuat 1 * |K d#ScUC1C 'E-SK EB- ftC f-B* ft m r -3 . fi i’H-fti ^ L M Cftr k Live Sft |>> 4 li| v 48 « ****'»• «***■ 'Vft-- H '-Ht -*«# ^a:n::T» Nkw li«ni Eklilvi; DVO Audio CoOetlimi VoC 1 r-if-T i pa 7 *-■ »'"he :i ■P rmw C-iiUTl V Register today on www.elektor.com/newsletter A Elektor App for iPhone and iPad <=> > The Elektor Electronic Toolbox Elektor now offers an App you cannot afford to miss on your iPhone, iPod Touch or iPad. The Elektor Electronic Toolbox is a collection of no fewer than 28 electronic tools that can be picked from a comprehensive set of icons! Highlights: - Databases for Transistors, FETs, Triacs, Thyristors, Diodes and ICs - NE 555 circuit design - An Ohms Law calculator - Schematic Diagrams - Number base converter - LED / resistor calculation - R/Land BJT calculations - And more Further information at Now available from the Apple iTunes Store trius^ 5 . 99 |€ 4£91 www.elektor.com /.app elektor 04-2011 19 IR THERMOMETERS Figure 6. Some instruments come with a type l< thermocouple, which can be used as contact sensor to measure the surface temperature so that the emissivity setting can be adjusted for IR measurements. the instrument right next to the object to be measured. For a bit more money, you get a thermometer with a field of view of 8: 1 or 10:1, which is more like what you’re looking for. However, if you want to measure something on a PCB or inside an enclosure, you should be looking for an instrument whose optics provide an FOV of 20:1 or 30:1. Another important feature is the option of adjusting the emis- sion coefficient setting. Particularly for measurements on metallic objects, such as a bare aluminium heat sink, a fairly radical adjust- ment of the coefficient is necessary to obtain correct readings. How- ever, this feature is usually found only instruments at the upper end of the price scale. Of course, this is all highly relative because we’re talking about fairly inexpensive instruments here. Professional mod- els can easily cost more than 200 euros/pounds, but for that money you get an officially calibrated device with guaranteed long-term accuracy. With ‘no-name’ (or better said, imaginatively named) instruments, only time will tell how stable they are. All but two of the instruments we tested have a pointer beam, usually in the form of a laser beam (see Figure 5 for the different types). Only the Black&Decker unit has an LED beam, whose col- our depends on the measured temperature. Some of the instru- ments are equipped with two laser beams that indicate the size of the measuring spot, which is very handy and considerably reduces measurement errors. However, you should bear in mind that this indication is usually incorrect at short distances because the laser beams cross at a distance of 1 0 to 1 5 cm. Here as usual, you should use your common sense when making measurements. For compari- son, the professional-quality Fluke 573 instrument we used as a ref- erence has three laser beams that indicate the centre and diameter of the measuring spot. An especially handy feature with some IR thermometers is the option of connecting a type K thermocouple so you can measure the temperature with a contact sensor. Then you can compare this with the IR temperature reading and adjust the emission coefficient precisely (Figure 6). For example, the HT3301 unit provides this capability, and it has a measurement memory for up to 20 readings. Most of the devices also have several other features, such as a mem- ory for saving minimum and maximum temperature readings or an alarm with an adjustable threshold level. All of this is noted in the summary table. Unusual models There are few unconventional instruments in the group. The first is the Peaktech 5090, which has a totally different appearance than the other instruments and looks more like a multimeter. It also has two measurement functions: temperature and relative humidity. Both quantities are shown at the same time on a large display. The humidity sensor is housed in a separate probe that is connected to the meter by a coiled cable. Unlike the other instruments, the IR thermometer function is continuously enabled after the unit is switched on, which takes a bit of getting used to. The laser pointer can be switched on or off with a separate button. Speaking of multimeters, the Extech EX470 combines a standard multimeter with an IR and thermocouple (type l<) thermometer. Although the IR measuring function does not offer many setting options, this is a handy solution for an electronics hobbyist or pro- fessional who needs an all-in-one instrument. The multimeter even features true RMS readings along with capacitance and frequency measurement. To give you an idea of the variety of products that are available, we also included an IR thermometer from Black&Decker in our selec- tion. You can buy this device in an ordinary DIY home improvement store. It is actually intended to be used for tracking down heat leaks in your house, but it can be use for other purposes as well. The spot size is too large for measuring small objects, but that’s also true of quite a few of the other models in our selection. A special feature of this instrument is that it has a user-settable hysteresis range (with three steps), and the colour of the LED spot changes when the meas- ured temperature goes outside the hysteresis range (relative to the initially measured value). Although the LED spot is smallerthan the measuring spot and not as easy to see at longer distances, the col- our change is very a practical feature for the original application. Practical experience To test the instruments under practical conditions, we made several measurements on different enclosures and heat sinks. These results showed that all of these instruments are reasonably accurate; they deviated only a few degrees from our Fluke 572 reference instru- ment. However, you should bear in mind that the deviations are rel- atively large at low temperatures (room temperature), where a dif- ference of 2 °C is much more significant than at high temperatures. We also used a small electric hot plate to check the spot size and the 20 04-2011 elektor Table ia. Key specifications. Model Amprobe IR608A BASETech MIN1 1 BK Precision 635 Black&Decker TLD100 ELV 8835 ELV VA 6520 Temp, range -1 8 to 400 °C -33 to 220 °C -20 to 550 °C -30 to 1 50 °C -50 to 1 050 °C -50 to 500 °C FOV 8:1 1:1 10:1 6:1 30:1 8:1 Emissivity 0.95 fixed 0.95 fixed Ajustable 0.95 fixed Ajustable 0.95 fixed Laser 1 — 1 LED 1 1 IRband 7 to 1 8 jim — 6 to 14 jim - 8 to 14 jim 8 to 14 jim Resp. time 0.5 s 1 s 1 s - 1 s 0.5 s Max-Min High/Low alarm -/- -/- x/x -/- x/x X/- Extras — — — — Case, K-type thermocouple, 20-reading memory Case Price € 94 (ex VAT) €23 € 157(exVAT) €55 €100 €62 % | Model Extech EX470 Fluke 62 HT3301 Optris MS LT Peaktech 4975 Peaktech 5090 Temp, range -50 to 270 °C -30 to 500 °C -50 to 1 050 °C -32 to 420 °C -50 to 550 °C -50 to 500 °C FOV 8:1 10:1 30:1 20:1 12:1 8:1 Emissivity 0.95 fixed 0.95 fixed Ajustable 0.95 fixed Ajustable 0.95 fixed Laser 1 1 1 1 2 1 IR band - - 8 to 1 4 jim 8 to 1 4 jim 8 to 1 4 jim 6 to 1 4 jim Resp. time - 0.5 s 1 s 0.3 s 0.15s 0.4 s Max-Min High/Low alarm -/- X/- X/X X/- X/X X/- Extras Multimeter functions, K-type thermocouple — Hard case, K-type thermocouple, 20-reading memory — Case Case, built-in humidity meter Price €145 €125 € 1 48 (ex VAT) €89 €63 €84 ^ ^ Model Testo 830 T1 Uni-Trend UT 300B Velleman DVM105 Velleman DVM8861 Voltcraft IR260-8S Voltcraft IR800-20D Temp, range -30 to 400 °C -18 to 380 °C -33 to 220 °C -50 to 550 °C -30 to 260 °C -50 to 800 °C FOV 10:1 10:1 1:1 12:1 8:1 20:1 Emissivity Ajustable 0.95 fixed Ajustable Ajustable 0.95 fixed Ajustable Laser 1 1 - 2 1 2 IR band - - 5 to 1 4 jim 8 to 1 4 jim - 8 to 1 4 jim Resp. time 0.5 s 0.5 s 1 s 0.15s - 0.15s Max-Min High/Low alarm -/X X/- X/- X/X X/- X/X Extras — — Storage case Case — Case Price €121 €29 €40 €85 €30 €96 elektor 04-2011 21 IR THERMOMETERS accuracy of the laser pointer. Although this may not sound espe- cially professional, in practice it turned out to be very effective. In particular, with some of the instruments we had the feeling that the built-in laser (or the IR sensor) was not properly centred. Especially in the case of instruments with a small field of view, it is important that the laser pointer marks the exact centre of the measuring spot. We found that this was not entirely true with various instruments; the laser pointer was often misaligned by a few degrees. Sometimes a few taps on the instrument were enough to cause the laser to sud- denly shift by a few degrees. The worst in this regard was the Volt- craft IR800-20D with its dual laser. Although the spot size stated in the specs was very close to reality, the lasers clearly pointed too far to the right and were offset from the actual measuring spot by nearly half its diameter. The dual-laser units of the Peaktech 4975 and the Velleman DVM8861 , which came from the same factory, did not exhibit this problem, so we assume that it was an isolated problem. Nevertheless, it’s a good idea to not trust the laser spots blindly, and it’s advisable to have some extra surface around the measur- ing spot to ensure that you’re measuring the right thing. The three laser spots of the Fluke reference instrument were perfectly aligned, despite its narrow 60:1 field of view (actually, we hardly expected anything else). You should also take parallax errors into account at short distances. A difficult choice? An IR thermometer can be a very handy instrument if you use it properly. We haven’t said anything about accuracy yet in this arti- cle. Almost all of the devices have an accuracy of around 2%, which yields a negligible error compared with all the other measurement errors that can occur with an IR reading. The important factors for making measurements with relatively small objects, especially in the electronics area, are a small measur- ing spot (preferably 20:1 or better FOV) and the possibility of adjust- ing the emissivity setting. The ELV 8835, HT3301 and Voltcraft IR800-20D meet this requirement. However, suitable models are available from nearly all brands; here we only made a more or less random selection from the wide range of available products. Still, it’s clear that you can buy an instrument that fulfils these require- ments for as little as 1 00 euros/pounds. An instrument with a field of view of 8:1 or 1 0:1 (1 cm spot size at a distance of 1 0 cm) is also perfectly adequate for measuring the temperatures of somewhat larger objects, such as heat sinks, as long as you remember to stay close to the object being measured. Particularly for readings on electronic circuits, instruments with a fixed emissivity setting of 0.95 will generally not yield usable results. It’s noteworthy that many instruments come from the same facto- ries in China (just like multimeters), with the only difference being the colour or the printing on the housing. Consequently, you should pay careful attention to appearance when comparing different brands of thermometers. We were especially taken by the two mini-instruments in this selec- tion: the BASETech Mini 1 and the Velleman DVM105. They are cute little gadgets for making the occasional quick measurement. Although they don’t have any optics (a tube in front of the sensor gives them a 1:1 ratio), the Velleman instrument does allow you to set the emissivity value. ( 100913 -I) We thank Fluke Netherlands for making a Fluke 572 IR thermometer available for use as a reference for our tests. Emissivit Emissivity (or the emission coefficient) is an indication of the extent to which the thermal infrared radiation emitted by an object is determined by the object’s own temperature. A value of 1 means that the infrared radia- tion is determined solely by the object’s own temperature. A value less than 1 indicates that the emitted radiation depends in part on factors other than the object’s own temperature, such as nearby objects or heat transmission. Simple IR thermometers usually have a fixed emission coefficient setting of 0.95. If the emissivity of the object to be measured differs from this, the resulting readings will be inaccurate. More expensive instruments have an adjustable emission coefficient setting. The emissivity values of a number of materials are listed in the table. They have been compiled from lists provided by various manufacturers of IR thermometers. The emissivity of metals is strongly influenced by the processing undergone by the metal and the surface treatment. Metal Emissivity Non-metal Emissivity Bare aluminium 0.02-0.4 Concrete (rough) 0.93-0.96 Gold 0.02-0.37 Class 0.76-0.94 Copper 0.02-0.74 Wood 0.8-0.95 Lead 0.06-0.63 Carbon 0.96 Brass 0.03-0.61 Human skin 0.98 Nickel 0.05-0.46 Paper 0.7-0.95 Steel 0.07-0.85 Plastic 0.8-0.95 Tin 0.04-0.08 Rubber 0.86-0.94 Silver 0.01-0.07 Water 0.67-0.96 Zinc 0.02-0.28 Sand 0.76-0.9 When compiling this table, we noticed that every manufacturer states somewhat different values, which makes it rather difficult to derive the correct emissivity settings for an instrument from the table supplied with the instrument. The only sure way to determine the correct setting is to measure the temperature with a contact sensor. 22 04-2011 elektor QUASAR electronics Quasar Electronics Limited PO Box 6935, Bishops Stortford CM23 4WP, United Kingdom Tel: 01279 467799 Fax: 01279 267799 E-mail: sales@quasarelectronics.com Web: www.quasarelectronics.com Postage & Packing Options (Up to 0.5Kg gross weight): UK Standard [ 3-7 Day Delivery - £4.95; UK Mainland Next Day Delivery - £1 1 .95; Europe (EU) - £1 1 .95; Rest of World - £1 2.95 (up to 0.5Kg) lOrder online for reduced price UK Postage! VISA EUROCARD We accept all major credit/debit cards. Make cheques/PO’s payable MasterCard to Quasar Electronics. Prices include 17.5% VAT. Please visit our online shop now for details of over 500 kits, V/SA projects, modules and publications. Discounts for bulk quantities ■ | Electron | 01279 Credit Card 467799 SOLO The Electronic Kit Specialists Since 1993 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 range and 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 £7.95 Computer Controlled / Standalone Unipo- lar Stepper Motor Driver Drives any 5-35Vdc 5, 6 or 8-lead unipolar stepper motor rated up to 6 Amps. Provides speed and direc- tion control. Operates in stand-alone or PC- controlled mode for CNC use. Connect up to six 3179 driver boards to a single parallel port. Board supply: 9Vdc. PCB: 80x50mm. Kit Order Code: 3179KT - £15.95 Assembled Order Code: AS3179 - £22.95 Computer Controlled Bi-Polar Stepper Motor Driver Drive any 5-50Vdc, 5 Amp bi-polar stepper motor us- ing externally supplied 5V levels for STEP and DI- RECTION control. Opto- isolated inputs make it ideal for CNC applica- tions using a PC running suitable software. Board supply: 8-30Vdc. PCB: 75x85mm. Kit Order Code: 3158KT - £23.95 Assembled Order Code: AS3158 - £33.95 Bi-Directional DC Motor Controller (v2) Controls the speed of most common DC motors (rated up to 32Vdc, 10A) in both the forward and re- verse direction. The range of control is from fully OFF to fully ON in both directions. The direction and speed are controlled using a single potentiometer. Screw terminal block for connections. Kit Order Code: 3166v2KT - £22.95 Assembled Order Code: AS3166v2 - £32.95 DC Motor Speed Controller (100V/7.5A) Control the speed of almost any common DC motor rated up to 100V/7.5A. Pulse width modulation output for maximum motor torque at all speeds. Supply: 5-15Vdc. Box supplied. Dimensions (mm): 60Wx100Lx60H. Kit Order Code: 3067KT - £18.95 Assembled Order Code: AS3067 - £26.95 Most items are available in kit form (KT suffix) or assembled and ready for use (AS prefix). 8-Ch Serial Isolated I/O Relay Module Computer controlled 8- channel relay board. 5A mains rated relay outputs. 4 isolated digital inputs. Useful in a variety of control and ^sensing applications. Con- trolled via serial port for programming (using our new Windows interface, terminal emula- tor or batch files). Includes plastic case 130x100x30mm. Power Supply: 12Vdc/500mA. Kit Order Code: 3108KT - £69.95 Assembled Order Code: AS3108 - £84.95 Computer Temperature Data Logger 4-channel temperature log- ger for serial port. °C or °F. Continuously logs up to 4 separate sensors located 200m+ from board. Wide range or tree software applications for stor- ing/using data. PCB just 45x45mm. Powered by PC. Includes one DS1820 sensor. Kit Order Code: 3145KT - £19.95 Assembled Order Code: AS3145 - £26.95 Additional DS1820 Sensors - £3.95 each Rolling Code 4-Channel UHF Remote State-of-the-Art. High security 4 channels. Momentary or latching relay output. Range up to 40m. Up to 15 Tx’s can be learnt by one Rx (kit in- cludes one Tx but more avail- able separately). 4 indicator LED ’s. Rx: PCB 77x85mm, 12Vdc/6mA (standby). Two and Ten channel versions also available. Kit Order Code: 3180KT - £49.95 Assembled Order Code: AS3180 - £59.95 DTMF Telephone Relay Switcher Call your phone num- ber using a DTMF phone from anywhere in the world and re- motely turn on/off any of the 4 relays as de- sired. User settable Security Password, Anti- Tamper, Rings to Answer, Auto Hang-up and Lockout. Includes plastic case. Not BT ap- proved. 130x110x30mm. Power: 12Vdc. Kit Order Code: 3140KT - £74.95 Assembled Order Code: AS3140 - £89.95 Infrared RC Relay Board Individually control 12 on- board relays with included infrared remote control unit. Toggle or momentary. 15m+ range. 112x122mm. Supply: 12Vdc/0.5A Kit Order Code: 3142KT - £59.95 Assembled Order Code: AS3142 - £69.95 New! 4-Channel Serial Port Temperature Monitor & Controller Relay Board 4 channel computer serial port temperature monitor and relay con- troller with four inputs for Dallas DS18S20 or DS18B20 digital ther- mometer sensors (£3.95 each). Four 5A rated relay channels provide output control. Relays are independent of sensor channels, allowing flexibility to setup the linkage in any way you choose. Commands for reading temperature and relay control sent via the RS232 interface using simple text strings. Control using a simple terminal / comms program (Windows HyperTerminal) or our free Windows application software. Kit Order Code: 3190KT - £69.95 PIC & ATMEL Programmers lli 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) £14.95 18Vdc Power supply (PSU120) £19.95 Leads: Serial (LDC441) £3.95 / USB (LDC644) £2.95 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 - £49.95 Assembled Order Code: AS3149E - £59.95 USB 'All-Flash' PIC Programmer USB PIC programmer for all ‘Flash’ devices. No external power supply making it truly portable. Supplied with box and Windows Software. ZIF Socket and USB lead not included. Assembled Order Code: AS3128 - £49.95 See website for full range of PIC & ATMEL Programmers and development tools. Secure Online Ordering Facilities • Full Product Listing, Descriptions & Photos • Kit Documentation & Software Downloads TEST & MEASUREMENT PicoC Please welcome ATtiny & The Low Picofarads By Vladimir Mitrovic (Croatia) ■a Even upmarket digital multimeters boasting a built-in capacitance meter are useless if you want to check out tiny capacitances like 2.7 pF or 5.6 pF. Usually, you’re tied to a lowest measuring range of 2000 pF, which is a good laugh to RF designers and radio amateurs. Although at 3.5 digits the DMM’s resolution is 1 pF, any measurement below 200 pF or so will produce coarse if not ridiculous results. Pico C does a far better job. Beating many DMMs hands down, this little instrument easily measures capacitances down to fractions of a picofarad. Small capacitances like in the sub- 1 0 - picofarad (pF) range are often invisible but by no means insignificant. The seasoned RF designer will know not just where to sniff them out but also explain to the more DC-minded just how a few stray pF in a circuit may decide between wild oscillation and controlled behaviour, EMC Go/No-Go, volume production in China or ‘forever-a-prototype’. Here’s a solder blob with a residue of blackish dried resin around it: 1 .5 pF and no wonderthe 2 GHz CPU oscillator fails to operate because it sees a significant reactance (feel free to do the maths; they’re no fun). Likewise, a 1 0 cm long PCB track carrying pulses in the nanoseconds range across a cheapo 4 -layer board: easily 5 pF, causing ringing and other unwanted effects like resonances upsetting digital logic at the far end (feel free to do the maths; they’re ugly). Small capacitors are a radio amateur’s and radio repairman’s delight and your Editor could not resist scavenging his vintage component drawer and show you a few specimens in Figure 1 . We’ve also seen relatively small polystyrene capacitors — say, in the 500 pF range — used in high- end audio circuits and these you might also want to check for accuracy and drift due to ageing. Specifically in active (opamp) Features • range: > will be displayed. If this happens in measuring mode, normal measurements will be restored as soon as the large capacitor is removed. If you use an inappropriate reference capacitor, the same message can appear during calibration, which will be interrupted for repeating with a proper reference capacitor. Accuracy and stability The accuracy of the little instrument depends primarily on the accuracy of your reference capacitor. Immediately period, without a capacitor attached the readout was seen to vary between -0.1 pF and 0.1 pF. If you notice persistent inaccuracies in your and measuring routines are written in assembler, to have better control over timing. BascomAVR is pretty wasteful when it comes to arithmetic with long variables For all measurements below 1000 pF forget about your DMM and use Pico C instead after calibration you may expect 1%, ±1 digit accuracy or better, if you can get your hands on a more precise reference capacitor. Although the output frequency of the TLC555 timer is only slightly temperature and voltage dependent, even small fluctuations become visible due to the instrument’s high resolution. For example, if you measure the same capacitor for several minutes, some change in the measurement results may be observed. In the Elektor labs, on testing the stability with a high-spec 1 nF polypropylene reference capacitor it was found that the measured value had a tendency to change a few tenths of a pF upwards in the first two minutes or so after calibration. After several hours, the measured value may be seen to change to 1001 pF or 999 pF. This might seem inaccurate, but actually represents a deviation of only 0.1 %. During the same measurements, like a readout other than 0.0 pF without a test capacitor, or an error clearly exceeding 0.1 % when measuring the reference capacitor, you may repeat the calibration as explained before. Calibration values are written in the EEPROM inside the microcontroller and will be reused the next time Pico C is switched on. If used at room conditions with no significant temperature changes, Pico C normally won’t require calibration each time it is used. However, with the microcontroller’s EEPROM allowing 1 00,000 write cycles (sez the Atmel sales rep), there should not be a problem if you calibrate Pico C whenever you think appropriate. Software development The ‘EE_pico_C.bas’ program was written in BascomAVR programming language [2], with several assembler routines. Interrupt and it was a challenging task to fit the whole program into the ATtiny2313’s 2 KB of flash memory. That’s why some calculations and conditional branching are written in the assembler, too, as you will be able to discover for yourself in the source code file that’s available free from the Elektor website PI. (100823) Internet Links [1] www.elektor.com/ 100823 [2] Bascom AVR Course, parts 1 -6, Elektor September 2008 through February 2009. elektor 04-2011 29 TEST & MEASUREMENT Wireless OBD-II Car diagnostics interface with Bluetooth orZigBee by Folker Stange and Erwin Reuss (Germany) The cheapest way to diagnose faults on a modern car is to connect its OBD-II interface to a (notebook) PC running suitable diagnostics software. However, a wired connection is not always the most suitable, and self- contained OBD testers are a rather expensive and less flexible alternative to using a PC. An interesting option is a wireless OBD interface with a radio interface to a PC: the homebrew solution described here allows the choice of using either Bluetooth or ZigBee. Almost every car these days has a diagnos- tics connector hidden away somewhere in the passenger compartment. Although the distance from the steering wheel is, with some exceptions, standardised (at 0.61 m), this does not seem to have constrained manufacturers’ creativity significantly: OBD-II connectors are found tucked away in the door pillar, in the driver’s footwell, in the central console, in the glove box, behind ash trays and storage compart- ment flaps and in who knows what other nooks and crannies. It is probably best not to have to try to find the connector in a hurry when your car has conked out at the side of the road. Make the connection Assuming that you have managed to find your OBD-II connector, the next task is to get data from it to your PC. This requires special-purpose software along with, in the simplest case, a level shifter to convert the OBD-II signals to RS-232 voltage lev- els. Often a USB-to-RS-232 adaptor will be required as well, as few modern PCs have RS-232 ports. In the most straightforward scenario just one pin (called the ‘K’ line) on the OBD-II socket is used. Then a MAX232 is all that is needed on the hardware side, with a bidi- DIAMEXDXM m i2-u Figure 1 . Block diagram of the DXM module with 32-bit ARM Cortex M3 processor for OBD applications. rectional output stage to interface to the socket. Using software specific to the model of vehicle the car’s electronics can then be interrogated. In theory this remains valid with the stand- ardisation of OBD-II. Indeed, the pinout of the diagnostics connector is standard- ised (for most pins at least), and there is a basic set of five permissible protocols (ISO, KWP2000, PWM, VPWM and CAN). A uni- versal interface has to be able to recognise all these protocols and be able to adapt itself accordingly. This means that in prac- tice the interface needs a microcontroller in addition to the level shifter so that a connection can be made automatically to the vehicle’s electronics and the desired data transferred. In combination with suit- able OBD-II software it is then possible to obtain diagnostics from any petrol-engined car built from 2000 onwards and any die- sel-engined car built from 2003 onwards, regardless of manufacturer. Normally the interface is plugged directly into the OBD- II socket in the car and then linked to a notebook using a USB or RS-232 cable. It is more practical, however, to use a radio link between OBD interface and notebook, 30 04-2011 elektor TEST & MEASUREMENT +12V Figure 2. The OBD-II Bluetooth interface circuit consists of a DXM module and a Bluetooth module plus a 3.3 V switching regulator. especially if diagnostics are to be obtained while driving. In this case it is possible for the OBD interface to derive power from the OBD socket itself. As many notebooks and netbooks already include a Bluetooth interface (and those that don’t can be kit- ted out with a suitable dongle), this would seem to be the ideal standard to choose. If Bluetooth is not suitable, ZigBee is available as an alternative. Build-it-yourself In making a compact and powerful OBD interface it is impossible to avoid the use of fine-pitch SMD devices. However, the DIY approach is feasible if a ready-populated Features • compact size, fits inside an OBD-II plug • integrated DXM module • automatic protocol scan • PWM, VPWM, ISO9141, KWP2000 and CAN interface standards • software compatible with ‘moDiag’ and ‘OBD-DIAG’ • suitable for use with all OBD-ll-equipped cars Bluetooth version • compatible with Windows XP, Windows Vista and Windows 7 • Class 3 Bluetooth module with maximum range of 100 m ZigBee version • Cortex M3 and Atmel AT90USB162 host microcontroller • Windows driver using INF file • Frequency range 2405 MHz to 2480 MHz with automatic channel selection • Receiver sensitivity -101 dBm • IEEE 802.15.4-2003 (ZigBee-like protocol) • automatic retry on failed transmission • range approximately 10 m toi5 m (maximum approximately 30 m to 40 m) • ZigBee USB stick compatible with Windows XP, Windows Vista and Windows 7 elektor 04-2011 3i TEST & MEASUREMENT Figure 3. Top and bottom sides of the Bluetooth interface board with OBD plug soldered on. SMD microcontroller module is used. The DXM module [1 ] used here was described in the September 2009 issue of Elektor [2]. As Figure 1 shows, this unit comes with an ARM Cortex M3 processor and a pano- ply of peripherals. With firmware loaded it becomes a universal OBD-II diagnostics and control unit that can be connected directly to the vehicle’s OBD-II connector. The mod- ule can be configured for various applica- tions using AT commands (for further infor- mation see [1 ]), including as a diagnostics interface running at a suitable baud rate. On the output side it offers a serial inter- face at 3.3 V levels. This can be connected to a wireless transceiver, which might, for example, be a Bluetooth orZigBee module. We will look at both options below. Bluetooth Figure 2 shows the Bluetooth version of the OBD-II interface circuit. The DXM mod- ule is connected to the OBD-II connector on the input side and to the compact Ray- son BTM222 Bluetooth module on the out- put side. This module was described in the December 2009 issue of Elektor [3], and has already been used to provide a Blue- tooth extension to the autonomous OBD-II Analyser NG [2]. The module comes com- pletely preconfigured and transfers data at 19200 baud. We therefore also configure the DXM module to run at this speed. Figure 4. Circuit of the ZigBee USB stick, specially designed to work with the ZigBee OBD-II interface. 32 04-2011 elektor TEST & MEASUREMENT Figure 5. The ZigBee OBD-II interface includes two ARM Cortex processors: one handling OBD communications in the DXM module and one for communicating with the AT86RF230 ZigBee transceiver device. Power for the circuit is obtained from the OBD-II socket, which provides the vehicle’s on-board 12 V supply. Diode D1 provides reverse polarity protection, and a small switching regulator efficiently steps the voltage down to the 3.3 V required by the two modules. The BTM222 is a ‘class 3’ Bluetooth mod- ule, with a specified range of up to 1 00 m. However, this range is achieved only under ideal circumstances, and requires the use of a class 3 Bluetooth receiver at the other end of the link: this is not provided by most Bluetooth-equipped notebooks. If maxi- mum range is required, then a class 3 Blue- tooth dongle can be used as the transceiver on the PC side. The circuit board, included in the kit of parts, has a printed quarter-wave- length antenna built in. This antenna works very well and should not be modified by the addition of extra lengths of wire. The board is ready populated with the SMD compo- nents, and only a few components remain to be soldered (the blue device in Figure 3 is coil LI , not an electrolytic). ZigBee Whereas with Bluetooth data transfer is authorised by pairing devices using a pass- word, ZigBee is a point-to-point protocol between two fixed stations. Since note- books generally do not come with ZigBee interfaces, it is necessary to use a USB don- gle plugged into the computer. A range of up to 40 m is possible, but the interface is designed for communications over a rather shorter range. The circuit for the ZigBee USB stick designed for this project is shown in Figure 4. Here, as in the ZigBee version of the OBD-II interface circuit in Figure 5, the transceiver device used is the Atmel AT86RF230, which in elektor 04-2011 33 TEST & MEASUREMENT Figure 6. Top and bottom sides of the ZigBee interface board with OBD-II plug soldered on. each case must be configured in software. For this reason both circuits include a host microcontroller: in the OBD interface circuit this is an NXP LPC1313 Cortex M3 device, while in the USB stick an Atmel AT90USB1 62 is used. In each case the microcontroller is responsible for initialisation and for optimis- ing the data transfer for the requirements of OBD-II. All data transferred have to be spe- cially treated for OBD-II, and so in the end we are looking at a proprietary data trans- fer format. Consequently the home made ZigBee USB stick is the only one that can be used here. The LPC1313 has to make the data stream available very quickly, in order to add as lit- tle as possible to the overall latency. This is the reason for choosing a powerful 32-bit Cortex M3 device in the ZigBee OBD-II inter- face. The AT90USB1 62 is an ideal choice for the USB stick, as it includes a built-in USB interface. The wiring of the AT86RF230 ZigBee trans- ceiver follows Atmel’s recommendations. A transformer (balun) matches the signal to the printed quarter-wavelength antenna. The firmware for the two microcontrollers can be downloaded from the Elektor web- site as a hex file [5]. There is scope to mod- ify the code in the ZigBee interface, and the programming connections for both micro- controllers are available on the board. Inter- ested constructors can therefore experi- ment using a suitable in-system program- mer [6]. Button SI in Figure 5 is only used when the system has to ‘learn’ a new USB stick. The circuit around the OBD connector and power supply is not especially different from the Bluetooth version. A kit is also available for the ZigBee version, containing all the necessary components and with the SMDs already fitted. Figure 6 shows the popu- lated board with OBD plug soldered on. The companion ZigBee USB stick, corresponding to the circuit in Figure 4, is available ready assembled, although the board is still visible (see Figure 7). Construction In both versions the DXM module is sol- dered to the underside of the printed circuit board. A trick comes in handy to simplify desoldering the DXM module and BTM222 Figure 7. The ZigBee USB stick showing the circuit board in its transparent enclosure. module in the Bluetooth version if neces- sary: cut a small piece of paper (10 mm by 25 mm) and place it between module and board (Figure 8), leaving a narrow gap. Then the module can be more easily removed from the board using desoldering braid. When soldering the modules (the DXM module and the BTM222 module in the case of the Bluetooth interface) it is best to solder first just the pins that are actually used in the circuit. Figures 9 and 1 0 indicate these pins with dots. A reasonably power- ful iron is required to solder the ground pins on the modules. On the Bluetooth version the only components to be soldered are the coil LI (the blue component in Figure 8), the headers for RXD and TXD, and the two jumpers (see Figures 8 and 9). On the ZigBee version the coil is soldered on the same side of the board as the DXM module. The OBD plug is mounted in the same way on the two versions of the interface. First solder the eight-way header and then remove the black plastic strip from the pins, using a knife or pliers to lift it away. This makes subsequent soldering of the OBD- II connector block (the right way around!) much easier. The Elektor web pages [5] accompanying this article include a series of photographs and brief guide to construc- tion, which should help you orient yourself. Finally screw the two halves of the case together, fitting the perspex shim in the space provided for the cable strain relief. In the ZigBee interface two shims are provided (one with a hole and one transparent) to allow button SI to be operated if necessary. 34 04-2011 elektor TEST & MEASUREMENT Testing Those lucky readers who possess an Elektor OBD Simulator [7] will be able to test their device from the comfort of their own benches. Less lucky readers will have to make do with the real thing in their car. With the interface connected, the two LEDs on the DXM module should flash briefly, indicating a successful self-test. If using the Bluetooth interface, start up the Bluetooth interface on the notebook, allow it to find the new device, and enter the mas- ter password ‘1234’. Windows offers a wide range of virtual COM ports. The first port is used by our applica- tion software for communication. The inter- face can be used with the help of a termi- nal emulator such as AGV-Supertool [8]. It is essential to select the correct baud rate (19200) and COM port. Type ‘ATZ’ or ‘ATI’ into the terminal window, which should prompt a reply from the DXM module. With that, the Bluetooth connection has been successfully tested. To test the ZigBee interface, a driver needs to be installed. Plug in the ZigBee USB stick, and the Windows Assistant will start up automatically and whisk you off to the Elektor website to download a driver. The connection will be established automati- cally without the need for a master pass- word. The ‘ED Tester’ tool will assist with testing: both components, the host and the USB stick, should be recognised. The value indicated by the field strength bars should be between 30 and 50. Software Operation of the diagnostics software on the PC is independent of the standard used for radio communication, which means that both versions can be used with the ‘moDiag’ OBD software. This was described in the April 2010 issue of Elektor as part of the description of the Bluetooth expan- sion of the Analyser NG [4], and is available for download at [5]. The ‘OBD-DIAG’ pro- gram is also compatible with both inter- faces. One interesting possibility would be to transfer the OBD data to a smartphone over Bluetooth. This would require suitable (and yet-to-be- developed) diagnostics software running on the smartphone; however, the authors would be keen to assist any enthusiastic software developers with ambitions in this direction. (100872) Internet Links [1] www.dxm.obd-diag.net (DXM module) [2] www.elektor.co m/ 09045 1 (OBD-II Analyser NC) [3] www.elektor.com/080948 (Bluetooth with the ATM1 8) [4] www.elektor.com/09091 8 (Bluetooth expansion for the OBD-II Analyser NG) [5] www.elektor.com/ 100872 (wireless OBD-II project pages) [6] www.obd-diag.de (ISP STM/NXP device programmer) [7] www.elektor.com/080804 (OBD-II simulator) [8] www.er-forum.de/odb-diag-dl (OBD-DIAG software) Figure 8. A strip of paper placed between board and module makes it easier to desolder it later. Figure 9. When fitting the DXM module only solder the indicated pins. Figure 1 0. The pins to be soldered are marked here. None of the other pins is needed. Elektor Products & Services • OBD-II Bluetooth interface, complete kit of parts including order code 100872-71 enclosure and printed circuit board with SMDs ready-fitted: • ZigBee USB stick, suitable for use with OBD-II ZigBee interface, order code 100872-72 ready to use: order code 100872-91 • OBD-II ZigBee interface, complete kit of parts including • Items accessible through www.elektor.com/100872 enclosure and printed circuit board with SMDs ready-fitted: elektor 04-2011 35 Asteroids & E-Blocks dsPIC - the final frontier for microcontrollers \ ' * By Jonathan Woodrow (UK) You may have noticed that microcontroller manufacturers are bringing out new ranges of devices with 16 and even 32 bit cores. In this article we look at the 16- bit dsPIC chip from Microchip and give you an example of how you can create something that is a bit of fun with such a new device: the classic ‘Asteroids’ game. * f You wouldn’t know the difference just by looking at them: they look just like those 1 6-series chips we’ve been using for a couple of decades now. But inside, dsPICs are very different. Microchip have taken the micro- controller to the next level. Let’s look at how. Architecture: the dsPIC chips belong in the 1 6-bit family of microcontrollers which includes the dsPIC devices and the PIC24 series of devices. The key element here is that the processor is 16 bits wide rather than the more traditional eight bits. This, other architectural features, and a single exe- cution cycle, have lots of implications for program- ming and performance: no more bank swapping, handling larger numbers and calculations is easier, address- ing larger chunks of memory is easier, and your program goes faster. Power: reflecting the general trend to lower the power consumption of electronic devices these chips operate at supply volt- ages as low as 1 .8 V although the one we used is operating at 3.3 V. Lower power means smaller transistors on the silicon, which means that you can cram more cir- cuitry (up to 51 2 l< Flash memory and up to 1 28 l< RAM) on a given silicon chip. Comms and internal peripherals: with effectively more silicon to play with Micro- chip have included more internal comms peripherals on the chips: custom l 2 C and SPI blocks, (up to three of each!), up to four USARTs, USB and others. Specialised func- tion blocks rather than a single USART you adapt to a particular use means that pro- gramming in is easier and the comms can go faster. The internal motor controls are also impressive with bags of features. Analogue capability: these chips have com- parators and ADCs by the bucket load. On some dsPIC33s you can select 1 0 or 1 2-bit ADC operation and the 10-bit ADC samples at 1 MHZ. That’s fast for a microcontroller and speech processing is surely possible with these little beauties. Cost: It is hard to do a direct comparison as there are so many differences between the 8-bit and 1 6-bit variants. A quick search shows that the 28-pin dsPIC33FJ128GP202 we’re using in a DIL package costs less than £3 (around € 4.70) from Farnell. That is actually less than a 40-pin, 8-bit PIC1 6F877. Wow — all that speed! It’s not just that they clock faster, but it seems like Microchip have done everything they can to improve the speed of all parts of the device. How much faster depends on the appli- cation you are using. But if you want to do a floating point calculation consider this: 8-bit PICs clocks at, say, 20 MHz and perform at around at 5 MIPS. The daddy of the dsPICs — thedsPIC33 core — clocks at 80 MHz and per- forms at around 40 MIPS. Eight times as fast. But as the bit width of the dsPIC33 is twice as wide it performs floating point at least four times as fast as the 8-bit core. So even with- out invoking specialist hardware accumula- tors in the device, a quick calculation shows that the dsPIC performs at least 32 times as fast as their like 8-bit cousins where floating point numbers are concerned. Play Asteroids on a single chip Elektor Products & Services • E-Blocks dsPIC bundle: # EB655SI4 • E-Blocks graphic colour display: #EBo58 • E-blocks keypad: # EB014 • Flowcode for dsPIC/PIC24: # TEDSSI4 • Flowcode program file: 100955-11.zip • Hyperlinks in article All items accessible through www.elektor.com/ 1 00955 36 04-2011 elektor MICROPROCESSORS Figure 1 . Flowcode for dsPIC & PIC24 showing mathematics functions. So what? So what do we do with this new 8 litre V6 hot rod of a chip? Well, to start with it is not that obvious. When you discuss this with Microchip, they talk about motor speed control with on-the-fly calculated feedback loops made with MatLab-derived blocksets embedded in the C code, switched mode power supply circuits, speech processing and more. However what struck the devel- opment teams at Matrix Multimedia and Elektor was the ability of the mathemati- cal engine inside these devices for devel- oping applications with the new genera- tion of graphical displays. Manipulation of graphical displays requires relatively large amounts of memory and a capability of transferring that memory from a micro- controller to a display in super quick time. As well as this, the chip needs to run the main program and yet still have enough oomph left to do the number crunching on the graphical data itself. With the dsPIC33 we have all this; So, single chip computer games based on graphical displays have to be the way forward — our target had to be to recreate the vintage computer game ‘Asteroids’ on a single chip. Wanted: Compiler One of the difficulties you face when start- ing with a new series of devices is that you don’t have a suitable compiler or assembler. Never fear: there is a new version of Flow- code that has just become available that is compatible with the dsPIC and PIC24 fami- lies of 16-bit microcontrollers (Figure 1). This has the same user interface as other Flowcode programs and existing programs should transfer across to this new version easily enough. There is one major difference with this new version: Flowcode for dsPIC/PIC24 has a full mathematics library including all trigono- metric functions and full floating point processing capability. Flowcode for dsPIC/ PIC24 supports more than 200 types of chips in the 1 6-bit family, also has direct support for various Microchip develop- ment hardware boards and allows direct support with In Circuit Debug with the new E-blocks dsPIC/PIC24 E-blocks Multi- programmer board. Hardware configuration Our design is based on a dsPIC33fj 128 which can easily be fitted onto the board that comes with the Flowcode for dsPIC bun- dle. This device has 1 28 l< ROM, 1 6 l< RAM and runs at around 40 million instructions per second (MIPS). It is shipped in a stand- ard 28-pin DIL package. To get the design up and running we are using the new E-blocks dsPIC Multiprogrammer which is compatible with the dsPIC and the PIC24 family of chips. To the Multiprogrammer we have connected a keypad and a 1 28 x 1 28- pixel colour graphical display. You can see Figure 2. The E-blocks hardware set up. elektor 04-2011 37 MICROPROCESSORS Figure 3. Speeding up the graphics by managing sequential differences. the overall configuration in Figure 2. The dsPIC33 family runs at 3.3 V to save power. By contrast the colour graphical display operates off 1 4 V, which is required to run the powerful backlight. Software description The software of course is the tricky bit. There are several problem areas: managing the graphics data, sending the data to the display, calculating the graphics data to dis- play, tracking the objects in the game and their status, the user interface and the game play itself. Managing the graphics data is the major task and the Flowcode program revolves around this. The key problem here is that you can not manipulate the data and dis- play it at the same time or it will flicker To solve this, we reserved two blocks of 128 by 1 28 pixels for display memory with one bit per pixel — around 2 l< in RAM per block. We developed a two phase program which allowed us to manipulate the contents of one memory block according to the game play, whilst the other block is being trans- ferred to the display using the SPI protocol and the on-board SPI interface in the dsPIC chip. We found that around 20 frames per second was sufficient for this game (we could have made it go quicker). We also sped up the system by only changing the pixels in the display that had changed from the last time the display was sent. You can see this in Figure 3. When writing different letters to the screen, the whole block can be written again, or you can monitor which pixels go from black to white, and white to black and you can just process these. Because we now have software-level access to the pixel data, we can perform tricks with the pixels. One trick we use, is to make the asteroids and other objects appear to ‘wrap’ around the screen. Instead of clipping and discarding pixels outside the playing area, ‘wrapping’ those pixels so they appear at the far side of the screen. This saves having to draw objects poten- tially four times in all separate corners of the game grid. Those of you who are concentrating will notice that there is a colour border and scor- ing text (see Figure 4). The potential down- side of this graphics technique is that we only have one colour. To get round this, we restrict the game to only the inside parts of the display and we ’window dress’ the main game area with colour borders and text in full colour. Most of the routines for the dis- play are embedded in Flowcode: the only exception were two routines we developed in C code to perform the double buffering, as this is a specialist and custom feature that is tweaked to the requirements of the game (wrapping the pixels is one example). The in-game objects themselves are fairly simple graphical constructions: the space- ship is a three vertex object with a central position and vertices calculated by trigo- nometry. Each asteroid has up to five ver- tices. As they move across the screen they rotate. The positions of their vertices are represented in the chip by floating point co-ordinates whose values are all calculated by trigonometric calculations each frame. With up to seven asteroids in the frame, fly- Figure 4. Some screen images from the final Asteroids game 38 04-2011 elektor MICROPROCESSORS ing rockets from the space ship and explod- ing asteroids, the number of floating point trigonometric calculations per frame needs to be between 1 00 and 200. We also made certain sections of the code quicker with a few other tricks: for example on collision detection. We assumed that all objects on the game were circular as detect- ing collisions on circles is much faster than on other objects. The section on the panel shows how this is done and gives a nice example of how the maths library can help in writing a program like this. One issue is that the best apparatus to-hand for controlling the ship is the keypad. How- ever this works on a matrix of 4x3 bits, so it is possible to find if a single key has been pressed, but not if multiple keys have been held. This is a drawback as you might want to fire missiles and move at the same time. We worked around this by treating each 3-element row as a single key, therefore splitting the keypad into four independent rows. Each row can then be tested to see if any key is pressed or held, allowing the player to hold down the keys, improving the game no end. So 1 , 2, 3 rotate the ship left, 4, 5, 6 accelerate the ship, 7, 8, 9 fire the missiles, #, 0, * rotate the ship right. The game play is based on several arrays which track the positions of the relative objects in the game and simple algorithms to dictate their motion. There is also a sim- ple scoring and level mechanism. Clever collision detection calculations If two circles (radius rO and rl ) touch, they form a larger circle whose radius is (rO + rl ). The distance from the centre of one circle to the centre of the other is: r = sqrt((x1 - xO) 2 + (yl - yO) 2 ) Therefore if this is less than (rO + rl ) then the ob- jects collide: r < (rO + rl) Luckily we can therefore remove the square-root as it is more efficient to calculate the square of (rO + rl ). So to calculate the collision detection we need to do: rsq = (xl - xO) 2 + (yl - yO) 2 result = rsq < (rO + rl) 2 This is only 3 multiplies, and no divides or anything more complex. Conclusion The dsPIC33 we have used is a great little device. We are impressed by the power and the versatility and the trouble Microchip has taken to make this easier to use — and faster! Being able to fit this game into one little chip is quite impressive. We have an urge to do PACMAN next. A YouTube video of this project is available at [ 3 ]. So far no one has beaten the game at level five. Let us know! About this project The program is written in Flowcode for dsPIC. A copy of the Flowcode program can be downloaded this project's web page PI. The hardware consists of the new Flowcode for dsPIC bundle (EB655SI4) to which for this occasion is added the dsPIC33FJ1 28GP202, the optional add-on Graphical Colour Display (EB058) and the Keypad (EB014). Flowcode 4 for dsPIC and is available from the Elektor Shop. (100955) Note: You will have to use Flowcode 4 for dsPIC/PIC24 Professional as it relies on the Graphical LCD component. The Home/Student version does not have this component. Internet Links [1] www.elektor.com/1 00955 [2] www.elektor.com/eblocksoverview [3] www.youtube.com/user/ MatrixMultimediaLtd#p/u/5/ jgsM4mSzbPg [4] www.matrixmultimedia.com elektor 04-2011 39 AUDIO & VIDEO Preamp based on Ibanez TSg Guitar Input By Thijs Beckers (Elektor Labs) In September 2010 we published a digital multi-effects unit. This circuit can only be used with line level signals, such as those used by keyboards and the effects loops of mixing panels. To make that circuit suitable for use with electric guitar signal levels we now present a simple but effective amplifier circuit. The Elektor Digital Multi -Effects Unit pub- lished in the September 2010 edition PI contains a number of nice effects that would not be out of place in conjunction with an electric guitar. Here we publish a preamplifier, which makes the input of that circuit suitable for connecting to an electric guitar. This preamplifier, which in addition to a high-impedance input, also has the option of adding an effect com- monly used with electric guitars, namely distortion. Circuit For this very simple circuit we took inspira- tion from a very popular overdrive-pedal from Ibanez. To be more precise: the TS9 Tube Screamer. You could say that our ‘pre- amplifier’ is a slimmed-down TS9, but still Characteristics • Easy to solder • Powered from a g-V battery or suitable adapter • The character of the sound is easily changed • Bypass-switch option for the distortion • Adjustments for Drive, Tone and Level 40 04-2011 elektor AUDIO & VIDEO Figure 1 . The schematic is based on the TS 9 Tube Screamer from Ibanez. having the same characteristic sound of one of those. The schematic of the circuit can be seen in Figure 1 . The input impedance is mainly determined by R 1 (470 k£l), since the input impedance of an opamp generally amounts to several megohms. Input capacitor Cl ensures that the guitar pickup elements are not subjected to the offset voltage that is generated by R 1 at the non-inverting input of IC 1 A. You don’t have to worry about the corner frequency of the high-pass filter that is formed by R 1 and Cl . This amounts to only 7 Hz. For guitar signals, that value of Cl could easily have been selected to be smaller by a factor of nearly 1 0. IC 1 A operates simultaneously as a buffer and as a ‘drive’ amplifier. Together with anti-parallel connected diodes D 1 and D 2 , IC 1 A determines, to a large degree, the ‘sound’ of the distortion effect (see ‘Mod- ifications’). The gain — i.e. the degree of distortion — is determined by R 2 and the potentiometer connected to JP 3 . The fol- lowing applies: the larger the value of the resistance in the feedback loop of IC 1 A, the higher the distortion. A switch can be added via JP 7 to turn the distortion on and off (just as with a guitar effects pedal). When the switch is closed, the gain-potentiometer is short-circuited and the gain is entirely determined by R 2 alone. By selecting an appropriate value for R 2 , the volume level of the undistorted sound can be matched to the volume of the distorted sound. The optimum value depends a little on the pickup elements that are used in the guitar. It was found that a value of 10 k£l gave the most balanced result. Note: The ‘bypass’-switch only turns off the distortion, not the tone-control sec- tion. It is therefore not a real bypass... Via a simple tone-filter, which mainly influ- ences the higher frequencies, the signal then arrives at the output buffer IC 1 B. The potentiometer for the tone control is connected via JP 4 . For the best feel when adjusting the tone control it would be pref- erable to use an inverse-logarithmic poten- tiometer here. These are, however, difficult to obtain. You could, of course, use a nor- mal logarithmic potentiometer and wire it the other way around, but this will proba- bly feel a little strange, because the highest gain then occurs when turning the potenti- ometer to the left. After the output buffer stage there follows a simple volume control with a potentiom- eter that is connected via JP 5 . A logarithmic potentiometer with a value of 1 00 l<^ will suffice here. The output impedance is quite large, but with a short connection between this out- put and the input of the next stage (the multi-effects unit, for instance) this will not result in any problems. Power supply The circuit has to be powered from a regu- lated voltage of 9 V. If we are using a regu- lated mains adapter with a 9 V output as the power supply for the Digital Multi-Effects Elektor Products & Services • PCB: #100923-1 • PCB artwork (free download): #100923-1. pdf • Demo movie atwww.youtube.com/user/ElektorlM • Elektor Digital Multi-Effects Unit: September 2010 (www.elektor.com/090835) elektor 04-2011 4 i AUDIO & VIDEO COMPONENT LIST Resistors R1 =470kft R2,R5,R9,R10 = 10I<£1 R3 = 4.7kn R4,R7,R8 = 1kft R6 = 220a Capacitors Cl ,C4 = 47nF C2 = 56pF C3,C5 = 330nF C6,C7 = 1 jllF C 8 = 47jiF 1 6V Semiconductors D1,D2 = e.g. 1 N4148* IC1 = e.g. OPA2134* Miscellaneous JP1 JP2 ,JP3 JP6JP7 = 2-pin pinheader, lead pitch 0.1 in. (2.54mm) JP4JP5 = 3-pin pinheader, lead pitch 0.1 in. (2.54mm) 8-pin 1C socket for opamp* 2 pcs 2-pin socket for diodes* 2-pin socket for connecting drive pots Figure 2. The circuit board is single-sided and designed to be very compact. 2 pcs 3-pin header for connecting tone and level pots Potentiometers: 500l<£2 logarithmic (drive), 20k£2anti logarithmic (tone)*, 100l<£2 loga- rithmic (level) Wires for potentiometers PCB# 100923-1, see [2] * please refer to text Unit, then all three boards (this preamp and the user interface and main boards of the Multi -Effects Unit) can all be powered from the one power supply. The power con- sumption is very minimal, so practically any standard adapter will suffice. In the circuit of the preamp, R9 and R1 0 are used to generate a symmetrical power sup- ply voltage, where ground is replaced by V cc /2. The signal from the guitar is offset by V cc /2, after which it passes through the circuit. Before the signal reaches the output of the circuit this offset is removed again by C7, so that any of the following stages, such as the input of the multi-effects unit, will not be damaged. Modifications Every guitarist has his or her own preference as far as the sound goes. You are therefore welcome to experiment to your heart’s con- tent with the sound of this preamp. R3 and C4 act as a high-pass filter, so that lower fre- quencies are overdriven less by the diodes. With the component values as indicated, the corner frequency of this filter is about 720 Hz. By taking a larger value for C4, the gain at lower frequencies is increased. A smaller value results in a thinner sound. Incidentally, a smaller value for R3 results in more drive. The diodes have by far the greatest influ- ence on the sound. In our prototype we used two standard 1 N4148 diodes, which generate a very pleasant sound. A 1 N4007 results in a somewhat ‘hulking’ sound, while germanium diodes, such as the 1 N34, provide a softer sound. The 1 N91 4 is also a good candidate. Combinations of diodes are also possible, for example a 1 N41 48 connected in anti-parallel with two germa- nium diodes connected in series. Each of these results in a sound that is slightly dif- ferent, which may appeal to one person but perhaps not another. So we strongly recom- mend that you experiment. It is therefore a good idea not to mount the diodes directly onto the circuit board, but to fit a couple of sockets instead. In this way it is very easy to try out different diode combinations by simply plugging them in. The type of opamp used has a lesser effect. But the differences are definitely audible and can make the difference between a sound that is just right or one that is just not right. Our preference is the OPA21 34, which gives a somewhat ‘smoother’ sound than, for example, a TL072, which sounds a lot coarser. Other opamps which are also used by guitarists in Ibanez TS-9 pedals are, among others, the LM358, the LM833, the LT1 1 24, the OP227 and the JRC4558D. Each of these bestows its own effect on the sound and it is only possible to pick the ‘best’ one by simply trying them all. Finally it is also possible to experiment with the tone control. R4 and C3 form a high- pass filter (with the component values as indicated, the corner frequency is at about 480 Hz). By varying C3 between 100 nF (more treble) and 470 nF (more bass) there is yet another opportunity to polish the sound some more. With C5 and R6 and the potentiometer the sound can be fine-tuned externally. With C5 the same is true as for C3: 1 00 nF gives more treble; 470 nF gives more bass. Construction The assembly of this simple circuit is rela- tively easy since only standard, leaded com- ponents are used. The component overlay is printed in Figure 2. As always, begin with the low profile components such as resis- tors and fit the taller components such as capacitors last. This generally makes assem- bly the most straightforward. A small piece of soft foam can be pressed against the PCB to help the components stay in place when the board is turned upside down to solder the leads. To make it easy to try several different opa- mps it is a good idea to use an 1C socket for this. You can then simply plug in the opamp of your choice and it is also very easy to swap it for another type. The same is true for the diodes, but you will perhaps have to improvise a little here; you could cut two sockets from a female header/connector and plug the diodes into these. The potentiometers are connected to the board with headers. This is mainly done to keep the printed circuit board as small as possible, but this way also allows them to be mounted on a front panel in whatever way you like best. It is recommended that you use a mono jack for the bypass switch. You can then easily connect a simple foot switch from the music store. The printed circuit board layout can be downloaded from the Elektor website I 2 !, as well as the Eagle PCB design files (Eagle version 5.6). (100923-I) Internet Links [1] www.elektor.nl/090835 [2] www.elektor.nl/100923 [3] www.youtube.com/user/ElektorlM 42 04-2011 elektor Here comes the bus! (4) by Jens Nickel (Elektor Germany Editorial) Our bus doesn’t stop for anyone! Even after the copy deadline for the previous edition we received many new e-mails from interested readers. Many thanks for these: I have tried to comment on all of your ideas, which have sometimes turned into mini-discussions. It is a pity that readers were not aware of the most recent developments in the design of the bus: producing a magazine takes a little time and there is inevitably a delay between the writing of an article and its appearance in print. Many of the e-mails contained valuable thoughts and ideas, and so we decided to institute a mailing list for interested readers. I wanted to be able to share feedback on this fourth article in the series ‘live’ with other developers, and members of the list can also add their comments immediately. A core group of readers took up the idea of working together on an Elektor project in a new way like this rather, shall we say, enthusiastically. After the initial invitation ideas for the ElektorBus protocol started to flood in to my inbox: seven e-mails on the first day, thirty-odd on the next, all full of suggestions and advice as well as more fully worked- out ideas. And when I tell you that even experts in the field such as John Dammeyerwere chiming in (he was one of the people behind the biggest CAN bus installation in the world, controlling the illumination of the Olympic rings at the winter games in Vancouver), you will see that we were really getting down to business! It was clear that some seasoned engineers had already started work on getting the test node circuit we gave in the last issue up and running on the bench. Elektor author and professional engineer Gunter Gerold suggested a capacitor in parallel with the reset button: consider it done. And surely the 7805 regulator was last seen in the stone age? We received many e-mails suggesting alternatives for this and for other components. There is no shortage of microcontrollers, perhaps only a little dearer than the Atmega88, but featuring useful built-in bus interface peripherals: CAN transceivers are mentioned especially frequently. Several substitutes were also suggested for the LT1 785. 1 would like to stress again, however, that the test node circuit is not intended as a ‘reference implementation’. A bus node can be made using completely different components, and we want to avoid a dependence on special-purpose devices. Several readers alerted us to the fact that although connecting the RE and DE pins on the LT1785 together is a practical approach to achieving half-duplex operation, it is not the most flexible. If DE is taken high and RE low, the microcontroller can read back its own transmissions. This can be useful in detecting bus collisions. John sent us a (to me) highly novel variation on the RS-485 transceiver circuit using just two pins on the microcontroller: see the small circuit diagram. This idea seemed so useful that I decided to modify the circuit of our first test node as shown in the figure. All the relevant transceiver pins are now connected to pins on the microcontroller, and we can test the different variants of the circuit simply by changing the software. Many of the ideas are certainly worth looking at in the longer term. The internet was a recurring topic: an internet connection for the bus is certainly right at the top of our wishlist. John, along with Elektor reader Eric Huiban from France, suggested modularising the hardware: make a small ElektorBus printed circuit board with processor, crystal, RS-485 driver and one or two LEDs, and then, just as with the Ethernet modules we often use in Elektor projects, use this to equip other devices with ElektorBus functionality. Such a module could be replaced by a wireless version at a later date. An excellent idea, and one we will surely return to later in this series. Another popular point of discussion revolved around how to connect a PC to the bus. Writing Windows applications that can be controlled by external events is not always straightforward. Elektor author Walter Trojan suggested that it should be possible to make a USB gateway with its own microcontroller to replace the USB-to-RS-485 converter. This would help decouple the PC from the microcontroller-based bus. We soon came to the conclusion that using a PC as a bus master was at best an interim solution, even given that frameworks such as .NET directly support (virtual) COM ports [1 ]. Our goal should always be to create a bus architecture that can run independently of a PC, with central control coming from a more humble microprocessor. The small team had big plans when it came to the question of the maximum permitted number of bus nodes. Elektor reader Bertrand Duvivier, a product manager at Cisco, proposed a hierarchical bus topology. Since RS-485 was designed for a maximum of somewhere between 32 and 256 bus participants elektor 04-2011 43 E-LABs INSIDE E-LABs INSIDE (and in a home automation application we could easily exceed even the greater of those numbers), Bertrand felt that it would be necessary to divide the bus into segments. The various segments would then be joined using a kind of router or controller, which would orchestrate the flow of messages between segments. A node address would then be divided into a segment identifier and an identifier of the node within the segment, much as IP addresses are divided. However, as we have said before, we want our bus to be as simple as possible so that understanding the hardware and software can easily be within the grasp even of beginners. However, it was becoming clear to me that we would have to allow for the possibility of joining bus segments at some point, and in our protocol (see below) we have expressly provided for addresses divided into two parts. Finally: the protocol. Let us start with the question of how a bus node can detect when a message starts. Gunter’s idea was that the transmitter could force an artificial UART framing error. I wasn’t keen on this, since it would create a dependency between the higher protocol layers in the stack and the lower physical layer (RS-485 and UART). My preference was to use a more traditional ‘start byte’: but what value to use? 0X02 or 0x03? Perhaps 0x7E? I felt that Obi 01 01 01 0 would be best, since that would also allow for synchronisation. (A similar idea is used in Ethernet, where the bits are written ‘backwards’, the start byte thus appearing as 0x55.) In his first e-mail Bertrand had put forward the possibility of using message packets of a fixed length, and even though almost all other protocols use a variable payload size, the idea did have some appeal. Indeed, for our round-robin mode, where the nodes transmit in turn, it seemed ideal. It also makes synchronisation easy: every so many bytes on the bus we must see the value OxAA. After our small commun ity had exchanged a few links, such as [1 ] and [2], and a few more suggestions for simple protocols, I made my proposal for a protocol with a fixed message length. We would need about eight bytes for the header (start byte, addresses, error detection and so on) and so it seemed that a total length of 1 6 bytes would be ideal. Eight payload bytes would be plenty for most applications and the overall structure had a pleasing symmetry. Some of the ideas that were bandied about concerned the use of different function control bytes and the possibilities of handshake between master and slave, but these (highly valuable) discussions became so voluminous and in places so application specific, that it was necessary to defer looking further into the ideas until a later date. As in the OSI model, the second layer of our protocol is concerned with getting the data packets to the right receiver without damage, and, if necessary, reassembling them in the right order. Thus any message longer than eight bytes will have to be fragmented. There then followed several e-mails discussing the number of bits that should be used to form an address. Four bytes (allocated between transmitter and receiver addresses) at first D1 44 04-2011 elektor BYTE 0 1 2 3 4 5 6 7 8 9 A B C D E F BIT 7 6 MODE 00 BIT MODE 12 BIT MODE A8 5 4 3 2 1 0 10 10 10 10 00000000 ADDRESS RECEIVER ADDRESS SENDER DATA - 00 hex > HD 110012 -13A BYTE 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 10 10 10 0 0 0 1 0 0 1 0 SEGMENT RECEIVER NODE RECEIVER SEGMENT SENDER NODE SENDER FRAGMENT NUMBER DATA - 12hex L 110012- 13B BYTE 0 1 2 3 4 5 6 7 8 9 A B C D E F 7 6 5 4 3 2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Cl 0 0 0 DATA - A8hex 110012 -13C seemed far too many: would we ever want to have as many as 65,536 participants on a bus? For error detection we decided to use a CRC (a full description of which would be an article in itself, but you can read all about it on the internet [4], [5]). Two bytes would be enough for that. But perhaps there are applications, such as transmitting audio, where error detection is not so important? Also, in point-to- point connections, for example, we would not make use of the full range of addresses, and in any case the transmitter address would often not be necessary. All these are potential overheads in the protocol that we would like to reduce. On the other hand, we would like to keep open the option of splitting an address into a segment identifier and a node identifier (see above). And finally, I wanted to keep the option of numbering the fragments of a message from 0 to 255. If the transmitter numbers the fragments counting downwards to zero, the receiver will know how many more packets to expect until the message is complete. So we would have configurable addressing, whereby more or fewer bytes can be used for addresses depending on whether it is needed to specify both transmitter address and receiver address or just the receiver address, and on whether grouping into segments is required, with optional fragment numbering and optional two-byte CRC error detection. These various options are flagged using bits of a single byte, called the ‘mode byte’, sent immediately after the start byte (see text box). Et, ladies and gentlemen, voila, the Elektor Message Protocol (EMP)! When John the CAN expert saw my proposal, he could not resist a chuckle: ‘just like CAN’, he wrote. ‘If you had restricted the addresses to just 1 2 bits each, you would practically have reinvented it.’ Quickly I looked up the details of CAN on the computer. I had to admit that we was to some extent right: CAN also uses a payload length of eight bytes (although this is a maximum, rather than a minimum as in our case). The flexible allocation of bits to identifiers and addresses, and of course the CRC, were also a little reminiscent of CAN. However, I couldn’t help feeling that coming from a CAN-fan like John, I should perhaps take his words as something of a compliment... (110012) Internet Links [1 ] http://msdn.microsoft.com/library/ system. io. ports. serialport.aspx [2] http://en.wikipedia.org/wiki/Modbus [3] www.vscp.org/wiki/doku. php?id=vscp_specification_-_vscpJevel_i_over_rs-485 [4] http://en.wikipedia.org/wiki/Cyclic_redundancy_check [5] www.lammertbies.nl/comm/info/crc-calculation.html ElektorMessageProtocol: mode byte no ID bytes, data from byte 2 ID bytes from byte 2 bytes 2 and 3 are ID bytes bytes 2 to 5 are ID bytes no CRC bytes Eand Fform a 1 6-bit CRC last ID byte is all ID bytes are used for a fragment number addressing next fragment follows no fragment follows immediately immediately address bits address bits for both 2 . for receiver only transmitter and receiver top six address bits give 1 , no segment address bus segment reserved: may be used as a flag indicating a high-priority message If bit 3 of the mode byte is set fragments can follow one another immediately in sequence (think of the carriages of a train), giv- ing the same effect as a larger packet size. elektor 04-2011 45 A quick temperature measurement... By Thijs Beckers (Elektor Netherlands Editorial) m □O “Know what you measure” is obviously derived from the phrase “know what you eat”, but that doesn’t make it less true. During our IR thermometer test published this month, this was con- firmed once again. Our plan was to test a number of reason- ably affordable IR thermometers. A list of potential candidates was made and the suppliers are approached with the question whether they would be prepared to make a device available. Now Elektor is not the Consumer Federation, so it does some- times take a considerable amount of persuasion to convince suppliers, who are not operating in the electronics sector, to send us an instrument, but anyway: in front of us there are 1 5+ IR thermometers in all shapes and sizes. Now it starts for real. What would we like to know about these thermometers and how can we test them? And we need a reference thermome- ter of course, to compare the measurements. Fortunately, the people at Fluke were generous enough to send us a model 572. With specifications such as an measuring angle of 60:1 , a triple laser and a calibrated accuracy of 1 % to 900 °C this thermom- eter is eminently suitable as a reference. With these thermom- eters we especially would like to know how accurate they are at measuring the temperature. Another important aspect is the measuring angle or size of the surface area that is measured. Measuring the temperature accuracy is not a major problem. Take a surface at a certain temperature, measure it with the different IR thermometers and the reference thermometer, and compare the results. A simple cooking element was perfectly suitable for generating some higher temperatures. In addition, we checked the laser indication. Why do that, you think? With a number of the thermometers there was already a clearly visible deviation of the laser(s) compared to the ‘cen- tre-line’ of the instrument, where you would have expected the measurement to take place. Further measurements (unfortu- nately) confirmed this (refer to the test report article elsewhere in this issue). The so-called accuracy of the built-in laser beam is therefore sometimes deceptive, in reality you are measuring something else instead of what the red laser dot is pointing to. Incidentally, the measuring itself is also a subject on itself. It can be quite hard to estimate what the exact surface as that you are measuring, despite for, example, the double laser indication that three of the instruments have built in. In any case, the thermometers need a certain minimal surface area to be able to measure properly. This surface is too large to measure the temperature of ‘normal’ chips, which is a little disap- pointing for us as electronics engineers. With those thermome- ters that have a very small measuring angle, you would think that you could measure very close up for a very small surface area. This is not the case however — over the first 1 0 to 1 5 cm these instruments have a kind of ‘measuring bundle’, which has a cer- tain minimum dimension. Incidentally, with the Fluke 572 this is clearly indicated in the documentation (see Figure 1 ). Other instruments don’t make any mention of this at all. These assume a complete cone-shape from the front of the instrument, the cor- rectness of which we have our doubts. But it is also very difficult to check. Our advice when using an IR-thermometer is to always measure as close as is possible, but nevertheless always assume a measuring spot of at least 1 to 2 cm diameter. Since we were also warned from several quarters that there are large deviations when measuring reflecting objects we put that to the test by taking a small, black anodised aluminium heatsink and file down one side of it so that the bare aluminium became visible. This heatsink when subsequently heated to a practical value of about 65 °C, a temperature that this type of heatsink can easily reach when mounted on a circuit board in a small enclosure. Now using the Fluke 572 and one of the other ther- mometers with a small measuring angle of 30:1 , we measured at a close distance first the black side and then the bare side. The difference was enormous with 65 °C on the black side and 40 °C on the bare side. If you then take into consideration that the ambient temperature is about 20 °C, then the difference between the two sides, caused by the so-called coefficient of emissivity, is more than 50%. The maxim ‘Know what you meas- ure’ is certainly appropriate! It even should be: ‘Know what you measure and how you measure’. (110140-I) 46 04-2011 elektor PUlSONI* n 1 1; mr 'Hawvwivtrii THE ORIGINAL SINCE 1994 PCB-Pnni Servicing Your complete PCB prototype needs. 8 hour prototype service 1 mm moterial now available Free Laser SMT Stencil with all PCB prototype cD-pooi.com Supported File Formats R1H4X WfcliTj Email: sales@pcb-pool.com Free Phone UK: 0800 389 8500 REFL0W-K1I I Now available; Tools and accessories for prototype PCB assembly W A. * 1 i reflow S I « ' I -.<■ ... <***«** ■ ESDBE D «mt- $ dsPIC/PIC24-Bundle Advantageous hardware/software solution for rapid project development This solution is perfect for anyone wanting to develop systems based around Microchip’s powerful 16 bit core products. The pack is supplied with a dsPIC30F2011 device, and is fully compatible with the full range of E-block boards and accessories. Datasheets on each individual item are available separately. Contents: • Flowcode 4 for dsPIC/PIC24 (Professional Version) • USB dsPIC/PIC24 Microcontroller Multiprogrammer • LCD Board • LED Board H • Switch Board • Plug top power supply • USB cable Bundle Price: Only £299.00 Order now at www.elektor.com/dspic-bundle 15 % DISCOUNT to the sum of the individual parts! elektor 04-2011 47 TEST & MEASUREMENT 3 GHz Frequency and Signal Level Meter Built around a CPLD and a dsPIC microcontroller This handy instrument measures frequencies from 50 MHz to 3 GHz with an accuracy of 10 ppm and provides an indication of the signal level over a range of -40 dBm to +10 dBm. Readings are displayed on a three-line LCD module, and the instrument is powered by three standard AA cells. By Martin Bachmann and Daniel Schar (Switzerland) A convenient battery-powered instrument is very practical for quickly measuring the fre- quency and level of HF signals. The instru- ment described here also features very high accuracy for frequency measurement. It has a 50-£2 HF input with a female SMA connector, suitable for connection to a cable or directly to an antenna. Of course, if you connect an antenna to the instrument you need to ensure that the level of the signal you wish to meas- ure is sufficiently high relative to other signals that are also picked up by the antenna. Basic architecture The block diagram in Figure 1 shows the general layout of the meter, with the HF portion and the digital portion distin- guished from each other by different shad- ing. The input signal is fed via a passive (resis- tive) splitter to the input stages of the two branches of the HF circuit: one for frequency measurement and the other for signal level measurement. The signal level measurement circuit essentially consists of a logarithmic Features • Frequency measuring range: 10 MHz to 3 GHz • Frequency measurement error less than 10 ppm (0.001%) • Signal level measuring range: -40 dBm to +10 dBm (0.1 pW to 10 mW into 50 £ 1 ) over the range of 300 MHz to 2.8 GHz • 146 readings per minute • Power source: three 1.5 V AA cells or a 5 V AC mains adapter (min. 180 mA) • Maximum current consumption at 5 V input: 170 mA • Battery life with three 2000 mAh NiMH cells: 18 hours continuous operation without LCD backlighting or 11 hours with backlighting 48 04-2011 elektor TEST & MEASUREMENT 0 Figure 1 . Block diagram of the frequency and signal level meter, with the HF portion shaded blue and the digital portion shaded green. detector 1C made by Linear Technology. Frequency measurement requires a more complex circuit. It basically consists of a fre- quency counter implemented in an Altera CPLD, along with a frequency divider and a reference oscillator. Signal processing, con- trol and display functions are provided by a Microchip dsPIC microcontroller. Signal level measurement An LT5538 logarithmic signal detector 1C [1 ] from Linear Technologies is used to meas- ure the signal level. Along with a frequency range of 50 MHz to 3 GHz, the selection cri- teria for this device were a dynamic range of at least 50 dB, an input sensitivity of -46 dBm, operation over the industrial tem- perature range of -40 to +85 °C, operation from a 3.3-V supply voltage, and the low- est possible price. Only three ICs meet the dynamic range requirements: the ADL551 3, the LT5534 and the LT5538. We chose the LT5538 because it has the largest dynamic range of the three (75 dB). This 1C detects the power of the HF signal and outputs a voltage proportional to the power. This voltage is fed to an A/D con- verter in the microcontroller, and the dig- itised value is further processed by the microcontroller. Unfortunately, the signal level output volt- age from the LT5538 is highly frequency dependent. Forthis reason, we implemented a digital correction function using polyno- mial approximation. The signal level meas- urement function can be calibrated using a routine in the microcontroller firmware that is accessed from the display menu. Frequency measurement Frequency measurement is essentially based on a counting method implemented in the Altera Max-2 CPLD [2]. During the measurement cycle, one counter counts zero crossings of the signal being measured, while another counter counts zero crossings of the signal from the reference oscillator. The frequency can then be calculated from the counts accumulated by the two coun- ters by using the formula: frequency = (reference frequency) □ (signal count) □ (reference count) Figure 2. Timing diagram of the synchronisation logic in the CPLD. Frequency measurement using two counters starts and stops when the reference signal and the input signal both have rising edges at the same time. Elektor Products & Services • PCB: # 100760-1 • PCB layout files (free PDF download): # 100760 - 1 .zip • CPLD and dsPIC software (including source code): free download file # 100760 - 11 .zip • Items accessible through www.elekt 0 r.c 0 m /100760 elektor 04-2011 49 TEST & MEASUREMENT DB Figure 3. In the actual circuit, the HF portion on the left and the digital portion on the right Synchronisation logic is programmed in the CPLD to increase the accuracy of frequency measurements. This logic ensures that the two counters used for frequency measure- ment are both started and stopped when the reference signal and the signal being measured have rising edges at the same time (see Figure 2). The counts accumu- lated by the two counters are sent to the microcontroller over an SPI bus. The CPLD can process input signals up to approximately 200 MHz. A frequency divider is required to allow higher frequen- cies to be measured. Naturally, the division factor (in this case 32) is included in the calculation of the frequency. An LMX2485E PLL 1C [3] from Linear Technologies is used here as the frequency divider. Only the inte- 50 04-2011 elektor TEST & MEASUREMENT DB are independent functional units with separate supply voltages. grated frequency divider of this 1C is actu- ally used; the PLL function is not utilised. The advantage of this seemingly wasteful approach is that PLL ICs are manufactured in very large volumes and are therefore cheaper than pure HF divider ICs. The internal settings of the PLL 1C (includ- ing the division factor) must be configured every time the instrument is powered up. We were able to implement this directly in the CPLD, so the microcontroller is not needed for this function. This allows the frequency measurement portion of the circuit to operate as an independent, self- contained module that simply outputs data from its SPI port and can easily be used for other applications. To improve the input sensitivity of the instru- elektor 04-2011 5 i TEST & MEASUREMENT COMPONENT LIST Resistors (SMD0603) R101 = 56£l R1 04 = 4.99kft R1 05,R229,R231 =0^ R200 = 1 0kn R201 ,R303,R308 = AlkCl R202.R21 1 ,R226 = 33k£2 R203,R21 0,R301 ,R302 = 100kn R220,R221,R222 = 15kft R225 = 1 50k a R230,R235 = 1 1<£1 R232,R293 = not fitted R236 = 18kn R250,R25 = 39£} R290.R291 ,R292 = 4.7l<£2 R304,R305,R306,R307,R404 = not fitted R401 ,R402,R403,R405 = 1 SQ R406 = 82£1 Capacitors (SMD0603) Cl 01 ,C226,C230,C231 ,C232,C301 ,C302 ,C303 = lOOnF Cl 02, Cl 1 0,C403,C41 5 = 1 0OpF Cl 04, Cl 05,C233,C401 ,C402,C404,C41 3.C41 6,C41 8.C41 9,C422,C423,C425 = 1 nF Cl 06, Cl 09 = not fitted 007,008 = 1 pF C200.C201 ,C21 0 = 2pF C202.C21 1 ,C251 ,C252 = 1 pF C240,C241 = 1 8pF C250 = 470nF Inductors (SMD0603) L101 = 1.5nH L401 = 4.2 jllH Semiconductors D200,D201 ,D202,D205,D225,D226,D227 ,D228 = NSR1 020 (SOD323-W) D204,D235 = 3.3V zener diode (S0D1 23) D206 = 5.6V zener diode (S0D1 23) IC101 = LT5538 IC200.IC21 0 = MCP1 824 (SOT23-5L) IC230 = DSPIC33FJ32GP204-I/PT (TQFP44), programmed IC301 = EPM240T100C3N (TQFP100), CPLD (Altera) IC401 = LMX2485E (LLP24), PLL (National Semiconductor) IC402 = ABA-31 563 (SOT363), wideband am- plifier (Avago) Q250 = BSS1 23 or SN7002W (SOT23) VR230 = TL431 (SOT23-5), voltage reference (Tl) Miscellaneous IC250 = EA D0GM1 63W-A, 3.3V-LC-Display, 3x1 6 characters (Electronic Assembly) JP001 = DC adaptor socket, PCB mount JP100 = SMA socket, 142-0711-881 (Emerson/ Johnson) JP200 = (optional) 2-pin pinheader (battery connection) JP230 = 2-pin pinheader with jumper (if required) JP235 = 5-pin pinheader, right angled JP301 = 6-pin pinheader, right angled JP302 = 6-pin pinheader, 2-row (if required) R205 = self healing fuse 30V/0.2A (SMD1 21 0), Littlefuse 1210L020WR (e.g. Farnell 1596997) S200,S220,S221 ,S222 = pushbutton, 1 make contact, PCB mount X240 = 1 8MHz quartz crystal (HC49/SMD) X301 = CFPT-1 26 (LF TVX0009920) from IQD, temperature compensated 40MHz SMD quartz oscillator (Farnell #1 1 00757) Enclosure: Bopla Type BS404 F-7035 PCB #100760-1 (see www.elekor. com/100760) Figure 4. The PCB layout with exclusively SMD components on the bottom side. Only the buttons and the display module are located on the top side. 52 04-2011 elektor TEST & MEASUREMENT Table 1 . Measurement accuracy Quantity Accuracy Range Frequency <10 ppm (<0.01 %) 50 MHz to 3 GHz -20 dBm to 0 dBm <10 ppm (<0.01 %) 700 MHz to 2700 MHz -35 dBm to +10 dBm < 1000 ppm (< 1 %) 300 MHz to 2700 MHz -40 dBm to +10 dBm Signal level (calibrated) 4.3 dB 50 MHz to 3 GHz -40 dBm to +10 dBm Figure 5. SMD side of the manually assembled Elektor lab prototype board. Figure 6. Top side of the Elektor lab prototype board. ment and compensate for the attenuation of the passive splitter (-6 dB for each leg), a broadband HF amplifier is included ahead of the divider. The Avago ABA-3 1 563 [4] device used for this purpose has 50 Q input and out- put impedances and a frequency bandwidth extending from DC to 3.5 GHz, and it pro- vides approximately 20 dB of gain. The HF amplifier operates in the saturation region in the presence of strong input signals. Accuracy The frequency measurement accuracy essentially depends on the accuracy of the reference signal. The readings cannot be more accurate than the oscillator fre- quency. In addition, the accuracy of the fre- quency measurement depends on the sig- nal level and the frequency being measured. Fundamentally, the accuracy increases with increasing input signal level. Despite signal level calibration, the signal level measurement can never match the accuracy of the frequency measurement (see the section ‘Signal level calibration’). The achievable results are summarised in Table 1 . From tests, we determined that the frequency measurement accuracy of our pro- totype unit was 1 ppm at room temperature. Circuit description The portions of the circuit shown with dif- ferent shading in the block diagram (HF portion and digital portion) were originally built and tested on separate PCBs. In the course of device development, these two portions were merged on a single board. The corresponding full circuit diagram is shown in Figure 3. Here again the HF portion on the left and the digital portion on the right are sepa- rate functional units that can be used inde- pendently of each other. To improve supply decoupling, the two portions of the circuit are powered by separate supply rails and voltage regulators, with IC200 for the dig- ital portion and IC21 0 for the HF portion. Both voltage regulators provide a supply voltage of 3.3 V. The two voltage regula- tors receive their input voltage either from a battery pack connected to JP200 (three AA cells; voltage 3.6 to 4.8 V) or from a 5-V AC mains adapter connected to JP001 . Voltage source selection is automatic: if the voltage on the AC adapter input is higher than the voltage from the battery pack connected to JP200, diode D200 is reverse biased and iso- lates the battery pack. This diode also pro- vides protection against reverse-polarity battery connection. A series diode in the AC adapter input circuit provides similar reverse polarity protection and prevents reverse current flow. A Polyfuse (self-heal- ing thermal fuse) and Zener diode are con- nected after this diode. This combination protects the circuit against excessive volt- age and limits the current in case of a fault. The HF and digital portions are connected only by the four SPI bus lines and the sig- nal detector output line (and of course by a common ground point). The CPLD sends the counts from the frequency measure- ment counters to the dsPIC over the SPI bus, and the dsPIC uses this data to generate the frequency reading shown on the LCD mod- ule and to apply frequency correction to the elektor 04-2011 53 TEST & MEASUREMENT Figure 7. The authors’ prototype device. signal level data. The output voltage from the level detec- tor (IC101) in the HF portion is fed via the DB line to the A/D converter input of the dsPIC, which digitises it with 1 2-bit res- olution and processes the result- ing values with the previously men- tioned frequency-dependent correction to obtain the readings shown on the LCD mod- ule. Diodes D225-D228 limit the voltage on the dsPIC A/D converter input (pin 1 5) to prevent overdriving. The dsPIC monitors the battery voltage on a separate analogue input (pin 1 3); this voltage is reduced to a suitable level by a voltage divider (R225 / R226). The TL431 reference voltage source (VR230) provides a 2.5-V reference voltage for the A/D converter in the dsPIC. The user interface consists of four pushbut- ton switches (S200 and S220-S222) and the three-line LCD module, with the backlight switched via Q250. The LCD module oper- ates from a supply voltage of 3.3 V and fea- tures high contrast with automatic adjust- ment and very low current consumption (just 250 pA without backlighting). In the HF portion, it’s easy to recognise the elements of the block diagram. The signal splitter after the 50-£2 SMA connector con- sists of just three resistors (R401-R403). Passive splitting of the input signal into two signals for input to the level detection cir- cuit and the frequency measurement circuit results in a loss of 6 dB for each path, which is why an amplifier (IC402) is placed ahead of the input to the PLL 1C (IC401 ), which as already mentioned is used solely as a prescaler (frequency divider). This prescaler must be configured by the CPLD each time the instrument starts up, for which reason the PLL IC’s Microwire interface port (which is compatible with SPI) is connected to the CPLD (IC301 ). The CPLD receives the reference clock signal for frequency measurement from ref- erence oscillator X301 , which effectively deter- mines the measurement accuracy. The type LF TVX0009920 speci- fied in the compo- nents list, which is a member of the CFPT 126 fam- ily from IQD Fre- quency Products, is a temperature compen- sated 40-MHz crystal oscillator with an operating temperature range of -40 °C to 85 °C. It is compatible with 3-V logic and has a frequency stability of ±0.5 ppm, which is equivalent to just 20 Hz at 50 MHz. Of course, this accuracy comes at a price, and if you do not need such high accuracy you can use a more economical oscillator instead. If you have access to a high-accuracy fre- quency counter for comparative measure- ment, you can improve the accuracy of the LF TVX0009920 by trimming the values of resis- tors R301 and R302. In the second prototype built by the authors, the measured frequency error at 40 MHz was -1 5 Hz (0.38 ppm) with the standard resistance value of 1 00 kO for R301 and R302. The authors were able to reduce the error to +5 Hz (0.1 25 ppm) by lowering the value of R302 (with R301 = 94.68 k n, R302 = 1 00 kO). The CPLD is programmed via the JTAG port (JP301 ). Jumpers on the pin header labelled ‘JTAG Disable’ are used to select either pro- gramming mode or operating mode for the CPLD. If desired, after the CPLD has been programmed you can replace the pin header and jumpers by solder bridges. JP25 in the digital portion of the circuit is an ICD programming and debugging port for the dsPIC microcontroller. Jumper JP230 can be used to manually reset the microcon- troller if necessary. PCB All SMD components are fitted on the bot- tom of the double-sided, through-hole plated PCB (Figure 4). Only the four buttons and the display module are located on the top of the board. Figures 5 and 6 show the fully assembled prototype developed in the Elektor lab, while Figure 7 gives an impres- sion of the authors’ prototype. In both cases the SMD components were placed and soldered by hand, which is not easy (especially with the PLL 1C). However, the advantage of using manual assembly instead of reflow assembly is higher accu- racy of the SMD reference oscillator fre- quency. This means that only electronics enthusiasts who are truly experienced in handling SMD devices should attempt this demanding project. After the board has been assembled cor- rectly, you need a Byteblaster or USB Blaster programming interface and the Quartus programming environment to program the CPLD. For the dsPIC, you need MPLAB from Microchip and an ICD programmer. Everything else (VHDL code, source code, hex files and programming instructions) are available in the software download package on the Elektor website [5]. Display The readings are shown on the LCD module in a very straightforward manner. The first line displays the text ‘Frequency / Level’, the second line displays the frequency in MHz, and the third line displays the signal level in dBm. The display menu also supports cali- bration of the instrument and viewing sta- tus information, such as the battery voltage. The four buttons, whose functions are described in Table 2, are used for menu selection and parameter configuration. The menu scheme is designed to always Table 2 . Menu functions of the pushbutton switches S200 OK (confirmation) and switching on the instrument S220 Back (return to previous menu level) S222 Increase value or move up in menu S221 Decrease value or move down in menu 54 04-2011 elektor TEST & MEASUREMENT Figure 8. Menu structure of the microcontroller software. show the name of the currently selected menu in the top line of the display The menu structure of the software is illustrated in Figure 8. Here it should be noted that in the ‘Measuring / Advanced’ menu, switches T3 and T4 can be used to select either ‘Fre- quency / Level’, ‘Min/Max Frequen.’ or ‘Min/Max Level’. The ‘Service’ menu can be selected in the ‘Status’ menu by pressing buttons T3 and T4 at the same time. In the ‘Service’ menu you can display the raw sig- nal level data (A/D value) and switch power to the HF portion on or off via IC2 10, thereby either enabling or disabling the frequency and signal level measurement functions. Signal level calibration The LT5538 used for signal level detection has a very large dynamic range, but it has the drawback that the output voltage is highly frequency dependent. Although sig- nal level measurement can be calibrated very precisely within a narrow frequency band, it is rather inaccurate over the desired broad frequency range. Fortunately, the fre- quency dependence of the detector output can be corrected, at least partially, by tak- ing advantage of the fact that the frequency of the measured signal is known. Using the measured frequency value, the microcon- troller can convert the detected signal level to the correct value. For this purpose, the firmware provides a separate ‘Calibration’ menu. To perform the calibration, which is based on the least squares method, you need a frequency generator with an adjust- able frequency range of 1 00 MHz to 3 GHz and an adjustable signal level range of -40 dBm to +1 0 dBm. Use the following procedure to calibrate sig- nal level measurement: 1 . Select the ‘Calibration’ menu. 2. Enter the indicated frequency and signal level. 3. Confirm the entered values. 4. Enter the next set of indicated frequency and signal level values. 5. Repeat this for all of the indicated values 6. After a short computation time, the cali- bration process is completed and the data is stored permanently in the flash memory of the microcontroller. Even with this calibration, the signal level readings are less accurate than the fre- quency readings. The largest measured error was 4.3 dB. Development potential In addition to many stimuli for developing your own devices in the domain of truly high frequencies (including PCB layout aspects), this project provides an intro- duction to CPLD programming. Thanks to the open source software (VHDL code and dsPIC source code in C), you can easily adapt the instrument to meet your specific needs or use it for other applications. The authors used MPLAB IDE v8.30 and the MPLAB C30 C compiler to develop the microcontroller firmware. They also used Quartus II v7.0 to develop and download the CPLD logic. Expanding the functionality would require a CPLD with more macrocells. Additional pads for a CPLD with more memory are already present on the PCB. If such a device is fit- ted, 0-£2 resistors must be fitted in positions R304, R305, R306 and R307. There is also room for improvement in the signal level measurement function, assum- ing you have access to good test equip- ment. With regard to the hardware, you could try to minimise reflections at the amplifier input by using an impedance matching network. Possible software modi- fications include the ability to select differ- ent calibration points or more calibration points, and you might want to try using higher-order polynomials for correction of the signal level reading. ( 100760 -I) Internet Links [ 1 ] http://cds.linear.com/docs/ Datasheet/5538f.pdf (LT5538-1 data sheet) [ 2 ] www.altera.com/literature/hb/max 2 / max2_mii5v1_01 .pdf (MAX II CPLD data sheet) [3] www. nationa I .co m / ds/ LM/ LMX2485 . pdf (LMX2485 data sheet) [4] www.avagotech.com/docs/AV02- 1 782EN (ABA-31 563 data sheet) [5] www. elekt or. com/10076 About the authors Martin Bachmann and Daniel Schar stud- ied Electrical Engineering at the Zurich University of Applied Sciences Winterthur in Switzerland. They developed the instru- ment described in this article as part of a project carried out during their studies. elektor 04-2011 55 READERS PROJECTS Altimeter for Micro-Rockets Higher and higher! By Anthony le Cren (France) When dealing with micro-rockets or scale models, it’s often difficult to find out the altitude. The main problem is really the weight of the on-board electronics system, which needs to be as light as possible. This altimeter using SMD components is as light as a letter (16 g) and has a data recorder that lets you record atmospheric pressure every 25 ms up to 16,384 stored values. Once the flight is over, the data are recovered via a serial connection to a computer and displayed in a spreadsheet. This then converts the pressure to altitude and plots the rocket’s behaviour. Technical specifications • SMD throughout • PIC 16 F 88 , programmed in Flowcode V 4 • Uses Tiny PIC Bootloader [ 2 ] • ADS 1110 16 -bit l 2 C A/D converter • 32 l (marked 1 02) and 1 0 l (marked 1 002 or 103) SMD resistors, and to complete the first side, the SMD capacitors. As for the other side (the component side), start by soldering in the microcontroller, the four LEDs, and the two capacitors. It’s tricky to spot the orientation of the pressure sensor. If you look at it carefully, there is a chamfer at the bottom left that indicates pin 1 (Figure 2). There now remain the two regulator decoupling capacitors and the pin header. There’s no holder for the 1 2 V battery, all you have to do is solder like a standard Table 1 . Configuration of the ADS 1110 A/D converter. Samples/s (SPS) Number of bits Minimum code Maximum code 15 16 -32 768 32 767 30 15 -16 384 16 383 60 14 -8 192 8 191 240 12 -2 048 2 047 58 04-2011 elektor READERS PROJECTS resistor in the middle of the PCB. Fitting the components on the RS-232 board should present no problem. However, you should take care to solder the female connector onto the track side in order to facilitate the connection between the two boards. Firmware The program is produced using Flowcode V4. The hex file contains the Tiny PIC Bootloader I 2 ! bootloader. This will be very handy for reprogramming the microcontroller after your own fashion. To do this, run the ‘tinybldWin.exe’ application. Select the file ‘Altimetre.hex’, 1 9200 baud for the speed, and the COM port you’re using. Power up the RS232 interface board and click on WriteFlash. The program should immediately be written to the PIC (Figure 6). After ignition and the rocket has blasted off, the altitude increases (if everything’s going according to plan...) and the atmospheric pressure reduces. As soon as the software detects a large enough pressure change, it automatically launches the acquisition for a period that will be a multiple of 3.2 s. You can set the pressure threshold that will trigger recording and the duration of acquisition using HyperTerminal (Figure 7). In configuration mode, LED D4 stays lit. Press the space bar to display the menu. Select the configuration menu, then enter three figures for the duration of acquisition (here 01 0, i.e. 1 0 x 3.2 = 32 s). Then set the trigger threshold between 1 and 9 dPa; the 5 shown in the figure corresponds to an elevation of around 4 m (1 dPa = 0.83 m). Launch and making use of the data Figure 4a. Block diagram of the analogue-to-digital converter. Figure 4b. Use a magnifying glass to identify pin 1 . Figure 5. The RS-232 interface stays on the ground, so it has a PCB all to itself. elektor 04-2011 59 READERS PROJECTS Figure 6. Reprogramming the microcontroller is easy thanks to Tiny PIC Bootloader. Figure 7. Configuring the altimeter with the help of HyperTerminal. Data 100418 - 18 Figure 8. The pressure values recorded during the flight converted into altitudes. It’s easy to make out the different phases of the flight. For testing, it’s perfectly possible to use this altimeter in a volley boll, on a kite, in a model aircraft, etc. The only difficulty will be adjusting the trigger threshold depending on the weather conditions. If the sensor is open to the air, the wind may very well trigger the acquisition without any elevation in the altitude. The trick is to protect the sensor like you would a microphone, with foam, or else to protect the whole thing inside a case — but that will increase the overall weight. Once the altimeter has been configured and installed in/on your flying machine or object, apply the power using jumper K1 . LED D1 will light for 3 s as the pressure at ground-level is measured, to be used as the reference for the spreadsheet plot. Then LED D2 will light to indicate that the altimeter is ready to start acquisition. Tapping lightly on the sensor will simulate an abrupt pressure variation, and you’ll see that LEDs D1 and D2 both light for the duration of the acquisition phase. To recover the data using HyperTerminal, go into the Transfer menu in order to capture the text displayed on the screen, before reading the pressures out of the EEPROM. Using your favourite spreadsheet program, open a new spreadsheet, then paste into it the previously-recovered text data. All that now remains to be done is to calculate the altitude using the formula below and plot the graph (Figure 8). An example calculation can be found in the file ‘trace, ods’m. Altitude = 288.15 0.0065 X f 1 - V f V where: - P a | t = pressure at the altitude - P ref = reference pressure measured at ground level (first measurement) - 288.1 5 = air temperature in Kelvin (100418) Internet Links [1] www.elektor.com/ 10041 8 [2] www.etc.ugal.ro/cchiculita/software/ picbootloader.htm 60 04-2011 elektor This magazine has a topic that keeps me busy on making prototype projects, advances in electronic design ideas, & always wondering what would be the next. For me, being informed in my field of expertise, it really adds confidence in my career. ^ ^ R. Arcilia, Celestica Philippines, Inc. Subscribe to Circuit Circuit Cellar Magazine • Influencing the design and production of embedded hardware and software systems. • Providing in-depth articles & highly technical content since 1988. • Enabling readers to make intelligent assessments and decisions in real-world project development scenarios. • Delivering thousands of samples to engineers through global sampling and contest programs. MEASUREMENT & SENSORS [Dtante-I fiHllhd *UWin liirri.ifr WIRELESS COMMUNICATIONS |.\4vfQg|i| l i Trains 1 4)1 V)ti!>'i 1 inn imitm! Wirrli n I TIIIF jail Qnlaiil Pwld J wWVH-Mjk iipiul TumuniMFi in E mh.’kkiJ ■il CU Tty.- Adi ftjiol-d Fr -. I . r u ii -t n -I J I i E ii'lii.ii.- EMBEDDED DEVELOPMENT I min JJcJ KiblV .-.J I iilwli 1 ILiidi Auihib- H"i* in .Hi 4’Uri j ClTwfl l"qnpimr. 1 -Ii.ihlJ Frjriuii ■ nl L'HB Kiplililrri \t, HlKimnrita nriim m! i lilnir ANALOG TECHNIQUES Fi',v mi L /.iU'J'I'.'J '4T™ Fluid! TiiJw ijk. [in.n Inihrn FjmI.hiiiiljI Grn|iinlri| Ualn Sign up today and save up to 66% off the cover price! Take out your 2.0 subscription now! tcellar.com I 860 . £ THE MAGAZINE FOR COMPUTER APPLICATIONS www.circui www.cc-access.com TEST & MEASUREMENT GPIB-to-USB Converter Industry standard measurement bus gets a USB interface by Rainer Schuster (Germany) The ‘General Purpose Instrumentation Bus’ (also termed IEEE-488 and IEC-625) is probably the oldest bus system currently in use — and with more than 5,000 different GPIB devices available, it remains the foundation stone for controlling professional test & measurement equipment. PCs are not normally equipped with a GPIB interface, however, forcing users to buy a plug-in card or an expensive external USB- GPIB converter. Fortunately our DIY solution using a USB-equipped R8C/13 board is both straightforward and affordable. It’s barely credible that a bus system originally developed by HP in the 1960s under the designation HP-IB (Hewlett Packard interface bus) is today still a widely used industry standard. In the seventies the HP-IB was standardised as IEEE-488 (also known as IEC-625) and adopted by many manufacturers under the title GPIB. Its wide dis- tribution, long-renowned reliability and ease of use have all meant that even now the GPIB is not threatened by any new bus standard. And since many users are unable or unwilling to abandon this inter- face, there is no shortage today of new T&M gear (such as oscillo- scopes and signal generators) that are equipped not just with USB and Ethernet interfaces but also with GPIB, mainly to IEEE488.2 (IEC-60488-2) standards. Its 8-bit parallel interface means that GPIB resembles the obsoles- cent Centronics printer interface, although up to 30 devices can be addressed with up to 1 5 device connected simultaneously to the bus cable, either in cascade (daisy-chained) or radially (or a com- bination of both). There’s no need to go into more detail now, as we’ll come to this later in the article. As usual there is a Wikipedia page [1 ] providing a good introduction as well as links to further information sources. Because PCs do not by and large offer a GPIB interface, it’s neces- sary to provide your own plug-in card or an external GPIB-to-USB converter, the price of which can in extreme cases exceed the value of the test gear that requires it. It’s not all bad news, how- ever, as this article shows. All the hardware you need for a GPIB-to- USB converter is a microcontroller with a USB interface equipped with at least two bidirectional I/O ports and a 24-pin Centronics connector... R8C recycling It does not take long to find a microcontroller with a USB interface equipped with at least two bidirectional I/O ports; one was already described in Elektor February 2009. For this transistor characteris- tics tracer project the author developed a small R8C board with a USB interface, which you can find as a built and tested PCB in the Elektor Shop under the order code 080068-91 . This handy control- ler board (80 x 35 mm) is programmable via the USB interface. The schematic in Figure 1 shows it built around an R8C/13 microcon- troller hooked up to a PL2303 USB-to-serial converter. The compo- nent list and the PCB layout can be found in the article describing the transistor characteristics tracer, which you can read gratis on the Elektor web page [2] for this project. The connections of the R8C/13 correspond to the legendary “Tom Thumb” R8C/1 3 board [3], retailed by Elektor at extremely low cost in 2006 and the software CD that is also available from the Elektor Shop. The current combination of PL2302 USB controller and microcon- troller is recycled from the January 2006 issue of Elektor, in which the author described the application board [4] for the R8C/13. Power for the project is taken through its USB connection. Various port pins, +V and ground are provided on a 20-pin connection strip (K1 ), allowing this PCB to be used also for other purposes if desired. The pinout roster is given in Table 1 . Pushbutton SI lets you reset the microcontroller at any time. Eighteen 470 Q resistors limit the output current of the port pins to around 1 0 mA and prevent the entire controller board being destroyed under fault conditions. Setting jumper JP1 enables programs to be loaded into the micro- Characteristics • Low-cost GPIB-TO-USB converter • Simple hardware (R8C/13 USB board with Centronics connector) • Assembled and tested R8C/13 USB board available • Free firmware with source code • Free flash program • Free development environment • Free PC sample program with source code 62 04-2011 elektor TEST & MEASUREMENT controller through the USB port (for examples using the Flash Develop- ment Toolkit from Renesas, which can be found on the R8C software CD [5]. The R8C software package forthis CD can also be downloaded from location [6]. As regards creating R8C software, downloading hex files into the con- troller and installing the USB driver for the PC there is plenty of infor- mation in the Elektor articles dis- cussed above and on the R8C page of the Elektor website [8]. As already mentioned, the hard- ware fortheGPIB-to-USB-converter consists purely of the combination shown in Figure 2 of a 24-pin Cen- tronics connector and the R8C/1 3 USB board (080068-91 ). The cable connections are shown in Table 2. Everything else is handled by the firmware in the R8C/1 3. Firmware The firmware for the microcon- troller was written in C for the Rene- sas High Performance Workshop (version 4.08) and is available as free download on the Elektor web page forthis project [7]. Detailed information on programming the R8C/13 is at Elektor’s R8C Digest web pages [8]. +5V +5V Figure 1 . The circuit of the controller board with R8C/1 3 and USB-to-serial converter PL2303. Communication between the USB interface and GPIB device is ini- tialised using the serial interface UART1 of the R8C/1 3 (the settings are 38400 baud, 8 data bits, 1 stop bit and no parity). Next we acti- vate the GPIB bus wire REN (remote enable) and after this the IFC (interface clear) wire for 1 0 ms, to reset any devices that may be connected. Simultaneously this resets the R8C/13 into its ‘control- ler in charge’ (CIC) state. Elektor Products & Services • Controller board (R8C/13 USB board, assembled and tested): # 080068-91 • PCB layout (PDF download) and component list for the controller board, available free at www.elektor.com/o8oo68 • Firmware, source code and PC software: free download # 100756-11.zip • Hyperlinks in article • All items accessible through www.elektor.com/100756 elektor 04-2011 63 TEST & MEASUREMENT Table i: Pin assignments for Ki Pin Meaning Pin Meaning 1 PI .7 11 P3.0 2 GND 12 P3.1 3 PI. 3 13 P0.7 4 PI .6 14 P0.6 5 P1.1 15 P0.4 6 PI .2 16 P0.5 7 P4.5 17 P0.2 8 P1.0 18 P0.3 9 P3.2 19 +5V 10 P3.3 20 P0.1 Following this nothing happens initially, because by definition all connected GPIB devices can speak only when they have been instructed to in advance by the controller. In order to relay com- mands and data to the GPIB devices connected the program now waits for incoming commands from the serial interface to then carry them out. To this end a small protocol is implemented: [<,>] [GPIB string] This example shows how it works. R1 ,*IDN? represents the command ‘Read’. This sends the string ‘*IDN?’ to the GPIB device with the address 1 and waits for an answer. The reply string of the device is sent back to the PC via the USB interface. Table 3 sets out the commands implemented, which are the so- called ‘universal’ commands to which all connected devices react. Next come the so-called ‘addressed’ commands, which are valid only for devices that have already been addressed (see Table 4). In order to address a device (as listener) we must first send the com- mand (before any others) ‘Listen (0x20)’ along with the (‘ORed’) device address. After the actual command ‘Unlisten’ must be sent. All the commands mentioned are so-to-speak ‘low-level’ com- mands. As a rule the only commands needed for communication with devices are R = Read, W = Write and if applicable S for polling the Service Reguest wire. Any errors in the data transmission will cause the R8C/1 3 to send ‘Error X’ to the PC. X=1 indicates that the addressed device is unavailable. X=2 flags a timeout problem in sending or receiving data Table 2: Connections for the Centronics connector at Ki of the R8C/13 USB board Signal name Port pin Ki assignment 24-pin Centronics connector assignment DIOI P0.1 20 1 DI02 P0.2 17 2 DI03 P0.3 18 3 DI04 P0.4 15 4 EOI P3.0 11 5 DAV PI. 3 3 6 NRFD PI .6 4 7 NDAC PI. 7 1 8 IFC P1.0 8 9 SRQ P4.5 7 10 ATN PI. 2 6 11 Shield - 2 12 DI05 P0.5 16 13 DI06 P0.6 14 14 DI07 P0.7 13 15 DI08 P3.1 12 16 REN P1.1 5 17 GND - 2 18-24 bJ pq DIOI DI02 DI03 DI04 EOI DAV NRFD NDAC IFC SRQ ATN SHIELD DI05 DI06 DI07 DI08 REN GND GND GND GND GND GND GND 100756 - 11 Figure 2. The hardware of the GPIB-to-USB converter combines a 24-pin Centronics connector with the R8C/13 USB board. 64 04-2011 elektor TEST & MEASUREMENT Programming The High Performance Embedded Workshop from Renesas pro- duces a Motorola hex file (GPIBJJSB.mot) that can be loaded via the USB interface with the ‘Flash Development Toolkit 3.4 Basic’ available from [5] or [6]. For this the jumper JP1 on the controller board must be set and the reset button pressed briefly. After pro- gramming don’t forget to remove the jumper and press the reset button once more. After this our GPIB-to-USB converter is ready to put to real work. The converter in action A practical application for the converter can be seen in this program written in VB6 for transferring traces from a Tektronix TDS21 0 oscil- loscope to a PC. If you know the commands for your own ‘scope it’s simple to adapt the program, which you can download from location [7]. First install the program on your PC by running ‘Setup.Exe’. After installation start the program by clicking on GPIP_USB.exe. The program then opens all available COM ports seguentially and sends the identification polling string of the GPIB-to-USB converter (l) until the matching port is found and the reply string is received. Directly after this the identification string of the oscillo- scope is polled by sending the command ‘R1 ,*IDN?’. The Figure 3. Sample oscilloscope trace delivered via the GPIB-to-USB converter from the ‘scope to the PC. Table 3: GPIB universal commands available Command Parameter Meaning C - Send IFC and reset all connected devices G GPIB command Activates the ATN wire and sends the received command as Parameter over the GPIB Bus 1 - Interrogates the identification string of the USB converters Reply: GPIB-TO-USB converter VI .0 R Device address, String to the device addressed The string given in the parameter is passed on to the device addressed and the reply string from the device is passed back S - Interrogates the SRQ (Service Request) wire Reply 0: No devices require a service request 1 : A service request is required T Timeout period in us Alters the timeout period while sending and receiving date on the GPIB Bus. Default = 200,000[us] = 200ms W Device address, String The string received in the parameter is sent forward to the device addressed in the pa- rameter (no reply expected) LLO 0x11 Local Lockout: Local control of all connected devices is disabled DCL 0x14 Device Clear: reset all devices on the GPIB Bus PPU 0x15 Parallel Poll Unconfigure: block the parallel poll function SPE 0x18 Serial Poll Enable: following a service request trigger serial polling of the devices SPD 0x19 Serial Poll Disable: block the serial polling function UNL 0x3 F Unlisten: Release all devices from listening UNT 0x5 F Untalk: Instruct the device speaking to cease elektor 04-2011 65 TEST & MEASUREMENT Table 4: Addressed CPIB commands Command Value in Hex Meaning GTL 0x01 Goto Local: switch the devices addressed to local operation SDC 0x04 Selected Device Clear: reset the devices addressed previously PPC 0x05 Parallel Poll Configure: carry out parallel polling for the devices addressed previously GET 0x08 Group Execute Trigger: carry out a defined event simultaneously on the devices addressed previously TCT 0x09 Take Control: hand over control to another device jL Ji*j Imlcifcii licit V-ulL«y-c h-Murnr r VI ^ T mclioni r IlHHlfll i r rtiL^f (wi v} t tin* Tifli t«. rwi Dcucitii 1 1 • • ||f F f FHW1 vMdl Tfliri Tctt Iah^I £iwil j AJ .I ACAaptej*- ;in (“■ IWLjll wl iZvl. f ACPIw« |iT” *• FVLFiLt Qewt | Mjll.r II j HdiMhV.lt 4 , >1 iA- fir, 5 p.-j P«f9MC*»tAvc*7l r~ 1 M-sl-e ■!•<; li * s'.lvriiufK F Jf /i rtv rjrjfi. 'j.rvi ,v fir- «. 'rdwuir: F J | UK Figure 4. Using the LTspice simulation program we can import signals measured with an oscilloscope as .pwl files. Figure 5. In this example an actual signal measurement is used in an LTspice simulation. device address is set by the global constant ‘ADDR’ to 1 . For other device addresses this value must be changed of course. If the reply string of the oscilloscope is received, the program is ready to trans- fer waveforms and display these on the PC screen. Figure 3 shows a sample transfer from channel 1 of the ‘scope. Waveforms 2 Ref A and Ref B from channel 1 are available for trans- fer. The dashed line represents the Y-offset. Functions Y-offset, Y-DIV and X-Div are all extracted from the curve data. In turn they are transposed into ASCII format from -1 28 to +1 27, the visible array ranging from -1 00 to +100. The ‘Clear All* control allows all waveforms to be erased, whilst ‘Copy to Clipboard’ sends the curve data to the clipboard for further processing, e.g. for copying into Word. Menu options ‘File -> Export csv’ and ‘Export pwl’ export the curve data into Excel or store it as a ‘.pwl’ file. The ‘.pwl’ stands for ‘Piece- wise Linear Function’ and a file of this kind contains curve data that can be incorporated in the simulation program LTspice. You can read a report [9] in Elektor for September 201 0 that provides an insight into what you can achieve with this simulation program. One of the features of this program is the ability to select not only signal sources with predefined curve shapes (sine wave, square wave, triangular, etc.) but also to import external signal flows in the form of a .pwl file (see Figure 4). The example in Figure 5 shows a noisy signal, transferred from the oscilloscope in Figure 3 to the PC, integrated as a .pwl file into the simulation program and taken through a simple low-pass (R-C combination). The result of simu- lated filtering of the signal taken from the real world can be seen at the bottom of Figure 5: the blue curve represents the input signal (from the .pwl file) whilst the green curve is the signal after smooth- ing by the low-pass filter. (100756) Internet Links [1 ] http://en.wikipedia.org/wiki/IEEE-488 [2] www.elektor.com/080068 [3] www.elektor.com/r8cstart [4] www.elektor.com/0501 79-3 [5] www.elektor.com/050179-2 [6] www.blafusel.de/files/r8c [7] www.elektor.com/ 1 00756 [8] www.elektor.com/r8c [9] www.elektor.com/081 006 66 04-2011 elektor TO DISCOVER. ^ ktor TimeClick rv>if utoj ^ — last's CVt» *0* ~J A. TO 315CWW- f V -f r SoC, PSoC & Co ♦ g,^5S5»/l< & M,i " i "’° < '’ li r * rn Df.R I ED 5 The upgraded Elektor-PLUS subscription! o All 1 1 issues including the Summer Circuits edition o Included in your PLUS subscription: Annual DVD 201 1 o 20% cheaper than normal retail price Welcome gift worth £25 O Up to 40% discount on selected Elektor products o Elektor is delivered to your doorstep every month Read your copy before everyone else NEW: On your personalized Elektor PLUS website, you have permanent access to the three latest issues of the magazine in PDF format, as well as to a fast Elektor search engine! NEW: . When taking out an Elektor PLUS subscription you get exclusive access to www.elektor-plus.com where the three latest editions of Elektor magazine are available in the form of pdf files (i.e. the current issue and the two pre- ceding ones). With a simple click you download the complete issue (front to back!) or any single article. www.elektor-plus.com also sup- plies the most extensive Elektor search engine found on the web. However the upgraded PLUS subscription offers many more interesting extras like free E-books and supplementary articles. www.elektor.com/subs • Tel. +44 (0) 20 8261 4509 Or use the subscription order form near the end of the magazine. Elektor MINI PROJECT MIDI Step Sequencer Low budget back beat generator By Pirn van het Hof (The Netherlands) Some projects just ask for small, simple solutions. This MIDI Step sequencer falls into this category. When you’re playing a piece of music and you need a simple ‘backbeat’ this circuit will come to the rescue. • - Maximum of 16 steps • -3 memory banks • - CCi and CC2 can be set for each note • - Very easy to use The MIDI Step sequencer drives a synthe- sizer or a (music) program on the PC via MIDI. A maximum of 1 6 notes can have their MIDI properties configured via 20 keys; 1 6 of them for the notes and four for loading, saving, mode-selection and start/stop. With this device it becomes child’s play to create background rhythms or repeating melodies, for example. The Step sequencer uses only a very small number of components. In the circuit we find a PIC microcontroller, a number of resis- tors and capacitors, a 2x1 6 character LCD, a crystal and 20 keys. The majority of the work is carried out by the microcontroller. The sequencer can produce a maximum of 1 6 steps. For each of those steps the sequencer sends the associated MIDI infor- mation to the connected synthesizer or PC. The pitch, velocity (or volume) and the val- ues for CCI and CC2 can be set for each step. The note, CCI and CC2 values can be turned on or off. The reason for turn- ing off the note value is to make it possible to create certain rhythms. The CC values are only entered when they are required. The length of all notes and the pitch of the base-note can also be varied. With the lat- ter all notes are transposed by the same value. The number of steps can be set up to a maximum of 1 6. The MIDI channel and program number (instrument) can also be individually configured. Keys galore The 20 keys on the sequencer have the fol- lowing functions: • Keys 1 to 1 6 — > ‘normal’ keys • Key 1 7 — > load • Key 1 8 — > save • Key 1 9 -> mode-select • Key 20 -> start / stop The modes that can be selected with key 1 9 are (in order): • Note (default) • Velocity • Skip • CCI • CC2 • Control 1 = Speed (default 1 00) 2 = Length 3 = Base-note 4 = Steps 5 = MIDI channel 6 = Program no. 7 = CCI no. 8 = CC2 no. The function of keys 1 to 1 6 depends on the mode selected. In the note and veloc- ity modes the key selects the relevant step. The rotary encoder is then used to set the value for that key. In skip mode pressing the relevant key will toggle a step on or off. In CCI orCC2 mode pressing a key will toggle the CC mode on or off. When it’s on, the focus goes to the rotary controller, 68 04-2011 elektor MINI PROJECT LCD1 / \ Midi +5 V O 2x16 (DEMI 621 7) ? S> C/5 O |> Q Q CO O I CO OT-CMCOTj-mcOh-LULU >>>Q^Q^LUOOOOOOOO I I & 5V (°> R16 4R7 C3 lOOn . Jf 1 C4 cs An ■ i\ ■ H 220u 100n LT — 25V pOk - 1 oo | a | o| t- R1 R2 R3 R4 [~R5~ 0 0 0 0 0 S5 T O Q-+ S6^ £ S7 n O-o S8 n S9^ £ sijt £ sii . n S12^ |-Q o- S1 3T £ S14^ £ S15 . n S16^ J-O o- S1 7T £ S18^ £ S19 , £ S20^ j-O O- R14 J5 J6 _1 7 _18 23 24 _25 26 J9 _20 _ 21 _ _22 _27 _8 _9 30 +5V X a a > RE3/MCLR/VPP IC1 a Q > RB0/AN12/INT RB1/AN1 0/C12IN3- RB2/AN8 RB3/AN9/PGM/C12IN2- RB4/AN11 RB5/AN13/TTG RB6/ICSPCLK RB7/ICSPDAT RCO/TIOSO/TICKi RC1/T10SI/CCP2 RC2/P1A/CCP1 RC3/SCK/SCL RC4/SDI/SDA RC5/SDO RC6/TX/CK RC7/RX/DT PIC1 6F887-PDIP RA0/AN0/ULPWU/C12IN0- RA1/AN1/C12IN1- RA2/AN2/VREF-/CVREF/C2IN+ RA3/AN3/VREF+/C1IN+ RA4/T0CKI/C1OUT RDO RD1 RD2 RD3 RD4 RE0/AN5 RE1/AN6 RD7/P1D RA5/AN4/SS/C20UT in in O o in o s —l O o CO o P: RD5/P1B RD6/P1C RE2/AN7 in in > XI 33 34_ 35_ 36_ 37_ 38_ 39_ 40 2 _ 3_ 4_ 5_ 6 _ 7_ 28_ 29_ 10 +5V K1 S21 (rotary) T 16MHz The circuit diagram is dominated by the microcontroller and the large number of keys. which is then used to set the CC value. In control mode the keys have a very different function. Key 1 then controls the speed: with the help of the rotary encoder you can set up the tempo. Key 2 is for setting up the note-length. With this the length of all the notes can be config- ured, again using the rotary encoder. If, due to the tempo, the length cannot be achieved, the notes will stop prematurely. The base-note is set using Key 3. All other notes are then tuned relative to this one and increased by this value if required. Key 4 selects the number of steps that the sequencer carries out and Key 5 is used to set the number forthe MIDI channel. Then there is Key 6, which selects the pro- gram number or instrument (dependent on the equipment that is connected). Keys 7 and 8 are used to configure the CC1 and CC2 controllers respectively. Space has been reserved in the microcon- troller for three ‘songs’. Of course they need to be programmed first using the keys and the instructions shown above. After a press of the ‘save’ key the microcontroller asks in which memory bank you want to store the song. This number can be selected using the rotary encoder. Another press of the ‘save’ key will then store the sequence in the memory bank you selected. Loading a sequence is done in a similar way, but of course you must then use the ‘load’ key. Construction We constructed the prototype using a piece of experimenter’s board. For the display we used a type that is sold by us (Elektor Shop # 030451-72), but any HD44780 compatible display should be suitable. Potmeter PI is used to set the contrast level. During the testing phase we used pinheaders instead of keys, where we put a screwdriver across two pins to simulate a key-press. For day-to-day use this isn’t very practical, so we would sug- gest that these are replaced with real keys. The quartz crystal was mounted under the microcontroller. This isn’t vital, but it made the construction easier. The MIDI output has been connected directly to the microcontroller via a 220 Q resister, rather than via an optocouplerthat is normally used. We never experienced any problems when the sequencer was con- nected to pin 15 of the (old) joystick socket on a PC in this way. However, if you want to do things properly you should add an optocoupler to the output. A good source of information about MIDI can be found at www.midi.org [1] . The hex-file for the microcontroller can be downloaded via the web page for this project [2] . As part of the download you’ll also get the Basic code for the firmware, which was made using the PIC Simulator IDE from Oshonsoft. (090516) Internet Links [1] www.midi.org/ [2] www.elektor.com/ 09051 6 elektor 04-2011 69 AT Mi 8 ATM18 Catches the RS-485 Bus Next stop for driving relays... By Gregory Ester (France) If you’re looking to establish communications between two electronic boards via a wired link over a distance of overi km, with no intermediate active elements, then there’s really only one solution: an RS-422 link. And if you want to link three boards, then the point-to-point link becomes a multi-point link, and you’ll need an RS-485 bus. ATM18 110024-11 In fact, we’re going take things a bit further still, since here we’re setting up a commu- nicating system involving four modules. Three ATM1 8 boards are going to have to get along with the latest newcomer: Muln LCD, a display that’s directly compatible with the RS-485 standard. Physically, the data will be travelling over just two wires, and consequently the trans- mission mode will be semi-duplex: every- body can express themselves, but everyone has to take their turn. The EIA (Electronic Industries Association) and TIA (Telecom- munications Industry Association) stand- ard imposes on us how to physically link the communicating elements, but there’s no imposed standard concerning the com- munication protocol. So the data, the char- acters are going to be carried over a twisted pair. As for the language to enable everyone to understand each other — we’re going to have to invent that. My appetite whetted by Elektor’s E-Labs Inside pages, I couldn’t resist ‘sticking my nose in’... The players in the project To make it easier to identify ‘who’s who’ throughout this article, we’ve adopted the following convention: the two ATM 1 8s fit- ted with a two-wire LCD display will be called ATM01 and ATM02, while the third, connected to the ‘eight-relay module’, will be called ATM05. See also Figure 4. So ATM05 is connected to the 8-relay board, with the expansion port [1 ] to enable us to economize our ATM1 8’s port lines, so we can drive the relays elegantly using just two wires in addition to the power rails. This project was the subject of an article in the ‘ATM1 8 Relay Board and Port Expander’ article in the October 2008 edition, and the hardware is available from Elektorwith part numbers 071035-72 and 071035-95. The Muln LCD [2] is a module consisting of a standard LCD display with its built-in HD44780 chipset, coupled to a driver board that’s directly compatible with our RS-485 bus. There’s a whole section about this a bit further on. ATM01 will be able to control relays 1 and 2 on the Elektor relay board, while ATM02 will drive relays 3 and 4. It’s also worth noting that it is possible, without modifying the firmware, to rename the ATM01 and ATM02 Elektor products & services • ATM18 8-relay board: Elektor #071035-72 • Two-wire display: Elektor #071035-93 • Expansion port board: Elektor #071035-95 • Firmware and source code (free download): 110024-11.zip • ATM18 controller board: Elektor #071035-91 • Hyperlinks used in article • ATM18 piggy-back board: Elektor #071035-92 • ltemsaccessiblethroughwww.elektor.com/noo24 70 04-2011 elektor ATMi8 r PO PI * p 2 #> *1 P2 I 7 r P4 f* A P5 1 r P6 P? <1 V UCC GND • * PI C-P7 dsPIC-P4 AUR/ 9051 -PO PI OP* dsPlC-PS 8051 -PI Q/T-P2 R^T-PS ro to Ol CD -st 00 Figure 1 . Adapting the signal to the line. Figure 2. Breakout board: escaping pairs. boards as ATM03 and ATM04, so they would be able to drive relays 5 and 6 or 7 and 8 respectively. Muln will take care of giving a visual indication of every event that takes place. So all these protagonists are going to have to get along with each other on the same EIA RS-485 bus. Understanding the bus The ATMOx boards don’t communicate directly between themselves, as they don’t have RS-485-compatible ports. A commu- nication module [3] makes it possible to send data over the RS-485, by adapting the asymmetric serial signal (TTL) into a sym- metrical differential signal to the RS-485 standard. This conversion is mainly taken care of here by the Analog Devices ADM485 line driver. Figure 1 shows us the positions for the DIP switches so we’ll have, on the serial port side, the three data lines Rx, Tx and R/T available on HE1 0 connector pins 8, 7 and 3 respectively. Outputs A and B avail- able on the screw terminal block deliverthe differential signal suitable for the link. The ATMOx boards are capable of transmit- ting and receiving at the same time, but on the bus transmissions cannot take place at the same time — this is the very principle of the semi-duplex link. Physically, the bus consists of a pair of conductors twisted together, keeping unwanted effects like radiation and cross- talk into other cables to a minimum. We’re using the pair 1 -2 of a Category 5e SF/UTP network cable (data rate up to 1 Gbit/s, 200 times greater than the maximum pos- sible using the ADM485 device). So there are three pairs left over for sending other information — we’re not going to be using these in this project. SF stands for shielded , foiled : the pairs are covered with foil and the bundle of four pairs is screened. This pre- cludes interference from nearby sources to a high extent. Access to the two conductors of our pair is made easier by an adaptor board [4] that will take your PCB-mounting RJ45 connec- tor. In Figure 2, the two orange and yel- low wires correspond respectively to the markings A (+) and B (-), the differential transmission lines over which the signals, perfectly complementary in terms of their waveform, are conveyed. The potential difference between point A and point B is positive or negative, giving us either a 1 or a 0. The differential voltage balanced in this way limits the harmful influ- ence of surrounding sources of interference. You can see the waveform of these signals in Figure 3. This was recorded without any trickery using the Scanalogic-2-Pro logic analyser [5], a powerful tool whose capa- bilities are inversely proportional to the price tag! R/T must be kept high so that the data can be sent on Tx in the TTL RS-232 format. To receive the characters on your microcon- troller’s UART, R/T must be set to logic 0. The block diagram in Figure 4 shows the pins used for easy wiring. Up to 32 units can be connected to the bus without a repeater. The terminating resistors make it possible to attenuate signal reflections as much as possible — it would be rather tiresome if the signal came back “under the feet” of the ADM485 before you had finished send- ing all the bits. A MUlti-purpose INterface: Muln LCD More than just a simple LCD, this interface does of course let you display text on the screen, but the display can also be driven via the USB port on a PC, via a wireless remote thanks to some XBee modules, and elektor 04-2011 7i AT Mi 8 co T T 6 to 9V D q / co t 10 00 ■'3- co Cd CM CO CM CO QT t- O (N o o o Q_ Q_ Q_ qn CD o CL < o LO Q CL _i o i i i i i i i i i i i i 110024 - 12 Figure 4. Block diagram for rapid wiring of all the boards. of course via its native RS-485 link. A set of commands interpreted by a PIC18LF2550 lets you control the cursor position, display bargraphs, adjust the brightness of the backlight, or generate tones. The board even includes six TTL- and CMOS-compatible input/outputs and five 1 0-bit analogue to digital conversion inputs. If you already have a compatible display, you can opt for just the driver board [6]. Before incorporating this beast into our system, I couldn’t resist having a bit of a play around with this excellent bit of hard- ware from Droids. All the files available for this product can be downloaded from the manufacturer’s website [7] — i.e. the latest firmware, complete with its little executable that lets you update the firmware in the PIC embedded on the board thanks to the built- in bootloader (and hence without needing to use a programmer), the graphical inter- face (GUI) that lets you test all the functions of the Muln LCD, and of course the driver for controlling the virtual serial port. Once the driver has been installed, all you have to do to update Muln is follow the copiously-illus- trated procedure on the aforementioned website. You can then remove all the pretty, almost fluorescent yellow jumpers, leaving just the two visible in Figure 5 . At this point, you should be ready to connect up the USB cable so as to self-power the whole thing, then to run the fine GUI interface, offer you the result of a few tests, and insert a screen shot of the whole thing... Well, no. Instead, we’re going to unplug everything and fit the jumpers so we can send com- mands over the RS-485 interface using an FTDI USB/RS-485 cable [8] and the Hercu- les terminal [9]. To do this, shift the “USB” jumper one pinto the left— this then means you’ll have to power the board using an external voltage supply of 6-9 V DC. Shift the jumper that was in the “UART” position one step to the right to “RS-485”. Power up, and play... The documentation is available online from [10]. The frame is sent in hexadecimal and the start is marked by sending $FE followed by one or more bytes indicating the com- mand and the parameters. Figure 6 corre- sponds to three commands that can be sent by clicking on the corresponding SEND but- tons. The first clears the screen, the second displays the message “Hello world”, and the last one generates a tone. Muln LCD is now ready to be incorporated into the system. Overall operation After having configured the ATM01 and ATM02 boards by setting PD5 and PD6 as per Table 1 , apply power to all the boards. Table i. Naming the ATM18 boards. ATMOx PD6 pd 5 ATM 01 0 0 ATM 02 0 1 ATM 03 1 0 ATM 04 1 1 Table 2. Action - Reaction. ATM 01 ATM02 Press SI RE1 =/RE1 Press SI RE3 = /RE3 Press S2 RE2 = /RE2 Press S2 RE4 = /RE4 Press S3 X Press S3 X 72 04-2011 elektor ATMi8 The names ATM01 and ATM02 will be dis- played automatically at start-up on the first line of their respective two-wire LCDs. Powering up ATM05 causes a long beep from the Muln, a friendly “Hello!”, and the state of the eight relays in binary (from RE8 to RE1 ) is written on the second line (Fig- ure 7). As shown here, none of the relays are energized. As the boards on the bus have been assigned as ATM01 and ATM02, relays 1 to 4 are the ones we can operate. Thus pressing one of the buttons SI , S2, or S3 will produce an event (Table 2). Figure 8 tells us about three events that have just taken place: first, a press on ATM02 SI has operated RE1 , and the third line tells us that button SI has just been pressed again. But what do those dots on the middle line mean? If ATM01 and ATM02 both address the bus at the same moment, a collision is inevita- ble. As a result, the two dots along with a flashing cursor (not visible in the photo) on the second line mean that ATM02 is on hold, indicating that ATM01 has just sent a command to ATM05. During this time, See your project in print! Elektor magazine is looking for Technical Authors/Design Engineers If you have ^ an innovative or original project you'd like to share with Elektor's 1 40 k+ readership and the electronics community v* above average skills in designing electronic circuits experience in writing electronics-related software ^ basic skills in complementing your hardware or software with explanatory text ^ a PC, email and Internet access for efficient communications with Elektor's centrally located team of editors and technicians then don't hesitate to contact us for exciting opportunities to get your project or feature article published. Our Author Guidelines are at: www.elektor.com/authors. Elektor Jan Buiting MA, Editor Regus Brentford \ 1000 Great West Road, Brentford TW8 9HH, United Kingdom Email: editor@eiektor.com elektor 04-2011 73 AT Mi 8 ATM02 must remain silent. In other words, ATM01 takes prec- edence in case of conflicts on the bus. However, if you fall asleep over your boards and press all the buttons, the ‘guard dog’ will wake you up! In this case, ATM01 and ATM02 perform a hot restart, and ATM 01 has priority. Pressing S3 doesn’t operate a relay, but lets you interrogate their logic states, which are displayed on the two-wire LCD display. The state of the relay is updated live on the Muln display. If ATM01 or ATM02 restart, this is also indicated by a message on the Muln LCD. For the whole thing to work, two proprietary frames have been set up. The send frame (ATMOx to ATM05): $PGE1 , 01,05,01,0001*67 where: • $pgei: frame ‘1 ’ proprietary to Gregory Ester • oi: source board • 05: destination board •oi: relay to be activated • Parameter ‘o 0 0 1’: here the parameter value is always ‘1’, since the command is always the same: “toggle the relay” • *67: checksum, a simple XOR on the preceding characters excluding the *$’. If the check- sum is incorrect, the frame is ignored. Similarly, if you try to send ATM05 the following frame ‘PGEl , 01,05,03,0001*65' using the Hercules software, it will be ignored, because, even though the checksum is correct, ATM01 does not have the right to drive relay 3. The acknowledgement frame (ATM05 to ATMOx) could look like this: $PGE2 , 05,02,03,0006*62 ShuI (tFFJSfl |Hi#j wjkJ [srttWEtu 1 H lUgr uu [1 r* HF>: ftimd | r Hfc>: b'omJ | uuu.MMJ frhii^ani Hirtofa VET«,ip nMhiv Vnr*nm 3 ? 3 r ioi w j Figure 6. Sending your own commands over the RS-485 bus. Figure 7. Hello, all the relays are de-energized. • $PGE2 : frame ‘2’ proprietary to the author (can be modified in the source code) • 05: source board • 02: destination board •03: relay that has just been activated • Parameter ‘0 0 06’: a byte that is the image of the logic state of all the relays. Here (6) 10 = (0000 01 1 0) 2 indicates that RE2 and RE3 are energised. A logical AND on the bits we’re interested in lets you recover the state of the relays. • *62 : checksum as before. If the checksum is wrong, the mes- sage ‘xx’ is displayed in place of the two bits corresponding to the state of the relays. ****** R7T102 r s : : h- ! \ 3 M a kl j G ■ “5 \..i C “ t % v. a. %..i B a u L“ 1 » 1 - - j a (a m *£* ■JL* i l i b *L- *T* *T* a T 4 -T- Figure 8. Is ATM02 around? Internet Links & References [1] www.elektor.com/080357 [2] www.robosavvy.com, in Products -> Display [3] www.mikroe.com [4] www.sparkfun. com/products/8790 [5] www.ikalogic.com/scanalogic2/ [6] www.lextronic.fr/P19764-platine-muln-pour-afficheur-lcd. html, alternatively, [2] [7] www.droids.it, in the section Documents -> Downloads [8] e.g. Farnell part no. 1740357 [9] www.hw-group.com/products/hercules/index_en.html [10] www.droids.it, in the section Documents -> User guides [11] www.elektor.com/ 1 10024 The system has been successfully tested with a bus 6 m long. Conclusion The application suggested here is of course not on the same scale as the project currently being prepared by the e-LABs. Here, it was more a question of letting you explore one possi- ble application, some peripher- als that are compatible or can be made so, and a way of communi- cating. Just like you, I’m waiting very impatiently for the defini- tive solution that’s going to be devised in the Elektor labs and developed in the blue pages in the centre of the magazine... The elements of firmware (with source code) used for this pro- ject are of course available for you on the article’s web page in]. (110024) 74 04-2011 elektor INFOTAINMENT Hexadoku Puzzle with an electronics touch After last month’s heavily Elektorized Hexadoku we revert to the standard grid of 16 by 16 boxes you’ve grown accustomed to these past few years. Sharpen your pencil, sit down in a WiFi-free spot and enter the right numbers in the puzzle. Next, send the ones in the grey boxes to us and you automatically enter the prize draw for one of four Elektor Shop vouchers. Have fun! The instructions for this puzzle are straightforward. Fully geared to electronics fans and programmers, the Hexadoku puzzle employs the hexadecimal range 0 through F. In the diagram composed of 16x16 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 Correct solutions received from the entire Elektor readership automati- cally enter a prize draw for one Elektor Shop voucher worth £ 80.00 and three Elektor Shop Vouchers worth £ 40.00 each, which should encourage all Elektor readers to participate. Prize winners The solution of the February 201 1 Hexadoku is: 9084B. The £80.00 voucher has been awarded to: H.A. Stuut (The Netherlands). The £40.00 vouchers have been awarded to: Moses McKnight (USA); Joachim Hey (Germany); Knut L. Bakke (Norway). Congratulations everyone! Solve Hexadoku and win! in each column and in each of the 4x4 boxes (marked by the thicker black lines). A number of clues are given in the puzzle and these determine the start situation. Correct entries received enter a draw for a main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. Participate! Before May 1 , 201 1 , send your solution (the numbers in the grey box- es) by email, fax or post to Elektor Hexadoku - 1 000, Great West Road - Brentford TW 8 9HH United Kingdom. Fax (+44) 208 2614447 Email: hexadoku@elektor.com 9 C F 8 4 D 7 3 A E 2 5 B 1 0 6 1 E 4 B 2 A 6 c 7 0 8 D 5 3 9 F 0 7 2 D 1 B 5 F 6 9 C 3 8 E A 4 3 A 5 6 E 9 0 8 4 B F 1 C D 2 7 4 F 8 3 5 c 2 9 0 6 E A D 7 B 1 A 9 D 0 B 7 E 6 3 C 1 2 4 F 5 8 7 1 6 E 8 4 F A B D 5 9 3 0 c 2 B 2 C 5 D 0 3 1 F 4 7 8 9 A 6 E D 8 3 9 F 1 4 0 c A B 6 E 2 7 5 5 B A 7 3 6 c 2 8 1 9 E F 4 D 0 E 4 1 2 7 5 9 B D 3 0 F A 6 8 c c 6 0 F A 8 D E 5 2 4 7 1 9 3 B F D 7 1 0 E A 5 9 8 6 c 2 B 4 3 6 3 E 4 c 2 8 D 1 7 A B 0 5 F 9 2 5 9 c 6 3 B 4 E F D 0 7 8 1 A 8 0 B A 9 F 1 7 2 5 3 4 6 C E D F B 4 8 D 2 6 9 2 0 c 6 4 1 5 3 5 E 0 8 9 1 C c E 7 F A F C E 0 D 3 F 1 4 B 9 4 0 8 F 3 E C 6 2 4 7 9 F 0 5 D 0 2 9 A C 1 3 6 0 A 4 E 4 1 0 2 9 8 B 3 F E D 6 5 8 D 1 2 7 C 9 A 3 0 D 1 2 F E B 4 A 7 3 F 8 D 1 F 0 1 2 7 The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. elektor 04-2011 75 RETRONICS 137 Years of Solid-state Electronics By Andrew Emmerson (UK) No. 036*581, PATENTED NOV, 20, 1906. G. W r PICKARD. MEANS FOR RECEIVING INTELLIGENCE COMMENTATED BY ELECTRIC WAVES. A EXPLICIT] Off TILED J-3D-. 30. LiCt j : r A t test : tm entor; K^s m Jir-£'i---£L*-*iL. / t*. ■- Vi^T-G-C- y si . J — ■n.-t-i, A ■ w tr'i Tf \ , Attv Jan. 23, ] 930. J. £. LIUENFELD 1,745,175 KL‘Ti-:cri AND APPARATUS PCH COKTSOLLIliS ELECTRIC CtBSENTE Filed Oct. B, 1*26 Figure 1 . Patent awarded to Greenleaf Pickard in 1 906 after he perfected the crystal diode. Figure 2. Lilienfeld’s patent of 1 926 for a ‘Method and Apparatus for controlling Electric Currents’. You might be surprised to learn that solid-state electronics date back as far as 1874, when in fact Ferdinand Braun invented a solid-state rectifier using a point contact based on lead sulphide. But the chief credit for starting the silicon revolution goes to Greenleaf Pickard of Amesbury, Massachusetts, who discovered that the point contact between a fine metallic wire (the so-called ‘cat’s whisker’) and the surface of certain crystalline materials (notably silicon) could rectify and demodulate high-frequency alternating currents, such as those produced by radio waves in a receiving antenna. In 1 906 Pickard perfected the crystal detector (which he called a ‘wave-interceptor’) and took out a patent for the use of sili- con in detectors (Figure 1 ). This crystal detector (point-contact rectifier) was the basis of countless crystal set radio receivers, a form of radio receiver that was extremely popular until the ther- mionic triode valve superseded the crystal detector. Pickard’s diode was nevertheless a purely passive device and to earn the real prize somebody would have to achieve amplification using crystal devices. This did not take long, for already in 1910 Dr W.H. Eccles read a 76 04-2010 elektor RETRONICS Mirc-h 7, 1 933-. j, e, lilienfelli 1 ,900,01 & DEVICE FOR CQTtfftC FTDI specialise in USB silicon, hardware and software solutions. • USB WHQL complaint drivers. • USB host and slave solutions. ^ • Free firmware development tools. && • USB IC’s, modules, cables and - turnkey custom solutions. ^ • World renowned FOC application support. USB MADE EASY Instruments A Rohde&Schwarz Company 0 Oscilloscopes 0 Power Supplies 0 Spectrum Analyzers 0 RF Instruments 0 Programmable Measuring Instruments Great Value in Test & Measurement www.hameg.com 78 04-2011 elektor products and services directory — — = = Z 160 pages of tech audio articles Linear Audio Self ' Linkw , itz ' Cordel |: Passa -°- your tech audio resource wwwJmearauaio.net milj ^vh# satisfy your I I bill IJ ly inner geek geek a fresh approach Cool portable electronic projects and kits www.mintygeek.com www. elektor. com 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 ROBOT ELECTRONICS http://www.robot-electronics.co.uk Advanced Sensors and Electronics for Robotics • Ultrasonic Range Finders • Compass modules • Infra-Red Thermal sensors • Motor Controllers • Vision Systems • Wireless Telemetry Links • Embedded Controllers ROBOTIQ http://www.robotiq.co.uk Build your own Robot! Fun for the whole family! Now, available in time for X-mas • Arduino Starter Kits *NEW!!* • Lego NXT Mindstorms • Affordable Embedded Linux Boards • Vex Robotics (kits and components) • POB Robots (kits and components) email: sales@robotiq.co.uk Tel: 020 8669 0769 STEORN SKDB LITE Join the SKDB Lite, the place to understand, discuss and experiment with magnetics. • Learn more about magnetics and electromagnetics • Participate in developer forums and discussion surrounding magnetics and related topics. For FREE access to SKDB Lite: https://kdb.steorn.com/ref25 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. WWW. elektor. com SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business, Showcase - a permanent feature of the magazine where you will be able to showcase your products and services. For just £242 + VAT (£22 per issue for eleven issues) Elektor will publish your company name, website address and a 30- word description For £363 + VAT for the year (£33 per issue for eleven issues) we will publish the above plus run a 3 cm deep full colour image - e.g. a product shot, a screen shot from your site, a company logo - your choice Places are limited and spaces will go on a strictly first come, first served basis. So-please fax back your order today! _ I wish to promote my company, please book my space: • Text insertion only for £242 + VAT • Text and photo for £363 + VAT NAME: ORGANISATION: JOB TITLE: ADDRESS: TEL: PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 0031(0)46 4370161 COMPANY NAME WEB ADDRESS 30- WORD DESCRIPTION elektor 04-2011 79 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES JDhfft ALLWpnK A world of electronics from a single shop! A Guide to Powerful Programming for Embedded Systems Assembly Language Essentials Assembly Language Essentials is a matter-of-fact guide to Assembly that will introduce you to the most fundamental programming language of a processor. Unlike other resources about As- sembly that focus exclusively on specific processors and platforms, this book uses the architecture of a fictional processor with its own hardware and instruction set. This enables you to consider the importance of Assembly language without having to deal with predetermined hardware or architectural restrictions. You’ll immediately find this thorough introduction to Assembly to be a valuable resource, whether you know nothing about the language or you have used it before. The only prerequisite is that you have a working knowledge of at least one higher-level program- ming language, such as C or Java. Assembly Language Essentials is an indispensible resource for electronics engineering professionals, academics, and advanced students looking to enhance their programming skills. pjlektor Visual Studio C# 201 0 Programming and PC interfacing This book is aimed at anyone who wants to learn about C# programming and interfac- ing to a PC. It covers programming concepts from the basics to object oriented progra m- ming, displaying graphs, threading and databases. The book is complete with many full program examples, self assessment exercises and links to supporting videos. All code examples used are available - free of charge -from a special support website. 306 pages • ISBN 978-0-905705-95-8 £29.50 • US $47.60 Introduction to Control ninaixMi Engineering Solutions for control system applications Introduction to Control Engineering This book is intended as a source of refer- ence for hardware and software associated with instrumentation and control engi- neering. Examples are presented from a range of industries and applications. Throughout the book, circuit diagrams and software listings are described, typical of many measurement and control appli- cations. The hardware and software de- signs maybe used as a basis for application by the reader. The book contains examples of PIC, PLC, PACand PC programming. 164 pages • ISBN 978-0-905705-99-6 262 pages • ISBN 978-1-907920-01-1 • £29.50 • US$47.60 £27.50 • US $44.40 8o Prices and item descriptions subject to change. E. & O.E 04-2011 elektor Associated starter kit available ARM Microcontrollers This is the perfect bookfor people who want to learn C and who want to use an mbed ARM microcontrollerinaneasyandfunway.The mbed NXP LPC1 768 uses cloud technology. This means you do not need to install soft- ware on your PC in order to program the mbed! The only thing you need is a browser and a USB port on your PC. No previous ex- perience or knowledge required. You can get access to your project from any PC anywhere in the world and continue working on it. When you are done a few mouse clicks trans- fer the program to your mbed hardware. 250 pages • ISBN 978-0-905705-94-1 £29.50 • US $47.60 Analogue Video Technological evolution plus Oiv circuits Aj'kfdi] Technological evolution plus DIY circuits Analogue Video This book is intended for electronics enthu- siasts and professionals alike, who want a much deeper understanding of the incre- dible technology conquests over the pre- digital decades that created video. It details evolution of analogue video electronics and technology from thefirst electro-mechani- cal television, through advancements in Cathode Ray Tubes, transistor circuits and signal processing, uptothe latest analogue, colour-rich TV, entertainment devices and calibration equipment. 222 pages • ISBN 978-0-905705-96-5 £26.50 • US $42.80 V J elektor 04-2011 Design your own Enhanced second edition: 180 new pages Design your own Embedded Linux Control Centre on a PC The main system described in this book re- uses an old PC, a wireless mains outlet with three switches and one controller, and a USB webcam. All this is linked together by Linux. This book will serve up the basics of setting up a Linux environment- including a software development environment - so it can be used as a control centre. The book will also guide you through the necessary setup and configuration of a Webserver, which will be the interface to your very own home control centre. Newedition enhance- ments include details of extending the ca- pabilities of your control center with ports for a mobile phone (for SMS messaging) and the Elektor “thermo snake” for low- cost networked real-time thermal moni- toring of your house and outbuildings. Now you can additionally also send all kinds of useful temperature and sensor warnings to a mobile phone. All software needed will be available atthe Elektor website. 41 6 pages • ISBN 978-1 -907920-02-8 £34.50 • US $55.70 ) More information on the Elektor Website: www.elektor.com Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 Email: sales@elektor.com More than 25 projects based on the Elektor ATM18 board cd ATM1 8 Collection This CD-ROM contains all articles from the popular ATM18-CC2 series published in Elektor magazine. From RFID Reader and Bluetooth linking right up to a chess com- puter! Project software and PCB layouts in PDFformatare included. What’s more, this CD also contains a Bascom AVR program- ming course and helpful supplementary documentation. ISBN 978-0-905705-92-7 £24.50 • US$39.60 75 Audio designs for home construction dvd The Audio Collection 3 This DVD contains more than 75 different audio circuits from the volumes 2002- 2008 of Elektor. The articles on the DVD- ROM cover Amplifiers, Digital Audio, Loudspeakers, PC Audio, Test & Measure- ment and Valves. Highlights include the ClariTy 2x300 W Class-T amplifier, High- End Power Amp, Digital VU Meter, Valve Sound Converter, paX Power Amplifier, MP3 preamp and much more. Using the included Adobe Reader you are able to browse the articles on your computer, as well as print texts, circuit diagrams and PCB layouts. ISBN 978-90-5381 -263-1 £17.90 • US$28.90 8i SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES All articles in Elektor Volume 201 0 dvd Elektor 2010 This DVD-ROM contains all editorial articles published in Volume 201 0 of the English, Spanish, Dutch, French and German edi- tions of Elektor. Using the supplied Adobe Reader program, articles are presented in the same layout as originally found in the magazine. An extensive search machine is available to locate keywords in any article. With this DVD you can also produce hard copy of PCB layouts at printer resolution, adapt PCB layouts using your favourite graphics program, zoom in / out on select- ed PCB areas and export circuit diagrams and illustrations to other programs. ISBN 978-90-5381-267-9 £23.50 • US $37.90 RFID, NFC, Zigbee, GPS and more dvd Wireless Toolbox On this DVD-ROM you’ll find a number of documents and tools that will enable you to add wireless data exchange to your electronics systems. In accordance with the principle of our Toolbox series, we’ve broughttogethertechnical documentation (spec, sheets, application notes, user guides, etc.) on various devices according to the fre- quency and/or protocol used. All of the doc- uments are PDF files (in English). Browsing around the DVD is made easy by an HTML menu. Finally, this Wireless Toolbox DVD contains a collection of articles on this topic (RFID,xBee, DCF77, GPS, infrared, etc.) that have appeared in Elektor magazine. ISBN 978-90-5381-268-6 £28.50 • US $46.00 SatFinder (March 2011) Those of you who regularly need to realign a satellite TV dish will find this gadget extremely valuable. Caravan ow- ners and campers on long journeys who crave their home TV channels can now keep up with developments in sports, news and the soaps back home with the help of the SatFinder. This GPS based design includes a database containing positional information of a number of po- pularTV satellites. With the help of GPS data it calculates the precise angles to find the satellite first time! Kit of parts including Controller ; display and PCB (European Version) Art.# 100699-71 • £71.20 • US$114.90 NetWorker (December 2010) An Internet connection would be a valua- ble addition to many projects, but often designers are put off by the complexities involved. The ‘NetWorker’, which consists of a small printed circuit board, a free soft- ware library and a ready-to-use microcon- troller-based web server, solves these problems and allows beginners to add In- ternet connectivity to their projects. More experienced users will benefit from featu- res such as SPI communications, power over Ethernet (PoE) and more. Module , ready assembled and tested Art.# 100552-91 • £53.00 • US$85.50 The Elektor DSP radio (July/August 2010) Many radio amateurs in practice use two receivers, one portable and the other a fixed receiver with a PC control facility. The Elektor DSP radio can operate in ei- ther capacity, with a USB interface giving the option of PC control. An additional feature of the USB interface is that it can be used as the source of power for the re- ceiver, the audio output being connected to the PC’s powered speakers. To allow portable 6 V battery operation the circuit also provides for an audio amplifier with one ortwo loudspeakers. PCB, assembled and tested Art.# 1001 26-91 • £149.00 • US$240.40 Reign with the Sceptre (March 2010) This open-source & open-hardware pro- jectaimsto be more than just a little board with a big microcontroller and a few use- ful peripherals — it seeks to be a fast pro- totyping system. To justify this title, in addition to a very useful little board, we also need user-friendly development tools and libraries that allow fast implementa- tion of the board’s peripherals. Ambitio- us? Maybe, but nothing should deteryou from becoming Master of Embedded Sys- tems Universe with the help of the Elektor Sceptre. PCB, populated and tested , test software loaded (excluding Bluetooth module) Art.# 090559-91 • £89.00 • US$143.60 82 Prices and item descriptions subject to change. E. & O.E 04-2011 elektor "\ April 2011 (No. 41 2) + + + Product Shortlist April: See www.elektor.com March 2011 (No. 411) SatFinder 100699-1 Printed circuit board ..11.50 100699-41 ... ATMEGA8A-PU, programmed, European version ... .... 8.75 100699-42... ATMEGA8A-PU, programmed, US version ....8.75 100699-71 ... Kit of parts, European version ..71.20 100699-72... Kit of parts, US version ..71.20 Mini Webserver using BASCOM-AVR 090773-91 ... Minimodi 8 Module .. 56.00 A String of 160 RGB LEDs 100743-1 Printed circuit board .. 11.50 071035-91... PCB, partly populated, ATM1 8 Controller module .. .... 9.50 071035-92... PCB, partly populated ATM1 8-Testboard .. 29.90 071035-93 ... SMD-populated board with all parts and pinheaders .. 23.00 Solar Charger 090190-1 Printed circuit board ....8.50 090190-41 ... Programmed controller ....9.90 February 2011 (No. 410) Gentle Awakenings 080850-1 Printed circuit board 080850-41 .... ATmega168-20PU, programmed UltimaticCWKeyer 1 00087-41 PIC1 6F688-I/P, programmed Educational Expansion Board 100742-1 Printed circuit board Contactless Thermometer 100707-1 Printed circuit board 1 00707-41 .... PIC1 6F876A DIL28, programmed TimeClick 100371-1 Printed circuit board 100371-41 .... ATtiny861-20SU, programmed MIAC Controlled Underfloor Heating System MI0235 MIAC-PLC Mil 472 MIAC and Flowcode4 MI3487 3 x MIAC and Flowcode 4 Linux’edTelephone-to-VolP Adapter 100761-1 Printed circuit board 1 00761 -41 .... PIC1 8F2550-I/SO, programmed January 2011 (No. 409) Nixie Tube Thermometer 090784-1 Printed circuit board 090784-41 .... Programmed controller AT89C2051 /24PU Flight Data Recorder 071 035-91 .... ATM1 8 controller module 090773-91 .... PCB, populated and tested with programmed bootloader 100653-1 Printed circuit board Low-cost Headphone Amp 100500-71 .... Elektor Project Case 100701-1 Printed circuit board Wireless ECG 080805-1 Printed circuit board Support Board for Arduino Nano 100396-1 Printed circuit board „ 28.90 ,..8.75 ,..8.75 , 26.00 , 20.50 ,13.35 , 57.60 ,10.60 154.00 275.10 596.30 ,..8.15 ,13.25 12.40 .8.75 .7.30 56.00 12.95 16.80 8.75 .8.75 18.00 us$ ..18.60 ..14.20 ..14.20 114.90 114.90 ..90.40 ..18.60 ..15.40 ..48.30 ..37.10 ..13.80 ..16.00 ,.47.10 ,.14.20 ,.14.20 ,.41.90 ,.33.10 ,.21.40 ,.92.90 ,.17.10 ,248.40 ,447.90 ,971.00 ,.13.20 ,.21.40 20.00 14.10 15.40 90.00 20.90 25.80 14.10 14.10 29.00 December 201 0 (No. 408) NetWorker 1 00552-91 .... Module, ready assembled and tested ....53.00.... ,..85.50 Heating System Monitor 090328-41 .... ATmega328-20AU (TQFP32-08), programmed ....11.00.... ...17.80 Stroboscopic PC Fan 100127-1 Printed circuit board 4.50.... 7.30 100127-41 .... ATtiny 231 3, programmed ....14.20.... 8.75 Bestsellers o o CO 0 O' 1 O > Q Q U o3 CO 1 Introduction to Control Engineering ISBN 978-0-905705-99-6.... £27.50 US $44.40 > ARM Microcontrollers ISBN 978-0-905705-94-1 .... £29.50 US $47.60 ^ C# 2010 Programming and PC interfacing ISBN 978-0-905705-95-8.... £29.50 US $47.60 4 [ Design your own Embedded Linux Control Centre on a PC ISBN 978-1-907920-02-8.... £34.50 US $55.70 5 1 2 4 5 4 5 Fundamental Amplifier Techniques with Electron Tubes ISBN 978-0-905705-93-4.... £65.00 ...US $1 04.90 DVD Elektor 201 0 ISBN 978-90-5381 -267-9.... £23.50 US $37.90 DVD Wireless Toolbox ISBN 978-90-5381 -268-6.... £28.50 US $46.00 CD The Power Supply Collection 1 ISBN 978-90-5381 -265-5 .... £1 7.90 US $28.90 DVD The Audio Collection 3 ISBN 978-90-5381 -263-1 .... £1 7.90 US $28.90 DVD Elektor 1 990 through 1 999 ISBN 978-0-905705-76-7 .... £69.00 ...US $1 1 1 .30 1 NetWorker Art. #100552-91 £53.00 US$85.50 2 D SatFinder Art. #100699-71 £71.20 ...US $114.90 3 MIAC-PLC Art.#MI0235 £1 54.00 ...US $248.40 Reign with the Sceptre Art. # 090559-91 £89.00 ...US $143.60 Elektor DSP radio Art. # 1 001 26-91 £1 49.00 -US $240.40^ Order quickly and securely through www.elektor.com/shop or use the Order Form near the end of the magazine! Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH • United Kingdom Tel. +44 20 8261 4509 Fax +44 20 8261 4447 Email: sales@elektor.com elektor 04-2011 83 COMING ATTRACTIONS NEXT MONTH IN ELEKTOR Microphone Conferencing System Companies and families increasingly make use of on-line (video) conferencing and sound is often the problem. When a large group of people is gathered around a (laptop) microp- hone, it often happens that colleagues at the far end of the line have great difficulty in following the conversation. Sure, a good microphone will do the job to some extent, but in larger rooms that are not the best in terms of acoustics a single microphone just isn’t sufficient. In the May 2011 edition we propose a simple conferencing system with multiple microphones. Nixie Tubes Nixie tubes create a certain atmosphere. The glow of these small tubes literally exudes a certain warmth. Nixie tubes also arouse nostalgic feelings for older readers. Not surpri- singly Elektor has published several circuits using Nixie tubes. In the May 2011 edition we explore the world of Nixie tubes, their history, operation and applications, not forgetting to take a tour of the finest and most unique Nixie project ideas submitted by Elektor rea- ders following a call in our e-weekly newsletter. VGA adapter for microcontrollers While a small LCD is a common adjunct to many microcontrollers, it may not be a grand solution when it comes to displaying information. An old monitor with a VGA input is an excellent alternative. The serial-to-VGA converter described in the May 2011 edition allows an easy way of putting information on a screen. Although ourVGAAdapter is monochrome, that’s usually not a problem. The circuit is compact and built around a dsPIC3oF3on. Article titles and magazine contents subject to change; please check the Magazine tab on www.elektor.com Elektor UK/ European April 2 on edition: on sale April 21, 2 on. Elektor USA April 2 on edition: published April 7 8, 2 on. w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektor.com Elektor on the web I [CtflbOx wirs All magazine articles back to volume 2000 are available online in pdf format. The article summary and parts list (if applicable) can be instantly viewed to help you positively identify an article. Article related items are also shown, including software downloads, circuit boards, programmed ICs and corrections and updates if applicable. Complete magazine issues may also be downloaded. In the Elektor Shop you’ll find all other products sold by the publishers, like CD-ROMs, DVDs, kits, modules, equipment, tools and books. A powerful search function allows you to search for items and references across the entire website. lit Also on the Elektor website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Time limited offers • FAQ, Author Guidelines and Contact -■ C * qqh *’ :cr-r T Anir.t r-i-n *-.y na;.>i lA WF> i 1 ** tv '."T-i h** 1 * 4 C 1 (TUM u;-: owa *4 UK » teoipi v : tot-i M u licMir E-rf-'j li 14V t H TO / c JO HKOL‘*T Prog lamming Embedded PUT MicrncDfiliollen Looting for irw rwfprr qjT|T to* j L-rrk'nrr^i id f PCI PYDIur n pfr» TK* CTiT^Ui-T. I pttlwivr** Ft* Kit or parts ClektorWh HiJh CivC’ RCiH rei ft* V»ch- f'M' W-Jk 1T-IU H e-a:il 43 runcci mm ■ a PTOiarpp-iM OH* rtuT r TV E«i-lv "In [>_ ."U fhlip jr .1 uMii'a iru iTUXtf mtf 84 04-2011 elektor Description Price each Qty. Total Order Code Assembly Language Essentials £29.50 Design your own Embedded Linux Control Centre on a PC Yaffil £34.50 Analogue Video £26.50 Introduction to Control Engineering £27.50 CD ATM1 8 Collection £29.50 DVD Elektor 201 0 £23.50 DVD Wireless Toolbox £28.50 Fu ndamental Amplifier Techniques with Electron Tubes £65.00 ARM Microcontrollers £29.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 METHOD OF PAYMENT (see reverse before ticking as appropriate) □ Bank transfer | Cheque (UK-resident customers ONLY) □ VISA EUROCARD MasterCard Expiry date: Verification code: Please send this order form to* (see reverse for conditions) Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Address + Post code Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com order@elektor.com Tel. Email Date - - Signature EL04 *USA and Canada residents should use $ prices, and send the order form to: Elektor US PO Box 1 80 Vernon CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: order@elektor.com Yes, I am taking out an annual subscription to Elektor and receive the E-book * Microcontrouir Basics Microcontroller Basics totally free! (Please fill in your emailaddress below) I would like: 1 Standard Subscription (1 1 issues) I— I Subscription-Plus (1 1 issues plus the Elektor Volume 201 1 DVD-ROM + exclusive access to www.elektor-plus.com ) * Offer available to Subscribers who have not held a subscription to Elektor during the last 12 months. Offer subject to availability. See reverse for rates and conditions. METHOD OF PAYMENT (see reverse before ticking as appropriate) □ Bank transfer | Cheque (UK-resident customers ONLY) n visa □ EUROCARD MasterCard Expiry date: Name Verification code: Address + Post code Please send this order form to Tel. Email Date Signature EL04 Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com service@elektor.com ORDERING INSTRUCTIONS, P&P CHARGES All orders, except for subscriptions (for which see below), must be sent BY POST or FAX to our Brentford address using the Order Form overleaf. Online ordering: www.elektor.com/shop Readers in the USA and Canada should send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Elektor US for applicable P&P charges. Please allow 4-6 weeks for delivery. Orders placed on our Brentford office must include P&P charges (Priority or Standard) as follows: Europe: £6.00 (Standard) or £7.00 (Priority) Outside Europe: £9.00 (Standard) or £1 1 .00 (Priority) HOW TO 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. 4027021 1 held by Elektor International Media BV with The Royal Bank of Scotland, London. IBAN: CB96 ABNA 4050 3040 2702 1 1 . BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. GCredit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in this magazine. If difficulties in the supply of components are envisaged, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not guaran- tee 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 1 0% handling charge with a minimum charge of £5.00. Patents Patent protection may exist in respect of circuits, devices, components, and so on, described in our books and magazines. Elektor does not accept responsi- bility 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 adver- tisements) are copyright and may not be reproduced or transmitted in any form or by any means, including photocopying and recording, in whole or in part, without the prior permission of Elektor in writing. Such written permission must also be obtained before any part of these publications is stored in a retrieval system of any nature. Notwithstanding the above, printed-circuit boards may be produced for private and personal use without prior permission. Limitation of liability Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in connexion with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser any money paid in respect of the goods. Law Any question relating to the supply of goods and services by Elektor shall be determined in all respects by the laws of England. January 201 1 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION United Kingdom & Ireland Standard £51.00 Plus £63.50 Surface Mail Rest of the World £65.00 £77.50 Airmail Rest of the World £82.00 £94.50 USA & Canada | Seewww.elektor.com/usaforspecialoffers | HOW TO PAY Bank transfer into account no. 4027021 1 held by Elektor International Media BV with The Royal Bank of Scotland, London. IBAN: GB96 ABNA 4050 3040 2702 1 1 . BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident cus- tomers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. SUBSCRIPTION CONDITIONS The standard subscription order period is twelve months. If a permanent change of address during the subscription period means that copies have to be despatched by a more expensive service, no extra charge will be made. Conversely, no refund will be made, nor expiry date extended, if a change of address allows the use of a cheaper service. Student applications, which qualify for a 20% (twenty per cent) reduction in current rates, must be supported by evidence of studentship signed by the head of the college, school or university faculty. A standard Student Subscription costs £40.80, a Student Subscription-Plus costs £53.30 (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 201 1 r DVD Elektor 201 0 A whole year of Elektor magazine onto a single disk The year volume DVD/CD-ROMs are among the most popular items in Elektor’s product range. This DVD-ROM contains all editorial articles published in Volume 2010 of the English, American, Spanish, Dutch, French and German editions of Elektor. Using the supplied Adobe Reader program, articles are presented in the same layout as originally found in the magazine. An extensive search machine is available to locate keywords in any article. With this DVD you can also produce hard copy of PCB layouts at printer resolution, adapt PCB layouts using your favourite graphics program, zoom in / out on selected PCB areas and export circuit diagrams and illustrations to other programs. JEoWpWl Joorgang lektor ISBN 978-90-5381-267-9 £23.50 • US $37.90 Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 V Further information and ordering at www.elektor.com/shop 4H Index of Advertisers Atomic Programming Ltd, Showcase . . . .www.atomicprogramming.com 78 Avit Research, Showcase www.avitresearch.co.uk 78 Beta Layout www.pcb-pool.com 47 Black Robotics, Showcase www.blackrobotics.com 78 CEDA, Showcase www.ceda.in 78 Designer Systems, Showcase www.designersystems.co.uk 78 Easysync, Showcase www.easysync-ltd.com 78 Elnec, Showcase www.elnec.com . 78 Embedded Adventures, Showcase www.embeddedadventures.com 78 Eurocircuits .www.eurocircuits.com 11 EzPCB/Beijing Draco Electronics Ltd www.v-module.com 15 First Technology Transfer Ltd, Showcase .www.ftt.co.uk 78 FlexiPanel Ltd, Showcase www.flexipanel.com 78 Future Technology Devices, Showcase. . .www.ftdichip.com 78 Flameg, Showcase www.hameg.com. 78 Ikalogic www.ikalogic.com/scanalogic2/ 15 Jackaltac Labcenter Linear Audio, Showcase Minty Geek, Showcase MikroElektronika MQP Electronics, Showcase. . NXP Product Quasar Electronics Robot Electronics, Showcase. Robotiq, Showcase Showcase Steorn SKDB Lite, Showcase . Virtins Technology, Showcase www.jackaltac.com 9 www.labcenter.com 88 www.linearaudio.net 79 www.mintygeek.com 79 www.mikroe.com 3 www.mgp.com 79 www.nxp. com /cortex-mO 2 www.guasarelectronics.com 23 www.robot-electronics.co.uk 79 www.robotiq.co.uk 79 78, 79 www.kdb.steorn.com/ref25 79 www.virtins.com 79 Advertising space for the issue 17 May 2011 may be reserved not later than 19 April 2011 with Elektor International Media - Allee 1, 6141 AV Limbricht, the Netherlands Telephone 0031 (0) 46 4389444 - Fax 0031 (0) 46 4370161 - e-mail: advertenties@elektor.com to whom all correspondence, copy instructions and artwork should be addressed. elektor 04-2011 87 # PRE-PRODUCTION CHECK Board Edge Defined - All Components Placed - All Connections Routed - Power Planes Generated - l\l o Design Rule Violations - Design with Confidence: The latest version of the Proteus PCB Design Software provides a multi- stage Pre-Production Check which will detect and prevent a variety of common mistakes prior to your boards being sent for manufacture. PROTEUS DESIGN SUITE Features: ■ Hardware Accelerated Performance. ■ ■ Unique Thru-View™ Board Transparency. ■ ■ Over 35k Schematic & PCB library parts. ■ ■ Integrated Shape Based Auto-router. ■ ■ Flexible Design Rule Management. ■ ■ Polygonal and Split Power Plane Support. ■ Board Autoplacement & Gateswap Optimiser. Direct CADCAM, ODB++, IDF & PDF Output. Integrated 3D Viewer with 3DS and DXF export. Mixed Mode SPICE Simulation Engine. Co-Simulation of PIC, AVR, 8051 and ARM7. Direct Technical Support at no additional cost. All levels of the Proteus Design Suite include a world class, fully integrated shape-based autorouter at no additional cost - prices start from just £150 exc. VAT & delivery wwvw.labcenter.com Electronics Labcenter Electronics Ltd. 53-55 Main Street, Grassington, North Yorks. BD23 5AA. Registered in England 4692454 Tel: +44 (0)1756 753440, Email: info@labcenter.com Visit our website or phone 01756 753440 for more details