www.elektor.com NOVEMBER 2008 au$ i 2.90 - nz$ 1 5.50 - ar 84.95 - us$ 9.95 £ 3.90 e ectromcs wor dwide for better; FREE view of SMDs SMD-tool yj A t «rwu ^1^1 i to The No Compromise o PC OscHto scopes 250 MHz bandwidth 1 GS/ s real-time sample rate 128 me^asample 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. Advanced Triggers in addition Id Iht- ttfiricjrird Highers, the PcoSeopr." 5000 Kriei comes as standard wish pulse wkJth, wmdtfrv, tfropouL dd.iy. -2nd logic kvcl Irip^cring. 250 MHz Spectrum Analyser High-Speed USB 2.0 Connection Automatic Measurements Arbitrary Waveform Generator firu‘ yt>iif civil i v ■ ftirmi : i-: u’lf •: E fn k_ij !:■ : l il k , iHfw, W and analyse yp to lOOfl captures ' ^ within its waveform playback tool . ! echnology 1 he- tocPSCPpc 3000 Series of ottlirpscopes From Pit® 1-frchrKjlOgy Includes general purpose and high resolmaDfii roorfrlK 1 , Wiih 12 bii rtsolulfen and 1 accuracy, ihc 10 MHz PkoScopc 1434 Is able Co detect changes as. small as 0.024^; (244ppm) - making it the ideal ■l-clw.nel PiC!!ly^c^?plL , fur analog dCvgn .*nd analysis, Tht hjE.S't-r speed E bit roadeli tn die: PicoEkopc 5000 V r K ,r ? 1 1- -1 '. I n;H-ir f i" :■ I 20QKS/I arsd up to 1 MS/* record lengths for gCN*ral purpose iind p^ir applications* The RieoScdpt 2000 Stines OSCilfCKtipW ofler single arid dual chanrcl units Thai csFFef highly j portable/ tew eon volutions lo general purpose lulling. The ■ - award wirln n£ 25MHz handheld ftcoScope 2105 fils » W CDmioriably mta ihe p.slm or your hand ynt still includes I t ^ the powcriul fealufti four.d ih larger oscilloscopes. www.picotech.com/scope490 to check out our full line of PC-based instruments or call 01480 396 39S for information and a product catalogue EasyPIC5 Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD Following the tradition of its predecessor EasyPIC4 as one of the best PIC development systems on the market, the EasyPIC5 provides newly revised features for the same price. System supports 8-, 14-, 18-, 20-, 28- and 40 pin PIC microcontrollers (supplied with a PIC16F887). USB 2.0 on-board programmer with mikrolCD (In-Circuit Debugger) enables very efficient debugging and very fast prototype development. Examples in C, BASIC and Pascal language are provided with the board. Touch screen controller with connector is available on-board. LV24-33A Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD System supports 64, 80 and 100 pins PIC24F, PIC24H, dsPIC33F microcontrollers (supplied with PIC24FJ96GA010 - PIC24 16-bit Microcontroller, 96 KB Flash Memory, 8 KB RAM in 100 Pin Package). Examples in BASIC, PASCAL and C are provided with the board. You can choose between USB and external power supply. LV 24-33A has many features making your prototype development easy. USB 2.0 on-board programmer with mikrolCD (In-Circuit Debugger) enables very efficient debugging and very fast prototype development. Touch screen controller with connector is available on-board. PICPLC16B Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD 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, on-board USB 2.0 programmer and on-board mikrolCD (In-Circuit Debugger). EasyAVR5 Development Board with on-board USB 2.0 programmer System supports 8, 14, 20, 28 and 40 pin microcontrollers (supplied with ATMEGA16). Every jumper, element and pin is clearly marked on the board. It is possible to test most industrial needs on the system: temperature controllers, counters, timers etc. EasyAVR5 is an easy-to-use Atmel AVR development system. On-board USB 2.0 programmer makes your prototype development easy. Examples in BASIC and Pascal language are provided with the board. EasyPSoC3 Development Board with on-board USB 2.0 programmer System supports 8, 20, 28 and 48 pin microcontrollers (supplied with CY8C27843). Every jumper, element and pin is clearly marked on the board. EasyPSoC3 is an easy-to-use PSoC development system. On-board USB 2.0 programmer provides fast and easy in-system programming. Uni-DS 3 Development Board Complete Hardware and Software solution with on- board USB 2.0 programmer System supports PIC, dsPIC, AVR, 8051, PSOC and ARM microcontrollers with a large number of peripherals. In order to continue working with different chip in the same development environment, you just need to swich a card. UNI-DS3 has many features making your prototype development easy. You can choose between USB or External Power supply. Each MCU card has its own USB 2.0 programmer! EasydsPIC4 Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD System supports 18, 28 and 40 pin microcontrollers (supplied with dsPIC30F4013 general purpose microcontroller with internal 12-bit ADC). EasydsPIC4 has many features that making your prototype development easy. Many of these ready-to-go examples in C, BASIC and PASCAL language guarantee successful use of the system. Ultra fast on-board USB 2.0 programmer and mikrolCD (In-circuit Debugger) enable very efficient debugging and fast prototype development. EasyARM Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer EasyARM board comes with Philips LPC2148 microcontroller. Each jumper, element and pin is clearly marked on the board. It is possible to test most of industrial needs on the system: temperature controllers, counters, timers etc. EasyARM has many features making your prototype development easy. There is an on-board USB 2.0 programmer with automatic switch between ‘run’ and ‘programming’ mode. Examples in C language are provided with the board. BIGAVR Development Board with on-board USB 2.0 programmer v ■ yi a _ 1 1 System supports 64-pin and 100-pin AVR microcontrollers (supplied with ATMEGA128 working at 10MHz). Many ready-to-go examples guarantee successful use of the system. BIGAVR is an easy to use development system for Atmel AVR microcontrollers. BIGAVR has many features that makes your prototype development easy. You can choose between USB or External Power supply. BIGAVR also supports Character LCD and Graphic LCD as well. Easy8051B Development Board with on-board USB 2.0 programmer ** m 1*1 m mm System is compatible with 14, 16, 20, 28 and 40 pin microcontrollers (supplied with AT89S8253). There are also PLCC44 and PLCC32 sockets for 32 and 44 pin microcontrollers. USB 2.0 Programmer is provided with the system and programming can be done without removing the microcontroller out. LV 18FJ Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD System supports 64, 80 and 100 pin PIC18FxxJxx microcontrollers (supplied with PIC18F87J60 - PIC18 Microcontroller with an integrated 10Mbps Ethernet communication peripheral, 80 Pin Package). LV 18FJ is easy to use Microchip PIC18FxxJxx development system. On-board USB 2.0 programmer with mikrolCD (In-Circuit Debugger) enables very efficient debugging and fast prototype development. Examples in C, BASIC and Pascal language are provided with the board. dsPICPRO 4 Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD System supports dsPIC microcontrollers in 64 and 80 pins packages. It is delivered with dsPIC30F6014A microcontroller. dsPICPR04 development system is a full-featured development board for the Microchip dsPIC MCU. This development board has an on-board USB 2.0 programmer and integrated connectors for MMC/SDmemory cards, 2 x RS232 port, RS485, CAN, on-board ENC28J60 Ethernet Controller, DAC etc. Touch screen controller with connector is available on-board. Examples in C, BASIC and Pascal language are provided with the board. BIGPIC5 Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD System supports the latest (64) and 80-pin PIC microcontrollers (supplied with PIC18F8520). Many of these ready-to-go examples in C, BASIC and Pascal language guarantee successful use of the system. Touch screen controller with connector is available on-board. This development board has an ultra fast on-board 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. mikroElektronika Compilers Pascal, Basic and C Compilers for various microcontrollers Supporting an impressive range of microcontrollers, an easy-to- use IDE, hundreds of ready-to-use functions and many integrated tools make MikroElektronika compilers one of the best choices on the market today. Besides mikrolCD, mikroElektronika compilers offer a statistical module, simulator, bitmap generator for graphic displays, 7-segment display conversion tool, ASCII table, HTML code export, communication tools for SD/MMC, UDP (Ethernet) and USB, EEPROM editor, programming mode management, etc. Each compiler has many routines and examples such as EEPROM, FLASH and MMC, reading/writing SD and CF cards, writing character and graphics on LCDs, manipulation of push-buttons, 4x4 keyboard and PS/2 keyboard input, generation of signals and sounds, character string manipulation, mathematical calculations, I2C, SPI, RS232, CAN, USB, RS485 and OneWire communications, Manchester coding management, logical and numerical conversion, PWM signals, interrupts, etc. The CD-ROM contains many ready-to-go and tested programs to use with our development boards. E mikroElektronika manufactures and delivers competitive development systems across the globe. Our satisfied customers are the best guarantee of our first-rate service. In addition, the company is an official consultant on the PIC microcontrollers and the third party partner of Microchip company. We are also an official consultant and third party partner of Cypress Semiconductors since 2002 and official consultant of Philips Electronics company as well. All our products are RoHS compliant. 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 - Makes ethernet network with SPI Interface (ENC28J60). lrDA2 Board - Irda2 serves as wireless RS232 communication between two MCUs. Storage /RTC CF Board - Provides easy way to use Compact flash in your design. MMC/SD Board - Provides easy way to use MMC and SD cards in your design. EEPROM Board - Is serial EEPROM board via I2C interface. RTC Board - Is PCF8583 RTC with battery backup. ADC Board - Is 12-bit analog-to-digital converter (ADC) with 4 inputs. DAC Board - Is 12-bit digital-to-analog converter (DAC) with SPI. Keypad 4x4 Board - Adds keypad to your application. Accel. Board - Accel, is an electronic device that measures acceleration forces. with- fiTlkrofCD Hjpport PICFIash programmer - an ultra fast USB 2.0 programmer for PIC microcontrollers. Continuing its tradition as one of the fastest PIC programmers on the market, a new PICFIash with mikrolCD supports more PIC MCUs giving developer a wider choice of PIC MCU for further prototype development. mikrolCD debugger enables you to execute mikroC, mikroPascal or mikroBasic programs on the host PIC microcontroller and view variable values, Special Function Regi-sters (SFR), memory and EEPROM while the program is running. - All of our products are shipped in special protective boxes. -On-line secure ordering provides fast and safe way of buying our products. www.mikroe.com/en/distributors/ Find your distributor: UK, USA, Germany, Japan, France, Greece, Turkey, Italy, Slovenia, Croatia, Macedonia, Pakistan, Malaysia, Austria, Taiwan, Lebanon, Syria, Egypt, Portugal, India, Thailand, Taiwan, Czech and Slovak Republic. Please visit our website for more info WWW.mikroe.com SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD Small things & great editors You only have to read a few of Umberto Eco's books to be reassured that in mediaeval times 'things invisible' like vacuum, gravity, time, the plague and static electricity were awe inspir- ing if not a cause of great fear to the uninitiated. I wonder if the same applies to such seemingly unrelated stuff we struggle with in today's electronics, like surface mount components, electromag- netic radiation, microcontroller firmware and buried vias. Invisibility and tiny dimensions both cause the same feeling of unrest. When the transistor took over from the valve, a frequently heard complaint was that 'it sure is much more efficient but your can't see if the thing is alive or not' and 'these things die with not so much as a whisper'. Reportedly some radio & TV servicemen actually opened up faulty transistors to see if they could be fixed. Although far from being invisible, in the case of SMD components we heard reports like "more ended up in mum's vacuum cleaner that on my printed circuit board". Being able to view SMD parts is the first requirement to using them — next come handling, position- ing them on a board, and only then, soldering. The soldering having been covered in great detail in last month's issue on the Elektor SMD Reflow Oven, we figured a magnifying glass might open up a world to you if you still feel those minuscule parts are encroaching upon the hobby. The card-shaped flex- ible lens attached to this month's front cover is a free gift included with the full 125k print run of Elektor in all language editions — newsstands sales and sub- scriptions. Personally, I am near-sighted to the degree of being able to scrutinize SMD solder joints with my nose almost on the board surface, so the magni- fier saves me the trouble of raising my expensive glasses to an insecure posi- tion on my forehead. On 1 8 September 2008, Guy Raedersdorf, editor of the French edition Elektor, officially retired. Guy was 'Monsieur Elektor' for 27 years, not just to his French readership but also to all Elektor staff struggling with the fine points of the French language. Guy's helpful attitude, sheer speed, inventive- ness and accuracy down to the last comma made him an exemplary editor totally dedicated to his audience whilst exerting 'precision in expression' (now a fast disappearing skill it seems). Merci Guy and bonne chance from all of us. Jan Buiting Editor lekfo r electronics worldwide Speed Camera Warning Device The little module developed using e-Blocks lets you detect geo- graphical points of interest (POIs) using the frames output from a GPS receiver module. These POIs might be restaurants, petrol stations, or — why not? — the positions of fixed speed cameras! 22 Come see us at • Embedded Systems — Boston, USA, October 27-30. • Matelec — Madrid, Spain, October 28 - November 1 . • Elektronica — Munich, Germany, November 1 1-14. • Elektor Live ! — Eindhoven, The Netherlands, November 22. 30 Remote Control by Mobile Phone IiMK M«"i \\\ 1 t 1! il . s *■ r- > ■ * in ■ Q 'I This ingenious new design combines powerful capabilities with low technical overheads. It has programmable AC mains switching outlets plus status reports by text message and alarm-activated delivery of GPS data. Remote control by mobile was never easier, cheaper or more reliable! Many audio enthusiasts still prefer a good potentiometer for adjusting the audio volume. It would be even nicer if this potentiometer could also be controlled remotely. This is possible with a high-quality motorised potentiometer from Alps and a handful of electronics, as is described in this article. CONTENTS Volume 34 November 2008 no. 383 roiects Speed Camera Warning Device Remote Control by Mobile Phone 38 Motorised Volume Pot 4 ' Tracking Hot Spots 48 Lazy on the Bike ATmega meets Vinculum 58 Bascom AVR Course (3) 66 Colourful Computer Light 70 U niversal Remote Switch 74 Water Alarm (mini project) 48 Lazy on the Bike Electric bikes have become popular in recent times. But an off the shelf contraption is not nearly as much fun as one which we have to build ourselves. So, on the look-out for DIY kits! 52 ATmega meets Vinculum When it comes to matters of memory, microcontrollers tend to be rather poorly endowed. A external USB memory stick is the ideal remedy, offering straightforward data transfer to your PC. Now if bonding the memory stick to a micro was somewhat problematic until recently, it's now totally stress-free with the Vinculum chip from FTDI! 1 GB technolo 6i Friction-free Angle Measurement info & market 6 Colophon 8 Mailbox News & New Products 8 An introduction to SMD 80 ElektorSHOP Sneak Preview infotainment 76 Hexadoku 77 Retronics: Tektronix 7D01 Logic Analyser (1978) 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. better of SMDs f (10 Ve*t*j*f clrcuitsjdeasTups Volume 34, Number 383, November 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, Clemens Valens. Design sta 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 - 11/2008 Elektor j SMT Oven Multi-purpose and indispensable to professional and enthusiast From now on, "anyone can play SMD"! The Elektor SMT is at home where SMD boards have to be produced to a variety of requirements on size, components and soldering materials. • Selected, tested & certified by Elektor • Including Elektor-produced user manual • Fully menu controlled • Ideal for R&D laboratories, schools, small companies and... electronics enthusiasts • Product support from Elektor Customer Services • Demo video on www.elektor.com/smtoven • Order before 1 November 2008 and get £ 83 - € 1 00 - US$ 75 discount! You pay £ 799 - € 995 - US$ 1 450 (plus shipping) Main technical specifications Line voltage: 230 V AC / 1 650 W Line frequency: 50-60 Hz Size: 41 8 x 372 x 250 mm (1 6.5 x 1 4.6 x 10 inch) Weight: 1 6.7 kg (net) Effective PCB area: 280 x 280 mm (11x11 inch) Apart from the handle on the drawer giving access to the PCB tray, the user interface consist of an LCD and five buttons on the front panel. Art. #080663-91 • Price: £882 • € 1095 • US$ 1525 \ J Further information and ordering at lektor SHOP www.elektor.com/smtoven In 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 11/2008 - elektor 7 INFO & MARKET MAILBOX PaX amplifier stability Dear Jan — I would like to comment on the article on the paX Amplifier by Jan Didden in the April 2008 issue of Elektor. Error correction Around 80 years ago already, before feedback was commonly used, Black obtained a patent on feedforward error correc- tion. Due to the limited availa- bility of suitable components at that time, this principle was not used on a large scale until much later. The basic scheme of Hawksford [1], as shown in Figure 1 of Did- den's article, is often used as the starting point. If a = 0 and b = 1 , feedforward error correction is present. If a = 1 and b = 0, there is feedback error correction. Accurate addition of the correction signal at the output is difficult with a power amplifier, which is why the feedback approach is often used. In Figure 2 of the article, SI and S2 are idealised functions whose purpose is to add the error correction signal to V in at the input. However, the problem here is that a replica of the error signal must be generated. As a result, conversion stages are necessary to transform current into voltage and voltage into current. This means that the accuracy of the replication process is dependent on the matching of pairs of transistors and/or resistors. As a result, the replication factor K can be less than or greater than 1 . This inaccuracy influences distortion reduc- tion, and possibly other characteristics of the circuit as well. It is thus desirable to analyse the stability of the amplifier as a function of K. Feedback error correction The basic circuit shown in Figure 2 of Didden's article is based on a form of feedback. My version of a simple equivalent circuit of the feedback loop is shown in Figure A. As far as I know, this is the first time that the use of a current conveyor for this purpose has been described in a published article. If Z is connected to X, the current conveyor acts as a current mirror with 100% voltage feedback. In order to analyse the feedback loop, the input terminal is connected to ground. The behaviour of the current conveyor is idealised in order to avoid complex formulae: V x = V , A = 1 (where A. is the current gain of the current mirrors in the current conveyor). The error signal V , which in this case is the signal between the Z and P terminals, is converted to a current by R34. As a result of the current mirroring action of the current conveyor, a current with the same value flows in R25 if A. = 1 . This current produces a replica of the error signal across R25 if R25 = R34. Now it is extremely important for the loop gain H |oop to be less than 1 . If H h is equal to or greater than 1 , latch-up will occur with a DC-coupled circuit such as the one shown in the figure. This means that depending on the polarity of the DC offset, the output level will gradually increase until it reaches the positive or negative supply voltage. With the previously mentioned simplifications, the loop gain H |oop is given by: H, = (1 - G) x R25/R34 = °(°f - G) x K [1] Here the replication factor K is equal to R25/R34 and G is the combined voltage gain of the buffer and the output stage. This is a special form of feedback, since feedback is present if G is gre- ater than 1 , the loop gain is zero if G is 1 , and feedforward is present if G is less than 1 (as in the paX amplifier). If G is 0.95 (which is a reasonable estimate of the transfer function of the buffer plus the output stage) and K is 1 , the loop gain is 0.05. This is well below the critical limit (G = 1 ). This means that the feedback loop is sufficiently stable with regard to latch-up risk. Output impedance The open-loop output impedance of the buffer plus the output stage is shown in Figure B. As R o has a large influence on the non-ideal behaviour of the buffer and output stage, a value of 1 for G can reasonably be assumed for the purpose of calculating the output impedance. The current source / (shown here for the sake of the analysis) connected to the output produces a voltage across R . A replica of this voltage (just as with the error correc- tion feedback loop) is generated at the Z terminal. This can be expressed by the following formula: Z oul = R o x(l-R25/R34)) = R o x(l-K)[2] The output impedance Z out is positive if K is less than 1 , zero if K is 1 , and negative if K is greater than 1 . A positive output impe- dance causes overdamping of the loudspeaker, while a negative Panorama (virtual) CAD DVD Dear Editor — regarding your topic in the September 2008 issue on CAD. You did not include DIPTRACE (hwww.diptrace.com). As a non-electronics amateur but one who has used AUTO- CAD for many years in civil engineering, I found DIPTRACE was by far the most intuitive CAD package I tested. DIPTRACE is free for smaller projects (up to 250 pins). Please include this software in your next review. David (G3ZOI) (United Kingdom) 8 elektor - 11/2008 output impedance causes underdamping. As a result, an amplifier with a negative output impedance and a mediocre impulse response will cause overshooting if it is loaded with an LCR network (i.e. a loudspeaker), and in the worst case it can oscillate. Conclusions and recommendations From the above, it can be seen that the error correction feedback loop is stable, but the output impedance is negative in the presence of overcompensation. This is undesirable, espe- cially with a problematic speaker load (such as an electrostatic speaker). The output impedance can easily be checked by connecting an audio signal generator to the input of the ampli- fier. When a load is connected to the amplifier, the amplitude of the output signal will decrease if the output impedance is positive or increase if the output impedance is negative. If the output impedance is found to be negative, the cure is to reduce the value of K by decreasing the value of R25 or increasing the value of R34. Wim de Jager (The Neterlands) Response from Jan Didden, the designer of the paX amplifier: Dear Wim , Your reasoning with regard to the output impedance is correct. However , if you attach a few values from actual practice to it ; it turns out to not be a real problem. You raise two issues with regard to the stability of the error-cor- rection amplifier implemented in my design. The error correction resistors (R24 and R25) should be matched as closely as possible for maximum error correction. In practice , 1% matching can be achieve without having to use adjustable resis- tors or trimpots. This yields an error correction of 40 dB. Further- more, the loop gain of 0.05 that you mention (with an open-loop output stage gain of 0.95) means that the values of these resistors can differ by up to a factor of 20, or 2000%, with regard to stabi- lity considerations. Consequently , latch-up is not an issue. Your reasoning with regard to the output impedance is also cor- rect. Here again, it is enlightening to consider a few practical figures. A quick simulation shows that the open-loop output impe- dance of the circuit shown in Figure B is approximately 0.4 ohm (at 10 kHz). If the value of R25 is 1 % larger than it should be (rela- tive to R34), this yields a negative output impedance of 4 milli- ohms. For comparison , the resistance of 1 metre of speaker cable with a 2-mm wire diameter is approximately 10 milli-ohms. Here you could say that the negative output impedance offsets the resistance of the first half metre of the speaker cable. If it has any effect at all, it is to improve the damping. In summary, it appears that a mismatch of the error correction resistors by a few percent does not create any problem at all with regard to latch-up or output impedance. A matching level of 1% can be achieved by a ' clever ' choice of standard resistance values. All of this is confirmed by the trouble-free operation of several dozen amplifiers that have been built according to this design. Jan Didden Thanks for that David — will do! By the way, for those keen on statistics: the chunks to com- pile the ISO file and from there burn your own DVD were down- loaded 2,880 times and almost bowled over our web servers. Multiple Digibutlers on the same network Dear Editor — in part 2 of the DigiButler article (Elektor May 2008), it says that you can have only one DigiButler (or more generally, only one server) on your network. However, this is not strictly true - it is actually possible to connect several but- lers, and possibly other servers as well, if you use a trick. This is based on the fact that an IP address and port can be accessed from any desired web browser. As noted in the article, to do this you have to enter the IP address assigned by your provider and instruct your router to remap port 80 to port 80 of the IP address of your DigiButler. However, a specific IP address and port can be accessed from any web browser, and you can take advantage of this to allow several butlers to operate on a single network. An example of how this works may help clarify this. The normal situation when only one Digibutler is connected is as follows: IP address assigned by pro- vider: 86.131.222.120 DigiButler IP address: 192.168.0.2 Access address in the web browser: 86. 1 3 1 .222. 1 20 Resulting remapping in the router: external port 80 to internal IP 192.168.0.2 with internal port 80 However, it is possible to run two DigiButlers on the same net- work, and in particular on two ports of your ISP, such as ports 1024 and 27888. The first DigiButler sits on port 1 024, and the second one on port 27888. In this case you have: IP address assigned by pro- vider: 86.131.222.120 DigiButler 1 IP address: 192.168.0. 2 DigiButler 2 IP address: 192.168.0. 3 DigiButler 1 access address from the browser: 86.131.222.120:1024 DigiButler 2 access address from the browser: 86.131.222.120:27888 Resulting remapping in the internal port 80 Now you can log in to two DigiButlers from any desired location. Naturally, this . scheme can also be expanded if your router allows it. Tim Geerts (The Netherlands) A really handy trick! It's cer- tainly worth mentioning here. The DigiButler project seems to have gone down well witness the flurry of activity in our forum where you can read how read- ers got DigiButler to be less hot around the collar (one heatsink) and better prepared to relocate to other IP addresses (DHCP compatibility)! It's exactly the objective we had in mind for these articles: cheap hardware and fun in programming. At the time of writing, about 750 units have been sold. Thanks all for making this a success. 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. 11/2008 - elektor 9 INFO & MARKET NEWS & NEW PRODUCTS Complete IEEE802.15.4 solution for wireless networking Microchip announces the MRF24J40MA FCC-certified Radio- Frequency (RF) transceiver module and the MiWi™ Peer-to-Peer (P2P) Wireless Protocol Stack, based upon the IEEE 802.15.4™ specifi- cation. Together the MRF24J40MA module and MiWi (P2P) stack can target a variety of wireless network- ing applications, such as industrial monitoring and control, home and building automation, remote con- trol, low-power wireless sensor net- works, lighting control and auto- mated meter reading. The MRF24J40MA transceiver mod- ule is surface mountable and can be used with hundreds of 8-bit, 1 6- bit, or 32-bit PIC® microcontrollers (MCUs). It includes discrete biasing components and an integrated PCB antenna to be used in sensor and control network environments. The module is fully regulatory-agency certified for the US (FCC), Can- ada (1C) and Europe (ETSI), and is expected to save designers time and money by eliminating the need to receive FCC certification for their wireless products. The MiWi P2P protocol stack sup- ports star and peer-to-peer wire- less-network topologies with an ultra-small code implementation of 3K bytes for Microchip's PIC micro- controllers (MCUs). As a result, the stack provides short-range wire- less customers with hundreds of possible MCU implementations for applications that require sim- ple node-to-node communication. Additionally, the new MiWi P2P stack provides sleeping-node, The MiWi P2P protocol stack supports star and peer-to-peer wireless-net- work topologies with an ultra-small code implementation of 3K bytes for Microchip's PIC microcontrol- lers (MCUs). As a result, the stack provides short-range wireless cus- tomers with hundreds of possible MCU implementations for applica- tions that require simple node-to- node communication. Additionally, the new MiWi P2P stack provides sleeping-node, active-scan, and energy-detect features that enable robust operation while supporting the low-power requirements of bat- tery-operated devices. Available as a free download from Microchip's new online Wireless Design Centre at www.microchip. com/wireless, the small-footprint, proprietary stack complements the new MRF24J40MA 2.4 GHz FCC-certified transceiver mod- LED constant current demo board V.l Chip, Inc., a subsidiary of Vicor Corporation has announced a con- stant current (CC) PRM™ regula- tor demonstration board for LED applications such as street & sta- dium lighting, high-end projectors, active outdoor advertising and architectural installations. The board provides a precisely regulated current as required for direct-drive multi-LED applications where the intensity and bright- ness are controlled by regulating the current through the LEDs. The board can be used to provide adjustable current up to 240 W (5 A at 48 V) when employed as an standalone non-isolated source or can be combined with the range of VTM™ transformers to provide an adjustable isolated current up to 1 00 A. A PRM+VTM pair uses less than 1 watt for every 1,000 Lumens generated by the LEDs for high performance applications. This solution is a perfect complement to using BCM™ bus converters with low voltage driver ICs for lower power applications such as LED TV backlighting. The constant current board dem- onstrates the high power density of the PRM with current accuracy of 99.7% across the load range. The board has Kelvin connections World's highest integration single chip GPS receiver SkyTraq recently introduced their Venus634LP GPS receiver, reportedly the world's high- est integration single-chip GPS receiver using its low-power Venus6T GPS architecture. Meas- uring 1 Ox 1 Ommx 1 .2 mm, the Venus634LP integrates LNA, SAW filter, RF front-end, GPS baseband, 0.5 ppm TCXO, RTC crystal, LDO regulator, and passive compo- nents. A complete GPS receiver requires only an antenna and Venus634LP. Featuring highest integration, 1 centimetre squared footprint, ultra fast TTFF, high sensitivity, and low current consumption, the Venus634LP GPS receiver enables lowest cost of embedding location awareness into portable applica- tions without compromising size, performance, and battery life. It is compatible with both active and passive antennas. The receiver con- sumes 50 mA during signal acqui- sition and 30 mA during full power continuous tracking. The dedicated signal parameter search engine within the Venus634LP is capable of performing 8 million time-fre- quency hypothesis testing per sec- ond, offering ultra-fast 1 -second hot start and 29-second cold start under open sky. The advanced track engine allows tracking sensi- tivity of -158 dBm, enabling con- tinuous navigation in harsh envi- ronments such as urban, canyon ule. It represents Microchip's third free software protocol stack for IEEE802.15.4 transceivers, join- ing its ZigBee stack and existing MiWi stack. As well as Microchip's free Zig- Bee, MiWi and new MiWi P2P software-protocol stacks, the mod- ule is supported by Microchip's PICDEM™ Z Demo Kit and the ZENA™ Wireless Network Ana- lyser. When combined with these development tools, the module ena- bles designers with little or no RF design experience to design low- power wireless networking prod- ucts quickly and inexpensively. Designers can also use Micro- chip's PICDEM Z Demonstration Kit (DM1 63027) with all of the compa- ny's free stacks and MRF24J40MA module. The kit includes a pair of development boards with a PIC18LF4620 MCU, along with the ZENA Network Analyser and wireless network configuration util- ity (DM183023). The kit and the ZENA Network Analyser are avail- able today at the website below. www.microchipdirect.com for measuring the efficiency of the V.l Chip™ components independ- ent of load connect losses. Oscil- loscope probe jacks are availa- ble for measuring output voltage, including output voltage ripple. The board has fused PRM inputs, provision for mounting an optional V.l Chip pushpin heat sink, and system enable and disable. www.vicorpower.com / ccdemo / (08624-IX) and under deep foliage. www.skytraq.com.tw (080624-XI) 10 elektor - 11/2008 PC Oscilloscopes <& Analyzers BitGen DSP Waveform & Timing Generator for USB BitScope 100 Powerful waveform generation & mixed signal data capture in one low cost USB test instrument. 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 tinning. Multi-Band Spectrum Analyzer Display analog waveforms and their spectra simultaneously. Base-band or RF displays with variable bandwidth control. Direct Digital Synthesis Generator Arbitrary waveform crystal referenced DDS frequency synthesis. Microsecond one-shot timing precision and burst generation. Independent but sample synchronized with BitScope capture. Noise, Dither and Entropy Generator Pseudo-Random Number noise, dither and entropy generation. White, pink or binary with programmable or random seed. Voltage, Clock and Logic Generator Programmable voltage, clock and serial logic generation. Adjustable DC reference and mark/space clocks to 5MHz. Logic level shifting and probe calibration signals. BitGen is a comprehensive DSP based waveform and timing generation solution available as standard in BS100M or an option for BS100U. From clocks, sine, square or triangle waves to sophisticated bursts, chirps, noise or user programmable signals, BitGen supports them all. www . bitscope . com r INFO & MARKET NEWS & NEW PRODUCTS Electronworks electronic kits You don't have to be mad in life.... Second thoughts, yes you do. Elec- tronworks have taken some of life's insanity (and lots of their own) and put it into electronic kits. Electron- works' aim is to make learning electronics fun and to bring you a range of kits that are both practical and educational. A whole tonne of kits and ideas is available for unleashing in the coming months, so if you are young or old, new to electronics or a seasoned veteran you will find something to suit your needs. For example, Electronworks' MP3 booster amplifies the output of your MP3 player, so you can fill the room with music via your PC speakers. Also available are a ran- dom number generator that gener- ates a completely random number from 0-99 and an in car power 12V input and many more, supply, so you can power all your battery powered electronics from a www.electronworks.co.uk Ethernet mini module with ARM9 400 MHz microcontroller and Linux PROPOX from Poland introduce a new family of modules based on microcontrollers with the ARM9 core. The modules were designed to achieve 100% compatibility with the mmTm socket already used and promoted by PROPOX for few months in their EVBmmTm boards. Management Unit (MMU) allows the micro to run operating systems like Linux and Windows CE. The External Bus Interface (EBI) gives connectivity to SDRAM (up to 64 MB on board of modules) and up to 4 GB of NAND Flash — the largest amount available for now. The MMnetlOOl mini mod- ule has been equipped with Atmel's AT9 1 SAM9260 (AT91 SAM9G20) microcon- troller with an internal clock of up to 210 MHz (400 MHz). The Memory The additional set of peripheral devices contain 10/1 00Mbit PHY Ethernet with a trans- former and an RJ45 connec- tor, one USB Device, 2x USB 2.0 Host (i.e. Full Speed) and 5x RS232 interface. These features and a complex hardware base allow users to build stan- dalone systems using an Eth- ernet interface and an embedded operating system. PROPOX went one step further by offering the 'Linux on board' solution to customers: all modules are available with running Linux and come with a DVD containing source codes, compilers and sam- ple software. A complete eLinux solution called the MMnetl002 module will be available soon. www.propox.com ( 080793 - 1 ) 12 elektor - 11/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. 11/2008 - elektor 13 INFO & MARKET NEWS & NEW PRODUCTS New Capacitive Touch Demo Board Microchip announces the PICDEM™ Touch Sense 2 Demo Board (Part # DM164128) for capacitive touch- sensing applica- tions. The easy-to-use board comes with the royalty-free mTouch™ Sensing Solution Soft- ware Development Kit (SDK) and is pop- ulated with a 1 6-bit PIC24FJ256GB1 1 0 microcontroller (MCU), which fea- tures an integrated Charge Time Measurement Unit (CTMU) periph- eral for fast capacitive touch sens- ing. This is also the world's first 1 6-bit MCU family with USB On-The- Go (OTG). The board and sup- porting materials provide a complete platform for imple- menting capacitive touch-sensing inter- faces, without the need for external components. Addi- tionally, with the PIC24FJ256GB1 1 0 family's rich periph- eral integration and 256 kBytes of Flash memory, and Microchip's broad portfolio of free and low-cost software libraries, embedded designers can use a sin- gle MCU to cost effectively imple- ment a wide variety of additional user-interface functions, includ- ing QVGA touch-screen displays, speech-based audio prompts and USB connectivity. The PICDEM Touch Sense 2 demo board (Part # DM164128) can be purchased for $ 99.99 from Microchip. This price includes the mTouch Sensing Solution SDK and a USB cable. www.microchip.com/mtouch www.microchipdirect.com (080793-11) New industry alliance promotes use of IP in networks of 'smart objects' A group of leading technology vendors and users have formed the IP for Smart Objects (IPSO) Alliance, whose goal is pro- moting the Internet Protocol (IP) as the networking technology best suited for connecting sen- sor- and actuator-equipped or 'smart' objects and delivering information gathered by those objects. Smart objects are objects in the physical world that - typi- cally with the help of embed- ded devices - transmit infor- mation about their condition or environment (e.g., temperature, light, motion, health status) to locations where the informa- tion can be analyzed, corre- lated with other data and acted upon. Applications range from automated and energy-efficient homes and office buildings, fac- tory equipment maintenance and asset tracking to hospital patient monitoring and safety and compli- ance assurance. ics Engineers (IEEE), which develop and ratify technical standards in the Internet community, the IPSO Alliance will perform interoperabil- ity tests, document the use of new IP-based technologies, conduct The alliance seeks to advocate how networks of objects of all types have the potential to be converged onto IP. Founding members of the IPSO Alliance are Arch Rock, Atmel, Cimetrics, Cisco, Duke Energy, Dust Networks, eka systems, EDF (Electricite de France) R&D, Emerson, Freescale, IP Infusion, Jennie, Kinney Consulting, Nivis, PicosNet, Proto6, ROAM, SAP, Sensinode, SICS, Silver Spring Networks, Sun Microsystems, Tampere University, Watteco and Zensys. IPSO Alliance membership is open to any organisation advo- cating an IP-based approach to connecting smart objects. www.ipso-alliance.org (080793-VI) wetoem io trie i&jrtch oi KwtmBWETafThlHQS Intended to complement the efforts of entities such as the Internet Engi- neering Task Force (IETF) and the Institute of Electrical and Electron- marketing activities and serve as an information repository for users seeking to understand the role of IP in networks of physical objects. MLX90614 Infrared Thermometer Module The MLX90614 Infrared Thermome- ter Module from Parallax is an intelli- gent non-contact temperature sensor with a single pin serial interface for connection to most microcontrollers. The MDC90614 sensor is designed for non-contact temperature measu- rements of objects placed within the sensor's cone of detection. The sen- sor is comprised of an integrated ASIC and infrared sensitive ther- mopile detector. The sensor com- municates with an SX20AC/SS-G coprocessor over a digital SMBus, which Parallax has programmed to simplify an otherwise fairly com- plex communication protocol. With a temperature range of -70°C to 380°C, auto-baud detection and a programmable alarm setting, this module becomes very useful in many applications such as surface temper- ature measurement, human/animal presence detection or HVAC. Up to 1 00 modules can be connected on the same bus making multi-zone tem- perature measurement easy. www.parallax.com (search '28040') (080793-IX) 14 elektor - 11/2008 n n o /n A N T E X LJLJLJLJLJ Ante* offet a wide choice of input voltages and bit profiles for our soldering iron range 60*f 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 SERVICING YD U R COMPLETE PROTOTYPE NEEDS 1 EUROCARD (160 x 100 mm) + Tooling + Photoplots + VAT €49 ~ Price example * Any size and contour possible! Optional: • Soldermask • Fast-turnaround • Silkscreen • 4-Layer Multilayer • 6-Layer Multilayer mwkmo dun IUM7T 4 - EDPiV ' :i k J j| ' Free 080C Fjihi kj Simply send your files A/tA A /I /If /l/l If and order ONLINE: r%tU m 1*1/1/ t« V t Jlwi electro .iC telL01298 70012 70046 ^^Mp^ M plec.co.uk sales@peakelec.co.uk Special Limited Time. Atlas ESR Atlas DCA Model DCA55 Atlas ESR Model ESR60 Semiconductor Analyser Identifies type and pinout! "*' v— i ESR and Capacitance Meter Resolution of 0.01 ohms! Atlas LCR Mg|ij^p40 Atlas S^MSilpM |1jQ0 Inductor. Caoacit|ilpsistor AnalvSB Triac anlfI^^^^H)alyse| i Automatic pfildentification.y Auto gate tefB^^^Hpto lOi^o UK: Pleaseigiil £1 .00 p&p to your order. Pric eBi ip r olip.e Please see website for overseas pE PHHB 11/2008 - elektor 15 INFO & MARKET NEWS & NEW PRODUCTS Thermostats for UPS Battery Back-Up Systems When a power-cut hits a company, they need to be sure that their UPS system performs immediately and for as long as possible until mains power is re-established. The life of a battery back-up system is partly dependant on its stable temperature control which is often achieved using electronic means. As an alternative to electronic sen- sors, the Matsuo MQT thermostat supplied by ATC Semitec Ltd. offers UPS system installers a simpler and more cost-effective solution. Matsuo thermostats have a unique twin-bimetal system that creates a control which is capable of switch- ing over 1 million cycles. Accura- cies of ±1.5 K and differentials down to 3 K ±1 K are readily available, with repeatability as small as ±0.2 K. Basically they function on a par with electronic controllers. The thermostat's IP64 plastic hous- ing can be readily fixed to the side of a battery and so each one can be safely monitored. www.atcsemitec.co.uk (080793-V) ULP wireless SoC solution The n RF24LE 1 from Nordic Semi- conductor integrates a fully-fea- tured n RF24L0 1 + 2.4GHz trans- ceiver core including Nordic's proven Enhanced ShockBurst™ hardware link layer. It delivers true ULP operation with peak cur- rents low enough to run on coin cell batteries. The nRF24LEl also integrates an enhanced 8051 mixed signal MCU core featuring fewer clock cycles per instruction than legacy 8051 devices. Most instructions need just one or two clock cycles leading to an average perform- ance improvement of 8x using the MIPS (Million Instructions Per Sec- ond) benchmark. This high perform- ance combined with 16 kBytes of on-chip flash plus 1 kByte of SRAM ensures the processing platform is powerful enough to run both the RF protocol stack and application layer with ease. A wide range of peripherals and power saving modes support the RF protocol stack. A ULP 32 khlz crystal oscillator provides high accuracy timing for low report rate synchronous protocols and a 1 6 MHz RC oscillator pro- vides fast start-up times from idle. The 32 kHz oscillator can pro- vide timing accurate enough for higher report rate protocols with- out requiring an external crystal. A security co-processor supports AES encrypted wireless communi- cation. The n RF24LE 1 provides a range of nanoamp and microamp idle modes specifically designed for ULP RF protocol stacks. Further benefits include higher precision protocol timing, lower power con- sumption, and improved co-exist- ence performance. For the application layer the nRF24LEl offers a rich set of inter- faces and peripherals including an SPI, 2-wire, UART, 12-bit ADC, PWM and an analogue compara- tor. As such, the n RF24LE 1 is the ideal single chip solution for wire- less applications including mice, keyboards, remote controls, game controllers, sports/healthcare sen- sors, toys, and active RFID tags. Engineering samples of the nRF24LEl and development tools are widely available today. www.nordicsemi.com (080793-III 6-channel touch controller with integral LED driver Atmel® Corporation's AT42QT1060 is a touch control chip that integrates 6 channels of touch sensing with the ability to drive up to seven low current LEDs directly through a pulse width mod- ulated (PWM) output function. The device operates from 5.5 V down to 1.8 V and consumes less than 1 pA in standby mode to give long battery life; it comes in a tiny 4x4 mm MLF28 package, making it ideal for use in mobile phones and other handheld devices. The AT42QT1 060 is the latest addition to Atmel's comprehensive range of capacitive touch controllers based on Quantum Research Group's charge-transfer technology. These include QTouch™ and QMatrix™ based controllers for single and multiple touch buttons, touch slid- ers and touch wheels. The AT42QT1060 is designed for use in portable electronics prod- ucts. An inbuilt capacitive guard channel feature helps prevent false triggering, for example, where moisture is an issue. This feature also prevents against erroneous commands that can occur when devices such as MP3 players are carried in a pocket, or in the case of a cellular phone, when it is held against the ear. The highly integrated AT42QT1060 reduces component count, cutting design complexity and cost, and enabling faster product development. The AT42QT1060 functions through any insulating panel including glass or plastic up to 3 mm thick. Electrodes can be made from copper, silver, carbon, indium tin oxide (ITO) or Orga- con conductive ink and must be 6x6mm or larger. Widely differ- ent electrode sizes and shapes are possible, giving the product designer great flexibility in tailor- ing the user interface. www.qprox.com (080793-VII) 16 elektor - 11/2008 Universal Display Book for PIC Microcontrollers Prom LED to graphical LCD f ; ; ; ; ; \ The newcomer to Microchip's PIC microcontrollers invariably gets an LED to flash as their first attempt to master this tech- nology. You can use just a simple LED indicator in order to show that your initial attempt is working, which will give you confidence to move forward. This is how the book begins — simple programs to flash LEDs, and eventually by stages to use other display indicators such as the 7-segment display, alphanumeric liquid crystal displays and eventually a colour graphic LCD. As the reader progresses through the book, bigger and upgraded PIC chips are introduced, with full circuit diagrams and source code, both in assembler and C. In addition, a small tutorial is included using the MPLAB programming environment, together with the EAGLE sche- matic and PCB design package to enable readers to create their own designs using the book's many case studies as wor- king examples to work from. 192 pages • ISBN 978-0-905705-73-6 • £23.00 • US$ 46.00 v ~ J MICROCHIP V CENSORED Professional Solutions j * ■l Jr * ages +18 experts and curious readers allowed only ■ XILINX ATMEL * KITS Q httpi//www. propox. com Many ideas one solution o Q Z =) o CL o o o CO Z CO O O o 9? * 6 CD CD o z °-o O CD - QZ< z l£ l ip y z l z << r o ^ L CD LU o > LU 0 Z i— QZ LU 001 Ll_ O — °g§ CD z I— ZOO CD I — — j — o y CD LU 5 O LU ^ Upd ted rswww.com/electronics 08457 201 201 11/2008 - elektor 17 Thijs Beckers (Elektor Netherlands) The first step is always the hardest, so we're providing a brief introduction to SMT to help you out. Here we introduce you to some of the jargon, pitfalls and packaging so you can hold your own in discussions of this technology, which has become indispensable in the production of modern electronic equipment. If you want to work with surface-mount technology (SMT), you need to have a bit of basic knowledge. This article explains several terms, discusses some of the things to watch out for, and gives you some pointers for finding more information so you can learn to loosely mention the terms like a pro. What does it mean? To start off, let's take two terms that many people tend to mix up: 'surface mount device' (SMD) and 'surface mount technology' (SMT). SMT refers to the technology, which means using components (usually small) that do not have leads designed to pass through holes in the circuit board, while SMD refers to the actual component. Another term you will see is 'SMA'. This stands for 'sur- face mount assembly', which indicates that a component is designed for mounting on the circuit board, rather than with pins that pass through the circuit board. The same term can also be used as an abbreviation of 'surface mount adhesive', which is the glue used to attach SMDs to the cir- cuit board so they don't slide around during soldering. Jargon Nowadays SMDs are used in almost all electronic equip- ment. In fact, there are probably more components avail- able now in SMD form than in 'through-hole' form (with individual pins or leads). Naturally, the reason for this is the extensive miniaturisation of electronic circuitry. SMDs are also appearing increasingly often in the DIY world. When you use SMDs, you run into a considerable amount of insider terms. In order to get your bearings in the SMD world, you need to know these terms and understand what they mean. Most likely you have already heard the term 'ball grid array', but 'flip chip' is probably less familiar. With the latter technology, the chip is mounted with its active surface facing downward (Figure 1), which means that the active surface of the chip can be used directly for the connections. This makes it possible to make a large number of connections to the chip, and they have much lower inductance than with wire bonds due to the shorter distance. Another recent development is called 'package on pack- age' (PoP). This consists of stacking one chip on top of another one (usually discrete logic and memory), which saves space and keeps the connections short to minimise inductance problems. When boards are assembled automatically, they must have fiducial marks. A fiducial mark (or simply 'fiducial') is a symbol that is placed on the circuit board. It can be used to determine the position of the board with high accuracy, so that the solder paste can be applied correctly or a pick- and-place machine can place the components in exactly the right positions before the board goes into the oven for soldering. Incidentally, two standard methods have been developed for applying solder paste: silk-screening (also called screening or stencil printing) and direct printing. In the silk-screening process, a stencil is created with openings exactly aligned to the copper track layout. A rubber squeegee spreads the paste over this stencil, with the result that it ends up exactly where it should be on the circuit board. This method is fea- sible for series production, but producing a stencil of this sort is far too expensive for making a single PCB. The direct printing method is more suitable in the latter case. This involves using a special 'printer' (similar to an ink-jet printer) to deposit the solder paste directly on the PCB. However, these printers are rather costly. Reflow problems There are several common problems with soldering SMDs (including reflow soldering). One of them is called the 'tombstone effect', or 'tombstoning'. Figure 2 shows the forces acting on an SMD component during soldering. They can cause the component to stand upright on the circuit board instead of remaining flat on the board when it is soldered. Upright SMD resistors resemble miniature tomb- stones, which is where the term comes from. The component will rise up if the sum of and F 2 is less than F 3 , or in mathematical terms: M g [(D 2 + L 2 )/2] cos(a+(3) + y- Wcos(a/2) < yDsin(oc+), where M is the mass of the component and g is the force of gravity. 18 elektor - 11/2008 There are several causes of tombstoning. For instance, light- weight components are more susceptible to this effect. Rela- tively long solder pads can also cause this undesired effect, because the portion of the pad that extends beyond the component causes an increased torque (larger value of O in Figure 2). Tombstoning can also occur if temperature does not rise uni- formly at both ends of the component. If one end is warmer than the other one, the solder will melt first at this end, lead- ing to an undesired upright component. This problem usu- ally does not occur in modern convection ovens, but design- related factors such as screening and cooling surfaces can lead to temperature differences. Incorrect component placement can also lead to tombston- ing, but the main cause is a temperature difference between the two ends of the component, which causes the solder to melt earlier at one end than at the other end. / Popcorning / is another example of what can go wrong during the soldering process. This refers to a condition that can occur if moisture-sensitive components remain outside a moisture-proof package too long before they are soldered in a reflow oven. The component package can absorb mois- ture due to its hygroscopic properties. If such a component is heated relatively quickly, the moisture turns into steam, which may create so much internal pressure that the pack- age will crack or burst open. Another problem is that the component may float on the molten solder and tip over along its long axis as a result. This is particularly annoying with LEDs, since it causes the light to be emitted toward the side instead of straight up. Standards Since the 1 st of July 2006, electronic equipment marketed inside the EU is not allowed to contain certain substances. This is stipulated by the 'Restriction of Hazardous Sub- stances' directive, usually abbreviated as 'RoHS'. In col- loquial language, this is also described by saying that the equipment and components must be 'lead-free'. The fact that a component is 'lead-free' or fulfils the RoHS stand- ard does not necessarily mean that it is suitable for lead- free processing. It only says something about the chemical composition of the product, but not that it can withstand the relatively high temperatures used in lead-free soldering. Consider yourself warned. A good reference source for industrial standards related to components is the Institute for Interconnecting and Packag- ing Electronic Circuits (IPC - see the web link at the end of this article. The standards in the IPC-7351 to IPC-7359 series are especially important for PCB design. They pro- vide information about suitable dimensions, shapes and Solder ball Rigid Laminate Substrate 080667 - 11 Figure 1. Wire-bond or flip-chip? Flip-chip technology is often used in processors due to high clock rotes. tolerances of pads for SMDs, so that they provide enough surface area for soldering but not too much (which would create a risk of tombstoning). Packages and packaging We could fill dozens of pages with information about SMD packages - it's an almost endless subject. Here we recommend that you read through the overview of the most common SMD codes and pin layouts prepared by R. P. Blackwell [1]. With regard to packaging, we can keep our remarks quite short: as SMDs are usually processed by automated machines, it is essential to standardise the containers used Figure 2. The tombstone effect is caused by unbalanced forces. 11/2008 - elektor 19 INFO & MARKET SMD to supply the components to the machines. There are four common types: - Tape or reel: the components are located on a tape that is wound on a reel, just like the tape of an (old-fashioned) tape recorder. - Tray or pallet: components with a small pin spacing or BGA are usually packaged in this sort of container. - Stick or tube: 1C with edge-mounted pins are often sup- plied in a plastic tube to prevent accidental bending of the pins. - Bulk: a large number of the same type of component, which are not packaged in an orderly manner. Often used in the past with large quantities. Requisites In the old days, enthusiasts went to an electronics shop to purchase their components. As there are often a large number of package options available now for components, it is simply impossible for an average shop to keep all types of components in stock. Fortunately they can usually supply the desired version on request. Online shops often have a larger selection, but there is a chance that they do not have the part in inventory and will have to order it from a distributor. In addition, there are usually shipping charges. The really big play- ers, such as Farnell and Conrad Electronics, can usually deliver from stock. Finally, you need solder paste if you want to solder PCBs with a reflow oven. There is large selection of various pastes, each with its specific properties. The one may have a higher melting temperature, while the other may have smaller solder particles, and so on. See reference [2] for more information on solder pastes. You can also consult the web links listed below under 'Background information' to learn more about the top- ics discussed in this article. Once you've digested all this information, you'll be a lot more knowledgeable, and you won't be at a loss for words when the subject turns to SMT, SMD or SMA. ( 080667 - 1 ) Internet Links [1 ] www.marsport.org.uk/smd/mainframe.htm [2] www.siliconfareast.com/solder-paste.htm Background information www.answers.com/topic/flip-chip www.ipc.org www.ami.ac.uk/courses/topics/0229_place/index.html 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-6I4I-AV Susteren, The Netherlands, Fax: (+31) 46 4370161 Email: editor@elektor.com 20 elektor - 11/2008 r ' Design your own Embedded Linux control centre on a PC lektor SHOP 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 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 v Order quickly and safe through www.elektor.com/shop AHQfliL LAMQTHE'fl tQN Le HFEr‘-By-aTE#‘ Haw tet Builo ATVJJ. an jIiOjm TOJjfl r’wiv ij EJAA4£ E7PM1131-CJ 900/3000, Slrtenfc ZM ■"*> Appto II -A CHTHTHdan 641 A- 4 Z- r f ^ Kjtt CiCTHtlPri ■TVh>^ Dh-nr-ft i. UrflUrHl ^h!l t r 'C JtlMHM fetKrv E >■ ' ■ m UfC DmHdpmc'H HJtf- ‘ . ; ■ ■dor*, ihi glhw fcti ' rCrfJr, .aid ftwwW iuMs kfcS-.di«.r I--MW C-r— ydH ■ HR WWW.XEAMESTATION.CDM Ph: I £.£ 1 ; l . ,-:;j .■ -- 1 aufTCiiw1-@NUkvg ri HE.T TBIz01&3lS 40347 Miivvliury Eli:i:l r-miins Lli J Fn: D1B3B 36143 hirctilf HKri HjpHili,- B£iisFW,14 EAD 2 null: dni.iltif m?.vh i-v.h:: LI1 SCK A0 SDA A1 WP A0 24LC256 -o RCO -O RC5 RC2 £ -ORC1 -o RC6 -O RC2 -ORC7 -O RC3 -ORC4 SUB D9 J3 RXUSB O- TXUSB O- C4 v+ © 10ja 7X RS232 O RX 232 O- 12 11_ 10 C2 r 1 Ojj. I 10n V + C1 + © U2 Cl- R10UT RUN T1 IN T10UT T2IN T20UT R20UT R2IN C2+ MAX232 C2- V 16 13 14 7 8 15 C3 J1 1 1 RC6 O — < » 2 RC7 O— < » 4 o a o a o o ■o a 10n -o TX RS232 SUB D9 9 D2 -O TX USB RCO O -ORX232 -O RXUSB RC1 O j 1 _ ) S 3 ) < RIO v+ © CIO Cl R13 lOOn 100|i 25 24 23_ 22 _ 21 _ 1 8_ 20_ 1 9_ 15 16 31 R14 14 R15 13 26 30 O O > RST TXD RXD RTS CTS DTR Rl DSR DCD PWREN TXDEN TEST PWRCTL 2 8 o > o > o o < U3 RXLED TXLED RSTOUT EESK EECS EEDATA FT232BL USBDM USBDP SLEEP 3V30UT AGND GND XIN XOU C8 22p 27 XI I I GND 28 1 I 11 12 5 _1 32 2 R18 R16 J2 10 6 27 Q. 270. R17 29 17 6MHz C9 22p C6 33n O +V O D- O D+ O GND USB-B H 220 Q | — bicolour LED 080615-12 Figure 2. Circuit diagram of the home-made E-block. The serial data input is selected manually by the position of the jumpers on Jl. r POI files There are lots of different types of POI files, but the ones we're using contain nothing more than a list of geographical positions in ASCII, hence their .ASC extension. On one line of this list we find three comma-separated fields: longitude, latitude, and a name, often a number: of POI files (for free). To display a POI file, all you have to do is load it into PoiEdit and pick 'Se- lect All' in the 'Edit' menu. Don't forget to load, and if necessary calibrate, a map. Some maps are also available on the PoiEdit website. 2.681 1 1 , 44.43686, "Num 40235" The longitude and latitude are in decimal degrees. To sort a POI file by longitude (if you're using the 08061 5-1 1_1 program), all you have to do is click on the Longitude bar and save the file in .ASC format. f r PtiEJacxooe o-iui* sofa*«i« - [itr «.i The simplest way to obtain a POI file that can be used by our project is to pay a visit to the PoiEdit website [5]. PoiEdit is a shareware application that lets you display and edit the contents of a POI file. This website also has lots of links to other sites where you can get hold The POI file thus created or downloaded can be directly read by the transfert.exe update program, as described elsewhere in this article. nc c<* -oab >«t> ■T.K224 -r x?*r 16I565* itm» u.n-m ROM M‘C7M *.«y»x M4COC * tnn M4?»J MK714 KtHM M ••»*? M.'AM M.TJC M?ttK M774M Lon - 555*166 V. CVn nxw 55 3*«1) KH«< ‘nWiOi 5SJKW 5VM3S5 615421 -61 47*1 «i Mm -61 5416 } 4M7X •5 7*672 - 6*1 IK •5 7KM 524660 • 6 M »4 - 45*647 •464174 •456111 -4 **41 - 15*722 - 4 * 74.1 •254717 -4/4641 » n L j 24 elektor - 11/2008 I 2 C memory (Figure 4), looks after displaying the data, and drives the sounder and bi-colour LED. The sec- ond section is used for updating the I 2 C memory with the help of a compu- ter. A switch determines which section of the program is run. Primary loop Out of the NMEA0183 frames pro- vided by the GPS, we’re going to use the RMC frame [4] . This frame contains all the information we need: latitude, longitude, time, date, and speed. After decoding an RMC frame, we then need to read the I 2 C memory. If we find a location corresponding to our current position - minus a certain margin, of course, otherwise it’s too late! - that means we are near a POI. In this event, we leave our read loop and set off the alarms, i.e. the sounder sounds, the bi-colour LED light up red, and a mes- sage is displayed on the LCD warning of a POI close by. Next time a GPS frame is received, we start again and decode, read the PC memory, compare, etc. Updating the database The second section of the program is used for updating the database via a serial link. The transfer is initiated by the PC which sends the character 13h (19 in decimal) to the PIC, and the trans- fer starts once the PC receives the same character back. The PC then sends the file to the PIC, which acknowledges each character received by sending the character 13h. When 128 charac- ters have been received, the PIC writes them into the PC memory. To do this, we’ve used the PC routine available in Flowcode, which makes it very easy to use the PC bus. The transfer ends with a special character FFh, which is the signal for the PIC to display on the LCD the number of points stored in memory. This number is also stored in the PIC EEPROM, as we need it to be able to get out of our comparison loop correctly in the other section of the program. For updating to be as fast as possi- ble, it is done at 115,200 baud. But the component routine is already config- ured to 4,800 baud for dialogue with the GPS. We have got round this prob- lem by inserting a little bit of assem- bler code into our program. Another complication concerned the interrupt used to detect the reception of a character. The Flowcode library does not include this interrupt, so we had to create a user source for it. Figure 3. The speed camera warning device built using E-blocks. Our own E-block is the one with the sounder. Automatic backlight One option that deserves to be men- tioned here is the automatic adjust- ment of the display backlight depend- ing on the ambient light level. This was easily achieved using the PIC’s ADC, which measures the voltage at the terminals of the light depend- ent resistor (LDR), and a PWM (pulse width modulation) output to control the backlighting via a transistor. The ADC and PWM are component rou- tines included within Flowcode. Simulation Virtually the whole of the program can be simulated in the Flowcode environ- ment, except for the reception of the characters during transfer of the file containing the POIs, where we have used some assembler code. Each com- ponent of the project can be simulated: the LCD, the PWM output, reading the I 2 C memory, GPS frame reception, and even the ADC for use with the LDR. ( BEGIN ) H-j'-- C -al Coil Macro 1 1 ■iirUrATi x if N PiFSTOrtc v X r - El si/ Nu LATITUDE E HIJ toe MdCIU C dll E ial Macro 1 Dfleierr.. . [ Cal e-id* km i IMF W II 1 i I Condtcn X?X J QQWRA V Xrisdn. Wd LATITUDE I. MINN I Ill'll LED Fgh ts Bed CaJ Maao LE D_fi D, . | Rfcr.lJ.fl KiiViihn RADAR - 1 I j i a Aitii Lai Macro v-.riiiuj-M I M d L [U Cal l"al Macro Beep Figure 4. The full program is much too long to be shown complete. So we'll just give the most interesting part: the detection algorithm. 11/2008 - elektor 25 E-BLOCKS LCD1 \ LC DISPLAY 2x16 \ J W Q |> Q Q WOOtfllc Oi-cjn^-incDh'miii >>>CCDCUJQQQQOQOOIjIj vcc ©- PI z 4k7 VCC © R1 R4 H 10k V R2 D2 H 220 R3 -\ 220 R5 NSL4960 red/green VCC © K3 O ISP 27 28 VCC (©1 1 ^■ 10 HlOOn 20 © MCLR RB0/INT IC2 rbi RB2 RB3/PGM RA0/AN0 RB4 RA1/AN1 RB5 RA2/AN2 RA3/AN3 RC0 RA4/TOCKI RC1 RA5/AN4 RC2 PIC16F876A RC3 RC4 RC5 RB6/PGC RC6/TX RB7/PGD RC7/RX J. OSC1 OSC2 _L C5 22p XI I I 20MHz 10 21 22 23 24 25 26 19 C6 22p rr vcc © ( 20 ) IC4 (io) C11 lOOn 10 11 12 13 11 12 13 14 15 16 17 18 BZ1 KPEG110 IC4 19 _LM EN EN n 18 1£ _14_ 12_ 9 _7 _5 3 14 15 +12V © IC1 LM7805 l\ 1 /l K1 16 o- o- vehicle battery Cl 22p 50V 0 * 1/ C3 lOOn 11 C4 lOOn C2 22p 50V VCC -© D1 rz green R7 ©L" R17 VCC © Cl V v TQr VCC ■© Js R12 BC547 R6 VCC © R9 1r7 VCC |R 8 n. c 1 © SCK IC6 A0 SDA A1 WP A0 24FC1025 3 7 si PC/GPS 25 24 23_ 22 _ 21 _ 18 _ 20 _ 19 _ 18 18 31 R13 T 14 TrI 1 3 13 26 » 1 O o o o 0 — 0 o > o > > o < RST > TXD RXD RTS CTS DTR Rl DSR DCD IC3 RXLED TXLED RSTOUT EESK EECS EEDATA FT232BL PWREN TXDEN TEST PWRCTL USBDM USBDP SLEEP 3V30UT AGND GND XIN XOUT GND C7 22p 27 X2 I I 6MHz 28 C9 ^ToOn 11 12 5 1 32 2 | R14 R16 K2 USB-B -\ 27 <1 \- 10 6 H 27 n | - R15 29 17 C8 22p C13 33n OVBUS O D- O D+ OGND VCC © 11 13 15 17 74HC241DW IC5 K4 6 6 O 6 6 O P _r\. 5 4 _rv 3 _rv 2 -TV 1 PPS GND TX RX VIN GND O EM-406A EM-406A-2 080615- 13 Figure 5. The full circuit diagram of the speed camera warning device. To simulate decoding a GPS frame, we need to input a GPS frame to the RS- 232 component module. We can then see the reading of the memory in the I 2 C routine, byte by byte. The values of the variables can be displayed (or changed), and simula- tion can be performed in step-through mode. Circuit Once our E-block prototype was operational, we redesigned the cir- cuit without the actual E -blocks (Fig- ure 5) - the EB006 E-block has been replaced by a 16F876A PIC (IC2) run- ning at 20 MHz and the EB005 E -block by a standard alphanumeric LCD with backlight (LCD1) - the contrast can be adjusted with potentiometer R17. We have eliminated the components that are no longer needed, like the MAX232, replaced the manual multiplexer by a 74HC241, and added photoresistor R5. The PIC connects to the I 2 C EEPROM via its special PC bus inputs SCL and SDA. The GPS receiver and the USB/ RS-232 interface (IC3) are connected to the PIC USART by way of the mul- tiplexer IC4. In normal mode, the mul- tiplexer connects the PIC RX input to the GPS TX output to receive the GPS frames. In PC memory update mode, the RX input is connected by the mul- tiplexer to the TX output of the USB/ RS-232 converter. The PIC TX output is directly connected to the RX input of the convertor IC3. Switch SI lets you choose between normal and update mode, and at the same time controls the EEPROM write protection at the same time. The display is connected to PORT B of the PIC in 4-bit mode. Input AN0 of the ADC is connected to a potential divider made up of R4 and the photoresistor R5, which enables us to vary the dis- play backlighting depending on the ambient light level. The backlight is adjusted by means of the signal on one of the PIC’s two PWM outputs. The other output is used to drive the sounder. The bi-colour LED D2 uses another two outputs of PORT A, RA3 and RA5. EEPROM chip IC6 contains the posi- tion of the POIs, each listed by lati- tude and longitude to 6 bits. For our 26 elektor - 11/2008 project, we’ve chosen the 24FC1025 from Microchip, a 1,024 kbit memory that allows us to store the position of 21,845 POIs. The most expensive part in the whole project is the EM406-A GPS receiver module with built-in antenna from Glo- balSat, already familiar to regular Ele- ktor readers [4]. It interfaces directly to a microcontroller via its ‘almost’ TTL- level serial port. The USB/RS-232 interface is taken care of by an FT232BL IC from FTDI (IC3). This forms the interface between the PIC and the PC and requires a driver to be installed on the PC in order to be used as a virtual COM port. And lastly, the project is powered via a 7805 regulator. Figure 6. Board component layout. Construction It’ll take you just a few hours to build this project. Refer to Figure 6 for the board component layout. Note the use of a ‘wire-wrap’ socket to bring the display up to the height of the housing, and the same for the bi-colour LED. The first step is to solder the SMD components. The FT232BL IC is the trickiest, but with a very fine tip and a bit of patience, it can be done (you can use solder flux to help). The other SMD components ought not to present any real problem. Next, solder the discrete resistors, non-polarised capacitors, and then the electrolytic ones (observ- ing the correct polarity carefully). After soldering all these components, check that the supply voltage is reaching the ICs on the appointed pins. Two .HEX files are available for pro- gramming the PIC (see components list). The executable called 080615- 11_2 can be used with downloaded POI files directly. The 08061 5- 1 1 1 file requires a POI file sorted by increas- ing longitude, which speeds up the POI detection algorithm. With the circuit powered and the PIC programmed, the green LED D1 lights and the display shows a start-up mes- sage (depending on the position of SI). If the display appears blank, adjust the contrast using R17. First steps The first time the circuit is pow- ered up, the EEPROM has to be pro- grammed with a POI database. Close SI and connect the circuit to your com- puter’s USB port. Never connect the USB cable and the cigarette lighter plug at the same time! Now’s the COMPONENTS LIST Resistors (0.25W 5%) R1 ,R8,R1 2 = lOkQ R2 / R3 / R7 = 220Q R4 = 3kD3 R5 = NSL4960 (LDR) R6 = 1 kQ R9, R10 = 1I ♦ P6KE30 220u 35 V +5V PI Q P2 Vre o u-j-j: GND SB320 +5V JP1 bo cH +5V O P5 1 P P6 C5 1u 16 _14 _7 13 15 1u £ vcc > C1+ IC2 Cl- TIOUT T1IN T20UT T2IN RUN R10UT R2IN R20UT C2+ MAX232CPE GND m C2- LD > C8 til GND 1u GND PI: +5V P2: +5V P3: GND P4: GND P5: RXD-RS232 P6: TXD-RS232 P7: TXD-TTL P8: RXD-TTL C3 3u3 50V +5V O cii [100n GND o o < PCO (ADCO) IC3 PCI (ADC1) PC2 (ADC2) PC3 (ADC3) PC4 (ADC4/SDA) PC5 (ADC5/SCL) o o > PD3 (INTI) PD4 (XCK/TO) PD5 (T1) PD6 (AINO) PD7 (AIN1) ATmega8-16PU AREF PB0 (ICP) PB1 (OC1A) PD2 (INTO) PB2 (SS/OC1B) PD1 (TXD) PB3 (MOSI/OC2) PD0 (RXD) PB4 (MISO) PC6 (RESET) PB5 (SCK) i i < i CD >< >< CD C9 22p XI ? -tji 8 MHz X GND CIO 22p 5_ 6 _ 11 _ 12 _ 13 14 15 16 17_ 18_ 19 +5V O K8 SCK RESET MOSI MISO ISP GND R11 1k5 OUTPUT3 rNn yellow GND 080324-11 Figure 1. The circuit diagram is remarkably simple since most functions are handled by software in the ATmega8. 11/2008 - elektor 31 CELLPHONE If this technique has any shortcoming, then it is the time involved; between the first call and switching an out- put or sending an SMS alert a delay of between 90 and 180 seconds can occur. Call recognition To avoid possible operation caused by ‘false’ calls (wrong numbers, unwanted sales calls, etc.) we use two different operating modes for evaluating calls received (indicated as ‘TelTyp’ in the software). The choice of Teltyp mode is set using the switch S2-2, seen on circuit diagram Figure 1 next to pin 27 (PC4) of the ATmega8, as follows: 1. TelTyp = On (S2-2 closed) The calling mobile must have caller ID enabled (in other words the call must not come up as ‘Number Withheld’). The remote switch reacts only to calls from mobiles whose numbers are stored on the SIM card of the mobile associated with the remote switch. Calls from unrecognised numbers are ignored. The SMS status alert is sent back to the number that called. 2. TelTyp = Off (S2-2 open) Every call received in the 90-second time window is counted. For extra security, however, the device must be called one time more often than when TelTyp=On for the same function. This is because it’s unlikely that an invalid caller would ring more than once within 90 seconds. So to switch Out- put 1 two calls are required (and so on). The SMS status alert is sent to the first number appearing in the phone book on the SIM card of the mobile attached to the remote switch device. Control functions As already mentioned the switched outputs (Outputs 1-3 on the sche- matic in Figure 1) are controlled by the number of telephone calls received. The switching functions for the three outputs are not the same, however: 1 call: Outputl is on each occasion switched only briefly (relay RE1 oper- ates for just one second). 2 calls: Output2 can be controlled in one of two different ways, depend- ing on how switch S2-1 on Pin 28/PC5 of the ATmega8 is set. If the switch denoted in the software as ‘Exit2Typ’ is closed (Exit2Typ = On), the output Table 1 • Typical Status-SMS with a GPS module connected Status: TelTyprl Exit2Typ:0 Time:15mn Exitl:0 Exit2:l Exit3 : 1 *GPS OK* 15:50:23 N52Q58.0674 E012Q48.3217 Message Meaning TelTyp : 1 Switch TelTyp is On Exit2Typ : 0 Switch Output2Typ is Off Time : 15mn On Output 3 a switching time of 15 minutes has been set Exitl : 0 Output 1 is enabled Exit2 : 1 Output 2 is enabled Exit3 : 1 Output 3 is enabled *GPS OK* GPS reception is operational. Data valid ("*GPS INVALID*" if reception is disturbed) 15 : 50 : 23 UTC time N52Q58 . 0674 GPS coordinates: 52° 58.0674' Northerly latitude ("52 Degrees 58,0674 Minutes") E0 12*^4 8 .3217 GPS coordinates: 1 2° 48.32 1 7' Easterly longitude toggles or changes state on each acti- vation. If switch S2-1 is open (Exit2Typ = Off) then Exit2 behaves like Outputl (RE2 then operates for one second). 3 calls: Output3 is switched on and then off for the period set by the rotary switch (SI). The following on periods can be selected: 1, 5, 10, 15, 20, 30, 45, 60, 90 and 120 minutes. 4 calls: SMS status alert is generated and sent. Status and alarm reports The status alert message provides information about the switching state of Outputl, 2 and 3 and the setting of S2-1 and S2-2 (Exit2Typ and TelTyp). Optionally the report can include infor- mation about GPS coordinates. The setting of TelTyp also determines to whom the text message is sent (see paragraph above on call recognition). Connection of a GPS receiver module is entirely optional. If you decide to do this, the data sent from the GPS- module is examined and if reception is good enough to decode the geographi- cal coordinates, these are included in the text message. If the status of the GPS module means the coordinates are inexact but available, then these are sent in the text along with details on the quality of the coordinates. There are various ways of converting the GPS coordinates (see penultimate Web link at end of article) or else you can enter them direct into Google Maps to find their position on the map (for exam- ple, N51 00.9892 E005 50.3189 gives the location of Elektor House). A typical status text including GPS data is shown and explained in Table 1. Sending an SMS text can also be trig- gered via the alarm input at K2 in Fig- ure 1. This input is protected by an optoisolator and reacts to changes in signal. Every change in signal level during operation sets of an alarm. In this situation an alarm alert is sent by SMS to the first phonebook entry on the SIM card of the mobile connected to the remote switch. The text noti- fies the alarm and if a GPS module is connected, the location coordinates as well. Circuit and printed circuit board The schematic (Figure 1) is extremely straightforward since most functions are handled in software within the ATmega8. All the same the PCB itself (Figure 2) is not exactly compact, partly because we have not used sur- face-mounted devices (SMDs) and also because the AC mains (110 V/230 V) section of the circuitry needs ade- quate room for the relatively large relay and interference-suppression components. Switches SI and S2 have already been described. The reset switch S3 plays a relatively crucial role here; as far as the microcontroller is concerned, the set- tings of switches SI and S2 become valid only following the reset opera- tion or applying power. Every change to the settings of SI and S2 requires a fresh reset to take effect! LED D5 indicates reception of GPS data (if a GPS module is connected to 32 elektor - 11/2008 Figure 2. The printed circuit board manages without SMDs. Almost half the surface area is taken up by the mains-voltage section with the relatively large relay and interference suppression components. Mini-DIN connector K7): flashing light denotes poor reception (inadequate signal or interference) but continuous illumination signals valid coordinates. After switching-on or reset the LED flashes rapidly for about two seconds to indicate that the mobile be con- nected is making a connection (which can take up to 30 seconds or so). If the LED remains unlit, the mobile is not responding and the remote switch is not working properly. Sub-D connector K6 is provided for making a serial connection to the mobile, and since we are dealing with RS-232 signals, the level changer MAX232 (IC2) must not be omitted. Test points are provided for the sig- nals and operating voltages around the serial interface in the form of solder pins PI to P8. The programming inter- face (ISP interface) for the microcon- troller is taken out to connector pins K8, although this will be needed only if you choose to load different firmware into the microcontroller. The power supply for the circuitry can be fed either to connector K1 or from an external mains plug-in PSU (what our American friends call a wall wart) or else you can use the on-board bat- tery supply of the car, boat, caravan, etc. Any mains PSU will do (an unsta- bilised one is fine) so long as it deliv- ers at least 9 V. Make sure there is suf- ficient power for other devices con- nected (mobile and GPS); this means you must have at least 1 A available. Voltage regulation is handled by the COMPONENTS LIST Resistors R1 / R3 / R5 / R7 / R9 / R1 1 = 1 kD5 R2,R4 = 1 OkD R6 / R8 / R1 0 = IkQ R1 2 = see text R13 / R14 / R15 = 1 D/volt, 2W (see text) Capacitors Cl = 220 a/F 35V C2, Cl 1 = lOOnF C3 = 3jL/F3 50V C4 / C5 / C6 / C7 / C8 = 1/iF 16V C9,C1 0 = 22pF Cl 2,C1 3,C1 4 = 0.1jL/F/ampere (see text) Semiconductors D1 = P6KE30A, TVS (30V/ 600W) D2, D3 = SB320 or 1 N5820 (Schottky; 3A /20V) D4 = LED, red, low current, 3mm D5 = LED, green, low current, 3mm D6-D9 = LED, yellow, low current, 3mm D1 0,D1 1 ,D1 2= 1N4148 T1,T2,T3 = BC337 (T092 case) IC1 = L78S05CV (TO220 case) IC2 = MAX232CPE+ (DIP16 case) IC3 = ATMEGA8-1 6PU, DIP28 case, pro- grammed, Elektor SHOP # 080324-41 OC1 = PC81 7X2J000F, optocoupler, DIP4 case Inductor LI = 40/iH 2A (e.g. EPCOS) Miscellaneous XI = 8-MHz quartz crystal (HC49 case) RE1 ,RE2,RE3 = HRS4E-S (DC 5V) K1 = DC adapter socket, PCB mounting K2 = 2-way PCB screw terminal block, lead pitch 5mm K3-K5 = 2-way pinheader, lead pitch 2.54mm K6 = 9-way sub-D plug (male), PCB mount K7 = 6-way mini-DIN socket, PCB mount K8 = 6-way SIL pinheader, lead pitch 2.54mm JP1,JP2,JP3 = 2-way SIL pinheader, lead pitch 2.54mm 51 = MCRH2AF-10R 10-way DIP rotary encoder 52 = MCDS02 2-way DIL switch 53 = FSM4JH single-pole pushbutton, PCB mount FI = auto -resetting PTC fuse, 30V, sus- tain current 1 . 1 A, activation current 2.2A, e.g. Multifuse MF-R1 10-0-99 (Bourns) or Polyfuse 30R1 10 (Littlefuse) or Polyswitch RUEF1 10 (Tyco), ES-LP30-1 10 (ESKA) = PFRA 1 1 0 (Reichelt.de) PI -P8 = 1 mm dia. solder pin 1C sockets for IC2 (DILI 6), IC3 (DIL28), OC1 (DIL6 used as DIL4) Heatsink for IC1 (U profile, 25x1 5x20 mm, 1 7 K/W, slotted hole) M3 screw, 1 0 mm, with nut (for securing heatsink) Blue transparent enclosure, 1 50x80x50 mm (LxWxH), e.q. Conrad Electronics # 522498 PCB, Elektor Shop # 080324-1 or kit incl. PCB, # 080324-71 11/2008 - elektor 33 CELLPHONE Firmware for hardware The software for the GSM remote-controlled switch was written in C, for which the free development environment WinAVR (release 200601 25) was used (this includes AVR-GCC, a version specially opti- mised for Atmel-AVRs). The main task of the processor is to commu- nicate using a serial interface with the modem in the mobile handset connected. Basic functions such as recognising incoming calls, man- aging the address book, etc. make use of a Hayes-compatible com- mand set composed of AT commands that were formerly used widely in PC modems. After connecting your mobile phone to the PC using a serial data cable, controlling the mobile requires only a simple termi- nal program — something that later on the microcontroller can take care of. Individual models of mobile phone may be programmed to recognise additional commands outside the standard set. However, these are deliberately not included here, as they are not usable with the majority of handsets. While we were developing this project we became aware that telephone manufacturers do not always stick to the rules laid down. An example is the format in which a caller's telephone number is displayed (CLIP): the Siemens C55 presents the data in inverted commas. Activating the telephone number display by terminal pro- gram and signalling a call Understandably it's impossible to look into every possible detail but during the development process we did manage to verify the software against several different models of phone. Another consideration arises if a GPS module is to be connected: cur- rent AVRs provide only a USART, making it necessary to control an ad- ditional serial interface in software. In this case it's advantageous that the GPS module transmits only data and also at a slow rate of 4,800 baud. As the data from the GPS module is repeated continuously there is no need to buffer the characters received. It suffices to simply wait until the required data set occurs, as and when it is required. In this way the code for data reception is much simplified. Sending an SMS text A fair amount of effort is involved in sending a text message by mo- bile telephone. Before the message can be passed to the mobile for transmission it needs to be coded with the destination telephone number and various other details as a PDU (Protocol Data Unit). It's true that a few models of mobile can also accept the information in plain text format but these are few and far between and their number is dwindling. Once you have got to grips with PDUs, you can then send SMS texts with every type of mobile without further restrictions. To demonstrate how a PDU is formed we shall send the clas- sic message "Hello World" to the German telephone number +441 231 234567890. The telephone number is given in internation- al notation like this: + . For normal text messages (maximum 1 60 characters) only 7-bit ASCII characters can be used. You can find details of the character set In the official publication GSM 03.38, which describes how a PDU is made up. It is assumed that the number of the messaging centre for texts is already programmed into the mobile. This is the case if you currently can enter texts into your mobile and send them without any other formalities. We will now use our terminal pro- gram and enter two lines in order to send our SMS text message: AT+CMGW=26 001 1 000F91 9421 1 332547698F00000AA0BC8329BFD065DDF72 3619 PDU for an SMS message The first line is completed by pressing Return (CR+LF). The telephone now responds with the symbol ">" to indicate that it is standing by. You can now send the second line, which is ended with the control code Ctrl-Z. The telephone then confirms receipt and tells you the automatically generated reference number of the message if correctly transmitted. This number would enable you to search the telephone's memory for the notification, although generally this is not of any interest. Note that with this control sequence the mobile does not actually transmit the text message but merely stores it. This is an advantage during the test phase, since the order of events is fundamentally iden- tical to actually transmitting, except that there is no cost involved and you can read and check the messages on the mobile's display. Only when you replace the AT command CMGW with CMGS is the mes- sage sent to the phone immediately upon data entry. Creating a PDU message The digit following an AT command indicates the total number of bytes in the line following. Here the first byte is always 00 if no text exchange (SMSC: Short Message Service Centre) is indicated (and is then not counted). The 26 bytes following afterwards are arranged as follows: 5-V regulator IC1, which can take care of higher surges from external battery supplies. Fuse FI protects the circuitry, assisted by suppressor coil LI, protec- tion diode D1 and the two Schottky diodes D2 and D3. FI is a self-healing PTC fuse that resets itself on power- down or when the fault is cleared (manufacturer names: Multifuse, Poly- fuse, Polyswitch etc.). D1 is a tran- sient voltage suppressor diode (TVS). The model used (PK6E30) behaves like a 30-V zener diode and has the ability to react extremely rapidly to high-voltage peaks of short duration. The two Schottky diodes prevent the flow of reverse currents either side of the voltage regulator. The 5 V oper- ating voltage VRE ‘decoupled’ by D3 supplies the three relay stages. If you don’t require all three outputs, the cor- responding components can simply be omitted from the PCB. The outputs function like a switch. When the relay contacts are closed, the two terminal connections are linked straight through and make a circuit for the connected 34 elektor - 11/2008 Byte (Hex) Meaning 1 1 Message Flags; contains details of how the message is coded and how the telephone should react. 00 Reference number. Upon 00 the telephone naturally ap- points a number for referencing the message and to be able to respond to this particular number. OF Number of digits in the target telephone number. "491 231 234567890" consists of 15 (OFh) digits. 91 Telephone number, arranged in international notation. 94 21 13 32 54 76 98 F0 coded telephone number. 00 Protocol Identifier; always 00 00 Data Coding Scheme; always 00 AA Expiry time; message is valid for four days 0B Number of septets (not bytes) following with the actual message text. The number corresponds to the total text characters of the SMS text message. "Hello World" con- sists of 1 1 (OBh) characters. C8 32 9B FD 06 5D DF 72 36 19 Method of writing the bytes of a message coded in septets. Particular attention must be paid to the coding of the telephone number and the actual text message. The telephone number is coded relatively simply: first check whether the number of digits is even. If not, an "F" is appended to the end of the digit sequence. Following this every two pairs of digits are switched with one another. See also http://www.gsm-modem.de/sms-pdu-mode.html and http:// www.developershome.com/sms/operatingMode.asp Coding a text message involves more effort. In contrast to normal practice elsewhere only seven (instead of eight) bits are used per character. The seven bits used for each character are known as a septet. However, the telephone always expects a byte (8 bits) to be sent. To achieve this, the eighth bit (HSB) of the first byte is filled with the LSB of the following byte. In the second byte there are now two bits free, which are filled with bits from the third byte. This process of transformation is carried out in a number of steps. These are tedious but simple to understand, like this: 1 . First we convert individual symbols into their ASCII hex values. 2. These hex values are then transformed into binary digits, in which the HSB is always 0 and omitted (since only the first 1 27 charac- ters of the ASCII set are used). 3. The bits of the binary number are then mirrored, i.e. arranged in reverse order. Symbol Hex Binary (7 Bits) mirrored H 48 100 1000 00 01001 e 65 1 10 0101 10 1001 1 1 6C 1 10 1 100 00 1 101 1 1 6C 1 10 1 100 00 1 101 1 o 6F 110 1111 ii non 20 010 0000 00 00010 W 57 101 01 1 1 11 10101 o 6F 110 1111 ii non r 72 111 0010 01 001 1 1 1 6C 1 10 1 100 oo non d 64 1 10 0100 00 1001 1 4. The mirrored bits are written one after another as a bit sequence: 000100110100110011011001101 1 1 1 1101100000101 11010 1 1 1 1101101001 110011011001001 1 5. Onto this chain are added, on the right, as many zeros as neces- sary to make up the total number of bits that can be divided by 8 without any remainder. For the sample text three filler bits are required: 000100110100110011011001101 1 1 1 1101100000101 11010 1111101101001 1100110110010011000 6. The bit sequence is divided into bytes of 8 bits each. 7. Now each byte is mirrored again. 8. Each byte is represented in the hexadecimal system and when written in sequence produces the coded information C8329BFD065DDF72361 9. Binary (8 bits) mirrored Hex 0001 001 1 1100 1000 C8 0100 1100 001 1 0010 32 1101 1001 1001 ion 9B ion mi mi noi FD onooooo oooo ono 06 1011 1010 0101 1101 5D mi ion noi mi DF 0100 mo 0111 0010 72 ono noo ooi i ono 36 1001 1000 0001 1001 19 DC or AC load. As shown in the com- ponent list, the values of the capaci- tors and resistors used in the R-C net- works that protect the relay contacts from arcing must be matched to the voltage and current flowing through the contacts: For capacitors C12 to C14 you should allow around 0.1 /jF per amp of load current. For example 2 A would require 200 nF. The capacitor should be rated for the maximum voltage to be applied. Mains voltage of 230 VAC would need a capacitor rated at around 630 V DC. If the contacts are to pass 230 V at 2 A we would choose an MKS-4-630 type of 220 nF value, for example. Several solder points are provided for each capacitor on the printed circuit board, to enable you to use different form fac- tors of capacitors. For resistors R13 to R15 the best ones to use are 2 -watt metal film types with a value of about 1 Q per V of load volt- age. For 230 V we would calculate 230 Q and actually use 220 Q/2 W). The alarm input on K2 is isolated elec- 11/2008 - elektor 35 CELLPHONE Figure 3. Sample PCB with components inserted, viewed from above. trically from the alarm circuitry by optocoupler OC1. As the LED inside the optocoupler cannot be seen, we have provided LED D6 to display the logic level on the output of the opto- coupler. An alarm is always triggered by a change in logic level. If LED D6 lights after a reset (= quiescent state), the alarm is given until it goes out (and vice versa). The alarm input must be switched in such a way that a cur- rent of around 20 mA flows through the LED in the optocoupler (in either alarm or quiescent state). You need to watch the polarity of the voltage too, since the internal LED of the optocou- pler can be damaged otherwise. The LED in OC1 drops around 1.2 V, mean- ing that resistor R12 is calculated as follows: (U K2 - 1.2 V) / 20 mA So, if the voltage at K2 is 12 V for example, you need a value for R12 of 10.8 V/20 mA = 540 Q (in fact you would use 560 Q). When inserting components into the PCB (Figure 2) there are only two details to note. The EPCOS inductor (LI) used on our sample board does not allow the connection leads to be made too close to the end caps of the coil and a minimum distance of 3 mm is indi- cated. The second detail is the socket for the optocoupler, which is produced as a 4-pin DIL chip. Because 4-hole sockets are not available everywhere, we have used a 6-hole socket. You can see in the photo (Figure 3) how the IC is placed in this socket. Of course you can solder the chip direct into the PCB if you prefer, without using a socket. Mobiles, Cellphones The mobile connected to the PCB requires an RS-232 interface. Permissi- ble data rates are 4.8, 9.6, 19.2, 38.4 and Figure 4. The connections for mobile handset, GPS module and plug-in mains unit are on the forward side of the PCB. 36 elektor - 11/2008 f ooddah Gps Tracker Status: TelTyp:0 Exit2Typ:l Time:20mn Exi 1 1:0 Exit2:0 Fxit3:l *GPS OK* 07:20:28 N51 a 00.9725 E005Q50.2700 Figure 5. Status acknowledgement by text message looks like this on the mobile's display. 57.6 kilobaud. For the data format of SMS Text messages you require some understanding of the PDU language, which is used on most mobile phones. We tested the circuit with the widely available Siemens models C55 ( + data cable) and S35. Some other mod- els might not work with our remote switch, as inevitably some minor vari- ants occur in control systems. The mobile needs to be equipped with a SIM card, switched on and sub- scribed to a network. Ringtones are best dispensed with and the keypad lock activated. It is important to store the telephone numbers used to initiate the switch operation and send a text not in the mobile’s memory but on the SIM card itself. These telephone num- bers must be entered in the interna- tional notation (not in any other for- mat), as shown in the inset on how to create an SMS text message. Further- more, the telephone numbers must occupy the memory slots on the SIM card in ascending order without any gaps. The first authorised telephone number (to which alarm and status alerts may also be sent as required) is entered in memory slot 1, the next number then in slot 2 and so on. This sequence is not the same as how the numbers are indicated in the mobile’s Phonebook list (probably sorted in ascending numerical order). The mem- ory slots can be checked and amended either as they are being entered or else subsequently — please check in the mobile’s instruction book for details. The mobile is connected using the RS-232 protocol. Older models of phone generally have this interface, although they do need a suitable data cable for linking the system connec- tor on the mobile to the sub-D9 con- nector K6 on the remote switch board. If the data cable requires a supply of volts, this can normally be taken from the sub-D connector (‘vampire feed’) with around 9.5 V on pins 4 and 7 (this will require bridging JP1). Take time to check the connections of the data cable against Figure 1 to ensure it is correct for you. In some cases using this vampire feed for the data cable will overload the MAX232, with the mobile una- ble to ‘talk’ to the remote switch. You can confirm this by applying a reset to pin 14 of IC2; if the signal level does not reach around ± 10 V but hov- ers around ±5 V you have problems. Another indication is if the voltage on pin 2 of IC2 measures less than about 9.5 V. If this is the case you will have to supply volts into the data cable in some other manner. It may also help if you use 10-jl/F electrolytics for capaci- tors C4 to C8. Plenty of solutions can be found on the Web and you may end up making your own data cable. GPS connection Including a GPS module is necessary only if you actually require GPS data in the alarm or status alerts (as in Fig- ures 5 and 6). The module must pro- vide data in NMEA format at 4,800 baud. The data can be handled at either TTL or RS-232 level (around ±12 V). Only the data output (TxD) of the module is used. All these require- ments are met on most modules. The set-up was tested by the author with a GPS-41MLR module and then in the Elektor labs with a Navilock 303R with jumper JP2 set for RS-232 level. The GPS module can be connected using the standard Mini-DIN connector on the Navilock to K7 on the switch or else soldered direct onto the PCB. The necessary power supply of 5 V (check the data sheet of your GPS module to see if it uses 5 V too) can be taken from the PCB, for example on solder pins PI or P2 (ground on pins P3 and P4). If a module using TTL level is con- nected to K7 then jumper JP3 must be set (under no circumstances can both JP2 and JP3 be set at the same time!). If connecting TxD from the mod- ule direct to the PCB, either TTL or RS-232 level can be fed in (but never Figure 6. This shows an SMS alarm report being received, with GPS data included. both simultaneously). The direct con- nection passes through JP2 (for RS- 232 operation) or JP3 (for TTL level), and onwards either JP2 to pin 8 of IC2 (designated ‘RS-232’) or else from JP3 to pin 4 of IC3 (labelled ‘TTL’). In each case the other pin of JP2 or JP3 is then isolated and out of circuit. The heading photo shows the remote switch con- nected to a Siemens mobile and the Navilock-GPS Mouse. The red wire of the data cable is for charging the mobile’s battery ( + 5 V to pin 1 on the mobile connector). ( 080324 - 1 ) Internet Links (Google can translate pages for you) WinAVR: http://sourceforge.net/projects/winavr AT command set for GSM/GPRS telephones: www.communica.se/multitech/gprs_at.pdf Technical specification GSM 03.38: www.mobilecity.cz/doc/GSM_03. 38_5.3-0.pdf Technical data on mobile handset models: www.mikrocontroller.net/articles/Handy (Hersteller = manufacturer, Systemstecker = system connector, Ladespannung = charging voltage, nur = only, Schnittstelle = interface, Besonderheit = special feature). Online PDU Encoder and Decoder: http://twit88. com/home/utility/sms-pdu-encode-decode Online coordinate conversion: www. cache-test-dummies, de/tools/koordinatenumrechnung Author's own project page: www.blafusel.de/misc/mc_gsm.html 11/2008 - elektor 37 AUDIO High-end with remote control design: Frank Link (Germany) Many audio enthusiasts still prefer a good potentiometer for adjusting the audio volume. It would be even nicer if this potentiometer could also be controlled remotely. This is possible with a high-quality motorised potentiometer from Alps and a handful of electronics, as is described here. Controlling the volume in high-quality audio equipment is always a critical part of the audio path. The potentiom- eter that is to be used for this has to be first-rate to give excellent match- ing between the two channels and at the same time it needs to function for a long time without generating any crackling or other noise. These days it is more common that electronic potentiometer-ICs and resistor net- works with relays are used, but these solutions are rather involved. Many audio enthusiasts still swear by a good ‘old-fashioned’ potentiometer. Whenever you start looking for a good specimen you will quickly arrive at the Alps brand. Alps truly make excellent potentiometers, both without and with motor control. The latter is very nice to enable you to conveniently control the volume remotely from your listen- ing position. In this article we present a small circuit that can control such an Alps motorised potentiometer using a standard RC-5 remote control. In addi- tion to turn the volume up or down the circuit also has 5 outputs for switching between different input channels. One 1C Not counting the voltage regulator IC, the entire circuit contains only one IC that takes care of all the operations: an ATmega from Atmel, which is respon- sible for decoding the RC-5 signals and driving the potentiometer (and the optional input relays). Apart from that, there isn’t much to the schematic, shown in Figure 1 , but we will never- theless walk through it. IC1 is the brains in this circuit, an ATmega8L, which is running here at a clock frequency of 4 MHz, thanks to crystal XI. An IR receiver module, type SFH51 10-36, is connected to port PD7. This receives the signals from the RC- 5 remote control, polishes them into ‘clean’ digital pulses and then passes 38 elektor - 11/2008 +5V O JT ^lOOn SFH51 10-36 K4 ry 0 7- 0 CM vcc AVCC — AREF PDO (RXD) PD1 (TXD) PD2 (INTO) IC1 PC6 (RESET) PC5 (ADC5/SCL) PC4 (ADC4/SDA) PC3 (ADC3) PC2 (ADC2) PCI (ADC1) PCO (ADCO) PD3 (inti) ATmega8L-16PU +5VO PD4 (XCK/TO) PBO (ICP) PD5 (T1) CM - PB1 (OC1A) PD6 (AINO) o C/3 (_) C/3 PB2 (SS/OC1B) PD7 (AIN1) O t PB3 (MOSI/OC2) V X _i < _j < PB4 (MISO) X X PB5 (SCK) GND 1 — CQ CL co CQ CL GND CO C5 CD H F CM CM C4 K6 22*pF 4MHzT?2p * T A 28 27 26 25 24 23 14 15 16 17 18 K1 19 +5V Bi-colour 9VDC K5 rV 0 0 9VAC 071135-11 Figure 1. The schematic for the remote volume control. An ATmega8 does all the work here. them on to the controller for further processing. The software has been written so that the processor reacts to RC-5 commands from a remote control from a tuner/amplifier (receiver), RC-5 system 17 (decimal). Port pins PD2 through PD6 are made available externally via connector K3 for switching the pre-amplifier inputs. Driving the motor of the Alps potenti- ometer is done from ports PBO through PB5 and PCO through PC5. Six outputs from each of the ports B and C are con- nected in parallel to provide sufficient drive current for the motor (this also reduces the number of parts). The maximum current through the motor when it is stalled is 150 mA, according the Alps data sheet (100 mA when rotating normally). The absolute maximum current per I/O pin is 40 mA, according to Atmel. So by connecting 6 pins in parallel more than 200 mA can be delivered. To indicate that the motor is turning, a dual-colour LED (Dl) is connected in parallel with the motor. Depending on the direction of rotation the LED will illuminate red or green. The current through the LED is about 10 mA, this is therefore not a problem for the driver stage in the microcontroller. You can make an RS232 connection via K2 (which is connected to PDO and PD1) for debugging or other purposes (however, you will have to write the software routine to do this yourself!). The power supply consists of a bridge rectifier, a 5-V regulator (IC3) and a few capacitors. For the power supply you can use a transformer, a suitable DC voltage already present in the ampli- fier or a mains adapter. Practical matters Figure 2 shows the PCB layout for this circuit. The board is split into two parts, one for the processor section and one for the potentiometer. For the latter, all the connections for the potentiome- ter are implemented as a row of pins. Separate ground connections have also been added in case you would like to add additional screening (K7/K8, for each channel separately). There is also a separate connection for the screen of the motor section, implemented as a separate PCB pin. For the motorised potentiometer we assumed the version with the connec- tions directly on the motor part (solder eyelets). On the PCB, next to the motor, are two PCB pins to which the motor can be connected with two short wires. Next to that is the actual connection for the motor (K9), which receives the drive signal from the microcontroller on the controller PCB (Kl). Indicator LED Dl is connected next to K9 to a pair of connections. The LED can optionally be connected with two wires if it is to be mounted behind a front panel. On the controller PCB, K5 is the con- nection for the power supply voltage. The regulated 5 V is also made avail- able (K6) as an extra. The five signals for driving, for example input relays of a preamplifier, are available at con- nector K3. For this purpose the con- troller decodes buttons 1 through 5 and channel/program up/down (com- mands 32 and 33 decimal, respec- tively), so that you can either select an input directly or sequentially step through the inputs in either direction. To make things easy, pins 1 through 5 of K3 correspond to buttons 1 through 5 of the remote control. The connections for the IR receiver (IC2) that is used here, is via a 3-way row of connections. So you can either 11/2008 - elektor 39 AUDIO Figure 2. The circuit is built on two printed circuit boards, one for the electronics and one for the potentiometer. elect to fit IC2 directly on the PCB or connect it with a short length of cable to a connector (but make sure you get the polarity correct!). Software The firmware for this circuit is built up in modules. The source code for the various hardware parts can be found in separate files. So, for exam- ple, motor. c contains the various func- tions for switching the motor on and off. In buttons.c are all the definitions and functions for the RC-5 codes from the remote control. The design of the program is quite sim- ple. An interrupt routine takes care of receiving the RC-5 bits. This routine also checks whether the received code conforms to the RC-5 standard. If this is the case, then the received code is stored so that it can be used for fur- Code-tangle Not everyone will have a remote control from a Philips receiver or tu- ner (or another brand that uses RC-5) handily available to use for this application. Fortunately there are cheap alternatives in the form of a pre-programmed universal remote control. The author had a closer look at a type 'EuroSky 8' which is sold by Conrad, among others, for about 14 Euro (they call it a 'Universal Remote Control MF-8 Black'). This seems to work well with most devices, although the range could have been a little greater. However, it turned out that the RC-5 system address 1 7 (dec.), which can be programmed for device AMP (enter code 1 1 1 2 on the remote control) did not work entirely according to the standard. The volume buttons, channel buttons and stand-by button proved to work correctly. These are very important for us, but the operation of the other functions of an audio device requires the number buttons. Unfortunately the code that is transmitted for these buttons is a complete surprise. While we expected code 1 for button 1 , code 2 for button 2, etc. something completely different was trans- mitted instead (see the following table). Button EuroSky 8 (AMR code 1112) RC5 (Tuner) Address (hex.) Command Address (hex.) Command 1 11 3F 11 01 2 OC 3F 11 02 3 17 3F 11 03 4 12 3F 11 04 5 05 3F 11 05 The author noticed this too and he adapted the software in the con- troller accordingly. However, this results in problems when we use a remote control which does transmit the correct codes. This is why the Elektor lab has modified the controller software in such a way that it only reacts to the correct commands of system address 1 7. For the tests we used a universal remote control from Philips (type SBC RU 865, code 0001 for TUNER). Using this, the circuit works as expected; other universal remote controls should also work well with this circuit. To check whether a remote control transmits the correct codes, you can use the circuit from the Elektor October 2001 issue (IR Code Ana- lyser, article number 01 0029). If you would like to make your own simple remote control (without microcontroller) you can have a look whether an SAA3010, PT221 1 or HT6230 can be obtained from so- mewhere. One example for such a circuit is in the December 2003 issue (Small RC5 Transmitter, article number 024034). 40 elektor - 11/2008 ther processing by the main program. If the code is incorrect the value ‘0’ is stored. This causes the main program to ignore this code. After the initialisation of the vari- ous peripherals comes the main pro- gram loop of the firmware. This loop is repeated indefinitely. Once a valid RC-5 code has been received it is split into device code, key code and the toggle bit. The software subsequently checks, based on a table stored in EEPROM, whether an RC-5 code has been received that is relevant to this circuit. By the way, these codes can be freely selected. For this you need to change the table in buttons. c and recompile the firmware and program the control- ler again. For the latter you will need AVR-Studio or WinAVR. When the received code matches one of the codes in the EEPROM, the micro- controller will execute the correspond- ing command. The software contains also a second COMPONENTS LIST Resistors R1,R3 = lOkQ R2 = 82Q R4 = 390Q PI = Alps 1 0kf2 logarithmic stereo motor potentiometer (e.g. RK271 1 2MC) Capacitors 01,07,08 = lOOnF ceramic, lead pitch 5mm 02, 06 = 1 OyL/F 63V, radial, lead pitch 2.5mm 03 = lOOpF, lead pitch 5mm 04, 05 = 22pF, lead pitch 5mm 09 = 220jL/F 25 V radial, lead pitch 2.5mm C10-C13 = 22nF ceramic, lead pitch 5mm Semiconductors D1 = 2-pin dual-LED IC1 = ATMEGA8-1 6PU, programmed, Elektor SHOP # 071 135-41 IC2 = SFH51 1 0-36 (possibly via 3-way SIL pinheader) IC3 = 7805 Miscellaneous B1 = B80C1500 (80Vpiv, 1.5A) (round case) K1 ,K6,K9 = 2-way SIL pinheader K2,K7,K8 = 4- way SIL pinheader K3 = 7- way SIL pinheader K4,K5 = 2-way PCB screw terminal block, lead pitch 5mm XI = 4MHz quartz crystal PCB, ref. 071 135-1 from www.thepcbshop. com Controller software: free download 071 135-1 1 .zip from www.elektor.com operating mode, where the fifth out- put is replaced with an on/off function (standby, command 12 decimal). ( 071135 - 1 ) Advertisement Professional PCB Supplier URL: WWW.EzPCS.€Otn Email: &ale$@ ezpdb.com Tel: +86 139 1002 1704 HOi up To 50 Layers. 2.J5mll JtC. 0 tmm Hole Size 01 h ei Producls Stencils, Keypads. Frontpanelg, FlfixPCR, Fnclttsurfis,, Tnrnkfiy Services 11/2008 - elektor 41 PROJECTS MICROCONTROLLERS Monitoring infrared sources with the Mega88 102 I* .%» V ■ I Udo Jiirsz and Wolfgang Rudolph (Germany) In this instalment, we add a miniature infrared camera with integrated image processing capability to the ATM1 8 system. This makes it possible to identify the positions of up to four infrared sources, display the positions on a monitor, and output their coordinates. Assembling a high-tech camera system of this sort is certainly affordable if you take advantage of mass-produced high-tech toys. When you hear the term ‘hot spot’, you probably think of a wireless Internet access point, but this term also has other meanings. In a nuclear power plant it means a tiny, highly radioac- tive particle; in a database it means a data element; and in geology it means a centre of volcanic activity. However, the hot spots we are have in mind here are literally hot locations. Anything that is hot emits infrared radiation. There are three generally rec- ognised classes of infrared radiation: • IR-A covers the range from 0.78 /dm to 1.4 jL/m; • IR-B covers the range from 1.4 pm to 3 pm; • IR-C covers the range from 3 pm to 1 pm. The terms ‘thermal radiation’ and ‘infrared radiation’ are often confused with each other. Thermal radiation is the electromagnetic radiation emit- ted by a body as a function of its tem- perature. Infrared radiation occupies 42 elektor - 11/2008 Figure 1. The Nintendo Wii remote control unit. Figure 2. These screws in the battery compartment must be removed. only a small portion of the total ther- mal radiation spectrum. For the pur- poses of the present project, the IR-A range is especially interesting because we intend to use a tiny camera that is fitted with an optical filter so it can only see light in the range of 850 nm to 920 nm, and which has integrated sig- nal processing circuitry Such a compo- nent can provide the basis for innumer- able applications, such as a fire alarm, an intrusion alarm, an object tracker, a gesture-controlled input device, an instrument for measuring the speed of objects, and much more. But how can you get your hands on this sort of high- tech camera? Interesting sensors By the end of 2007, Nintendo had already sold more than 15 million Wii game consoles. As a result, the asso- ciated remote game controller (Wii Remote), often referred to as ‘Wii- mote’ (Figure 1), has become a very widely used computer input device [1]. Among other things, it includes an infrared camera with a resolu- tion of 1024 x 768 pixels and built-in hardware blob tracking for up to four objects at the same time. This CMOS camera sensor, which is made by Pix- Art Technologies [2], is in a different league than your average PC -compat- ible webcam. The Wiimote also con- tains a three-axis acceleration sensor (Analog Devices ADX330 [3]) with a resolution of 8 bits and a measuring range of ± 3 g. The remote control unit is a fascinating piece of technology, and on top of this it is quite inexpen- sive. You can pick one up from various dealers or online auctions for less than £ 20 (€ 25) or at least you could before this article was published! Before you can start properly disman- tling the unit, you have to expose the goodies. Start by removing the two tri- wing screws in the battery compart- ment (Figure 2). This type of screw head is sometimes called ‘Y-shaped’, or you may encounter it under its inter- national designation: POO-WC45. You can purchase a suitable screwdriver at your local home improvement shop, or you can buy a full set of bits at a dis- count supermarket. In the Elektor lab, we discovered that an ordinary cheap screwdriver with a shaft diameter of around 2 mm can also do the job if you file the edges off slightly. The first two screws are easy to remove, but the two lower screws, which are recessed, are more difficult. Figure 3. PCB ahoy! Figure 4. Camera sensor and IR filter. 11/2008 - elektor 43 MICROCONTROLLERS Figure 5. Desoldering the pins is not difficult. Figure 6. The solder tabs of the sheet-metal screen are a bit more stubborn. Here it helps to enlarge the holes first with a drill in order to provide bet- ter access. You can use a flat-blade screwdriver to release the two plastic locks at the upper end of the remote control, after which the case is open (Figure 3). After you tip the board out of the case, you will see the infrared sensor at the upper end on the bottom of the board (Figure 4). The case of the remote con- trol unit has a filter insert that screens the sensor against visible light. With the filter, the maximum sensitiv- ity lies in the range of approximately 850-920 nm. With a bit of caution and careful work, you can unsolder the sensor undamaged. For this purpose, the authors sawed off the end of the PCB before unsoldering the sensor. In the Elektor lab we man- aged without sawing the board in two, as you can see from the photos. As the Wii PCB is assembled using lead-free solder, you should first apply ‘normal’ (lead-based) solder to all of the sensor pins and screen tabs before you start desoldering. Don’t be too stingy with the solder, but on the other hand don’t ‘bake’ the solder joints, as otherwise you may overheat the sensor. After all the pins have been properly treated with solder, you can begin des- oldering. Start by using a solder sucker or solder braid to remove the solder from all of the sensor’s solder joints. The eight signal and power pins can be freed completely in this way. Now the sensor is only held in place by the two solder tabs of its sheet-metal screen (Figure 5). They can also be desoldered. While heating the solder joint, use a screwdriver to cautiously lever up the sensor on the component side (Figure 6). Then repeat this proc- ess with the tab on the other side. With a few back-and-forth repetitions, you can quickly pull the sensor free from the board (Figure 7). The screen (sheet metal enclosure) of the sensor must be left in place, as otherwise it will quickly and permanently turn into ‘dead silicon’. If you leave the rest of the remote con- trol board undamaged when removing the sensor, the remainder of the cir- cuitry will still function normally. What you have left over then is an interest- ing Bluetooth device with an accelera- tion sensor, for which you can probably think of some useful applications. PCB In order to use the IR camera sensor with the ATM18 board, you need a bit of simple circuitry (Figure 8), which can be built on a small PCB (Figure 9). A 25-MHz crystal oscillator (CGI) pro- vides the sensor clock signal (CLK). The crystal oscillator can be powered directly from the +5-V supply voltage of the ATM 18 board via PCB connector K2 (with the voltage decoupled by Cl), but the camera sensor (IR1) requires an Figure 7. The unsoldered camera sensor. Figure 8. The circuit for connecting the camera sensor. 44 elektor - 11/2008 operating voltage of approximately 3.3 V. This is obtained by wiring two sili- con diodes in series (D1 and D2, type 1N4148) to reduce the +5-V level on Cl to around 3.3-3. 5 V on C2. The obliga- tory pull-up resistors for the I 2 C bus are also located on the PCB. Here this bus operates with 3.3-V signal levels. This is compatible with the 5-V operating volt- age of the Mega88 because the active signal level on the bus lines is obtained by pulling them to ground, while the high level is obtained by switching the output pins to the high-impedance state. The 3.3-V level is far enough above the switching threshold voltage the pins as Ground (two pins), +3.3 V, SCL, SDA, and three other unknown signals. Two of them were quickly identified as the clock input and the Reset signal. The function of the third pin remained unclear. Naturally, after all this research a colleague sent us the address of the website at http://kako. com/neta/2007-001/2007-001.html, which describes the pin assignment of the sensor (Figure 10). That’s how it goes - but at least this information matched our findings. The rest was just a matter of routine effort. After we built a prototype, the ATM18-12C tester (our next project - stay tuned!) I 2 C The nature of the l 2 C bus and how to use will be described in future instalments of the ATM1 8 series of articles. Here we only want to briefly note that the l 2 C bus is a serial data transmission bus consisting of two lines: SDA (data) and SCL (clock). Data can be transmit- ted in both directions: from the microcontroller to the peripheral devices, and from the pe- ripheral devices to the microcontroller. Several devices can be controlled via the bus. For this purpose, each l 2 C-device has an address that is sent when a link is established. (2.5 V) for reliable data transfer. The optical sensor from the Wiimote is a ‘system on chip’ (SOC) device designed by PixArt as an application- specific IC for tracking multiple objects (‘multi-object tracking sensor’) that includes an integrated signal proc- essor in addition to the CMOS image sensor. The signal processor con- stantly searches for the brightest spots and determines their coordinates. Up to four bright objects (‘blobs’) can be recognised and tracked concurrently. The sensor is also sensitive to visible light if the filter is not used, but this capability is not used here. Communication The I 2 C interface makes communica- tion between the sensor and the micro- controller relatively easy. The camera generates an (X,Y) coordinate set for each blob within its field of view of 1024 x 768 pixels and sends this data via the interface for further process- ing. The only question now is how this works, because Nintendo is totally silent on this subject. We started by using a logic analyser to record the data traffic between the master and slave devices on the I 2 C bus. After around two hours, we had a clear understanding of how the module is initialised and how to read the data from it. We identified the signals on once again proved its worth in the first functional tests. The slave address of the Wiimote IR sensors is OxBO. Software The source code of the software in C (Code Vision AVR) and Basic (Bas- com AVR) is available on the Elektor website. The C project ATM18_Wii_ Remote _IR_Sensor demonstrates the use of the sensor with the ATM18. It utilises the internal I 2 C unit of the Mega88, which means that the pin assignments are fixed: the data line (SDA) is on PC4, while the clock line (SCL) is on PC5. Two additional lines must be connected for the supply volt- age. If the LCD module is connected, it will display the blob coordinates detected by the sensor. The ATM 18 also outputs the blob posi- tions in the form of four pairs of values (X,Y) on the US ART interface, with the format ‘X1,Y1,X2,Y2,X3,Y3,X4,Y4’ This string is output repeatedly. The value of X can range from 0 to 1023, while the value of Y can range from 0 to 767. If X = 1023 and Y = 1023, this means that the associated blob is not active. The program ‘Wii-Blob-Track’, which is also available on the Elektor website, Figure 9. PCB for using the sensor with the ATIVI18. COMPONENTS LIST Resistors R1,R2 = 2kD2 R3 = 22kD Capacitors Cl ,C2 = 10/+ 25V C3 = lOOnF Semiconductors Dl, D2 = 1N4148 CGI = 25MHz oscillator module IR1 = Wii Infrared imaqe sensor (see text) Miscellaneous K1 , K2 = 2-way SIL header PCB, order code 080358-1 from Elektor SHOP Free artwork download from www.elektor.com Figure 10. Lab prototype of the PCB with the camera sensor. Figure 11. Sensor pin assignment: Pin 1 = V cc (+3.3V) Pins 2 and 3 = GND (ground) Pin 4 = not used Pin 5 = SCL (l 2 C) Pin 6 = SDA (l 2 C) Pin 7 = CLK (25 MHz) Pin 8 = Reset 11/2008 - elektor 45 MICROCONTROLLERS +5V GND DATA CLK LCD 20x4 □□□□□ □□□□□ □□□□□ □□□□□ 080358 - 13 Figure 12. Connecting the sensor and LCD board to the ATJV11 8 board. Here the LCD is connected to PD5 (clock) and PD6 (data). can be run on a PC under Windows to display the recognised hot spot posi- tions. This program receives the X,Y coordinates from the ATM 18 board and converts them into graphic form. Any- one who has ever tried to determine the position of an object from a camera image can appreciate the clever sim- plicity of this Wiimote-based solution, and especially its excellent cost/per- formance ratio. You can test the operation of the unit by wandering around the room with a lit cigarette lighter in your hand while someone logs your travels, or you can fit an IR LED and battery on the back of your pet cat and observe the move- ments of your experimental feline sub- ject in full darkness. Bascom example As usual, we also developed a Bascom application program that provides func- tions similar to the basic functions of the C program. We also wrote a specific property monitoring application for use with the sample Bascom program. Unlike the C program, the Bascom pro- gram does not use the hardware I 2 C interface, but instead creates an equiv- alent function in software. This means that you can use any desired set of pins for the I 2 C bus. In our case, we use the same pins as for the C program. The microcontroller sends several bytes to the sensor for initialisation. After this, date is read out at regular intervals in sets of 16 bytes. Each blob requires three bytes. As each coordi- Listing Sensor data processing with Bascom ' ATM18 CCD sensor ' I2C : SCL = PC5, SDA = PC4 $regfile = "m88def.dat" $crystal = 16000000 Baud = 38400 Dim Slave As Byte Dim Slaverd As Byte Dim D1 As Byte Dim D2 As Byte Dim Din (16) As Byte Dim N As Byte Dim XI As Word Dim Y1 As Word Dim X2 As Word Dim Y2 As Word Dim X3 As Word Dim Y3 As Word Dim X4 As Word Dim Y4 As Word Dim Xyl As Integer Dim Xy2 As Integer Dim Xy3 As Integer Declare Sub Send2bytes Declare Sub Sensorinit Declare Sub Readsensor Declare Sub Convertdata Config Portb = Output Config Scl = Porte. 5 Config Sda = Porte. 4 I2cinit Config I2cdelay = 15 ' I2C sensor address Slave = &HB0 Slaverd = &HB1 Print "ATM 18 I2C_Wii_IR_Sensor" Sensorinit Do Readsensor Convertdata Print "PI \\ + Str (xl) + ", " + Str (yl) Print "P2 \\ + Str (x2) + ", " + Str (y2) Print "P3 w + Str (x3 ) + ", " + Str (y3 ) Print "P4 \\ + Str (x4) + ", " + Str (y4 ) Xyl = XI + ‘ Y1 Xyl = Xyl + X2 Xyl = Xyl + Y2 Xyl = Xyl + X3 Xyl = Xyl + Y3 Xyl = Xyl + X4 Xyl = Xyl + Y4 Print Xyl Xy3 = Xy2 - Xyl Xy2 = Xyl Xy3 = Abs (xy3 ) If Xy3 >10 Then Print "**********" Portb .0=1 Else Portb .0=0 End If 46 elektor - 11/2008 Figure 13. Coordinate processing by the PC program. Up to four 'blobs' can be shown concurrently. nate is a 10-bit value, the eight lower- order bits of each value are transmit- ted in one byte, while the two higher- order bits of the X and Y coordinates are stuffed into the third byte. After all the bits have been rearranged prop- erly, you have four sets of (X,Y) coor- dinates. They are transmitted via the serial interface to a terminal emulator program at a speed of 38,400 baud. ATM 18 I2C_Wii_IR_Sensor PI 66, 67 P2 813, 228 P3 774, 332 P4 722, 113 The ATM18 project at Computenclub 2 ATM18 is a joint project of Elektor and Computenclub 2 ( www.cczwei.de ) in collaboration with Udo Jursz, the editor in chief of www.microdrones.de. The latest developments and applications of the ATM1 8 are presented by Computenclub 2 member Wolfgang Rudolph in the CC 2 -tv programme broadcast on the German NRW-TV channel. The ATM1 8-AVR board with the IR camera was described in Instalment 23 of CC 2 -tv, which was broad- cast on 1 8 September 2008. CC 2 -tv is broadcast live by NRW-TV via the cable television network in North Rhine-Westphalia and as a LiveStream programme via the Internet ( www.nrw.tv/home/cc2 ). CC 2 -tvis also available as a podcast from www.cczwei.de and - a few days later - from sevenlood.de. The program constantly monitors the ‘bright spots’ to see whether they change. If they do, an alarm signal is output on PBO, and it can be used to drive the ULN2003. This could be con- nected to a siren, a fire extinguisher, or some sort of pyrotechnical system. If you want to protect your art collection, for instance, all you need is four infra- red LEDs that are constantly observed by the sensor. A checksum is formed from the set of eight coordinates. If it changes from the value of the previ- ous measurement by more than 10, an alarm is generated. This can happen if, for example, a thief passes through one of the invisible infrared beams or uses a fishing rod to drop a line through a skylight and snag one of your Picassos that is protected by the IR system. Now that we’ve laid the groundwork, we look forward with considerable anticipation to applications developed by Elektor readers. ( 080358 - 1 ) Internet Links [1 ] http://en.wikipedia.org/wiki/Wii_Remote [2] www.pixart.com.tw [3] www.analog.com/en/mems-and-sensors/ imems-accelerometers/adxl330/products/ product.html Waitms 200 Loop Waitms 30 End Sub Sub Send2bytes I2cstart I2cwbyte Slave I2cwbyte D1 I2cwbyte D2 I2cstop End Sub Sub Sensorinit D1 = &H3 0 D2 = &H0 1 D1 = &H3 0 D2 = &H0 8 D1 = &H0 6 D2 = &H9 0 D1 = &H0 8 D2 = &HC0 D1 = &H1A D2 = &H4 0 D1 = &H3 3 D2 = &H3 3 Waitms 100 End Sub Send2bytes : Waitms 10 Send2bytes : Waitms 10 Send2bytes : Waitms 10 Send2bytes : Waitms 10 Send2bytes : Waitms 10 Send2bytes : Waitms 10 Sub Readsensor I2cstart I2cwbyte Slave D1 = &H3 6 I2cwbyte D1 I2cstop Waitms 1 I2cstart I2cwbyte Slaverd For N = 1 To 15 I2crbyte Din(n) , Ack Next N I2crbyte Din (16) , Nack I2cstop Sub Convertdata XI = Din (4) And &H30 XI — XI * 16 XI = XI + Din (2 ) Y1 = Din (4) And &HC0 Y1 — Y1 * 4 Y1 = Y1 + Din ( 3 ) X2 — Din (7) And &H30 X2 = X2 * 16 X2 = X2 + Din ( 5 ) Y2 = Din (7) And &HC0 Y2 = Y2 * 4 Y2 = Y2 + Din (6) X3 — Din (10) And &H3 0 X3 = X3 * 16 X3 — X3 + Din ( 8 ) Y3 = Din (10) And &HC0 Y3 = Y3 * 4 Y3 = Y3 + Din ( 9 ) X4 — Din (13) And &H3 0 X4 = X4 * 16 X4 = X4 + Din ( 11 ) Y4 = Din (13) And &HC0 Y4 — Y4 * 4 Y4 — Y4 + Din ( 12 ) End Sub End 11/2008 - elektor 47 ELECTRIC BICYCLE REVIEW Lazy on the 'DIY' e-bike Thijs Beckers (Elektor Netherlands) We wouldn't be Elektor if we didn't do a little experimenting with e-bikes, which have become popular in recent times. But an off the shelf contraption is not nearly as much fun as one which we have to build ourselves. So, on the look-out for DIY kits. And where would you find one of those? Exactly: eBay! Electronics is still hot! Witness the Segway and the ever increasingly frequent appearance on the street of bicycles with an auxiliary electric motor. A Segway may be a bit difficult to build yourself, but changing a wheel (because it is hardly more than that) is not really a big deal for most people. So, get started with the DIY electric bike kit! Dear bought and far fetched... ...are dainty for ladies, at least that is how the saying goes. The kit that we ordered for this review is manufactured in China. It is a package containing a motor driver/controller circuit, a set of handbrakes with switch, an accelerator han- dle, a pedal sensor and a wheel with built-in motor. The package finally arrived at our lab via a German importer, where, after having travelled half-way around the world it is mounted on a second-hand bicycle that was hurriedly acquired from somewhere for this purpose. The wheel, with regards to its diameter (24 inch), is not quite right for this bike, but that won't spoil the fun. Technology From the three power cables that leave the controller box and go to the motor we concluded that we are dealing with a brushless motor. Although the XLR plug for the connec- tion to the batteries is of reasonable quality, the plugs that connect to the motor are unfortunately not the best quality. There is a not inconsiderable chance that these will burn out after a while... Inside the controller enclosure we find an ATmega48Vl 0, an 8-bit AVR microcontroller with 8 k of in-system-prog ram- mable Flash ROM. There is a strong indication the header on the board is suitable for 'updating' (dare we say hack- ing?) of the controller. There are also six substantial, N-channel MOSFETs from STMicroelectronics, type P75NF75, which are rated for as much as 80 amps. The enclosure is made from one piece of extruded alumin- ium and has a cover at both ends. The power MOSFETs are clamped, with electrical isolation, against one side of the enclosure so that they can dissipate their heat. During our The kit contains a wheel with built-in motor, two handles with built-in switch, a sensor for the movement of the pedals, an accelerator handle and a controller. 48 elektor - 11/2008 test rides, for which we put the circuit and batteries in pan- niers to keep things simple, the controller enclosure became quite warm. This is therefore not appropriate as a perma- nent solution and it would be much better if the controller was exposed to the passing air. We do however question the water-proofing of the enclosure. The connectors aren't really suited for our damp climate either. This could easily become a problem. Via the phone number on the PCB, we have been able to trace the manufacturer: the Chinese company Jiaxing City. There is a strong suspicion that the circuit has not been extensively tested for use in the EU, evidenced by the absence of RoHS, CE and other approval marks. The wheel comes from the company Nine Continent in Wen- ling, China and does conform to the RoHS standard. Practice The first problem we encountered was that the wheel was too wide. Carefully)!) we spread the front fork a little so we could fit the wheel in it. And of course, the motor initially turned the wrong way, so take note which way around the wheel is supposed to be fitted, before you fasten all the cables in place. The wheel turns with more friction than what we are used to with a normal wheel. When buying the tyre we had to pay close attention. 24 inch is apparently not always 24 inch... These come in different sizes so it is best if you bring the wheel with you. Mounting the accelerator handle was rea- sonably straightforward. The size of the tubing for the han- dlebars in China is apparently the same as in Europe. Once the wheel and the accelerator handle were fitted, and the controller circuit and batteries in the pannier, it was time for a test ride (see photos). The handbrake and pedal sensor should also have been connected (see EU regulations inset), but the motor also works without them. The handbrake contains a switch which turns the motor off the moment you start to brake. An additional 'advantage' of not installing the pedal sensor is that the accelerator handle always works. So you do not need to pedal for the motor to turn on. Note that it is therefore not legal to ride on the road this way. 11/2008 - elektor 49 ELECTRIC BICYCLE REVIEW The DIY e-bicycle in action The advantage of an electric motor over a combustion engine is emphasised once again: an electric motor pro- vides immediate torque, while simple combustion engines first has to get up to speed. The bike soon moved too fast for laps through our lab, so we moved the test outdoors. Even though the batteries were brand new and really should have been 'conditioned' a little, they nevertheless gave very little trouble. The motor was very capable of propelling the test bicycle to a speed of about 25 kilometres per hour, without doing any pedalling at all. We should now try it without the limiter... Unfortunately our dilapidated mountain bike was not trans- formed into a barely controllable speed demon, but it did go a little faster nonetheless. We got up to about 30 kilo- metres per hour, provided there is no wind. The torque of the motor remains the same, so you won't go faster up a steeper hill compared with the limiter enabled. The other thing we noticed is that once the 30 km/h mark was reached, additional pedalling (to help the motor a little) was pointless. That means, the kilometres in excess of 30 you have to do all yourself. This is nevertheless not a poor performance from a standard bicycle, considering that you do not require a permit, insurance or whatever (at least in The Netherlands), although third-party insurance is recom- mended, because accidents will happen. We couldn't find any problems with the front-wheel driven bike. The bike behaves like normal in all other respects. A few hints for the batteries. For the application in electric bicycles it is best to use batteries with fast charge and dis- charge curves. The company Huijzer Components recom- mended us to use the EVZ series made by CSB. The bat- teries are connected in series to obtain the required 36 V. Note: although this voltage is not lethal, the current that the batteries can supply can be used to weld! For those among you who are considering obtaining such a kit directly from China: take into account the shipping and import costs. These will likely increase the price by 30 percent, if not more (depending on the shipping costs). In conclusion we can state that such a kit for about € 200 is a nice 'upgrade' for a bicycle, although the mounting of the control circuit and the batteries will require a bit of thought. ( 071128 - 1 ) Our thanks go to Huijzer Components (www.huijzer.com) for making the batteries available. Internet Links www.recumbents.com/wisil/e-bent/default.htm http://zeept.wordpress.com/ www.elektrischefiets.be/index.html http://www.electric-bikes.com/bikes/legal.html, http:// en.wikipedia.org/wiki/Electric_bicycle_laws EU regulations Within the European Union bicycles may be fitted with an auxiliary electric motor. This is subject to the following requirements: - the electric motor may not propel the vehicle on its own but only assist the pedalling motion - the maximum power of the motor may not exceed 0.25 kW. - at a speed of more than 25 km/h the electric motor may not provide any additional power. The compact controller PCB already comes with a header that can be used to re-program the controller. 50 elektor - 11/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. 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 9 ! 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 uasarEImztronics L cor n J™ Se cure Online O rdering Facilit ies • Full Proc Juct Listing, D escriptions & Photos • Kit [ Jocumentatior i & Software C downloads MICROCONTROLLERS ATmega meets Vinculum Recording data values with a USB stick Burkhard Kainka (Germany) When it comes to matters of memory, microcontrollers tend to be rather poorly endowed. An external USB memory stick is the ideal remedy, offering straightforward data transfer to your PC. Now if bonding the memory stick to a micro was somewhat problematic until recently, it's now totally stress-free with the Vinculum chip from FTDI! The Vinculum chip has been devel- oped by the FTDI company for adding not merely an uncluttered USB inter- face but full USB host functionality to all conceivable embedded applications [1]. Boards and devices equipped in this way can be enhanced further, for example with a USB memory stick or ‘thumb drive’. The ‘Vinculum’ controls the FAT file system and relieves devel- opers of a significant amount of devel- opment work. Experi menter-f riend ly The name ‘Vinculum’ comes from the Latin and has the meaning of bond, fet- ter, tie or leash. In that same spirit we can use this chip to attach a USB stick to a small 8-bit microcontroller with- out any problems at all. In this way an Atmel ATmega88 can now enjoy sev- eral Gigabytes of external memory. For developing applications of this kind the VDIP1 module [2] is well suited, as all connections from the Vinculum can be taken to a DIP connector (see head- ing photo and Figure 1). You can also carry out initial tests on a breadboard or stripboard (a.k.a. Veroboard, Vector A.D6 AD? AGO AC1 AC2 GND AC3 AC4 ACS RS# P6S 3V3 ADS AD4 ADS AD2 ADI GMD ADO U1M U1P LD2 LD1 5V0 Figure 1. Connections of VDIP1 (Source: Data sheet [2]). Figure 2. First tests with a USB-serial adapter. 52 elektor - 11/2008 Board, perfboard) if you wish. The main connections are set out in Table 1. The chip handles a number of serial and parallel operating modes, which are selected using J3 and J4. In our application we need to use the serial interface of the Vinculum, so we must plug J3 and J4 up to Vcc (pins 13/14). Signals are processed at TTL level, meaning that the microcontroller can be operated without the need for a separate interface adapter module. For a first test we need to talk to Vin- culum using a PC terminal program Terminal.exe [3]. Since most computers are no longer equipped with a serial interface, a USB-to-serial adapter is used, for example in the form of the DIP module UM232R (as shown in Fig- ure 2). An equally good solution is the Table 1. Vital Vinculum connections Pin 1 : VCC to +5V Pin 6: AD2 data output TXD Pin 7: GND to ground Pin 8: ADI data input RXD Pin 10: AD4 Handshake line CTS, to GND USB -Serial cable supplied by Elektor [4]. The VDIP1 module needs to be fed with a 5 V supply. Internally it is in fact looking for only 3.3 V but it is fully 5 V-tolerant, meaning that it can later be hooked up without modification to a microcontroller running on 5 V. Before we go any further, here’s a vital warning: always remember to remove the USB memory stick before you switch off the Vinculum module. Painful experience indicates that total memory loss may occur otherwise (maybe you need to put some mark- ing on the stick to remind you). As soon as you then connect the stick to a PC, the latter will then attempt to reformat it... Terminal test Vinculum recognises two command sets. The Extended Command Set is provided for text-based operations, whilst there are also byte commands (the Short Command Set) that can be used with microcontrollers, for exam- ple. At switch-on the text mode is always selected. You can test out both modes using the Terminal.exe pro- gram very conveniently, as it’s easy to switch between byte communication and text. Open the Terminal with the settings ‘9600:N,8,1’ (see Figure 3). Do not con- nect a USB stick at this stage. Now type DIR (it’s immaterial whether you use small letters or capi- tals as they are all treated the same). Vinculum then reports that no data medium has been detected. Now plug in a USB memory stick and ‘Vinculum’ proudly announces: Device Detected P2 No Upgrade D:\> For a second time type DIR < Enter >, and the directory of contents appears. Just as in DOS, only short filenames are supported in Format 8:3. Long filenames are displayed in an abbrevi- ated format. KAPl DIR SDR DIR TEXT . TXT D:\> A text file with the content “Hello ” is indicated as follows: RD TEXT . TXT Hello D: \> As you would expect, the use of subdi- rectories is equally simple. Not quite so straightforward is enter- ing data in a file. The key commands are Open, Write and Close: OPW file WRF dword data CLF file When writing data you must indicate the number of bytes to be stored accu- rately. The total is entered as a 32-bit figure (dword). If the file is still open you can repeat the WRF operation if you wish to enter data in blocks. An example is given in our BASCOM application below. A faster means of entering data is achieved by switching to the Short Figure 3. Communication with the Vinculum using TerminaLexe. 11/2008 - elektor 53 MICROCONTROLLERS Extended Command Set Short Command Set (Hexadecimal Codes) Function DIR 4 - 1 0J 00 List files in current directory DIR’ file*- 1 01 20 file 00 List specified file and size CD- fi le- 1 02 20 file OD Change current directory CD* . . *-* 02 20 2E 2E 0D Move up one directory level RD * fi it?— 1 04 20 file 0D Reads a whole file OLD -file- 1 Ob 20 file OD Delete subdirectory from current directory MKD* fi le- 1 06 20 file 0D Make a new subdirectory in the current directory MKD • fi It- 'dater : me*- 1 06 20 file 20 date time 0D Make a new subdirectory in the current directory Also specify a file date and time DLF* file- 1 07 20 file 0D Delete a file WRF • dword- 1 dare 00 20 dword OD data Write the number of bytes specified in the 1 parameter to the currently open file OPW • f i lo— 1 09 20 file 0D Open a file for writing or create a new file OPW ’file* aid tet i me— 1 09 20 file 20 date time 0D Open a file for writing or create a new file Also specify a file date and time CLF* file- 1 0A 20 file OD Close the currently open file RDF * dw ord— 1 08 20 dvord 00 Read the number of bytes specified in the V parameter from the currently open file PEN' file- fi le- 1 0C 20 file 20 fi 1 e 0D Rename a file or directory OPR* tile- 1 OF. 20 file 0D Open a file for reading OPR * file -date- 1 OF 20 file 20 dace 0D Open a file for reading Also specify a file access date SEK * dword- 1 20 20 dwotd 0 d Seek to the byte position specified by the I 5 ' parameter in the currently open file FS- 1 12 OD Returns the free space available on disk if less than 4GB is free FSE 4-1 93 OD Returns the free space available on disk IDD 4 - 1 OF UD Display information about the disk if disk is less than 4GB Figure 4. The most important file commands (Source: Firmware manual [5]). Command Set (SCS): SCS Vinculum responds in like manner in small Bytes (for example 13 corre- sponds to CR): 62 13 To return to Extended Command Mode you use the command ECS. Other com- mands can be found in the Vinculum Firmware User Manual [5], as seen in Figure 4. Firmware update It’s always a good idea to use the lat- est version of the firmware. On the Vinculum download page [6] you can always find the most recent ‘VDAP’ firmware file (as we went to press this was ftrfb_main_03_65VDAPF.ftd). Loading the new firmware is easy with the USB memory stick. Copy it to the root directory of the medium and rename it as ‘ftrfb.ftd’ [7]. When you connect the stick the follow- ing reports appear: Device Detected P2 Found It Change MAIN Reflasher Active Rebooting Ver 03.65VDAPF On-Line: Device Detected P2 No Upgrade D: \> Vinculum and ATmega in harmony That’s enough playing around; now it’s time for an actual application. A microcontroller, an ATmega88 in this case (for instance on the Elektor ATM18-AVR Board), is connected via its RXD (PDO) and TXD (PD1) lines to the VDIP1. These need to be cross- connected, i.e. TXD to RXD and RXD to TXD (see Figure 5). The microcontroller should read the file ‘ToDo.txt’ in order to capture the data included as instructions for measure- ment and to write the test data into a second file ‘Log.txt’. The measure- ment system is an installation that has already been set up somewhere. The user edits a command file on the PC and saves this onto the USB stick. Then he plugs the stick into the micro- controller system and lets the meas- urement operations take place. At the appointed time the stick is removed along with the data collected. These measurements are then evaluated on the PC. This is how the Command File is built up: Total number of measurement opera- tions: (Word) 0 - 65535 Interval between measurements in ms: (Word) 0 - 65535 Number of measurement channels: (Word) 1 - 8 For 100 measurements, 1000 ms and two channels, the file ToDo.txt will then read: 100 1000 2 This file can be created in Windows Notepad for instance. It’s important to close off the final line with < Return > just like the preceding ones. The end of each line in the file is made up of the special symbol CR and LF, which should be noted when the file is read in the microcontroller. 54 elektor - 11/2008 Listing 1. Mini data logger 'Bascom ATmega88, Vinculum $regfile = "m88def.dat" $crystal = 16000000 Baud = 9600 Open "coml:" For Binary As #1 Dim Samples As Word Dim Delayms As Word Dim Channels As Word Dim N As Integer Dim I As Integer Dim L As Integer Dim S As String * 20 Dim Ad As Integer Config Portb = Output Config Adc = Single , Presca- ler = Auto , Reference = Off Start Adc Echo Off Do Input S Loop Until S = "D:\>" Portb .0=1 Waitms 1000 Print "rd todo.txt" + Chr(13); Input Samples Get #1 , L Input Channels Get #1 , L Input S Print "OPW Log.txt" + Chr(13); Input S For N = 1 To Samples S = "" For I = 1 To Channels Ad = Getadc(i) S = S + Str(ad) If I < Channels Then S = S + Chr ( 9 ) Next I S = S + Chr (13) + Chr (10) L = Len(s) Print "WRF Put #1 , 0 Put #1 , 0 Put #1 , 0 Put #1 , L Put #1 , 13 Print S ; Input S Waitms Delayms Next N Print "CLF log.txt" + Chr(13); Input S Portb .0=0 End Measurement program Our measurement program is imple- mented here in Bascom-AVR [8] for an ATmega88. In principle the only com- mands necessary to share serial data with Vinculum are Print and Input, also Put and Get, for single bytes. A small devil lies in the detail: in Bascom the Print command (as in the other BASIC dialects) at the end of a line is inex- tricably linked with CR (ASCII 13) and LF (ASCII 10). Vinculum does not take kindly to the final LF symbol, how- ever. It is always treated as the first Advertisement r Computer Vision Principles and Practice rar> Computer Vision Principles end Prwfo* [“jlektor L_3shop Computer vision is probably the most exciting branch of image processing, and the number of applications in robotics, auto- mation technology and quality control is constantly increasing. Unfortunately entering this research area is, as yet, not simple. Those who are interested must first go through a lot of books, publications and software libraries. With this book, however, the first step is easy. The theoretically founded content is under- standable and is supplemented by many practical examples. Among other subjects, the following are dealt with in the fun- damentals section of the book: Lighting, optics, camera tech- nology, transfer standards and stereo vision. The practical sec- tion provides the efficient implementation of the algorithms, followed by many interesting applications. 320 pages • ISBN 978-0-905705-71-2 • £32.00 • US$64.00 Elektor Regus Brentford • 1 000 Great West Road Brentford TW8 9HH • United Kingdom Tel. +44 20 8261 4509 Order quickly and safe through www.elektor.com/shop 11/2008 - elektor 55 MICROCONTROLLERS symbol of the following line, which is then rejected as a ‘Bad Command’. However, you can suppress the two end-of-line symbols by follow- ing the Print command with a semicolon (print “dir”;). The required CR must be added separately. For example: print "dir" + Chr(13); The program ‘Vinculum. bas’ can manage quite well with- out the Short- Command mode — in other words, using the ‘long’ text commands. The problem of needing to enter the length of data lines in exactly four bytes (dword) is solved by using the Put command. The length of a data line, even when we are using the maximum possible of eight channels, is clearly less than 255 symbols. In fact we need only one byte, so, for a line length of, for example, 16 symbols, you can send four times Put with the bytes 0, 0, 0 and 16. Why send these bytes with four Put commands and not as a text string? Well, a Null byte in a String indicates its end. For that reason Put is used only when Nulls need to be sent. Problemette solved C 1.4k rural! T Jdnal M*|! |n- 1 I] t**' SwrfcAi'P Jfrffcht ErtUam E'.trw Patifj l “■1 »■ 1 A Ji5,i h j -3 . _l , _i -i . J '> LjL 1 r _ tiiuo A -LmWJ A n c 1 1 n 11 2 2 11 n 3 3 31 11 i 4 11 31 r. 5 11 31 [ 0 E 11 7 7 11 11 d H 31 31 9 5 11 11 10 10 11 11 11 11 11 11 12 12 11 31 TJ 13 54 1023 14 H 51 m V, 15 113 471 IS 10 m JV tr 17 ift 2SS Id Itl T37 213 19 15 140 t&i 70 20 til im 71 ;i M? rsi 22 22 142 )S2 23 23 142 T49 24 143 tit ■ ■ 140 1073 If. 14 * , TB ¥ H \1jlwlp| yj ; t - J ,J / ugn. * LQ * f X El Cm J T \< * I Figure 6. Data evaluation using Excel. Figure 5. Connections between VDIP1 and ATmega88. A further small problem ari- ses when reading the Com- mand File. The BASIC indi- cator Input Samples reads a total value into the variable Samples. The issue is closed out when a CR appears. In the file this is followed with a LF, however. This must now be trapped with a Get to avoid upsetting the entry follo- wing. Likewise in the source text we find repeatedly an obviously superfluous ‘Input S’. It is entered at locations where Vinculum quits a com- pleted action with D:\>t. In this manner we ensure on the one hand that the ATmega does not new data until the old has first been processed, and on the other hand that no junk is left to remain in the data buffer of the microcontroller. The end result can be seen at the end of Listing 1. Now we shall try out everything Figure 7. Mini measurement circuit. stick should not be removed. The LEDs on the VDIP mod- ule indicate that data is being written regularly once a sec- ond. After a total of 100 sec- onds the measurement proc- ess is complete and PBO drops to zero volts. Now you can remove the stick and plug it into the PC. The newly cre- ated file Log.txt now contains the measurement data that has been captured. Measurement data: n n n n n n 54 1023 91 698 113 471 And so on. Using the Tab symbol (ASCII 9) as separator bet- ween the individual channels renders this data easy to pro- cess in Excel. The Excel chart in Figure 6 shows the measurements taken using the small cir- cuit in Figure 7 — we are comparing the charge on two different capacitors that are linked by a resistor. The smaller of the two is 100 jl/F and is charged repeatedly with +5 V via the press-but- ton switch. Prize question: what is the capacitance of the larger electrolytic? ( 071152 - 1 ) together and plug the USB stick into the microcontroller system. After about a second the stick is recognised and the command file is read. The ATmega sets its pin PBO high and (for example) lights up an LED, to show that meas- urement is now in progress and the Internet Links [1] www.vinculum.com/documents. html [2] www.vinculum.com/documents/ datasheets/DS_VDIPl .pdf [3] www.elektor.com/071 152 [4] www.elektor.com/0802 1 3 [5] www.vinculum.com/documents/ fwspecs/UM_VinculumFirmware_ V205.pdf [6] www.vinculum.com/downloa- ds.html [7] http://staff.ltam.lu/feljc/electronics/bas- com/vinculum 1 .pdf (if you don't read German you can still understand the pictures and use the Google translation engine at http://www. google.co.uk/language_tools?hl = en ) [8] www. mcselec.com 56 elektor - 11/2008 BI-UK-1 THE MAGAZINE FOR SPECIALISTS V lektor iStemet The Elektor PLUS subscription iM'MWF ■ Keep £44.80 in your pocket! Elektor PLUS advantages save:”* Subscription PLUS ooQ 00 10 Magazines £39 '° 1 Double Issue (Juiy/August) Annual CD-ROM 2GB MP3 player ■ sss s £44.80 Your saving £5.80 £17.50 £31 -50 o Cheaper than 1 1 issues from the newsstand o More than £10 discount on the new Annual CD-ROM With every issue subscribers get up to 40 % 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. MICROCONTROLLERS Timers and Interrupts Burkhard Kainka (Germany) Many practical tasks can only be solved by using accurate timing. The ATmega controllers are well equipped in this respect; the Mega8 to Mega32 controllers all have three timers. Timer 0 and 2 are 8-bit while Timer 1 is a full 16 bit wide. The ATmega controller's timer/counter section looks a lit- tle daunting at first sight (Figure 1). They are highly con- figurable and require a certain amount of care to ensure they are set up correctly for your application. For those programming in Assembler this configuration procedure is quite involved but as you will see BASCOM simplifies things a lot. The first thing to decide is the source of the timer/counter clock signal. It can come from the internal clock (directly or via a prescaler) or from an external source (e.g. connect to pin PI for Timer 1 ). The counters can count on either the ris- ing or falling clock edge and the counter value can be read or changed at any time via the TCNT1 register. When an overflow occurs it can generate an interrupt. The counters are commonly used for generating Pulse Width Modulated (PWM) signals. This is just a brief outline of some of the more basic properties of the timer/counters, as you become more familiar with the controller you will begin to get a bet- ter appreciation of their versatility. Reading the timer For the first exercise we are using the 16-bit timer driven by the system clock crystal and divided by 256 in the pres- caler. In BASCOM all this information can be written on one line: Config Timerl = Timer , Prescale = 256. The timer also begins counting so it is not necessary to use Start Timerl . Listing 1 is the first test, as before we are using a Goto to reduce 'compilation clutter'. The listing as printed will only ever go to the first example, you will need to change fifth line to Goto Test2 and recompile for the next exercise. In Testl timer/counterl just runs continuously and the coun- ter value is displayed five times per second. The values are in the range from 0 to 65535, and we can see that after roughly one second an overflow occurs: 088 17864 30706 43547 56389 3695 16471 We know the clock frequency and the counter size so it is possible to work out the exact time between overflows: the counter clock is 1 6 MHz divided by 256 which gives 62.5 kHz. The counter overflows after 65536 clocks so the inter- val between each overflow is 1 .049 s. In this application the counter produces a precise time ref- erence. We can now use this information to test how long the program takes to complete the two instructions: "Print Timerl" and "Waitms 200". Using for example the con- secutive readings 43547 and 30706 the interval is 43547 - 30706 = 1 2841 clock periods. One clock period equals 1 / 62.5 kHz = 15.267 pis. The time between the two readings will therefore be 1 2841 * 1 5.267 pis = 196 ms and not 200 ms. We can see that the Waitms instruction should not be used if it is necessary to make accurate time measurements. Timer Interrupt This exercise programs the controller to generate an accu- rate 1 second clock. The 1 6-bit Timer 1 is not necessary for this application; we can use 8-bit Timer 0. The timer will be programmed to overflow every 1000 ps and generate an interrupt. 58 elektor - 11/2008 m 4 JH s b i e An interrupt causes a forced interruption of the main pro- gram and directs the controller to execute a sub routine (Interrupt Service Routine or ISR) to service the interrupt. Different events can be programmed to generate an inter- rupt and an ISR is required to respond to each type of inter- rupt. Here TimO_isr would be the subroutine name but in this example we have just used TimOjsr: as a label which indicates where the program jumps to on interrupt. The last instruction of the interrupt routine must be a RETURN. In this example further interrupts will not be serviced until the return is executed. Test 2 configures timer 0 with a prescaler of 64, which gives it a clock frequency of 250 kHz. The counter is 8-bits wide so without further programming it will generate an overflow interrupt every 256 clock cycles. We need the counter to interrupt every 250 clocks for an accurate 1 ms timebase so it is necessary to load the counter with the value 6 each time it overflows. A word variable called Ticks is incre- mented every time the counter overflows. When this vari- able reaches 1 000 it indicates that one second has elapsed and the variable called Seconds is incremented. The value of either variable can be read by the main program. In this example the program sends the value of seconds to the ter- minal every second starting from zero at program start. It is necessary to allow the interrupts to occur by enabling the global interrupt (Enable Interrupts) and also allow the timer 0 overflow condition to generate an interrupt (Enable TimerO). The display shows the value of seconds: 0 1 2 3 All interrupt sources can be disabled by using Disable Interrupts. Averaged measurements Measurements made of analogue signal levels are often affected by a 50 Hz mains signal superimposed on the volt- age level. The unwanted 50 Hz component can effectively be cancelled out by sampling the analogue voltage level several times during a complete cycle of the mains voltage (20 ms) and then averaging all the measurements. c n z> 00 I O U u u Timer/Counter TCNTn I OCRnA £ J OCRnB f ICRn Count Clear Direction Control Logic TOP \ clk T BOTTOM = 0 TT t Fixed TOP Values /I TOVn (Int.Req.) Clock Select Edge Detector ^ 1 From Prescaler ) Tn OCnA '(Int.Req.) Waveform Generation OCnA OCnB '(Int.Req.) Waveform Generation OCnB ( From Analog Comparator Ouput ] -ICFn (Int.Req.) Edge Noise Detector Canceler ICPn N TCCRnA 1 jP 080672 - 1 1 Figure 1. Block diagram of the timers. Listing 1 Reading the timer registers 'Bascom ATmega88, Timer $regfile = "m88def.dat" $crystal = 16000000 Baud = 9600 Goto Testl Testl : Config Timerl = Timer , Prescale = 256 'Start Timerl Do Print Timerl Waitms 200 Loop 11/2008 - elektor 59 MICROCONTROLLERS Figure 2. Measuring an ac voltage. 50Hz ^ [)0 — i iok \ ADCO 1 i i i i i i i i i i i i 080672 - 12 For this exercise we will use a timer interrupt again to gen- erate an accurate timebase. The average value is achieved by sampling the analogue signal 25 times in a 20 ms time window. The sampling interval is therefore 800 ps. Timer 2 will be used with a prescale value of 64. Each time it over- flows Timer2 is loaded with the value 56 so that the next overflow occurs 200 clocks later. 800 |js is more than enough time to make the analogue measurement and calculate the sum and mean value. The variable Ticks is incremented each time a measurement is taken every interrupt. After 25 measurements the sum stored in ADO is transferred to the variable AD0_mean. The main program averages the value and then sends it to the screen. Averaging in this way gives such good suppression of the 50 Hz components that by using half wave rectification the system can be used to measure ac signals. The low volt- age AC signal is connected to the ADCO input via a 10 k Listing 2 Exact seconds using interrupts Test2 : Dim Ticks As Word Dim Seconds As Word Dim Seconds_old As Word Config TimerO = Timer , Prescale = 64 On OvfO Tim0_isr Enable TimerO Enable Interrupts Do If Seconds <> Seconds_old Then Print Seconds Seconds_old = Seconds End If Loop Tim0_isr : '1000 p.s TimerO = 6 Ticks = Ticks + 1 If Ticks = 1000 Then Ticks = 0 Seconds = Seconds + 1 End If Return Listing 3 Measuring averages Test3 : Dim AdO As Word Dim Ad0_mean As Word Config Adc = Single , Prescaler = 64 , Re- ference = Off Config Timer2 = Timer , Prescale = 64 On Ovf2 Tim2_isr Enable Timer2 Enable Interrupts Do Ad0_mean = Ad0_mean / 25 Print Ad0_mean Waitms 100 Loop Tim2_isr : '800 ps Timer2 = 56 Ticks = Ticks + 1 AdO = AdO + Getadc(0) If Ticks > 24 Then Ticks = 0 Ad0_mean = AdO AdO = 0 End If Return protection resistor (Figure 2). The program now finds the average value of the positive half wave which is equal to half of the absolute average value of the sine wave. A typi- cal sequence of measurements would be: 226 227 226 226 226 Although there is some variation the measured average value is mostly 226. This can be converted into a real volt- age level: 5 V * 226 / 1 023 = 1 .1 0 V. The measured alter- nating voltage therefore has an absolute average value of 2.20 V. For a sine wave this equates to an RMS value of 2.44 V and a peak to peak value of 3.46 V p _ p . The rela- tionship between the peak and RMS value of a sine wave is V2 = 1 .414. For arithmetic averaging the relationship of the peak value to the average value is 7t/2=l .571 , so the absolute average value is 90.03 % of the RMS. ( 080672 - 1 ) Downloads and further information: The programming examples and more information for this course can be downloaded from the project page at www.elek- tor.com. As always we look forward to your feedback in the Elek- tor forum. 60 elektor - 11/2008 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 I each Wednesday £ From the Elektor labs: Simple, useful and fun electronic circuits! Play the i-TRIXX Quiz and win! Test your knowledge about internet, computers and electronics. Take your chance now and play the i-TRIXX Quiz. There are great prices to win! Check i-TRIXX.com and subscribe now! Powered by TECHNOLOGY SHAFT ENCODERS E*i#llAM IfAA I I l%IIVII llvv Angle Measure|ient a magnetic shaft encoder using the Hall effect Josef Warta (with the assistance of Andreas Riedenauer) Measuring angles has until now involved a choice between potentiometers and optical encoders. Potentiometers are inexpensive, but have the disadvantages that they require calibration and create friction; optical solutions, although offering high accuracy and long-term stability, are mechanically more complicated and considerably dearer. In this article we describe a modern semiconductor-based solution: a magnetic shaft encoder using Hall effect sensors. A potentiometer can measure a vary- ing angle by converting it into a vary- ing resistance. This has the advantage that an absolute angle reading is avail- able immediately when the circuit of which it forms a part is turned on. The disadvantage is the friction created when the shaft is turned, and further- more poor tolerance means that cali- bration is a necessity. The optical ap- proach offers much greater precision, service life and long-term stability, but on the other hand an absolute angle reading can only be obtained using a complicated optical system, increasing overall costs. It is possible to construct an angle sen- sor by exploiting the Hall effect, offer- ing high precision and low cost. There is a mechanical separation between the moving and fixed parts of the de- vice, which means that it is possible to make units sealed against moisture and dust for use in robotics, industrial machinery, medicine, aerospace and many other application areas. The basics Hall effect sensors for measuring mag- netic fields are already in widespread use, for example to determine the ro- 62 elektor - 11/2008 tor position in brushless DC motors. In these applications the sensors are simply used as switches to replace slow, unreliable mechanical contacts. The Hall effect is exhibited to some de- gree by any electrical conductor; the strength of the effect depends on the material and using modern semicon- ductor technology we can build highly sensitive Hall elements into integrated circuits at low cost. The principle of operation of a Hall ele- ment is illustrated in Figure 1. A volt- age proportional to the magnetic field strength is developed across the sen- sor when a current flows through it. A rotating bar magnet or bipolar magnet will therefore give rise to a sinusoidal voltage, just as a coil does in a rotat- ing magnetic field. In contrast to this induced voltage, however, the output signal of the Hall sensor can be meas- ured statically, since a stationary mag- netic field gives rise to a constant Hall voltage. A single Hall sensor can be used as an angle measuring device as shown in Figure 2. We are restricted to the quasi-linear region of operation of the sensor between -45 ° and +45 °. High precision of mechanical construction and alignment between magnet and sensor is required. Temperature varia- tions can affect the magnet and hence the amplitude of the output voltage of the sensor, reducing accuracy unless temperature compensation is used. Ex- ternal magnetic fields directly affect the amplitude and phase of the output voltage, and so magnetic screening is essential. Take four These obstacles to the accurate meas- urement of angles can be solved el- egantly using a circular arrangement of four (or even more) sensors. The ro- tational axis of the magnet should go through the middle of the circle. Each pair of diametrically opposite sensors is connected to a differential amplifier (Figure 3), and the difference voltage gives the gradient of the Z component of the magnetic field. These gradients vary sinusoidally with angle, and, if the sensors are accurately aligned, the two gradients will be 90 ° out of phase with one another, giving a sine and a cosine signal. These two signals are digitised, and a low-pass filter reduces jitter and noise. A DSP device imple- menting the CORDIC algorithm can be used to perform the coordinate trans- Figure 1. Principle of operation of a Hall element. In contrast to electromagnetic induction, the Hall element produces a voltage in a stationary magnetic field. X HS (/> I do ' nte 9 ratec| JP) linear , Hall sensor V DD V, out V SS quasi-linear range 070480-12 Figure 2. When a single Hall sensor is used the measurement range is limited to between -45 0 and +45 °. Figure 3. Measurement independent of stray fields using four Hall sensors. formation from the sine and cosine sig- nals to give amplitude and phase in- formation. The amplitude output can be used to control the current source feeding the Hall sensors so that the device’s sensitivity is independent of the magnetic field strength, as well as to give an indication of the distance between the magnet and the sensor circuit. If a sensor IC includes this out- put, it is simple to add a contactless pushbutton feature to a contactless ro- tary switch. Shaft encoder ICs Austriamicrosystems (AMS), based in Unterpremstaetten near Graz in Aus- tria [1], has developed a family of mag- netic shaft encoder ICs along the lines illustrated in Figure 3. The AS50xx se- ries of shaft encoders offers resolu- tions from 8 bits to 12 bits and a range of output interfaces: serial, PWM, ana- logue, incremental, or combinations of these. As well as high accuracy and wide operating temperature range the sensors also feature rapid processing, 11/2008 - elektor 63 TECHNOLOGY SHAFT ENCODERS Accuracy of a shaft encoder system There are two parameters of a shaft encoder that are often confused: resolution and accuracy. The two are not necessarily related to one another. Resolution is the size of the smallest step, or the number of equal steps per revolution, that the encoder can distinguish. A 1 2-bit encoder therefore has a resolution of 2 1 2 = 4096 steps per revolution, or 0.08789 ° per step. The resolution is chiefly determined by the analogue-to-dig- ital converters (ADCs) and by the precision of arithmetic used in the CORDIC calculation. Accuracy is a measure of the deviation from the reported angle value from the true angle. Many factors affect the accuracy of a magnetic shaft encoder, jointly determining the overall quality of the device. The most important factors are as follows. Phase error of the Hall signals This error would be expected to be small, since the Hall elements are arranged exactly at right angles to one another. However, a problem can arise with a rapidly rotating magnet if there is a differential delay in the paths taken by the sine and cosine signals. This can happen if a sin- gle analogue-to-digital converter is used to sample the signals alternately. The AS5030 uses parallel converters, keeping the phase error negligibly small even at high rotation speeds. Matching error between Hall sensors or amplifiers This error is minimised by a carefully-optimised 1C layout and advanced semiconductor manu- facturing technology. Offset errors in the signal path An offset error will add a DC component to the sine or cosine signal. Such errors generally originate in the Hall sensors themselves or in poor matching between transistors in the ana- logue signal path, and can be minimised by design techniques such as spinning current com- pensation in the Hall element, chopper amplifiers and on-chip trimming adjustments. Non-linearity of the ADC Non-linearity in the ADCs can only be compensated for by a tedious calibration process, and so the linearity requirement on these components is correspondingly demanding. Non-linearity of the magnet If we consider the vertical component of the magnetic field (to which the Hall elements are sensitive) parallel to the rotational axis, the maxima are at the poles. In between the poles the behaviour is broadly linear (see illustration). As long as all the Hall elements are in this linear region the differential signal will be of constant amplitude, independent of the horizontal posi- tion of the magnet. Larger diameter magnets therefore allow for greater horizontal offsets than smaller ones. On the other hand, the graph of field intensity against displacement is also flatter, which means that the amplitude of the differential signal is reduced. This in turn requires greater amplification, resulting in poorer signal-to-noise ratio. The best compromise is found using magnets with a diameter of approximately 6 mm: experi- ence indicates that the maximum error induced by an imperfectly-centred magnet is well un- der 1 °; with a centred magnet the maximum error is under 0.5 °. I i i i ! 070480-16 Sin / Sinn / Cos / Cosn 070480-14 allowing position measurements at ro- tational speeds of up to 30000 revolu- tions per minute. We shall take the AS5030 [2] as an ex- ample device. This costs around five pounds bought individually, falling to just over three pounds each for fifty or more devices, and is therefore an eco- nomical solution in simple angle meas- urement applications. The Hall sensors are fabricated using a CMOS process and operate from a 5 V supply. The sig- nal processing logic is integrated onto the device (see block diagram in Fig- ure 4). Internal compensation assures reliable performance from -40 °C to + 125 °C, with parts for automotive ap- plications specified for operation up to + 150 °C. The differential measurement technique inherently compensates for external magnetic fields, ageing of the magnet and variations in temperature. The devices offers eight-bit resolution, distinguishing 256 angles over a 360 ° revolution: this corresponds to an an- gular resolution of 1.4 °. In addition to angle, the device also measures the overall field strength, which it reports using a six-bit code. This allows the distance to a rotating magnet to be estimated, or the implementation of a contactless pushbutton feature as de- scribed above. The position value can be output over a serial digital interface (two-wire or three- wire) or using a PWM (‘one- wire’) output. A zero position can be pro- grammed into the device’s OTP (one- time programmable) memory to sim- plify assembly by obviating the need to align the magnet precisely. A low power sleep mode with rapid wake- up allows the device to be used in bat- tery-powered applications. The device can be used with hard- wired logic rather than a microcon- troller for fail-safe operation, ideal for safety-critical applications employing redundant systems. A diagnostic fa- cility provides a warning if the mag- net works loose or is not present. A basic accuracy of +/-0.5 ° means that in many applications calibration is unnecessary. A complete position measurement system can be made using just an AS5030 (see pinout in Figure 5), a de- coupling capacitor, and a bipolar mag- net mounted perpendicular to the ro- tation axis. Sources for the AS5030 and two kinds of magnet can be found at [2], while Figure 4. Block diagram of the AS5030 angle encoder 1C. 64 elektor - 11/2008 data sheets and other downloads can be found at [3]. Magnets The magnet can be press-fitted or glued directly to a non-magnetic axle. Rare earth magnets are recommended be- cause of the higher field strengths ob- tainable: neodymium-iron-boron mag- nets are cheaper than samarium- cob alt magnets, but have a higher temperature coefficient and lower maximum work- ing temperature. The main parameters when selecting a magnet are: • temperature coefficient; • dependence of field strength on ma- gnetic field strength (automatically compensated for by AS5000 series encoders); • Curie temperature; • maximum working temperature; • field strength, measured in Tesla or kilogauss. In addition to the sample magnets available at [2], a wide selection is available at [4] and [5]. Software for si- mulation of magnetic fields is availa- ble at [6]. Demonstration board AMS produces demonstration boards for all its encoder ICs to help designers gain practical familiarity with the de- Figure 5. Pinout of the AS5030. The output signal is available on a serial digital output and as a PWM signal. vices. The boards consist of a small printed circuit board which carries the sensor IC, a microcontroller, a four-digit seven-segment display, a USB socket for connection to a PC, and a header for connecting an expansion board. A hole in the Perspex cover accepts a rotary button fitted with a magnet. Figure 6 shows the AS5030 DB demonstrati- on board for the AS5030 device, again available at [2]. An external angle sen- sor can be connected using the hea- der, for example on an AS50xx adapter board, available as an optional extra. This external sensor can then conve- niently be configured or permanently programmed using the demonstrati- on board software, available for free download at [3]. More details about the demonstration board and adapter board can be found in the PDF manuals available for download at [7]. A free en- coder software development kit (SDK) is also available for download, inclu- ding a DLL and example programs for dedicated applications based on the demonstration board. Further informa- tion can also be obtained from AMS’ distributors [8]. ( 070480 - 1 ) Web Links [1 ] http://www.austriamicrosystems.com [2] http://www.austriamicrosystems.com/ 03products/products_detail/AS5030/descrip- tion_AS5030.htm [3] http://www.austriamicrosystems.com/ 03products/products_detail/AS5030/down- load_AS5030.htm [4] http://www.bomatec.ch/index_e.php [5] http://www.arnoldmagnetics.com [6] http://www.invensense.com [7] http://www.austriamicrosystems.com/ 03products/products_detail/AS5040/down- load_AS5040.htm [8] http://www.austriamicrosystems.com/ 06contactcenter/distributors_start.htm ■ PUf1 Index B A • LED3 -K. :> J£b 0D3U3 ® UPr n g 7 +9 \J GNQ ^ ’ 3U3 ■ ndx/Hd * J AS504U/45 E austr 1 ami crosys terns 006/10 Figure 6. An AS50xx demonstration board provides a development environment for dedicated applications using its accompanying free software. 11/2008 - elektor 65 MODDING & TWEAKING Colourful Computer Light Controlling the Living Colors lamp with USB Jeroen Domburg We live in a colourful environment these days. Everything is in colour: TV, advertising billboards, mobile phone displays and LEDs. Philips added a further dimension to all this with their Ambilight, Wake-up Light and Living Colors lamp. We will work with the latter in this M&T article. The wireless remote control offers interesting possibilities once the protocol has been cracked... In the February 2008 issue the editors disassembled a Living Colors lamp from Philips. In this article we will once again do something with this lamp. One of the disadvantages of the lamp is that it can only be controlled with the supplied remote control. Nice enough perhaps, if all you want to do is use it as a glorified table lamp. But controlling it with a PC offers many other possibilities. Turn the room red In the remote control we find two printed circuit boards that are interconnected with a ribbon cable. when you’ve received mail, let the col- our of the wall follow the movie you’re watching, illuminate the room when it’s time to get up, you mention it! Lively colours For those who missed the article men- tioned earlier: a Living Colors lamp is an appliance made by Philips that with a few bright, coloured LEDs can illumi- This is how we reverse engineer the protocol. It may not look like it, but apart from the wires the remote control is still completely intact. nate a room in just about any conceiv- able colour. In this way you can create or enhance a particular mood. The Liv- ing Colors lamp comprises the lamp it- self and a remote control. The two are linked via a CC2500, a little IC from Texas Instruments, which can send data over a 2.4 GHz radio link. To be able to control the lamp we will first have to figure out how the data is sent. Measuring this without open- The all-important CC2500 chip. They don't come any bigger than this, unfortunately... 66 elektor - 11/2008 D1 D2 Figure 1. It can't be much simpler than this: we do the control of the CC2500 with an ATmega88 via USB. ing the device is difficult. Firstly, be- cause the CC2500 has several methods available for sending the data (MSK, FSK, OOK, with or without data whit- ening, Manchester-encoded, etc.) so it is a lousy job trying to dig out the transmitted data from the actual ra- dio signal transmitted. Secondly, the author, in contrast to the RF people at the editorial offices, does not have SHF measuring equipment at his disposal, something that’s crucial with this ap- proach. We will therefore have to de- code the information using some other method... Eavesdropping Taking a look at the datasheet for the CC2500, we read that the chip gets its data from the host-processor via a 4- wire serial connection, with the option of two more wires for status informa- tion. If we eavesdrop on the traffic on this 4-wire bus we should be able to learn a whole lot more about what is being transmitted. Although there are two CC2500s, namely one in the remote control and one in the lamp itself, we decided to listen only to the one in the remote control. The reason for this is less phil- osophical than you may think: it proved to be impossible to open the lamp without damaging it, but it turned out that opening the remote control was a lot easier. The remote control consists of two printed circuit boards. The PCB for the touch sensitive ‘push buttons’ plus the controller for these, a QT1106 is connected with a ribbon cable to the smaller main PCB that contains the MSP430 processor and the CC2500. Tapping into the bus is rather difficult, but with the aid of thin wire and some instant glue it was eventually possible to make a mechanically strong tap. Because interpreting the protocol us- ing only and oscilloscope is rather tedi- In comparison with the ATmega88 the latter is in- deed quite 'mega'. ous, we use an AVR with hardware SPI support for the actual ‘sniffing’. This AVR then sends the eavesdropped sig- nal via a serial port to the PC where the actual decoding can begin. When we push a few buttons on the remote control, it is immediately clear that the protocol is more complicat- ed than we had initially anticipat- ed. When the remote control is first turned on, The CC2500 is initialised with data regarding the frequency, the type of modulation and the data rate. The actual communication is based on packets. A packet is loaded into the CC2500 and transmitted by the chip in RF form. Reception is done in the same way. The CC2500 is set to re- ceive mode and as soon as a packed has been received a particular pin The size does not make it impossible to solder. A steady hand, a magnifier and thin wire go a long way. goes high and the packet can be read by the microcontroller. Data format The packets consist of a number of fields. The first thing that emerges is that both the remote control and the lamp have a, probably unique, ad- dress. Therefore, the packets for set- ting the colour, for example, start with the address of the lamp followed by the command. The commands correspond with the buttons on the remote control. There is, among others, a command to turn the lamp on, to turn it off again, to set the colour and to set the lamp in demo mode. The command is followed by a se- L This is how the transmitter is mounted on the USB PCB. The thing with black tape around it is a 25- MHz SMD crystal. 11/2008 - elektor 67 MODDING & TWEAKING quence number. This is a number that increments by one after each com- mand is sent. When the lamp sends a response, this same sequence number is sent back so that the remote control can determine which response goes with which command. It gets more interesting after the se- quence number byte. There now follow three bytes with colour information. The fact that colour information is be- ing sent is somewhat remarkable, since the average remote control only passes on which button is being pushed. The decision to store the selected colour in the remote control makes sense. In this way Philips ensures that if you use the remote control with multiple lamps they will all be set to the same colour. For our purposes this is also very prac- tical: it is, after all, much easier to sent the desired colour than to emulate all sorts of button pushing. To send the colour, Philips decided to use the HSV system. The Hue gives the colour, the Saturation the intensi- ty of that colour and Value the amount of light the lamp has to generate. By giving the appropriate command with certain HSV-values the desired colour can be set immediately. And because the wireless connection operates at a speed of 500 kbaud, this is relatively quick as well. Control Okay, we have the protocol, we have the initialisation data and we know how we can set the colour of the lamp. What are we now going to do with that knowledge? The author decided that an Ambilight-ish functionality would be nice to do. The plan therefore, was to build a device that could be con- nected to the PC and control several lamps. For the control we can use existing software: on the internet there is a community of people who make their own PC controlled Ambilight clones. This has resulted in a few nice Linux and Windows applications that are very useful for this project. The most common protocol used in this software is the MoMoLight protocol, which is actually nothing more than sending the RGB values for three different light sources directly to the serial port. To be compatible with the software we need a few things. Firstly we’ll have to emulate a serial port over the USB bus and secondly we’ll have to convert the incoming RGB data to the HSV format that’s expected by the lamps. The first requirement is easily met with one of several ready-made solu- tions: a number of companies make USB-to-RS232 converter ICs that can be directly connected to the bus. For this project however, we chose a differ- ent approach. The heart of the circuit consists of an ATmega88 which is con- nected directly to the USB port. If we look at the datasheet for this AVR we will however not find any mention of hardware to support USB. So how does this work then? The solution is to be found in a trick: with some clever programming most of the AVRs can be made to ‘mimic’ a low-speed USB device. There even exist special libraries for this purpose [1]. Several projects have been made around these libraries: USB -program- mers, bootloaders, display controller, just name it. One of these projects is called AVR-CDC and its purpose is to implement a USB to serial converter in software. That’s just what we need! The software is licensed under the GPL, which means that if you build a device using it, you also have to supply the source code. That is not a problem for this project. An RGB to HSV converter is also eas- ily picked from the Internet. There are multiple solutions on various websites, but they are often based on floating point, which means that the already busy AVR has to do even more. After an extensive search we fortunately also found an integer version, which costs far fewer clock ticks. This soft- ware is released under the MIT license, which, after a little searching, appears to be compatible with the GPL. So after a copy-paste operation we’ve already gathered half of the required code. The code to control the wireless chip is all that remains. Because this chip has a comprehensive datasheet and we have a good example obtained by eavesdropping on the data from the re- mote control, this is not a big deal. Hardware Because we’ve solved a number of requirements in software, the circuit that remains is not tricky at all (Fig- ure 1). On the left is the USB connec- tion, which is connected with a few, and according to the USB specification, mandatory resistors to the AVR. The CS2500 and the USB data lines require a power supply voltage of 3.3 to 3.6 V. This is obtained in a simple way from the 5 V on the USB connector. Connect two diodes in series with this 5 V and the voltage drops to about 3.5 V. On the right of the schematic is the CC2500, in a configuration which is nearly entirely a direct copy from the datasheet. The loop between RP_P and RP_N is the antenna. Although there are quite specific requirements for this antenna in the datasheet, a wire about 1 1 cm long and bent into the shape in- dicated suffices in practice and works well over a short distance. The schematic looks quite simple, but the assembly of the circuit is much trickier than it looks. This is because the CC2500 chip, which deals with the necessary RF communication, is only available in a QFN package. For those that are not familiar with SMD pack- And the end result: the Living Colors lamps 68 elektor - 11/2008 ages: the five pins on each side of this tiny chip all fit between two pins of a normal DIP package. As if that is not bad enough, most of the 20 connec- tions to the IC have to be actually con- nected as well. How do we solve this as hobbyist without access to an ex- pensive SMD equipped workshop? Of course, there are conversion PCBs available, but they are generally quite expensive and certainly the versions for QFN are not readily available. The author therefore chose for the ‘dead bug’ method: the chip is glued upside down with a drop of instant glue to a small piece of prototyping board. The connections are now made with thin wire to the copper tracks of the proto- typing board. This type of wire is sold with the name Kynar- or wirewrap wire, but a cheaper alternative is sal- vaging an 80-way IDE cable; the indi- vidual wires are about the same size. Once the module with the CC2500 is done, the remainder is not too much trouble. That is because these are all through-hole parts. In the end the dili- gent effort results in a little PCB about the size of a match box, with the USB connector as its only connection. Compatibility problems All that is left to do is plugging in the connector and testing of the assem- bly. The first tests appear to go real- ly well, but several colours look abso- lutely nothing like those on the screen. How can this be? A quick test with a graphics program that can generate in use as an Ambilight clone. HSV colours indicates that the HSV- to-RGB conversion in the lamps does not follow the official standard entirely. Although the saturation and value are correct, there is a certain non-linearity in the hue curve. Fortunately this can be fixed. After a few observations of the differences in colour, a table can be constructed which converts ‘real’ hue- values to their equivalent Living Colors hue values. The table is not really an ideal solution, but if you notice the col- our differences when watching a movie you will have to ask yourself whether that movie is really worth your time... Because there is little chance that oth- er lamps have the same addresses as the lamp we used, there is a learning routine in the AVR. This works as fol- lows. First make sure that all lamps that have to be controlled can be oper- ated with one remote control. You can ‘add’ a lamp to a remote control by holding the remote against the Philips logo on the front and pushing the ‘1’- button on the remote. Do this for all the lamps and if all is well, all lamps will now react to that remote control. Once the remote control knows all the lamps it is possible to transfer the ad- dresses to the AVR: push button SI and press the ‘O’ button on the remote control until the LED on the PCB (Dl) turns off. What is happening? The re- mote control attempts to turn off all the lamps by sending each lamp the ‘off’ command. The AVR also listens on this channel and stores every passing ad- dress. These addresses are saved in EEPROM. ‘Acquired’ addresses remain in the AVR until replaced by other ones after the learn-button is pressed again. The addresses are also retained when the power supply voltage is removed. The last mile How does all this work on the PC side? As already mentioned, the AVR presents itself as a serial port that un- derstands the so-called MoMoLight protocol. This means that any program that supports this protocol can control the Living Colors lamps. A few exam- ples of these are, just like the firmware for the Atmel, on the website of the author [2] and on the project page at www. elektor. com . For programmers who would like to write their own software: the MoMo- Light protocol supports up to three RGB light sources. To set the lamps to the desired colour the emulated seri- al port needs to be opened at a baud rate of 4800, no parity and 8 data bits. The RGB values for the lamps can now be sent in nine bytes in the order of R1,R2,R3,G1,G2,G3,B1,B2,B3. A final remark: it has come to the au- thor’s attention that the software USB stack is not quite as compatible with all computers as it should have been. Should there be a problem with a par- ticular PC, you can try to connect the device via a USB2.0 hub to the PC. If this is all to no avail then there is also a serial version available on the au- thor’s website. ( 070850 - 1 ) Web Links [1] : www.obdev.at/products/avrusb/index.html [2] : http://meuk.spritesserver.nl/projects/livcol About the author: Jeroen Domburg is a student at the Sax- ion Technical University in Enschede, the Netherlands. He is an enthusiastic hobbyist, with inter- ests in microcontrollers, electronics and computers. In this column he showcases his personal handiwork, modifications and other in- teresting circuits, which do not necessar- ily have to be useful. In most cases they are not likely to win a beauty contest and safety is generally taken with a pinch of salt. But that doesn't concern the author at all. As long as the circuit does what it was intended for then all is well. You have been warned! 11/2008 - elektor 69 MAILBOX The Universal Remote Switch Box is a universal remote control receiver, fitted with 16 open-collector outputs. Each of these can be configured either as a momentary or a toggle output. In addition there is also a master/slave function built in. This Universal Remote Switch Box was inspired by the ‘Easy Home Remote Control’ circuit in the 2006 July/ August issue (page 72). This circuit has only 4 outputs, howe- ver, and accepts only RC5 codes. To eliminate the latter limitation, the firmware of the circuit described here is based on the ‘Universal Infrared Receiver’ (UIR, see sidebar), which makes it suitable for all types of remote control. How it began A few years ago I wanted to build an IR-receiver for my PC. First I built the receiver by Holger Klabunde [1], but I was really disappointed with the soft- ware that comes with it. After much looking around I came across UIR on the website of Srdan Milostic (now no longer on-line). The hardware was practically identical, but UIR could handle all kinds of remote control. After replacing the PIC I had a good remote control for my PC. Later on, I had the idea of using UIR with a second microcontroller for a remote switch box that doesn’t require a PC. But two microcontrollers, that is just a little bit extravagant. Because only the HEX-code was available, I converted the original code into assem- bler. Around this assembler code I sub- sequently built a additional shell. And with this the Universal Remote Switch Box was born. The schematic The hardware is straightforward: • a TSOP1736 receives and demodu- lates the IR-signals; • with a dip-switch and three push buttons the circuit can learn different codes; • three (bi-colour) LEDs are used as status indicators; • there are two ULN2803 output buf- fers for driving the outputs; • an LTC485 (or similar) is used for the RS485 port; • the brain of the whole thing is the PIC16F877. There is not much else to say about the schematic, except that the output buffers are capable of driving relays directly. The ‘learning’ of the different IR-signals and the RS485 connection are described a little bit later on. To make the PCB compact, a number of SMD components are used. These are standard parts however. The PCB is single-sided, although this results in the need for two wire links. The Firmware When the circuit receives a signal from the remote control it is decoded with the aid of the UIR software into a 48 bit code. This is compared, via the RECEIVED_CMD subroutine, which checks whether a valid command was received, with the codes that are sto- red in the EEPROM. When a valid code is found, the corresponding output is set appropriately. At the same time Timerl is set to zero. This generates an interrupt after about 262 ms, which turns off the pulse-output(s) and clears a blocking flag. There is a peculiarity in the firmware, which is caused by the hardware: the last four outputs are not connected in order to the microcontroller. In addition the other outputs are wired in reverse. This is corrected in the software using a look-up table (PORT_CONV). The four configuration bytes for the type of output (TOGGLE 1/2 and MASTER 1/2) therefore have to be also in this same order. This is taken into account in the PC software. As a result of these adjustments the outputs nevertheless appear to be in order. The size of the EEPROM is 256 bytes. Of this, 192 bytes are used for the codes (two codes can be program- med for each output) plus four bytes are for the output configuration. The output number is also transmitted via the RS485 port. To be more accurate, this port, in fact, passes on each of the 32 individual codes that are possible. In addition of this serial connection, the configuration can also be sent to a PC, which makes the programming somewhat easier (for more details look under the heading ‘PC software’). Figure 1 . At the centre is the PIC1 6 microcontroller, which is supported by the buffer ICs and the RS485-interface chip. 70 elektor - 11/2008 +5V 11/2008 - elektor 71 MAILBOX READERS CIRCUITS see®®®®®® ®© JP2 JP3 >^WJP4 IC2 ULN2803 ULN2803 1 IC5 LTC485 © © icn PI Cl 6F877P • • • • • • IBB 4 MHz © CM CD QC QC QC I 33p 33p 0 IC7 LED1 LED2LED3 TS0P1736 DinOM^D9l3 QH © ■ •■•■•I ni •c? # SI A pfll o 100r^— • • • • io • • • C3 C4 n n • • CM CD _ T 1 T 1 * 1 ££ CD CO IV MD Ln 100n 100n • CL CL CL □ □□ 1 00n | L L_L LX LX LX : LX :□□□□□ -V _v _v _v _v _v _v _v _v Q Q Q S) S) (S CS (S S) Figure 2. The component layout for the top of the board shows the neatly arranged design of the PCB Figure 3. On the bottom of the board we recognise the SMD parts. The serial connection operates with the settings 9600 Baud, no parity, 8 data bits, 1 stop bit (9600-N-8-1). The pro- tocol is as follows: - OxFF (start byte) - 0x40 -I- output number - OxFE (stop byte) Universal IR receiver UIR stands for Universal Infrared Receiver. This is a PIC12C508 connected to the COM-port of a PC, which can be used (in conjunction with the appropriate software) to operate multimedia programs. Originally, this was probably made by Srdan Milostic, although there is no further information because his website has been gone for years. More information about UIR can be found on the author's website [2]. The RS485 driver is always active, except in edit-mode. This is therefore effectively only an output. For future possibilities the RX- and TX-pins are already connected to RC6 and RC7 of the microcontroller. The programming mode Normally the outer two LEDs are illu- minated green. When receiving a valid code the middle LED briefly (5 ms) fla- shes red. With a invalid code the outer two LEDs turn off briefly, but this is barely visible (1 ms); these times were deliberately chosen to be this short because of the receive routine. The programming (or ‘learning’) is ini- tiated by pressing the left push button, the left LED will turn red. On recep- tion the middle LED briefly flashes green. When the same code has been received twice in a row, the two LEDs on the left turn green and no further codes are received. With the right but- ton the code can be stored in RAM, with the left button a new attempt can be made. With an incorrect reception (not the same code twice), the second LED briefly flashes green and the third LED briefly red. Two UIR codes can be stored for each output. Each code is represented as a 12-digit hexadecimal number (6 bytes). When storing the code with the right button, the dip-switch is used as the output number. This dip-switch could also be replaced with a rotary version (see photo), so that it is easy to change from one output to the next. The fifth switch on the DIP block (a jumper in the photo) selects the second block of 16 codes. Leaving programming mode is done with the middle push button. Only then are all the codes stored in the EEPROM. The Edit mode With a press of the right push button we enter edit mode. This is indicated by the right LED turning red. In this mode it is possible to remove a code. This is done by simultaneously press- ing the left and right buttons. The mid- dle LED briefly flashes red as confirma- tion. The output number is again deter- mined by the dip-switch. Leaving edit mode is also done by pressing the middle button. In this Protocol Uploading: OxAA start byte output 0, code A binary coded, 6 bytes output 0, code B ... output F, code B total 192 bytes 4 bytes output configuration 0x40 - 0x5 F 1 byte checksum modulo 2 - XOR, not including start byte Ack (0x06) or Nak (0x15) as confirmation Downloading: OxAB download command Response from the circuit is the same as when u ploading (including start byte and checksum). 72 elektor - 11/2008 Figure 4. The prototype uses a rotary encoder, but a DIP switch works just as well. Figure 5. As can be seen here, the SMD parts save quite a bit of space. mode too, the changes are only saved to the EEPROM when leaving the mode. PC software In edit mode the microcontroller also listens to the RS485 port (normally this is only an output, as previously men- tioned). In this mode it is possible to read the configuration and to modify it. This configuration is stored as an ini-file. A ‘back-up’ file in such a format can also be loaded. When the PC program first starts, it checks whether any of the ports COM1 through COM16 exist. The result is shown in a combobox after which the first available port is opened. With ‘Download’ you can retrieve the con- figuration and with ‘Upload’ you can load a configuration into the PIC. Using the software you can also set the type of output. There are four options: • Toggle: press once — > on; press again — > off. • Pulse: output active for about 262 ms. • Master: the same as Toggle, but when switching off all slaves turn off as well. • Slave: when switching on, the mas- ters also turn on, switching off is not possible. Multiple masters is possible, but whether this is useful is questionable. There is also a function for the middle button when in the idle state. Press- ing this button results in the code ‘OxEEEEEEEEEEEE’. When this button is programmed using the PC program (normal programming is not possible with this button), it can be used as the local control for an output. The table shows the protocol that has been used. For connecting the RS485 port to a PC the ‘Low-cost RS232-to- RS485 Converter’ in the January 2005 issue, page 69 is eminently suitable. ( 080063 - 1 ) Note: This circuit has not been tested the Elektor Laboratory. Internet Links [1] www.holger-klabunde.de [2] www.hdelectronics.nl 11/2008 - elektor 73 MINI PROJECT Water is vital for humans, but too much of it has an undesirable effect, particularly when it turns up in the wrong places. This is what two Elektor designers discovered after a blocked drain of a combination boiler and a leaking filter of an aquarium. This will quickly suggest the idea of designing a small circuit that will give a clear signal when this type of flooding occurs, in this case with a loud alarm. It is not always possible to prevent a water leak, of course. But in this case it is essential to discover it as quickly as possible. That is the purpose of this circuit: a clear warning when water appears somewhere where it doesn’t belong. What are the most important design criteria to keep in mind when design- ing a flood alarm? Seeing that it could be years, or hopefully never, before there is a leak, the circuit has to be al- ways ready and should not rely on the mains voltage. If the circuit is powered from batteries it is very important that the circuit has very low or no power consumption when everything is dry. To detect the water we make use the fact that (non distilled) water is con- ductive to an extent. The Design Water is a poor conductor then and consequently we should be able to measure a relatively large resistance between the two electrodes. The best way to do this is to make the gate of a MOSFET the input of our circuit. We prefer to measure with respect to ground, so we use a P-channel version for Tl, in the form of a BS250. This FET switches the oscillator that follows. When it is dry, Tl has to stay off. This is achieved with Rl. Cl prevents the circuit reacting to noise. With a value of 10 MQ the circuit is sensitive enough and the current that flows is less than one micro-ampere (1 /jA ). R2 protects the gate from high voltages (when the electrode it touched, for example) and forms in combination with Cl a low- pass filter, so that any AC (noise) volt- ages are filtered out and the oscillator that follows is switched cleanly. R3 en- sures that this oscillator is completely off (no current consumption at all). To minimise the power consumption when water is detected the (active) buzzer is intermittently turned on. The buzzer is activated for about 1 to 1.5 seconds every 10 seconds. The os- cillator that makes this happen is im- plemented with discrete parts. For this we chose an astable multivibrator with two transistors. The advantage of this is that one of these two transistors (T3) switches the buzzer and the buzz- er also functions as the collector resis- tor. C4 is necessary because most ac- tive buzzers (the version with a built-in oscillator that generates the bleeping noise) are a very noisy load. The buzzer that is used here, without a parallel ca- pacitor, prevented the operation of the oscillator (the buzzer remained on). The component values of the circuit around T2 and T3 have been designed with the specific requirements of this application in mind (highly asymmetric square wave) so that these values are quite different from the standard im- plementation. This is also why the off- time deviates from the value resulting from the standard formula that is nor- mally used to calculate the component values for this AMV. T3 is a Darlington device so that the base resistor R6 can be as large as possible. This ensures that C3 has a reasonable value. When the buzzer is not activated the collector resistor of T2 determines the largest share of the current consumption. During the time when the buzzer is activated, C3 has to be charged again. Since the time (R4XC3) required to recharge C3 is longer than the time set by R5XC2, the expected time of R6xC3 is there- fore shorter. The theoretical times in an optimal case may be calculated from In 2XR5XC2 and In 2XR6XC3. The expected time would have been 15 seconds, but has been reduced to 10 seconds by the combination of val- ues chosen for these components. In- creasing the value of C3 to lengthen the off-time does not work. R4 would have to be reduced by the same ratio and that would increase the current consumption. 74 elektor - 11/2008 Figure 1. The circuit comprises a detector section with a MOSFET and an astable multivibrator with two transistors. You could experiment with the value of R6, but make sure that T3 still switch- es on properly. The voltage drop will be around 0.8 V. For the ‘sensor’ for this water alarm you can use two short wires with the insulation stripped off. The circuit is sensitive enough to sense a drop of tap water on a table with the ends of the sensor wires. To prevent the circuit from drowning in a large pool of water and therefore won’t work properly any more, you can build it into an enclosure that floats. Alternatively you could mount the PCB, buzzer and battery on a block of polystyrene. The wires for the sensor can be pushed through the block and bent over on the underside. The block of polystyrene has to be big enough to carry the weight of the circuit, of course. A third possibility is to mount the circuit sufficiently high up in the room. The sensor can be connected to the circuit with twisted wires, prevent- ing them from picking up noise. Current consumption For the buzzer we used a type that can be found at Digi-Key, the CEP-2260A. This buzzer, at a power supply volt- age of 9 V, uses less than 5 mA. The actual buzzer that we have, used even less, only 4 mA. There are however 12- V buzzers that use 20 mA or more. Us- ing one of these would considerably reduce the amount of time that the alarm can remain active. The current consumption of our pro- totype averaged less than 0.5 mA, so with a standard 9-V PP3 battery rated at 500 mAh it will run continuously for 1,000 hours. If nobody has taken any action after the alarm has been going for 40 days, well then... Since the current consumption in the idle state is negligible (<1 ijA), there is a risk that the battery may leak after a few years. So keep an eye on the life expectancy of the battery and make sure it is mounted in the separate com- partment or a plastic bag, so should the battery leak, it cannot cause any damage. ( 071094 - 1 ) Advertisement Prototype & small series PCB specialists Order pooling CIRCUITS Simple online pricing Fast online ordering Clear online order tracking All services NEW ONLINE STENCIL See us at 11-14 NOV ELECTRONICA 2008 - A5-161 Call us: 020 8816 7005 Email: euro@eurocircuits.com www.eu rod rcu its.com On demand low pooling prices wide pooling choices 1-8 layers no tooling charges no minimum order from 3 working days 100% DRC verification full options service 1-16 layers UL marking 11/2008 - elektor 75 INFOTAINMENT PUZZLE M AY A Half'll I I vAOvJUr\L4 electronics touch This time of the year, a Hexadoku puzzle like the one printed here should provide low-cost mental entertainment for an evening or two. So go for it and try to enter the right hex numbers in the boxes. Send us your solution and 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 £249 and three Elektor SHOP Vouchers worth £40.00 each. We believe these prizes should encourage all our readers to participate! The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. PARTICIPATE! Please send your solution (the numbers in the grey boxes) by email to: editor@elektor.com - Subject: hexadoku 11-2008 (please copy exactly). Include with your solution: full name and street address. Alternatively, by fax or post to: Elektor Hexadoku Regus Brentford - 1 000 Great West Road - Brentford TW8 9HH United Kingdom - Fax (+44) 208 2614447 The closing date is 1 December 2008. PRIZE WINNERS The solution of the September 2008 Hexadoku is: 7A0FE. The E-blocks Starter Kit Professional goes to: Simon Williams (UK). An Elektor SHOP voucher worth £40.00 goes to: Colin Wilson (UK); Hannu von Essen (FIN); Jeff Debooy (AUS). Congratulations everybody! 4 E 0 6 F 3 C 9 D 5 F D 6 9 4 B 1 5 2 7 4 A B 7 2 3 A C 9 6 2 3 A 8 D 6 7 B 1 4 7 C 9 0 8 3 A E 3 8 E 6 1 4 F 7 6 4 B F D 1 5 8 A 5 8 0 6 B C 2 5 E 3 8 E B 9 0 8 F 7 C A 4 6 0 3 4 1 3 9 8 5 A 6 2 D 3 7 C F 4 0 9 B C 7 8 4 1 9 5 2 D E 6 9 E B 0 5 7 A 2 1 F (c) PZZL.com F 5 1 B E 7 9 3 A 0 D 8 C 4 2 6 4 6 8 C D 0 A 2 1 9 B F 7 3 5 E A 0 D E B 5 4 6 3 C 7 2 9 F 1 8 7 9 2 3 F 1 8 C 5 E 6 4 D B A 0 8 7 5 6 3 2 F 1 B A 4 9 E C 0 D C 1 3 D 8 B 7 A 0 F E 5 4 2 6 9 9 A B 0 4 E C D 7 2 3 6 1 5 8 F 2 E 4 F 0 9 6 5 8 D C 1 3 7 B A 6 3 F 1 9 D 2 8 C 4 A B 5 0 E 7 0 2 9 7 6 3 5 4 E 1 8 D B A F C E D A 8 1 C B 0 F 7 5 3 6 9 4 2 5 B C 4 7 A E F 9 6 2 0 8 D 3 1 1 F 0 A 5 8 3 E D B 9 7 2 6 C 4 B 4 6 9 C F 0 7 2 5 1 E A 8 D 3 D 8 7 2 A 4 1 B 6 3 0 C F E 9 5 3 C E 5 2 6 D 9 4 8 F A 0 1 7 B 76 elektor - 11/2008 INFOTAINMENT RETRONICS Tektronix 7D01 Logic Analyser (1978) Martin Cooke (United Kingdom) Back in the 7 0's when engi- neers were bread-boarding their designs using the new fan- gled microprocessors they soon found that the traditional diag- nostic tools were falling a lit- tle short of the job. Many found themselves in the equipment store rummaging in vain for an eight-chan- nel storage scope. In 1 973 Hewlett Packard announced their HP5000A logic analyser (US: ana- lyzer) which was a basic two-channel machine designed for use with combi- national logic and using LEDs to rep- resent digital levels. Tektronix had for a long time been using a modular approach to their oscilloscope designs; a scope chassis housed the CRT together with its high and low ten- sion supplies and a number of bays which accommodate plug-ins to amplify the input signal and generate the time- base. If you wanted more bandwidth or channels it was a simple job to swap the plug-ins. knob scrolls through the captured data. Storage options allow pre, post or centre trigger and a varia- ble data filter (up to 300 ns) helps to prevent false triggering when sampling in asynchronous mode. Voltage threshold for the logic under test is adjustable between ing aspect of this and most other early analysers; the test clips supplied have a habit of pinging off the 1C lead or shorting adja- cent pins. A much better solution is the spring peg type of 1C test clip which fits over the 1C body or With modern desk- top PCs clocking at several GHz you may wonder if there is still a place on the workbench for an analyser that can only manage a maximum asyn- chronous clock of 1 00 MHz, but for the majority of microcontrol- ler designs the unit has proved to be more than adequate. ( 080644 - 1 ) or as a map. It contains mem- ory to store data captured by the 7D01 as a reference which can then be compared with succes- sive captures to detect errors. Connecting to the circuit under test was always the most frustrat- Around 1976 Tek- tronix announced the type 7D01 logic analyser plug-in for their 7000 series oscilloscope chassis. The 7D01 can dis- play and store up to 1 6 channels of dig- ital data. Triggering options include a 16-bit word recogniser which is set up from a row of three-way switches (hi/lo/don't care) on the front panel. The word recogniser also has a BNC output on the front panel useful for triggering other test equipment. A cursor plus and minus 1 2 V. The DF2 display formatter in the left hand bay displays the cap- tured data as a 16-channel tim- ing diagram or as a state table in either binary, hex, octal (there is also an ASCII display option) better still is to design the PCB to include pin headers specifically for analyser connection. Lifting the side panels on this unit is something of a revelation; all of the gold plated connectors still retain their original lustre and the use of perforated aluminium panels allow optimum air circulation while pro- viding EMI shielding. A closer look shows a liberal use of the high speed Motorola MECL 10000 fam- ily of chips (includ- ing the 4Kxl data storage RAM) and reveals that all ICs and transistors from T092 up to T03 out- line are mounted on sockets. The build quality and atten- tion to detail verges on the obsessive and explains partly why Tektronix has such a good reputa- tion amongst repair and calibration engineers. With this build quality comes a price; in 1 979 the cost of the 7D01 and DF2 alone would have set you back over 1 1 ,000 US dol- lars, the price of a very nice car. All the operator manuals are famously com- prehensive and can be found on the Internet. 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 11/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. C S TECHNOLOGY LTD www.cstech.co.uk Low cost PIC prototyping kits, PCB's and components, DTMF decoder kits, CTCSS, FFSK, GPS/GSM, radio equipment and manuals. PCB design and PIC program development. DECIBIT CO.LTD. www.decibit.com • Development Kit 2.4 GHz • Transceiver nRF24L01 • AVR MCU ATmega168 WWW. elektor. com 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 hiii | ■ ■ an ■ ■ m ■ ■ ■ 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 FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk/PICProTrng.html and Assembly SXiwftw Programming Courses, Trttmfw Ud. 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. YOUR ELECTRONICS OPEN SOURCE http://dev.emcelettronica.com Website full of Projects and Resources for Electronics Engineers and DIY. • Tutorial • Flardware (Schematic - ~ & Gerber) ™ • Firmware (Asm & C) • Reference Design Everyone can submit a story as a useful source! 'Share for life' 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. [EC 78 elektor - 11/2008 products and services directory 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 m 1 pi f 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 WWW. elektor. com 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, distortion analyzer, LCR meter. Free to download and try. SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business, Showcase - a permanent feature of the magazine where you will be able to showcase your products and services. For just £220 + VAT (£20 per issue for eleven issues) Elektor will publish your company name, website 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 11/2008 - elektor 79 BOOKS, CD-ROMs, KITS & MODULES A world of electronics from a single shop! Communicating with CAN (October 2008) The CAN (Controller Area Network) protocol was originally developed for use in the automotive sector. It is now over 20 years old, but is still frequently used these days. It was specially designed for use in environments where you have a lot of electromagnetic interference. Despite the fact that the CAN protocol is a serial protocol, it can't just be connected to (the serial port of) a computer. The all-round USB-CAN adapter described in last month's Elektor is a compact and simple solu- tion. With the help of the accompanying software you can follow all data communications taking place and carry out operations such as filtering and storage at the flick of a (mouse) switch. PCB, portly populated Art. #071 120-71 • £54.90 • US$ 109.80 Elektor SMT Reflow Oven (October 2008) The Elektor SMT reflow oven will faithfully handle most if not all your soldering of projects using surface mount devices (SMDs). The oven is particularly suited for use not just in Colleges, workshops, clubs and R&D laboratories, but also by the ad- vanced electronics enthusiast. This pre- cious workbench tool is at home where SMD boards have to be produced to a variety of requirements on size, compo- nents and soldering materials. Size: 4 1 8x372x250 mm (16.5xl4.6x 10 inch) Art. # 080663-91 • £882.00 • US$ 1525.00 Reduced price till 1 November 2008: £799.00 • US$ 1450.00 DCC Command Station (September 2008) Electronics is making more and more in- roads into the domain of model trains. Trains are now controlled with digital codes, and in many cases the entire sys- tem can be operated from a computer. Elektor presents a design for the device that forms the heart of a digitally control- led model railway: the DCC Command Station. The computing power in this de- sign is provided by a highperformance ARM 7 processor. Kit of ports incl. programmed ARM module Art. # 070989-71 • £88.50 • US$ 177.00 Prices and item descriptions subject to change. E. & O.E 80 elektor - 11/2008 SAPS-400 (May 2008) With the SAPS-400 we offer a powerful, adjustable symmetrical supply that's ide- al for lightweight audio power amplifiers and happily sits in less than a quarter of the space taken by a comparable supply of conventional design. PCB, populated and tested , ready- mounted in aluminium U profile Art. # 070688-91 • £159.00 • US$318.00 DigiButler (May & April 2008) A low-cost home automation server based on a Freescale Coldfire 32-bit mi- crocontroller. The project has been de- signed with open source in mind and doubles as a powerful Coldfire develop- ment system using free CodeWarrior soft- ware from Freescale. DigiButler activates electrical appliances in and around the home, accepting on/off commands from a WAP phone, through an Ethernet net- work or via a webpage at an allocated IP address and with full access security. Kit of parts including SMD-stuffed PCB , programmed microcontroller , all leaded parts and CD-ROM containing both Elektor articles , TBLCF documentation , datasheets , application notes and source code files. Design your awn EMBEDDED UNUX CONTROL CENTRE 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 Universal Display Book !ii P C .MiiLi-SK l -L c (ri- "\ From LED to graphical LCD Universal Display Book for PIC Microcontrollers This book begins with simple programs to flash LEDs, and eventually by stages to use other display indicators such as the 7-seg- ment and alphanumeric liquid crystal dis- plays. As the reader progresses through the book, bigger and upgraded PIC chips are introduced, with full circuit diagrams and source code, both in assembler and C. A tutorial is included using the MPLAB progra- mming environment, together with the PCB design package and EAGLE schematic to enable readers to create their own designs. 192 pages* ISBN 978-0-905705-73-6 £23.00 • US$ 46.00 PIC Mi tro controllers ti m . r Urv^nrn Silent alarm, poetry box, night buzzer and more PIC Microcontrollers This hands-on book covers a series of exciting and fun projects with PIC micro- controllers. You can built more than 50 projects for your own use. The clear expla- nations, schematics, and pictures of each project on a breadboard make this a fun activity. The technical background infor- mation in each project explains why the project is set up the way it is, including the use of datasheets. Even after you've built all the projects it will still be a valuable reference guide to keep next to your PC. 446 pages • ISBN 978-0-905705-70-5 £27.95 • US$ 55.90 11/2008 - elektor 81 PRODUCT SHORTLIST, BESTSELLERS Computer Vision Principlm and tfV tactile Principles and Practice Computer Vision Computer vision is probably the most ex- citing branch of image processing, and the number of applications in robotics, auto- mation technology and quality control is constantly increasing. Unfortunately enter- ing this research area is, as yet, not simple. Those who are interested must first go through a lot of books, publications and software libraries. With this book, howev- er, 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 lor Electronics Engineer!:! i! mi plications 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 environment and the toolset it offers are discussed in detail. Each topic is accompanied by clear, ready to run code, and where nec- essary, 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 Modern technology for everyone FPGA Course FPGAs have established a firm position in the modern electronics designer's toolkit. Until recently, these 'super components' were practically reserved for specialists in high-tech companies. The nine lessons on this courseware CD-ROM are a step by step guide to the world of Field Pro- grammable Gate Array technology. Sub- jects covered include not just digital logic and bus systems but also building an FPGA Webserver, a 4-channel multimeter and a USB controller. The CD also con- tains PCB layout files in pdf format, a Quartus manual, project software and various supplementary instructions. ISBN 978-90-5381 -225-9 • £14.50 • US$ 29.00 Software Tools & Hardware Tips Ethernet Toolbox 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 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 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 / v Prices and item descriptions subject to change. E. & O.E 82 elektor - 11/2008 November 2008 (No. 383) £ USS Motorised Volume Pot 071135-41 ....Programmed controller ATMEGA8-16PU 5.90... 11.80 Speed Camera Warning Device 08061 5-1 Printed circuit board 15.50... 31.00 080615-41 ....Programmed controller PIC1 6F876A-I/SO 11.80... 23.60 Remote Control by Mobile Phone 080324-1 Printed circuit board 17.80... 35.60 080324-41 ....Programmed controller ATMEGA8-16PU 5.90... 11.80 080324-71 ....Kit of parts see www.elektor.com Tracking Hot Spots 080358-1 Printed circuit board 9.10... 18.20 ATmega meets Vinculum 071152-91 ....VDIP1 module 22.5... 45.00 October 2008 (No. 382) Communicating with CAN 071 1 20-71 .... PCB, partly populated 54.90... ...109.80 Elektor SMT Precision Reflow Oven 080663-91 .... Ready to use oven (230VAC only) 882.00 ... .1525.00 Multi-purpose GPS Receiver 070309-41 .... Programmed controller PIC1 8F2520 11.60... 23.20 ATM18 Relay Board and Port Expander 071 035-72 .... Relay PCB with all components and relays 36.90... 73.80 071 035-95 .... Port Extension PCB, populated with SMD 13.40... 26.80 RF Sweep Frequency Generator / Spectrum Analyser 040360-41 ....Programmed controller ATmega8535 21.80 ... 43.60 September 2008 (No. 381) DCC Command Station 070989-71 .... Kit of parts incl. programmed ARM module 88.50 177.00 July/August 2008 (No. 379/380) 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 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 AYR-ISP Compatible Programmer 0801 61 -41 .... Programmed controller ATmega8-l 6AU 1 1 .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 18.00 Solar-powered Battery Charger 080225-41 .... Programmed controller PIC1 2C671 9.00 1 8.00 Bestsellers F_„l IJ_J I! \ od 1 3 5 3 2 4 1 2 3 4 5 Embedded Linux Control Centre ISBN 978-0-905705-72-9 £24.00. US$ 48.00 PIC Microcontrollers ISBN 978-0-905705-70-5 £27.95. USS 55.90 Universal Display Book ISBN 978-0-905705-73-6 £23.00..... USS 46.00 Computer Vision ISBN 978-0-905705-71 -2 £32.00 .....USS 64.00 Visual Basic for Electronics Engineering Applications ISBN 978-0-905705-68-2 £29.95 .....USS 59.90 FPGA Course ISBN 978-90-5381-225-9 £14.50. US$ 29.00 ECD 4 ISBN 978-90-5381-159-7 £17.50. US$ 35.00 Elektor 2007 ISBN 978-90-538 1-218-1 £1 7.50 .....USS 35.00 Home Automation ISBN 978-90-5381-195-5 £13.90. USS 27.80 Ethernet Toolbox ISBN 978-90-538 1 -2 1 4-3 £1 9.50 .....USS 39.00 DigiButler Art. # 071102-71 £29.00 .....USS 58.00 SpYder Discovery Kit Art. # 060296-91 £9.00.... USS 18.00 DCC Command Station Art. # 070989-71 £88.50.. USS 1 77.00 Communicating with CAN Art. #071 120-71 E54.90...USS 109.80 SAPS-400 Art. # 070688-9 1 £ 1 59.00 ... USS 3 1 8.00 Order quickly and safe through www.elektor.com/shop or use the Order Form near the end of the magazine! Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH * United Kingdom Tel. +44 20 8261 4509 Fax +44 20 8261 4447 Email: sales@elektor.com 11/2008 - elektor 83 INFO & MARKET SNEAK PREVIEW Free Supplement: the i-TRIXX Collection If you hate those complex projects, rejoice! This year too, the December issue of Elektor comes with a 24-page supplement called i-TRIXX Collection. These free pages contain about 20 circuits supplied by the Elektor lab and selected free-lance contributing authors. This year's collection is again aimed at those of you starting out in electronics or on a modest budget. If you like scavenging components from the junk box, the circuits presented are just the ticket to making something quickly in an afternoon or so. Wireless HiFi Until recently, radio links were rare birds in the audio hi-fi scene, probably because of issues with the transmission quality. Some manufacturers did manage to bite the bullet however and now supply surround sound sets incorporating remote speakers on a wireless link. If it looked like high-quality audio transmission over RF is outside the realm of home construc- tion, new modules from Aurel make it all possible and Elektor (who else) is the first to come up with a tried and tested DIY project. Electronic Spinning Top A really impressive gadget, this electronic spinning top capable of displaying a text if you make it spin at good speed. A round circuit board with a diameter of about 70 mm accommodates a microcontroller, 2 button cells, 2 LED bars and a number of components. The earth's magnetic field is detected in an inge- nious way to enable the LEDs to be driven such that the toy actually produces legible text! Article titles and magazine contents subject to change, please check 'Magazine' on www.elektor.com The December 2008 issue comes on sale on Thursday 20 November 2008 (UK distribution only). UK mainland subscribers will receive the issue between 15 and 18 November 2008. w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektor. Elektor on the web All magazine articles back to volume 2000 are available online in pdf format. The article summary and parts list (if applicable) can be instantly viewed to help you positively identify an article. Article related items are also shown, including software downloads, circuit boards, programmed ICs and corrections and updates if applicable. Complete magazine issues may also be downloaded. In the Elektor Shop you'll find all other products sold by the publishers, like CD- ROMs, kits and books. A powerful search function allows you to search for items and references across the entire website. Also on the Elektor website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Surveys and polls • FAQ, Author Guidelines and Contact - Choc* »n wim Z M Inform. live #rtide* w h-eject* Unlcyde-rlding robot Elektor SMT Renow Oven demo on YouTube Ren<»»: Low eo»t tew pin cow* n.**. microcontroller NLX9C614 rtrored thermometer v Books CIcMor October 2008 Go with th« Reflow 22 V CD-ROM* v Kits l Module* M Clocks wKh v Controller. V M^oono. V Offer. V f lektcrr Credit* W tubierrpuon* Elektor'* 2008 October Issue can be downloaded! The downloadable ver*«n not oner *evo* you time or* money but alto offer* lull lot search options g pa per Works two Maste-ciass [cjrents for reflow soldering :: IWfajrte Assess Identification New book Mlling machii from a kit ClekSor LeKtreniX free MAI Rfee*e enter rdv> email address: before subm.i*.-.} guestrons, please review our fAQ section’ 84 elektor - 11/2008 Description Price each Qty. Total Order Code Universal Display Book for PIC Microcontrollers Design your own Embedded Linux Control Centre on a PC CD-ROM FPGA Course £14.50 Computer Vision £32.00 PIC Microcontrollers £27.95 (323 (323 £23.00 £24.00 Free Elektor Catalogue 2008 Prices and item descriptions subject to change. The publishers reserve the right to change prices without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Sub-total P&P Total paid Name Address + Post code Tel. Email Date - - Signature EL1 1 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 EL1 1 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* (see reverse for conditions) Elektor Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com sales@elektor.com *USA and Canada residents may (but are not obliged to) use $ prices, and send the order form to: Elektor US PO Box 876 Peterborough NH 03458-0876 Phone: 603-924-9464 Fax: 603-924-9467 E-mail: custservus@elektor.com METHOD OF PAYMENT (see reverse before ticking as appropriate) Bank transfer | Cheque (UK-resident customers ONLY) □ Giro transfer 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 Suppliers uf PGB Soldering Bguipment & Rework Stations L-XZ— I NEW IN STOCK ^ 328 Working Platform /£je£I Kn ii-Kiurl^ Hri \*!-Guh <■■■ AH JDW^okltfingifiin wflhFumc i^feOTibcr n 1i toeing ftn ialck *1rg 'eviT p .. .ih-Htsir ngLIrn. r: V*t .-nrc 1 ! Vji I n :- i ?r-n ik.hr Pad 1C FtenunaJ Toof 2KCV&WFaiWS Online Pike £1 39,95 j 2W0 7dW SoleterFng SUticn Online Price £74.95 Soldering Iron Tips & Air Nettles Wide Selwion ri.V J ildLJL 1 Online Pike £69.95 Hot Tweezers & Station I 710 Infrared Welding Station i" w Online Pike £44 95 Online Price £ 7 50.00 Test-pins.co.uk Ei ipffo** i y T#rf-p4M. ROTtpfert^i i PiDtmi m For Test-pin s £ Prnfws Visit WWW,f#5^piri5,tQMk Abort Obtoui^ code 3 sc- ap&is& ww w.pcb-so I cferi ng.co.uk E!flC!r^HIICiH4^3 M^fltsdCWlftdyniielCeOEre. a *44 I0.il 941? 4W/W V*' w*’* p£&-po4*ring ^ gh, P : -1 d * i ^oi3. H&ddcjdon . Hcrcfardihir* EM I ftfF F +44 |G| 1592 4 507(3 i E s-Din-ii^pcb-uydtmg 03 . lH. Index of Advertisers Allendale Electronics Ltd www.pcb-soldering.co.uk 87 Antex Electronics Ltd www.antex.co.uk. 15 ATC Semitec Ltd, Showcase www.atcsemitec.co.uk 78 Avit Research, Showcase www.avitresearch.co.uk 78 Axxess Identification Ltd www.axxessid.com 21 Beijing Draco i/iww.ezpcAcom 41 Beta Layout, Showcase www.pcb-pool.com 15, 78 Bitscope Designs www.bitscope.com 11 BVM www.bvmltd.co.uk 29 C S Technology Ltd, Showcase i/iwi/i/.cstecAco.y/c 78 Decibit Co. Ltd, Showcase i/iwwdec/M.com 78 Designer Systems, Showcase www.designersystems.co.uk 78 EasyDAQ, Showcase www.easydag.biz 78 Easysync, Showcase www.easysync.co.uk. 78 Elnec, Showcase www.einec.com 78 EMCelettronica Sri, Showcase www.emcelettronica.com 78 Eurocircuits www.eurocircuits.com 75 First Technology Transfer Ltd, Showcase . . www.ftt.co.uk 78 FlexiPanel Ltd, Showcase www.flexipanel.com 78 Future Technology Devices, Showcase. . . . www.ftdichip.com 78 ILP Electronics Ltd, Showcase www.ilpelectronics.com 78 Labcenter www.labcenter.com. 88 London Electronics College, Showcase . . . www.lec.org.uk 79 MikroElektronika MQP Electronics, Showcase. . Newbury Electronics Nurve Networks Paltronix Parallax Peak Electronic Design Pico Propox Sp Quasar Electronics Radiometrix, Showcase Robot Electronics, Showcase. Robotiq, Showcase RS Components ScanTool, Showcase Showcase USB Instruments, Showcase . Virtins Technology, Showcase www.mikroe.com 3 www.mqp.com 78 www. newburyelectronics. co.uk 21 www.xgamestation.com 21 www.paltronix.com 13 www.parallax.com 29 www.peakelec.co.uk 15 www.picotech.com 2 i/i/i/i/i/i/.propox.com 17 www.quasarelectronics.com 51 www.radiometrix.com 79 www.robot-electronics.co.uk 79 www.robotiq.co.uk 79 www.rswww.com/electronics 17, 29, 41 www.obd2cables.com, www.scantool.net . . . .79 78, 79 www.usb-instruments.com 79 www.virtins.com 79 Advertising space for the issue of 15 December 2008 may be reserved not later than 18 November 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. 11/2008 - elektor 87 than All levels of the Proteus Design Suite now include a world class fully integrated shape based autorouter at no additional cost. The Proteus Design Suite also incorporates ■ Professional schematic capture ■ Highly confi ■ Publication quality schematics ■ Interactive c ■ Fully configurable bill of materials ■ Polygonal a ■ Large component libraries for both ■ RS274X, E) simulation and PCB layout database e> Mixed mode SPICE circuit simulation 3D Viewer v ■ Co-simulation of PIC, AVR, 8051 and an d DXF ex ARM7 microcontroller firmware ■ Automatic component placement and gateswap optimization Prices start from just £1 50 - visit our website for full details or to download a free demo. Electronics Labcenter Electronics Ltd. 53-55 Main Street, Grassington, North Yorks. BD23 5AA. Registered in England 4692454 Tel: +44 (0)1756 753440, Email: info@labcenter.com exc. VAT & delivery