LED BICYCLE LIGHT...BASCOM AVR COURSE...DCC CONTROLLER...ULTRASONIC DETEC www.elektor.com SEPTEMBER 2008 aus$ i 2.90 - nz$ 1 5.50 - sar 84.95 - us$ 9.95 electronics worldwide e-CAD Software IrrIe download r * - i I lectroniTenthuB > M ■ LOW DISTORTION AMPLIFIER MODULE! KC-5470 £26.25 plus postage & packing This ultra low distortion amplifier module uses the new ThermalTrak power transistors and is largely based on the high- performance Class-A amplifier. This improved circuit has no need for a quiescent current adjustment or a Vbe multiplier transistor and has an exceptionally low distortion figure. Kit supplied with PCB and all electronic components. Heatsink and power supply not included. • Output Power: 135WRMS into 8 ohms and 200WRMS into 4 ohms • Freq Resp. at 1W: 4Hz to 50kHz • Harmonic Distortion: <.008% from 20Hz to 20kHz LED WATER LEVEL INDICATOR MKII KIT KC-5449 £10.25 plus postage & packing This simple circuit illuminates a string of LEDs to quickly indicate the water level in a rainwater tank. The more LEDs that illuminate, the higher the water level is inside the tank. The input signal is provided by ten sensors located in the water tank and connected to the indicator unit via-light duty figure-8 cable. Kit supplied with PCB with overlay, machined case with screen printed lid and all electronic components. • Requires 12-1 8V AC or DC 500mA plugpack. THEREMIN SYNTHESISER KIT KC-5295 £17.50 plus postage & packing The Theremin is a strange musical instrument that was invented early last century but is still used today. The Beach Boys' classic hit "Good Vibrations" featured a Theremin. By moving your hand between the antenna and the metal plate, you can create unusual sound effects. Kit includes a machined, silkscreened, and pre drilled case, circuit board, all electronic components with clear English instructions. Required 9VDC wall adapter (Maplin #GS74R • £7. 99) POST & PACKING CHARGES Q Order Value £10 -£49.99 £50 -£99.99 £100 - £199.99 £200 - £499.99 £500+ Cost Max weight 121b (5kg). Heavier parcels POA. Minimum order £10. u Note: Products are despatched from Australia, so local customs duty & taxes may apply. Prices valid till 30/09/08 DRIDGE MODE 7j KC-5469 £7.75 plus postage & packing IDEAL FOR STEREO AMPLIFIERS. Lets you run a stereo amplifier in 'Bridged Mode' to effectively double the power available to drive a single speaker. There are no mods required on the amplifier and the signal processing is done by the kit before the signals are fed to the stereo amp. Ideal for say, using a stereo amp as an occasional PA amp for social functions or using an old amplifier to drive a sub-woofer in a home theatre. • Kit supplied with silk screened PCB and all specified components. • Requires balanced (+/-) power supply. v\l PIC LOGIC PROSE KIT KC-5457 £4.50 plus postage & packing Most logic probes are designed to operate on 5 V rails. This design operates on a wide voltage range down to 2.8V so it's suitable for use on the most modern circuits. It's also extremely compact with SMT devices on a PCB only 5mm wide, so it will fit inside a very slim case. It's capable of picking up a pulse only 50mS long and will also detect and hold infrequent pulses when in latch mode. Kit includes PCB and all specified electronic components including pre-programmed PIC. You'll need to add your own case and probe - a clear ballpoint pen case and needle, works well. IR REMOTE EXTENDER MKII KIT KC-5432 £7.25 plus postage & packing Operate your DVD player or digital decoder using its remote control from another room. It picks up the signal from the remote control and sends it via a 2-wire cable to an infrared LED located close to the device. This improved model features fast data transfer, capable of transmitting pay TV digital remote control signals using the Pace 400 series decoder. Kit supplied with case, screen printed front panel, PCB with overlay and all electronic components. • Requires 9 VDC power (Maplin #GS74R £7.99) and 2-wire cable HOW TO ORDER • ORDER ON-LINE: www.jaycarelectronics.co.uk • PHONE: 0800 032 7241* •FAX: +61 2 8832 3118* • EMAIL: techstore@jaycarelectronics.co.uk • POST: P.O. Box 107, Rydalmere NSW 2116 Australia • ALL PRICING IN POUNDS STERLING • MINIMUM ORDER ONLY £10 *Australian Eastern Standard Time (Monday - Friday 09.00 to 17.30 GMT + 10 hours only) Expect 10-14 days for air parcel delivery LOW COST DIGITAL MULTIMETER QM-1500 £2.25 plus postage & packing This full featured Digital Multimeter is perfect for the home handyman or young experimenter and will give years of reliable service. It features a huge 1 0A DC current range as well as diode and transistor testing functions. Also measures AC & DC volts and resistance. At this price you should buy two! Uil| Cjb. QV isnn 4- STAINLESS STEEL TOOLS 5” Stainless Steel Long Nose Pliers TH-1888 £4.95 plus postage & pkg Made from polished stainless steel, have a leaf spring and have serrated jaws.. Stainless Steel Side Cutters - 115mm TH-1890 £3.50 + postage & pkg High quality small side cutters that have thick (2mm) t blades and soft comfort plastic spring loaded handles. RESISTANCE WHEEL RR-0700 £5.75 plus postage & packing Great for experiments or selecting the best resistance for a circuit. Choose from 36 x 0.25W 5% resistors ranging from 5 ohms to 1 M ohms. Comes complete with leads and insulated crocodile clips. FREE CATALOGUE Checkout Jaycar’s extensive range We have kits & electronic projects for use in: • Audio & Video • Car & Automotive ^ • Computer • Lighting • Power • Test & Meters • Learning & Educational • General Electronics Projects • Gifts, Gadgets & Just for fun! For your FREE catalogue logon to www.jaycarelectronics.co.uk/elektor or check out the range at www.jaycarelectronics.co.uk 0800 032 7241 jaycarelectronics.co.uk BitScope USB Mixed Signal Oscilloscope Analog Digital Digital Storage Oscilloscope Dual Channel Digital Scope with industry standard probes or POD connected analog inputs. Fully opto-isolated. Mixed Signal Oscilloscope Capture and display analog and logic signals together with sophisticated cross-triggers for precise analog/logic timing. Multi-Band Spectrum Analyzer Display analog waveforms and their spectra simultaneously. Base-band or RF displays with variable bandwidth control. Multi-Channel Logic Analyzer Eight logic/trigger channels with event capture to 25nS. DSP Waveform Generator Optional flash programmable DSP based function generator. Operates concurrently with waveform and logic capture. Mixed Signal Data Recorder Record to disk anything BitScope can capture. Supports on-screen waveform replay and export. User Programmable Tools and Drivers Use supplied drivers and interfaces to build custom test and measurement and data acquisition solutions. Inventing the future requires a lot of test gear... ...or a BitScope BS100U Mixed Signal Storage Scope & Analyzer Innovations in modern electronics engineering are leading the new wave of inventions that promise clean and energy efficient technologies that will change the way we live. It's a sophisticated world mixing digital logic, complex analog signals and high speed events. To make sense of it all you need to see exactly what's going on in real-time. BS100U combines analog and digital capture and analysis in one cost effective test and measurement package to give you the tools you need to navigate this exciting new frontier. O CK 0 * o m rtl tScg*p* 5: < Standard 1M/20pF BNC inputs Smart POD Connector Opto-isolated USB 2.0 12VDC with low power modes BitScope DSO Software for Windows and Linux BS100U includes BitScope DSO the fast and intuitive multichannel test and measurement software for your PC or notebook. Capture deep buffer one-shots, display waveforms and spectra real-time or capture mixed signal data to disk. Comprehensive integration means you can view analog and logic signals in many different ways all at the click of a button. The software may also be used stand-alone to share data with colleagues, students or customers. Waveforms may be exported as portable image files or live captures replayed on another PC as if a BS100U was locally connected. www . bitscope .com 9/2008 - elektor 3 Crossing the Pyrenees, Alps, Atlantic & the Great Wall Electronics is a now a largely borderless activity as far as publishing and exchange of infor- mation are concerned. The only barrier that seems to exist (mostly in people's heads) is language, but hey no problem as English is the lingua franca of electronics, everyone knows their printers and datasheets and Elektor is avail- able in several translated editions to those preferring their mother tongue. That is not to say the cou- leur locale can be dispensed with and consequently all our interna- tional editors and advertisers do their best to localise the magazine to their markets. The Spanish edition of Elektor, admirably edited by Eduardo Cor- ral, was launched one year ago to reach readers not just in Spain, but also in the US and a number of south-American countries. The same basically for the Portuguese licenced edition, of which a special version is produced for Brazil. By the time you read this, Elektor's Italian licence partner Inware Edizioni srl should have their website and subscriptions intake up and running and we can look forward to seeing an authorised Italian Elektor again after a dozen or so years. Elektor is also crossing the Atlantic, now trialling the US market with a slightly adapted, locally printed and distributed version of this, the international English version of the magazine. Although our entry into the 'States is still in the 'block diagram' phase, I'm convinced that adding North American subscribers and advertisers holds a promise of significantly widening the circle of enthusiasts, professionals and com- panies serviced by our magazine, website, products and events. Speaking of e-vents, we're now taking reservations (via the Elektor website) for our second business trip to China in November of this year. The second round will comprise a business conference with local industrialists and a visit to the only government-author- ised market for electronics trade and manufacturing. A visit to the Great Wall is also scheduled in — if only to see for yourself that it failed both ways as a barrier to modern electronics. leWo r electronics worldwide The idea behind this College project is to try to balance a ball on a beam using a PID control loop. If the ball is pushed, the system moves the beam to return the ball to its initial position. So get out your USB DAQ card and a PC, and show off! 1 8 The Thought Cursor Controlling a computer using the power of thought alone is less far-fetched than you might believe. The easy part is to measure precisely the tiny currents in the brain associated with thought processes; the hard part is to extract the thoughts from the morass of multi-channel EEG (electroencephalogram) data. Elektor investigates. In this article we present a design for the device that forms the heart of a digitally controlled model railway: the DCC Command Station. The computing power in this advanced design is provided by a high- performance ARM7 processor. 34 DCC Command Station Jan Buiting Editor Volume 34 September 2008 no. 381 roiects 26 Ball & Beam for Elektor USB DAQ Card 34 DCC Command Station 44 Luxury LED Bicycle Light Light as Air (ATM1 8 series) 56 BASCOM AVR Course (1) 60 Projection over Hundreds of Metres 68 E-blocks: Accelerated Design Ultrasonic Sound Detector technolo 20 Panorama: e-CAD Anthology jO A The November 2005 'Kaleidoscope' DVD with 30-odd programs relating to electronics CAD (Computer-Aided Design) was a huge success. Three years on, we decided to repeat the exercise. This time round, instead of physical DVD with the magazine, the programs come as free downloads! With a few servos, a laser module from eBay, a microcontroller and a little dexterity we can make a laser projector which, depending on the laser, can be seen from several hundreds of metres. 1 8 The Thought Cursor info & market 6 Colophon 8 Mailbox News & New Products 20 Pa norama: e-CAD Anthology 80 Elektor SHOP Sneak Preview infotainment 76 Hexadoku 77 Retronics: E1T decade scaler tube (ca. 1954) ELECTRONICS WORLDWIDE elektor international media Elektor International Media provides a multimedia and interactive platform for everyone interested in electronics. From professionals passionate about their work to enthusiasts with professional ambitions. From beginner to diehard, from student to lecturer. Information, education, inspiration and entertainment. Analogue and digital; practical and theoretical; software and hardware. M PC TAKES Cl Icktor Sternet ladio circuitsjoeasTtlps Volume 34, Number 381, September 2008 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 1 1 times a year with a double issue for July & August. Elektor is also published in French, Spanish, German and Dutch. Together with franchised editions the magazine is on circulation in more than 50 countries. International Editor: Wisse Hettinga (w.hettinga@elektor.nl) Editor: Jan Buiting (editor@elektor.com) International editorial staff: Harry Baggen, Thijs Beckers, Ernst Krempelsauer, Jens Nickel, Guy Raedersdorf. Design stc Antoine Authier (Head), Ton Giesberts, Luc Lemmens, Daniel Rodrigues, Jan Visser, Christian Vossen Editorial secretariat: Hedwig Hennekens (secretariaat@elektor.nl) Graphic design / DT Giel Dols, Mart Schroijen Managing Director / Publisher: Paul Snakkers Marketing: Carlo van Nistelrooy Customer Services: Anouska van Ginkel Subscriptions: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 Internet: www.elektor.com 6 elektor - 9/2008 Masterclass High-End Valve Amplifiers Specifically for audio designers, audiophiles, DIY enthusiasts etc. In this Masterclass Menno van der Veen will examine the predictability and perceptibility of the specifica- tions of valve amplifiers. Covered are models that allow the characteristics of valve amplifiers to be explored up to the limits of the audible domain from 20 Hz to 20 kHz. This then leads to the minimum stability requirements that the amplifier has to satisfy. The coupling between output valves and output transformer are also modelled. This gives new insight into a unique type of distortion: Dynamic Damping Factor Distortion (DDFD). Negative feedback is often used in amplifiers. What is the optimum and what are the audible consequences? The correct amplification of micro details is explained, based on new research, and new models about this are presented. [grants A Menno van der Veen, Msc Leading designer of valve amplifiers and output transformers Programme: Reception and registration (9.30) Preamplifiers: equivalent schematics, limits in the frequency domain Power amplifiers: modelling of class A to B, interaction of the specifications for OPTs and frequency range and damping factor Lunch (12.15-12.45) Negative feedback: how negative feedback can be done right, remarkable experiments in "the project" Output transformer: limits and possibilities for the output transformer Discussion and end (3.30) The course fees are £ 1 60.00 (Including handout, certificate and lunch) Subscribers to Elektor are entitled to 5% discount! Date: Saturday 4 October 2008 Location: Birmingham City University Time: From 1 0am to 3.30pm More info and registration at www.elektor.com/events L REGISTER NOW! Places strictly limited. Email: subscriptions@elektor.com Rates and terms are given on the Subscription Order Form Head Office: Elektor International Media b.v. P.0. Box 1 1 NL-61 1 4-ZG Susteren The Netherlands Telephone: (+31 ) 46 4389444, Fax: (+31 ) 46 43701 61 Distribution: Seymour, 2 East Poultry Street, London EC1A, England Telephone:+44 207 429 4073 UK Advertising Huson International Media, Cambridge House, Gogmore Lone, Chertsey, Surrey KT1 6 9AP, England. Telephone: +44 1932 564999, Fax: +44 1932 564998 Email: p.brody@husonmedia.com Internet: www.husonmedia.com Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photo- graphs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software carriers and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopy- ing, scanning an recording, in whole or in part without prior written permission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may ex- ist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publisher to alter the text and design, and to use the contents in other Elektor International Media publications and activities. The Publisher cannot guarantee to return any mate- rial submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2008 Printed in the Netherlands 9/2008 - elektor 7 INFO & MARKET MAILBOX Age, technology and education Dear Editor — in response to the quite extensive article 'UK University Courses for Electronics & Electrical Engineering' in the February 2008 issue of Elektor, and recognising that the problem is not exclusive to the UK, I'd like to present the subject with a slightly different perspective: what kind of education shall the University bestow on the 'new students'? Although a learning curve is always related to the complex- ity of the subject matter, fields like electronics, communica- tions or computers have an added difficulty; the technol- ogy advances do not agree very well with unstructured or occasional study. In fact, age is a difficulty which will influ- ence more the newcomers or new candidates to a job. As an example of applied mobile communications, let's look at a third generation mobile phone (3G). From project design right up to manufacturing, just how many disciplines are involved? Of course nobody can be an expert covering everything from the functional architecture right up to the case design and ergonomic matters, although the team leader should have clear ideas about such vastly different subjects as VLSI or camera lenses. He or she will be supported by an extensive group of experts for each main part, whether a power supply controller, a multilayer PCB or the battery to be used. We can move the problem to another layer, allowing the project leader to get support from the product supplier, as is often the case, but then he or she forfeits freedom of choice and time. Consequently it is often decided to mix in-house expertise, supplier support and external sources to carry out well defined tasks. It's often heard that "there is nothing new today"; the latest mobile phone being no more than the previous one enriched with better features or implementing new technologies, more frequently some 'feature' to keep up with the competition. Hence brand new products need know-how, which basically is the cumulative experience of successful projects, innovation and creativity. Innovation and creativity often goes on account of newcomers, graduated or not. Not being stuck in past, they just have ideas — maybe old concepts, but new for them! The screening has to be done by experienced experts, but a question arises, are they pre- pared to understand a brilliant idea? The notion of 'education and then a job' is not motivat- ing for creative people, they want to be part of the action. Today, technologies advance much faster than any practi- cal application, so insisting on education followed by more education without presenting an opportunity to experiment in practice, causes many students to either drop out or go for a short time graduation path. New students must have deep knowledge of the fundamentals related to any technology or field of application. A graduate in history or languages doing an MA on Computer Science will know a lot of 'names' but most probably still not under- stand why the work of Jack Kilby was so important for today's degree of integration in ICs. The panorama is not exclusive to electronics, communications or computers. If we think about biotech, nanotech or any other emergent technologies the situation is worse. For years, scien- tists, universities and private labs worked hard on nanotube growth — today we can buy such tools off the shelf; that's the reality. After 20 years of R&D and lump sums invested, nanotechnology today is a well established industry, and the return will be high. With real-life needs and applications often neglected as opposed to pure technology research, I wonder if the indus- try will be able to cope with its need to find sufficient skilled professionals in the near future. It's time for the industry, the universities and private labs to get together and start reflecting. The European countries are too hierarchically minded for some matters, and too tolerant for others. But we are not alone in the competition. Rui Figueiredo (Portugal) The 0C171 Mystery (solved) (1) Dear Jan — referring to your article in the Summer Circuits 2008 edition I would question the 'solved' part of the title as the cause of the growth of the fibres is still subject to specula- tion in the article. I was involved in the investiga- tion of similar sounding metal- lic fibre growth inside a metal can, in my case it was a VCO module, eventually causing failure by shorting to the circuit inside the can. The fibres were shown to be crystalline tin and grew usually straight (though some were curly) from the can out into the air space at various angles. The cause was traced to the can being made of tin plated brass and the growth of such fibres is appar- ently a well known phenom- enon. These fibres grow more quickly in a cold environment which matched our experience with this VCO. The article does not state the composition of the OC 1 7 1 metal can, but there are pictu- res and a video here 8 elektor - 9/2008 www.vintage-radio.info/whis- kers/ for a similar effect in an AF1 1 7 which states that the can is tin plated and that the whiskers are tin. It would seem that tin plating is not such a good idea when applied to enclosures for elec- tronic circuits! Jim Thurgood (UK) Thanks for the response to my article Jim — it seems to have generated on unexpec- ted amount of feedback. Also thanks for the interesting link. I om also grateful to Andy Emmer- son for his advice that the history of electronics contains a few mistakes and it is useful to write about them! For more scientifically based the- ories , you might wont to hove a look ot www.springerlink.com/ content/v77\\33 1 021 16274/ which indicates that the couse of this dendritic growth problem may be undercooling , but I am not sufficiently well informed to know how relevant this article is. This may be related also: www.nature.com/nature/journal/ v216/n51 1 5/obs/21 6574b0.html I agree that the exact nature of the microscopic hair growth inside these transistors is still a matter of debate or research but in the title I was referring to the mystery of circuits suddenly foi- ling after 25-40 years , and that has been solved as for as I om concerned. The 0C171 Mystery (solved) (2) Hi Elektor — thanks for an interesting Summer Circuits edition; lots of nice, small pro- jects off the beaten track. By the way, those funny short- circuits in the old OC trannies may be 'tin whiskers' i.e. e growth of tin hairs from tinned surfaces. A nasty problem with PCB tracks, too! Lots of infor- mation out there on the web if you Google for tin + whisker. Jan Philipp Wuesten (AskJanFirst) (Germany) That's right Jon Philipp , 'whisker' is a correct term to use in this cose. The 0C171 Mystery (solved) (3) Dear Editor — I just received my July/August 2008 edition and read the above article with interest. It mentions 'hairs' growing. IMHO these are whiskers, i.e., needle-shaped monocrystals growing out of layers separated by galvanic or pyrolitic effects. The hairs are just a few microm- eters thick and may be removed by a current surge (alas, this may end transistor's life). I was curious to read that sev- eral theories had been created around this effect, realizing that 'whiskers' formation is a well known problem. H. Kobow (Germany) Thank you for your response to my article , which also appeared in translation in the German Elektor. Whisker growth is indeed a correct term to describe the effects. Although the theories behind pyrolitic growth and dendrite formation from tin and metal junctions and compounds hove been covered by advanced metallurgy for many years , / can only assume that the mak- ers of the OC170/171 transis- tors had no way of knowing in the early 1 960s. After all, it takes about 25-40 years for the hairs to become long enough to cause short-circuits , the period well exceeding the useful life- time of a transistor radio. As I wrote, 'zapping' the whiskers is not a permanent solution. A stable audio signal (2) Dear Sir — this refers to the request of Mr. Monteban for a stable a.f. signal source for audio measurements (Mailbox, June 2008). A construction project called 'Spot Sinewave Generator' was published in the May and June 1 985 issues of Elektor, which hopefully will cover Mr. Monteban's requirements. Darius Toorkey (India) Thanks for helping Mr. Monteban, Darius. Marconi rebranding of FUP1D Hi Jan — Retronics is always a very interesting section. I have a good few pieces of test equipment of that age and older myself. I may start writing about them when I retire next year! Referring to the June 2008 instalment I have the FUP1 D, with the additional UHF band. It is branded 'Ml', which stands for Marconi Instruments and would originate in the UK. It is identical to your photo but is labelled TF2950, which was the Marconi series of numbers for test equipment. Ed Dinning (UK) Many thanks Ed an looking for- ward to seeing some articles from you. Thanks also to Ludo ON4AIO from Belgium who mailed me a copy of the TF2950 product information sheet. Good old 8051 Dear Editor — I still see a lot of projects based on some 8051 derivative. And almost everybody uses some C compi- ler or assembler. For those who like program- ming in Pascal here is Turbo51 — a free Pascal compiler for the 8051 family of microcon- trollers. It's found at http:// turbo51 .com and features a fast single pass optimiz- ing compiler, Borland Turbo Pascal 7 syntax, full floating point support, mixed Pascal and assembler programming, full use of register banks, advanced multi-pass optimizer, smart linker, generates com- pact high quality code, output formats include binary, Intel HEX and assembler source. I wrote Turbo51 because I like Pascal programming language, still work a lot with 8051 and couldn't find any good Pascal compiler for 8051 . I believe that sooner or later there will be some project published in your magazine that will use Turbo51 . Igor Funa Corrections & Updates Portable Thermometer July & August 2008, p. 19, ref. 080418-1 The type number shown in the circuit diagram for IC5 should be: PIC16F684. Mai I Box Terms • Publication of reader's orrespondence is at the discretion of the Editor. • Viewpoints expressed by correspondents are not necessarily those of the Editor or Publisher. • Correspondence may be translated or edited for length, clarity and style. • When replying to Mailbox correspondence, please quote Issue number. • Please send your MailBox correspondence to: editor@elektor.com or Elektor, The Editor, 1 000 Great West Road, Brentford TW8 9HH, England. 9/2008 - elektor 9 INFO & MARKET NEWS & NEW PRODUCTS New 2 MB & 8 MB nvSRAMs from Cypress Cypress Semiconductor Corp. recently introduced 2-Mbit and 8-Mbit non-volatile static random access memories (nvSRAMs), extending their nvSRAM portfolio from 16 kbit to 8 Mbit. The new devices feature access times as low as 20 ns, infinite read, write and recall cycles, and 20-year data retention. They offer the best solution for applications requir- ing continuous high-speed writing of data and absolute non-vola- tile data security. Systems requir- ing nvSRAM functionality include servers, RAID applications, harsh- environment industrial controls, automotive, medical and data communications. The 2-Mbit nvSRAM and CY1 4B1 08 8-Mbit nvSRAM are ROHS-compli- ant and directly replace SRAM, battery-backed SRAM, EPROM and EEPROM devices, offering reli- able non-volatile data storage with- out batteries. Data transfers from the SRAM to the device's non-vol- atile elements take place automat- ically at power down. On power up, data is restored to the SRAM from the non-volatile memory. Both operations are also available under software control. The new nvSRAMs are manufactured on Cypress's S8(tm) 0.13-micron SONOS (Sili- con Oxide Nitride Oxide Silicon) embedded non-volatile memory technology, enabling greater den- sities and improved access times and performance. The new devices have an available Real Time Clock feature that com- bines the industry's lowest standby oscillator current with the highest performance integrated memory, enabling event time-stamping sup- ported by non-volatile memory. www.cypress.com /NVM (080624-1) Elektor E-vent: Study Trip to China Elektor's second Study Trip to China is planned for 9-18 November 2008. We will visit the China Elec- tronics Fair in Shanghai with an exhibition area of 60,000 m 2 representing the electronics industrial chain set up for one- stop purchasing of high-end components. This authoritative electronics show is the only one with full support from the Chinese Ministry of Information Industry and Ministry of Com- merce. It was classed 'A' exhi- bition in 2003 by the Ministry of Commerce. Also on the programme is a visit to the largest electronics-packed street in Beijing and/or Shanghai. The shops, often 4 to 5 floors tall, are choc-a-bloc with components, microcontrollers, experimenter's boards, modules, electric plugs, LEDs in assorted colours, LCDs and much more. Everything an electron- ics enthusiast can dream up can be found here! A business conference is also organized as part of the tour, providing an insight into trade opportunities in China. Of course there is again room for culture like the Forbidden City, Tiananmen Square, the Great Wall, the Maglev train, and more. The price of this all-inclusive tour is € 3,995 (plus VAT) per person. If you are interested in joining us in November, please register now on www.elektor.com and you will receive more detailed information. ZigBee® network module antenna. The module is del i v- sleep mode with less than 1 pA. Radiocrafts AS expand their prod- uct line with a compact ZigBee Network Module (ZNM) for use in ZigBee based mesh networks. The ZNM module offers the com- plete ZigBee network protocol in a small module with an easy to use API interface. By using the new ZNM module, ZigBee applications can be built with minimum effort, reducing time to market. The RC2300-ZNM module is a compact surface-mounted high performance module measuring only 1 2.7x25.4x2.5 mm includ- ing EMC shielding and integrated ered on tape and reel for volume production. The module is very easy to use having a UART or SPI interface for serial communication and configu- ration. The ZigBee application runs in any external controller, commu- nicating with the module by an easy-to-use API. With only 10 API calls, a complete application can be made. The new module sup- ports all features of the ZigBee 2006 standard. The RC2300-ZNM module is pre- certified for operation under the European, F C C and fl ARIB radio 1 regulations for license-free use. It operates at 1 6 channels in the 2.45 GHz frequency band. When used with quarter- wave antennas a line-of-sight range of 250 metres can be achieved. Indoor range is typically 10-30 metres. The module is designed for The module, Demo Kits and PC development tools are available now. www.radiocrafts.com (080624-III) 10 elektor - 9/2008 PicoScope 5000 Series JJj The No Compromise 1 GS/s real-time sample rate o PC Oscilloscopes *28 megasample record length o With class-leading bandwidth* sampling rate, memory depth and an array of advanced high-end features, the PicoScope 5000 PC Oscilloscopes give you the features and performance you need without any compromise. 7 he PicoScopc 3000 Serres of oscilloscopes from P:co Technology Includes gcficr. : il purpose md high rc^olucmn morfr-K: With 1? hr reseJution 1 : . jeeur^ ty, Uio IQMh^ PicoStope 3424 ^ able todeiect changes as small -as 0-024 (S^ppm) - making it [he Ideal 4-channel oscilloscope tor analog design and analysis, t he higher speed 8 fail models In Ihe Pico Scope 3000 ?erie^ ftaiure 5 dumpling ratei up i& 2GGM5/S and up to 1 MV i record lengths for general purpose and portable applies tens. The Pi to Scope; 2000 ie*-its ost bioscopes oiler single ind duaf channel units that offer highly ^ portable/low cost wluti^ns k > general purpose testing. The award winning 25-MHz handheld PitoSc&|x j 2tQS fit& tofnfbriabty into the palm of your hand yet srin includes- 'ft the powerful features found in larger oscilloscopes. t www*pteotech.com/scope485 U1 x Advanced Triggers Jn add-on to the standard triggers the PicoScope 5000 senes conies as standard with puke width, window, dropout* delay, and logic level triggering, 250 M Hz Spectrum Analyser Highspeed USB 2,0 Connection Automatic Measurements Arbitrary Waveform Generator Define your own waveforms *r select fror* & predefined signals with the '2 b!i P 125 M5/* arbitrary waveform g£rtcr«iEdiv Waveform Playback Tool 1 Fico-Srape software now allows you eo go bart, review, iiniJ ^in ;ily it wp i& 1000 captures w^hm ils waveform playback tool., Technology ^ to check out our full Sine of PC-based instruments or call 01480 396 395 for information and a product catalogue INFO & MARKET NEWS & NEW PRODUCTS Multinational Micromouse championship showcases a new generation of robotic talent Teams from Singapore, India, Iran and the Netherlands joined competitors from across the UK, at this summer's UK Micromouse robotics championship. Organ- ised by Birmingham City Univer- sity, the event saw over 50 mini robots competing in maze-solv- ing, wall-following, drag racing and mini-sumo challenges. The senior maze-solving final featured a tense battle between Derek Hall, the 2007 champion, and his regular UK Micromouse adversary, Peter Harrison. The maze-solver challenge sees the autonomous mini-robot 'mice', racing unaided to the centre of a specially constructed maze over a series of timed runs. Derek successfully defended his title, with his 'MouseX' and 'MouseX2' robots claiming the top two places, registering the competition's fastest run-time of 6.98 seconds. A new generation of robotic tal- ent demonstrated their skills in the UK Micromouse categories for junior and schools competitors. The robotics club from Singapore's Woodlands Ring Secondary School dominated the top places course in a time of 2.13 seconds. The honours in the wall-following and line-following categories were shared by the UK's John Hampden Grammar School and Hillcrest nearly 30 years, with similar events also taking place in the USA and across East Asia. The original aim of stimulating inte- rest in the then fledgling fields of software and electronics is now more relevant than ever. The increasing prevalence of these technologies in industry and society has led to widely- acknowledged skills shortages in these areas. UK Micromouse organiser, Bir- mingham City University's Dr Tony Wilcox says: "It was really encouraging to see this new gen- eration of competitors in action. Mini-robots are a great way to get 'hands-on' and explore soft- ware and electronics technolo- gies, which is the most effective way to spark new interest in these areas." Further details about the event and building mini-robots can also be found at www.tic. ac.uk/micromouse. Competitors gather at the end of the event to compare robots. in the schools drag racing chal- lenge. Their fastest stepper-motor powered challenger completed the Community School. Micromouse championships have been held annually in the UK for RS Components for energy efficient products RS Components recently launched its Solutions for Energy Efficiency range, allowing elec- tronic design engineers to view and choose from over 1 ,600 of the best-in-class power-efficiency products, encompassing 40 technologies from 60 leading manufacturers. All products are available direct from rswww. com/electronics, enabling the speedy creation of energy effi- cient designs. Product highlights include: Texas Instruments TPS63000 voltage regula- tor for extremely low power applications such as PDAs, MP3 players and LEDs MSP430 ultra low power microcontroller range opti- mised to deliver extended battery life in portable applications CC2520 low power Zigbee transceiver and development kit for RF engineers designing wireless networks in applica- Precision Amp with Lowest Guaranteed Input Bias Current PowerWisc Amplifier tions such as automatic meter reading. National Semiconductor NTs PowerWise range of energy efficient products includes a wide selection of products from amplifi- ers that guarantee the lowest input bias current in the industry to data- converters that consume 30% less power than competitive devices. NXP GreenChip ICs for power supplies, designed specifically for Laptop computers and LDC TVs, reducing no-load standby power consump- tion to 0.2-0.3W. RS Components Ultra-miniature switch mode power supply units that provide no-load power consumption of <0.5W. Integral to the range are a number of energy harvesting products to exploit natural, renewable energy sources. These include wind and solar power products together with their associated regulators and batteries. Also featured are EnOcean wireless control, switching and sensing products that don't need exter- nal power or batteries as all the power is generated internally. Passives are also available including ultra compact power inductors from Wurth. A selection of peripheral devices complements the entire offering with various wireless and dis- play options for the engineer to choose from. RS has also selected the Golden Dragon LED range from Osram, one of the market leaders in solid state lighting solutions. http: / / rswww.com / electronics ( 080624 - 11 ) 12 elektor - 9/2008 4 if I The only universal and reusable development solution, available online today RS EMBEDDED DEVELOPMENT PLATFORM rswww.com/electronics INFO & MARKET NEWS & NEW PRODUCTS Elektor Workshop: Graphical Programming of Microcontrollers using Flowcode Date: 4 October 2008, from 09.00 - 1 6.00 hours. Location: Birmingham City Uni- versity, Technology Innovation Centre, Millennium Point, Curzon Street, Birmingham B4 7XG. Lecture and workshop presenters: Dr. Nick Holden BSc(Hons) PhD CEng MIET, Senior Lecturer in the Centre for Electronics and Software, Technology Innova- tion Centre, Birmingham City University. Mr. Parmjit Chima BEng PgDip, Manager, Centre for Electronics and Software, Technology Inno- vation Centre, Birmingham City University. The purpose of this one-day course is to program and apply PIC microcontrollers in an acces- sible and practical way. The participants will learn how to use Flowcode to exer- cise some of the functionality Dr. Nick Holden of these modern microcontrollers using peripherals such as timers, counters, digital port I/O, A/D and USART, with polling and inter- rupt techniques. The course will use the E-blocks hardware with one of the com- mon 40-pin PIC microcontrollers. The graphical programming of the microcontroller is done with Mr. Parmjit Chima the revolutionary new software Flowcode version 3. The knowl- edge gained can also be applied to other 8-bit microcontrollers such as the AVR from Atmel. The participant will at the end of the day be able to build embed- ded systems with analogue values and switches as inputs and output via LCD and LEDs. This workshop is also a very thorough preparation for pro- gramming these microcontrol- lers in C. Prerequisites: some electronics skills digital technologies computer proficiency (Windows) The course fee is £ 160, includ- ing lunch and certificate. Every participant also receives the CD Flowcode software ver- sion 3 (value £ 48.30). Elektor subscribers are entitled to a 5 % discount. Note: the number of seats is lim- ited. There is space for only 16 participants! Be quick to regis- ter, places are strictly limited. Programme and registration on www.elektor.com Nl ELVIS II offers USB Plug and Play, full Nl Multisim Integration National Instruments has announced Nl ELVIS II, the latest version of the design and prototyp- ing platform that educators world- wide have adopted for hands-on, project-based learning. Based on the powerful LabVIEW graphical system design software, Nl ELVIS II gives educators 1 2 new USB plug- and-play instruments and complete integration with Multisim 10.1 soft- ware for SPICE simulation to sim- plify the teaching of circuit design. In addition, educators can use Nl ELVIS II with a suite of third-party boards and curriculum resources to teach control design, telecom- munications and microcontroller concepts. The new Nl ELVIS II includes back- ward compatibility with the pre- vious version, laboratory-friendly features such as USB plug-and- play connectivity and a smaller form factor to simplify setup and lab maintenance. Nl ELVIS II also features 1 2 of the most commonly used instruments in engineering and science laboratories, including an oscilloscope, function genera- tor, variable power supply and iso- lated digital multimeter, in one low- cost, easy-to-use platform. Because Nl ELVIS II is based on LabVIEW, educators can easily customise the software, leading SPICE simulation and schematic capture software. Educators and students can use Multisim 10.1 with Nl ELVIS II to seamlessly switch between simu- 1 2 instruments or create their own using the provided source code for the instruments. Nl ELVIS II also features complete integration with new Multisim 10.1 lated and acquired data, over- lay simulated and measured data in the same instrument and use a single platform when simulating or testing to provide a holistic view of the circuit design process - from designing and prototyping to deployment. Multisim also includes other pedagogically relevant fea- tures such as custom in-circuit quiz- zes and a 3-D Nl ELVIS II feature that students can use to wire their circuits on a virtual replica of the system, increasing efficiency in the laboratory. With an extensive network of plug- in boards from leading vendors in education and industry, educators can use Nl ELVIS II to teach a vari- ety of classes, from circuit design, measurement and instrumentation to design, telecommunications and embedded/microcontroller design. Quanser provides three different plants for teaching control design and mechatronics with Nl ELVIS II and LabVIEW. Emona Instruments introduced the DATEx telecommuni- cations trainer to teach telecommu- nications concepts using Nl ELVIS II and LabVIEW. Additionally, Freescale Semicon- ductor's Microcontroller Student Learning Kits with flexible 8-, 16- 14 elektor - 9/2008 and 32-bit microcontroller modules is fully compatible with Nl ELVIS II and leverages the 12 new inte- grated instruments to teach embed- ded and microcontroller design. National Instruments is committed to enhancing engineering and sci- ence education worldwide by pro- viding educators and students with powerful graphical system design software and modular hardware to connect the curriculum with the real world. Professors and students benefit from powerful, professional tools such as Nl LabVIEW graphi- cal development software, which helps students visualise and imple- ment engineering concepts. The integration of LabVIEW in the classroom creates an effective, dynamic learning environment - from LEGO® MINDSTORMS® NXT in primary schools to research lab- oratories in universities. www.ni.com / academic www.ni.com/nielvis (080264-IV) Industry's most secure WiFi embedded networking module Alpha Micro Components has added the MatchPort b/g Pro to its extensive portfolio of networking products. The MatchPort b/g Pro allows a wide range of machines to be managed and controlled remotely over a network with an added level of security. MatchPort b/g Pro is claimed to be the industry's most secure embedded WiFi networking mod- ule designed for applications that require the safest and most reliable technology for secure data trans- fer in sensitive applications such as medical records and government data transmissions and financial transactions. Security features include: IEEE 802.1 li compliant radio with AES-CCMP (Advanced Encryption Standard-Counter Mode with Cipher Block Chain- ing Message Authentication Code Protocol) and TKIP (Temporal Key Integrity Protocol) > Complete suite of 802. lx EAP (Extensible Authen- tication Protocols) including EAP-TLS (Trans- port Layer Security), EAP-TTLS (Tunneled Transport Layer Secu- rity), PEAP (Open standard from Cisco Systems, Microsoft and RSA Security), LEAP (Light- weight Extensible Authentica- tion Protocol) End-to-end TLS/SSL 3.0 (Secure Sockets Layer) and SSH (Secure Shell) tunneling End-to-end AES (Advanced Encryption Standard) 1 28-bit encrypted tunneling MatchPort b/g Pro handles the most computationally demand- ing or data intensive applications effortlessly with a 32-bit, 159 MIPS (Dhrystone 2.1) 166 MHz pro- cessor. With 8 MB of SDRAM and 8 MB flash, it provides enough memory capacity for OEM cus- tomisation, loading web pages, and data 'store and forward' applica- tions. It features two serial input ports with 230 kbps data rate capa- bility, seven control pins (CP/GPIO), and a wide opera- tional temperature range of -40° to 70°C, with the option to operate up to 85°C with lower MTBF. www.alphamicro.net (080624-V) Elektor Workshop: PIC Programming using 'C — hands-on for beginners Date: 4 October 2008, from 09.00 - 1 6.00 hours. Location: Birmingham City Uni- versity, Technology Innovation Centre, Millennium Point, Curzon Street, Birmingham B4 7XG. Lecture and workshop presenters: Dr. Anthony Wilcox GRIC PhD CEng MIET, Consultant and Prin- cipal Lecturer, Centre for Elec- tronics and Software, Technol- ogy Innovation Centre, Birming- ham City University. Mr Andrew Hill BSc MIET, Con- sultant and Principal Lecturer, Technology Innovation Centre, Birmingham City University. The main goal of this one-day course is to provide an intro- duction to the programming of PIC microcontrollers in the C programming language. The course is mainly aimed at par- Dr. Antony Wilcox ticipants who are unfamiliar with the C programming language, but who would like to learn to use it in an embedded environment. The participant will be introduced to those aspects of the C language that are most relevant to the pro- gramming of microcontrollers. The Mr. Andrew Hill hardware used in the course con- sists of E-blocks. Course objectives: The participant can make a sim- ple C program The participant can program a PIC-microcontroller in C Prerequisites: Some experience in program- ming is recommended, such as (Visual) Basic, Pascal, Assembly or another lan- guage. No prior knowledge of C is expected. Some familiarity with elec- tronics, digital technology and computer proficiency (Windows) The course fee is £ 1 60, includ- ing lunch and certificate. Every participant also receives the CD C for PIC Microcontrol- lers (value £ 48.30). Elektor subscribers are entitled to a 5% discount. Note: the number of seats is lim- ited. There is space for only 16 participants! Be quick to regis- ter, places are strictly limited. Programme and registration on www.elektor.com 9/2008 - elektor 15 INFO & MARKET NEWS & NEW PRODUCTS Altium joins European fight against piracy Altium Limited, the electronics design industry's leading developer of unified electronic product devel- opment solutions, has extended its Business Software Alliance (BSA) membership to include the Europe, Middle East and Africa (EME A) region. The move will strengthen Altium's IP protection and comple- ment its anti-piracy movements in China and the rest of Asia. The move will see Altium join BSA's efforts to crack down on the $US48 billion black hole caused by piracy - with over 40% of these losses stemming from the EMEA region alone. Many European countries have shown an over- all decline in piracy rates since 2003, however characteristics vary with each country and mar- ket. For example, Greece which has a piracy rate of 58% expe- rienced industry losses of $198 million last year, while the United Kingdom which has a piracy rate of 26% — one of the lowest in the EMEA region — experienced losses of more than $1 .8 billion. But software piracy not only has a detrimental effect on the software industry, it also poses a threat to the IT industry, ultimately affect- ing local job opportunities and investments into research and development. The EMEA region is a very large market for Altium, making up more than 33% of total sales in the finan- cial year ending June 30, 2007. Altium's increased support for the BSA is a positive step forward, helping Altium to protect its IP and secure future innovations in elec- tronics design. www.altium.com (080624-VI) Motor Mount & Wheel kit It's time to give your robot the mobility and style it deserves with the new Motor Mount and Wheel Kit with position con- troller from Parallax. Power- ful 1 2 VDC, 150 rpm motors are combined with precision machined 6061 aluminium hardware to provide enough power, strength, and beauty to make other robots jealous. Conveniently positioned screw holes in the bearing block make mounting this kit a breeze, and the included 6-inch (15 cm) pneumatic rubber tires perform quadrature encoder system to reliably track the speed and position of each wheel with 36 positions/rotation resolution and report the data on well on a variety of smooth or rug- ged terrains. The kit includes two position controllers which use a command via a 19.2 kbps serial bus. The position controllers can also be interfaced with HB-25 motor controllers (sold sepa- rately) to automatically provide user-definable smooth speed ramping and accurate position control, which frees up the main processor to handle more impor- tant tasks. www.Parallax.com (080624-VIII) Turner, Constable and a Lascar data logger As well as exhibiting works by great British artists such as J.M.W. Turner and John Constable, the Bury Art Gallery, Museum and Archive also contains a number of Lascar's EL-USB-2 temperature and humidity data loggers. And whilst a data logger won't pull the crowds in like a Turner masterpiece, it will do its bit to ensure these works are kept in the best condition for gen- erations to come. Alison Green, Museum Assistant explains, "It's taken over a hun- dred years to build up this col- lection and its value, historically and socially, is enormous. It's very important we monitor the environ- ment in which the collections are housed. Exposure to extremes of heat, cold, aridity or humidity can cause textiles, canvas, wood and other materials to quickly deteriorate." A search on the internet turned up a product by Lascar Electron- ics — a data logger — designed to measure and record both tem- perature and humidity over a specified period of time. "This is a great product", says Alison. "I can simply plug it into my compu- ter's USB port, give it a name, set some alarms and choose a sam- pling rate. When it's programmed, it's small enough that I can pop it back into a case without it tak- ing over the display and away it goes measuring temperature and humidity levels. When the logger is full of data or I see an alarm level has been reached because its red alarm light is flashing, I take it back to the computer and download all the recordings to see what environment our exhibits have been exposed to. It's not just in the best interest of the exhibits — we're a publicly funded organi- zation and we have to actually prove we're looking after every- thing in the museum." The EL-USB-2 is available imme- diately directly from Lascar Elec- tronics at a price of £ 49.95. Dis- counts for quantity are available upon request. www.lascarelectronics.com (080624-VI 16 elektor - 9/2008 Paltronix Limited, Unit 3 Dolphin Lane, 35 High Street, Southampton, SOM 2DF I Tel: 0845 226 9451 I Fax: 0845 226 9452 I Email: sales@paltronix.com Product information and secure on-line ordering at www.paltronix.com. Major credit and debit cards accepted. Prices exclude delivery and VAT. Please see our website at www.paltronix.com for further products including components, microcontroller development tools, prototyping aids, educational robot kits, test equipment and wireless communications products. EasyPIC5 C Starter Pack — everything needed to start developing PIC projects in C for just £189 Get an oscilloscope, logic analyser and much more with the PoScope USB-based Instrument for only £79 With a PoScope you get: • Dual-channel oscilloscope • Spectrum analyser • Dual-channel chart recorder • 16-channel logic analyser with UART, SPI, I2C and 1-wire serial bus protocol decoding • 8-channel pattern generator • Square-wave/PWM generator This latest version of the popular PoScope is a must-have tool for those developing microcon- troller-based projects or with a general electronics interest and provides the features of six instruments in one compact PC-based unit at an incredibly low price. The PoScope connects to one of your desktop or laptop PC’s USB interfaces (USB 1 .1 or USB 2.0), is Windows XP and Vista compatible and comes with easy-to-use software. The PoScope provides two BNC connectors for oscilloscope, spectrum analyser and chart recorder inputs and a 25-way female D-connector for logic analyser and pattern generator input/outputs. Supplied with USB connecting cable and software and manual on CD-ROM. A PoScope Bundle is also available for £119, which additionally includes two high- quality oscilloscope probes and a logic analyser test lead and clip set. The dual-channel oscilloscope provides voltage and frequency measurement, absolute, differential and external trigger- ing, adjustable pre-trigger, marker meas- urements and filtering. Specifications include a 100Hz ~ 200kHz sampling rate, 1126 samples/channel (1 channel) or 563 samples/channel (2-channel) memory depth with pipe reading of 64k samples per channel, 10-bit resolution A/D and input voltages from -20 ~ +20V. The spectrum analyser provides Ham- ming, Hanning, Blackman and Blackman- Harris window functions. Dual-channel oscilloscope view The chart recorder provides dual-channel recording at sampling rates from 0.01 Hz ~ 200kHz with a maximum record time of 24 hours at Fs < 100Hz. A/D resolution and input voltage range are again 10-bit and -20 ~ +20V respectively. Pix-Cell GSM Controller New product — the Pix-Cell is a stand-alone controller offering GSM/GPRS communications, three digital inputs, three 10-bit analogue inputs, SPDT relay output and RS-232 interface priced at £129. ZeroPlus Logic Analysers A range of powerful 16 and 32-channel logic analysers with advanced serial bus protocol decoding including CAN, LIN, USB, UART, SPI, I2C, 1-wire and more. With prices from only £125, there’s a logic analyser in this range to suit all needs and budgets. Universal Development System The UNI-DS3 is a versatile micro- controller development system supporting PIC, dsPIC, 8051, AVR, ARM and PSoC devices with an extensive range of built-in I/O features and on-board USB programmer priced from £109. The EasyPIC5 C Starter Pack contains everything needed to start learning about and devel- oping with PIC microcontrollers using the C programming language. The package contains the popular EasyPIC5 development board, a full version of MikroElektronika’s powerful mikroC compiler, USB and serial cables, blue backlit 16x2 character and 128x64 graphic LCDs, touch-screen overlay for graphic LCD, DS1820 temperature sensor and a 40-pin enhanced Flash PIC16F887 microcontroller — all for just £189. The EasyPIC5 C Starter Pack is well-suited to beginners and experienced developers alike and comes with high-quality printed documentation and a large number of easy-to-understand example programs for a number of PIC microcontrollers. The EasyPIC5 supplied in the starter pack is a full-featured development board for PIC10F, 12F, 16F and 18F microcontrollers in 8, 14, 18, 20, 28 and 40-pin packages. The EasyPIC5 incorporates an on-board USB-based PIC programmer and in-circuit debugger as well as a useful selection of built-in I/O devices such as LEDs, switches, 7-segment displays, potentiometers, RS- 232 interface, PS/2 and USB connectors and provision for fitting of the included LCD displays, touch-screen and DS1820 tem- perature sensor. What’s more, all of the PIC’s input/output lines are available for connection to your own circuits or to any of our huge range of low-cost optional add-on boards such as Ethernet, RS-485, CAN, LIN, IrDA and RFid communications, EEPROM, SD/ MMC and Compact Flash storage, 12-bit A/D and D/A, and many useful interfacing and prototyping boards. EasyPIC5 BASIC Starter Pack and EasyPIC5 Pascal Starter Pack also available at £149 each. Similar starter packs also available for 8051 , AVR and dsPIC — please see our website at www.paltronix.com for prices and full details. The logic analyser provides 16 channels (eight when pattern generator in use) with a sampling rate of 1kHz ~ 8MHz, internal and external clocking, versatile triggering and an input range of 0 ~ +5V. Memory depth ranges from 1544 bits/channel (Fs <= 1MHz) to 128 bits/channel (Fs <= 8MHz). Built-in serial bus protocol decoding facilitates the decoding of UART, SPI, I2C and 1-wire serial buses. The pattern generator allows eight of the logic analyser’s channels to be used to provide output waveforms from 1 kHz ~ 1 MHz with a memory depth of 1544 bits/ channel and an output voltage of OV for logic “0” and 3.3V for logic “1”. The PWM generator provides a 7.8125kHz output with a 1 ~ 100% adjust- able duty cycle. Square waves can also be output with a 50% duty cycle and an adjustable frequency ranging from 3.91kHz to 1 MHz. 'gjfm h. - ■ 1 ■ . _ ■ ” J - r* . rw » j-- Sixteen-channel logic analyser view ■ — ... ■ ii ■ UART, SPI, I2C and 1-wire decoding view Supplied in the EasyPIC5 C Starter Pack is a full version of MikroElektronika’s mikroC, a power- ful integrated development environment and C compiler for PIC12, PIC16 and PIC18 microcon- trollers. With its built-in user-friendly features, mikroC makes developing code for PICs easier than ever. When used in conjunction with the ■ i 1 EasyPIC5 development board, mikroC provides full in-circuit debugging capabilities. mikroC also provides a library of ready-written routines that provide support for all of the EasyPIC5’s on- board I/O devices and optional add-on boards. This enables programs to be quickly constructed V even when working with advanced features such as CAN, Ethernet and USB communications, character and graphic LCDs and touch-screen, and EEPROM, MMC/SD and Compact Flash data storage. mikroC also incorporates useful tools such as LCD custom character generator, GLCD bitmap generator, USART, HID and UDP terminals and 7-segment display decoder. 9/2008 - elektor 17 TECHNOLOGY MEDICAL ELECTRONICS The Thought Cursor Brain-computer interfaces and how they work © Amplifiers and A/D converter The signals are taken via a flat cable to four amplifier units, each comprising 32 channels. The signals are digitised at 5 kHz to a resolution of 16 bits and then sent to a PC over a fibre optic link. These units are readily available on the mar- ket, with a price in the tens of thousands of pounds. Jens Nickel Controlling a computer using the power of thought alone is less far-fetched than you might believe. The easy part is to measure precisely the tiny currents in the brain associated with thought processes; the hard part is to extract the thoughts from the morass of multi-channel EEG (electroencephalogram) data. Research groups all over the world [1, 2, 3] are working on how to tease out useful control information from an intri- cately interdependent array of measured brain currents. One ultimate aim is to allow a patient to control a motor in a pros- thetic limb using just a thought, allowing tetraplegic people to stand independently and go about their daily business more easily. It will be a few years before such systems are ready for widespread use, but they are already functioning in the laboratory. Measuring, amplifying and digitising the tiny currents involved does not require special equipment. The job the researchers are tackling is to distil the multitude of sampled data channels down to a simple command, which requires plenty of process- ing power and some clever software algorithms. The Berlin Brain-Computer Interface (BBCI) [1] is a coopera- tive project between the intelligent data analysis group at FIRST, part of the Fraunhofer Institute, the neurology clinic neurophysics group at Charite University Hospital, Berlin, and the Technical University of Berlin. The prestigious project is funded by the EU, by the DFG research foundation, and by the German government. How it works P The BBCI uses the 'pre-movement' principle, whereby the patient must imagine themselves wanting to move a finger, hand or foot, in order to execute a command. The brain cur- rents are measured using electrodes attached to the skin of the subject's head. Using this principle and connection method limits the system to just a couple of movement commands ('left' and 'right', for example) as otherwise the error rate be- comes too high. Nevertheless, this is enough to control a sim- ple computer game using the power of thought alone. Robot control has also been demonstrated [4]. Using a simple cur- sor-based system, writing has been shown to be possible at speeds of up to about seven characters per minute [5]. For this example the user must be able to see the cursor on the screen to allow feedback from the computer. Many brain-computer interfaces demand that the subject un- dergo training (possibly lasting as long as one week!) to learn the thought patterns that give rise to brain currents that the machine can discriminate reliably. The BBCI, however, shifts the burden of learning to the computer, which can shorten the adaptation process to just half an hour, with the subject imagining themselves moving either their left or their right index finger (for example) for periods of a second or so at a time. About one third of subjects tested manage to defeat the ability of the system to learn their thought patterns, for reasons that are not yet understood. CCCQQO cccoc^co o Electrodes * ooo GOO OOO OOP OOCOOOn'^ occocc. - In the BBCI brain currents are measured using 1 28 Ag/AgCI (silver/silver chloride) electrodes, mounted together in a cap to fit over the head [6]. Caps of this kind are also used in medical research and cost a couple of thousand pounds. The elec- trodes are distributed over the whole of the upper part of the head, each mak- ing contact with the skin over a patch approximately 5 mm across. Within the project a cap has been developed that does not need gel to improve the electri- cal contact between electrode and skin but which can still measure and continu- ously record potential difference fluctua- tions of around 50 pV. The brain currents fluctuate with the distribution being d waves', between 8 Hz and 1 3 brain is relaxed. When prepar 1 4 Hz) also come into the pictiUr ith typical frequencies between 0.5 Hz and 50 Hz, pendent on the nature of the brain's activity. 'Alpha z, are well known and are seen in the EEG when the ig to make a movement, lower frequencies (below e. 18 elektor - 9/2008 © Preprocessing O Signal analysis The recorder PC takes the signals from the A/D converters and carries out some preprocessing operations which help to reduce the com- putational demands of the subsequent stages. The signals are band- pass filtered (between 0.05 Hz and 200 Hz) and then downsampled to 1 000 Hz. Raw data packets are then sent to the next computer over the network, and simultaneously are stored in a database. The analysis stage starts with further preprocessing, whereby the sig- nal is downsampled again to 100 Hz. From thinking about making a movement to executing it takes around a second: this means that it is best to collect one second's worth of data to analyse the correspond- ing fluctuations in brain currents. Data from periods of 128 samples (corresponding to about 1 .2 s) are collected and multiplied by a win- dow function chosen to give greater weight to the later samples. A Fourier transform is then applied, and from this the frequency com- ponents below 7 Hz are extracted. An inverse transformation recon- structs the signal, which is now resampled at 20 Hz. This forms the result of the signal analysis stage. 0 Classification The classification module is im- plemented in C++ and in MAT- LAB, and embodies the major- ity of the technology that has been developed. Two threads running in parallel on the sig- nal analysis computer examine the signals, each looking for ev- idence of one of the two poss- ible control commands. The re- sults from the two threads are combined, and any detected control command is transmit- ted over the network every 40 ms. Computer network The control commands are used to drive a multimedia pro- gram that runs on a further computer (the 'feedback cli- ent'). This then enables the subject to see the effect of their thoughts directly on the screen. Because of the large amount of computing power required, the BBCI employs several off-the-shelf PCs connected together over a 100 Mbit Ethernet network [6]. Internet Links [1 ] http://ida.first.fraunhofer.de/bbci/index_en.html [2] http://bci.tugraz.at [3] www.bci-info.tugraz.at [4] www.first.fraunhofer.de/owx_1_3836_2_2_0_e1 9487f27e91 7f.html [5] http://ida.first.fhg.de/publications/BlaDorKraSchWilMurMue06.pdf [6] http://ida.first.fhg.de/publications/KreBlaCurMue07.pdf ( 080332 ) 9/2008 - elektor 19 INFO & MARKET CAD Panorama Guy Raedersdorf (Elektor France) In November 2005 we published an article 'Kaleidoscope', accompanied by a DVD-ROM that included almost thirty programs relating to CAD (Computer-Aided Design). Given its success, we decided to repeat the exercise. Only this time round, for several different reasons, there's no DVD with the magazine. In our hunt for CAD software, we tried to collect as many evaluation versions as possible - demos with greater or lesser restrictions, but also 100% functional versions of pro- grams - within this family of software. We're well aware it's impossible to be exhaustive and there are still some that have 'slipped through our net'. But don't worry, that's doubt- less just till next time round... Ed.: don't hesitate to tell us about your finds , favourites , etc., we'll share them with all our readers. Unfortunately, it's just not possible for us to go into all the details of the dozens of CAD programs available on the market. So we'll have to content ourselves with just mention- ing certain features that struck us while we were installing and getting to know them. Finally, let's just add that ibfriedrich (Target3001 !) and Seetrax (Ranger2 XL) have offered us 'Elektor specia ' ver- sions with possibilities that go beyond their usual evalua- tion versions. We're sure our readers will be able to make the most of these. Why no physical DVD? At the current price of blank writable DVDs, we didn't feel it was justified (either from an economic point of view, or indeed an environmental one) to issue a physical DVD with each of the 1 50,000 copies of this September 2008 issue (a Spanish edition was added to the European group three years ago). So we're suggesting a dual approach: 1 . the various programs can be downloaded individually (particularly suitable for those readers who don't have a fast internet connection); all you have to do is go into the 'virtual DVD' and download the .zip file from the relevant directory. 2. or there's a 'virtual DVD' that appears 'physically' as an .iso file to download from our website (warning: it's almost 1 .7 GB, which means a broadband connection is virtually obligatory!) and then burn onto a DVD using the burn soft- ware of your choice, Nero or Burning Studio. All you then have to do is put the DVD into your drive and it will auto-run (if your operating system is suitably configured), or you can just manually run the index.htm file in the root directory of the DVD drive containing your newly-burned DVD. Now let's move on to our review - the programs are ar- ranged in alphabetical order. Abacom sPlan 6.0, the circuit entry application from Abacom, lets you create a circuit diagram easily and cleanly thanks to an extensive and expandable component library. Worth not- ing: the possibility of defining the form of the circuit sheets, 20 elektor - 9/2008 automatic component numbering (standard in most of the software in this category), component search, and the use of variables. Sprint-Layout 5.0 is an easy-to-learn PCB design pro- gram with all the standard functions for this type of activity. It takes only a few minutes to grasp how it works. Note the co-ova i lability of French and German versions. Extra on the Panorama 'DVD': LochMaster 3.0 for your projects on prototype board. FrontDesigner 3.0 for designing board overlays. AMS A MS (Advanced Microcomputer Systems) offers Circuit- CREATOR, an application that handles circuit entry, PCB design, and the other usual functions. Like most current pro- grams, it supports SMD components. Options for several fonts per layer and for changing the shape of lands be- tween layers. You can define supply and ground planes with or without thermal dissipation option. Interactive com- ponent placement. The rat's nest suggests optimum com- ponent layout, but also makes manual routing easy. Has a DRC (Design Rule Checking) function used to check the built- in design rules; it flags up an error and shows where it is. Their program also includes a simulation application SpiceCreator, also available as an extra on the DVD. Baas Many of our readers are familiar with the name Lay- ol PCB; it was in fact one of the first PCB design programs with more than one language to choose from. This is still the case with this latest version, Layol PCB version 10.19 on offer from Baas Electronics. The version on offer here is the simplest version. As it is not linked to a netlist, this program lets you place your components wherever you want and draw tracks the way you want. To be able to read a netlist generated by a circuit entry program such as those created by Mentor, multiSim, Calay, Protel, or Tango, you need to move up to the professional version, Layol PCB Design. Capilano As part of the Panorama download we're offering you two products from the Capilano stable, the DesignWorks Ex- press for Windows program and the evaluation version of DesignWorks Professional 5. DesignWorks Express for Windows (free) is a handy application for circuit entry (single-sided) as long as the number of pins remains under 500. All options are open to you: editing, saving, print- out, and even producing netlists for loading into a PCB design program, for example Pad2Pad (also free) de- scribed below. Like its little brother, DesignWorks Professional 5 is a circuit entry application. 100% hierarchical design, standard and custom netlist formats, extensive component library, are just a few of its features. Let's just note that there is also a version of DesignWorks Professional 5 with a simulation function. Cadence The OrCAD® PCB Designer suite from Cadence, the 'proto-genitor' of circuit entry software, is now at version 1 6.0. Integration has reached its highest point, meaning a remarkable consistency in the commands common to the various modules that make up OrCAD PCB Designer, in this way making it possible to design a project from start to finish, from entering the circuit, via component drawing, to designing the PCB. It includes an interactive autorouter SPECCTRA (re-named Allegro PCB Router), a piece of soft- ware that seems to be becoming the must-have solution in the field of autorouting. Once installed, the software appears in the form of two programs, OrCAD Capture CIS for circuit entry (with a DRC function that lets you eliminate the majority of errors right from the outset) and OrCAD PCB Editor for PCB design and routing. A new ActiveParts function lets you search for information about an OrCAD component using various criteria. Cadsoft Eagle 5.0 from Cadsoft is one of the most popular circuit entry and PCB design programs amongst hobbyists in Eu- rope. It owes its popularity to the ease of use and perform- 9/2008 - elektor 21 INFO & MARKET CAD ance of the non-commercial version (see table). It exists in several versions, including a Freeware version limited to a board area of 100 x 80 mm, 2 signal layers, and 1 circuit sheet. Apart from these limitations, you can do everything that can be done with the Professional version. If you want to have a manual (in English or German), a CD-ROM, and unconditional technical support, then it's worth purchasing a license (€ 49). It's worth noting that Eagle is one of the few CAD applica- tions, if not the only one as far as we are aware, to exist in Windows, Linux, and Mac versions. £*Q 8 m 15 E3 - Z B V KiCad The only fully OpenSource program in this 'Panorama', Kicad is actually a suite of four programs under an overall project manager, Kicad. It is fully functional, comprising all the modules needed, from circuit entry, Eeschema, to PCB design, Pcbnew (which also lets you visualize it in 3D), via the Gerber file viewer Gerbview and Cvpcb, the form selection program for the components used in the project. Even though it's OpenSource, KiCad is far from being a second-rate piece of software; it's very comprehensive and even includes autorouting. The documentation includes a very instructive and well-pre- sented tutorial. 7T, rrJ (400 0) %!£ 4* n E3 p □ * X <*, it o-i Si * * 4 r r /< \\ / T o o ■ * o \ O rtT Ei X 5 LabCenter The latest offering from LabCenter is Proteus Design Suite 7.2. Proteus is in fact a combination of two pro- grams in one: ISIS for circuit entry and ARES for PCB de- sign with autorouting and 3D visualisation. Together, these form a powerful, highly-integrated environment. There are several versions, from the Starter Kit, with a netlist limited to 500 pins, to the Level 3 version which handles unlimited pins and layers. ISIS supports hierarchical design and can be used to cre- ate busses; ARES is based on netlists, and is able to use physical DRC. Like many current applications, the libraries include over 1 0,000 different components. FreePCB 1.20 McCAD Allan Wrights's FreePCB is a free PCB design program. The Manual available on the author's website is an excel- lent resource for finding out what's involved when you want to design a printed circuit. There's no circuit entry function, so you'll either need to use a circuit entry program, or else create your own netlist, making sure it can be imported into FreePCB. The existence of a rat's nest helps a great deal in positioning the components properly, thus making it poss- ible to avoid unnecessary track lengths. The presence of a shape editor is quite surprising in such an environment, but FreePCB's specific function is to make printed circuits, and it does this well. ibFriedrich TARGET 3001! VI 3 is the worthy successor to its pred- ecessor VI 2, covered in November 2005. A few points of interest: 3D view of the project (lets you see if a project is viable) Reverse-engineering (you really have to discover this amazing tool, now included in more and more programs) Multi-lingual (board markings and documentation! Assistant for aligning components geometrically (p acing 7 LEDs along an arc from 20° to 120° becomes child's play). Fuller library of 'standard' components Automatic library updating, etc. McCad has made a reputation for itself in the Mac world as the first manufacturer of CAD software to run on Mac - at a time when our PCs were still only running on DOS! McCAD offers 2 programs for Windows, EDS-1 and a higher-performance version of this software, EDS-plus. The evaluation version is for EDS-1 . McCAD has opted for a modular approach, customers buying just those modules they need: basic or advanced circuit entry, digital/ana- logue simulation, PCB design, autorouting, Gerber conver- sion, etc. There is also a free version, EDS Lite. Note: The version on offer here is on 'Elektor special ' ver- sion that lets you do a lot more than the standard demo version. Worth noting: the possibility of downloading a very in- structive e-book 'Quickstart to Simulation' devoted to simulation. 22 elektor - 9/2008 National Instruments Multisim from National Instruments is an old acquaintance to the Elektor designers. For years, they've been working with Ultiboard, the forerunner of this program. Multisim, the latest offering from the Electronic Workbench Group - which has now become part of Nl - has evolved into a multi-faceted tool combining circuit entry, interactive circuit simulation, PCB design, and compliance testing. Multisim is available in different versions: Base, Full, and Power Pro. We are offering you a trial of the Base version. Multisim in fact comprises two modules, Multisim for cir- cuit entry and SPICE simulation, and Ultiboard, in its new livery, for PCB design with built-in routing. The possibility of using LabVIEW measuring instruments adds an extra dimen- sion to this software. Number One Systems Easy-PC from Number One Systems has been well-known for years, and is now at version 1 1 .0. What struck us with this new version is the existence of Design Calculators that let you perform various operations like defining track size according to current, and calculating their impedance, as well as the temperature rise in operation. Naturally, DRC is available here too. One of the interesting options - found in other software too, albeit under a different name - is the Intelligent Gerber Im- port, which lets you re-create, from a Gerber file from any source, an Easy-PC PCB from which it is then even possible to derive a full circuit diagram. In addition, you'll also find a demo version of Easy-Spice, a simulation program. Seetrax Seetrax has added two of its programs to our list: Rang- ed XL and Seetrax XL Designer (SXLD to its friends). To install Ranger2 XL, all you have to do is run the setup.exe file; once installation is over, you'll have the demo version of Ranger2 XL with its original restrictions. To now change your demo version into the 500-pin version (a present from Seetrax), all you need do is copy the li- cence. dot licence file (from the 'Licence' subdirectory; make sure the name is right, without any other additional suffix) into the ...\seetrax\ranger2xl\data directory. Seetrax XL Designer is the second program from Seetrax. To install the demo version, all you need do is run the XLDesignerDemo_l .49.exe file. Licence installation takes place during this operation, so the program works right away. This version is limited to projects comprising a maximum of 30 components and 50 nets (it is otherwise identical to the full version). When the program is run, it of- fers a button to search for updates. Note: After transfer of the licence file , the version of Rang- er2 XL offered here is the '&500' version that normally sells for £90. Those Engineers Spicycle is a full program that lets you design a PCB di- rectly from a netlist or in more conventional fashion from a circuit diagram. As all the operations are carried out under Active X control, it is possible to perform back annotation between the circuit diagram, the netlist, and the simulation parameters. One interesting aspect of Spicycle is that it includes a very comprehensive symbol library, making it possible to design not only an electronic circuit, but even to create a sort of schematic diagram of any kind of system (for a wind tunnel, for example). Spicycle offers a simulation in 'mixed' mode (integrates seamlessly with the SpiceAge simulator). Data transfer to the circuit diagrams is bidirectional, meaning you can im- port a SPICE netlist which is then presented in the form of interconnected circuit symbols. Back annotation becomes a real pleasure. Tsien BoardMaker3 has come a long way since it came out in 2000, and has been regularly updated. The VI .33.0022 version on offer here dates from 24 June 2008. Board- Maker3 is an integrated environment for PCB design; it has high-performance tools for circuit entry, Spice simulation, 3D visualisation, and autorouting. Worth noting: on the www.tsien.info/guide.php site there is a series of pages that explain extremely well what's in- volved when you start to tackle a circuit entry and PCB de- sign application. Visionics EDwinXP includes all the tools you could wish for required to produce a printed circuit: the circuit editor, PCB editor (with autoplacement and autorouting), simulators in EDSpice mixed mode, the library manager, and all the rest. Worth noting: the presence of a thermal analyser (with sig- 9/2008 - elektor 23 INFO & MARKET CAD nal integrity and field analysis), and a test for the effects of electromagnetic radiation on the circuit. The installation of this program alone is already a real feast for the eyes. Note: It's important for the directory where the EDwinXP 1 6 1 files are going to be decompressed to have a name of 8 characters or less (e.g. EDwinXP) if you want to be able to install the program (see the readme.txt file that comes with the program). So where are the missing ones? Despite all our efforts, we didn't manage to 'nail' all the CAD software manufacturers we'd have liked for our round- up. Some of them weren't in a position to make an evalua- tion version of their programs available to us (for example, Altium, which does however boast a most attractive virtual demonstration centre at www.altium.com/evaluate/demo- center/# and choose your language), others simply chose not to. Conclusion Reviewing almost 20 programs, whether comprehensive or specializing in just PCB design, really brought home to us the increasing complexity of this type of software. Using such programs demands a relatively up-to-date PC, if you Manufacturer Program name Circuits PCB Autorouting Simulation Abacom sPlan 6.0 * yes — — — Sprint-Layout * — yes yes — Frontdesigner 3.0 * — — — — Lochmaster 3.0 * — — — — Advanced Microcomputer Systems Circuit Creator * yes yes yes yes Spice Creator * — — — yes Baas Electronics LayolPCB 10.0 * — yes — — Cadence OrCAD 16.0 * yes yes yes option CADSoft Eagle 5.0 ] ) Light * yes yes yes — Standard yes yes yes — Professional yes yes yes — Capilano DesignWorks Express * 2 ) yes via Pad2Pad — — DesignWorks 5.0 * yes via Pad2Pad with add. module with add. module FreePCB Free PCB 12.0 * — yes with add. module IBFriedrich TARGET3001 ! 3) Light * yes yes yes yes Smart yes yes yes yes Economy yes yes yes yes Professional yes yes yes yes Design Station yes yes yes yes KiCAD KICAD * yes yes yes — LabCenter Proteus 7.2 * yes yes yes yes McCAD EDS-1 * yes yes with add. module with add. module McCAD 3SPICE Lite * — — — yes SimPlus * — — — yes National Instruments Nl Circuit Design Suite 10.1 * yes yes yes yes Number One Systems Easy PC * yes yes with Router + Easy-Spice Others Easy-Spice * — — — yes Pad2Pad Pad2Pad * — yes — — Seetrax Ranger2 XL 4 ) yes yes with add. module — XL Designer * yes yes with add. module — Those Engineers Spicyle * yes yes — SpiceAge SpiceAge * — — — yes Tsien BoardMaker 3 * yes yes gateway yes Visionics EDWinXP 11.6* yes yes yes yes * = included on Panorama virtual DVD, N.l. = No info, - = No or Not Applicable h Versions also available for Mac and Linux (see under 'Extra') 2 ) Free version 3 ) This is an upgraded Elektor special version 4 ) The version on the virtual DVD is the Ranger2 XL/500 version (normally worth £90) 24 elektor - 9/2008 want to avoid its turning into a real trial of patience. In any case, you'll need quite a lot of that to get to grips with any of these programs. Most of the top-end programs (price- wise too!) are hardly very different in terms of what they offer, except in terms of certain details. And what for one user may seem to be an unforgivable omission may be an option that another user has no need of. It's a question of taste and requirements. You are the best judge of that. So why not take a look at our website and download the .iso file to create your own DVD, or pick the programme you'd like to try out... Happy exploring! Ed.: In view of the time that elapsed between writing this article and the 'gathering' of the software appearing on the virtual DVD , it's still a good idea to look and see if there may be a new version of any of the software described in this article you may be interested in (hence the links given in the table). ( 080356 - 1 ) The author would like to thank Cadence Design Systems, Inc. for allowing Elektor to distribute OrCAD software from their site and a virtual DVD. By the same token, he would like to thank all the other compa- nies for their unconditional permission. Price (rrp) Homepage €39.90 www.abacom-online.de/fr/ €39.90 €39.90 €39.90 $ 99 to $ 995 www.advancedmsinc.com/ $ 99 or www.circuitcreator.com/ € 99 to € 950 www.baas.nl/ N.C. www.cadence.com/ www.cadsoft.de/ €49 € 750 € 1,499 free www.capilano.com/ $ 395 to $ 790 free www.freepcb.com/ www.ibfriedrich.com/ €59 € 159 €569 € 1,649 €2,999 free www.lis.inpg.fr/realise_au_lis/kicad/ £ 150 to £ 1,225 www.labcenter.co.uk/index.cfm/ $1,095 to $ 1,395 www.mccad.com/ $ 395 $ 695 N.l. www.ni.com/ £ 247 to £ 447 www.numberone.com/ £ 295 free www.pad2pad.com/ £ 90 to £ 460 www.seetrax.com/ £ 100 to £1,000 £ 45 to £ 1 95 www.spiceage.com/ £45 £ 350/yr or 6x price www.tsien.info/index.php $ no to (n.i.) www.visionics.a.se/ Internet Links The manufacturers' addresses are given in the table. CAD software manufacturers Altium www.altium.com Ariadne www.cad-ul.de/ariadne/index.html Autotrax www.kov.com CADint www.cadint.se CirCAD www.holophase.com DesignSof www.designsoftware.com Express P www.expresspcb.com Mentor Graphics www.mentorg.com Merco electronics www.mercoelectronics.info PCB Editor www.waldherr.com Pulsonix www.pulsonix.com/index.asp The PCB Designer www.cad-design.com Vutrax www.vutrax.co.uk/ Zuken www.zuken.com General source links www.terrypin.dial.pipex.com/ECADList.html www.abcelectronique.com/annuaire/societes_52.php http://etronics.free.fr/dossiers/softs/softOO.htm 9/2008 - elektor 25 PROJECTS PID BALANCING ACT Ball & Beam for Grind your teeth on PID design and programming Jose Luis Ruperez Fombellida & Jose Manuel Escobosa Bravo Like it or not. Ball & Beam is a compulsory item on the Electronics Engineering curriculum, specifically for classes on PID (proportional-integral-derivative) control systems. The idea is to try to balance a ball on a beam using a control loop. If the ball is pushed, the system moves the beam to return the ball to its initial position. So let's get out our USB DAQ card and a PC to show off! Apart from your curiosity and eager- ness to learn about PID (one of the great pillars of electronic engineering), the ingredients of this project can be summarised as • the Elektor USB Data Acquisition (DAQ) Card [1]; • a circuit which acts as interface between the DAQ and the mechani- cal system; • mechanics, i.e. construc- tion of the ball & beam system, which is very easy and cheap com- pared to commercial units; • A personal computer running a program. This project can be interesting for any- one keen on electronics and/or comput- ers; even more so if he or she is curious about control and regulation systems or about discrete PID controllers using Windows C + +/CLI programming. It may also trigger old hands at electron- ics to re-live the PID experiments they once did at College in the dim past. The project has a low threshold as there is no need to do any Laplace or Z transform. There is no need to do any calculation either; apart perhaps from an empirical tweaking of the PID con- troller by adjusting certain controls in the PC program. Of course, those of you with solid mathematics education can rigorously analyse the system. On the other hand, seeing how a ball remains stable in a certain position on the beam not only has didactic or aca- demic interest! Aircraft of the vertical takeoff type such as the Harrier employ similar control loop systems to maintain stability while stationary in the air. Recipe for the system The Ball & Beam system consists of electronics, software and mechanical elements and so makes a nice project to run by a group of students from dif- ferent fields of study. The elements are shown in Figure 1 . The electronics comprises two printed circuit boards: 1. Elektor USB Data Acquisition Card (November 2007). This card has 8 dig- ital inputs, 8 digital outputs, 8 ana- logue inputs and 2 analogue outputs. From all this I/O capacity we employ just one digital output, one analogue output and one analogue input. For a deeper knowl- edge of this card, the article in ref. [1] should be read. 2. Ball & Beam Interface Card. The card described in this arti- cle is used to adapt the Ball & Beam Mechanics to the USB Data Acquisi- tion Card. For software, we add the Ball & Beam PC Program. This application for PC communicates with the Data Acqui- sition Card to send and receive infor- mation from the Ball & Beam mechani- cal assembly through the Ball & Beam Interface Card. It is developed in C + +/ Watch the Elektor Ball & Beam scale model on YouTube 26 elektor - 9/2008 CM2 C * ~ O \ ' mu <> &*£.£ # SOM PC fmiGGAM CLI with the free Visual C + + 2008 compiler (Express Edition) availa- ble on the Microsoft website). Lastly, the mechanical assembly is a scale model made of methyl- acrylate (methacrylate or Per- spex™) which has a V-shaped beam in which a steel ball can roll. It includes a potentiometer (made from resistance wire) to determine the position of the ball on the beam, and a servo to make the beam swing up and down. USB data acquisition card From the USB Data Acquisition Card, the following resources are used: and, therefore, the angle of the beam. 3. RDO — this digital output is availa- ble on pin 1 of Kl. An LED is connected to it, which will blink at the PID sam- pling frequency F s when the system is operating. Ball & Beam interface card thought of as consisting of three parts. 1. LED — this indicator (with its asso- ciated current limiting resistor) is con- nected to the RDO digital output on the USB Data Acquisition Card. The Ball & Beam PC program will make this LED blink to the sampling frequency F g . 1. ANO — this analogue input is avail- able via pin 1 of connector K5 on the card. This input receives a voltage pro- portional to the position of the ball on the beam. 2. CCP1 — this analogue output is found on the pin 1 of connector K4. It is programmed to control the servo posi- The Ball & Beam Interface Card was purposely kept a simple as possible, using cheap and easy to find compo- nents. The price to be paid for this sim- plicity is some tolerance but that’s not a problem since we have an adjust- ment process available. The circuit diagram of the interface card is shown in Figure 2. It can be 2. Filter — this is for the ball posi- tion ‘potentiometer’. As the steel ball touches two lengths of Nickel-Chrome wire, on occasions false contacts will be produced which would give wrong values. To counteract erratic values as much as possible, a low-pass filter consisting of R1 and Cl is included. 9/2008 - elektor 27 PID BALANCING ACT K5\J^ 1 ^ J 1 •* I u ^ • • ©Elektor 070148-1 EH SI at* 153 D2 R7 Ball & Beam PC Program USB Data Acquisition Card K5 Y7 K4 ^©Elektor 080002 - 1 ^' VI . 1 / /. K f ri~il K4 fa>» K1 K2 m 1® # R1 vjv C7 ®-®-||-® ® i f i t© ® 60® R2 * «T i» 1 T 1 g — 3) ® IC2 ■ Hb 3 * 05 V. R 7 W 0O®R4 K3 ©i — i© o-ii-o-o HI-©-© | © I l ®R8 C 8 £ ® i k 5 k a ■ 9 «=>® o:e®c=)®[:: n 0C3 C3 K6 R1 ° C2 ©cm® R12 ■ ■ i ■ S ■ ■ ■ ■ ■ K2^ Ball & Beam Interface Card K1 o POWER C n I I I °V o o* i 3 I 3 °V o O* Dual External Power Supply 1V3 dc Ball & Beam Mechanics Ball < — — > Beam T T ] 080002-11 Figure 1. Overview of electronic and mechanical components connected up. This 6 dB/octave (first order) filter effectively sits between the ball posi- tion ‘potentiometer’ and the ANO ana- logue input on the USB Data Acquisi- tion Card. The simulation result of this filter is shown in Figure 3. Note that the roll-off frequency is very low at just 7.5 Hz, but enough to perfectly register the ball position due to the movement by the beam. 3. Pulse generator to the servo — the beam slope is determined by the posi- tion of a servo. The beam will remain horizontal if the servo is in the cen- tre position. If the servo spindle is at one extreme, the beam slopes some 15°. If it is at the other extreme, the beam slopes 15° opposite. The signal fed to a servo is composed of pulses with a frequency between 50 Hz and 60 Hz. The pulsewidth determines the servo position and varies between 1 ms and 2 ms. The servo’s central position corresponds to 1.5 ms. These times may vary slightly from a servo manufacturer to another. The pulsewidth is controlled by the CCP1 analogue output on the USB DAQ Card. The relevant electronics is simple: one astable and one monostable imple- mented using the ICM7555 or TLC555, i.e., the low-power CMOS version of the famous LM/NE555 (which, by the way, should not be used). Both IC1 and IC2 are supplied from the USB port on your computer through the USB DAQ Card. More on the 7555 and relevant calculations in the inset. Around IC2 a monostable has been assembled. Its trigger signal is pro- vided by IC1; that is why the pulses generated by the monostable have the same frequency as the IC1 astable. The output pulsewidth controls the servo position and must have a fre- quency between 50 Hz and 60 Hz. The monostable pulsewidth should vary between 1 ms and 2 ms (typically). The pulsewidth is determined by the CCP1 analogue output. CCP1 supplies a PWM signal with a frequency of about 2.9 kHz whose average in volts can be calculated with the expression: ^ccpi — Where D is a constant between 0 and 1. As the CCP1 signal is going to mod- ulate the monostable’s pulsewidth, it is necessary to filter it to turn it into a continuous level. This is done by R5, C4, R4 and C5, the components form- ing a low-pass filter of modest fea- tures with a roll-off at about 30 Hz. That’s high enough for the sampling frequency F s and low enough for sup- pressing harmonics of the 2.9 kHz PWM signal on CCP1. The slope of the filter is 12 dB/ octave (2 nd order). Notice that the charging of the monostable’s capacitor is not done with the usual simple resistor — here, a constant-cur- rent source is used. Built around Tl, it keeps the capacitor’s charge build- up linear, enabling the monostable pulsewidth to vary in linear fashion with the CCP1 signal. The constant current flows in Tl’s collector line and is adjusted by PI. See the Monostable IC2 dimensioning inset for the compo- nent value calculations. The servo, besides the pulse signal, needs a supply voltage. As its current consumption is rather high (hundreds Provide video proof to Elektor if you did the project with a ball heavier than 1 kg. 28 elektor - 9/2008 Vcc O R11 § CO R © DIS IC1 THR OUT TLC555 TR CV -L m C6 "on C7 ^ToOn ^ BC557B CO K4 R © DIS IC2 THR OUT TLC555 TR CV -L in K6 C8 lOOn R1^ Ik D1 +5VO O O 2 _ 4_ 6 _ 8 _ 10 JL + SERVO K5 BWn/% +5VDC O I (SERVO) K3 R4 R5 C5 lOOn C4 lOOn +5VO- O O 2 _ 4_ 6 _ 8_ 10 ->K4 +5V POTENTIOMETER R2 K1 K2 Ik lOOn Cl 22u 16V +5VO O O 2 _ 4_ 6 _ 8_ 10 — >K5 080002-12 Figure 2. Circuit diagram of the Ball & Beam interface card. of milliamps), it is impossible to supply it from the USB DAQ Card (remember where that card gets its power from?). Hence it is essential to power the servo from an external supply rated at 5 V and 1 A, connected up to K5. Construction The component mounting plan of the circuit board designed for the interface card is shown in Figure 4. As usual the true-scale copper track layout (reflected and non-reflected) is in a free .pdf file found on www.elektor. com/080002 i.e. .the web page for the project. Construction of this board should be a breeze as only traditional through-hole components are involved. The Ball & Beam PC program The program developed for the project implements a discrete PID controller with an F s (sampling frequency) of 10 Hz. The PID mathematical deriva- tion is given in the PID maths inset. The PC program is also a free down- load from the project web page. All PID parameters can be controlled and observed in the program, see Fig- ure 5. A brief program description is given below. • MAIN. Using START, you launch the system and with PAUSE you stop it. You can adjust the reference (desired position of the ball on the beam) by adjusting r(n). • PARAMETERS. Here the PID control- ler’s kp, ki, and kd constants can be adjusted. For each of these there are two scales: 1 and 10. • VARIABLE CHART. This shows the evolution of r(n), y(n), e(n), u(n) sig- nals. These are, respectively: refer- ence (desired position of the ball on the beam); real position of the ball on the beam; error and PID controller out- put to the servo. The starting numbers and end of scale remain in black if the value is positive and they change into red for negative values. • TERM CHART. Here you can view the evolution of proportional, integral, derivative (PID) terms, as parts of the controller maths. As before, black is positive and red is negative. • EXPRESSIONS: In a frame you view the mathematical expression used for the PID controller implementation. • GRAPH. There are two charts: the first one is the whole system’s block diagram consisting of the discrete PID controller (implemented by software in the Ball & Beam Program), a D/A con- verter and an A/D (both on the USB DAQ) and the ‘continuous plant’ which is the Ball & Beam mechanical assem- bly. The Ball & Beam Interface Card only adapts the USB Data Acquisition Card to the Ball and Beam mechanics, that’s why it does not appear in the Figure 3. Frequency response of the filter designed for the wire potentiometer. 9/2008 - elektor 29 PID BALANCING ACT How this acts like a potentiometer is illustrated in Figure 6. If the ball is at the left end of the beam, the voltage between the wires is (close to) 0 V. This voltage keeps increasing as the ball moves to the right, until getting to a maximum of 1.3 V. The servo used is the Futaba type S148 or equivalent. It is connected to K4 on the Ball & Beam Interface Card. The servo’s white wire connects to pin 1 of K4, the red one to pin 2 and the black one to pin 3. Figure 4. PCB design for the interface. The copper track layout is a free download. COMPONENTS LIST Resistors R1 = 1 20kf2 R2,R7,R12 = IkQ R3 = 10D R4,R5 = 47kQ R6 = 220kf2 R8,R9 = 2kQ 7 RIO = 270kQ R1 1 = 1 kQ5 PI = 5kf2 preset Capacitors Cl = 22jL/F 16V radial C2 = 1 00yL/F 16V radial C3,C6,C7,C8 = lOOnF C4,C5 = lOOnF Semiconductors D1 = LED, low current, 3mm T1 = BC557B IC1 ,IC2 = TLC555 or ICM7555 (do not use plain 555) Miscellaneous K1,K3,K6 = 1 0-way boxheader K2,K5 = 2-way SIL pinheader K4 = 3-way SIL pinheader PCB, ref. 080002-1 from www.thepcbshop. com PCB artwork, free download from www. elektor.com/080002 Project software, free download from www. elektor.com/080002 block schematic. The second chart, located in the lower part of the screen, shows the evolu- tion of a selected (n) function. The sig- nal can be any one of those included in the VARIABLE or TERM CHART. By clicking on its name, it will appear represented. The program was written using C + + / CLI with the free of charge Visual C + + 2008 (Express Edition) compiler. The most important function is called ‘Void timerl_Tick’ and it is found in the archive ‘Forml.h’. In this function, among others, sits the discrete PID controller code. The free of charge .NET XYGraph was also used for the control of compo- nentXtra.com. Ball & Beam mechanics Parts lists, parts photos and details of the mechanical assembly of the Ball & Beam scale model may be found in a supplementary document that can be downloaded free of charge from the project web page as archive file 080002-W.zip. The document also has an interesting discussion on selec- tion of the ball material (steel) and its weight (approx. 64 g). The beam has two wires made of nickel-chrome (NiCr 80%/20%) between which the ball rolls. The steel ball rep- resenting the wiper, the lot acts like a linear potentiometer (or ‘rheostat’) that’s perfect to determine the ball position on the beam. The resistance wire is normally used for manufactur- ing and repairing heating elements. The wire has a diameter of 0.5 mm. Resistivity for the nickel-chrome wire at 80%/20% is about 1.1 Q mm 2 /m. The beam length being 40 cm, the resist- ance works out as 40- 10~ 2 196.35- 10 -3 2.24Q S = jt • r 1 = Jt + 5 ^ 2 / 1 96.35mm 2 Starting up The USB DAQ Card connection to the PC and the installation of the corre- sponding driver is explained in [1]. Once the USB DAQ is installed, you can launch the Ball & Beam PC pro- gram. Make sure that the application is stopped (Status: STOP). Connect the 5 V, 1 A external power supply and adjust preset PI until the ‘C’ arm (see mechanical assembly document) gets horizontal — the beam must be horizontal too. Click on the START but- ton (Status: RUN); this will take con- trols r(n) and kp to their highest posi- tion (the latter in the x 10 scale), whilst checking that the ‘C’ arm is at an angle of 30° to 50° relative to the base. Then stop the application (Status: STOP). Now put the ball on the beam and connect the 1.3V/1 A auxiliary power supply. Move the ball by hand to the far right of the beam, keeping it there, and write down the voltage meas- ured across resistor R2. This should be approximately 1.3 V. Adjust the aux power supply to get exactly 1.3 V. Now everything is ready for the first try. Maiden run Push the START button on the program and slide reference r(n) to the middle. Slowly raise the kp proportional con- stant until the ball rocks slowly on the beam. Carefully increase the derivative constant until the ball is stable. If so, push it a little by hand — the system should respond by keeping the ball steady. Now increase the integral constant little by little until the error is elimi- nated and the ball is steady as before, but this time approximately in the mid- dle of the beam. Got it! PID in action. . . tell everyone about it at College and in the Elektor forum! From here, you and your classmates can try as much you want, for example: 30 elektor - 9/2008 • choose different positions for the ball using r(n). • Make the system respond slower or quicker, with increased or reduced accuracy, with more or fewer tendency to oscillation, and so on, by changing kp, kd and ki. • study the system’s maths and adjust the constants for determined starting premises. About Windows MS Windows is not a real-time oper- ating system. In fact, it’s constantly waiting for events coming from periph- erals (keyboard, mouse, etc.) and from applications. This can affect our sys- tem’s sampling frequency F s hence cause irregularities in the operation (the Ball & Beam Interface Card LED will be our witness). To counteract this inconvenience as much as possible, certain precautions must be taken: • Use a PC with fast CPU and a vast amount of RAM memory. • Execute the Ball & Beam PC program only. Pull the plug on MSN & Co. • Give your application a high level of priority in the Windows multitasking scheme (this is done by the program). • While the Ball & Beam PC program application is executing, do not maxi- mize not minimize windows or push the Start button, etc. Allow the PC to interact with the application only. If you stick to the above guidelines, the sampling frequency will be practically free from irregularities. If something does not properly work If something does not work, take some time to read this section, it will help you locate the cause either in the PC program, the interface card, or the mechanical assembly. First, make sure of a running, fully updated Windows XP or Vista. Ball & Beam does not work under Windows 2000 or lower. Also check if you have the latest update of .NET Framework (from version 3.5). The executable program Ball_Beam. exe is in the same folder as mpus- bapi.dll and XYGraph.dll. To run the program under Windows Vista, right- click on ‘Ball_Beam.exe’ and from the context menu choose ‘Execute as Administrator’ . (ICMJ7555 astable multivibrator The (ICM) 7 555 chip is the CMOS low-power version of the renowned LM555/NE555. With it, RC timers can be easily designed. Its functional schematic is given below. For some later calculations, it is necessary to know the value of R. For the present applica- tion, measurements indicate that a value of 100 kU is best. The signal generated by the astable multivibrator around IC1 is periodical but with the High level time much longer than the Low level time. The Low level pulse is used for triggering a second 7555 (IC2) wired as a monostable multivibrator. Theoretically, the signal the astable should supply at its output (pin 3 of 1C 1) is: 5V 0V i _r mj LT V T 080002 - 15 t H = (£10 + R\ 1) • C6 • ln2 = {210k + 1*5) • lOOw • 0.69 = \%.lms t L = RU- C6-ln2 = l£5 -10072*0.69 = 103.5 s T = t H +t L =l%. 7 ms + 103.5 s = 1 8.8722s F = — = — - — = 53.2 Hz T 18.8 ms The actually measured values are: t H — 1 8 ms t L — 1 00 jL/S T= t H + t L =18. 1ms, hence F = 1/T = 55.2 Hz The program has been successfully tested on Windows XP and Vista PCs without encountering any problem. However, the program may indicate some error if there is a problem with the USB Data Acquisition Card. If so, go back to ref. [1]. Note that a correc- tion was published for the project. If the program is modified, it must be compiled again with the Visual C + + 2008 Express Edition — do not use the 2005 version. Besides, you should have NET XYGraph and Visual C + + 2008 Express Edition, all correctly registered. The program needs a screen resolution of at least 1280x1024 so send the old 15 inch CRT off to recycling along with the 486 or Win98 PC. On the Ball & Beam Interface Card it may happen that it is impossible to get the adjustment done properly. This is probably due to tolerances, mainly in the internal voltage divisor of the (ICM)7555 or TLC555 integrated cir- cuit (in the prototype we used a Philips IC). With an oscilloscope, check up the signal on IC1 pin 3 (0 V and 5 V levels, frequency between 50 Hz and 60 Hz, low level of some 100 ps). If not, IC1 is probably at fault or you have mounted a wrong component value. If it proves impossible the get the ‘C’ arm horizontal by adjusting PI, change C8 to a different value (47 nF or 150 nF). If during the start-up the ‘C’ arm is noticeably higher than 30-50° relative to the base, try different values for R4 and R5 (68 kQ or 100 kQ). 9/2008 - elektor 31 PID BALANCING ACT tu.fc i nriy Ft w p>_L OWfl [ 1 *P !» N 1. i ;: y_AJ 1 0? * ii+jyj £=i -'W ■ I M i,*— ■ L« ■ iw» I «tt 5wJ WM If it’s External power supply Figure 5. The Ball & Beam PC software in action. Food for C++ programmers and quite a lot to tweak to get the ball stable on the beam! Figure 6. The position of the ball on the beam is read by a DIY rheostat or wire potentiometer. Monostable IG2 dimensioning The expected signal at the monostable output (pin 3 of IC2) is: n n n tpULSE 1 T 080002- 16 Allowing for a little headroom at either extreme, the servo timing range of 1 .0 - 2.0 ms is calculated from C8-L7. t cv PULSE I 01 = 5- (2 -R) R6 ( R4 + R5 ) 7? + [(2-i?) R6 (i?4 + i?5)] + U CCP\ R R6 (2-i?) (i?4 + i?5) + [i? R6 (2-i?)] 1 .65 + 0.54 • U qqp\ R=100K / 5- R1 R9 + R1 -Uy Q\{a=0.2) (R% + a- P\) = 203 A U y=0.6V * PULSE CZ-Ucv _ 100hF- (1.65 + 0.54 -U CCPl ) I Ql ~ 203 A 0.8 ms@U CCpl =0V 1.5 ms@U ccpl =2.5V 2.1 ms@U CCpl =5V Note that the variation of f PULSE > s linear with respect to U CCP1 . In practice, the pulse durations obtained after adjusting PI are well within the range 1 ms to 2ms. PID maths n — 1 u(n) = k p • e(n) + k. •Ts'/ j e(i) + k d • i=0 / e(n) — e(n — 1) N v Ts y 1 Ts = — Fs e(ri) = r(ri)-y(ri) been necessary to change C8, R4 and R5, check the signal at IC2 pin 3 (levels 0 V and 5 V, frequency between 50 and 60 Hz, high level of 1.5 ms). For this last measurement, the Ball & Beam PC pro- gram has to be halted (Status: STOP) and PI adjusted to reach the indicated 1.5 ms. If everything is correct so far, ask your- self if the Ball & Beam Interface Card and the servo are properly powered, the latter from the 5 V / 1 A supply. Finally, are you powering the wire potentiometer with an external power supply of approximately 1.3 V and a minimum current of 1 A? If so, all that’s left to do is verify the mechani- cal assembly. ( 080002 - 1 ) Reference [1] USB Data Acquisition Card, Elektor November 2007. www.elektor. com/0701 48 About the Authors Jose Luis Ruperez Fombellida and Jose Manuel Escobosa Bravo are teachers in electronics at San Bias Secondary School, Madrid, Spain. 32 elektor - 9/2008 We add value to PCBs when others just sell them. - One Stop Manufacturing Service - Free Electronic Components - Free Prototyping Assembly - Professional Consultant www.EzPCB.com Email: sales@ezpcii.com MODEL TRAIN CONTROL Digital model control with the ARM7 Patrick Smout Electronics is making more and more inroads into the domain of model trains. Trains are now controlled with digital codes, and in many cases the entire system can be operated from a computer. In this article we present a design for the device that forms the heart of a digitally controlled model railway: the DCC Command Station. The computing power in this design is provided by a high- performance ARM7 processor. One of the key elements of a modern digitally controlled model railway is the control unit that produces the dig- ital signals for controlling the locomo- tives. This device also has several sec- ondary functions, such as communicat- ing with a PC. This article describes a control unit (called a ‘Command Station’ in model railway jargon) that employs the DCC standard and is built around a power- ful ARM7 processor, which is also used on the Elektor ‘ARMee’ board. First a brief introduction to the topic. With conventional analogue control of a model railway system, the speed of the locomotives is adjusted by varying the voltage on the track. The simplest arrangement consists of a transformer and a potentiometer, possibly comple- mented by a rectifier. More advanced systems use pulse-width modulated (PWM) signals. The principal advan- tage of this approach is improved run- ning characteristics. This is quite nice, but even with these systems it is very difficult to control other functions in a locomotive, such as sound effects or a smoke generator. If a decoder is fitted in the locomotive and the transformer is replaced by an electronic control unit with a track booster, we enter the realm of digitally controlled model railways. The electronic controller that makes all this possible is called a ‘Command Sta- tion’. The Command Station described here is suitable for systems that employ what is called the ‘DCC standard’. DCC is not the only method for digital con- trol of model railways, but it is one of the few methods that is not tied to a specific manufacturer. The advantages of digital train control can be summarised as follows: • Dramatically improved locomotive running characteristics, especially at low speeds and on uphill grades. • Individually switchable auxiliary func- tions in locomotives, such as sound effects, smoke generators, remote decoupling, and lighting (including when the train is standing still). • Several trains can travel on the track or in the same block at the same time. • A computer can be added for easy automation of control and protection functions. An additional benefit of the system described here is: • The standard is widely used, so prod- ucts from different suppliers can be used ‘mix and match’ in the same system. A brief history of DCC Despite what you might think, DCC (which stands for ‘Digital Command Control’) is not new. The history of DCC goes back to the late 1980s. At that time a working group of the National Model Railroad Association (NMRA), an umbrella organisation of model rail- way enthusiasts in the USA, was look- ing for a standard that could be used 34 elektor - 9/2008 Structure of a digitally controlled model railway A digitally controlled model railway consists of the following functional blocks (see Figure 1): • Transformer. Every system needs a source of power. • Decoder. This processes the signals that originate from the Command Sta- tion and are placed on the track by the booster. A decoder can be fitted in a locomotive, but it can also be used in a fixed location for controlling compo- nents such as turnouts and signals (in the latter case, it is called an accessory decoder). A remarkable aspect of these decoders is that they receive power and digital signals via the same leads, so there is no need for separate power leads. As each decoder has a unique, configurable address, it is easy to connect several decoders to the same track. Each decoder only responds to the information intended for it. for digital control of model trains. The commercially available systems at that time were proprietary and mutually incompatible. After an extensive study of the avail- able systems and a few diversions, in the early 1990s the NMRA decided on a system developed by Lenz, a Ger- man company. Reliable data transfer and interference-free operation were naturally the most important criteria for their choice. In addition, the new standard had to be able to evolve with the available technology and satisfy new requirements arising in the model railway world. The requirements and expec- tations that the new standard must fulfil were specified by the DCC work- ing group of the NMRA in documents called ‘Standards’ and ‘Recommended Practices’ (RPs). The electrical prop- erties that the signals must fulfil, as well as the form and content of the transferred data, are defined pre- cisely. Among other things, the recom- mended practices define the require- ments that must be met by the dig- ital boosters that supply power to the model railway. Figure 1. Block diagram of a model railway system with digital control. • Occupancy feedback detectors. These are used to keep track of which parts of the track are occupied or free. For this purpose, the track is divided into a number of small sections, with one rail of each section electrically insulated from the adjacent sections. The insulated rail of each section is connected to an occupancy feedback circuit. In its simplest form, this is a current detector. If a section is occu- 9/2008 - elektor 35 MODEL TRAIN CONTROL 36 elektor - 9/2008 +1V8 +3V3 Figure 2b. Schematic diagram of the ARM module. pied, there will be a measurable cur- rent consumption (even if it is rela- tively small). The measured signal is usually sent to the Command Station in the form of a binary signal. • Hand controller (also called a cab controller, after the driver’s cab of a locomotive). The hand controller replaces the traditional rotary knob on the transformer, and it also pro- vides some extra functions, such as switching lights and sound effects on and off. Each controller can control its own locomotive, but it is also possible to operate several locomotives with a single controller. • PC. Although a PC is not absolutely necessary, including a computer in the system adds a lot of extra scope to digital model railroading. In the simplest case, it can be used to dis- play the track occupancy data. Natu- rally, a lot more is possible. There are various software packages available, both commercial and free, that can handle the entire control and protec- Figure 2a. Schematic diagram of the DCC Command Station. The ARM module is fitted onto connectors K1 and K2. tion functions of a railway. This cer- tainly doesn’t have to spoil the fun of a model railway - while you are piloting a goods train through the marshalling yard just like a real engine driver, the PC ensures that no disasters occur in other parts of the system. • Booster. As a respectable model rail- way system can consume a consider- ably amount of current, one or more boosters are used to supply power to the track. If several boosters are used, they are all driven from the same Command Station. In this case, each booster supplies power to a portion of the track system. • Command Station: the heart of the system. Its most important task is gen- erating the digital signals that control the locomotives and all other digital components in the railway system. In addition, the Command Station looks after communication with one or more hand controllers, which are usually connected to a bus. The bus used here is called XpressNET, which is a polled single-master EIA 485 bus. A link to the occupancy feedback detec- tors is also essential. A separate bus can be used for this purpose, but in mikrollektronika DEVELOPMENT TOOLS | COMPILERS | BOOKS With useful implemented peripherals, plentiful practical code examples and a broad set of add-on boards, mikroElektronika development boards make fast and reliable tools that can satisfy the needs of experienced engineers and beginners alike. €asyAVR5A with on-board USB2.0 programmer The system supports 8, 14, 20, 28 and 40 pin microcontrollers (comes with ATMEGA16). Each jumper, element and pin is clearly marked on the board. It is possible to test most industrial peripherals on the system: temperature controllers, counters, timers etc. Touch screen controller with connector is available on-board. EasyAVR5A is an easy-to-use Atmel AVR development system. On-board USB 2.0 programmer makes your development easy. Examples in BASIC and Pascal language are provided with the board. BIGAVR2 with on-board USB2.0 programmer The system supports 64-pin and 100-pin AVR microcontrollers (comes with ATMEGA128 working at 10MHz). Ready to go examples guarantee successful use of the system. BIGAVR2 is an easy to use Atmel AVR development system. BIGAVR2 has many features that makes your development easy. You can choose between USB or External Power supply. BIGAVR2 also supports Character LCD as well as Graphic LCD. Touch screen controller with connector is available on board. Add-On Boards A wide range of additional daughter-boards for development systems Please visit our web page for more info http://www.mikroe.com ADC Board - 12-bit analog-to-digital converter (ADC) with 4 inputs. DAC Board - 12-bit digital-to-analog converter (DAC) with SPI. Keypad 4x4 Board - Add keypad to your application. Accel. Board - Accel, is an electronic device that measures acceleration forces . 5V-3.3V Voltage Translator - Use 5V in 3.3V voltage sys- tems with LVCC3245A 8-bit - non-inverting bus transceiver on-board. 3.3VReg Board - Voltage regulators Specifically designed for use in low input voltage applications. 5V-3.3VReg Board - This regulator can provide local on-card regulation changing your voltage from AC/DC 8- 16V to 5V or 3.3V. 9/2008 - elektor 37 MODEL TRAIN CONTROL DCC: what and how A DCC signal consists of an AC voltage in which the digital information is encoded in the lengths of a series of pulses. The half-bit time for a '1 ' bit is 58 ps, so the transmission time for a '1 ' bit is 1 1 6 jits. The half-bit time for a 'O' bit is at least 1 00 jus. In principle, the two half-bit times for a '0' bit should be the same to avoid producing a DC po- tential on the track. However, the standard allows the stretching of '0' bits in order to intentionally superimpose a DC voltage on the traction volt- age. This can be used to operate an analogue locomotive without a decoder on the track at the same time. This possibility is not utilised in the Command Station described here, and the half-bit time for a logic '0' is set to a fixed value of 1 1 6 jus. The transmission time for a '0' bit is thus 232 (is with this Command Station. Messages are sent in the form of data packets. The structure of a standard packet can be described briefly as follows: - Preamble: a series of at least 14 '1' bits preceding the start of a new packet. - Packet Start Bit: a '0' bit that marks the end of the preamble and the start of the address. - Address Byte: a series of 8 bits that indicates the address (or part of the address) of the decoder for which the data is intended. - Data Byte Start Bit: a '0' bit that marks the start of the data. - Data Bytes: several groups of 8 data bits with '0' bits as separators between the groups. This part of the package contains the supplementary address, instructions, data, and a checksum. - Packet End Bit: a '1 ' bit that marks the end of the packet. Example: An order for setting the direction of travel and the speed (in 28 individual steps) is constructed as follows: 11111111111111 0 AAAAAAAA 0 0 1 DSSSSS 0 EEEEEEEE 1 Preamble Address Instruction Checksum AAAAAAAA D SSSSS EEEEEEEE Address of the target locomotive for the instruction Direction of travel (1 = forward) Speed Checksum (XOR of the previous bytes excluding the preamble - in this case [AAAAAAAA] ^ [01 DSSSSS]) A bit stream for setting locomotive number 83 to forward motion with a speed of 0 thus takes the form: 11111111111111 0 0101001 1 0 01 1 00000 0 00110011 1 The signal waveform of an order could be: 070989 - 13 A complete description of the standard, including a summary of all the instructions, is available at the NMRA website (www.nmra.org) on the i DCC working group activities page i L ____ ____ ____ ____ ____ ____ J practice these devices sometimes share the cab bus. We decided to use a separate bus for this in our design: the S88 bus. Finally, there is the link to the com- puter, which in this case is an RS232 port. Thanks to the use of an open pro- tocol that is supported by a variety of software packages, expansion is problem-free. Schematic diagram The circuit shown in Figure 2 is built around an LPC2106. This is a powerful 16/32-bit NXP microcontroller based on an ARM7TDMI-S processor core with a maximum clock rate of 60 MHz. The microcontroller has 128 kB of flash EE PROM and 64 kB of RAM, which are more than adequate for quite a few projects. There are also two 16C550- compatible serial ports, two versatile 16-bit timers, an I 2 C interface, and an SPI interface. A maximum of 32 I/O lines are available for connection to the outside world. The microcontroller is shown in the middle of the schematic diagram in the form of a separate daughterboard, which some readers will certainly find familiar. This board (o/n 040444-1) was 38 elektor - 9/2008 used earlier in another Elektor design: the ARMee’ project published in April 2005. Practically all important signals are fed out via two connectors (K1 and K2). The board is powered from +5 V. The 1.8-V and 3.3-V supply voltages required by the microcontroller are generated on-board. The 3.3-V supply is also made available via the connec- tors for I/O devices that require a lower supply voltage. Unfortunately, the LPC2106 does not have an internal EEPROM. As quite a few things must be stored in non- volatile memory in the Command Sta- tion, we remedied this shortcoming by using a small external EEPROM (IC8, 8 k x 8). Fortunately, the link to the microcontroller is quite simple because we can take advantage of the micro- controller’s standard I 2 C interface. As there is only one device on the I 2 C bus, addressing is unnecessary, so the E0, El and E2 address pins of the EEP- ROM are tied to ground. R12 and R13 are pull-up resistors, which are neces- sary for proper bus operation. An RS232 interface is provided for com- munication with the computer. Half of a MAX3232 powered from the 3.3-V rail provides level shifting for the Transmit and Receive lines of UART 0. Using UART 0 for the computer link also pro- vides a convenient way to download new software via the built-in boot loader. The pin assignments of K5 cor- respond to a DCE (such as a modem), so a standard one-to-one cable (avail- able in every computer shop) can be used for the connection between the control unit and the computer. The other half of the MAX3232 provides the level shifting necessary for driving an external track booster. This signal is fed out via K4. This connector also has a pin for a short-circuit feedback signal. If the signal on pin 1 is pulled to ground (by the booster), the control unit will disable the output. The connectors for the hand control- lers, which are driven via XpressNET, are located at the right. The hardware is a standard EIA 485 port implemen- tation. Driver IC8 (LTC1485) provides the signal shaping. Resistor R8 ensures that the line is terminated properly. Although this is not especially criti- cal at the data rate used here, it’s bet- ter to be safe than sorry. Resistors R7 and RIO hold the Transmit and Receive lines in a defined state when they are not being driven by a device on the bus. This prevents the receivers from picking up invalid data due to inter- ference coupled into the floating bus lines. RJ-12 6P/4C modular connectors or plug-and-socket connecters can be used to connect the hand controllers to the network. There are two relays at the bottom middle. The contacts of relay RE2 can be used to connect the traction voltage from the booster to the main line, while the contacts of RE1 can be used to connect the booster output to a separate programming track. This relay is only engaged if the Command Station receives special programming instructions from the programming software. When this happens, relay RE 2 is released. This ensures that pro- gramming instructions for a locomo- tive on the programming track are not sent to other locomotives on the main track as well. This difference in the intended uses of the two relays is the reason for the additional circuitry around relay RE1. This is a simple current detector that senses the acknowledgment pulses generated by the decoder during a pro- gramming session. An acknowledge- ment pulse is generated by causing the current consumption to rise to at least 60 mA for a defined time (approx- imately 6 ms), for example by briefly switching on the motor. The presence (or absence) of these acknowledge- ment pulses enables the control unit to put together the response from the decoder. The decoder current flows through R16 during the programming session. This resistor thus determines the sensitivity of the detector. Four fast diodes (two pairs of diodes con- nected head to tail, since the track booster supplies an AC voltage) limit the voltage across the sense resistor to twice their forward voltage drop. Two diodes connected in series are used here to ensure that T1 can be driven into conduction at a suitable level. Rll and C4 form a low-pass filter that sup- presses noise pulses. The LED in opto- coupler IC7 is driven by the signal on the collector of Tl. The collector cur- rent, and thus the current through the LED, is determined by resistor R15. The optocoupler (which provides elec- trical isolation from the traction volt- age) supplies the ack pulses to the microcontroller. Connector Kll is used for the JTAG port. SI is reset button. If you want to develop your own software for this mikrollektronika DEVELOPMENT TOOLS | COMPILERS | BOOKS With useful implemented peripherals, plentiful practical code examples and a broad set of add-on boards, mikroElektronika development boards make fast and reliable tools that can satisfy the needs of experienced engineers and beginners alike. 5 with on-board In-Circuit USB2.0 programmer & debugger EasyPIC5 supports 8-, 14-, 18-, 20-, 28- and 40- pin PIC microcontrollers (comes with the PIC16F887). The mikrolCD (In-circuit Debugger) enables very efficient debugging. Examples in C, BASIC and Pascal language are provided with the board. EasyPIC5 comes with the following printed documentation: EasyPIC5 Manual, PICFIash2 Manual and mikrolCD Manual. BIGPIC with on-board In-Circuit U5BE.O programmer & debugger MICROCHIP PIC BOARD System supports the latest (64) and 80-pin PIC microcontrollers (comes with PIC18F8520). Many of ready to go examples in C, BASIC and Pascal language guarantee successful use of the system. A Touch screen controller with connector is available on board. This development board has an on-board ultra fast USB 2.0 programmer, mikrolCD (In-circuit Debugger) and integrated connectors for MMC/SD memory cards, 2 x RS232 port, RS485, CAN, on-board RTC, PS/2 connector, DAC etc... Add-On Boards A wide range of additional daughter-boards for development systems Please visit our web page for more info http://www.mikroe.com CAN-1 Board - Interfaces CAN via MCP2551. CANSPI Board - Makes CAN network with SPI interface. RS485 Board - Connects devices into RS-485 network Serial Ethernet - Make ethernet network with SPI Interface (ENC28J60). Digital POT - MCP41010 SPI Interfaced digital potentiometer. SmartMP3 Board - VSIOOIk MP3 decoder with SPI Interface. Serial 7-seg Display 2 Board - MAX7219 SPI Interfaced, LED Display Drivers with 8 Common-Cathode LED Displays LightToFreq Board - TSL230BR programmable light-to-frequency converter. 9/2008 - elektor 39 MODEL TRAIN CONTROL Figure 3. The PCB is designed with a spacious layout to make assembly easy. project and you have the right tools, you can use this port for downloading and debugging the program code. It is not used during normal operation in and around a model railway The circuit is powered by a transformer with a secondary voltage of 13 to 14 V connected to K8. A transformer rated at 16 to 20 VA is more than adequate. A standard model train transformer is not especially suitable for this purpose, since it has a slightly higher output voltage (14-16 V AC ), which will cause IC4 to become rather warm. The trans- former voltage is full-wave rectified by a set of four diodes, and the DC volt- age is smoothed by C9. This voltage is then reduced in two stages, first to + 12 V and then to +5 V. The 12-V sup- ply voltage is used directly to power the two relays and the hand control- lers connected to the XpressNET bus. The +5-V supply voltage powers the microcontroller and its peripheral logic. Four ceramic capacitors provide effective suppression of undesirable oscillations. COMPONENTS LIST Resistors R1 ,R3,R4,R6,R9,R1 4,R1 7-R22 = lOkD R2 = 470D R5 = 1 OOkD R7,R10 = 680D R8 = 1 20D R1 1 ,R1 2,R1 3 = IkQ R1 5 = 100D R16 = 8D2 Capacitors C1-C8 / C10 = C13 / C15 = lOOnF C9 = 4700]uF 40V radial Cl 4 = 390pF Semiconductors 01-04,010,011 = 1N4001 D5 = 1N4148 D6-D9 = BYW1 00-200 T1,T2,T3 = BC547 IC1 = MAX3232CPE IC2 = 74HCT1 25 IC3 = 74LS125 IC4 = 7812 IC5 = 7805 IC6 = LTC1485CN IC7 = TLP521-1 IC8 = 24C64 Miscellaneous SI = pushbutton, 6mm, PCB mount RE 1 ,RE2 = 12-V relay, 2x changeover, e.g. Finder type 40.52 Heatsink, Fischer type SKI 04, 25mm, for IC5 Heatsink, Fischer type SKI 04, 35mm, for IC4 K1 ,K2 = 20-way SIL socket K3,K7,K10 = 6-way SIL pinheader K4 = 4-way SIL pinheader K5 = 9-way sub-D socket (female), angled pins, PCB mounting K8 = 2-way PCB terminal block, lead pitch 5mm K6,K9 = 6P4C modular connector, PCB mount, e.g. Hirose TM5RE1 -66 K1 1 = 20-way DIL pinheader K12,JP1,JP2 = 2-way pinheader K13,K14 = 4-way PCB terminal block, lead pitch 5mm K1 5 = 5-way SIL pinheader ARM CPU module (unprogrammed); Elektor SHOP item 040444-91 PCB, Elektor SHOP item 070989-1 1 Kit of parts incl. programmed ARM module; Elektor SHOP item 070989-71 (see www. elektor.com) 40 elektor - 9/2008 The circuitry around IC2 and IC3 is used to read the data from the S88 feedback detectors. The S88 bus is designed as a giant shift register com- posed of the S/R flip-flops of the indi- vidual feedback detectors, which reg- ister their ‘occupied/free’ status until they have been read out serially. Most of this work is done by software run- ning in the microcontroller. The con- tribution of the hardware to this proc- ess is limited to buffering the control signals. IC3 buffers the outgoing sig- nals (Clk, Load, and Reset), while IC2 buffers the incoming signal (Data). The serial data is clocked in at rate of 5 kHz. With the maximum number of detectors that can be connected to the bus (4096 inputs), this means that a full set of inputs can be read 10 times each second. This all works as follows: • Data supplied to the feedback detec- tors in parallel format is loaded from the S/R flip-flops into the shift regis- ter by setting the Load signal high and issuing a clock pulse on the Clk line. • The S/R flip-flops are reset by set- ting Reset High, after which they are ready to register new data. • The microcontroller then reads in the serial data by issuing a series of clock pulses on the Clk line. These signals are output by a 6-way connector (K3). The +5-V supply volt- age on this connector is used to power the connected feedback detectors. Finally, there is one more connector (K15) at the bottom left of the drawing. It supports an alternative bus for the hand controllers and feedback detec- tors. Stay tuned for more information about this. PCB assembly The PCB layout for the Command Sta- tion is shown in Figure 3. Assembling the board is quite straightforward, as there are no components that require special attention. If you allow yourself sufficient time and work attentively, you are bound to achieve a good result. Fit the low-profile components first, fol- lowed by the high-profile components. As the final step, solder the electrolytic capacitor, IC4 and IC5 with their heat sinks, and relays RE1 and RE 2. It is advisable to fit IC1, IC2, IC3 and IC6 in sockets, since they provide the interfaces to the outside world. They bear the brunt of any inadvertent short circuit, and you can replace them eas- ily if they are fitted in sockets. The following components are optional: • JP1 and Kll can be omitted if you do not intend to use the JTAG interface. • For K7/K8 and K9/K10, fit only the connector or connectors that you personally prefer. All four of these connectors are wired in parallel. Initial use and testing Connect the transformer to K8 and switch on the mains voltage. Check the +5-V supply voltage (e.g. between pins 5 and 8 of IC6) and the + 3.3-V supply voltage (e.g. between pins 15 and 16 of IC1). The next step is to download the appli- cation code to the DCC Command Sta- tion. You can use a standard NXP tool for this (LPC2000 Flash ISP Utility). This tool enables you to download code to the processor via the PC serial port. The instructions for using this tool are described in detail in the sup- plementary information for this article on the Elektor website. You can also download the hex code for program- ming the processor from the website. Alternatively, if you buy the Elektor kit for this project you will receive a pre- programmed module. When the Command Station is started up the first time, it reconfig- ures the non-volatile data stored in the EEPROM. This can take a while (around 20 seconds), so you can take a short break before continuing with the next step. Now connect a pushbutton with a make contact (normally- open) between the two pins of K12. This is the Stop / Go / Cold Start button. If you press this button, relay RE2 should engage so the digital signal for driving the booster is present on con- nector K4. Now the DCC Command Station is ready for normal operation. If you press the button again, relay RE 2 is released, and the digital signal is no longer routed to K4. You can also use the pushbutton to perform a system reset. If the Com- mand Station stops responding, even after the supply voltage is interrupted, mikroElektronika DEVELOPMENT TOOLS | COMPILERS | BOOKS With useful implemented peripherals, plentiful practical code examples and a broad set of add-on boards, mikroElektronika development boards make fast and reliable tools that can satisfy the needs of experienced engineers and beginners alike. UNI-DS UNIVERSAL DEVELOPMENT TOOL Thanks to many features UNI-DS3 is the world's easiest to use development board for different types of microcontrollers. The system supports PIC, dsPIC, AVR, 8051, ARM and PSoC microcontrollers with a large number of peripherals. In order to continue working with different chip in the same development environment, you just need to switch a card. You can choose between USB or External Power supply. Each MCU card has its own USB 2.0 programmer! PICPLCI6 with on-board In-Circuit USB2.0 programmer & debugger Minimize your time from prototype to final product by using the market-proven PICPLC16B development board. PICPLC16B is a system designed for controlling industrial systems and machines. 16 inputs with optocouplers and 16 relays (up to 10A) can satisfy most industrial needs. The ultra fast mikrolCD (In-circuit Debugger) enables very efficient debugging and very fast prototype development. Features: RS485, RS232, Serial Ethernet, USB 2.0 programmer and mikrolCD (In-Circuit Debugger) are available on-board. Add-On Boards A wide range of additional daughter-boards for development systems CF Board - Easy way to use Compact flash in your design. MMC/SD Board - Easy way to use MMC and SD cards in your design. EEPROM Board - Serial EEPROM board via I2C interface. RTC Board - PCF8583 RTC with battery backup. EasyConnect Board - Connects your peripherals easily and fast using connectors. lrDA2 Board - Irda2 serves as wireless RS232 communication between two MCU’s. Port Expander Board - MCP23S17 is the 16-bit port expander with SPI interface. Easylnput Board - Make input levels easy and fast using high quality DIP switch. Please visit our web page for more info http://www.mikroe.com 9/2008 - elektor 41 MODEL TRAIN CONTROL you can restore it to proper operation by holding the button depressed while switching on the power. This causes all non-volatile data stored in the Com- mand Station to be reset to its default values. This process takes approxi- mately 20 seconds. Now you’re ready to connect the Com- mand Station to the track booster. You can use a DIY booster, such as the one described already in Elektor (EEDTs or EEDTs Pro Booster), or you can use a commercial model (such as the Lenz LV102). The basic setup requires two leads to be connected between the Command Station and the booster: 0 V from pin 2 of K4 and the DCC sig- nal from pin 3. The short-circuit feed- back signal can be connected to pin 1 if desired. When a short circuit occurs, this pin must be pulled to ground, which causes the Command Station to disable the digital signal. 321019 * 0^4 44 dd Control software Various programs are available for using the Command Station described here with a PC to control a model railway system. There is a very nice ‘native Dutch’ program available called ‘Koploper’, which is entirely free (www.pahasoft.nl). It is supported by an active forum where users can find answers to their questions (www. koploperforum.nl). We’re sure these users won’t mind the odd question in English. You can use the ‘PT’ program (also a Dutch product) to program DCC decod- ers. This program also provides exten- sive functions for testing feedback detectors and accessory decoders. You’ll find it at http://people.zeeland- net.nl/rosoft. You can also use ADaPT (Advanced Driving and Programming Tool) from STP Software (www.stp-software.at) to program decoders. Although this soft- ware (available in English and German versions) is not free, it can also be used for locomotive management. Of course, you can also take on the chal- lenge of writing your own software. A sample program for Microsoft Visual Stu- dio Express 2008 is available and can be downloaded free of charge from the project page on the Elektor website. Let us and other readers know how you get on — a simple message in the Elektor forum does the trick. ( 070989 - 1 ) Figure 4. Fully assembled prototype with the ARMee module installed. Web Links DCC: www.nmra.org/standards XpressNET: www.lenz.com P50x: www.uhlenbrock.com Koploper: www.pahasoft.nl PT: http://people.zeelandnet.nl/rosoft NXP: www.nxp.com About the author After the completion of his studies in Telecommuni- cation & Microprocessors, Patrick Smout has been actively involved in electronics product development (hardware and software) since 1 985. In recent years his focus has moved away form hands-on engineer- ing, and he is now the coordinator of the develop- ment department. His first electronic construction projects included the Elektor Junior Computer and all of its subsequently published extensions. These were complemented by DIY extensions, such as a graphics card. His hobbies are model trains and (naturally) electron- ics and embedded software. According to Patrick, the nicest thing about this pro- fession is seeing how a design slowly comes to life, right from the incipient stage, and then watching it travel around the world as a full-fledged product. E-mail: dcccommandstation@versateladsl.be L J 42 elektor - 9/2008 Suppliers uf PGB Soldering Bguipment & Rework Stations On line Price £44 .95 c a 5 ui « m bl H % M +Z IP Wl NEW IN STOCK 328 Working Platform Hri \*!i#& ww w.pcb-so I cferi ng.co.uk E!GC!NH!ltM«JL*3 ModfltSdOfl C■ 2&E B Simply send your files and order ONLINE: PC8-POOL.COM tel. 01298 70012 fax. 01298 70046 www.peakelec.co.uk otBctroiiic (tMlgp j sales@peakelec.co.uk Handheld Test Gear - Cool, Smart. Atlas DCA Atlas ESR Atlas DCA Model DCA55 Semiconductor Analyser Identifies type and pinout! Atlas ESR Model ESR60 ESR and Capacitance Meter Resolution of 0.01 ohms! Atlas LCR*^9 Atlas SCR Atlas LCR Model LCR40 Atlas SCR Model SCR100 Inductor, Capacitor, Resistor Analyser Triac and Thyristor Analyser Automatic part identification. Auto gate test current up to 100mA UK: Please add £1.00 p&p to your order. Prices include UK VAT. Please see website for overseas pricing. 9/2008 - elektor 43 LED LIGHTING Luxury LED Bicycle Brighten your beam and banish burnt-out bulb blues Dr Thomas Scherer Having treated himself to a new bicycle fitted out with all mod cons including a shiny hub dynamo, the author was looking forward to many miles of pedalling pleasure. But then disaster struck: after just a couple of hours use the bulb in the front light burned out! Not finding the prospect of repeated replacement attractive, he set out to substitute a power LED for the bulb. It is not in an engineer’s nature to be satisfied with a simple solution, such as replacing the bulb. It is much more satisfactory to under- stand the problem properly from the ground up, and of course a problem like this can be viewed as an opportunity for a good rummage in the junk box to look for components that might be use- ful in devising a proper solution. Tuning up It often saves considerable effort to spend a few moments with Google before trying to solve a problem for oneself. The author found that the properties of hub dynamos had already been investigated in great depth by others, such as at [1]. However, the Internet is not a com- plete substitute for a proper fault diagnosis. Figure 1 shows that on the author’s lighting set a semiconduc- tor device is wired across the bulb. The type P6KE7.5CA ‘transient volt- age suppressor’ [2] is in effect two Zener diodes back-to-back, designed to clamp excess voltages. From the information in [1] it became clear what had happened. A hub dynamo, even at normal speeds, develops more than the specified 6 V. The suppres- Figure 1. A suppression diode is wired in parallel with the filament lamp in the front bicycle light. Figure 2. The voltage waveform from a hub dynamo is far from sinusoidal. 44 elektor - 9/2008 sor, which is supposed to protect the bulb, is specified for a dissipation of 5 W, and begins to conduct at 6.5 V. At 0.5 A the voltage across the device will be about 7.5 V. (The dynamo can be thought of as a current source; without the suppressor a voltage of between 8 V and 10 V would appear across the bulb.) Even 7.5 V was, in the author’s case, enough to destroy the bulb. Furthermore, the plot of dynamo output voltage against time (see Figure 2) is far from sinusoidal. An enquiry at a nearby shop con- firmed the author’s hunch that he was not alone in his experience: 6 V bulbs were strong sellers. It was interesting to note that the rear light, which used LEDs, had not failed. LEDs with a series current limit resistor dissipate a power that increases linearly with applied volt- age rather than exponentially, and so are more resilient to excessive volt- ages than bulbs. Overture The author had previously experi- mented with white power LEDs for bicycle lighting. At that time only 1 W devices were available, and, when used with a rim dynamo, the LED was not bright enough. Despite its higher efficiency the 1 W LED was not as bright as a 2.4 W filament bulb, although the whiter light was dis- tinctly more noticeable and lifetime was of course better. Act I: Power LED Since then, 3 W LEDs have become available with efficiencies of over 110 lm/W, which is better than fluores- cent lamps: a good start. A simple cir- cuit using a 3 W LED is shown in Fig- ure 3. The circuit achieves just slightly greater brightness than a halogen bulb. The current sourced by a hub dynamo is rarely much more than 0.5 A, and so a typical 3 W LED with a forward voltage of 3.3 V will be dissipating only around 1.6 W. However, the high efficiency of the device means that its light output is nevertheless greater than that of a 2.4 W halogen bulb. Entr'acte For maximum brightness the 6 V out- put of the dynamo needs to be con- verted down to 3.3 V to 3.8 V for the Figure 3. The first experimental circuit for using a 3 W LED in a bicycle light. Figure 4. This final circuit for the bicycle light gets the maximum possible illumination from the 3 W LED. 9/2008 - elektor 45 LED LIGHTING Figure 5. Eagle design files for the printed circuit board are available for download. COMPONENTS LIST Resistors R1 = 2k Q7 R2 = 560C2 R3 = 1 kD8 PI = 1 k£2 preset, miniature, horizontal mounting Semiconductors D1-D5 = SB540 (Schottky)* LED1 = 3W power LED, white* Miscellaneous LI = lOOpH 1 A (e.g. Reichelt L-PISR 100p) Optics for power LED (20°- type)* PCB # 080153-1 (artwork download on www.elektor.com) Capacitors Cl = lOOOpF 35V, radial, lead pitch 5mm C2 = 1 OnF C3 = 470pF 16V, radial, lead pitch 5mm * see text j Figure 6. Very compact prototype of the switching regulator. LED with as little power loss as possi- ble, with a corresponding increase in current to 700 mA. At such low voltages an ordinary- step-down converter will operate at an efficiency of around 80 %. Rectify- ing the AC voltage from the dynamo using a bridge consisting of Schottky diodes will cost a voltage drop of twice 0.4 V, giving an additional power loss of 0.4 W at 0.5 A. Allowing 0.1 W for the rear LED light leaves us with just 2.5 W; 80 % of that is 2 W. Compared to Figure 7. The LED (mounted on its carrier board) and lens are bolted to a piece of aluminium angle to make the lighting module. the circuit in Figure 3 we have gained a meagre 0.4 W. So, theoretically at least, things are not looking good. However, according to [1] hub dynamos can develop up to 12 V. At 0.5 A that corresponds to a power of 6 W. This is more than enough: working backwards from the 3 W required for the LED, we divide by 80 % to obtain an input power to the switching regulator of 3.6 W. At 0.5 A this means a voltage of 7.2 V. Adding on the 0.8 V dropped by a Schottky rectifier bridge, and we need 8 V at the output of the dynamo, which is well within its capabilities. The switching regulator gives us a further advantage: it protects the LED from excessive current and, above a certain dynamo speed, ensures that the light output provided is constant. Act II: The circuit Figure 4 shows a type LT1076 step- down converter [3]. The device requires a minimal number of external compo- nents and draws only 8.5 mA to power its internal circuitry. It operates at 100 kHz, can start up from an input volt- age of 3.5 V and can deliver up to 2 A. D1 to D4 form the bridge rectifier, and D5 is the flyback diode. At 5 A the SB540 is somewhat overspecified for this application; at 0.5 A the diode only drops 0.33 V. Good 1 A Schottky diodes such as the SB 140 can be substituted for D1 to D5, with a resulting drop in overall efficiency of around 2 %. The RC network comprising R1 and C2 connected to pin 2 of IC1 provides fre- quency compensation. The regulator compares the voltage on pin 1 with its internal reference (2.21 V), and so the adjustable voltage divider comprising R2, PI and R3 allows the output volt- age to be adjusted from 2.7 V to 4 V. LI is a fixed 100 /jH inductor designed for operation at 100 kHz and 1 A. A low ohmic resistance increases overall effi- ciency. However, the component is not particularly critical, and even a 100 jl/H toroidal suppression choke will give an efficiency of over 75 %. Act III: Construction and test The printed circuit board (Figure 5) makes construction straightforward. The layout design was done using Eagle, and the design files and a PDF of the layout are available for download from http://www.elektor.com. If IC1 is to be mounted flat against the board its pins must be bent accurately. A small heatsink made from a piece of alumin- ium angle (Figure 6) is adequate. IC1 dissipates a maximum of 0.5 W, so it is also possible to solder the M3 fixing nut to the copper pad on the reverse side of the board. The coil suggested in the parts list is a low-cost SMD component to which two lengths of wire need to be carefully sol- dered. The printed circuit board also has pads for other package varieties. After populating the board and check- ing over the soldering, the circuit can Figure 8. The module from behind: the four plastic lugs of the lens are melted slightly to secure them and the LED is isolated using plastic washers and fixed using M3 locknuts. 46 elektor - 9/2008 be connected to a bench supply or mains adaptor capable of delivering 9 V to 12 V at 0.5 A or more. The output is loaded using a 4 W 4.7 Q resistor. It should be possible to adjust the output voltage over the range given above and IC1 should become gently warm to the touch. With 10 V at the input and 3.75 V across the 4.7 Q resistor the overall effi- ciency of the circuit should be about 75 %: 4 W in and 3 W out. Before turning the circuit off, adjust PI to obtain the minimum output voltage so that when the LED is con- nected it is not immediately overloaded when the circuit is switched back on. Before wiring up the power LED it, and the printed circuit board on which it is mounted, should be bolted to a length of aluminium angle (not forgetting a dash of thermally conductive paste). It is best if the lens is also fixed to the aluminium angle. This makes a com- pact lamp module (see Figure 7 and Figure 8) which has the advantage of not immediately damaging your retina if you look directly into it. The module can be built into the old bicycle lamp enclosure with the filament bulb and suppressor removed. Figure 9 shows the author’s prototype where, with a judicious bit of filing, he managed to attach the module to the inside of the original lens in the lamp. The electron- ics can be mounted in a separate plas- tic enclosure. Finale: Adjustment As explained in the text box, the volt- age across the power LED needs to be adjusted so that the correct current (approximately 0.7 A) flows through it. For maximum LED lifetime (over 20,000 hours) it is essential that this value is not exceeded. With adequate cooling, however, some devices can be run at up to 1 A. The adjustment is straightforward. If we try to measure the current directly by putting a meter in series with the LED the resistance of the meter will significantly affect accuracy, and so instead we connect the LED module directly to the output and measure the input current. Starting at the bottom of the adjustment range (PI set to the far left position) we gradually adjust it until the input current is 0.4 A at 10 V, for a total input power of 4 W. Since the overall efficiency of the circuit is approximately 75 %, this means that the power delivered to the LED is approximately 3 watts. If a 12 V input, for example from a mains adap- tor, is used the corresponding input current is 0.33 A. The forward voltage of the LED falls with increasing tem- perature, and so the current though it will rise. PI will therefore need to be adjusted several times until, after perhaps five minutes, thermal equi- librium is reached. The adjustment is then complete. Warning: never look directly into the LED. The LED also gets hot! Never look directly into a power LED when it is on! Advertisement Jf Helping bring your ideas to reality since 1987. Microcontrollers and accessories for the engineer, hobbyist, and student. www.parallax.com Milford Instruments (+44) 1 977 683665 http://www.milinst.com Parallax 9/2008 - elektor 47 LED LIGHTING Encore! At low road speeds a hub dynamo delivers a low frequency AC voltage. At 5 km/h the LED blinks, becoming steady as the speed rises to 10 km/h. The circuit has not been tested with rim or other types of dynamo. With a bit more pedalling effort (at speeds of over 30 km/h) the voltage from the dynamo, without suppres- sor diode, can reach 12 V. This will not cause any problems for the LED, which is protected by the circuit; however, if an ordinary 6 V 0.6 W filament bulb is used in the rear light it will soon be destroyed. It is therefore recommended to use an off the shelf LED-based rear light as well. The attitude of the governments of some European countries towards our efforts to equip our bicycles with bright and reliable lamps is hardly what one might call ‘enlightened’: in the author’s home country the law specifies the use of filament bulbs in bicycle lights, not- withstanding the fact that a brightly- shining home-made light is a definite improvement on an off-the-shelf regu- lation-compliant light, and much bet- ter again than an ordinary light with a blown filament! ( 080153 ) Links and References [1] Hub dynamo laboratory test: www.vintagebicyclepress.com/VBQgenerator.pdf [2] P6KE7.5CA data sheet: www.fairchildsemi.com/ds/ P6%2FP6KE7V5CA.pdf [3] LT1076 data sheet: www. linear.com/pc/down load Document. do?n avld = H0, Cl ,C1 003,(31 042, Cl 033, PI 007,02659 Light show The power LED is the most important component in this circuit. The photographs show sample devices from three manufacturers, all offer- ing efficiencies of between 90 Im/W and 1 10 Im/W, around the same as a good fluorescent light. Cheaper, but decidedly inferior, 3 W LEDs are also available on the market, but purchasing these is a false econ- omy. It is also best to avoid the 'warm white' variants, which have lower efficiency. The devices shown come mounted on a small printed circuit board which includes an aluminium slug that simplifies extracting heat. When run at 3 W some 2 W is dissipated as heat and a power LED not equipped with cooling will have rather a short life. There are good reasons for operating LEDs at a constant current rather than at a constant voltage. A typical differential resistance for an LED of the kind used in this project might be as low as 0.2 Q, which means that a voltage step of 20 mV gives rise to a current step of 0.1 A. Now, 20 mV is not a large quantity, and the sharp temperature depend- ence of the LED's forward voltage means that a temperature change of 1 0 °C could easily lead to a current change of more than 0.1 A. Unfortunately most switching regulator ICs are designed for constant voltage rather than constant current operation. The internal reference voltage of the 1C used here is 2.21 V, which is too large to allow the construction of a simple current feedback loop using a series sense re- sistor: at 0.75 A the power dissipated in the sense resistor would be in This 3 W power LED from Cree is also an attractive piece of electronics in its own right. The Luxeon Rebel is particularly small and is mounted on a ceramic substrate. The Seoul Z-LED is encapsulated not in hard plastic but in a silicone resin which offers long-term resistance to dulling. i In order to examine the i differences between the various makes of LED, we made some meas- i urements on a sample i of each. The resulting characteristic curves are shown here. It is clear i that the forward voltages i are very different from one another and that the differential resist- i ance of the LED is very i low at currents of around 0.75 A. The consequenc- es of this are as follows. i LED characteristic curves: voltage (left) and differential resistance (right) at various currents. i V U/l characteristics AQ AR characteristics the region of 1 .6 W. We therefore must resort to controlling the current via the output voltage of the regulator, adjusted via PI to suit the par- ticular LED used. This is sufficiently accurate if the differential resistance is around 0.2 T2. 48 elektor - 9/2008 n n o /n A N T E X LJLJLJLJLJ Ante* offer a wide choice of input voltages and bit profiles for our soldering iron range 60+ years of experience It may surprise you but buying an Antex sofdering iron costs less than you think in the long run, British made to exacting standards, they last significantly forger than many imported brands. With a wide range of thermally balanced models, and temperature controlled Irons too, you can always be sure to find an iron that meets your needs. A large range of replacement tips are available for most irons, and technical help is on hand from our offices in Devon UK. 8uy Online Our new website has all of our irons, and soldering spares and accessories available 24hrs a day. Most items are shipped next day, and we offer free carriage throughout Europe. Why not give antex.co.uk a try* * * - * vwvuv.antexxo.uk FREE shipping on alt orders Ant ex Electronics Ltd 2 Westbridge Industrial Estate Tavistock, Devon PL1 9 BDE, UK Tel: +44(0)1822 613565 Fax: +44(0)1822 617598 Email: sales@antexxo.uk Web: www.antexxo.uk Electronics Engineers - Join A Winning Team! UK, Europe and Middle East The Lektronix Group of Companies are the worlds leading provider of Industrial Automation repairs with an enviable reputation for the best in technical excellence and customer service. Due to the huge demand for our services, and our future expansion plans, we need to employ additional engineers at all our workshops to keep pace with the additional work we are receiving. We are looking for English speaking Electronic Repair Engineers, Electronic Repair Technicians and Electronic Component Level Repair Engineers in all the following locations: • Walsall, UK • Bridgend, UK • Newry, Northern Ireland • Katowice, Poland • Brno, Czech Republic • Dubai, UAE Do you have an interest in electronics? Have you any experience in the field of practical electronics? Have you experience in Radio/Television/Home Electronics? Does your hobby/interest include electronics? Are you willing to learn new tricks - electronic engineering? Do you want work in an exciting and challenging environment? Do you have any experience with Machine Tool Systems - PLC's - Servo Drives - Servo Motors - Monitors-VDU's - AC Drives - DC Drives - Temperature Control - Digital Electronics - Analogue Electronics? Please Contact: Mr Brian Stewart - Group Technical Director Lektronix International Ltd, Unit Cl, Lockside, Anchor Brook Ind Park, Aldridge, West Midlands, WS9 8EQ, United Kingdom. We offer a competitive salary and all the other benefits normal with a go ahead company. For an application form please either: Telephone +44 (0)1922 455555, or apply online at www.lektronix.net/about/careers 9/2008 - elektor 49 MICROCONTROLLERS Light as Air Using the ATM18 to control a magnet levitation device Udo JurB and Wolfgang Rudolph Overcoming gravity is an age-old dream, which we can't expect to see fulfilled anytime soon. However, we can come closer to making it reality on a small scale. Commercial levitation devices that cause a small piece of metal - often with some sort of covering - to hover in the air have been available for many years. A coil provides the lifting force, and a light barrier is used to regulate the levitation height. This causes the levitated metal object to maintain a defined distance from the core of the coil. Many of these devices are more expensive than need be. We also want to make something hover, but here we take a slightly different approach. Instead of a light barrier, we use a Hall sensor to detect the position of the levitated object. 50 elektor - 9/2008 With the usual levitation devices, which have already been described in DIY articles in past issues of Elektor, the beam of a light barrier is more or less obstructed by the ‘floating’ ob- ject. The amount of light received by the sensor of the light barrier is used to control the amount of current flow- ing through the coil. The mechanical and electronic construction of the de- vice is designed to maintain the lev- itated metal object in the prescribed position. Distance control using a Hall sensor is based on a completely differ- ent principle. Magnetic field sensor A Hall sensor is a semiconductor de- vice that generates a voltage propor- tional to the strength of the surround- ing magnetic field. The voltage pro- duced by the actual sensor element is very small (in the millivolt region), so a sophisticated bridge amplifier is also necessary. We use a Micronas HAL815 integrated magnetic sensor housed in a low-profile TO-92UT package in our levitation controller, so this is already taken care of. The amplifier, tempera- ture compensation and a filter are in- corporated in the IC (Figure 1). All of the parameters can be programmed by superimposing digital signals on the supply voltage (with pulses that increase the voltage from 5 V to 8 V). For instance, the measuring range can be adjusted from ±30 mT to ±150 mT. Programming is not necessary in this case, because the device is fac- tory-configured for the ±30 mT range - which is exactly right for this appli- cation. With a supply voltage of 5 V, the output voltage is 2.5 V with no mag- netic field present. The output voltage varies by plus or minus 2.5 V depend- ing on the direction and strength of the magnetic field, for a total range of ap- proximately 0 to 5 V. Only one direc- tion is needed in this application, so only the range between 2.5 V and 5 V is used. Figure 1. Block diagram of the sensor. Hall effect The American physicist Edwin Herbert Hall discovered this effect, which was later named after him, during his doctoral work in 1 879. The Hall effect is based on the Lorenz force. Moving charges are deflected in a magnetic field, and this produces a potential difference perpendi- cular to the direction of current flow. Hall sensors are made from small, thin sheets of semiconductor material with a low charge carrier density in order to achieve high electron velocity. This results in a relatively high output voltage. If a current flows through the sensor and it is placed in a magnetic field with the field lines perpendicular to the surface of the semiconductor, the sensor voltage changes. The out- put voltage of the sensor is proportional to the product of the current and the magnetic field strength. As the value of the current is known, the magnetic field strength can be determined from the measured voltage. These sensors are usually integrated in a package with a signal amplifier. The thermal sensitivity of the sensor is also compensated in such devices. Controller If we bring a magnet close to the Hall sensor with the magnetic field lines perpendicular to the surface of the sensor, the output voltage of the sen- sor varies in proportion to the magnet- ic field strength. This makes it possible to determine the distance between the sensor and a magnet with a known field strength. With this information, a controller can adjust the current in the coil to keep the magnet ‘floating’ in the air. The current is adjusted around 1000 times per second. This continual adjustment requires certain rules. PID controllers (proportional, integral and differential - see the inset) are used in electronic systems for this purpose. In our case the ‘I’ component is not necessary, so we can use a PD con- troller. However, it is not implemented as an analogue circuit with opamps for this ATM18 project, but instead with software in the form of a control- ler program. Every minute departure of the levitated magnet from its in- tended position, every air movement, every change in temperature, every vibration, and many other things can directly affect the levitated behaviour. If the magnet moves a bit closer to the solenoid coil, the current in the coil must be reduced immediately. If the 9/2008 - elektor 51 MICROCONTROLLERS LCD 20x4 — II — — II — II — 1 JUUUi ]□□□[ ]□□□ ]□□□ 1 TSOP1736 080359 - 11 Figure 2. Schematic diagram of the experimental circuit magnet moves even a small distance away from the coil, the current must be increased immediately. As the coil is connected to the PWM (pulse-width modulated) output of the microcontrol- ler via a UL2003, this is done by chang- ing the duty cycle. The pulses are in- tegrated in the ferrite core and coil to yield an average current level. Figure 2 shows the structure of our pro- totype. The Hall sensor is connected to ADC 6. The PWM output on PD 6 drives one or more inputs of the ULN2003 power stage. The coil is connected be- tween the open-collector outputs and + 12 V. It is important to connect pin 8 to K6 so the internal protection diodes in the ULN2003 can limit the induc- tive spikes from the coil. Pushbutton switches S1-S3 are used to configure the control parameters. This lets you raise or lower the levitation position of the magnet by up to 10 mm. Alter- natively, you can use an RC5 infrared remote control unit to operate the de- vice via an IR receiver connected to the circuit. The parameters are constantly shown on the LCD display. General requirements Making a magnet hover in the air is not a trivial task. If it comes too close to the coil, it will immediately be pulled all the way to the coil, and the control- ler can’t do anything to stop it. This means that the coil must be mounted at a sufficient height. On the other hand, the magnetic field of the fully energised coil must be strong enough to lift the magnet from its lowest posi- tion. This means that you have to wind the right coil on the right core and use a magnet that is as small and light as possible, but also strong. And you have to adjust the device for a suitable levi- tated distance. Another difficulty is that the output voltage of the sensor is not propor- tional to the distance between the coil and the magnet. Nonlinear controlled systems can lead to stability problems. On top of this, the magnetic field of the lifting coil also affects the sensor. The severe requirements imposed by the controlled system make the job of the controller more difficult. Here a bit of help in the form of damping can’t hurt. It arises in a rather unobvious manner due to the aluminium heat sink, under which the sensor is mounted. Every motion of the magnet creates an eddy current in the aluminium, and this pro- duces an opposing magnetic field. In this way, magnet oscillations are damped by eddy-current losses. Magnet and coil The magnet must be very light and very strong. A neodymium magnet with a mass of less than 0.3 g is quite suitable. We used a type Q-CDM50- G from www.supermagnete.de (mass 0.23 g) in our various prototypes. An- other potential source of small, strong magnets is cannibalised CD drives. A preliminary test with the solenoid coil will tell you whether a particular mag- net is suitable. With an applied volt- age of 12 V, the coil should be able to lift the magnet from a height of at least 3 cm, but 4 cm or more is better. A ferrite rod such as is commonly found in medium-wave radios is used for the coil. It should have a diameter of 10 mm and a length of 80 to 100 mm. Don’t try to rush things when con- structing the coil. As you can see from Figure 3, you start by sliding a length of heat-shrink tubing over the ferrite rod (a) and shrinking it in place (b). You can also use electrician’s tape in- stead. After this, you can start wind- ing the coil (c). It consists of four layers of 400 turns each, wound with 0.2-mm enamelled copper wire. You can wind the coil entirely by hand, or you can use an electric drill running at a very low speed (d). After you finish wind- ing the coil, secure both ends with heat-shrink tubing (e), making sure to feed out the free ends for the leads (f). Finally, you can fit another length of heat-shrink tubing over the entire coil to protect it (g). If you want to avoid counting turns and would rather wind the coil ‘helter- skelter’, you can wind the ferrite rod over a length of 50 mm with 0.2-mm copper wire until the winding reaches a diameter of 18 mm. The coil will then have a resistance of 40 to 50 Q, so the 52 elektor - 9/2008 current will not exceed 300 mA with a 12-V supply voltage (this only holds true for DC current). When the coil is driven by the PWM output of the pro- cessor, amplified by the ULN2003, the current is pulsating DC instead of pure DC. The average value of the current is thus less, and the coil characteristic is similar to that with AC operation, with the result that a distinctly lower cur- rent flows through the coil. This completes the coil. After you have carefully protected the leads and the ends of the coil with electrician’s tape, you can simply use the alligator clips of a ‘third hand’ (soldering aid) to hold the coil for initial testing. This makes it easy to adjust the height to the proper value (Figure 4). Practical aspects Our prototype (see the photo at the head of the article) was built around an aluminium heat sink with the sen- sor mounted underneath. A brass rod was fitted to the heat sink, and the wiring that conducts the current to the coil was routed along this rod in a suitable manner. A plastic bracket was fitted to the rod, and the coil was clamped to the bracket. The details are shown in Figures 5a-d. After the coil has been secured, you can connect everything to the proto- typing board and start your levita- tion tests. Two ready-made sample programs are available on the Elektor website for downloading. One of then was written in Code Vision, and the other in BASCOM. The best approach is to start with the C program, since it shows all the par- PID controllers Our objective here is to use an electromagnet to attract a permanent magnet exactly enough to levitate it at a particular height. As the magnet le- vitation system is an unstable, nonlinear controlled system, it must be stabilised as well as regulated. We use a PD controller for this purpose. The task of a closed-loop controller is to continually and independently control a physical quantity in order to maintain a specified setpoint value - in our case the magnet position - and eliminate the effects of disturbances. For this purpose, the controller constantly compares the actual value (the position of the magnet) with the setpoint value (the desired position of the magnet). The control error determined in this manner is used to gene- rate the control output, which acts to minimise the control error when the control loop is in balance. However, it takes a certain amount of time for a system of this sort to respond and for the control output to take effect, and for this reason it must overreact at first and then underreact imme- diately afterward in order to avoid overcompensation that would cause control failure. This requires the control output to have a damping effect, depending on the system characteristics. The behaviour of the controller is described by differential equations. The magnitude of the P component varies in proportion to the control error (difference between the actual value and the setpoint value). This only affects the proportional gain factor. The D branch of a controller is a differentiator that must always act together with the P component (or the I component). The D component arises from variations in the control error over time and is multiplied by the integral action time. It does not depend on the control error, but instead on the rate of change. A large integral action time cause a large change in the control output and often causes instability in the control loop. An integral component is used when the control error must reduced to zero (or as close to zero as possible). It is not used here because the levita- tion device always works with a control error and only the control gain is adjusted. The slope of the control curve decreases as the distance from the sensor increases, which is offset by increased gain. This compensates for the nonlinear characteristic of the controlled system. Listing Example BASCOM PD controller Clear Down , Compare B Pwm = Clear Down P = 0.1 D = 60 , Atml8 PD regulator , SI At Pb3 = Up , S2 At Pb4 = Down $regfile = „m88def.dat" $crystal = 16000000 Dim N As Byte Dim X As Integer Dim Y As Single Dim Z As Single Dim Xold As Single Dim Xp As Single Dim Xi As Single Dim Xd As Single Dim P As Single Dim I As Single Dim D As Single Config Adc = Single , Presca- ler = 32 , Reference = Off ' AD-Wandler starten Start Adc Config TimerO = Pwm , Presca- le = 1 , Compare A Pwm = Do If Pinb.3 = 0 Then P = P + 0.0002 If Pinb.4 = 0 Then P = P - 0.0002 X = 0 For N = 1 To 8 X = X + Getadc ( 6 ) Next X X = X / 8 If X < 512 Then X = 512 Xp = X - 512 Xp = Xp * P Xd = X - Xold Xold = X Xd = Xd * D Y = Xp + Xd Y = Y / 2 If Y > 255 Then Y = 255 If Y < 0 Then Y = 0 PwmOa = Int (y) Loop 9/2008 - elektor 53 MICROCONTROLLERS ' ! ■■ . 1 ameters on the display. Right after you switch on the supply voltage or reset the circuit, no current flows through the coil because the proportional factor of the controller is zero. Place the mag- net above the sensor, orient it to obtain a maximum reading for the displayed Pv value, and press button SI. This should cause the current to increase. You can also see this from the increas- ing brightness of the LEDs on the out- puts. If nothing happens, the magnet is probably the wrong way round. Turn it over and repeat the experiment. The longer you press SI, the more the coil current will increase. Suddenly the magnet will start to rise and then re- main suspended in a stable position. You can press SI to make it rise even higher. If you press SI and S2 at the same time, it will drop gradually. At some point, you will doubtless overdo the levitation height and the mag- net will fly up to the ferrite rod with a bang. Now you know the maximum levitation height. You can probably in- crease the levitation height slightly by carefully adjusting the position of the solenoid coil. The coil should be just high enough that it can still lift the magnet from the surface of the heat sink.. SI adjusts the proportional fac- tor of the controller, which effectively means the control gain. You can also use S3 to alter the proportion of the differential component, which is im- portant for stability. However, in most cases the default value is suitable. If the magnet refuses to lift, the direc- tion of the magnetic fields may be to blame. Try reversing the polarity of the coil. You can also use a voltmeter to check the output voltage of the sen- sor. It should be close to 2.5 V with no magnet present, and the value with the magnet lying above the sensor should be more than 4 V. Some other possibili- ties are that the magnet is too weak or too heavy. However, this should have already been sorted out by the initial test without the controller. MLC in C The C program for the magnet levi- tation controller (MLC) is very large and can only be described here in general terms. Figure 3. Coil construction stages: ferrite rod with heat-shrink tubing (a) shrunk onto the ferrite rod (b); start of coil winding (c); fully wound coil (d); coil ends covered with heat- shrink tubing (e) and with the leads fed out (f); finished coil covered with heat-shrink tubing (g). Figure 4. A simple experimental setup. Hall sensor data acquisition and tim- ing generator The A/D converter is used to acquire the Hall sensor data and as a timing generator. Eight sensor readings are acquired in an interrupt routine within 1 millisecond. After this the ‘adc_ ready’ flag is set. The main program loop uses this flag for synchronisation. The function ‘adc_get_average()’ cal- culates the average of the eight sen- sor readings, which forms the current actual value for the PD controller. This averaging suppresses noise on the measured signal. Controller The PD controller is recalculated 1000 times each second. Due to this con- stant time interval, the control algor- ithm does not have to calculate the time, which saves processing time. The average sensor value is first cal- culated in the function ‘mlc_update’. The P component is calculated from this actual value. The D component is calculated as the difference between the previous and current actual values. The control output (the pulse width of the PWM signal) is formed by adding the two components. Actuator Here the actuator for the controlled sys- tem is the electromagnet in the form of a ferrite-core coil. A PWM signal with a pulse rate of 32 kHz drives the power stage (ULN2003). The coil is switched to ground. Thanks to the high PWM frequency and the large inductance of the coil, the coil current is strongly fil- tered (integrated). This yields a con- stant magnetic field with a low ripple component. 54 elektor - 9/2008 Figure 5. Details of the prototype assembly: (a)base plate (aluminium heat sink), (b)Hall sensor, (c)brass rod with coil leads, (d)coil bracket with cable ties. Display output To avoid reducing the control frequen- cy as a result of time-consuming dis- play outputs, the outputs are divided into many individual jobs. The function ‘mlc_write_lcd()’ uses a state machine to perform a single display output in each control cycle. Control process After the individual modules have been initialised, the same process is ex- ecuted repeatedly in an endless loop: 1. Update the control loop: mlc_update(); // Update magnet levitation control 2. LC display output: mlc_write_lcd(); // Do a single LCD operation 3. Scan control parameter buttons: mlc_scan_buttons(); // Check the Kp and Kd pushbuttons 4. Synchronise with A/D converter: while (!adc_ready) // Synchronise the control loop 5. Start the next control cycle at step 1 RC5 control With an IR receiver connected, you can use an RC5 infrared remote control unit to operate the device remotely. Button 1 increases the P value, while button 4 decreases it. Button 3 increases the D value, while button 6 decreases it. In ad- dition, button 0 acts an emergency stop and causes the P value to be set to 0. BASCOM example The Basic program (see listing) has in- tentionally been kept simple, so it does not include the LCD and remote control functions. Only the P factor (and thus the effective levitation height) can be adjusted using the SI and S2 buttons. When the program is started, P is as- signed the value 0.1 to provide a cer- tain amount of gain so you can place the magnet exactly above the sensor by positioning it to obtain maximum coil current. The controller performs its calculations with real numbers (single precision). Here again the actual value is obtained by averaging eight individual readings. The controller can only use the range between 512 and 1023. The lower the magnet position, the higher the meas- ured value. The measured value is mul- tiplied by the P factor to yield the set- ting for the PWM value. The system would also work without a D compo- nent, but the motion is damped if this component is added. If the magnet ris- es quickly, the controller anticipates an imminent overshoot and reduces the current accordingly. ( 080359 - 1 ) Assembly note A parts kit with a ferrite rod, HAL81 5 and magnet is available from www.elektor.com. 9/2008 - elektor 55 MICROCONTROLLERS BASCOM AVR Course Programming the ATmega controller HASCOM AVK IDt 1 1.11 .9.1 1 - | L:\Arbeit\AVK\HA5CUM-AVK\M8b\Print.basl Fie Edit View Program Tools Options Window Help sinole_scientificbas doubleLtriobas lwire.bas Sub ^ Label ▼ S ~1 X B double_triobas i ^ a * % APN3.BAS ' Bas>u*j* ATjiieya88 , Fxinl Sxtsylilt; - n m88de£ . dal " Jcrystal = 16000000 Baud = 9600 Goto Test! Testl Do Print ‘'hello" Haitns 2 UUU Loop Test 2 Din A As Byte Din B As Inteqer Din C As Sinqle Do <|||J A: 20 Print " input 0. .255' Modfiad Insert Parti Burkhard Kainka The AVR series of microcontrollers from Atmel are very popular. Many projects already featured in Elektor have an ATmega beating away at their heart. In this mini course we turn the spotlight onto software development for these controllers. BASCOM is an ideal programming language for the newcomer; it has a steep learning curve ensuring that your path to success (and a working prototype) is reassuringly short. The ATmega controller and BASCOM together make a strong team! Whatever application you have in mind, con- trollers from the ATmega range are sure to have the majority of the necessary peripheral hardware already integrated on-board: ports, timer, A/D converter, PWM output, and UART are all standard together with a choice of RAM, ROM and EEPROM size. BASCOM is one of the easier languages to use and makes interfacing to peripherals using LCDs, RC5 and l 2 C a simple task requiring very few instructions. There is a good range of development hardware for this microcontroller family. The STK500 from Atmel or the Elektor CC 2 ATM1 8 AVR board [1] are both suitable platforms for this course. Alternatively there is no reason why you should not experiment with your own homebrew design built on a piece of perfboard. It also makes little difference whether you choose a Mega8, Me ga88 or even the larger Mega 1 6 or Me ga32. They all basically have the same core; the main differences are in the number of port pins and the amount of internal memory space. In this first instalment of the course we look at the controller's UART and A/D converter. The serial interface All of the ATmega series have a built-in serial interface (UART) using pins RXD (PDO) and TXD (PD1). The signals are TTL compatible so it is necessary to add an RS232 interface buffer such as the MAX232 to implement a true 56 elektor - 9/2008 RS232 interface. These buffers are already implemented on the Atmel STK500 development system. A suitable serial to USB Adapter can be connected directly to the Elektor ATM1 8 AVR board for serial communication [2]. The PC will need to be running a terminal emulator program before serial communication from the ATmega can be viewed on the screen. The serial interface is covered here first because the software routine is very simple and can be easily modi- fied if required. Listing 1 shows all the elements necessary for all of the BASCOM programs. The first line $ regfile = "m88def.dat" indicates which controller the code will be running on; in this case it is the ATmega88. The line can be omitted and the controller type specified using the Options/Compiler/ Chip menu but this method will generate an error if a differ- ent AVR system is used. It is far better to declare the control- ler type clearly in the program header with any program that you write. It also has priority and overwrites any setting defined in the Options menu. It is also important to specify the crystal frequency ($crystal = 16000000 for 16 MHz). It influences both the division ratio necessary to provide the requested communications baud rate clock (Baud = 9600) and also the timebase used to count milliseconds in the 'wait' statements (Waitms 2000 for 2 s). One feature of the test program given here is the use of the unconditional jump instruction Goto Testl . It is normally good pro- gramming practice to avoid using Goto statements because they interrupt the program struc- ture. In this instance we have included several programming examples in the same source code so it is only necessary to alter the first Goto Testl to Goto Test2 or 3, etc. (depending on which example you want to run) and then recompile. This avoids the need to compile individual source files for each example and reduces the number of files generated in the compilation process. Additional test programs can simply be added to the code and run using an appropriate Goto statement. The small program example used for Testl forms an endless loop between the Do and Loop statements. The program outputs a 'hello' message every two seconds. A terminal emulator program like HyperTerminal is needed to receive the message. Calculating The program in Listing 2 is used to calculate the area (C) of a circle where 'A' is the given radius: C = A 2 * 3.1415 'A' must be an integer variable, which is dimensioned as a byte and input via the serial interface. The value of 'A' (in the range 0 to 255) is first multiplied by itself. The result- ant intermediate value 'B' can be up to a word long (0 to 65535 . The result 'C' is a real value and is dimensioned as sing e which requires four bytes to store its value. Anyone familiar with other dialects of BASIC may be won- dering why the calculation has not been written as C = 3.1415 *A *A or Print 3. 1 41 5*A*A. The reason is that BASCOM only allows one calculation per expression so it is necessary to break down complex TXD O o — 1 i i RXD, PD0 ■ RS232 PC i i RXD O 1 TXD, PD1 ! 1 1 080330 - 1 1 1 Figure 1. The serial interface. TXD O — | 100k | 1 1 PD4 | RS232 PC i i RXD O -DO PD3 ! 1 1 080330 - 12 1 Figure 2. The simplest serial interface without an inverter. calculations into series of single steps to avoid violating this rule. Procedures The A/D converter in the ATmega has a 10-bit resolu- tion. Listing 3 shows an example of how the converter is initialised: Config Adc = Single , Prescaler = 64 , Reference = Off. The converter clock frequency is defined here as 1/64 of the processor clock, i.e. 250 kHz with a processor clock of Listing 1 Print 'hello' ,Bascom ATmega88, Print $regfile = „m88def.dat" $crystal = 16000000 Baud = 9600 Goto Testl Testl : Do Print „ hello" Waitms 2000 Loop Test2 : Test3 : End 9/2008 - elektor 57 MICROCONTROLLERS Listing 2 Calculating in BASCOM Dim A As Byte Dim B As Word Dim C As Single Do Print " input 0...255" Input A B = A * A C = B * 3 . 1415 'not allowed: C = 3.1415 * A * A Print C Loop Listing 3 Using a procedure Declare Sub Voltage Dim N As Byte Config Adc = Single , Presca- ler = 64 , Reference = Off Start Adc Do N = 0 : Voltage Print „ ADC ( 0 ) = „ ; U ; „ V" N = 1 : Voltage Print „ ADC ( 1 ) = „ ; U ; „ V" Print Waitms 500 Loop Sub Voltage D = Getadc (n) D = D * 5 U = D / 1023 End Sub Listing 4 Using the Software UART Baud = 9600 , Open „comd. 3 : 9600 , 8 , n, 1" For Output As #2 Open „ comd . 3:9600, 8 , n , 1 , INVER TED" For Output As #2 Config Adc = Single , Presca- ler = 64 , Reference = Off Do N = 0 : Voltage Print #2 , „ADC(0) = „ ; U ; „ V" „ N = 1 : Voltage Print #2 , „ADC(1) = „ ; U ; „ V" „ Print #2 , Waitms 500 Loop 1 6 MHz. The internal reference voltage is not used but is derived externally and applied to pin AREF. In most cases the 5 V stabilised supply voltage can be used. A procedure is used to input the ADC measurement and convert it to a voltage reading. It is only worthwhile using a procedure if it can be reused by different parts of the main program body. In this example two voltage measurements are displayed. The new procedure is called Sub Voltage. Before the procedure can be called it must first be declared: Declare Sub Voltage. The program fragment shown here does not conform to good software writing practice. In Visual Basic it is usual to pass the channel parameter 'N' when the procedure is called: Voltage(N). Alternatively a function could be writ- ten and then called using: U = Voltage(N). In the example here we are using only global variables so that D, N and U are accessible from all parts of the program including other procedures. All of the accepted software guidelines indi- cate that this is not good programming practice but in this instance it simplifies the job for the compiler and controller. Experience has shown that even large programs occupy- ing 100% of the flash memory of a Me ga32 and using a large number of global variables are completely stable in operation and run without problem. Passing variables to procedures can sometimes generate errors which are quite difficult to trace. The software serial interface One of the many highlights of the BASCOM compiler is its software serial interface. Say you are already using the hardware serial interface with the RXD and TXD pins and you require another COM interface? Alternatively it could be that you do not have any RS232 interface inverter chip (e.g. a MAX232) on your board but still need to provide a connection for an RS232 cable. In both cases BASCOM has a solution to the problem. Any available port pins can be defined in software as serial interface pins for the soft- ware serial interface. The example Listing 4 uses PD3 as a serial output. Com- munication speed is set to 9600 Baud and the interface number 2. To output a simple message you can use Print #2, 'hello' for example. Using the INVERTED parameter allows the interface to be built without the need for a MAX232 interface inverter. BASCOM inverts the signal so that inactive level is a logic Low. The PC interface RXD signal can then be connected directly. The signal levels are not truly RS232 but it provides a useable interface solution and can, for example, be used to interface a USB to serial adapter to the Elektor ATM1 8 AVR board without the need for a MAX232. ( 080330 - 1 ) References [1 ] ATMl 8 AVR Board, Elektor April 2008. [2] USB <-> RS-232 Cable, Elektor July/August 2008. Downloads and further information The programming examples and more information for this course can be downloaded from the project page at www.elektor.com. We also welcome your feedback in the Elektor Forum. 58 elektor - 9/2008 QUASAR electron ics Quasar Electronics Limit PO Box 6935, Bishops Stqrtford CM23 4WP, Tel: 0870 241 ed United Kingdqm 6 1826 Fax: 0870 460 1045 E-mail: sales@quasarele ctronics.com Web: www.(puasarElectrj>nics.com 08717 Postag^ 3-7 Day Europe 'Order We acc to Quas Please 95 & Packing Op Delivery - £3 (EU) -£6.95; R4 (inline for reduq opt all major cr ar Electronics, visit our online projects;, modules and ions (Up to 0.5 UK Mainland st of World - £! ed price UK Pc idit/debit cards Prices include shop now for publications. Credit Card Scales : UK Standard fery - £8.95; I) gross weight) Next Day Deliv f).95 (up to 0.5Kg stage! . Make cheque^/PO’s payable 17.5% VAT. details of over 5 Discounts for b d 177 00 kits, Ik quantities. 168 The Electronic Kit Specialists Since 1993 Motor Dirivers/Controllein Here are just a few of our controller and driver modules for AC, DC, Unipolar/Bipolar s;tepper motors and servo motors. See website for full range and Pdetails. O! for ntrollels & Lodgers data acquisition See website for SI! Here are just a few of the controller and full details. S all units: Order Code PSU and control units we have uitable PSU 445 £8.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 - £12.95 Assembled Order Code: AS3179 - £19.95 Computer Controlled Bi-Polar Stepper Motor Driver Drive any 5-50Vdc, 5 Amp bi-polar stepper motor using externally supplied 5V lev- els for STEP and DIREC- TION control. Opto-isolated inputs make it ideal for CNC applications using a PC running suitable software. Board supply: 8-30Vdc. PCB: 75x85mm. Kit Order Code: 3158KT - £17.95 Assembled Order Code: AS3158 - £27.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 - £17.95 Assembled Order Code: AS3166v2 - £27.95 DC Motor Speed Controller (100V/7.5A) Control the speed of almost any common DC motor rated up to 100V/7.5A. Pulse width modulation output for maximum motor torque at all speeds. Supply: 5-15Vdc. Box supplied. Dimensions (mm): 60Wx100Lx60H. Kit Order Code: 3067KT - £13.95 Assembled Order Code: AS3067 - £21.95 lost items are available in >r assembled and ready for kit form (KT suffix) 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 - £54.95 Assembled Order Code: AS3108 - £64.95 Computer Temperature Data Logger 4-channel temperature log- ger for serial port. °C or °F. Continuously logs up to 4 separate sensors located 200m+ from board. Wide range ot tree software applications for stor- ing/using data. PCB just 45x45mm. Powered by PC. Includes one DS1820 sensor. Kit Order Code: 3145KT - £17.95 Assembled Order Code: AS3145 - £24.95 Additional DS1820 Sensors - £3.95 each Rolling Code 4-Channel UHF Remote State-of-the-Art. High security. 4 channels. Momentary or latching relay output. Range up to 40m. Up to 15 Tx’s can be learnt by one Rx (kit in- cludes one Tx but more avail- able separately). 4 indicator LED ’s. Rx: PCB 77x85mm, 12Vdc/6mA (standby). Two and Ten channel versions also available. Kit Order Code: 3180KT - £44.95 Assembled Order Code: AS3180 - £54.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 - £54.95 Assembled Order Code: AS3140 - £69.95 Infrared RC Relay Board Individually control 12 on- board relays with included infrared remote control unit. Toggle or momentary. 15m+ range. 112x122mm. Supply: 12Vdc/0.5A Kit Order Code: 3142KT - £47.95 Assembled Order Code: AS3142 - £59.95 PIC & ATM EL Programmers We have a wide range of low ATMEL Programmers. Comply documentation available from Programmer Ac 40-pin Wide ZIF 18Vac Power su Leads: Parallel (LDC441) £3.95 / cost PIC and te range ancj bur web site cessories : socket (ZIF4( pply (PSU01 (LDC136) £3. USB (LDC64 0W) £14.95 0) £18.95 05 / Serial 4) £2.95 NEW! USB & Serial Port PIC Programmer USB/Serial connection. Header cable for ICSP. Free Windows XP software. Wide range of supported PICs - see website for complete listing. ZIF Socket/USB lead not included. Supply: 16-18Vdc. Kit Order Code: 3149EKT - £39.95 Assembled Order Code: AS3149E - £49.95 ft - NEW! USB 'All-Flash' PIC Programme^ USB PIC programmer for all ‘Flash’ devices. No external power supply making it truly portable. Supplied with box and Windows Software. ZIF Socket and USB lead not included. Assembled Order Code: AS3128 - £44.95 “PICALL” PIC Programmer “PICALL” will program virtu- ally all 8 to 40 pin serial- mode AND parallel-mode (PIC16C5x family) pro- grammed PIC micro control- lers. Free fully functional software. Blank chip auto detect for super fast bulk programming. Parallel port connection. Supply: 16-18Vdc. Assembled Order Code: AS31 17 - £24.95 ATMEL 89xxxx Programmer Uses serial port and any standard terminal comms program. Program/ Read/ Verify Code Data, Write Fuse/Lock Bits, Erase and Blank Check. 4 LED’s display the status. ZIF sockets not included. Supply: 16-18Vdc. Kit Order Code: 3123KT - £24.95 Assembled Order Code: AS3123 - £34.95 PI W ww w.Qi uasarElectnpnics O O « n J™ Se cure Online O rdering Facilit ies • Full Proc Juct Listing, D escriptions & Photos • Kit [ Jocumentatior l & Software C downloads MODDING & TWEAKING Gert Baars We've already covered a laser projector in an earlier instalment of this series. This time however, we use a different projection mechanism. With a few servos, a laser module from eBay, a microcontroller and a little dexterity we can make a laser projector which, depending on the laser, can be seen from several hundreds of metres. Laser projectors are often used for light effects at, for example, places of enter- tainment. These generally use power- ful laser beams which generate strik- ing light patterns. These types of laser projectors are not cheap however and even the individual parts such as laser modules and fast servos are not really that attractive either, considering their price. The alternative then, naturally, is to make your own. Laser diodes and modules Through eBay and the like, laser point- ers and modules are frequently on offer for less than 10 pounds. These are typi- cally red lasers with a power of less than 5 mW. This is more than enough to project something indoors during the day and outdoors at night up to a distance of about 100 metres. More powerful lasers, such as green lasers rated at 30 mW, can be used outdoors during the day over hundreds of meters and at night over several kilometres. Using this type of laser is not recom- mended, in principle, because of safety considerations. You can also use a single laser diode. But you will need a so-called collimator to obtain a parallel light beam. Controller The heart of the control system (see Figure 1) is an ATmega88 controller. Although it would be possible to drive the servos with a purely analogue sys- tem, from a music source for example, using a microcontroller offers addi- tional possibilities such as the projec- tion of text. Analogue signals are required to drive the servos. We generate these with two PWM DACs (X-Servo and Y-Servo). The 78 kHz PWM frequency is strongly suppressed with a four-stage RC -filter. The two ADC inputs (X-in and Y-in) allow for analogue control, for use as a XYZ-plotter and an X-T oscilloscope. The Z-input (with internal pull-up) is used to turn the laser on and off. An RS232 interface is added so that an LCD and keyboard interface are not required. The HyperTerminal program that is part of any standard Windows installa- tion can be used to communicate with the projector. The correct port settings are 9600 baud, 8 bits, 1 stop bit, no par- ity and no flow control. The schematic for the laser controller shows that the laser is driven with a constant current. defines the laser current and the quiescent current can be set with PI. This is sometimes bet- ter because laser diodes start to work at a certain threshold current but only produce optimal light when operating at a certain temperature. By setting the idle current just under the threshold current the light output is increased when used as a projector. On pin 6 of the controller there is also an output called ‘TTL optional’. This is because some laser modules are sup- plied with a control PCB which has a 60 elektor - 6/2008 ALWAYS BE VERY CAREFUL WHEN WORKING WITH LASER TYPES lll-A AND lll-B AND GREEN DPSS LASERS. LOOKING INTO THE BEAM CAN PERMANENTLY DAMAGE YOUR RETINA! v+ +5V V+ © +12. ..15V © □□ ►14 2AT 1N4001 1000n 25V backside CM r^* 2 case 071141 - 11 Figure 1. The schematic for the laser controller. The optional driver circuit can be used for larger lasers. separate modulation input that can be driven directly. Laser modules, such as the ones used in laser pointers, often have a photo diode which is used to control the laser current. These common mod- ules are usually intended for 3 V bat- tery operation. If you measure the cur- rent of the module at 3 V you can use this to determine what the value for Ri should be. In this case it is better if Ri is selected to be slightly smaller. The servos Making your own servos that are rea- sonably fast is not all that difficult. Servos targeted for the model-build- ing world are not an option because they are too slow and inaccurate for this application. The servos for the laser projector can easily be made from a small DC motor that is often found in older CD/DVD drives. We refer here to the motor that opens and closes the tray, but sometimes a CD/DVD drive contains multiple motors of the same type. To turn the DC motor into a servo an angle sensor is required. This angle sensor measures the rotation of the motor shaft. The result of this meas- urement is used to correct the posi- tion of the motor shaft. In a standard servo the angle sensor is generally a potentiometer which is connected to the motor shaft. This, however, creates a lot of friction and is not very accu- rate. The servos for the laser projector use a combination of a magnet and a Hall-effect sensor as the angle sensor. The magnet is an especially powerful Neodymium miniature magnet which measures only 2x2x2 mm. There are several possibilities for attaching the little magnet to the spindle. Here we used the clamp from a plastic terminal strip as the cou- pling (see Figure 2). These have an internal diameter of 2.2 mm while the motor shaft has a diameter of 2 mm. Not really ideal, but the clamp can be fixed in place with the screw and the little magnet is easily glued to it. When gluing the magnet you need to make sure that the north- or south-pole of the magnet does not face the shaft but is perpendicular to it. It is as if the side of the magnet is glued and not the end. Whether the North or South pole faces to the left or right does not mat- ter. It is merely a case of reversing the motor wires to make everything right again. Finding the poles is not that hard. These are the sides where the magnet is most powerful. When two magnets grab each other the joined surfaces are always the poles. The mir- ror that deflects the laser beam can be attached with instant glue. When the motor shaft rotates from its neutral position, the polarity of the magnetic field in front of the sensor rotates as well. This is necessary for 6/2008 - elektor 61 MODDING & TWEAKING top view 071141 - 13 Figure 2. This figure shows how the mirror is attached to the servo shaft and how the angle sensor is constructed. mirror clamp screw motor spindle S(N) magnet magnetic sensor spindle junction piece the proper operation of the servo. Nat- urally, the construction of the clamp with the magnet and the mirror con- tribute to the inertia of the motor. How- ever, tests showed that this contribu- tion was smaller than the inertia of the rotor itself and this contribution can therefore be ignored. It is best if the mirrors are so-called first surface (or front surface) mirrors. These do not have glass in front of the reflective surface, which avoids addi- tional refraction and means that the angle of incidence is always equal to the angle of reflection. This ensures that the laser beam remains nice and focussed after reflection. First surface mirrors can often be found in older (laser) printers/scanners/bar code readers and can be cut to size reason- ably easily using a glass cutter. The mirrors in the laser projector are cut with dimensions of about 6x8 mm. When gluing the mirrors you have to make sure which side has the reflect- ing layer. The rear side (the side with the glass) is obviously the side that is to be glued. Once the glue has set properly the servo can be assembled. The motor has to be mounted on a piece of circuit board, preferably using the original mounting screws. Make sure that the screws do not protrude too far into the motor so that they touch the rotor. The shaft coupling, complete with magnet and mirror, can now be attached to the shaft. After this, the Hall effect sensor has to be mounted in front of the lit- tle magnet. The Hall sensor used in the prototype was in an SMD package and therefore a small piece of circuit board was used as the mounting sup- port for the sensor. The same sensor is also available in a SIP package, which makes things somewhat easier. When positioning the sensor you have to take into account the desired mir- ror position, which will usually be 45 degrees for a 90° reflection. The centre of the sensor package has to be exactly opposite the magnet at a distance of about 1-2 mm. This is precision work, but is not hard to do. To ensure that the magnet cannot turn too far away from the sensor, two end- stops are fitted that prevent this from happening. The end stops are easily Figure 3. Each servo motor is controlled by this circuit. The input is therefore connected to the X-servo and Y-servo outputs of the main schematic (Figure 1). 62 elektor - 6/2008 Figure 4. To enable control in both the x- as well as the y-direction the servos can be positioned like this. mounted and are in the form of two pieces of wire, cut from a resistor lead, for example. These can be soldered onto the motor PCB to the left and right of the screw for the shaft cou- pling. This completes the servo. Servo control The electronics for the servo drive can be kept quite simple (see Figure 3). PI is used to set the input signal sen- sitivity and determines the maximum projection format. P2 sets a DC-offset, which is used to move the projection image a little, for example. ICla ampli- fies the difference between the signal from the magnet sensor and the input signal. When this difference is posi- tive, the motor turns in the opposite direction compared to when this sig- nal is negative. In this way a closed loop is created which is necessary for controlling the servo. IClb is a propor- tional-differential (PD) amplifier. This is indispensable to correct the phase of the feedback loop. IC2 and IC3 are connected as a bridged amplifier for driving the motor. These An opened CD-drive. The little DC-motor under con- sideration sits at the front in the middle. ICs, type TDA2030, are intended as an audio amplifier but are functionally just big difference amplifiers that can deliver about 3 A. More than enough for this type of motor. Four diodes pre- vent the inductive flyback voltage of the motor from damaging the IC. The power supply voltage for these ICs is provided by a 7809 regulator. With a 9-V power supply, IC2 and IC3 can drive the motor with plus and minus 6 volts. In the prototype IC2, IC3 and the 7809 were all mounted without insulation on a common heatsink. The current consumption of the servos depends on the amount of drive. This is typically not more than 100-200 mA each. The average power consumption of the entire projector including a 5 mW red laser module is about 300 mA. Bat- teries will therefore not last very long, but powering from a mains adapter or a small lead-acid battery for ‘in-the- field operation’ are good options. Adjusting the servos When a servo is connect to the drive PCB for the first time, all the potenti- The little DC-motor as removed from the CD-drive (keep the little mounting screws). ometers have to be set to their cen- tre positions. When the power sup- ply is connected, and all is well, the motor now turns such that the mag- net is exactly opposite the sensor. If the magnet turns away from the sen- sor then the motor wires need to be swapped around. Using HyperTerminal we can send commands via the serial port to the projector. There are two commands for adjusting the step response of the servos: AX and AY (adjust X/Y). After issuing an AY command the step response of the Y-servo is projected. The potentiometers for the PD con- troller and motor driver now need to be adjusted so that the projection is a nice, clean pulse waveform with- out showing any oscillation artefacts. The same is true for the X-servo after issuing the AX command. Repeat the adjustment of both servos once more. Measured with an oscilloscope (at the sensor output), the step response time of the prototype was about 2-4 ms, depending on the step size. The -3 dB sine response is about 150 Hz. In operation Once the servos are working and are adjusted properly, the projector itself can be tried. The serial port of the pro- jector is connected to the serial port of a PC/laptop. Start HyperTerminal and enter the COM-port settings. A con- nection can now be established with the ATmega88. You can now enter commands using the keyboard. With the LC command (list commands) the list of available commands is dis- played on the screen. Each command consists of two (capital) letters. If there are no parameters this is then imme- diately followed by pressing the enter key. Commands with parameters are All parts of the servos together: mirror, shaft cou- pling, magnet sensor and the little magnet. 6/2008 - elektor 63 MODDING & TWEAKING The little motor mounted on a piece of printed cir- cuit board with the 45-degree line where the magnet sensor has to come. The mirror, the shaft coupling and the little magnet, ready to be glued together. The mirror glued to the shaft coupling; the magnet is next. entered by typing the command, fol- lowed by a space, then a parameter, then another space, etc. Parameters are a number, usually 0-9. There is no checking of the input and therefore there are no error messages either! Using the command MS (mode set), one of four modes can be selected. If the projector is used on an occa- sion where music is played, it can be nice to show the music as an oscillo- scope image on the wall. In this case the sound output from a CD-player, or from a microphone with pre-ampli- fier, is connected to the Y-input of the controller. After issuing the command MS 3, the projector operates as a pro- jection oscilloscope. The command SS (save settings) can now be used to save everything. If the projector is now switched back on, after having been switched off, it will continue to oper- ate with these same settings and can therefore operate ‘stand-alone’. If the projector is to be used as a non- stop text display this can be accom- plished as follows: the text is entered with the TX command. The text size and scroll speed are set with TS. The entered text is now projected as a run- ning text display. If the text is dis- played in mirror image or upside down then this can be corrected with the RE command. Once all is correct, the SS command can be used to store every- thing (including the entered text). To project text, the MS 1 or MS 2 com- mand need to be issued. In mode 1 the text scrolls letter by letter and in mode 2 word by word. With the latter there is the possibility that a word is too long when the letter size is too large. No error detection for this situation is pro- grammed in, users will have to look out for this themselves. An important adjustment is the tim- ing. The software assumes predictable response times of the servos. These are stored as two parameters. Using the TM command with 2 parameters these can be altered and saved with SS. In the TM command the first parameter is a fixed time and the second causes a delay proportional to the size of the projection. The default is: TM 3 4. The projector works well with the default settings, but experimenting with the settings gives you a better feeling for the workings of the projector. For exam- ple, TM 1 4 distorts the projection and with TM 4 4 is slower than necessary. Fine adjustment is possible however and can gain some speed which means that texts with larger scroll widths can be used. These would otherwise be delayed too much which results in a flickering image. This is however only a problem with large letters and a scroll width of more than about 5 characters. Should this experimenting with the settings result in some problems with the display, the LD command (load defaults) can be used to set every- thing back to the initial state. Don’t forget to store this ‘reset’ with the SS command. Positioning Figure 4 and the photos show how the servos can be positioned. It is advis- able that the position of at least one servo and also that of the laser is made to be mechanically adjustable. It is important that no laser light misses the mirrors. With a little bit of adjust- ment of the laser position (height and direction) all of the correct settings are usually easily found. Note that with laser modules the hous- ing is often the + connection. A little piece of heatshrink sleeving is then required for insulation. Lasers with larger powers As mentioned before, working with red lasers can be considered safe for pow- A small nail holds the magnet in place for gluing. The shaft coupling with mirror and magnet, all glued together. The complete shaft coupling, mounted on the motor shaft. Now the Hall-sensor. 64 elektor - 6/2008 The complete servo including the magnet sensor which is held in the correct place with a small PCB. We make the mechanical construction with M3 hard- ware and aluminium angle profile. The two mounted servos with the laser module in the foreground. ers up to a few milliwatts (still, never look into the beam). The advantage of a green laser compared to a red one is that the eye is much more sensitive to green light, so that the projection appears much brighter. Green lasers are usually DPSS (Diode Pumped Solid State) types, where the beam of an 808 nm infrared laser diode drives a pair of crystals. These crystals convert the 808 nm beam in two steps to 532 nm (green). The efficiency of this is much smaller than 100% so that, in principle, a big infrared laser diode is required. To illus- trate this: a 5 mW red laser diode requires a drive of about 40 mA, a 5 mW green DPSS module needs typically 200 mA. If you must work with more power, then for a few tens of Euro you can purchase a green laser pointer rated at, for exam- ple, 30 mW. These will have to be dismantled, which usually involves sawing to gain access to the driver PCB. The driver PCB often delivers too little current and/or is too slow. Driving the diode directly with a current source is often the best solution for optimum speed and light output. When the driver PCB is removed, after determin- ing which are the connections to the laser diode, it is best if the laser diode and photo diode are connected in anti- parallel. This is just a case of soldering two pins to each other (usually pin 1 and pin 3, pin 2 is the housing). This is because a laser diode typically has a reverse blocking voltage of no more than 2 V and the photo diode prevents this from being exceeded. Laser diodes are also sensitive to static discharge, so take the necessary precautions. In the circuit of Figure 1 there is an additional circuit for driving a bigger laser diode with a constant current and to modulate it. The assumption here is for a current of 500 mA for a 30 mW DPSS module obtained from a laser pointer. The TDA2030 is configured as a current source which can be modulated with TTL signals and the L200 is added as regulator with current limiter. This is additional safety to protect the expen- r — — — — — — — — — — — — — — — — — — — t ! Program fuse ; settings ; i BOOTSZ =11 i 1 BODLEVEL =100 1 | CKSEL = 0111 [ ! SUT = 1 1 ! 1 (brownout VCC = 4,3 V, 1 i ext. full swing XTal) i _ _ _ J sive laser module from currents greater than about 550 mA. The potentiome- ter sets the quiescent current which is just below the threshold at which the module starts to ‘laser’ This serves to slightly increase the average tem- perature (for optimal light output). The resistor R is used to set the current through the laser diode and R l is for the current limit. If the nominal current needs to be 500 mA, for example, it is safe to calculate R T for 550 mA (500 + 10 %). Applications There are of course a number of interesting applications for a laser projector. It is, for example, possible to use it for chatting. Two people and two tables with a computer on each can be posi- tioned against opposite walls. The chatters can then see the text of the other person behind/ above their monitor on the wall. Using the wall of a larger build- ing it is possible to chat in a group, provided each participant has their own projector, of course. Another application is the projection of advertising messages in a shop win- dow, for example. This can be done from the inside because the text can be projected mirror-reversed. The text can then be read normally from the outside. Many other applications can be con- ceived of, but we leave those up to you. ( 071141 - 1 ) The complete laser projector: the two servo driver PCBs are on the right, the servos are at back left and the controller and RS232 in- terface are in front on the left. 6/2008 - elektor 65 MESSE MGNCHEN INTERNATIONAL Visit India’s largest Show for Electronic Components, Assemblies, Materials and Production Technologies enter the center^ of the Indian electronics industry/ * If / MARK THESE DATES: BQDB SEPT. 2008 / Sponsored by: Department of Information Technology Ministry of Communications & Information Technology, Government of India India's electronics industry is booming in all aspects. Participate in this dynamic growth and exhibit at the 9th electroniclndia in Bangalore, India's "Silicon Valley" and hub to its huge electronics and IT industry. Take advantage of this unique opportunity and present your products and services to a first-rate audience of decision-makers at India's No. 1 electronics forum. Also Participate in Three International Conferences: 1) EMS/Contract Manufacturing: The Indian Perspective 2) Symposium: The Trends and Future Requirements in Automotive Electronics 3) Exploring the Latest Technologies and Tools in Electronics Design electroniclndia 2008 September 2-5, 2008 Bangalore International Exhibition Centre (BIEC) Bangalore, India Platinum Sponsors SIEMENS Lamp Post Banners Sponsors Visitor Badge Sponsors ft H*H *1 l eatdec U 1 Some Key Exhibitors Carry Bag Sponsors Infineon v. j%> a r «i , siftui v rjrt 1 1 Other Sponsors M MIYACHI j jiijjj/ AAPJjW ARROW ASIA PAC LTD. ytesembf on AT&S mn . CENTUM d CIPSA-RIC India Pvt. Ltd. DIGITAL r EM lec Technologies EPCOS t^t Farnell ARROW ASSEMBLEON Ascent Circuits AT&S Bergen Associates Bergen Systems Centum CDIL CIPSA-RIC India Digital Circuits EMS Technologies EPCOS Estovir Farnell Fuji Electric HARTING Halting [Henkel Hieal 1 iNETest Resources Pte Ltd r®v J.A.M. ■JUKI Hynetic INetestJtesources IND £ Enterprises Relaytronics ill SiN c* /4g SERVICE LEADERSHIP INNOVATION SAMSUNG SCHLEUNIGER SLN Technologies SM Electronic 3 Technologies (P) Ltd. TAVSWW Sumitron Taiyo Yuden Tamura Corporation komax KOMAX TDfviEN Tomen Electronics KYORITSU V RONICS N & Ol 1 OK INTERNATIONAL u KYORITSU NMTRONICS Semiconductors OK International PANASONIC APW President TEC TRULY TRANS-TEC Manufacturing"^. Tyco Electronics Vinyas Tjrr.fr Wurth YOKOGAWA ♦ Yokogawa Co-organisers / Co-sponsors AEIS w CEIEC 0 ©OODs m IET The Knowledge Network IPCA to- es §gfg| . ■■ ■§! ZV€I: AEIS CCPIT CEIEC CEAC CLIK ELIAP IET IGCC IPCA TEEMA VDMA ZVEI MMI India Private Limited 23, Deccan Court, S. V. Road, Bandra (West), Mumbai - 400 050. India Tel.: +91 22 26452101 / 2 / 3, Telefax: +91 22 26516372 E-mail: info@mmi-india.in, info@electronicindia.net URL: www.electronicindia.net Supported by I- n V It ¥ Hong Kong Trade Development Council $ Department of Information Technology Ministry of Communications & Information Technology, Government of India Mp 1 Federal Ministry of 1 Economics and Labour l 1 made ■ in TRADE & 1 Germany INVESTMENT www.uktradeinvest.gov.uk Elector 07 AnQlfL L^MDTI-lE'Sd A TAT/ON Lunw flFEr“-E - r-STEir Haw tet Dl.'i a acjJitiH wajjw gwu viof li pp^mi^jjrj DwJUiimp(rM , b*ih* Jr AlJH 900 / 30 QO t SliXUfr Z* 1® 4opk> II &. C-LynnK-dwfi -H4! : ^ •-- «;|15; J^r C™n«rHhW 4NGIUDES- M ■ f«*L [h-rTr-HH * LT intfn! ^ rCiM^MMjiMtiJUlJQSJLatetaJ ^h -TiwFyn Wi|i wLMmEjmtetifedSiffmTiil ™ fuT. i‘mBiiiTiBiirTii‘i‘irii fiT iiiinrr ^ ‘■C>THJktr'5t/t^*^ B m l .k? iH ln. -H: Nifr . .1 • Bilan*, rm Qi i^b git»i foti Cihiwh< .'■ T/ ESnH'ni!- HR ftl I K* Wk - Vy ^ /V Ce i i-T*rt# HR WWW.XEANESTATIOM.CDM Pm: ^ i aufmwlQHUHVLiHEt - P. -E :■ Tel: 01635 40347 Ni;i.vhury El i : i : I r 1 1 1 1 i : : :■: Lid Fm: DIG® 3&I43 FiiVih, n.Jj Hji-Iilii- EeiliFW,14 MU ; mill. clmultattnrujbu^.tOTn.Ki.uik: K^vwj^HrbnryidiKftnnlns.M.iilc l Electronics inside out! The free e-magazine about internet, computers, hacking, tweaking, modeling, gadgets, geekstuff, gaming and DIY electronics. The e-zine you have to check out now! Receive i-TRIXX in your mailbox FOR FREE each Wednesday! WWW. elektor. com Play the i-TRIXX Quiz and win! Test your knowledge about internet, computers and electronics. Take your chance now and play the i-TRIXX Quiz. There are great prices to win! PCB House Start from £30 Prototype & Production No Min Order Fast Delivery From the Elektor labs: Simple, useful and fun electronic circuits! Powered by Check i-TRIXX. com and subscribe now! [jjektor 9/2008 - elektor 67 E-BLOCKS E-blocks: Accelerated Design E-blocks + Flowcode + TINA John Dobson (Matrix Multimedia) In this article we take a look at some of the latest techniques you can use to accelerate the design process, in this case of a switch-mode power supply. Figure 1. Principle of a step-up ('boost') voltage converter (redrawn from Microchip application note). Figure 2. Basic circuit of a switch- mode step-up voltage converter (note: schematic for use in TINA, redrawn in Elektor style). RB 0-° +5V © J- I 7 _8 9 jm 11 12 13 Vdd © K1 14 VI 3D U1 RBO RAO RBI RA1 RB2 RA2 RB3 RA3 RB4 RA4 RB5 RA5 RB6 RA6 RB7 RA7 PIC16F88 v< 5S 17 18 1 2 _3 4 _1S 16 CFB VfB -O R2 £ R load 080194-12 Switched mode power supplies (SMPSUs) are traditionally viewed as a bit of a black art. And with good reason - the mathematics behind the design process is complex, prototy- ping — often with custom wound inductors — is awkward, and the custom SMPS regulation chips used in the design itself are expensive. However this does not need to be the case: most modern circuits now contain a microcontroller with extra capacity that can be used to control the power supply, and design tools have advanced to a point where virtual prototyping is now possible. Sure, the mathematics is still there - but the use of simulation tools, with a little trial and error, means that if you make a wrong turn, get- ting back on track is not so difficult. At least that is what we are hoping — we have to assume we're complete no- vices here! The circuit We are looking at the possibility of generating a 1 2 to 15 VDC voltage rail from a 5 VDC supply. This is for an instrument that requires ±12 V rails. As the application is only for driving a few opamps we only need a few tens of milliamps — if that. Having sniffed around the Internet we came across a Microchip Application Note that describes the use of the elementary circuit in Figure 1 . This is a fairly traditional 'boost converter'. We intend to po- wer the circuit with a 5 V supply — shown as V in . FET T1 is periodically switched on by a pulsed control input — more about this later. At the point where the FET is switched on, a relatively large current is drawn through inductor LI , and the energy stored in the inductor increases. All of this cur- rent will be supplied via the 5 V supply — Schottky diode D1 will ensure that no current flows from the second half of the circuit because V out is greater than V in . At the point where the FET turns off, the energy stored in the inductor is released. In this release there will be a voltage surge across the inductor which will result in a larger voltage at point A than the supply voltage. At this time in the cycle diode D1 will start conducting and charge will be pumped across it into Cl . As long as the discharge current through the load, 68 elektor - 9/2008 R1 , is not too large then the result of this circuit is that the output voltage is larger than the input voltage. So this is a great little circuit that can be implemented rela- tively cheaply, and will — in theory — do the job we need. Providing that the load is precisely known — and does not change — and a switching waveform of an appropriate frequency and period can be supplied, we are home and dry. Of course these conditions rarely apply — loads vary depending on the actions of the rest of the circuit, compo- nents have tolerances and in practice a closed loop system incorporating some method of regulation is going to be nee- ded. A more practical circuit is shown in Figure 2. This is essentially the same circuit with some additions. As the currents drawn by LI can be large, a couple of capa- citors have been placed across the supply rail for decou- pling. The load resistor here is 500 ohms. This will give us around 30 mA as the model load — more than enough for our needs. The FET switching control is governed by a PIC microcontroller output pin. The pulse waveform on this line will determine the charge and discharge of LI . To complete the feedback loop, the circuit output voltage is fed into the PICmicro analogue input pin A1 via a potential divider made up of R1 and R2. The RC network formed by R2 and C FB provides a little smoothing on the feedback signal. The value of C FB can be established empirically. Software development The firmware to make the PIC supply the control pulses was developed using Flowcode, the software suite with E- Figure 3. A section of the Flowcode program written for the PIC-controlled SMPSU. p J-L* >lO-L r D®- u ! \ { 1 \ 1 I \ , s ir*’ Hx** •?. Figure 4. TINA at work showing the response of a virtual circuit running Flowcode- generated ASM code and combining a PIC with analogue components. Now start optimizing without soldering! Advertisement See your design in print! Elektor Electronics (Publishing) are looking for Freelance Technical Authors/ Designers If you have # an innovative or otherwise original design you would like to see in print in Europe's largest magazine on practical electronics # above average skills in designing electronic circuits # experience in writing electronics-related software # basic skills in complementing your design with an explanatory text # a PC, email and Internet access for efficient communication with our in-house design staff; then do not hesitate to contact us for exciting opportunities in getting your designs published on a regular basis. Elektor Electronics Jan Buiting, Editor P.O. Box 1 1, NL-614I-AV Susteren, The Netherlands, Fax: (+31) 46 4370161 Email: editor@elektor.com 9/2008 - elektor 69 E-BLOCKS Figure 5. TINA also routes the PCB tracks (5a) and generates a 3-D rendering of the board (5b). blocks. The program is relatively simple and can be seen in Figure 3. Referring to this and the schematic, here is a description of how the program works. The .fcf file proper sits in archive file 0801 94.-1 1 .zip on the Elektor website for those that want to study the details. In the MAIN loop the program sets up the relevant pins as inputs and outputs and sets system variables. An inter- rupt icon is used to trigger an interrupt at around 10 kHz, equivalent to 100 |js. Then there is a 'C' icon with the contents: the internal voltage reference. If the voltage is lower than a preset threshold (in this case 80 Fex which corresponds to about 2.5 volts at pin RA1) then a flag is set and the FET is turned on by pin B0 for one interrupt cycle - around 100 ps. When the FET is on, current flows through the in- ductor and when the FET is turned off, the back-EMF produ- ced increases the voltage at point V sw so current flows throu- gh the diode. If the voltage at RA1 is above the threshold then the FET is not turned on. From Hungary comes TINA Now for the clever bit - the schematic shown in Figure 2 can be entered into in a software package called 'TINA' from DesignSoft [2]. TINA supports a relatively new kind of simulation where you can simulate high-speed analogue circuitry at the same time as simulating your microcontroller running the code you have designed. The process here is simple: design your software using Flowcode, assemble the Flowcode program to ASM code, alter the characteristics of the PIC inside TINA so that the microcontroller is associated with the relevant ASM file and then simulate the circuit. You can see the results of the simulation in Figure 4. The first trace shows the current drawn at point AMI throu- gh the inductor, the second trace shows the state of RB0, the third trace shows the feedback voltage, the fourth shows the input voltage V in , the fifth trace shows the output voltage, and the last trace shows the voltage at the junction of the FET drain and the inductor. Whilst there is some ripple on the output the voltage is a pretty steady 14 V. The big sur- prise for me here was the amount of current taken in the first few milliseconds and the size of the subsequent bursts which are more than an amp! Getting practical (again) So having got the simulation working we used an E-blocks Multiprogrammer and a Prototype Board to put the cir- cuit together. The system seems to work well with around 1 3.5 V at 30 mA. If you try to lower the load resistor and draw more current then all sorts of strange things happen as the 7805 regulator we are using starts its impression of a toaster and cuts out at regular intervals resetting the PIC. As an added bonus here it makes a noise like a rat being strangled — stand clear! The PCB design and 3-D rendering generated using TINA are shown in Figure 5. The exercise once again proves that both Flowcode and E-blocks are far more 'open' products than is often assumed, and right up the street of anyone starting out in microcontrollers, whether PIC as demonstra- ted here or AVR. ( 080194 - 1 ) cmcon = 0x02; //set comparator register to compare with internal Vref cvrcon = OxAC; //set internal Vref to Vcc/2 A comparator, rather than an A/D, is used because it ope- rates much faster by comparison (the PIC16F88 supports both internal comparators and A/Ds) The last icon in the MAIN flowchart is a While loop which just keeps the pro- gram running — all the control is carried out by the timer interrupt routine. The interrupt routine first reads the internal comparator which compares the feedback at point V FB (on RA1) with Web Links [1] www.elektor.com/0801 94 (Free downloads) [2] www.tina.com E-blocks E-blocks is a modular system designed to learn microcontroller programming at various levels. The current product range comprises about 70 modules and ancillaries for PIC, AVR and ARM platforms. E-blocks systems employ the 'Flowcode 7 graphics programming software tool. E-blocks are available from the Elektor SH0R see www.elektor.com/e-blocks. 70 elektor - 9/2008 Our range of more than \ 43 hardware circuit boards, \ CD-ROMs, sensors and accessories \ has just got bigger. \ In addition to the new versions of \ Flowcode we now have bundles to allow you to rapidly develop systems based on RFID and Zigbee technology. BENEFIT NOW! The retail price of our bundles is at a significant discount to the sum of the individual parts. You’ll save a massive 30% discount w.r.t. individual items! Ordering Use the order form near the end of the magazine or go to www.elektor.com (shop). E-blocks will be shipped after receipt of payment. Prices are exclusive of postage. electronics worldwide More information and free downloads available on www.elektor.com/eblocks PROJECTS MINI PROJECT Ton Giesberts Using the circuit described here you can quickly and simply check whether harmful sounds with a high frequency are being produced somewhere nearby, especially important at locations where the so-called ultrasonic teen-deterrents against loitering youths are installed. Ten LEDs indicate the sound pressure of signals with frequencies between 16 and 40 kHz. These days, to harass loitering youths into leaving, an ‘ultrasonic’ sound sys- tem is often used (such as the Mos- quito). Such a system generates, in the vicinity of a popular gathering place, a sound with frequencies between 17 and 20 kHz. This sound appears to be very irritating to youths, with the result that they soon move on. Older people appear to be unable to hear these fre- quencies and are therefore not both- ered by them. The term ‘ultrasonic’ is actually not quite correct. Ultrasonic sound is nor- mally used to describe the range of fre- quencies that are above the range of human hearing, that is, above 20 kHz. Because the frequencies used are below 20 kHz, they are not only audi- ble to loitering youths (insofar as they don’t have any hearing damage), but they are even better heard by babies, small children and pets. The sound pressure is not all that high, according to data provided by the manufacturer. But if the ultrasonic deterrent is never- theless considered to be annoying, it is very likely to be even more irritating to babies and small children (and that is not taking into account the poten- tial hearing damage by prolonged exposure). Babies and pets cannot say what is wrong (with the exception of par- rots perhaps). So if you are walking through the city with a baby there is the chance that the child is exposed to these types of sound without the par- ents realising. So that you can quickly get an indi- cation whether harmful sounds with a high frequency are being produced somewhere, we designed an indica- tor that can detect these signals and measures their intensity. Ten LEDs show the sound pressure of sound in the frequency range from 16 to 40 kHz. Lower frequencies are suppressed by a fifth-order, high-pass, Butterworth fil- ter so that the indicator will not react to speech and other everyday sounds. When designing the measuring range for the indicator the decision was made for maximum deflection at a sound pressure of 90 dB. If you are exposed to 90 dB for more than an hour then there is the risk of permanent hearing dam- age. Whether you can also suffer hear- ing damage from frequencies you can- not hear any more, wear of the audi- tory ossicles for example, has not been researched yet. Schematic The circuit shown in Figure 1 may look quite involved, but it is really not that bad. The circuit comprises a micro- phone amplifier, a fifth- order high-pass filter, an active rectifier, a buffer stage and finally the display driver with ten LEDs. For driving these LEDs we used the old, trusty LM3915 in dot-mode (we deliberately did not choose bar-mode because of the current consumption). This IC is configured for its simplest application with REF ADJ connected to ground. In this configuration the input signal has to be 1.28 V DC (typically) for ‘full deflection’. Working backwards from this value and the sensitivity of the electret- microphone that is used, we can cal- culate the required gain. For the micro- phone we chose a type that can be obtained from Farnell (the Kingstate type KEEG1542TBL-A). This choice was mainly determined by the fre- quency response curve shown in the datasheet (which can be downloaded courtesy Farnell). This shows a slight increase towards 20 kHz, which leads us to conclude that it will still be usa- ble at frequencies a little over 20 kHz. While there may be a lot of ripple in the curve above 20 kHz this is not a problem since we’re only looking for an indicative measure of sound pressure. At 90 dB the microphone module will give an output of about 8 mV. When we take into account that the rectifier contains a peak detector (makes a dif- ference of V2 in the gain) and that the sensitivity of the microphone can vary by up to ±3 dB, we therefore need a cir- cuit with a minimum gain in the region of 80 to 160. The input contains a gain stage (IC1A) which amplifies 40 times. This also cuts off the lowest frequencies at the same time (Cl and C4). C3 and C5 compen- sate a little for the slight drop of fre- quency response above 20 kHz. For the opamps the ST type TS924IN quad rail- 72 elektor - 9/2008 +3V 100n Term.2 L Term.1 +3V 470n +3VO— t w D1 D2 9 7 6 5 3 V+ MDSEL LED1 REF OUT LED2 DIVHI LED3 IC2 LED4 IN LED5 LED6 LED7 LM3915N LED8 REF ADJ LED9 DIVLO LED10 V- ♦ DIO 080602-11 w Figure 1. With this circuit you can very easily track down high-frequency audio signals. 9/2008 - elektor 73 MINI PROJECT Figure 2. The frequency characteristic of the input amplifier on its own (green) and the input amplifier followed by the high-pass filter (blue). to-rail device was selected, which can deliver no less than 80 mA. This opamp has a relatively large GBW (gain-band- width product) of 4 MHz, so that the bandwidth of the input amplifier at a gain of 40 is still 100 kHz (C5 is only for RF decoupling), more than enough for this application. This is followed by a steep filter built around IC1B that passes only frequencies above 16 kHz (-3 dB). The measurement curves (Fig- ure 2) show the amplitude response of the input amplifier on its own and that of the input amplifier followed by the filter. For the proper operation of the fifth-order filter a buffer is not enough, but the opamp needs to have a gain of 2 (this can be seen clearly in the measurement curves). This is a fortunate circumstance since the other stages now don’t need to have as much gain. The filter contains an adjustable com- ponent to allow for the compensation of component tolerances. PI can be used to make the curve as straight as possible. If you do not have the means to measure this then you can use the nominal value of 870 Q for PI instead. It is still recommended to measure and select C6 through CIO for equal values. The rectifier around IC1C is a stand- ard implementation, where the usual diode between the output of the opamp (pin 8) and the inverting input (pin 9) is not necessary because the output cannot go negative. To ensure correct operation, the rectifier is AC- coupled (R15/C12) to the output of the filter. Dll protects the input of the opamp from excessive negative input voltages. The output voltage of the rectifier (cathode of D12) charges capacitor C13 to the peak value via R18. The purpose of R18 is to limit the maximum charg- ing current. With the values as shown, C13 is charged relatively quickly, the RC time-constant is only 22 |is. The total amplification of the circuit can be adjusted over a wide range with P2 so that other (less sensitive micro- phones) can be used as well. The dis- charge time of C13 varies somewhat with the setting of P2, but that is not important here. The fourth opamp (IC1D) is used as a buffer to drive the LM3915. Although the resolution of the LM3915 is 30 dB (10 x 3 dB) but because of the simple design of the rectifier the volt- age across C13 is not exactly propor- tional to the input signal. The bottom LED D1 lights up at -21 dB compared to the voltage required to turn on the topmost LED (D10). The current consumption of the whole circuit is between 11 and 15 mA, good for six days of continuous use. The cir- cuit appears to work down to nearly 2 V, so that instead of alkaline batteries rechargeable batteries could be used as well. This is much more environ- mentally friendly. If you like to experiment, you could try to make a small parabolic reflector so that you can pinpoint the source of the ultrasonic sound. The microphone needs to be mounted at the focal point of the reflector. Perhaps even a small horn is already enough... ( 080602 - 1 ) Advertisement Your price conscious PCB supplier EUliE) CIRCUITS Online price calculation Online ordering Online order tracking Online 24/24H arid 7/70 Interested? Contact us: 444 2088 167 005 E-mail; euro@eurocircuits.com www.eurocircuits.com ( Verified ) A la carte pooling for standard boards up to 6 layers from 1 to 1000 pieces from 3 working days onwards - pooling with mors- options * up to s layers - from 1 to iOOD pi£C££ - from 3 working days onwards your board, our challenge up to 16 layers from 1 piece onwards from 3 working days onwards 74 elektor - 9/2008 + Elektor PLUS advantages Subscription 1 0 Magazines 1 Double Issue (juiy/Augus ) Annual CD-ROM 2GB MP3 player Total value of Individ. Elektor year subscrif Your saving Keep > 44.80 in your pocket! • Cheaper than 1 1 issues from the newsstand More than £10 discount on the new Annual CD-ROM With every issue subscribers get up to 40% discount on selected Elektor products As a welcome gift you get a free 2GB MP3 player worth £31 .50 No queues, travelling, parking fees or “sold out” Elektor is supplied to your doorstep every month Always up to date - read your copy before everyone else www.elektor.com/subs • Tel. +44 (0) 20 8261 4509 Or use the subscription order form near the end of the magazine. INFOTAINMENT PUZZLE H^YAn^KFl Puzzle with an l iV^A WvJvJrVvl electronics touch After the colossal — but reportedly not too difficult — AlphaSudoku puzzle in the Summer Circuits edition we cheerfully continue with a regular Hexadoku. As before, do participate! All correct entries received enter a prize draw for an E-blocks Starter Kit Professional and three Elektor Shop vouchers. The instructions for this puzzle are straightforward. In the diagram composed of 1 6 x 1 6 boxes, enter numbers such that all hexadecimal numbers 0 through F (that's 0-9 and A-F) occur once only in each row, once in each column and in each of the 4x4 boxes (marked by the thicker black lines). A number of clues are given in the puzzle and these determine the start situation. All correct entries received for each month's puzzle go into a draw for a main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. The puzzle is also available as a free download from our website. SOLVE HEXADOKU AND WIN! Correct solutions received enter a prize draw for an E-blocks Starter Kit Professional worth £248.55 and three Elektor SHOP Vouchers worth £35.00 each. We believe these prizes should encourage all our readers to participate! The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. PARTICIPATE! Please send your solution (the numbers in the grey boxes) by email to: editor@elektor.com - Subject: hexadoku 9-2008 (please copy exactly). Include with your solution: full name and street address. Alternatively, by fax or post to: Elektor Hexadoku Regus Brentford - 1000 Great West Road - Brentford TW8 9HH United Kingdom - Fax (+44) 208 2614447 The closing date is 1 October 2008. PRIZE WINNERS The solution of the June 2008 puzzle is: 0EA75. The E-blocks Starter Kit Professional goes to: John Hall (UK). An Elektor SHOP voucher worth £35.00 goes to: Francois Herbert (NZ); Antonescu Alexandru-Florian (RO); Sven Skjenneberg (N). Congratulations everybody! F 1 7 9 A 8 4 2 0 1 B 7 3 E A E B 5 3 C 7 2 F 1 7 9 3 1 C B A 0 8 5 3 2 F 9 E 0 D C 1 3 8 2 4 C 2 1 5 8 2 E F 9 D C 1 3 7 A 6 3 9 8 C 4 B 5 7 2 6 3 4 8 D B A F A 8 C F 5 6 2 B C 4 7 E 9 D 3 1 1 0 A 8 D C 6 F 0 2 5 E 8 D 8 7 2 1 B 6 0 9 5 E 5 2 D 9 4 8 1 B (c) PZZL.com 7 1 0 5 F 4 2 A 8 C 3 6 D 9 B E D 2 8 9 1 0 E 3 B 4 7 5 C 6 A F F 4 3 6 D B 8 C E A 1 9 2 7 5 0 A B E C 6 5 9 7 F 0 2 D 4 3 1 8 9 3 2 D B 7 6 1 4 5 E A 0 F 8 C E C 5 8 2 A 3 4 7 1 F 0 6 B 9 D B 7 1 A 5 9 F 0 6 D C 8 3 E 4 2 4 F 6 0 E 8 C D 2 9 B 3 5 A 7 1 8 A F 2 C E 4 5 3 6 9 1 B 0 D 7 0 6 B 7 8 D 1 2 C E A 4 F 5 3 9 C D 4 E 9 3 7 B 5 F 0 2 8 1 6 A 3 5 9 1 0 F A 6 D B 8 7 E C 2 4 5 E A F 7 C D 8 1 2 6 B 9 4 0 3 1 8 C B A 2 5 9 0 3 4 F 7 D E 6 2 9 D 4 3 6 0 E A 7 5 C 1 8 F B 6 0 7 3 4 1 B F 9 8 D E A 2 C 5 76 elektor - 9/2008 RETRONICS INFOTAINMENT E1T decade scaler tube (ca. 1954) Rui Figueiredo A previous instalment of Retronics discussing the 'Dekatron' decimal counter valve [1] having aroused my attention through feedback pub- lished in Elektor's Mail- box section, I thought I'd alert the Editor to another counter tube, the Philips E1T. A good amount of information on the actual use of the device being available on the Internet (see web links), I decided to concentrate on the sci- entific environment at the time when the E1T was 'prima donna'. First produced at around 1954, the E1T combines a display, a scratch memory and a counter in one device. Even for those not familiar with elec- tron tubes, the diagram (reproduced from radi- omuseum. org) gives an idea about the opera- tion of the E 1 T and how it fits in a counter cascade arrangement. The E1T may be lik- ened to a small cath- ode ray tube (CRT) in which the count/display readout (0 through 9) jumps from digit to digit under the control of deflection plates (E) with internal feedback maintaining the posi- tion until a new pulse occurs (see dynamic characteristics). The 1 0 th pulse causes the beam to collide with reset anode al (D). The resulting negative pulse is processed by an E90CC dual triode connected as a mon- ostable generating two pulses (or 'flags' if you like): a carry bit to drive the next decade, and a cutoff level to reset the El T to zero. The system, Brtmififtrrl (ttOiO NillMcHrmatlKKr OiuKUti) J*l .« <«> Mum ZtMrtHri A monostable: reset to zero (blanking); carry bit generator B next decade driver C pulse count driver D overflow detector E deflection plates G ribbon type electron beam H electron beam gun J blanking pulse (reset to zero) K slotted electrode (self-centering) and phosphor screen devised almost 60 years ago, is the precursor of 'overflow-with-carry' in a microprocessor! The use of the E 1 T seems restricted to Philips' own scientific division as well as high-end professional instruments and equip- ment including radar, nuclear and x-ray (XRD, XRF). In the latter appli- cation (without computers or calculators!) Bragg's law (nX = 2d sin 0) was traditionally relied on to count pulses. To cope with the tremendous 'intensity' variations expressed as the number of pulses and their ampli- tude, two techniques became established after some time. The first was counting all pulses com- ing from the detector (a Geiger or Flow counter), the second, applying the pulses to a pulse level detector set to 'thresh- old' or 'window' mode. A linear amplifier sup- plying output pulse lev- els between (almost) 0 V and 1 00 V pk was usu- ally inserted between the counter output and the pulse analyser. The El T's maxi mum 'speed' of about 30 kHz was a limiting factor, as well as the 27 ps neces- sary to reset the decades to zero (minimum safe width for non-selected tubes). This required the use of a prescaler if, say, three ElTs were intended to constitute a counter readout. Usually, the prescaler was a pure 8-bit coun- ter using E90CC triodes with neon lamps as bit readers. Thus any value on the three E1T dec- ades has to be multiplied by the prescaler-selected factor and added to the binary counter for better accuracy. The E1T was designed concep- tually at around 1946 by Adri- aan van Overbeek of the famous Philips NatLab (PhysLab), based on earlier research by Jan Jonker. Later, another NatLab worker, Kees Van der Velden (now C. Keith Vandervelden) further per- fected the device under super- vision of the legendary Klaas Rodenhuis of Philips TubeLabs. Probably due to cost, the E1T was not mass-produced like other Philips tubes. Yet it's not rare and Rodenhuis once said that the 10,000 or so devices around had been ordered from Philips TubeLabs' sample depart- ment (!). He also confirmed that 'E' was for 6.3 V heater, 'T' for 'tel lerbu is' (counter tube) and '1' for the first device in the series. See, you could count on Philips for consistency in type designations! ( 080365 - 1 ) This month's free Retronics down- load is the E1T datasheet. Reference [1] The 'Dekatron' decimal coun- ter valve, Elektor March 2008. Web Links www. radiomuseum.org/tubes/ tube_el t.html www.dos4ever.com/trochotron/ TROCH.html www.dos4ever.com/El T/El T.html www.tube-tester.com/sites/nixie/ different/el t-tubes/el t.htm www.lks.physik.uni-erlangen.de/ diffraction/iinter_bragg.html http://www-outreach.phy.cam. ac.uk/camphy/xraydiffraction/ xraydiffraction7_l .htm Retronics is a monthly column covering vintage electronics including legendary Elektor designs. Contributions, suggestions and requests are welcomed; please send an email to editor@elektor.com 9/2008 - elektor 77 ELEKTOR SHOWCASE To book your showcase space contact Huson International Media Tel. 0044 (0) 1 932 564999 ATC SEMITEC LTD www. atcse m itec . co . u k Thermal and current-sensitive components for temperature control and circuit protection; • NTC Thermistors • Current Diodes • Thermostats • Re-settable Fuses • Thermal Fuses • Temperature Sensors Call today for free samples and pricing Tel: 01 606 871 680 Fax: 01 606 872938 AVIT RESEARCH www.avitresearch.co.uk USB has never been so simple... with our USB to Microcontroller Interface cable. Appears just like a serial port to both PC and Microcontroller, for really easy USB connection to your projects, or replacement of existing RS232 interfaces. See our webpage for more details. From £10.00. BETA LAYOUT www.pcb-pool.com Beta layout Ltd Award- winning site in both English and German offers prototype PCBs at a fraction of the cost of the usual manufacturer’s prices. B0W00D ELECTRONICS LTD www. bowood-electronics.co.uk Suppliers of Electronic Components • Semiconductors • Opto Electronics • Passives • Enclosures • Switches • Stripboard • PCB Materials • Popular Special Offer Packs Online Store, all major cards Same day despatch upto 3.00pm Personal Service sales@bowood-electronics.co.uk Tel: 01246 200222. C S TECHNOLOGY LTD www.cstech.co.uk Low cost PIC prototyping kits, PCB's and components, DTMF decoder kits, CTCSS, FFSK, GPS/GSM, radio equipment and manuals. PCB design and PIC program development. DECIBIT C0.LTD. www.decibit.com • Development Kit 2.4 GHz • Transceiver nRF24L01 • AVR MCU ATmega168 DESIGNER SYSTEMS http://www.designersystems.co.uk Professional product development services. • Marine (Security, Tracking, Monitoring & control) • Automotive (AV, Tracking, Gadget, Monitoring & control) • Industrial (Safety systems, Monitoring over Ethernet) • Telecoms (PSTN handsets, GSM/GPRS) • Audiovisual ((HD)DVD accessories & controllers) Tel: +44 (0)1872 223306 EasyDAQ j •' i.- -- www.easydaq.biz • USB powered, 4 relays + 4 DIO channels • Will switch 240VAC @ 10 amps • Screw terminal access • LabVIEW, VB, VC • Free shipping • From £38 Design & supply of USB, USB Wireless, Ethernet & Serial, DAQ, Relay & DIO card products. info@easydaq.biz EASYSYNC http://www.easysync.co.uk EasySync Ltd sells a wide range of single and multi- port USB to RS232/RS422 and RS485 converters at competitive prices. ELNEC www.elnec.com • device programmer manufacturer • selling through contracted distributors all over the world • universal and dedicated device programmers • excellent support and after sale support • free SW updates • reliable HW • once a months new SW release • three years warranty for most programmers YOUR ELECTRONICS OPEN SOURCE http://dev.emcelettronica.com Website full of Projects and Resources for Electronics Engineers and DIY. • Tutorial • Hardware (Schematic & Gerber) ” • Firmware (Asm &C) • Reference Design Everyone can submit a story as a useful source! 'Share for life' First Technology Tttofltfof £fd. FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk/PICProTrng.html Microchip Professional C and Assembly Programming Courses. The future is embedded. Microchip Consultant /Training Partner developed courses: • Distance learning / instructor led • Assembly / C-Programming of PIC1 6, PIC1 8, PIC24, dsPIC microcontrollers • Foundation / Intermediate FLEXIPANEL LTD www.flexipanel.com TEAclippers - the smallest PIC programmers in the world, from £20 each: • Per-copy firmware sales • Firmware programming & archiving • In-the-field firmware updates • Protection from design theft by subcontractors FUTURE TECHNOLOGY DEVICES http://www.ftdichip.com FTDI designs and sells USB-UART and USB-FIFO interface i.c.’s. Complete with PC drivers, these devices simplify the task of designing or upgrading peripherals to USB ILP ELECTRONICS LTD www.ilpelectronics.com Tel +441233750481 Fax +441 233750578 ILP have been manufacturing audio modules since 1 971 and apart from our standard range we also offer a custom design service for the OEM market. 78 elektor - 9/2008 products and services directory LONDON ELECTRONICS COLLEGE http://www.lec.org.uk Vocational training and education for national qualifications in Electronics Engineering and Information Technology (BTEC First National, Higher National NVQs, GCSEs and GCEs). Also Technical Management and Languages. HE MQP ELECTRONICS www.mqp.com • Low cost USB Bus Analysers • High, Full or Low speed captures • Graphical analysis and filtering • Automatic speed detection • Bus powered from high speed PC • Capture buttons and feature connector • Optional analysis classes OBD2CABLES.COM http://www.obd2cables.com • Thousands of OBD cables and connectors in stock • Custom cable design and manufacturing • OBD breakout boxes and simulators • Guaranteed lowest prices • Single quantity orders OK • Convenient online ordering • Fast shipping Visit our website, or email us at: sales@obd2cables.com ROBOT ELECTRONICS http://www.robot-electronics.co.uk Advanced Sensors and Electronics for Robotics • Ultrasonic Range Finders • Compass modules • Infra-Red Thermal sensors • Motor Controllers • Vision Systems • Wireless Telemetry Links • Embedded Controllers ROBOTIQ http://www.robotiq.co.uk Build your own Robot! Fun for the whole family! • MeccanoTM Compatible • Computer Control • Radio Control • Tank Treads • Hydraulics Internet Technical Bookshop, 1-3 Fairlands House, North Street, Carshalton, Surrey SM5 2HW email: sales@robotiq.co.uk Tel: 020 8669 0769 RADIOMETRIX www.radiometrix.com The leading global developer of ISM band, low power radio modules for wireless data transmission: • Transmitters • Receivers • Transceivers • RF modems • Evaluation Kits SCANTOOL.NET http://www.scantool.net ScanTool.net offers a complete line of PC-based scan tools for under £50. • 1 year unconditional warranty • 90 day money back guarantee • For use with EOBD compliant vehicles • Fast shipping • Compatible with a wide range of diagnostic software Visit our website, or email us at: sales@scantool.net USB INSTRUMENTS http://www.usb-instruments.com USB Instruments specialises in PC based instrumentation products and software such as Oscilloscopes, Data Loggers, Logic Analaysers which interface to your PC via USB. VIRTINS TECHNOLOGY www.virtins.com PC and Pocket PC based virtual instrument such as sound card real time oscilloscope, spectrum analyzer, signal generator, multimeter, sound meter, SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business, Showcase - a permanent feature of the magazine where you will be able to showcase your products and services. For just £220 + VAT (£20 per issue for eleven issues) Elektor will publish your company name, website address and a 30-word description For £330 + VAT for the year (£30 per issue for eleven issues) we will publish the above plus run a 3cm deep full colour image - e.g. a product shot, a screen shot from your site, a company logo - your choice Places are limited and spaces will go on a strictly first come, first served basis. So-please fax back your order today! _ n I wish to promote my company, please book my space: • Text insertion only for £220 + VAT • Text and photo for £330 + VAT NAME: ORGANISATION: JOB TITLE: ADDRESS: TEL: PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 00-44-(0)1932 564998 COMPANY NAME WEB ADDRESS 30- WORD DESCRIPTION 9/2008 - elektor 79 BOOKS, CD-ROMs, KITS & MODULES (May 2008) Tthe linear supply. With the SAPS-400 we offer a powerful, adjustable symmetrical supply that's ideal for lightweight audio power amplifiers and happily sits in less than a quarter of the space taken by a comparable supply of conventional de- sign. PCB, populated and tested ready-mounted in aluminium U profile Art.# 070688-91 • £159.00 • US$318.00 Display Computer (May 2008) Programming a graphic display is dis- tinctly more difficult than programming a text display. Our mini microcontroller board features a new display-on-glass module and a high-performance Renesas Ml 6C microcontroller. The board is avail- able fully assembled, and the microcon- troller is pre-loaded with a TinyBasic interpreter to simplify the development of graphics applications - even for novices. PCB, populated and tested Art.#070827-91 • £78.80 • US$ 157.60 SAPS-400 DigiButler (May & April 2008) A low-cost home automation server based on a Freescale Coldfire 32-bit microcontroller. The project has been designed with open source in mind and doubles as a powerful Coldfire development system using free CodeWarrior software from Freescale. Dig i Butler activates electrical appliances in and around the home, accepting on/off commands from a WAP phone, through an Ethernet network or via a webpage at an allocated IP address and with full access security. Kit of parts including SMD-stuffed PCB , programmed microcontrol- ler, all leaded parts and CD-ROM containing both Elektor articles , TBLCF documentation , datasheets , application notes and source code files. Art.# 071102-71 • £29.00 • US$ 58.00 Going Strong A world of electronics from a single shop! Prices and item descriptions subject to change. E. & O.E 80 elektor - 09/2008 Elektor Internet Radio (April 2008) In the good old days, you had to modu- late audio signals onto an RF carrier so they could be received and demodulated to produce something more or less audi- ble. Nowadays things are different. Au- dio signals are compressed and put into IP packets that are 'streamed', and you can access every Internet radio pro- gramme in the world by receiving, buff- ering and decompressing these packages. This is all very easy with the Elektor Internet Radio: listening to radio programmes with the latest ICs. And all open-source! If you take a look on the Web, you'll be astounded to see that Google presently finds more than 21 million hits for 'Internet radio', so it's ob- viously a hot topic! PCB, SMD-populated Art.# 071081-71 • £115.00 • US$230.00 ECIO PLC (March 2008) An ECIO acts as the brains of this PLC board that has relays, opto-isolators CAN (!) connectivity and an LCD. All this I/O capacity together with Flowcode allows the board to act as a versatile, powerful PLC for quite complex control and auto- mation projects. The LCD module is used to display ASCII characters to the user as a means of troubleshooting during the software development stage or for moni- toring the system. Kit of parts incl. PCB , EClO-module and all other components Art.# 070786-71 • £76.00 • US$ 152.00 A DIY system made from recycled components Design your own Embedded Linux control centre on a PC This book covers a do-it-your-self system made from recycled components. The main system described in this book re- uses an old PC, a wireless mains outlet with three switches and one controller, and a USB webcam. All this is linked to- gether by Linux. This book will serve up the basics of setting up a Linux environ- ment - including a software develop- ment environment - so it can be used as a control centre. The book will also guide you through the necessary setup and configuration of a Webserver, which will be the interface to your very own home control centre. All software needed will be available for downloading from the Elektor website. 234 pages • ISBN 978-0-905705-72-9 £24.00 • US$ 48.00 More information on the Elektor Website: www.elektor.com Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 Email: sales@elektor.com L J Cumputfjr Vision Principlm and Fiactico Principles and Practice Computer Vision Computer vision is probably the most ex- citing branch of image processing, and the number of applications in robotics, au- tomation technology and quality control is constantly increasing. Unfortunately enter- ing this research area is, as yet, not sim- ple. Those who are interested must first go through a lot of books, publications and software libraries. With this book, how- ever, the first step is easy. The theoretically founded content is understandable and is supplemented by many examples. 320 pages* ISBN 978-0-905705-71 -2 £32.00 • US$ 64.00 PIC MfcrQ»rattollcrs ilrjrnm Silent alarm, poetry box, night buzzer and more PIC Microcontrollers This hands-on book covers a series of exciting and fun projects with PIC micro- controllers. You can built more than 50 projects for your own use. The clear ex- planations, schematics, and pictures of each project on a breadboard make this a fun activity. You can also use it as a study guide. The technical background infor- mation in each project explains why the project is set up the way it is, including the use of datasheets. Even after you've built all the projects it will still be a valuable reference guide to keep next to your PC. 446 pages • ISBN 978-0-905705-70-5 £27.95 • US$ 55.90 09/2008 - elektor 81 PRODUCT SHORTLIST, BESTSELLERS 5.0, 6.0, VBA, .NET, 2005 Visual Basic for Electronics Engineering Applications This book is targeted towards those people that want to control existing or self-built hardware from their com- puter. After familiarizing yourself with Visual Basic, its development envi- ronment and the toolset it offers are discussed in detail. Each topic is ac- companied by clear, ready to run code, and where necessary, schematics are provided that will get your projects up to speed in no time. 476 pages • ISBN 978-0-905705-68-2 £29.95 • US$ 59.90 More than just an introduction Microcontroller Basics Microcontrollers have become an indis- pensable part of modern electronics. They make things possible that vastly exceed what could be done previously. Innumera- ble applications show that almost nothing is impossible. There's thus every reason to learn more about them, but that raises the question of where to find a good intro- duction to this fascinating technology. This book offers more than just a basic intro- duction! It clearly explains the technology using various microcontroller circuits and programs written in several different pro- gramming languages. ISBN 978-0-905705-67-5 • £19.95 • US$ 39.90 Modem technology for everyone FPGA Course FPGAs have established a firm position in the modern electronics designer's toolkit. Until recently, these 'super components' were practically reserved for specialists in high-tech companies. The nine lessons on this courseware CD-ROM are a step by step guide to the world of Field Pro- grammable Gate Array technology. Sub- jects covered include not just digital logic and bus systems but also building an FPGA Webserver, a 4-channel multimeter and a USB controller. The CD also con- tains PCB layout files in pdf format, a Quartus manual, project software and various supplementary instructions. ISBN 978-90-5381-225-9 • £14.50 • US$ 29.00 Software Tools & Hardware Tips Ethernet Toolbox This CD-ROM contains all essential in- formation regarding Ethernet interfaces! Ethernet Toolbox includes a collection of datasheets for dedicated Ethernet inter- face ICs from many different manufac- turers. It provides a wealth of information about connectors and components for the physical layer (PHY) and specific software tools for use with the Ethernet (Software). To help you learn about the Ethernet in- terfaces, we have compiled a collection of all articles on this topic that have ap- peared in Elektor and complemented them with additional documentation and links to introductory articles on Ethernet interfaces. The documents are PDF files. ISBN 978-90-5381-214-3 • £19.50 • US$39.00 All articles published in 2007 Elektor 2007 This CD-ROM contains all articles pub- lished in Elektor Volume 2007. 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. The instal- lation program now allows Elektor year volume CD-ROMs you have available to be copied to hard disk, so you do not have to eject and insert your CDs when searching in another year volume. With this CD-ROM you can 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. ISBN 978-90-5381-218-1 • £17.50 • US$35.00 More than 68,000 components ECD 4 The program package consists of eight databanks covering ICs, germanium and silicon transistors, FETs, diodes, thyristors, triacs and optocouplers. A further eleven applications cover the calculation of, for example, LED series droppers, zener diode series resistors, voltage regulators and AMVs. A colour band decoder is in- cluded for determining resistor and in- ductor values. ECD 4 gives instant access to data on more than 68,000 compo- nents. All databank applications are fully interactive, allowing the user to add, edit and complete component data. This CD- ROM is a must-have for all electronics enthusiasts. ISBN 978-90-5381-159-7 • £17.50 • US$35.00 / v Prices and item descriptions subject to change. E. & O.E 82 elektor - 09/2008 A September 2008 (No. 381) £ US$ + + + Product Shortlist September: See www.elektor.com + + + July/August 2008 (No. 379/380) Portable Thermometer 08041 8-41 .... Programmed controller PIC1 6F684 9.00 1 8.00 Dimmable LED light 070963-41 .... Programmed controller AVR231 3 1 1 .90 23.80 Solar-powered Automatic Lighting 080228-41 .... Programmed controller PIC1 2C671 9.00 1 8.00 Battery Discharge Meter 070821 -41 .... Programmed controller PIC1 6F676-20I/P 5.90 1 1 .80 070821 -42 .... Programmed controller PIC1 6F628-20/P 9.00 1 8.00 Operating Hour Counter 070349-41 .... Programmed controller PIC1 2F683 5.90 1 1 .80 Lamp in a Wine Bottle 080076-41 .... Programmed controller ATtiny45 5.90 1 1 .80 Energy-efficient Backlight 080250-41 ....Programmed controller ATmega32 22.50 45.00 Deluxe '123' Game 080132-41 ....Programmed controller ATmega8-PU 9.00 18.00 Reaction Race using ATtinyl 3 0801 1 8-41 .... Programmed controller ATtinyl 3 4.90 9.80 Underwater Magic 071037-41 ....Programmed controller AT90S8515P 14.90 29.80 Flowcode for Garden Lighting 0801 1 3-41 .... Programmed controller PIC1 6F88 1 1 .90 23.80 Tent Alarm 080135-41 ....Programmed controller ATtinyl 3V 4.90 9.80 Programmable Servo Driver 080323-41 .... Programmed controller PIC1 2F675 5.90 1 1 .80 Simple USB AVR-ISP Compatible Programmer 080161-41 ....Programmed controller ATmega8-l 6AU 11.90 23.80 Intelligent Presence Simulator 080231 -41 .... Programmed controller PIC1 2C508 5.90 1 1 .80 LiPo Manager 080053-41 .... Programmed controller PIC1 6F84 1 1 .90 23.80 GPS Receiver 080238-41 .... Programmed controller PIC1 6F876A 23.00 46.00 Universal Thermostat 080090-41 ....Programmed controller PIC16F628 9.00 18.00 DTMF-controlled Home Appliance Switcher 080037-41 .... Programmed controller ATmega8-l 6PC 9.00 1 8.00 Solar-powered Battery Charger 080225-41 .... Programmed controller PIC1 2C671 9.00 1 8.00 RGB Lights 08041 9-41 .... Programmed controller PIC1 2F675 5.90 1 1 .80 Microlight Fuel Gauge 080054-41 ....Programmed controller ATmega8 9.00 18.00 Digital Rev Counter for (Older) Diesels 071 1 33-41 .... Programmed controller AT90S231 3 5.90 1 1 .80 Golf Tally 0801 81 -41 .... Programmed controller ATTiny44 5.90 1 1 .80 Outside Light Controller 080258-41 .... Programmed controller PIC1 6F628A 9.00 1 8.00 June 2008 (No. 378) Thermo-Snake 070122-41 .... PIC1 8F2550, ready-programmed 13.20 26.40 SAPS-400 070688-91 .... PCB, populated and tested, ready-mounted in aluminium U profile 159.00 318.00 USB-to-TTL Serial Cable 08021 3-71 .... USB-to-TTL converter cable 15.90 31 .80 May 2008 (No. 377) Two-wire LCD 071035-93 ....SMD-populated board with all parts and pinheaders 22.40 44.80 Bestsellers F_„l IJ_J I! \ 1 2 3 o 5 ii 2 3 4 Embedded Linux Control Centre ISBN 978-0-905705-72-9 £24.00. US$ 48.00 Computer Vision ISBN 978-0-905705-71 -2 £32.00.... .US$64.00 PIC Microcontrollers ISBN 978-0-905705-70-5 £27.95 US$ 55.90 Visual Basic for Electronics Engineering Applications ISBN 978-0-905705-68-2 £29.95. US$ 59.90 Microcontroller Basics ISBN 978-0-905705-67-5 £19.95. US$ 39.90 £14.50. US$ 29.00 1 3 Od 5 FPGA Course ISBN 978-90-538 1-225-9 Elektor 2007 ISBN 978-90-538 1-218-1 £1 7.50..... US$ 35.00 H ECD 4 ISBN 978-90-5381-159-7 £17.50. US$ 35.00 Ethernet Toolbox ISBN 978-90-538 1 -2 1 4-3 £1 9.50. US$ 39.00 a Home Automation ISBN 978-90-5381-195-5 £13.90.....US$ 27.80 DigiButler Art. # 071 1 02-71 £29.00 US$ 58.00 SAPS-400 Art. # 070688-9 1 £ 1 59.00 ... US$ 3 1 8.00 Elektor Internet Radio Art.# 071081-71 £1 15.00...USS 230.00 Display Computer Art. # 070827-91 £78.80...US$ 157.60 ECIO PLC Art. # 070786-71 £76.00... US$ 152.00 2H o Order quickly and safe through www.elektor.com/shop or use the Order Form near the end of the magazine! f^Jlektor L_3shop 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 09/2008 - elektor 83 INFO & MARKET SNEAK PREVIEW Elektor SMD Reflow Oven SMDs (surface mount devices) are increasingly used in today's circuit design, but mounting these parts is not easy without industrial tools. However Elektor again comes up with the goods by pre- senting its very own SMD Reflow Oven. In this specially designed and manufactured oven, the tem- perature is accurately preset and controlled to maintain a certain curve that's optimised for baking SMDs onto a circuit board using different brands of solder paste. The oven is available commercially from the Elektor SHOP. DMX512 Dimmer with MSP430 Although this digital lighting control system was originally designed for use in discotheques, it is equally at home at parties or other events. Our dimmer is controlled by the DMX512 protocol. Some salient features of the circuit: • DMX input and output; • Status LEDs and suppressor coils on each output; • 6 dimmable power output channels; • Switch for addressing and a 'copy' option. Lat , 43* 15. 0450 N Lon i Uit : fill : 006° 03. 2695 E 0.1 noeuds 192.5 n R 1 CP 5 S*V -0 DJSPLAYTECH 2 Q 4 A Multifunctional GPS receiver Motorists all over the world have embraced GPS technology for their navigation systems. Due to their small size, GPS receiver modules can be used for other purposes, too, like helping a robot to find its way about. In this article we not only explain how to enable a PC to talk to a GPS system, but also how such a system can be integrated into a robot. RESERVE YOUR COPY NOW! The October 2008 issue goes on sale on Thursday 25 September 2008 (UK distribution only). UK mainland subscribers will receive the magazine between 20 and 23 September 2008. Article titles and magazine contents subject to change, please check www.elektor.com. w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektor. Elektor 33 the web All magazine articles back to volume 2000 are available online in pdf format. The article summary and parts list (if applica- ble) 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 lektor electronic* worldwide m BENEFIT NOW! ts the publishers, like CD-ROMs, kits and books. A powerful search function allows you to search for items and refer- ences across the entire website. c = ~ i = - CnMK cet :n • [•rcrm.ov* mom 0 0 3t*««ur* tr»ntfur*r fv Prafeop. .utemahv* s>* 9 >p*t>c fitment art wetd chairpttns * *os« sorter Piets retenotar for 2 BV 0 Also on the Elektor website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Surveys and polls • FAQ, Author Guidelines and Contact I S^KOr OKr' .tet U2S3 v 800*1 a CO- Aom* (CtS h *06 Jt% yPCBs :: Blotter l-«MU :: timktorfabm :: Construction projocta •Vtfit ■ in 4 j , Workshop Mofttrcltit SjOffWt piiikierCfM'S t#S o*'» Hvonts Onfy for ouhocrlhoro ^IK «ntf* pr." M«r*W tetor. submit! ng suotwnt. I r.V«« Our FAQ Mttor' Su minor Saving* y. 84 elektor - 9/2008 Description Price each Qty. Total Order Code Universal Display Book for PIC Microcontrollers fTTSfll £23.00 Design your own Embedded Linux Control Centre on a PC £24.00 Computer Vision CD-ROM FPGA Course £14.50 PIC Microcontrollers £27.95 DigiButler (071102-71) £29.00 SAPS-400 (070688-91) £159.00 Free Elektor Catalogue 2008 Sub-total Prices and item descriptions subject to change. The publishers reserve the right to change prices P&P without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Total paid Name Address + Post code METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer j Cheque (UK-resident customers ONLY) □ Giro transfer Expiry date: Verification code: Please send this order form to* (see reverse for conditions) Elektor Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com sales@elektor.com Email Date - - Signature EL09 Yes, I am taking out an annual subscription to Elektor and receive a free 2GB MP3 player*. I would like: I I Standard Subscription (11 issues) Subscription-Plus (11 issues plus the Elektor Volume 2008 CD-ROM) * Offer available to Subscribers who have not held a subscription to Elektor during the last 12 months. Offer subject to availability. See reverse for rates and conditions. Name Address + Post code Tel. Email Date - - Signature EL09 *USA and Canada residents may (but are not obliged to) use $ prices, and send the order form to: Old Colony Sound Lab P.0. Box 876, Peterborough NH 03458-0876. Tel. (603) 924-6371, 924-6526, Fax: (603) 924-9467 Email: custserv@audioXpress.com METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer | Cheque (UK-resident customers ONLY) □ Giro transfer Expiry date: Verification code: Please send this order form to Elektor Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com subscriptions@elektor.com ORDERING INSTRUCTIONS, P&P CHARGES Except in the USA and Canada, all orders, except for subscriptions (for which see below), must be sent BY POST or FAX to our Brentford address using the Order Form overleaf. Online ordering: www.elektor.com/shop Readers in the USA and Canada may (but are not obliged to) send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Old Colony Sound for applicable P&P charges. Please allow 4-6 weeks for delivery. Orders placed on our Brentford office must include P&P charges (Priority or Standard) as follows: Europe: £6.00 (Standard) or £7.00 (Priority) Outside Europe: £9.00 (Standard) or £11.00 (Priority) HOWTO PAY All orders must be accompanied by the full payment, including postage and packing charges as stated above or advised by Customer Services staff. Bank transfer into account no. 40209520 held by Elektor Electronics with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20. BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Giro transfer into account no. 34-152-3801, held by Elektor Electronics. Please do not send giro transfer/deposit forms directly to us, but instead use the National Giro postage paid envelope and send it to your National Giro Centre. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in this magazine. If difficulties in the supply of components are envisaged, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not guarantee this time scale for all orders. Returns Faulty goods or goods sent in error may be returned for replacement or refund, but not before obtaining our consent. All goods returned should be packed securely in a padded bag or box, enclosing a covering letter stating the dispatch note number. If the goods are returned because of a mistake on our part, we will refund the return postage. Damaged goods Claims for damaged goods must be received at our Brentford office within 10-days (UK); 14-days (Europe) or 21 -days (all other countries). Cancelled orders All cancelled orders will be subject to a 10% handling charge with a minimum charge of £5.00. Patents Patent protection may exist in respect of circuits, devices, components, and so on, described in our books and magazines. Elektor does not accept responsibility or liability for failing to identify such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, diskettes and software carriers published in our books and magazines (other than in third-party advertisements) are copyright and may not be reproduced or transmitted in any form or by any means, including photocopying and recording, in whole or in part, without the prior permission of Elektor in writing. Such written permission must also be obtained before any part of these publications is stored in a retrieval system of any nature. Notwithstanding the above, printed-circuit boards may be produced for private and personal use without prior permission. Limitation of liability Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in connexion with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser any money paid in respect of the goods. Law Any question relating to the supply of goods and services by Elektor shall be determined in all respects by the laws of England. September 2007 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION Standard Plus United Kingdom £42.00 £49.00 Surface Mail Rest of the World £56.00 £63.00 Airmail Rest of the World £71 .00 £78.00 USA & Canada For US$-p rices please check www.elektor.com HOWTO PAY Bank transfer into account no. 40209520 held by Elektor Electronics, with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20. BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Giro transfer into account no. 34-152-3801, held by Elektor Electronics Please do not send giro transfer/deposit forms directly to us, but instead use the National Giro postage paid envelope and send it to your National Giro Centre. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL- protected for your security. SUBSCRIPTION CONDITIONS The standard subscription order period is twelve months. If a perma- nent change of address during the subscription period means that copies have to be despatched by a more expensive service, no extra charge will be made. Conversely, no refund will be made, nor expiry date extended, if a change of address allows the use of a cheaper service. Student applications, which qualify for a 20% (twenty per cent) reduction in current rates, must be supported by evidence of student- ship signed by the head of the college, school or university faculty. A standard Student Subscription costs £33.60, a Student Subscription- Plus costs £39.20 (UK only). Please note that new subscriptions take about four weeks from receipt of order to become effective. Cancelled subscriptions will be subject to a charge of 25% (twenty- five per cent) of the full subscription price or £7.50, whichever is the higher, plus the cost of any issues already dispatched. Subsciptions cannot be cancelled after they have run for six months or more. January 2008 r ' Design your own Embedded Linux control centre This book is not about XI 0, ZigBee, Z-wave or any that's available commercially. Instead, it covers a do-it-your-self sys- tem made from recycled components. The main system descri- bed in this book reuses an old PC, a wireless mains outlet with three switches and one controller, and a USB webcam. All this on a PC is linked together by Linux - as it can be obtained free of char- ge. 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 gui- de you through the necessary setup and configuration of a Webserver, which will be the interface to your very own home control centre. All software will be available for downloading from the Elektor website. 234 pages • ISBN 978-0-905705-72-9 • £24.00 • US$ 48.00 Elektor Regus Brentford • 1000 Great West Road Brentford TW8 9HH • United Kingdom Tel. +44 20 8261 4509 Order quickly and safe through www.elektor.com/shop Index of Advertisers Allendale Electronics Ltd www.pcb-soldering.co.uk 43 Antex Electronics Ltd www.antex.co.uk 49 ATC Semitec Ltd, Showcase www.atcsemitec.co.uk 78 Avit Research, Showcase www.avitresearch.co.uk 78 Beijing Draco www.ezpcb.com 33 Beta Layout, Showcase www.pcb-pool.com 43, 78 Bitscope Designs www.bitscope.com 3 Bowood Electronics Ltd, Showcase www.bowood-electronics.co.uk 78 C S Technology Ltd, Showcase www.cstech.co.uk 78 Decibit Co. Ltd, Showcase www.decibit.com 78 Designer Systems, Showcase www.designersystems.co.uk 78 EasyDAQ, Showcase www.easydaq.biz 78 Easysync, Showcase www.easysync.co.uk 78 electroniclndia www.electronicindia.net 66 Elnec, Showcase www.elnec.com 78 EMCelettronica Sri, Showcase www.emcelettronica.com 78 Eurocircuits www.eurocircuits.com 74 First Technology Transfer Ltd, Showcase . . www.ftt.co.uk 78 FlexiPanel Ltd, Showcase www.flexipanel.com 78 FLYPCB www.flypcb.com 67 Future Technology Devices, Showcase. . . . www.ftdichip.com 78 ILP Electronics Ltd, Showcase www.ilpelectronics.com 78 Jaycar Electronics www.jaycarelectronics.co.uk 2 Labcenter www.labcenter.com 88 Lektronix www.lektronix.net/ about/ careers 49 London Electronics College, Showcase . . . www.lec.org.uk 79 MikroElektronika www.mikroe.com 37, 39, 41 MQP Electronics, Showcase www.mqp.com 79 Newbury Electronics www.newburyelectronics.co.uk 67 Nurve Networks www.xgamestation.com 67 Paltronix www.paltronix.com 17 Parallax www.parallax.com 47 Peak Electronic Design www.peakelec.co.uk 43 Pico www.picotech.com 11 Quasar Electronics www.quasarelectronics.com 59 Radiometrix, Showcase www.radiometrix.com 79 Robot Electronics, Showcase www.robot-electronics.co.uk 79 Robotiq, Showcase www.robotiq.co.uk 79 RS Components www.rswww.com/electronics 13 ScanTool, Showcase www.obd2cables.com, www.scantool.net . ... 79 Showcase 78, 79 USB Instruments, Showcase www.usb-instruments.com 79 Virtins Technology, Showcase www.virtins.com 79 Advertising space for the issue of 20 October 2008 may be reserved not later than 23 September 2008 with Huson International Media - Cambridge House - Gogmore Lane - Chertsey, Surrey KT 1 6 9AP - England - Telephone 01 932 564 999 - Fax 01932 564998 - e-mail: p.brady@husonmedia.com to whom all correspondence, copy instructions and artwork should be addressed. 9/2008 - elektor 87 The Proteus Design Suite Celebrating BO Years of Innovation 1988 1990 2000 2005 2008 Labcenter commences trading with PC-B for DOS 1 989. First integrated autorouter added for PCB Design. Schematic Capture added to PCB Layout package 1 99 1 . forid First Schematic Capture for Windows™ . 1 99B. Topological route editing for easier PCB layout. 1 993. Proteus offers fully integrated circuit simulation. 1 994. Autorouter enhanced with Rip-Up and Retry algorithm. Gridless, shape based power plane support 1 99G. True, mixed mode SPICE simulation introduced. 1 997. Interactive simulation - ideal for educational users. 1 998. PIC microcontroller simulation technology developed. 1 999. 8051 microcontroller simulation technology developed. Worlld First Interactive MCU co-simulation (VSM] EOOI . High level language support added for MCU simulation. EOOE. ELECTRA adaptive shape based router interface added. E003. forOd First 32 bit MCU simulation support with ARM7. E004. Integration between Proteus VSIVI and MPLAB™. Redesigned GUI across the Proteus Design Suite EOOG. 3D visualisation engine integrated with ARES PCB Design. EOD7. forid First USB schematic based USB Simulation. Coming Soon: Introduction of HDL support in simulation, ODB++ manufacturing output, improved core SPICE simulation algorithms, enhanced live DRC error checking and much more. LABCEIMTER ELECTRONICS LTD A technology pioneer in the EDA Industry since 1988 Technical Support direct from the program authors Flexible packages and pricing tailored to customer requirements. !Yean v 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