www.elektor.com NOVEMBER 2007 £ 3.80 R47 770268 45112 G t adv for Christmas ith\the^e G\RE^T A^didj Kits Top Selling AUDIO/VIDEO Kits •ORDER ON-LINE 1 •ALL PRICING IN POUND STERLING •MINIMUM ORDER ONLY £10 IR Remote Control Extender MKII KC-5432 £7.25 + post & packing Operate your DVD player or digital decoder using its remote control from another room. It picks up the signal from the remote control and sends it via a 2-wire cable to an infrared LED located close to the device. This improved model features fast data transfer, capable of transmitting Foxtel digital remote control signals using the Pace 400 series decoder. Kit supplied with case, screen printed front panel, PCB with overlay and all electronic components. Requires 9VDC wall adaptor (Maplin #GS74R £10.99) 4 Channel Guitar Amplifier Kit KC-5448 £28.75 + post & packing This is an improved version of our popular guitar mixer kit and has a number of enhancements that make it even more versatile. The input sensitivity of each of the four channels is adjustable from a few millivolts to over 1 volt, so you plug in a range of input signals from a microphone to a line level signal from a CD player etc. A headphone amplifier circuit is also included for monitoring purposes. A three stage EQ is also included, making this a very versatile mixer that will operate from 12 volts. Kit includes PCB with ove con Universal Stereo Preamplifier Kit KC-5159 £5.25 + post and packing Based around the low noise LM833 dual op-amp 1C, this preamp is designed for use with a magnetic cartridge, cassette deck or dynamic microphone. It features RIAA/IEC equalisation, and is supplied with all components to build either the phono, tape or microphone version. • Measuring only 80 x 78 x 30mm, it is ideal for incorporating into existing equipment and is hence supplied short form of PCB and specified components ^ plus PCB standoffs for mounting. • +/- 15VDC required overlay & all electronic components. 1 Theremin Synthesiser Kit KC-5295 £14.75 + post and packing The Theremin is a weird musical instrument that was invented early last century but is still used today. The Beach Boys' classic hit "Good Vibrations" featured a Theremin. By moving your hand between the antenna and the metal plate, you create strange sound effects like in those scary movies! Kit includes a machined, silkscreened and pre drilled case, circuit board, all electronic components, and clear English instructions. Requires 12VDC wall adaptor (Maplin #GSR74R £9.99) Smart Card Reader and Programmer Kit KC-5361 £15.95 + post & packing Program both the microcontroller and EEPROM in the popular gold, silver and emerald wafer cards. Card used needs to conform to ISO-7816 standards, which includes ones sold by Jaycar. Powered by 9-12 VDC wall adaptor or a 9V battery. Instructions outline software requirements that are freely available on the internet. Kit supplied with PCB, wafer card socket and all electronic components. PCB measures: 141 x 101mm. Requires 9-12VDC wall adaptor (Maplin #UG01B £13.99) Build-Yourself Electronic Project Kits Looking for a particular KIT? Checkout Jaycar’s extensive range. We have kits and electronic projects for use in: • Audio & Video • Car & Automotive • Computer • Learning & Educational • Lighting • Power • Test & Meters • General Electronics Projects r 430+ page g -just for fun! IaLL prices in Jaycar cannot accept responsibility for the operation of this device, its related software, or its potential to be used in relation to illegal copying of smart cards in cable TV set top boxes. Post and Packing Charges Order Value Cost Order Value Cost £10 - £49.99 £5 £200 - £499.99 £30 £50 - £99.99 £10 £500+ £40 £100 - £199.99 £20 Max weight 121b (5kg). Heavier parcels POA. Minimum order £10. Note: Products are despatched from Australia, so local customs duty and taxes may apply. How to order: Phone: Call Australian Eastern Standard Time Mon-Fri on 0800 032 7241 Email: techstore@jaycarelectronics.co.uk Post: PO BOX 6424, Silverwater NSW 1811. Australia Expect 10-14 days for air parcel delivery Accessories PCB Holder with Magnifying Glass TH-1983 £3.75 + post and packing Anytime you need that extra bit of help with your PCB assembly, this pair of helping hands will get you out of trouble. With a 90mm magnifying glass, it also \ r , * provides an extra pair of eyes. • Size: Base: 78 x 98mm • Height: 145mm Resistance Wheel RR-0700 £5.75 + post and packing Convenient resistance selection. Select from 36 values from 5 ohms to 1M ohms. • Comes complete with leads and insulated crocodile clips. • Uses 0.25W resistors with 5% tolerance Component Lead Forming Tool TH-1810 £2.00 + post and packing Get the hole spacing for your resistors and diodes perfect every time. This handy forming tool provides uniform hole spacing from 10 to 38mm. Suitable for production assembly, education and training. The tool is double sided with one side for use with D047 outline diodes (eg 1N91 4) and 1W zener diodes; the other side being suitable for 1/5W resistors, D041 outline diodes (eg 1N4004). An incredibly handy tool! Logon to website for more service aids. A Magnifier Headset QM-3510 £8.50 + post and packing Minimising eyestrain while leaving your hands free this headset gives a wide field of vision, can be worn over prescription eyeglasses and can be tilted up out of the way when not in use. Four different magnifications, lightweight, excellent for close work. Check out the Jaycar range in your FREE Catalogue - logon to www.jaycarelectronics.co.uk/elektor or check out the range at www.jaycareiectronics.co.uk 0800 032 7241 (Monday - Friday 09.00 to 17.30 GMT + 10 hours only) For those who want to write: 100 Silverwater Rd Silverwater NSW 2128 Sydney AUSTRALIA jnycnr 2007 Portable Power Design Seminar December 5, 2007 To register, and for additional information, visit: www.ti.com/portable-power-ekt-uk HIGH-PERFORMANCE ANALOG YOUR WAY * Texas Instruments Technology for Innovators j lektor electronics worldwide The human factor The other week, during a seminar on CAD and electronic simulation, organised jointly by Elektor and National Instruments Electronics Work- bench Group, I had an opportunity to have a chat with a couple of Elektor readers. We were joined by two Multisim 10 experts and marketing staff from National Instruments. As the conversation went on, it dawned upon me that especially younger elec- tronics enthusiast are in real danger of becoming socially isolated because so many things can be done with just a PC and a pizza as companions in the ongoing quest called circuit de- sign. Now although the PC is a great tool and a good (if not essential) investment, be it for making a living from electronics, or just curious to ex- plore the field, it will only beep at you occasionally, or produce arcane error codes like runtime error -6001 . Electronics is learned from books, magazines, components trays and living people. Give it a try, you will find them friendlier, more forgiving and inspiring than the average PC with Internet and a host of CAD stuff installed on it. Talking to an older engineer is like opening the pages of an encyclopaedia. Another great place to learn about electronics in a very practical way seems to have disappeared comple- tely: old Rupert's electronic parts retail shop, where you could enjoy the shoptalk while waiting to be served, scribbled parts lists in hand. I learned 'compospeak' in such shops, and after a while became conversant with terms like trannies (transistors), O/P and I/P (output and input), duds, caps, HT (high tension), DOA (dead on arrival), toasted, blown up and plans. Funny to see that many of these terms are still used; you see them occasionally in newsgroup messages where they reveal the age of the author. In the old shops, it was not uncommon for customers to help each other as well as the assistant behind his till with any bit of information or gossip they were willing to share. For example, designs that were 'no good', or an interesting type code for a 'super replacement part — cheaper, too'. Although much more conversation on electronics is going on these days in newsgroups and forums, the tone is sometimes flippant or aggressive, and from reading these messages I often get the impression that people lack the spirit of those that enabled electronics as an educational pastime to run cheer- fully alongside all things professional, and continue to exist to this day. This advanced board for connection to the USB has eight digital outputs, * eight digital inputs, two 10-bit analogue out- puts and eight 10-bit analogue inputs for volta- 1 ge swings of 0 to 5 V. The system's core is a Mi- crochip USB-sawy microcontroller type PIC18F4550. Good news: the micro is housed in a DIP40 case, and programmed In C. A « Hl tfjfl i * 1 L - * ^ > A L L. * A 22 USB Flash Board This versatile Flash Board is built around an AT89C51 31 A, which is an extended 8051 -family microcon- troller with an 80C52 core and a Full Speed USB port. As a sort of bonus, the 1C has a complete update interface for downloading new firmware. Atmel also provides suitable software in the form of its FLIP program, which is available free of charge. Jan Buiting, Editor CONTENTS Volume 33 November 2007 no. 371 The Challenge On the bench is a notebook with an Intel processor and the specifications mentioned in this article. Manage to keep this 'unplugged' notebook run- ning for half an hour and you have a chance of winning a notebook PC or one of five Netgear Rangemax wireless routers. Be creative! projects 16 USB Data Acquisition Card USB Flash Board 28 Line Switcher 34 Headphone Amp with 3D Sound 45 Stay Tuned to G8JCFSDR 46 Low-cost Heating Controller 60 E-blocks Tachometer/Timer 68 Mesmerising Images 42 Stay Tuned to G8JCFSDR The G8JCFSDR soft- ware in conjunction with simple down-con- verter hardware like Elektor's May 2007 SDR (the best, and a real blockbuster) provi- des an extremely cost- effective, incredibly flexible and versatile receiver combination. technology 38 Tivoli — i lov' it 40 The Challenge 64 Rapid Manufacturing for Electronics Enclosures info & market 6 Colophon 8 Mailbox News & New Products Handiwork (soldering & etching) 46 Low-cost Heating Controller This article describes the construction of a flexible, programmable heating control unit which takes into account the outdoor tempe- rature. It's pretty intelligent, using state of the art electro- nics around an ATmega32 microcontroller. 56 Developing a Prototype 58 Hydra Game Development Kit Log icSim (review) 80 ElektorSHOP Sneak Preview infotainment 76 Hexadoku 77 Retronics Philips type ESC 'Semafoon' Pager (1962) 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. lektor i — *■ * T ''I s Volume 33, Number 371, November 2007 ISSN 0268/4519 Elektor Electronics aims at inspiring people to master electronics at any personal level by presenting construction projects and spotting developments in electronics and information technology. Publishers: Elektor 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: Mat Heffels (m.heffels@elektor.nl), Wisse Hettinga (w.hettinga@elektor.nl) Editor: Jan Buiting (editor@elektor.com) International editorial staff: Harry Baggen, Thijs Beckers, Ernst Krempelsauer, Jens Nickel, Guy Raedersdorf. Design stc Antoine Authier, Ton Giesberts, Paul Goossens, Luc Lemmens, 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/2007 A world of electronics from a single shop Brand new shop pages in Elektor! Books Highlights from the Elektor's book portfolio. Not just the latest titles but also top selling publications from the past. Elektor has books on a wide variety of subjects! r V CD-ROMs Our digital media collection. Software, hardware, education and, of course, lots of Elektor magazine articles! Nearly all disciplines from the wide fields of electronics and information technology are represented. r Kits & Modules Whether you prefer to build up boards for yourself, or enjoy the ease of a ready-made module, Elektor supplies a kit of parts or a ready-populated and tested board with many projects published in the magazine. We leave the choice up to you! Also monthly in the restyled Elektor Shop: • Bestsellers: listing the five top selling publications for each medium • Product Shortlist: printed circuit boards, software and microcontrollers arranged by month of publication • Ordering Info: fast and easy ordering via Elektor's online shop or the Order Form in the magazine a r^llektor Go to page 80 to see all the enhancements! 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.brady@husonmedia.com Internet: www.husonmedia.com Advertising rates and terms available on request. International Advertising Frank van de Raadt, address as Head Office Email: advertenties@elektor.nl Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photographs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software carri- ers and article texts published in our books and magazines (other than third-party advertise- ments) are copyright Segment, b.v. and may not be reproduced or transmitted in any form or by any means, including photocopying, scanning an recording, in whole or in part without prior written permission from the Publishers. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protec- tion may exist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publishers to alter the text and design, and to use the contents in other Segment publications and activities. The Publishers cannot guarantee to return any material submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media B.V. 2007 Printed in the Netherlands 11/2007 - elektor 7 INFO & MARKT MAILBOX Elektor Electronics worldwide Dear Sir — I have just copy of Elektor October 2007 no. 370 and was very interested to read the 'Elektor electronics worldwide' article on page 16 detailing the growth of Elektor over the years. Working with so many languages in this highly technical area must re- quire dedicated top notch people. I have a complete English edition set. Yes all 370 issues of the English language edition of Elektor which sit proudly on my bookcase in Elektor bind- ers providing perhaps a unique history of the development of electronics with associated projects. While this collection is probably not unique I did get each one at the time of issue and each has been read, and reread, and many projects, big and small, have been completed using the information contained therein, all with much associated pleasure. At the beginning very small projects. Even now, after all these years, I can still remember the enormous thrill and surprise at hear- ing, for the first time, the sound from a very small speaker of a transistor based astable multivibrator built using very few components. It worked and it was magic. But Elektor taught me that is wasn't. But you know what I mean. The photograph of issue no. 1 from December 1 974, with its tangled mass of components on the front reminded me of a thought from the time - "That will never work!" But it in no way reflected the quality of what was inside the magazine both then and ever since. The caption by the picture notes that it's bound to appear on Flog It. I have no such plans. My difficult decision is which one of my two sons will eventually get my Elektor collection and which one will get the house hopefully in many years time and after many more Elektorsl Keep up the great magazine and thanks. Terry Lad brook Thank you for your kind words about our magazine. Here at Elektor central offices I am the keeper of all magazine issues published since no. 1. The collection was in danger of getting lost or destroyed several times as the company moved to different places. I also have one copy of every book , booklet and CD Elektor published over the past 34 years. received my subscription SJ-;u-«aiO uiiHL. iron ics Ipr \hq eno ifitSuTCj lUBHTKir 1 Surely these are important factors, especially for measu- ring class-D amplifiers with LC output filters. S. Tantikovit (by email) You are right - this information is certainly useful for properly assessing the measured results. The bandwidth of the analyser used to make the THD measu- rements was 80 kHz , and all amplifiers were operated with a 4-ohm load for the bandwidth measurements. Amplifier modules test (2) Hello dear Editor — each month I look forward to read- ing your magazine, and no difference this time with the September 2007 issue. It start- ed good, and right up to the article about audio amplifier modules it became interesting, but then: what the beep, -No word whatsoever on or about the innovative ICE Power block from B&O in Denmark. I'm astounded and still gasping for air :-). In an article like that, how could you overlook/avoid the ICE Power blocks? Klavs Rommedahl (Denmark) We did not overlook the ICE po- wer blocks for our article , but as far as we know these modules are only available to equipment manufacturers. In our overview we only tested modules which are available to private persons for home use. Amplifier modules test (1) Dear Jan — I found your test of eleven audio amplifier modules in the September 2007 issue very interesting. On exami- ning the measured results, I noticed that the bandwidth of the analyser used to make the THD measurements was not stated. In addition, the load at which the power band- width of the amplifiers was measured (4 ohms or 8 ohms) was not stated. Magnetometer LEDs Dear Editor — the magneto- meter design published in the May 2007 issue is indeed extremely sensitive, but with my unit LED #10 is the most sensitive, while LED #1 is the last to light up. According to the text, this is not what I would have expected. Am I missing something here? J.U. Lummerzheim (Germany) 10 —1 LU + > C/5 o LED10 IN S LED9 DIV HI LED8 REF OUT LED7 IC4 LED6 LED5 LM3914N LED4 REF ADJ LED3 LED2 o _i > LED1 a > Your circuit is working properly. LED D10 (connected to the LED1 output of the LM3914) is simply a supply voltage indicator (as mentioned in the text), and it is always on. The actual LED indi- cator scale starts at the bottom with D9 (connected to the LED2 output of IC4) and ends with D1 (connected to the LED10 output of the LM3914). We must admit that it would have been more lo- gical to assign the LEDs compo- nent numbers corresponding to the sequence of the 1C outputs. Different LC displays in the battery charger Dear Jan — the Charge-'n- Check battery charger in the April 2007 issue of Elektor uses a 'standard' LC display with two lines of 16 charac- ters. Despite the large number of manufacturers and sources of such displays, there are usually not any problems with compatibility. But as the saying goes, the exception proves the rule. I built the battery charger using a perfectly ordinary 2-line display (purchased from Burklin), but only one line was active on my display. At first, I looked for the cause of the problem in the software (timing problems), but the program 8 elektor - 11/2007 LCD_Init(); // init LCD Here is the initialisation routine in LCD . C : void LCD_Init (void) { LCD_Timer =50; // 100 ms timeout SetBit (LCD_Flag, LCD_OK) ; while (chk_busy() == TRUE) { if (LCD_Timer == 0) { Beep_LCD_Fault () ; } } /* Modified in the program */ LCD_send_inst_spez () ; LCD_send_inst (LCD_ON) ; LCD_send_inst (LCD_Clear) ; } /* Modified in the program */ void LCD_send_inst_spez (void) { int i ; /* First initialise the display in 8-bit mode: send 1 command to the display */ BitClr (RW) ; data_bus_load ( (u8 ) (0x20>>4)); // Select 4-bit communication protocol BitClr (RS) ; BitSet (E) ; Nop ( ) ; BitClr (E) ; BitSet (RS) ; for ( i = 0 ; i< = 255 ; i + + ) Nop ( ) ; // Delay /* Second initialisation in 4-bit mode: send 2 nibbles to the display */ BitClr (RW) ; data_bus_load ( (u8 ) (0x28>>4)); // 4-bit communication protocol BitClr (RS) ; BitSet (E) ; Nop ( ) ; BitClr (E) ; BitSet (RS) ; data_bus_load ( (u8 ) (0x28&0x0f ) ) ; // 1 line BitClr (RS) ; BitSet (E) ; Nop ( ) ; BitClr (E) ; BitSet (RS) ; while (chk_busy ( ) == TRUE) {}; } worked perfectly. The problem could not be due to the display module, because two other compatible displays behaved exactly the same way in the battery charger, while all three displays worked flawlessly in other circuits. I also conside- red an error in the firmware, which was developed by a pro (Florent Coste) and tested in the Elektor lab, to be out of the question. I was thus left with no other choice than to assemble the display with the microcontroller in a separate circuit and check things out with a small test program. Although the hardware was very fast in this configuration, using the development envi- ronment for the ST7FMC2S4 (including the emulator) was quite a challenge. Using this test setup, I finally managed to get the display to work properly with the ST7FMC2S4 in 4-bit mode. At this point, I had narrowed the problem down to the point that everything pointed toward a bug in display initialisation. After carefully studying the pro- gram, I discovered the display initialisation routine and found that the first command it sends to the display in 4-bit mode is a 4-bit initialisation command. However, in a data sheet for a similar display I had read that the first command must be an 8-bit command. Now what can you do when you only have four lines available? The command for initialising the 4-bit mode is 28H. The 4-bit mode is selected by 20H, while 28H selects the 4-bit mode with two-line display mode. I thus had the idea of first using a write instruction to issue the 20H command. With '2' in the upper four bits and the lower 4 bits tied to ground and thus equal to 'O', this would be the same as an 8-bit 20H command. The 28H com- mand could then be sent to the display by two subsequent write instructions, followed by the other commands (each in two parts as well). And voila: after the modified program was downloaded to then microcontroller of the battery charger, the display worked properly with two lines. My suspicion that the author (Florent Coste) must have used a display that does not exhibit this problem was confirmed by a call to him. The display he used in his prototype was a Wintek WM-D1 602Z-1 GNNa, which has a pure 4-bit inter- face. In my case, the display was a MDLS16265SS, which has a 4/8-bit interface. The widely used 4/8-bit display modules are used fitted with a KS0070B or HD44780UA 1C as an LCD controller. As already mentioned, the display is initialised with the 28H command, where 20H represents initialisation in 4-bit mode and the fourth bit (with bit numbering 1-8) selects the 2-line mode if it is set high. Based on my research, the 4/8-bit display first needs an 8-bit 20H initialisation com- mand to place it in 4-bit mode. After this, the command for the 2-line mode (28H) can be transferred using two half-byte commands (since the lower four bits of the display are tied to ground). Consequently, all the program has to do is to issue a 20H command as a 1- byte command before it issues the 28H command. The instruction (see box), which is located in the main .c routine, calls the initialisa- tion routine LCD.C. However, these changes can only be implemented if the microcontroller has a program- ming interface (see photo) so the program can be modified. The JTAG interface is des- cribed in Section 4.4 (Data Interface) of the data sheet for the ST7MC1/ST7MC. A JTAG interface such as in DART from SofTec Microsystems (www.softecmicro.com/ pro- ducts. html? type=browse& title=ISP+Debuggers/ + Prog rammers) can then be used to reprogram the microcontroller. Jurgen Rieger (Germany) 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/2007 - elektor 9 INFO & MARKET NEWS & NEW PRODUCTS Two-channel 120-W Class D audio amp reference design International Rectifier introduced the IRAUDAMP4 Class D audio power amplifier reference design. Compared to typical circuit de- signs, the new reference design illustrates how designers can re- duce PCB board space by 50 per- cent for Class D audio amplifiers for the entire mid-voltage range of mid- and high-power amplifiers for home theatre applications, profes- sional amplifiers, musical instru- ments and car entertainment. Showcasing I R's IRS20955 200- V digital audio driver 1C and the IRF6645 DirectFET® digital audio MOSFETs, the IRAUDAMP4 ref- erence design is a two-channel, 120 W half-bridge design offer- ing 96% efficiency at 1 20 W, four ohms. The design incorporates critical protection features such as over-current protection, over- voltage protection, under-voltage protection, DC-protection, and over-temperature protection, in addition to housekeeping functions such as a ±5 V supply for analog signal processing for the pream- plifier and a +12V supply (Vcc) referenced to -B for the Class D gate driver stage. The two-channel design is scalable for power and number of channels, and requires no heatsink under normal operat- ing conditions. The IRS20955(S)(TR)PbF audio driver 1C, on which the reference design is based, features a floating PWM input designed specifically for Class D audio amplifier appli- cations. Bi-directional current sens- ing detects over-current conditions during positive and negative load currents without any external shunt resistors. A built-in protection con- trol block provides a secure protec- tion sequence against over-current conditions and a programmable reset timer. The internal deadtime generation block enables accurate gate switching and optimum dead- time setting for better audio per- formance, such as lower THD and lower audio noise floor. The featured companion IRF6645 power MOSFETs are part of IR's DirectFET family. The innovative DirectFET packaging technology enhances performance in Class D audio amplifier circuits by reduc- ing lead inductance to improve switching performance and re- duce EMI noise. The higher ther- mal efficiency enables 1 20 W op- eration into four-ohms, eliminating the need for a heatsink to shrink circuit size, provide greater layout flexibility and reduce overall ampli- fier system cost. www.irf.com (070679-VI) Semiconductor Wiki Microchip announces ICwiki — a website that enables engineers to collaborate and share information re- lated to semiconductor products, applications and best practices. Using Wiki technol- ogy, participants can change content on the site and participate in web logging ('blog- ging'), voting and mes- saging. ICWiki is avail- able in several different languages, including English, Chinese, Japa- nese, French, German, Italian, Portuguese, Rus- sian and Spanish. Following recent trends toward online social networking, ICwiki was designed to help engineers share knowledge about designs and applications, as well as help- ing university students gain access to knowledge that can help bridge their transition from academia to industry. Participants can work to- gether in either public or private blogs via the site's Group Decision Support Systems (GDSS) feature. Subject areas on the new Wiki in- clude particular market areas such as automotive, home appliances and robotics; functional topics such as algorithms, oscillators, PCB lay- out best practices and signal conditioning; and product topics such as microcontrollers, Dig- ital Signal Controllers (DSCs), analogue and memory products. The new ICwiki, whilst promoting links between academia and industry, also forms an important part of the 'University of Microchip'. This is Microchip's education and training program, not only supporting universities all around the world, but also en- compassing training provision in Regional Training Centers (RTCs) worldwide, at Micro- chip's MASTERs confer- ences and in online De- sign Centers. www.microchip.com/ICwiki (070679-VIII) 10 elektor - 11/2007 Environmentally friendly alternative to ionisation detectors In response to the trend for an in- creasing number of modern materi- als to generate a fast, flaming fire, System Sensor Europe extends its product portfolio of high perform- ance addressable fire detectors with the introduction of PTIR; the Photo Thermal Infra-Red detector. PTIR has been developed specifi- cally to provide an efficient and en- vironmentally benign alternative to the venerable ionisation detector, a 60-year-old technology. Until the introduction of the PTIR, ionisation technology was the most respon- sive and stable detector available for the rapid detection of fast flam- ing fires; however, it contains small amounts of radioactive material, so manufacturing, transport and end of life disposal costs have rightly in- creased in response to environmen- tal concerns. Indeed, many coun- tries now forbid their use complete- ly and the great majority will only approve their use when an effective alternative is not available. PTIR consists of independent photo- electric, thermal and infrared sen- sors, managed and controlled by sophisticated algorithms running on an embedded processor. The addition of the IR sensor to the es- tablished photo-thermal multi-sensor design increases the unit's perform- ance to the point where it can be used to replace the environmentally unfriendly ionisation detector without degradation in speed of response or increased false alarm frequency. PTIR, in common with all System Sensor devices, is an environmen- tally friendly detector, meeting the WEEE and RoHS legislative re- quirements even though they are not mandatory in the fixed installa- tion fire industry. By not using any environmentally hazardous materi- als, the widespread adoption of the PTIR as a high performance replace- ment for the ionisation detector will immediately reduce the amount of hazardous material contaminating an increasingly fragile world. www.systemsensoreurope.com (070679-IX) Fanless PanelPC for embedded applications For use in embedded applications such as machine control panels, parking ticket machines, kiosks, mobile and marine applications and advertising displays, BVM has introduced the OPC-363-84, a cost-effective fanless PanelPC com- plete with an 8.4" touch screen and VGA display. The standard unit uses four-wire touch screen technology with an optional heavy duty capacitive touch-screen avail- able for systems designed to be operated by the public. The standard unit is configured around an AMD Geode GX533 CPU with an LVDS connection to the 800x600 LCD panel. This produces 262 kcolours at a con- trast ration of 500:1 and a bright- ness of 450cd/sqm making it ideal for use in many different environments. The PC has up to 5 1 2 MB of RAM and an on-board VGA controller, which can be used to drive a sec- ond display, audio and dual LAN interfaces. A laptop style 40 GB HDD installed as standard can be substituted for a solid state device if required. Alternatively the Com- pactFlash socket can be used as the storage medium. An on-board Mini-PCI site and PCMCIA socket can provide a wireless LAN or other specialised interfaces. The OPC-363-84 is powered from 1 2 VDC with power consump- tion is a miserly 10W and no forced cooling is required. The op- tional rear cover adds EMC shield- ing and protection from damage and has the facility to house a cooling fan for high ambient tem- perature applications. Two RJ45 IAN ports, one CRT port, a PS/2 keyboard/mouse port and a D-sub and DC-min ports are pro- vided for external connection at the base of the unit. www.bvmltd.co.uk (070679-X) Displays for Temposonics C-Series Sensors MTS Sensors announced that Rap- id Controls has developed displays designed specifically for use with MTS' C-Series sensors. Designated the TDD-C4 and the TDD-C32, the displays supply power to the C-Se- ries sensors, include cabling that is compatible, and provide engi- neering unit output in inches and millimeters. The 4-digit TDD-C4 display sup- ports PWM and analog sensors with an option to automatically detect type. It provides 90 counts per inch base resolution for PWM (enhanced to 360 counts per inch by averaging) and 983 counts per sensor in analog mode. Features include a selectable units switch, 3 DC inputs for set-up and ope- ration, and asynchronous serial communications. Like the TDD-C4, the 4-digit TDD- C32 display supports PWM and analog sensors with an option to automatically detect type, and pro- vides 90 counts per inch base res- olution for PWM (enhanced to 360 counts per inch by averaging) and 983 counts per sensor in analog mode. Features include DC input for Zero, optional set-up via serial or 2-switch keypad, a selectable units switch and asynchronous se- rial communications. The compact size, zero wear, zero recalibration and optimized cost of the C-Series Core sensor makes it an ideal choice to replace older technology sensors, such as line- ar potentiometers and LVDTs. The C-Series sensor brings immediate benefits to the customer, including lower costs due to the elimination of expensive signal conditioning and higher reliability due to the non-contact nature of magnetostric- tive sensor technology. www.mtssensors.com www.rapidcontrols.com. (070723-1) 11/2007 - elektor 11 INFO & MARKET NEWS & NEW PRODUCTS Industry's smallest 8051 -based micro for mobile devices SST announced a new addition to the company's popular Super- Flash-based FlashFlex family of 8-bit, 805 1 -compatible micro- controllers, the SST89V54RD-33- C-QIF. The new SST89V54RD is available in a 6x6 mm WQFN package, making it the smallest 8051 -based microcontroller cur- rently on the market. The device's miniature size and low power consumption are ideal for small form factor mobile applications, such as notebook PCs, MP3 play- ers and GPS systems, as well as home entertainment devices in- cluding H DMI products. Addition- ally, the SST89V54RD supports in-system programming (ISP) and in-application programming (IAP), which provide a variety of ben- efits to device manufacturers and consumers alike. In addition to a tiny 6x6 mm footprint, the WQFN package offers an extremely low-profile nominal package height of only 0.7 mm (maximum total thickness of 0.8 mm), making the new SST- 89V54RD well suited for height- constrained mobile applications. The SST89V54RD supports both IAP and ISP, enabling the user to update the flash device in the field or in an application. Both IAP and ISP lower cost and improve time- to-market for manufacturers, while bringing enhanced user experienc- es and convenience to consumers. These re-programming features also have a significant role in en- abling increased functionality, such as remote diagnostics and product monitoring, in network- or Internet- enabled devices. www.sst.com (070723-11) Cypress PSoC FirstTouch kit Comes In USB thumbdrive format Cypress Semiconductor Corp. re- cently introduced their PSoC® First- Touch™ Starter Kit, a USB thumb- drive kit that provides a quick, easy, and affordable way for em- bedded customers to evaluate the integration, flexibility, and real mixed-signal programmability of PSoC mixed-signal arrays. Without writing or debugging a single line of C or Assembly code, the PSoC FirstTouch Starter Kit, working with Cypress's PSoC Ex- press™ visual embedded system design tool, provides designers with CapSense touch, tempera- ture, light and CapSense proximity sensing right out of the box. Cus- tomers can also experiment with many more designs available on www.cypress.com/ go/firsttouch, or build their own in minutes via PSoC Express. They can also add all of this functionality directly to their own development systems via the detachable expansion card. The PSoC FirstTouch Starter Kit in- cludes two small boards - a main system board that interfaces with a computer over USB, and a detach- able multifunction expansion card. The expansion card includes inputs and outputs for the many applicati- ons supported by the kit. No other thumbdrive kit offers such an exten- sive array of applications. The PSoC FirstTouch Starter Kit de- livers an extensive list of features, including: • Four embedded designs right out of the box • No code, no debugging PSoC Express-based design platform • 16-pin connection interface to plug the multifunction expan- sion card into target boards • Pins accessible for user functions • Convenient, USB thumb drive format • l 2 C and ISSP support The PSoC FirstTouch Starter Kit is available from the Online Store on the Cypress website at www. cypress.com/go/firsttouch and from Cypress's distribution part- ners worldwide. The kit is priced at US$29.95. www.cypress.com /go/ f irsttouch (070723-III) Linux driver for USB TC-08 thermocouple data logger Due to strong customer demand, Pico Technology has released a beta version of a Linux driver to allow programmers to control the USB TC-08 using their own soft- ware. As Linux is widely used in educational and scientific comput- ing, and is open-source and avail- able free of charge, this driver is expected to open up a range of new applications for low-cost, ac- curate temperature data-logging. The USB TC-08 is an eight-channel thermocouple data logger with a USB interface. It is packaged in a robust, compact case and draws 12 elektor - 11/2007 its power from the USB cable, so it requires no external power sup- ply. It has standard thermocouple connectors that accept all common thermocouple types (B, E, J, K, N, R, S, T) allowing you to measure temperatures in the range -270 to + 1820 degrees Celsius with up to 0.5 degree accuracy. The TC-08 has automatic cold-junction com- pensation, and conversion time is 1 00 milliseconds per channel. The driver is supplied in source- code form to allow compatibility with the widest possible range of Linux systems, and is accompanied by example programs in C and C++. It is released under an Open Source licence which allows it to be modified and redistributed. Please note that this beta release is not fully tested. It can be down- loaded from the link below. All drivers and documentation from Pico are free of charge. http:/ /labs.picotech.com (070723-IV) Semiconductor start-up premieres breakthrough sensor technology ChipSensors Ltd, a fabless semi- conductor start-up company, has unveiled a breakthrough in semi- conductor technology that enables the surface of the chip itself to sense parameters such as temper- ature, humidity, certain gases and pathogens. The patent-pending technology exploits the fact that the dielectric material in standard sub- micron CMOS comprises porous oxides and polymers; by selective- ly admitting or blocking ingress of the agent to be sensed, any resul- ting changes in electrical characte- ristics can be accurately detected and measured. The sensor technology is being shown in public for the first time at the RFID Europe 2007 exhibition in Cambridge. Visitors to booth 17 will be able to see a working de- monstration of a prototype single- chip temperature and humidity sen- sor, communicating via an off-chip wireless link to a laptop PC dis- playing real-time measurements. The 0.13 pm sensor chip being shown at RFID Europe has obvious applications as an all-electronic replacement for the type of elec- tromechanical thermostats and hu- midistats used in building manage- ment and environmental monitoring systems. Chip- Sensors is also currently developing an ultra-low- power wireless version of this sensor - which integrates all the signal conditioning, microcon- troller, memory and RF transceiver functions onto the same chip as the sen- sor itself — for incorpora- tion into passive and ac- tive ID tags. ChipSensors Ltd was founded in 2006, as a spin-out from a de- sign consultancy that specialises in wireless sensors. Initially self- funded, with matching grants and equity from various government agencies, the company attracted sufficient venture capital to seed development of its innovative sili- ■■ ' 1 con sensors. ChipSensors is now on the verge of commercialising this technology, and is currently engaged in negotiations with in- ternational customers, partners and potential investors. Until now, most sensors have been manufactured on glass or ceramic substrates, using specialist materials and manufacturing processes, and have proved difficult, if not impos- sible, to accommodate within main- stream foundry CMOS processes. The wafers had to be post-processed and the sensors then required testing and calibrating after packaging, which was time-consuming and ex- pensive. ChipSensors 7 proprietary technology overcomes these obsta- cles. It enables sensors, signal con- ditioning circuits — including high resolution analog-to-digital convert- ers — and RF transceiver functions, together with the microcontroller and memory, to be integrated on a single chip, fabricated entirely from standard CMOS. www.chipsensors.com. (070723-VIII) Enhanced GPS integration with gyroscope in dead reckoning reference design u-blox has improved its groundbreak- ing GPS dead reckoning system by integrating a gyroscope sensor from Epson Toyocom, a leader in the de- sign and manufacture of crystal- based electronic products, into the reference design for the product. The reference design will shorten time- to-market and reduce the risk of GPS integration for applications that require accurate, uninterrupted positioning re- gardless of GPS signal conditions. u-blox 7 dead reckoning solution, powered by the LEA-4R dead reck- oning GPS module, is ideal for ap- plications that require continuous positioning such as vehicle naviga- tion, fleet management and toll sys- tems. An odometer calculates di- stance traveled and a gyroscope determines turn rate. This data sup- plements the GPS data to provide continuous positioning in tunnels, indoor parking facilities, urban ca- nyons and other environments in which it may be difficult to obtain a GPS satellite signal. The AEK-4R dead reckoning refer- ence design Evaluation Kit is avail- able from October from u-blox of- ficial distributors and from u-blox 7 online shop at the link below. The reference design schematics are available upon request. Please con- tact sales@u-blox.com for details. www.u-blox.com/shop/ (070723-VI) 11/2007 - elektor 13 Microchip PIC Boards Embedded Webserver USB, Ethernet Dalles 1-wire RS232/dB5 r 12 C CAN-BUS Serial LCD Free project download with source code ARM Development Boards High performance 22bit RISC USB JTAG Ethernet and USB R5233. I2C. CAN-BUS NXF lpc and Atm el Sam Free C compiler and IDE Free ARM 7 tutorial download Embedded Linux Boards Low cost embedded Linux ooard Two USB host interact Two 40 pins sockets For exp* ht ion GSM / GH.4 Module sdri on Create CGI using C language Apache r PHP and SQLite RSS Reader and lclj demo Free SDK compiler download Secure online ordering www.skpang.co.uk sales@skpang.co.uk plug & play instruments why is everyone talking about cleverscDpe? c leu ci' sco pc CS 32 EA visit our website and discover for yourself www.clever5CDpe.CQin ‘ qua/?: Tve gal ms hr wsft j.W &n& hr hums -/ rsc&ms/tf ft Iff my (nends " |Joi Number One Systems 1 Pacv.DP for | CaSy-rV/ Windows The World Beating PCB design software nrar W W Version 1 1 features ■ Design revision analysis ■ Stan 1 Celt a points ■ Apply layout pattern & groups ■ Design calculator? ■ Electrical rules check (ERC) ■ Shape- editing pnncl ■ Merged ubtract ^hape editing ■ Track analysis Plus many more exciting features. The new Easy-PC reaches even higher! The breathtaking new Easy- PC for Windows Version 1 1 is released. Winning accolades the world over, VI I of the market leading Easy-PC delivers even more remarkable value for money and secs the new benchmark for performance in PCB CAD. just try a demonstration copy of Easy^PC and prepare to be amazed, TP Easy-PC delivers a simple to understand, folly integrated Schematics Sc PCB layout in a single application. Design and rules cheeks at all stages ensure integrity at all times. Professional manufacturing outputs allow you to finish the design process with ease. Stqp press,,. Stop press*** Stop press Easy-PC is supported running under Windows Vista Call for a brochure, prices & CD on *44 (0) 1 6&4 773661 or e-mail sales@riumberone.comi you can also download a demo- from www. N umberOne.com Oak lane. B-rtdon, Tewkesbury. Glos. GL 10 7LR. United Kingdom 14 elektor - 11/2007 Helping You Succeed ■LL,d.s:3jJ ShHjTii'J $ J tvs**** i a wTyhmg ncroci -fljpj V-dJuju^ P'/JiJJjiij Does your business need more support and resources? Successful organizations recognize the value of a strategic supplier relationship to help them deliver innovative products to their markets in a timely and cost-effective manner. Microchip Technology supports more than 45,000 customers worldwide, and we’re committed to helping you succeed. In addition to our high-performance silicon solutions, Microchip provides a long list of support functions that reduce time to market and lower your total system cost. And we have significantly expanded our local technical resources. Use microchipDIRECT to: Register today! Order directly from Microchip, 24 hours a day, 7 days a week with a credit card or credit line Receive competitive, direct volume pricing on all devices Check our product inventory Order broken reels at steep discounts Use fast and inexpensive production programming (now available) Place and maintain your order securely from any network connection Assign a PO number to your order Create a unique part number for any item ordered Receive e-mail notification of orders, deliveries, quote status and more microchip Q8 HEC T www. ’ c rnch-pdirnct.oDm \km * Rq H S COmpI i a rt t Microchip www.microchip.com The Microchip name and logo, PIC, and dsPIC are registered trademarks of Microchip Technology Incorporated in the USA and other countries. All other trademarks and registered trademarks are the property of their respective owners. © Microchip Technology 2006. All rights reserved. ME156Eng/05.06 DATA ACQUISITION Jose Luis Ruperez Fombellida This data acquisition card for connection to the USB has eight digital outputs, eight digital inputs, two 10-bit analogue outputs and eight 10-bit analogue inputs for voltage swings of 0 to 5 V. The system's core is a Microchip USB-sawy microcontroller type PIC18F4550 programmed in C. The circuit is built on a compact PCB and requires no external power supply. Measurement cards and systems you can connect to a PC have been a con- stant success factor in the long histo- ry of Elektor. Whether it’s stand-alone for control over the RS232 or LPT ports (anyone remember those?), as a plug- in card for the ISA bus (ditto) or now, recently, for the USB, it’s a blockbuster if our readers can (1) generate and read digital control signals, and (2) do the same for analogue signals! The card described in this article could be at the hub of a great many applications to do with measurement and control. We want USB Arguably, RS232, ISA and even Cen- tronics are things of the past when it comes to digital and analogue signals specifically for measurement and con- trol by/on a PC. USB is the way forward both in terms of speed and ease of con- nection, although the latter is a com- plex matter especially as far as soft- ware is concerned. For example, a lot of thought (and time) goes into making the PC recognise a valid USB device! In this article hopefully we cater for readers only interested in digital and an- alogue connectivity with the real world, as well as for those with a deeper inter- est in how USB actually works on a mi- crocontroller and, equally important, can be made to do something really useful — all at very low cost, of course. PIC 18F4550 for USB Fortunately, there are microcontrollers that make the USB interface between the PC (the host) and the circuit we wish to design (the device) more or less transparent. That’s because they are provided with dedicated hardware and software to implement USB ‘the easy way’. All totally invisible of course to those who just want to use the USB de- vice yet know nothing about it (which should not include you)! One such processor is Microchip’s PIC 18F4550, which has the additional advantage of lots of (free) software being available for it. Also, the device is available as a 16 DIP40 device which should attract applause and other expressions of approval from the I-hate-SMDs camp. The circuit The circuit diagram of this small wonder of technology is given in Figure 1. It’s not much more than a powerful CPU (IC1) sur- rounded by input and output connectors and a few status LEDs. The function of the con- nectors is as follows, with the relevant PIC lines in brackets: K1 = 8-bit digital output for 0- 5 V TTL swing (RD0-RD7). K2 = USB connector for linking to your PC (RC4-RC5). K3 = 8 -bit digital input for 0-5 V TTL swing (RB0-RB7). K4 = two analogue outputs for 0-5 V swing (RC1-RC2). K5 = 8 analogue inputs (ANO/ elektor - 11/2007 digital & analogue; input & output RA0-AN7/RE2) for 0-5 V swing. Internal pull-up resistors are available on RB, the digital input port lines. The analogue outputs have a resolution of 10 bits each using PWM (pulsewidth modulation) at 2.9 kHz. If necessary these outputs can be filtered with a simple RC network. The DC output voltage V Q obtained after the filtering may be calculated from: V Q = 5D [volts] where variable D is the duty cycle of the PWM, taking a value between 0 and 1. The analogue inputs also have a reso- lution of 10 bits. The oscillator in the PIC micro ticks at 20 MHz using quartz crystal XI and the usual pair of small capacitors for the parallel loading, and a high-value resistor (R5) for the feedback. Actually the microcontroller runs at 48 MHz, generated internally with K5 ANO 1 2 AN1 y AN2 3 4 AN3 y AN4 5 6 AN5 y AN6 7 8 AN7 y n 9 10 +5V 1 K3 RBO 1 2 RBI y RB2 3 4 RB3 y RB4 5 6 RB5 y RB6 7 8 RB7yJ o 9 10 +5V * see text 070148-11 Figure 1 . Circuit diagram of the data acquisition card with USB connectivity. the aid of a PLL and a frequency di- visor from the 20 MHz supplied by the quartz crystal. The frequency of 48 MHz is an exact multiple of the USB bus speed (full speed, 12 Mbits/s). Two status LEDs, D1 and D2, indi- cate the USB status. D3 is obviously the supply power indicator that lights when the card is connected to the USB port on your PC. The circuit’s supply voltage arrives via USB connector K2 and a small choke, LI, to suppress noise, with C4 assist- ing to that effect. That effectively leaves components SI, Rl, R2 and C3 at the MCLR input of the micro. Well it’s just another wholly tra- ditional Reset network. PIC Firmware Where there’s simple hardware, there’s a massive amount of software behind it all and usually lurking inside microcon- trollers. The firmware (object code) the PIC is faithfully executing was created by the author using two free software tools from Microchip: IDE MPLAB V7.5 and C18 Student Edition V3.02. The Microchip website has instructions for installation and use of both programs. The source code of the firmware is dif- ferent from the Microchip original. All project software is available as a free download # 070148-11. zip from our website at www.elektor.com. You will find at least three folders in the archive file: ‘driver’, ‘firmware’ and ‘PC’. The content is an Aladdin’s Cave for fans of C, PICs and USB (and that should cover a lot of our readers!). A piece of C code is shown in Figure 2; it’s these PIC fuse settings you’ll need to know if you’re not buying the chip ready-pro- grammed from Elektor. The firmware file contains the whole project and the result of its compilation called TAD_vl.hex. The microcontroller must be programmed with this file. Those of you interested in the deep- er workings of USB should know that the connectivity implemented on the card described on this article is de- ll/2007 - elektor 17 DATA ACQUISITION ■ N« 1 LL U H D tit u. ■! IAP ■ fVW>' • • IlilAIBa linHHii ' mam 11+ iHb&Ib M!Hf ■ r.aa ■« ni ■ iii - i n ■ei En | - An lb a i i -.nn i ■■ ~ ■ — ■■-P r . miir JIH MT nlu WIT HP ■ '■flJj.PWI ■h m >lj Kill II KM wn j i #■ i ■ ■ ■■ m fanUa :!■ i— j. ■!■ ■ ajj mium u k .. 4i» H h-n fc'M Bal 1 J -_Ii_ ■■ !Fi mlrr HIM pm I rr BT’iH H — rlw kH.JN iif HfaTu PT anki niEfl HP P **■ «-**!>+ arc rnl H rlill M PWH-P ■ P¥ ■ H* — M»’f *P1 ■ «P« *fl nil ■ Bufai EU ■ niBI M — I BE ■ Bn in tl-1 HW ia bsibH. Ill '■Hdi Irani h ibiti .■Tw 4 nnlid i iii Ih !■ ftn n|j|iim ilW i p If. 1 J I | t | I *B t> ~i n" a ' I H — L< uj in bm a 1 - 'rrirri la aviujmi pi I a* Hi Ink Kj- ■priuhjn m-l iuj Ifaip -HH iH il | i'll da Kff. | aa r ■ Tin || .,b i - a ki~b i-nrli m m m mb i im bB Lb fat ibB dlfa iriMa nil fa idiai mp mj iMbfpai m in - 1 i - Ua .mb mi 1 yhbmbmbb bj |iaa a a m ■ ifm Birn. aa. rna^ ii akau r I fa. mb' btm -fiuMM rr ■ aa uBicaMBi m BB I! k IB tEB M k«] JJ anparr ■ | i>i| a i a lu 1 1 |i Pbli i a hi L-iihfi tm- « ■" i m ■ i .i! ill aid i mi. | in! a all _|b t ■■ li. nr ■ ■In HTII UP ■ M I ■ ,B lllfl BBI PBKM B I U 14 BBaBk m !.n r .Kjj iaga.ua 11 . B-ifafa- PHlmEKr itt 1— i-kJrfc *a**M M TT. -i i-i ii"r-n — IH. WH 1 ■ ■ “kk — irin.. — 1 I- ■ -j Ii-r — ■- -r-r+t - — in I rr WPJ * M iBU I >np nritb — 1 nrirflM Hi* uk liH AM# M - HT 1 «1M* J IHH4fn. n. n — iriiA Bin auii arar au.ii | II 'Ll ill H h ifaaflfa al ! llh hjb iinanji aiq. ip)4 a kuu jijb nip bi 11 . . j u-n . mmm aarri - 1 yaaB n-. - . . - 1 . . 1 1 M El IS] I BBB I B IB HI ■ B I B BB I B BB ■ B I BJ.B I II BJ.KI BU ■ B I M B I II I — kla all I r klia*i I I ■ IB JBU la ■ Fallal'Ll I P h P K I ■-iB B.B|IIM 1-ifBB BilJ imi«" bib 1 ■■ 1 a 1 ■ 1 ail wi Biaiui n 1 1 ■§■ ■ m-h fein ui rm Figure 2. RU on MPLAB too? Lots of Elektor readers are. The C code for the project also contains useful information on the PIC fuse settings — an ongoing source of confusion to many microcontroller enthusiasts (and not just those on PIC). fined by firmware in the PIC18F4550. The following building blocks are used: BUS POWER mode; custom class; full-speed (12 mbit/s) and interrupt transfer. Construction The circuit is built on a compact dou- ble-sided printed circuit board of Data acquisition card trainer bench The author has developed four simple add-on cards for testing the data acquisition card for the following functionalities: 1 . LED card: 8 LEDs to visualize the digital output. 2. Pushbutton and switch card: 4 pushbuttons and 4 switches to exercise the 8 digital inputs. 3. LED voltmeter card: two LEDs that change their brightness according to the two analogue outputs. 4. Potentiometer card: 8 potentiometers for testing correct operation of the 8 analogue inputs. The data acquisition card and the four cards are shown in the picture. Although PCBs are shown and the author has the schematics and board designs in OrCAD format, these cards should be easy to build using Vero board. To test the whole system, a program was developed in C+ + CLR, for which the (free) Visual C + + 2005 Express compiler was used. This program is based on ex- amples from Microchip. A screendump of the program is shown here. This software is included in the ar- chive file for the project. which the component placement at both sides is shown in Figure 3. Some empty space has been left at the short sides of the board be able to secure it with screws. Although building up the board will be mostly plain sailing for experienced readers, some remarks may be in order for those just starting out in USB land with the present card. The opening in the collar of each box- header is an orientation aid and should be at the edge of the board to enable an IDC connector on a flatcable to be plugged in. SMD components are fitted at both sides of the board, so carefully study the two overlays to establish the cor- rect position and of each part, as well as the orientation in the case of the SMD LEDs. We recommend fitting the programmed PIC18F4550 in a good quality 40- way DIL socket. Watch the orientation of the large IC: pin 1 is near the reset switch SI. LI, finally, is a ferrite bead with three or four holes through which a piece of enamelled or other stiff wire is pulled. A ferrite bead with one hole and three turns of wire through it should also work. The final inductance of the RF choke so made is uncritical. To avoid possible damage to the PC, verify that there are no short circuits or other problems in the pins of USB connector K2. First connection Once the card is fully populated (and the microcontroller properly pro- grammed), connect it to a PC by means of a standard USB cable. The power LED D3 lights and one of the LEDs D1 and D2 flashes while the other remains off. At the same time the PC will tell you that a new USB device has been connected and that a driver is required. Tell Windows where the driver is locat- ed (folder driver\mchpusb.inf). Once the driver is installed the USB status LEDs flash alternatively. The card is then ready for use. VID/PID (Product ID/Vendor ID) All USB devices have a unique combi- nation consisting of two numbers so that no two equal devices exist. The first number, VID, identifies the manu- facturer of the device and the second, PID, gives the product identifier. The combination used in this project uses as VID the one of Microchip and 18 elektor - 11/2007 Figure 3. Top side and bottom side component placement for the PCB. The PCB artwork is a free pdf download from our website but bear in mind that the board is double-sided and through-plated. as PID the one of a demo card of the PIC18F4550 Microchip. If the USB Data Acquisition Card is used for commer- cial purposes, it is essential to obtain a different VID/PID set of numbers — this can be done, for example, through www.usb.org or through Microchip. This new combination should be in- cluded in the source code of firmware that would be compiled again in or- der to obtain an updated .hex file with which the microcontroller is programmed. The PC software would also have to be modified in the same way, since firmware and software must have the same VID/PID. Finally, the driver ‘mch- pusb.inf’ file would be modified. Precautions Some general precautions must be mentioned. All expansion connectors Kl, K3, K4 and K5 include +5 V and ground to power any cards that can be connected to them. Great care must be taken to prevent short circuiting these terminals and not drawing more than 100 mA from any of them. Also, remem- ber that these terminals are directly connected to the +5 V and ground of the USB port of your computer (and you do not want that to take damage [ COMPONENTS LIST ] Resistors (all SMD 0805 case) I R1 = lOkQ ■ I R2 = 470D I I R3,R4 = 33D I | R5 = 1 MD | | R6 / R7 / R8 = lkQ I I I ■ Capacitors ■ (all SMD 0805 case) Cl ,C3 = lOOnF C2 = 470nF C4 = 1 OnF 1 C5,C6 = 22pF I I I Semiconductors I I IC1 = PIC18F4550 I/P, programmed, Ele- I | ktor Shop # 070148-41 | I D1,D2,D3 = LED, SMD case 1206 Miscellaneous K1,K3,K4,K5 = 1 0-way boxheader K2 = type-B USB connector, PCB mount XI = 20MHz quartz crystal LI = VK200 or small ferrite bead with 2- 4 turns thin enamelled copper wire SI = pushbutton, PCB mount, 6mm I footprint I | DIL40 socket for 1C 1 | | PCB (bare), Elektor Shop # 070148-1 | Project software, file # 070148-1 1, free ■ download from www.elektor.com. ■ — avoid using family or kiddies PCs in any case). If you need more current for a certain application, consider the use of an ex- ternal power supply, joining only appli- cation and USB Data Acquisition Card grounds. Some precautions for the digital inputs 11/2007 - elektor 19 DATA ACQUISITION Files & file locations The complete project of the application for the PC is in PC\ TAD_V1_ win\ folder and its name is TAD_Vl_win.vcproj. The compiled pro- gram is in PC\TAD_Vl_win\Release folder and its name is TAD_V1_ win.exe (for the program to work, the dynamic link library mpusbapi. dll created by Microchip must be in that same folder). The executable one needs the .NET Framework. It is highly recommended to have the operating system updated by means of Windows Update. If you wish to modify the project to adapt it to your requirements it is necessary to install the Visual compiler Microsoft C + + 2005 Express and update it with Service Pack 1: Visual C + + 2005 Express SP1. Later we will install Microsoft Platform SDK for Microsoft Visual C+ + 2005 Express. This serves to develop WIN32 applications, necessary in this case to access the DLL mpusbapi.dll). All of it is free and can be downloaded from the Microsoft website. There you will also find in- structions about installation and examples. (K3): Do not apply voltages below zero or higher than 5 volts to avoid damage to the PIC microcontroller. On the digital outputs (Kl): each line can supply a maximum current of 25 mA for logic High or Low levels. On the analogue inputs (K5); the same as with the digital inputs. On the analogue outputs (K4): each line can supply a maximum current of 25 mA for logic High and Low levels of the PWM signal. Finally, the sum of all currents of all the digital and analogue outputs must not exceed 200 mA. Work in progress... The USB data acquisition data card has a lot of potential and the author has de- veloped, and is busy developing, the following application cards: 1. Triac card for the 8 digital outputs, to be able to control mains-powered loads in a comfortable manner. This card is isolated using optotriacs. 2. Resistor-to-voltage converter card supplying a voltage proportional to the input resistor. This voltage is applied to the digital input. 3. Voltmeter card with LED bar readout. 4. Speed control of a DC motor. This card controls the speed and direc- tion of a motor through the analogue outputs. 5. Driver card for stepper motors, capa- ble of microstepping through the dig- ital outputs. 6. Distance sensors card using the ana- logue inputs. 7. Relay card under control of the dig- ital outputs. Elektor and the author welcome other applications you may have developed. Let us know! ( 070148 - 1 ) About the author The author is a telecommunications tech- nical engineer working as a teacher of electronics in a professional school in Madrid since 1984. He is a keen electron- ics enthusiast. He developed this card to enable his students to control small robots from the USB port in a PC by programmes written in C code. Follow these steps The PC software available for this project should be relatively easy to install use and/or adapt if you follow these steps. 1. Install Visual C+ + 2005 Express: http://msdn2.microsoft.com/en-us/express/aa975050.aspx) 2. Install Visual C+ + 2005 Express SP1: http://msdn2.microsoft.com/en-us/express/aa975050.aspx 3. Install PSDK: Microsoft Platform SDK for Microsoft Visual C+ + 2005 Express: http://msdn2.microsoft.com/en-us/express/aa975050.aspx 4. Update the operating system using Windows Update. 5. Tell Visual C+ + to use PSDK. The sequence to do so suggested by Microsoft is given below. 5.1 Update the Visual C++ directories in the Projects and Solutions section in the Options dialogue box. Add the paths to the appropriate subsection: Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin; Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\lnclude; Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib. 5.2. Update the corewin express.vsprops file. One more step is needed to make the Win32 template work in Visual C+ + Express. You need to edit the corewin_express.vsprops file (found in C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults) and change the string that reads: Additional Dependencies="kernel32. lib" to: AdditionalDependencies = "kernel32.lib user32.lib gdi32 . lib winspool. lib comdlg32.lib advapi32.lib shel 132 . lib ole32.lib oleaut32.lib uuid. lib". 5.3. Generate and build a Win32 application to test your paths. In Visual C + + Express, the Win32 Windows Applicati- on type is disabled in the Win32 Application Wizard. To ena- ble that type, you need to edit the file AppSettings.htm file lo- cated in the folder "%ProgramFiles%\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\l 033\". In a text editor, comment out lines 441 - 444 by putting a // (double slah forward) in front of them as shown here: // WIN_APPdisabled = true; // WIN_APP_LABEL. disabled = true; // DLL_APPdisabled = true; // DLL_APP_LABEL. disabled = true. Save and close the file and open Visual C + + Express. 20 elektor - 11/2007 mlkroElektronika DEVELOPMENT TOOLS | COMPILERS | BOOKS CAN-1 Board - Interface CAN via MCP2551 . CANSPI Board - Make CAN network with SPI interface. RS485 Board - Connect devices into RS-485 network Serial Ethernet - Make ethernet network with SPI Interface (ENC28J60). lrDA2 Board - Irda2 serve as wireless RS232 communi- cation between two MCU’s. EasyPIC4 Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD Following tradition of its predecessor EasyPIC3 as one of the best PIC development systems on the market, EasyPIC4 has more new features for the same price. The system supports 8-, 14, 18, 20, 28 and 40 pin PIC microcontrollers (it comes with a PIC16F877A). USB 2.0 on-board programmer with mikrolCD (In- Circuit Debugger) enables very efficient debugging and faster pro- totype development. Examples in C, BASIC and Pascal language are provided with the board. Uni-DS 3 Development Board Complete Hardware and Software solution with on- board USB 2.0 programmer LV 18FJ Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD The system supports PIC, AVR, 8051 , ARM and PSoC micro- controllers with a large number of peripherals. In order to con- tinue working with different chip in the same development environment, you just need to swich a card. UNI-DS3 has many features that make your development easy. You can choose between USB or External Power supply. Each MCU card has its own USB 2.0 programmer! System supports 64, 80 and 100 pin PIC18FxxJxx microcon- trollers (it comes with PIC1 8F87J60 - PIC1 8 Microcontroller with an integrated 10Mbps Ethernet communications peripheral, 80 Pin Package). LV 18FJ is easy to use Microchip PIC18FxxJxx development system. USB 2.0 on-board programmer with mikrolCD (In-Circuit Debugger) enables very efficient debug- ging and faster prototype development. Examples in C, BASIC and Pascal language are provided with the board. CF Board - Easy way to use Compact flash in your design. MMC/SD Board - Easy way to use MMC and SD cards in your design. EEPROM Board - Serial EEPROM board via I2C interface. RTC Board - PCF8583 RTC with battery backup. ADC Board - 12-bit analog- to-digital converter (ADC) with 4 inputs. DAC Board - 12-bit digital- to-analog converter (DAC) with SPI. Keypad 4x4 Board - Add keypad to your application. Accel. Board - Accel, is an electronic device that meas- ures acceleration forces . with ffllkrOtCfi JuppdrE PICFIash programmer - an ultra fast USB 2.0 programmer for the PIC microcontrollers. Continuing its tradition as one of the fastest PIC programmer on the market, a new PICFIash with mikrolCD now supports more PIC MCUs giving devel- oper a wider choice of PIC MCU for further prototype development. mikrolCD debugger enables you to execute mikroC / mikroPascal / mikroBasic pro- grams on the host PIC micro- controller and view variable val- ues, Special Function Regi- sters (SFR), memory and EEP- ROM while the program is run- ning. - All of our products are shipped in special protective boxes. -On-line secure ordering provides fast and safe way of buying our products. System supports 64, 80 and 100 pins PIC24F/24H/dsPIC33F microcontrollers (it comes with PIC24FJ96GA010 - PIC24 16-bit Microcontroller, 96 KB Flash Memory, 8 KB RAM in 100 Pin Package). Examples in BASIC, PASCAL and C are included with(in) the system. You can choose between USB and External Power supply. LV 24-33 has many features that make your devel- opment easy. USB 2.0 on-board programmer with mikrolCD (In- Circuit Debugger) enables very efficient debugging and faster pro- totype development. 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 sys- tems and machines. 16 inputs with optocouplers and 16 relays (up to 10A) can satisfy many industrial needs. The ultra fast mikrolCD (In-circuit Debugger) enables very efficient debugging and faster prototype development. Features : RS485, RS232, Serial Ethernet, USB 2.0 on-board programmer and mikrolCD (In-Circuit Debugger) on-board. 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 makes MikroElektronika compilers one of the best choices on the market today. Besides mikrolCD, mikroElektronika compilers offer a statistical module, simulator, bitmap generator for graphic dis- plays, 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 charac- ter and graphics on LCDs, manipulation of push-buttons, 4x4 key- board 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 already- written and tested programs to use with our development boards. B mikroElektronika manufactures competitive development sys- tems. We deliver our products across the globe and our satis- fied customers are the best guarantee of our first-rate service. The company is an official consultant on the PIC microcon- trollers and tine 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. EasydsPIC4 Development Board Complete Hardware and Software solution with on- board USB 2.0 programmer and mikrolCD The system supports 18, 28 and 40 pin microcontrollers (it comes with dsPIC30F4013 general purpose microcontroller with internal 12-bit ADC). EasydsPIC4 has many features that make your development easy. Many of these already made examples in C, BASIC and PASCAL language guaran- tee successful use of the system. Ultra fast USB 2.0 on-board programmer and mikrolCD (In-circuit Debugger) enables very efficient debugging and faster prototype developing. EasyARM Development Board Complete Hardware and Software solution with on- board USB 2.0 programmer EasyARM board comes with Philips LPC2214 microcon- troller. 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 development easy. One of them is on-board USB 2.0 programmer with automat- ic switch between ‘run’ and ‘programming’ mode. Examples in C language are provided with the board. EasyAVR4 Development Board with on-board USB 2.0 programmer The system supports 8, 20, 28 and 40 pin microcontrollers (it comes with ATMEGA16). Each jumper, element and pin is clearly marked on the board. It is possible to test most of industrial needs on the system: temperature controllers, counters, timers etc. EasyAVR4 is an easy-to-use Atmel AVR development system. Ultra fast USB 2.0 on-board program- mer enables very efficient and faster prototype developing. Examples in BASIC and Pascal language are provided with the board. Easy8051B Development Board with on-board USB 2.0 programmer http://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. System is compatible with 14, 16, 20, 28 and 40 pin micro- controllers (it comes with AT89S8253). Also there are PLCC44 and PLCC32 sockets for 32 and 44 pin microcon- trollers. USB 2.0 Programmer is supplied from the system and the programming can be done without taking the micro- controller out. dsPICPRO 3 Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD The system supports dsPIC microcontrollers in 64 and 80 pins packages. It is delivered with dsPIC30F6014A microcontroller. dsPICPR03 development system is a full-featured development board for the Microchip dsPIC MCU. dsPICPR03 board allows microcontroller to be interfaced with external circuits and a broad range of peripheral devices. This development board has an on- board USB 2.0 programmer and integrated connectors for MMC/SD memory cards, 2 x RS232 port, RS485, CAN, on- board ENC28J60 Ethernet Controller, DAC etc... BIGPIC4 Development Board Complete Hardware and Software solution with on-board USB 2.0 programmer and mikrolCD Following tradition of its predecessor BIGPIC3 as one of the best 80-pin PIC development systems on the market, BIG- PIC4 continues the tradition with more new features for the same price. System supports the latest (64) and 80-pin PIC microcontrollers (it is delivered with PIC18F8520). Many of these already made examples in C, BASIC and Pascal lan- guage guarantee successful use of the system. Ultra fast on- board programmer and mikrolCD (In-circuit Debugger) enables very efficient debugging and faster prototype developing. BIGAVR Development Board with on-board USB 2.0 programmer The system supports 64-pin and 100-pin AVR microcon- trollers (it is delivered with ATMEGA128 working at 10MHz). Many already made examples guarantee successful use of the system. BIGAVR is easy to use Atmel AVR development system. BIGAVR has many features that makes your devel- opment easy. You can choose between USB or External Power supply. BIGAVR also supports Character LCD as well as Graphic LCD. EasyPSoC3 Development Board with on-board USB 2.0 programmer The system sup- ports 8, 20, 28 and 48 pin microcon- trollers (it comes with CY8C27843). Each jumper, element and pin is clearly marked on the board. EasyPSoC3 is an easy-to- use PSoC development system. On-board USB 2.0 program- mer provides fast and easy in-system programming. IK rC Bl* _ ‘jnL FI | '■■■ .■ Please visit our website for more info http://www.mikroe.com SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD 11/2007 - elektor 21 MICROCONTROLLERS Alexander Kniel Flash microcontrollers are easy to program, which makes them suitable for rapid software development environments and educational uses. In the past, program code was usually downloaded via a serial interface, but nowadays many PCs (especially laptops) only have USB ports. Our versatile Flash Board provides a solution to this problem. It is built around an AT89C5131A, which is an extended 8051 -family microcontroller with an 80C52 core and a Full Speed USB port. As a sort of bonus, the 1C has a complete update interface for downloading new firmware. Atmel also provides suitable software in the form of its FLIP program, which is available free of charge. The Flash Microcontroller Board ori- ginally published in December 2001 is well known to Elektor readers, and it has helped many readers get started in the world of microcontrol- lers. That’s hardly surprising, since microcontrollers with flash memory, such as the AT89C8252 used in the original Flash Board, are easy to pro- gram. As with many other similar boards used for educational purpo- ses, the code is downloaded from a development PC to the microcontrol- ler via a serial interface. Unfortuna- tely, the good old RS232 interface is becoming increasingly rare. Lapt- ops in particular often have only USB ports and no longer come with prin- ter ports or serial ports. If a teacher wants to give his students training boards that they can also program at home using a laptop, a different ap- proach is necessary. The author, an electronics instruc- tor at a vocational/technical school in Heilbronn (Germany), thus developed a version of the Flash Board based on a modern microcontroller with a USB interface. For this purpose he selected the Atmel AT89C5131AM, which has an 80C52 core and thus belongs to the 8051 family, just like the AT89C8252. The IC incorporates an Full Speed USB port, and it is specifically designed for use in USB devices such as printers, cameras, and so on. As a sort of bo- nus, the microcontroller has a complete update interface for downloading new firmware. This in particular enabled the author, who has a weakness for hardware and all sorts of programming languages, to build an extremely simp- le USB Flash Board because Atmel also provides suitable software in the form of its FLIP program, which is available free of charge. All you have to do is pro- vide the program code in a hex file and you’re ready to go. Generation-2 Flash Board Many copies of the first version of the new board developed by Alexander Kniel have already been built by stu- dents and used with laptop compu- ters. The board design was modified slightly in the Elektor lab, and among other things Elektor designer Chris Vossen added an LCD interface. The board thus follows in the footsteps of the 2001 version of the Elektor Flash Microcontroller Board and is suitable for not only learning how to program microcontrollers, but also for mature applications in device controllers, ro- bots, and many other areas. Everything revolves around the abo- ve-mentioned AT89C5131AM, which is an extended member of the 8051 fa- mily. Its core is an 80C52X2 with six clocks per instruction cycle. Besides 32 KB of flash memory, the IC has 1024 bytes of extended RAM, additi- onal EEPROM, and many other useful peripherals. Another helpful feature is that the M version of the microcontrol- ler can also operate at 5 V, and a versi- on in the user-friendly PLCC52 packa- ge is available. However, probably the most important feature is the USB 1.1 / USB 2.0 Full Speed module (for the experts: with endpoint 0 for control transfers and six additional endpoints with up to 512 bytes of FIFO memo- ry). If you want to develop USB soft- ware, this gives you everything you could wish for, although you do need a bit of technical expertise. Everyone else can regard the microcontroller as a normal 8051 device that can be pro- grammed via USB. The schematic diagram (Figure 1) shows a dual power supply that can draw power either from the USB bus or (with jumper JP4 fitted) via voltage regulator IC2 from an AC adapter con- nector K9. The D+ and D- pins of the Figure 1 Schematic diagram of the USB Flash Board. 22 elektor - 11/2007 +5V +5V 11/2007 - elektor 23 MICROCONTROLLERS igure 2 Assembling the circuit board should not present any problems. microcontroller are for the USB data lines. To activate the internal USB boot loader, a low signal level must be applied to PSEN via JP2 (jumper toward the edge of the board). When reset switch SI is pressed, the boot loader starts up and receives data via the USB port. Jumper posi- tion JP3 must be closed (jumper to- ward IC2) to activate the USB port. This connects pullup resistor R4 to the D+ line, which indicates a Full Speed USB device to the PC. If you would like to have a more conveni- ent way to switch between run mode and download mode, you can connect a changeover switch to JP2 and JP3. Components list Resistors R1 = 1 kD5 8-way SIL array R2,R3 = 27D R4,R12 = lkU5 R5 = 1 00D R6 / R7 / R1 1 = 4k D7 R9 = 8 -way 1 OkD array RIO = IkQ PI = 1 OkU potentiometer Capacitors Cl 0,C1 l=22pF C3 = 2nF2 C4 = 1 OnF C1,C2,C5,C6,C7,C14,C15,C16 = lOOnF C8 = 1 OyL/F 1 6V C9 = 1 a/F 16V 02 = IOOOa/F 16V 03 = 1 OOyL/F 25V Semiconductors D1-D8,D12 = LED, red, low-current D9 = BAT46 DIO = 1N4001 D1 1 = zener diode 6V2 IC1 = AT89C51 31 AM IC2 = 7805 XI = 1 2MHz quartz crystal Miscellaneous JP1,JP4 = 2 -way SIL pinheader JP2,JP3 = 3-way SIL pinheader K2 = USB-A socket K3,K6,K8 = 1 0-way boxheader K4 = 6-way (2x3) pinheader K 7 = 1 4-way boxheader K9 = mains appliance socket, PCB mount S1,S3-S6 = miniature pushbutton PLCC socket PCB, # 070125-1 from Elektor SHOP Kit of parts, # 0701 25-71 from Elektor SHOP It can be fitted directly on the PCB or mounted on a front panel. Four full-fledged 8-bit ports The microcontroller has four full- fledged 8-bit ports, each of which is accessible via a connector and/or as- signed a specific peripheral function. Port PO is available on K3, and it also drives eight LEDs that can be con- nected to VDD ( + 5 V) via series re- sistors. Port PI is freely usable and accessible via K6. Port P2 is wired to LCD connector K7. An LCD module can be operated in 4-bit mode via this connector, and a contrast adjustment trimpot is provided on the board. Fi- nally, port P3 is specifically intended to be used for inputs, and it can be accessed externally via K8. For testing user-developed programs, the board is fitted with pullup resistors, four pushbutton switches (P3.0...P3.3), and four DIP switches (P3.4. . .P3.7) on port 3. Switches normally require de- bouncing, which can usually be imple- mented in software. The P3.2 and P3.3 lines have supplementary hardware debouncing in the form of capacitors C6 and C7, since these lines are con- nected to the interrupt inputs of the microcontroller. We also mustn’t forget port P4 with the P4.0 and P4.1 lines, which form the I2C bus interface and are accessible via K4. The bare PCB for the USB Flash Board (Figure 2) is available from the Elek- tor Shop under order number 070125- 1. Alternatively, you can purchase a complete kit with all the componen- ts under order number 070125-71. As- sembling the board is not difficult. Be sure to avoid creating any shorts between D + , D- or the 5 V supply line and ground in the area around the USB socket. As there is no spe- cial protection for the D + , D- and 5-V supply lines, it’s a good idea to check this with an ohmmeter - but be sure to remove the microcontroller from its socket first. There is room for an ex- tra 100-nF ceramic capacitor beneath the IC socket, which should be fitted first. It provides optimal supply vol- tage decoupling. Initial operation You should use an AC adapter (8- 12 V DC) for initial testing. Fit jumper JP4 to select this power source. LED D1 should light up now. If you have already connected an LCD module, it 24 elektor - 11/2007 Flip USD intarmnllon should display dark pixels in the top line. If necessary, adjust the contrast trimpot until both lines are clearly dis- tinguishable. The upper line will re- main dark until the board has been in- itialised with a program. If you have an oscilloscope, you can also check the 12- MHz clock signal on the crystal. This clearly shows that the microcontroller is running. You have to download a program for the first real software test. For this purpose, you can use the Flexible In- System Programmer (FLIP) software, which you can download free of charge from Atmel’s home page (www.atmel. com). Enter ‘Flip’ as the search term to find FLIP 2.4.6 for Windows (4 MB, Version 2.4.6, updated May 2006). First extract the contents of archive file flip- 2_4_6.zip to a separate folder and then run the Setup.exe file in that folder. Fol- low the installation instructions and accept the licence conditions and sug- gested installation location. You will then see a short list of instructions for what you have to do next (Figure 3). The program is installed by default in C:\Program Files\Atmel\FLIP 2.4.6Y fxj lo |W'>m hcgrcfiTOfiq ihe UCIS rtthl tp. Clt** procKd » Fi 4 >w: 2 - CfrraL Ivprt ‘HvilpaE h Upb PC. =. frthw Hhr Ik-, a ‘iv rW..-i t TV* miff . ttvrtfd vr-fM * I I*? P* wt-lfd Vp«/K Locrtor. thtdkfcov [ 1 %. s - tom ifi m 7a.Mj.a1, Figure 3 The free FLIP programming software displays a list of what you have to do to start using the board. Faund New M-.ir rtwj.hr*? Wi/ jrd Fin -AMI l.h'IUI'n STMM.h Jrvj rr|-|.dl |l Min Mint 0 . I in Lr , :l m hw bcJuiM (Jn the ^bwdii. b?K»! ick** v del*# rtbie; lo?il firtht .wl mrivr fhr* hrsl diver tnunrl sul hr riiMlerl t, . SB®Llneni7ir!i#?fn«ijU>ju|3v.£l?-iRDM | >3 ■'ibfc III ■ iHUkiinn Dm X^iiV»nFiKV^lHLL>f , Ui i '2^ HVkIj y [ (fewra '-) Dortf :«-sck i r 4 choa::e tot di^ In nil*# Owns? 'be device Wmdgwi de*f r& pjeririH! Hn pir.TH |i»iiIiij:f hJ- r rr Im i "jrf r. In jji-h* IliiIwvf Now connect a cable to the USB con- nector and fit jumper JP2 in the ‘USB’ position (toward the edge of the board). To be on the safe side, press reset switch SI and close JP3. This starts the USB download firmware, which waits for contact with the PC to be established. The program reports vendor ID 03EB and product ID 2FFD, which enable Windows to assign a sui- table driver. Windows will recognise a new device and ask you to select a suitable driver. Select the driver loca- ted in folder C:\Program Files\Atmel\ FLIP 2.4.6\usb (see Figure 4). After it is installed, you will see the new de- vice in the Device Manager window. It can be recognised by its name ‘Jungo AT89C5130/AT89C5131’. If something goes wrong during this process, you have to track down the problem. Possible problem sources in- clude incorrectly fitted jumpers. For instance, if you activate the USB port with JP3 (pullup connected to D+) but do not start the internal firmware (JP2 still in the ‘Run’ position or no reset executed after switching over), Win- dows will report a new device - but not the right one. By contrast, you might start the update firmware correctly but fit JP3 incorrectly. In this case, Win- dows will not recognise that a device Figure 4. The microcontroller is recognised by Windows as a new device. igure 5 After you click Run, FLIP downloads the program to the flash memory of the microcontroller. 11/2007 - elektor 25 MICROCONTROLLERS Figure 6 Main menu of the BASCOM compiler. is connected, and thus no communica- tion will be established. After a bit of practice, you won’t have any problems making the right settings, and you can establish a communication session with the PC whenever you need it. Program download Now launch FLIP. First you have to use F2, Device a Select, or the IC icon to select the correct IC (AT89C5131). Then use F3, Settings a Communica- tion a USB, or the cable icon to select and open the USB interface. Finally, you have to use F4 or File a Load Hex File to load a suitable hex file. Select program file: 513 1_TE ST_ELEKTOR. HEX, which you can obtain along with the BASCOM AVR source code from the Elektor home page. Click the Run button (see Figure 5) to download the program code to the flash memo- ry. After this, you must change over JP2 and press the Reset button to run the program. Caution: the BLJB option is enabled automatically with a new microcontroller. You must deselect (uncheck) it the first dime you down- load a program, since otherwise it will not be possible to run the program af- ter it has been downloaded. If you want to download a new hex file after this test, you must first dis- connect the USB cable and then recon- nect it - and of course, with the right jumper settings and a Reset first. Af- ter this, you must establish the con- nection again in FLIP Alternatively, you can leave the USB cable connected and simply open JP3, which will also isolate the device from the USB without interrupting the supply voltage. In order to download a new program, you must first chan- ge the setting of JP2 again. The press Reset, wait two seconds, and fit JP3 again. This initialises the USB device. You will have to open the interface in FLIP again, after which you can start the download. Programming with BASCOM The BASCOM-51 Basic compiler is an ideal tool when you are just getting started with developing programs for the system, although you can also write programs for the microcontroller in C or assembly language. You can download a free demo version of BAS- COM-51 from the site of its producer, MCS Electronics (www.mcselec.com). The free version can generate up to 4 KB of code, which is sufficient for many applications. Figure 6 shows the main menu of the compiler. In order to ensure correct operation of the board, you must as- Hardware test in Bascom-51 'Simple test for inputs, 'outputs and LCD ' kkkkkkkkkkkkkkkkkkkkkk Dim X As Byte PI = 0 Cls Led " 8051-Test Wait 1 Lowerline Led " Elektor Wait 3 For X = 1 To 13 Shiftlcd Right Waitms 200 Next Cls Led " Test Port 0 Lowerline Led " Bit 2 exp 0 PO = &B11111110 Wait 1 Lowerline Led " Bit 2 exp 1 PO = &B11111101 Wait 1 Lowerline Led " Bit 2 exp 2 PO = &B11111011 Wait 1 Lowerline Led " Bit 2 exp 3 PO = &B11110111 Wait 1 Lowerline Led " Bit 2 exp 4 PO = &B111 01111 Wait 1 Lowerline Led " Bit 2 exp 5 PO = &B11011111 Wait 1 Lowerline Led " Bit 2 exp 6 PO = &B1 0111111 Wait 1 Lowerline Led " Bit 2 exp 7 " P0 = &B0 1111111 Wait 1 Lowerline Led " All Bits P0 = &B 00000000 Wait 1 Cls Led " Test Port 3 " Lowerline Led " Test Port 0 (LED) Wait 3 Status : P0 = P3 X = P0 Cls Led " Inputs " Lowerline Led "Port 3 = " ; X ; Waitms 60 Goto Status End 26 elektor - 11/2007 sign the LCD pins to port P2 under Options (Figure 7). BASCOM supports configuration of different register files for individual 8051 derivatives. Although there are no specific settings for the AT89C5131, this microcontroller is largely compa- tible with the 8052, so you should use register file 8052.dat. The listing shows the source code of the test program. It is easy to read and largely self-explanatory. After an intro- ductory message is displayed on the LCD, a running-light routine is execut- ed to check all the LEDs on Port P0. Following this, the inputs on port P3 are read in an endless loop and their f , , , , . . , . . . Figure 7 The assignment of the LCD pins to port P2 must be configured under Options, states are copied to output port P0 3 3 r r r Oft mm \U \ \ Li and shown on the LCD. You can ac- tuate the DIP swit- ches (S2) and pushbuttons S3-S6 to check that they are proper- ly assigned to the port pins. The as- sociated output LED will light up for each switch. The test pro- gram thus exer- cises practically all of the hardware. found in the 89S8252 and the 89S8253. However, in this case it is governed by different control registers (SFRs). This means that you cannot escape a care- ful study of the data sheet if you want to use the supplementary hardware. Like the 8052, the AT89C5131 has ano- ther serial interface that can be used with BASCOM by instructions such as Print and Input. However, this re- quires connecting an additional line driver (such as a MAX232), since the USB Flash Board does not have a serial interface port. This opens the door to typical interface applications, which means that you can use the micro- controller as a PC -based measuring in- strument, counter or motor controller. Of course, the AT89C5131 can also do a lot more, including implementing a complete USB device. This is descri- bed in several application notes and accompanying source code on the At- mel website. The archive file c5131- usb-kbd-stand-alone-l_0_2.zip de- monstrates how to construct a USB keyboard. A couple of ideas Finally, a couple of ideas for further projects. The microcontroller has an internal EEPROM, similar to what is With this USB microcontroller and the extensive software archive, you have essentially everything you need to de- velop your own USB applications. ( 070999 - 1 ) 11/2007 - elektor 27 HOME & GARDEN More and more ISPs are offering subscribers an extra phone line using Voice over IP (VoIP) on top of their Internet access. As a result, the number of people with two phone lines in their home is constantly increasing. These are easy enough to manage by connecting one (or more) phones to each line. But then you have to decide which phone to pick up when it rings (well, that's easy - it's the one that's ringing!) or when you want to make a call (trickier, that one!). Nicolas Boullis A single phone for two lines The project described here reduces this inconvenience by letting you connect a single phone to two lines at once, to avoid having to tie knots in the ca- bles! It’s a phone line switcher that routes the ‘correct’ line to the phone automatically. Specification Lots of phone devices (answering ma- chines, cordless phones) need exter- nal power to work. To avoid adding yet another power supply, we decided to make this project run on batteries (or better still, NiMH rechargeables). This does have an extra advantage: the switcher stays working even in the event of a power cut, so you can still call the electricity company. The downside is that we had to watch the power consumption, to get maximum battery life. Line selection needs to be follow a cer- tain logic: • If one line is already in use via the switcher, under no circumstances must that line be switched, as that would cause the loss of the communication in progress. • The user must have the option of man- ually selecting the line of their choice - for example, to be able to make a call on one line while the other is ringing, or to use a particular line to call a number at a special rate, or which is not acces- sible from certain types of line. • If there is no manual selection or communication in progress, a line must be selected if it rings. • Otherwise, Line 1 (the ISP VoIP line) is selected be default, so long as it is ‘available’ - a line of this type will be unavailable during power cuts or if the ‘super-modem’ is turned off for some reason. • Lastly, in the absence of Line 1, Line 2 must be selected. As we don’t necessarily know how the two lines are referenced with respect to earth, it’s important that both lines should be well isolated electrically. By the same token, to eliminate any dan- ger, both lines must also be isolated from the logic part of the circuit. And lastly, there must be some way of indicating to the user at all times which line they are using, and which line(s) is/are ringing. One other aspect we mustn’t forget: to be accessible to as many people as possible, the project should use only readily-obtained components that are easy to solder (and don’t require any programming!) Phone lines Building this switcher requires you 28 elektor - 11/2007 to have a basic minimum knowledge about the way phone lines work. Be aware that certain specifications may vary from one country to another, and may be different for private in- stallations - as may be the case for the phone lines provided by ISPs too. Quiescent, a phone line appears as a DC voltage source of 48 V, the polari- ty of which is not necessarily defined, and on certain installations may even vary over time. During ringing, an AC voltage is super- imposed on this DC voltage. The swing and frequency of the ring voltage dif- fers from country to country. In the au- thor’s home country, France, this is a sinewave of around 50 V rms and with a frequency of 50 Hz. The ring signal Figure 1. Circuit diagram of the line switcher. lasts around 2 seconds, with intervals of around 3 seconds. When a phone takes the line, it must draw a DC current of 20-50 mA. This current causes a substantial drop in the DC line voltage, which may fall to around 10 V or so. Control unit To switch the phone lines efficiently, while maintaining the isolation be- tween the two lines, the natural choice is a 2-pole changeover relay. However, IC2A 2 JT& VCC O C12 VCC o IC1 = HCC40106BF IC2 = 4093 VCC VCC 060288-11 11/2007 - elektor 29 HOME & GARDEN Figure 2. Pattern of the generously-sized double-sided through-hole plated switcher board. [components | list I Resistors | Rl / R2 / R7 / R8 = 33kD R3,R1 1 ,R1 8 = lOkQ R4 / R13 / R27 = 1MQ R5,R6 = 100D R9 / R10 = lOOkQ R12 = 4MD7 ■ R1 4,1 5 = 47kD I R16,R17,R21,R22,R25,R26 = 1 kQ I R19,R20 = 1 OOkD | R23,R24 = 470k£2 Capacitors C1-C4 = lOOnF (7.5mm pitch MKT) C5 = 470 nF (7.5mm pitch MKT) C6,C9 = 6yL/F8 100 V 1 C7,C8 = 10jL/F 100 V I Cl 0,0 1 = 220jL/F 10V non-polarised I Cl 2, Cl 3 = lOnF (5mm pitch | Sibatit/ceramic) Cl 4, Cl 5 = lOOnF (5mm pitch Sibatit/ceramic) Semiconductors D1,D2 = BAT85 D3,D4 = 1N4148 D6,D7 = LED, 3mm, green (low power)* D5,D8 = LED, 3mm, red (low power)* T1 ,T2 = BC557 T3-T7 = BC547 IC1 = 40106BF IC2 = 4093 IC3-IC7 = TLP620 (Toshiba optocoupler) Miscellaneous K1,K3,K4 = RJ1 1 6/4 phone socket (Hirose TM5RE1 -64) K2 = 2-way SIL pinheader for power: 9 V NiMH battery S1,S2 = pushbuttons RE1 = Bistable 5 V 2-pole c/o relay (Pa- nasonic DS2E-ML2-DC5V or Omron G6AK-234P-ST-US) * see text the use of a conventional relay is hard to reconcile with very low power con- sumption, in view of the fact that it might be in either position for a long time. So we opted for a bistable relay These exist in single- and dual-coil versions. A single-coil one is driven using an H- bridge, which requires four transistors and four diodes. However, the dual-coil version needs only two transistors and two diodes, and the transistor drive is simpler. Whence our choice of a dual- coil bistable 2-pole changeover relay. To ensure proper switching even with a slightly low battery, the relay chosen is designed for 5 V working. Circuit Let’s take a look at the way the switch- er works, with the help of the circuit in Figure 1 , and examine the various functions. Detection There are three things to detect for the phone lines: presence (for Line 1 only), ringing, and line use through the switcher. Each of these requires its own detection system. To detect if Line 1 (connected via RJ- 11 socket K4) is in use, the 20-50 mA current drawn by the phone passes through one or other of the two in- verse-parallel connected LEDs in op- tocoupler IC5. This results in satura- tion of the phototransistor, taking the Schmitt invertor IC1C input to ‘O’, giv- ing a logic ‘1’ at the invertor output. Resistor R6 sinks 10 mA before the op- tocoupler LEDs light, to avoid their re- acting to currents that are too low. By the same token, unpolarized capaci- tor Cll shunts away the AC current present during ringing. The time con- stant formed by R14 and C8 avoids the circuit’s reacting to very short line-in- terrupts (up to around 0.5 s). Such in- terrupts are used for loop-disconnect dialling (increasingly rare these days, replaced by DTMF dialling) or when using a phone’s ‘R’ key. Ring detection involves detecting a high-amplitude AC signal. The circuit formed by C3, C4, R7, and R8 consti- tutes a rudimentary bandpass filter centred at around 50 Hz. The filter out- put feeds the two inverse-parallel con- nected LEDs in IC6, via resistor Rll. When the ring signal is present, the phototransistor is regularly saturated, taking invertor IC1D input to ‘O’, giv- ing an output at logic ‘1’. The time con- stant formed by C9 and R13 maintains this logic ‘1’ for around 5 seconds after the ring signal ends, to cover the gaps between rings. And lastly, Line 1 presence is checked by detecting the DC voltage on the line, which may be between 10 V (line busy) and 50 V (line free). During ring- ing, detection may be upset by the su- perimposed AC signal, so this is atten- uated by the low-pass filter formed by C5 and R9. When the line is present, resistor R10 acts to limit the current in the diodes in IC7 to a value between 40-250 /jA - well below the current representing a busy line, so as not to upset the operation of the telephone exchange. Having such a low current in the LEDs means the corresponding optotransistor doesn’t saturate fully, so the current is amplified in transistor T7. This does saturate, taking invertor IC1E input to ‘1’, giving a logic ‘0’ at its output. There is a problem with the leakage current of the phototransistor, specified as less than 100 nA. Howev- er, even this tiny current, multiplied by the gain of T7, might be enough to take the invertor input to ‘1’. To avoid this, resistor R12 shunts 120 nA away from 30 elektor - 11/2007 being amplified by T7. Indication For each line, a pair of transistors on the output of the line busy and ring de- tectors lights each of the pairs of LEDs (D5/D6 and D7/D8) either red for ring- ing and green for line busy. Line selection logic Line selection is achieved by resistors R18, R19, and R20, diodes D3 and D4, the pushbuttons wired to connections SI and S2, invertor IC1F and NAND gate IC2B. Push-button SI forces selec- tion of Line 1 and S2, Line 2 (connected via RJ-11 socket Kl). As the order of priority between the two manual selections is not defined in the specifications, we went for the simplest option: manual selection of Line 2 takes priority over selection of Line 1. The same goes for the ringing priorities: we have opted to give ring- ing on Line 2 priority over ringing on Line 1. Given that a line can’t ring if it isn’t present, Line 1 ring detection has no influence on the selection, and is used for indication only The output of gate IC2B is logic high (‘1’) for Line 1 selection and low (‘0’) for Line 2. Relay drive From this line selection, we need to generate pulses to switch the relays. Gate IC2A is wired as an invertor to invert the selection signal. The normal and inverted selection signals are de- layed via C12/R23 and C13/R24. Then For private domestic use only Readers should note that this project is to be used for private, domestic installations only. You should be aware of the fact that connecting home-built equipment to the public switched telephone network (PSTN) is prohibited. The project described here reduces this inconvenience by letting you connect a single phone to two lines at once, to avoid having to tie knots in the cables! It’s a phone line switcher that routes the ‘correct’ line to the phone automatically. Figure 3. Finished example of line switcher. NAND gates IC2C and IC2D each com- bine one delayed signal with the com- plementary un-delayed signal to gen- erate a ‘low’ pulse. This pulse is am- plified by transistor T1 or T2 to drive the relays. The values selected for C 12, C13, R23, and R24 produce pulses of around 5 ms which is enough to toggle the chosen relay. You’ll notice connections JP1-JP6 on the circuit diagram - we’ll be talking about them in the next paragraph. Construction Having looked at the theoretical side of this project, now it’s time to get our hands dirty. Thanks to the double-sid- ed through-hole plated circuit board shown in Figure 2, building this project - which doesn’t use any exotic compo- nents apart from the relays - is within the capabilities of any Elektor reader. Just the time it takes to warm up the soldering iron, fit the components into their designated places (paying at- tention to the orientation of polarized components - C6-C9, CIO, and Cll are non-polarized), solder them one by one and we’re (almost) done. We’ve sug- gested using RJ-11 sockets to connect the incoming lines (Line 1 and Line 2) and phone (Tel). Fitting the relay is no problem - it’s impossible to get it the wrong way. Take care fitting LEDs D5-D8 - the cathode goes at the bottom (i.e. point- ed end) of the symbol on the compo- nent overlay. Push-buttons SI and S2 connect to the points marked for them on the board. Now care is needed with the pin con- nections to sockets Kl, K3, and K4 - this is where connections JP1-JP6 come into play. They are used to adapt the circuit to the characteristics of the phone line concerned. You won’t find them marked on the board, as they’re only pairs of solder pads to be jump- ered. You’ll need to use a multimeter to check the active pins at the input to each phone line and short across the appropriate pairs of pads JP1-JP6 with a blob of solder to make the cor- rect connections. We opted for this solution because of the differences in phone socket pin assignments be- tween countries - and even within one country you may encounter ‘variable’ solutions, as a result of the telecomms markets being opened up. After checking your construction over carefully, all that remains is to connect the power (9 V PP3 dry battery or re- chargeable) to the connector provided, K2. Getting going When the switcher is turned on, the relays would be in an indeterminate state. For this reason, it’s important to ensure that a pulse is generated to force them into the state ‘selected’ by IC2B. When power is applied, capacitors C12 and 11/2007 - elektor 31 HOME & GARDEN Bicolour LEDs for D5/D6 and D7/D8 What if we want to replace the pairs of red/green LEDs with 3-pin dual- colour LEDs? Our engineers have already thought of that. All you have to do is to fit a single bicolour LED in the top three holes - making sure you get it the right way round, oth- erwise it will light green when it's meant to be red and vice-versa. As the chips in dual-colour LEDs have different efficiency for red and green, it will be necessary to change the value of the dropper resistors in the dual-colour LED anode lines. Resis- tors R1 7 and R21 for the green need to be changed to 2kQ2 (instead of the original 1 kQ). C13 are discharged. Hence they force both supposedly complementary de- layed signals ‘high’ for around 5 ms. Thus, irrespective of which state is selected by gate IC2B, a pulse will al- ways be generated at power-up, so the relays will be set to a known state. Power consumption Quiescent, and with Line 1 present, most of the power is consumed in resis- tor R27 (1 MQ), giving a consumption of less than 10 juA - with a 200 mAh battery, that would give a life of over two years. If Line 1 is absent, the quiescent power consumption is even lower (measured at less than 1 juA). In operation, most of the power is used to light the LEDs, i.e. around 6 mA for line busy (green LED) or 7 mA during ringing (red LED). So the same battery would allow around 30 hours of com- munication or 28 hours of ringing. ( 060288 - 1 ) Web Links www. rennes.supelec.fr/ren/fi/elec/docs/tele- fon.htm (note: this link gives information about the phone system used in France) www.semicon.toshiba.co.jp/docs/datasheet/ en/Opto/TLP620_TLP620-4_en_datasheet 020925.pdf Advertisement Electronics Engineers - Join A Winning Team! UK and Czech Republic We are looking for Engineers for the United Kingdom & Czech Republic. The Lektronix Group of Companies are the worlds leading provider of Industrial Automation repairs with an enviable reputation for the best in technical excellence and customer service. Due to the huge demand for our services we need to employ additional engineers at our three UK workshops (West Midlands, South Wales and Northern Ireland) to keep pace with the work we are receiving. Also, due to future expansion throughout Europe we are looking for English speaking engineers to train and work in the UK with eventual relocation to our workshop in Brno, Czech Republic. We are looking for Electronic Repair Engineers, Electronic Repair Technicians and Electronic Component Level Repair Engineers. Do you have an interest in electronics? Have you any experience in the field of practical electronics? Have you experience in Radio/Television/Home Electronics? Does your hobby/interest include electronics? Are you willing to learn new tricks - electronic engineering? Do you want work in an exciting and challenging environment? Do you have any experience with Machine Tool Systems - PLC's - Servo Drives - Servo Motors - Monitors-VDU's - AC Drives - DC Drives - Temperature Control - Digital Electronics - Analogue Electronics? r c Please Contact: Mr Brian Stewart Lektronix Ltd, Unit Cl, Anchor Brook Ind Park, Wharf Approach, Aldridge, West Midlands, WS9 8EQ, United Kingdom. We offer a competitive salary and all the other benefits normal with a go ahead company. Telephone +44 (0)1922 455555 for an application form or apply on line at www.lektronix.net 32 elektor - 11/2007 r Analog + Digital Digital Storage Oscilloscope Dual Channel Digital Scope with industry standard probes or POD connected analog inputs. Fully opto-isolated. USB Mixed Signal Oscilloscope ...or a BitScope Mixed Signal Oscilloscope Capture and display analog and logic signals together with sophisticated cross-triggers for precise analog/logic timing. Multi-Band Spectrum Analyzer Display analog waveforms and their spectra simultaneously. Base-band or RF displays with variable bandwidth control. Multi-Channel Logic Analyzer Eight logic/trigger channels with event capture to 25nS. DSP Waveform Generator Built-in flash programmable DSP based function generator. Operates concurrently with waveform and logic capture. Mixed Signal Data Recorder Record to disk anything BitScope can capture. Supports on-screen waveform replay and export. User Programmable Tools and Drivers Use supplied drivers and interfaces to build custom test and measurement and data acquisition solutions. BS100U Mixed Signal Storage Scope & Analyzer Innovations in modem electronics engineering are leading the new wave of inventions that promise clean and energy efficient technologies that will change the way we live. It's a sophisticated world mixing digital logic, complex analog signals and high speed events. To make sense of it all you need to see exactly what's going on in real-time. BS100U combines analog and digital capture and analysis in one cost effective test and measurement package to give you the tools you need to navigate this exciting new frontier. Standard 1M/20pF BNC inputs Smart POD Connector Opto-isolated USB 2.0 12VDC with low power modes BitScope DSO Software for Windows and Linux BS100U includes BitScope DSO the fast and intuitive multichannel test and measurement software for your PC or notebook. Capture deep buffer one-shots, display waveforms and spectra real-time or capture mixed signal data to disk. Comprehensive integration means you can view analog and logic signals in many different ways all at the click of a button. The software may also be used stand-alone to share data with colleagues, students or customers. Waveforms may be exported as portable image files or live captures replayed on another PC as if a BS100U was locally connected. www . bitscope . com v 11/2007 - elektor 33 AUDIO Headphone Amp with 3D Sound Sound reinforcement for iPod & Co. Raymond Champlin The owners of some brands of personal music players complain that the sound reproduction suffers from a lack of volume and has a 'thin 7 quality. This add-on headphone amplifier solves the problem; it combines a high-quality amplifier with bass and treble boost and a 3D sound effect. Crank it up too high and your eardrums will meet in the middle! *PIN NUMBERS ARE FOR THE TSSOP PACKAGE. Figure 1. Block diagram of the MAX4409 showing external components. The ear is particularly sensitive to sounds in the frequency range of the human voice. Frequencies above or below this band are perceived to be quieter and this effect is even more pronounced at low levels of volume. Some audio amplifier designs incorpo- rate ‘loudness compensation’ which boosts the bass and treble frequencies at low volume settings so that the ton- al characteristics of the amplifier are perceived as being more linear with re- spect to the volume setting. The head- phone amplifier described here com- bines a high-spec amplifier IC with a discrete transistor front-end giving additional bass and treble lift together with an audio 3D effect. The MAX4409 The MAX4409 is used as the main ster- eo power amplifier for the headphones in this design. This IC can operate with a supply rail in the range of 1.8 V to 3.6 V and has a number of interesting properties. The block diagram in Fig- ure 1 shows that the IC contains an on- board charge pump circuit to generate the negative supply voltage PV SS , used throughout the chip. This almost dou- bles the dynamic range of the ampli- fier and allows the output to be biased around ground potential even though it is powered from a single-ended sup- ply. Capacitor Cl in the charge pump circuit is switched at over 300 kHz. The stereo amplifiers use a class AB output stage and the negative voltage produced by the charge pump allows the amplifier to have symmetrical pow- er rails which removes the need for a large electrolytic coupling capacitor at the output. Each amplifier can supply 80 mW into a 16 Q load. Headphones with an impedance of 32 Q will be sup- plied with more than enough power. Figure 2. The circuit showing the transistor preamp with tone filters and the MAX4409. 34 elektor - 11/2007 vcc © * optional, see text [R8~ R122 Cl QO-ch*- H on T R2 * ] [ R3 H 1 k5 } HHn C2 R6 K 100k | — i— C4 R5 1 1 I 33k h R13 C5 R9 1H 10k 470p Rip 1 330k h C6 R12 * '-T* II 0°2D — r R1 ©-CH3" 470n C3 470n R4 © 470n © BC847C BC847C I R7 I +3V ©-0-O I VCC -© R50 rC on Ih I C50 external 1000(i I 16V 3^6 | R28 R R222 — |_on_ C21 Hln Ocw- R22 * C22 . HZZHH R23 H 1k5 I R26 — | 100k | ~ C24 R25 1H 33k C7 470n C41 □ R11 4|i7 R41 T R43 H 33k | - vcc X R45 12 10 X VCC © C44 J R14 - 0 - 0 - R21 ©-0-0- 470n C23 470n R24 © BC847C I •k C26 R32 * ■T R33 f II I look | J 47 °P R30 1 330k | ~ C25 R29 1H 10k R42 C42 4|i7 470n © BC847C R27 I 13 I PVDD SVDD SHDN INL Cl P OUTL IC1 C1NP INR SVSS MAX4409 EUD OUTR PVSS COM PGND SGND C45 11 14 R44 H 33k | - R31 K1 hC R47 H 10k H * R46 v- - 070393 - 1 1 11/2007 - elektor 35 AUDIO Figure 3. The double-sided PCB accepts SMD components but is not through-plated. To give some idea of the sound level you can expect from this design, head- phone sensitivity (in accordance with IEC 60268-7) is measured with an in- put power of 1 mW and an average set of headphones would typically produce a Sound Pressure Level (SPL) of around 96 to 100 dB at this input power level. The MAX 4409 can supply 65 mW into 32 Q so it is unlikely that there will be any complaints of insufficient volume! The distortion figure of the amplifier is below 0.01 % at (almost) maximum power output. A more typical level of distortion (measured at 1 kHz) at 50 mW into 32 Q is around 0.002 % and 0.005 % for 60 mW into 16 Q. Both of these figures are many times less than the distortion introduced by the head- phones themselves which can have a level of 0.2 % or more. Other notable features of the MAX4409 are its ‘click-and-pop’ suppression which effectively prevents annoying switch-on and off noises. It is also worth noting the excellent power sup- ply rejection ratio and the common- mode rejection ratio of 96 dB. The qui- escent supply current of the device is just 5 mA. The preamp stage The complete headphone amplifier circuit diagram is shown in Figure 2. The 33 Q resistors R1 and R21 ensure that input impedance of the amplifier is equivalent to the load presented by a standard set of headphones. It isn’t really necessary to use this value of resistance for any sort of optimal load matching so the value of R1 and R21 can be increased tenfold without any Components list Resistors (SMD 1 206 case) R1 , R2 1 = 33D R2,R22 = see text R3,R23 = 1 5kQ R4, R24 = 560Q R5 / R25 / R43 / R44 = 33kQ R6 / R12 / R26 / R32 = lOOkQ R7,R1 1 ,R27,R31 = 1 kQ R8,R28 = lkQ5 R9,R29,R41,R42,R45,R46,R47 = lOkQ R10,R30 = 330kQ R13,R33 = 2I