November 2009 AUS$ 13.90 - NZ$16.90 - SAR 99.95 £4.65 www.elektor.com /'id ’ r * •i Electronic Component Ordering Retail’s gone e-tail Ssfl r ■* J l Pi i J M . 1 » PL F K T OR Vfkftrvcr 1 1/7009 VSSaot, 6LYN fc Dacoa Wait R32C Web Server Networking module for HTTP, e-Mail, FTP and much more Light Therapy BOX Blue LEDs combat winter blues Solder Station ‘Plus’ With integrated dvm 9 770268 45115 9 R48 11 BitScope Analog + Digital Digital Storage Oscilloscope Dual Channel Digital Scope with industry standard probes or POD connected analog inputs. Fully electrically isolated from PC. Mixed Signal Waveform Analyzer Capture and display analog and logic signals together with sophisticated cross-triggers for precise waveform timing measurement. Instant Replay Signal Generator Built-in synchronized waveform generator. Synthesize arbitrary waveforms or replay captured analog or logic signals instantly. Multi-band Spectrum Analyzer Display analog waveforms and their spectra simultaneously in real-time. Baseband or RF signals with variable bandwidth control. Integrated Waveform Data Recorder Record to disk anything BitScope can capture. Allows off-line replay and waveform analysis. Export captured waveforms and logic signals. Multi-platform & user programmable Supports Windows, Linux and Mac OSX. USB and Ethernet models with user programming libraries, drivers and customizable software. Mixed Signal Oscilloscopes $ry >// f ► ... 1 tel i W J BitScope is built tough to last a lifetime. Enclosed in a new low profile solid extruded aluminium case BitScope 325 can handle the harshest working environments. Its full metal jacket and electrically isolated design means that unlike cheap plastic alternatives it is also highly noise immune for the most sensitive mixed signal measurement applications. On the road or in the lab, BitScope is the ideal choice! Logic/Timing Analyzer Probes Industry Standard Scope Probes Software Included BitScope Software and Libraries BitScope 325 includes DSO, an intuitive test and measurement software application for your PC. The integrated test instruments include a digital storage oscilloscope, spectrum analyzer, logic state and mixed signal timing analyzer and an arbitrary waveform generator in one package. DSO is fast, with display rates up to 50Hz and deep, with capture up to 512kS per frame. Also included is a built-in data recorder to share captured signals with colleagues or customers via data export and real-time offline analysis. If you also need programmability, BitScope 325 comes with the BitLib application programming library for custom software applications or full integration with existing third party tools. Windows, Linux or Mac Ethernet or USB La www . bitscope . com DEVELOPMENT TOOL JUST THE WHY YOU LIKE IT Everything you’ve always wanted from a development tool Experience the ease of creating your own electronic devices! Complete PIC development solution Speed up your prototype development with the EasyPIC6 Development System. The EasyPIC6 comes packed with examples that makes your PIC development fast and easy. Save time & money! Get extra value for your money with this first-class tool for PIC development solutions. Get into the PIC world faster and easier than ever before with the EasyPIC6 Development System. Designed to suit your needs Your development time can be considerably reduced, resulting in an early prototype design and fast time-to-market for your end product. Thanks to many new features, you can start creating your own devices immediately. EasyPIC6 supports 8-, 14-, 18-, 20-, 28- and 40- pin PIC microcontrollers. The mikrolCD (Hardware In- circuit Debugger) enables very efficient step by step debugging. Examples in C, BASIC and Pascal are provided with the board. Hardware In-Circuit Debugger for step by step debugging at hardware level Port Expander provides easy I/O expansion (2 additional ports) using serial interface Full-featured and user- friendly development board for PIC microcontrollers On-Board 2x16 Serial LCD Display Keypad enables easy and fast data entry High-Performance USB 2.0 On-Board Programmer e Q-o 0 o o 00 1 'PCJODOODO-fiVOOfl 1 « flOflOoooooaooo 0 as? 0 0-0 □ o o a o □ * G £' ■=> 0 9000 000 CD oc o o 004 OCG 909000 ■D D CMS 0 & & 90 0 9 O u & C> QC'L'OOOC'G C — ' OOOOOOOOOOOao D □ O Deo D 90 9 _ OpC-DO-DOC DO : > - -■ oo-aboaoeoarr 1 , 'PCioPO'OfliBOi ' LV ' ■*— r 9 3 09 99 p 909 r; L y ” -E n n 1. A » A A. A A ■ ■ I 20 R32C Webserver Cheerfully supports http, email, ftp and more. 28 ATM18 BASIC Computer AVR micro simulates vintage home PCs like the ZX81. 32 Arduino + Theremin = Theremino The legendary hand operated instrument nowcast in Arduino. 36 New Developments in Class D Look, reduced EMI and no output filter! 38 Solder Station ‘Plus’ A commercial low-power solder iron gets real temperature control. 43 AVR, dB and LDR collide at D/AJunction Some components just don’t get along very well. 44 CAD in the Elektor Lab The introduction and use of Altium by our design staff. 45 Sine Wave Service Avery old project gets lab support all the way. 4 11-2009 elektor CONTENTS Volume 35 November 2009 no. 395 20 R32C Webserver A small add-on module for the application board from our September 2009 is- sue combines a TCP/IP chip plus Ethernet interface, a network connection with built-in transformer and status LEDs. This handy combination makes it child’s play to implement a web server and many other Internet applications without getting involved in complexities such as TCP/IP protocol. 48 Light Therapy Box Blue LEDs fight SAD a.k.a. the Winter Blues. 52 Driver-free USB Interface Data harvesting with the Elektor ECIO and an HID. 56 IGLOO Nano & Icicle FPGA kits A review of two really cool products from Actel. 32 Arduino + Theremin = Theremino This tiny oscillator circuit, when coupled with the software running on the Ar- duino microcontroller board, has a huge range of potential applications, allo- wing proximity-based control of any other circuit or system. 60 The World’s Smallest Electric Motor How an Elektor reader made it into the Guinness Book of World Records. 64 AVR-Max Chess Computer A minimalist homebrew chess computer. 38 Solder Station ‘Plus’ Twenty pounds or so would probably buy you a simple soldering station but it would not give you the same satisfaction as one that you built yourself and be- sides it would not have the energy control or DVM features of this design with its in-built microcontroller. 67 Booster for Audio Signals A simple project to crank up bass and treble levels. 70 USB Mouse using R8C/13 Starter Kit Tom Thumb encounters a Mouse called USB. 74 Hexadoku Our monthly puzzle with an electronics touch. 48 Light Therapy Box During the winter many people suffer from Seasonal Affective Disorder (SAD), which is commonly known as the Winter Blues. With the help of blue light the- se symptoms can be reduced. The blue-light generator described here has a built-in timer and is perfect for this task. 76 Retronics: Klystrons type 2K25 and 2K56 Regular feature on electronics ‘odd & ancient’. 84 Coming Attractions Next month in Elektor magazine elektor 11-2009 5 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. oSSSSSKt*. !£*-*»*. Volume 35, Number 395, November 2009 ISSN 1757-0875 Elektor aims at inspiring people to master electronics at any personal level by presenting construction projects and spotting developments in electronics and information technology. Publishers: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 www.elektor.com The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor is published 1 1 times a year with a double issue for July & August. Elektor is also published in French, Spanish, American English, German and Dutch. Together with franchised editions the magazine is on circulation in more than SO countries. International Editor: Wisse Hettinga (w.hettinga@elektor.nl) Editor: Jan Buiting (editor@elektor.com) International editorial staff: Harry Baggen, Thijs Beckers, Eduardo Corral, Ernst Krempelsauer, Jens Nickel, Clemens Valens. Design stct Antoine Authier (Head), Ton Giesberts, Luc Lemmens, Daniel Rodrigues, Jan Visser, Christian Vossen Editorial secretariat: Hedwig Hennekens (secretariaat@elektor.nl) Graphic design / DT Giel Dols, Mart Schroijen Managing Director / Publisher: Paul Snakkers Marketing Carlo van Nistelrooy Subscriptions: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 Internet: www.elektor.com/subs 6 12-2009 elektor Elektor Personal Organizer 2010 Wy Complete with a free pen and SMD-tool The Elektor Personal Organizer 2010 makes planning your appointments a real pleasure, and you always have ready access to have handy information that everyone who works with electronics needs to know. C \ In addition to the usual features such as an ap- pointments calendar, address book and notes pages, this organizer has around 40 pages pac- ked with useful information for you as an elec- tronics specialist, both professionally and in your leisure time. For example, there is an extensive collection of formulas and tables for calculating current and voltage, component descriptions, physical constants, connector pin assignments, and much more. The Elektor Personal Organizer 2010 at a glance: • 201 0 calendar (two pages per week) • Appointments calendar (with corner perforations) in six languages • 40 pages of technical information on electronics • Seven sections, separated by tab sheets • Alphabetic address and telephone book • Handy monthly planner • Lined pages for your notes • Five credit-card pockets and a pocket for business cards • Push-button closure • Six-ring binder mechanism (diameter 25 mm) • Luxurious grey imitation-leather binding ISBN 978-90-5381 -247-1 • £24.90 • US$41.90 Further information and ordering at www.elektor.com/prganizer 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: r.elgar@husonmedia.com Internet: www.husonmedia.com Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photo- graphs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software carriers and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopy- ing, scanning an recording, in whole or in part without prior written permission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may ex- ist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publisher to alter the text and design, and to use the contents in other Elektor International Media publications and activities. The Publisher cannot guarantee to return any mate- rial submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2009 Printed in the Netherlands elektor 12-2009 7 NEWS & NEW PRODUCTS New products galore from Parallax micro SD-Card Adapter The micro-SD Card Adapter (32312) allows you to easily con- nect a micro-SD Flash Memory Card to your Propeller chip or other microcontroller. This adapter contains the components required for an SPI interface between the host microcontrol- ler and a micro-SD memory card. The micro-SD Card Adapter includes a card detect switch which allows you to detect when a memory card is physically present in the socket. It also includes mounting holes so you can install it in your application. Price: $14.99. 433 MHz RF Transceiver Module The Parallax RF Transceiver (27982) is a very easy to use and low cost module capable of sending serial data wirelessly between microcon- trollers or to a PC. The low power consumption makes this module ideal for use in battery powered applications. This module sends and receives data by AM or CPCA modulation, thus offering a higher average output power which extends its range. This module is equipped with an RSSI feature that can be utilised to improve power efficiency by waking up circuitry only when an external signal is detected. Price: $39.99. »• - H 30 H I- X Ssj s -slli I 1 1 • <<» . • X . .. • 5' l : 2 v U- y • • • f (2 » * , » . 7 ? t 7 * ? MMA7455 3-Axis Accelerometer Module The Freescale Semiconductor MMA7455l_3-Axis Digital Output Acceler- ometer (28526) is a low power, micro machined sensor capable of meas- uring acceleration along its X, Y, and Z axes. It offers several conven- ient integrated features including an analogue to digital converter (ADC), digital low-pass filter, and selectable sensitivity ranges of ±2g, ±4g, or±8g. This device can be easily configured to detect quick motion pulses as single taps, double taps, and 0 g (free fall) conditions on any or all axes and pro- vides configurable interrupt pins (INTi and INT2) for each type of event. Flexibility and compatibility are designed into this module. An on-board voltage regulator and I/O voltage level-shift- ers make this module especially easy to connect to virtually any microcontroller. It operates over a wide range of supply voltages from 2.5 VDC to 5.5 VDC and communicates via Serial Peripheral Interface (SPI) or Inter-Integrated Circuit (I2C) bus. Price: $34.99. 7.2V Motor ; Bracket and Wheel Kit High quality 7.2 Volt DC motors feature durable construction, and 100% all-metal gears that stand up boldly to rough ter- rain and abuse. The motors’ top speed of ~3io RPM equates to a speed of approximately 6.6 feet / second (2.0 m/s) which is perfect for most medium- to small-size robotic projects. The included machined aluminium hubs solidly engage the 4 7/8 inch (12.4 cm) diameter wheels. The tread is moulded directly onto the wheel and offers excellent traction on most common surfaces. Price: $79.99. www.parallax.com (090750-I) Altium NanoBoard 3000 FPCA dev kit for £295 Altium has launched a new addition to its NanoBoard family of FPGA-based develop- ment boards. The NanoBoard 3000 is a pro- grammable design environment, supplied complete with hardware, software, ready- to-use, royalty-free IP and a dedicated Altium Designer Soft Design license. Designers have everything they need to explore FPGAs ‘out of the box’. They are no longer forced to search the web for driv- ers, peripherals or other software, and then have the hard work of integrating all these elements to make them work together. Using the NanoBoard 3000, electronics designers can construct sophisticated ‘soft’ processor-based systems inside FPGAs with- out any prior FPGA expertise. Engineers do not need any specialist VHDL or Verilog skills. Instead, they can use their existing board layout and systems design skills to con- struct, test and implement FPGA-based embedded systems. The IP libraries and intuitive graphical editors that are central to Altium Designer mean they can simply add processors, memory controllers, peripheral blocks and software stacks. They have eve- rything they need to create next-genera- tion, FPGA-hosted embedded systems with off-the-shelf components without having to write HDL or low level driver code. Altium includes a range of reference designs and tutorials to get engineers designing imme- diately. More IP will be added in the future. The first NanoBoard 3000 features a Xilinx Spartan 3AN FPGA. Two more NanoBoards, featuring Altera and Lattice FPGAs, are planned. In all three NanoBoard options, the FPGA is fixed. The NanoBoard 3000 is available for a recommended retail of £295 and includes a subscription to an Altium Soft Design License which also includes all software updates released by Altium during the 12-month subscription period. Design- ers can purchase a NanoBoard 3000 from Farnell UK. price 12-month Designer http://uk.farnell.com/altiuin (090750-II) 8 11-2009 elektor NEWS & NEW PRODUCTS The Next evolutionary leap in microphone technology Laser-accurate technology revolutionises the very concept of the microphone, trading mechanical parts movement for the patented and incredibly precise measurement by a laser of the movement of particulates suspended in air. Proof-of-concept was demonstrated by Laser- Accurate inventor and digital audio pioneer David Schwartz at AES show floor in New York, on September 21, 2009. There have been several key milestones in the evolution of the microphone, from the develop- ment of the basic transducer in the 19th century, to the introduction of the condenser microphone in the 1920s, followed by FET microphones in the 1960s and the more recent multichannel microphones used for surround audio applications. The next step in this evolutionary pro- cession was introduced at the 127th Audio Engineering Society Show, Oct. 9-12, 2009, at the Javits Center in New York City. Laser- Accurate® technology, from Schwartz Engineering & Design (SED), is claimed to represent a revolution in microphone technology: instead of the conventional diaphragm whose resonance creates electrical impulses against a coil or a back plate, Laser- Accurate technology uses a laminar stream of air in a chamber in which microscopic particles are suspended. When excited by changes in air pressure, the move- ment of these particles is detected by a laser beam that continuously passes through the chamber aimed at a photoelectric cell opposite the laser source. Conventional microphone design has numerous inherent idiosyncrasies: the speed with which a traditional diaphragm can react is innately limited by its physical size and shape, and the variety of those mechanical elements inevitably adds tonal colouration — distor- tion —to the sound it’s recording. In the design of Laser- Accurate, the diaphragm or plate is replaced with microscopic particles dispersed in a gas-filled chamber in which the laminar flow of the gas is constant. Detection of the displacement of the airstream and particles by a laser and optical receiver creates a completely non-intrusive method by which to meas- ure the movement of air. This arrangement means no significant mass stands between the source of the sound and the transduction of it to a recording media. (090750-V) Long life, low cost sealed sleeve bearing DC fans Orion Fans, a division of Knight Electronics, has developed a new family of sealed sleeve bearing DC fans. The Challenger Series fans feature a unique patented sealed sleeve bear- ing system that has an exceptionally long life expectancy of more than 50,000 hours at 25°C (L10). MTBF is in excess of 200,000 hours. The new sealed sleeve fan technol- ogy retains lubricant by using metal foils that serve as a guard to redirect and recy- cle the lubricant. The fans were developed in response to a continuing demand for fans with a wider temperature range and longer life than sleeve bearing fans, but at a lower cost in comparison to traditional ball bearing fans. The Challenger Series sealed sleeve fans are offered in seven sizes ranging from 40 x 10 mm to 120 x 38 mm, and are available in 12 VDC and 24 VDC versions. Airflow ranges from 6.7 to 105 CFM. The fans feature a brushless DC, auto restart, polarity-protected motor with a UL94V-0 plastic frame and impeller. The sealed sleeve fans are RoHS compliant. The sealed sleeve Challenger Series fans are available from stock at Allied Electronics in North America and RS Components in Europe. www.orionfans.com (090750-IV) New ESR analyser Atlas ESR + Measuring ESR is a fantastic way of finding faulty electrolytic capacitors, and even for tracing PCB short-circuits. A new addition to the Peak range has now been released which offers even more than the well established ESR60. The new instru- ment, the Atlas ESR + (Model ESR70) adds several features that many hobbyists, tech- nicians and engineers will find invaluable. The most notable new feature is the inclu- sion of ‘Audible Alerts’. Every measurement of ESR will be shown on the display as usual of course, but the unit will also produce a variety of tones depending on the value of ESR. The ESR measurement range has also been enhanced, now doubled, measuring from 0 to 40 ohms with a resolution as low as 0.01 ohms. This remarkably fine resolu- tion is great for assessing large capacitors and even allows you to use the Atlas ESR + for tracing short-circuits and finding the precise area of a PCB that has that invisible wisp of solder. The original Peak Atlas ESR (ESR60) unit will continue to be manufactured by Peak and is available at a new special price of £75inc VAT, while the new Peak Atlas ESR + (ESR70) is available for £89 inc. VAT. Peak charge just £2 for delivery in the UK. If you’re an existing user of the original Atlas ESR (ESR60), you can send it to Peak for a hardware and software upgrade to the ESR70 features for £55 inc. VAT. Customers with an ESR60 unit less than 3 months old can upgrade for just the difference in price between the two units. www.peakelec.co.uk (090750-IX) elektor 11-2009 9 NEWS & NEW PRODUCTS IAR: development package for ARM Cortex- Mo, -Mi, -M3 cores IAR Systems now supplies their Embed- ded Workbench for Cortex-M. Believed to be one of the world’s first integrated development environment designed spe- cifically for ARM Cortex-Mo, Cortex-Mi, and Cortex-M3 based cores, IAR Embed- ded Workbench for Cortex-M provides a comprehensive set of tools in a single package. Based on the latest full license edition of IAR Embedded Workbench for ARM 5.40, this limited license edition is competitively priced and helps keep the costs of equipping development engi- neers with industry respected toolsets to a minimum. It is perfect for developers just entering the ARM Cortex market. IAR Embedded Workbench IAR Embedded Workbench for ARM Cortex-M SYSTEMS The package includes an editor, project management tools, a highly optimizing C and C++ compiler, and a C-SPY simulator. Other tools include hardware debugging functions, support for RTOS-aware debug- ging on hardware, run-time libraries, relo- cating assembler, linker and librarian tools. IAR Embedded Workbench for Cortex- M provides extensive support for a wide range of hardware debug systems and RTOSes and generates very compact and efficient code. Ready-made device con- figuration files, flash loaders and exam- ple projects are also included. The com- piler can check against the rules of MISRA C (MISRA O2004) software development standard as established by the Motor Industry Software Reliability Association. An evaluation edition of IAR PowerPac RTOS, file system, USB stack and a TCP/IP stack bundles in included within the pack- age. IAR RTOS plugins are available from IAR Systems and other leading RTOS vendors. www.iar.com (090750-VI) Atmel maXTouch (TM) : superior human interface touchscreen solution Atmel® Corporation announced the produc- tion release of its new maXTouch (TM) family of capacitive touch- screen control- ler solu- tions, capable of supporting an unlimited number of unique simultaneous touches with a video-quality screen refresh rate of 250 Hz. Atmel’s new maXTouch technol- ogy platform supports the development of touchscreens surpassing 10 inches with full zoom, rotate, handwriting and shape recog- nition functionality. The first device in the family, the 1T1XT224, has 224 nodes that allow it to accurately report the positions of unlimited, simul- taneous touches and it can completely redraw the screen every 4/ioooth of a sec- ond (4 ms). The mXT224’s large number of nodes and fast performance makes it the world’s first touchscreen solution suitable for advanced touch screen functionality, such as rejection of unin- tended touches, stretch/pinch and rotate gestures, handwriting and shape recognition such as face detec- tion on mobile phones, mobile Internet devices (MID) and netbook screens surpassing 10 inches. By integrating the entire capacitive sens- ing circuitry on-chip, these maXTouch products provide a fully integrated single- chip solution without the need for exter- nal components to support the capaci- tive sensing, minimizing the cost and PCB footprint requirements. Multiple 1T1XT224 touchscreen solutions can be used to pro- vide smaller interspatial distances between touches on larger screens. Products utilizing the advanced 1T1XT224 touchscreen solution are currently progressing in design at sev- eral leading handset, netbook and other consumer product OEMs. The 1T1XT224 is the first capacitive touchscreen solution able to support the use of a stylus for drawing or signature cap- ture and character rec- ognition, thanks to its 80:1 signal-to- noise ratio (S/NR) and extremely fast refresh rate. A high S/NR is critical for the accurate reporting of adjacent or weak signals, and allows for precise reporting in noisy environments such as products with noise coupled from radio transceivers, LCD displays and battery chargers. Solutions without a suitably high S/NR consume more power and decrease their response time with extra filtering and processing in an attempt to extract a weak signal from a high noise environment. In contrast, the nearest competing off-the-shelf touch- screen solution has half as many nodes as the 1T1XT224, a screen refresh rate of only 83 Hz (66% slower) and an S/NR of only 25:1 (66% less). In addition to offering the best SNR rates in the market, maXTouch offers advanced noise suppression algorithms to provide end products with the ultimate immunity against coupled noise issues. The unlimited number of touches possible with Atmel’s maXTouch technology is the result of its mutual capacitive sensor design, combined with Atmel’s Charge- Transfer method of signal acquisition. Unlike self capacitance technolo- gies that sense individual rows or columns leaving ambiguity in reported multi-touch positions, mutual capacitance * sensors create a matrix of independent capacitive sensing nodes at the intersections of these rows and columns. Using Atmel’s maXTouch technol- ogy, each of these nodes are independently scanned within the matrix accurately sens- ing the position of an unlimited number of touches and delivering smooth movement in any location of the screen. 10 11-2009 elektor NEWS & NEW PRODUCTS The processing efficiency provided by the XMEGA (TM) microcontroller CPU allows the chip to ignore unintentional activity such as facial touch when on a call with a mobile phone. This capability, combined with the ability to collect the charge image in near theoretical times, allows the maXTouch products to demonstrate extraordinary per- formance. The 1T1XT224 integrates Atmel’s single-cycle RISC AVR core with 32 registers and two on-chip DSP engines that process the X and Y positions on the touchscreen. An event system and peripheral DMA con- troller off-load all inter-peripheral commu- nications and data transfer operations from the CPU, freeing it up for post-processing of the sensor image. This architecture enables the simultaneous processing of 224 nodes at 250 Hz, while consuming less than 5 mW. Additional maXTouch touchscreen solutions will be introduced in the Q4 2009 and Qi 2010. www.atmel.com/maXTouch (090750-VII) Automotive SoC enables precision ultrasonic sensing Maxim‘s newest MAXQ mixed-signal micro- controller provides a compact SoC for accu- rate ultrasonic distance measurements, and adds intelligence to cost-sensitive sensor- conditioning applications. The MAXQ7667 SoC is a mixed-signal micro- controller for ultrasonic sensor applications. A highly integrated DAS (data-acguisition system), this SoC provides a cost-effective solution for applications that must measure weak signals over long distances or identify multiple targets. Its integrated functions, moreover, allow designers to add intelli- gence to cost-sensitive sensor-condition- ing applications. The MAXQ7667 is opti- mized for automotive-sensor systems such as EPA (electronic parking assist) and PDC (park-distance control); it is also well suited for industrial processing, automation, and handheld applications requiring position measurement. This 7mm x 7mm device integrates the main functional blocks required to accu- rately measure position, including burst control (pulse transmission), analog echo reception, digital signal processing, and a microcontroller. This advanced integration reduces system cost and increases sensor- mounting options. The MAXQ7667 features a programmable burst-frequency generator to compensate for transducer tolerances, adjust frequency with temperature, and perform diagnos- tics. Programmable burst and duty cycles can optimize power to match environmental conditions. The echo receive path includes a vari- able gain amplifier, a 16-bit sigma- delta ADC, a digital bandpass fil- ter to eliminate OOB (out-of-band noise), and a digital demodulator with lowpass filtering to create an echo envelope. The MAXQ7667 is available in a space-saving 48-pin LQFP pack- age, and is fully supported over the -40 degrees Celsius to +125 degrees Celsius automotive tem- perature range. An evaluation kit is available to speed designs. This kit includes an evalua- tion board and a PC-based IDE (integrated development environment), which pro- vides a debugger, assembler/linker, time- limited version of the IAR C-compiler, and simulator. www.maxim-ic.com/MAXQ (090750-XI) LED street lights in Portuguese cities The implementation of efficient, attractive LED street lighting in Portugal has gathered pace over the summer as EnergiaViva has completed installations of the new UrbanLED street light in ten towns and cities. Installation work in a further 20 Portuguese municipalities is expected to have been completed this fall. The UrbanLED luminaires were introduced in April 2009, when they were installed on a street in the Portuguese town of Pombal. The solution, which uses LUX- EON Rebel power LEDs from Philips Lumileds, provide an attractive combination of power efficiency, CRI, uniform light dis- tribution and low maintenance and repair costs. These qualities have seen it quickly gain favor with other municipalities in Portugal. During the summer, UrbanLED street lights have been installed on streets in the towns of Alcochete, Moita, Barreiro, Arraiolos, Pombal, Santa Maria de Feira Vale de Cambra, Estarreja, Coimbra and Torres Vedras. The installations have been carried out by EnergiaViva and the installations are as popular with residents as with municipality officials. The white light from the UrbanLED transforms areas that were previously a dark yellowish colour from the high-pressure sodium lamps that they replace. The accelerating roll-out of LED street light- ing means that high-pressure sodium lamps could begin to be eliminated from Portu- guese streets. The installation progress in Portugal is the result of a unique consortium of companies in the energy, lighting and construction industries. Exporlux and its development division BlueSpan, which is responsible for the luminaire design, and Rosas Constru- tores SA have joined forces and as Energ- iaViva, deliver a complete solid state street lighting solution to municipalities. www.philipslumileds.com 090750-X) elektor 11-2009 11 NEWS & NEW PRODUCTS From 8 to 32 bit: PSoCs with 8051 and ARM cores By Jens Nickel (Elektor Germany Editorial) The chip manufacturer Cypress Semicon- ductor is introducing two new variants to their PSoC (Programmable System on Chip) family of devices. The new PS0C3 architec- ture is based on an 8051 compatible core while the PS0C5 includes a 32-bit ARM Cor- tex-M3 processor. Since the original ver- sion using this architectural concept was introduced six years ago the company has shipped 500 million units but this newgen- eration of devices with its improved capabil- ities promises to open up even more areas of application. In a time of credit crunch and recession it seems as though the embedded controller market is one area of growth in US manufacturing. Just like the earlier version of this chip archi- tecture (now renamed PS0C1) the new sys- tem-on-chip variants contain digital build- ing blocks which are configured via soft- ware (just like a CPLD) to produce timers, counters PWM generator and a whole lot more. Uniquely the PS0C1 and the two new PSoC chips have the capability to configure analogue circuits also so that ADCs (with 20-bit resolution), DACs, mixers, PGAs (Pro- grammable Gain Amplifiers), opamps and much more can all be implemented on-chip. The chip architecture is popular with design- ers because it often results in a true single- chip solution which reduces time spent in development and produces a finished chip which occupies much less space on the PCB compared with other solutions. From Drag & Drop to finished circuit Programming and configuring the new PSoC-Chips is accomplished using the ‘PSoC Creator’ Integrated Design Environ- ment (IDE). This powerful tool is free to download from Cypress semiconductor. The PSoC Creator environment allows the connectivity of the functional blocks in the chip to be defined using a ‘drag and drop’ graphical interface placing the blocks on a ‘design canvas’. The IDE is supplied with a library of dozens of pre-configured ana- logue and digital peripherals and the user can also develop new blocks and add them to a library as necessary. The user interface allows the functional block connections to be configured down to opamp level and ‘parameterized’ to make optimum use of the on-chip resources. An integrator for example could be reconfigured as a differ- entiator; the user can select the amount of feedback and much more besides. At the press of a button the tool generates a set of APIs which allows the running software access to the functional hardware blocks. For controller software development there is a CA51 Compiler from Keil and a GNU GCC- ARM Compiler included in the IDE. The ‘PSoC Creator’ combines and expands on the func- tionality of the earlier ‘PSoC Designer’ and ‘PSoC Express’ tools which were developed for use with earlier PS0C1. PSoC Creator is a completely new development and not com- patible with these older tools. Faster, Better, Bigger, More The introduction of these new variants to the PSoC family was spurred by the custom- er’s request for more processing power. The earlier PSoC devices are based around an M8C core and many have been put to good use in the design of computer keyboards and USB mice. Processing power is sufficient for jobs such as motor control and sensor interfacing e.g. the ‘CapSense’ capacitive proximity detector input sensor developed by Cypress to replace unreliable mechanical switches and sliders. More advanced appli- cations such as audio/video processing, multimedia (now in the automotive sector) and high speed communication processing all demand significantly more processing power. The need for speed is ever present. Cypress estimates that the potential mar- ket for its 8 to 32-bit embedded controllers could be in the region of $15 billion. Com- M as ■mr l> Ji 4 tf 6* »*■ - j Pra*~=« -MOC-Molcr- P m u {jtwM.Som m u PSsCM • OM.I e} ctocfc.'.uoc* jJ dbck_l_OBe* - U CfCer****.! sj t * 3< ■ u CrCtrtKtVatJ S) CyCvnOteg. J CyO»«**9. 6 0 *.' Si - O *WM.l d 5 wv i pwi 2 pwv.i'pw o»wj ’ d *wu 3 PWU _2_*Wt 3 .2.PWI - u *vw.) d 3 pwu 3 _pw\ sl wwyjw* ■ O w .1 d W.'.Tm* Tm> 1 Tm 3 naao.na* a O W.lj* d W.ljWjr, 3 w.ij j eyflrx** <] Crftaacc I lom • / V 1-4 fit rx * 1 o □ o N A *N J J CfCmcclgt 3 CrOaaeH 0*> » A * , [w]w M A at * C3 * _ L rL OX Tachometer Temperature Pump Pressure I . ADC DolSKJ a 9 1 J — ( V EOC •v 2 16 Bit Rnoluiwi Ti 81DC„T**1 capture ou»r' capita* 1C- ® Bflt PWMHsa, Or* Cueu Ml tee* nml- lltJTkM CMPVWU*! IP 5 CW T|p* t lat e> ba D**d Bar* CiMtM C*u Stea J <* I 12 n-20og elektor NEWS & NEW PRODUCTS peting manufacturers offering FPGAs and other similar programmable devices will also take some share of this market. The new PSoC variants bring with them impressive processing power: The 8-bit 8051 processor achieves 33 MIPS while the 32-bit ARM Cortex-M3 can hit 100 MIPS and its DMA interface achieves fast memory access. In addition the number of program- mable gates has risen from 1,000 on the original PS0C1 up to 20,000 on the PS0C3. Filter functions are now realised digitally ratherthan as analogue blocks. This should increase available bandwidth; the original was good for signals up to 150 Khz before it ran out of steam. Prominent at the top of the data sheet are the power saving fea- tures of the design: firstly the supply volt- age range is guoted as 5.5 V to 0.5 V (!) while ‘hibernate’ mode of the PS0C3 con- sumes just 200 nA which should be good news to designers of small mobile equip- ment, wireless sensors and other ultra low power applications. A significant advantage of the family is the pin and API compatibility between the 8 and 32-bit architectures. This means that a designer can start system design with a PS0C3 and if later on more processing power is required the existing design can migrate up to the PS0C5 platform without problems. A good feature to simplify circuit layout is the free allocation of any GPIO pin to any signal in the functional blocks. The chips also provide support for full-Speed USB, I2C, SPI, UART, CAN and LIN interfaces. The PS0C5 is also fitted with a JTAG debug interface. Starter kits from $49 US First samples of the PS0C3 chip should be available from November 2009 and it is anticipated that samples of the PS0C5 will be available by the beginning of 2010. Pro- duction is due to commence in the first quarter and second half of 2010 respectively. The chips will be available in a variety of package outlines offering different levels of integration (memory size and GPIO count). The unit price is expected be in the range between 1 and $10 US. Two evaluation kits are available: the PSoC 3 FirstTouch™ Start- erkit retails at $49 US and includes a PS0C3, evaluation board and on-board acceleration sensor, thermistor and ‘proximity detector’ (we took a closer look at the starter kit in last month’s edition of Elektor). A more comprehensive kit costing $249 US is well appointed and contains both a PS0C1 and a PS0C3 processor board. This will give developers a hands-on opportunity to com- pare the two PSoC systems. The Cypress semiconductor website is the place to go for data sheets, application notes and also to download the ’PSoC Creator’ software package, just follow the link below. www.cypress.com/psoc (090775-I) Low cost high power RF module for 868 MHz ISM Radiocrafts AS have expanded their RC232 product line family with a completely new high power module, the RC1180HP- RC232. The module is pin compatible with the existing RCnxx-series, and ena- bles extended range using the same low- cost design philosophy applicable for the whole RCnxx product family. The RC1180HP-RC232 (868 MHz) module is certified for operation up to 500 mW under the European radio regulations for license-free use. When used with quarter- wave antennas a lineof-sight range of over 3 km can be achieved. The compact RC1180HP-RC232 module, measuring only 12.7 x 25.4 x 3.3 mm, sets a new standard of integrating high power technology into a complete RF modem in one single tiny package, replacing tens of components compared to a discrete design. No external components are required, except an antenna. The modules are delivered on tape and reel for efficient volume production. The module is a complete RF system solu- tion running on the existing industry proven RC232™ protocol, with an easy- to-use UART interface for both configu- ration and communication. The embed- ded RC232™ protocol provides a point- to-multipoint solution with individual addressing or broadcast, and CRC check for signal integrity. The module can also be used as a wireless RS232 / RS485 cable replacement. Modules and Demo Kits are available now. www.radiocrafts.com (090750-NN) CLOCKING SYSTEM POWER MANAGEMENT POWER BOOST I- ROM 0.5V CAN 2 0 I'C > USB 2 0 ttHHUM DMA CORTEX MV 8051 CORE INTERRUPT CONTROLLER DEBUG & TRACE JTAG'SWO DIGITAL SUBSYSTEM UDB UDB UDB UDB ■vcp rv»Aj UDB UDB UDB UDB ' A/f » I i-.v\j UDB UDB UOB UOB •v(* - VMM UDB UDB UDB UDB -«'«•- CCOfTtH r*,v\j UDB UDB UOB UDB UDB UDB UDB UDB ANALOG SUBSYSTEM Z o k? < f or iaj S oc 8 d£ CL • » « ► GPIO GPIO GPIO GPIO GPIO SIO PSoC® 3 / PSoC® 5 Platform Architecture elektor 11-2009 13 COMPONENT BUYING Where (in the World) Can You Get It? Ordering electronic components By Thijs Beckers (Elektor Netherlands Editorial) As far as electronic components are concerned, going out to do a bit of shopping is a thing of the past. Now you can order almost everything on the Internet. Email, plain English and a credit card go a long way. You just have to wait a little while for the courier service, and then you have what you want. Despite retail having gone e-tail, a visit to your local electronics shop can have its advantages. Here we present an overview of electronic component suppliers. As opposed to five years ago, or even a bit longer, nowadays almost every electronic parts retailer or distributor has an Internet pres- ence. In fact, the situation has completely reversed: in many cases there’s only a webshop, so you unlike the glory days of London’s Edgware Road you can’t just pop in and pick up your components, or have them handed to you over the counter. How does this affect the availability of electronic components? And what about service and prices? Can you get anything you want? There are now countless webshops on the Internet. Of course, most of them are aimed at consumers, but the situation in the M ii-20og elektor Tips! electronic components business is somewhat different. As this involves individual components instead of finished products, it is much more common for a company (OEM) to order these com- ponents (in bulk) with a view to making an end product, which is then ordered by an end user. There are a number of large companies, such as Farnell, Mouser, DigiKey and RS Components, which can supply nearly all com- monly used electronic components. If you are a commercial cus- tomer, they offer a good range of products and (in most cases) a good search engine. However, it is often difficult (or more difficult) for private persons to place orders with these companies, since they are used to handling orders for large quantities. In addition, you can often find components at lower prices elsewhere, such as in much smaller webshops that specialise in particular compo- nents. Naturally, this requires a certain amount of searching, but as a private person you can usually find the time for this — at much lower cost than, say, a 50-mile ride, or a bus ticket to the nearest city (and finding the shop closed). Most large wholesalers and distributors only take orders from com- mercial customers. If you don’t fall in this category, you can ask your acquaintances whether they know someone with a small business registration who would be kind enough to place an order for you. Here you have to bear in mind that prices on sites of this sort typi- cally do not include sales taxes, which you have to pay as well. Other sources In addition to webshops, you can find electronic components on auction sites and sites that sell second-hand goods. The best known example is www.ebay.com, but if you ask your favourite search engine to look for auction sites you will find many more. On the eBay site, it’s usually worthwhile to look for shops (eBay stores) that specialise in electronic components. Service If you take the traditional approach of visiting your local (or nearest) electronics shop, you can usually expect to receive suitable assist- ance from the sales staff. Their knowledge (with regard to more than just components) can come in handy when you are looking for a particular solution, so don’t be afraid to ask for help. When you search for components on the Internet, you are fully on your own. You have to personally pick the right component package (now then, what should it be: TQFP, LQFP, or something else?). You may be able to obtain useful information from forums oriented toward electronics, such as a number of the .alt and .sci Yahoo newsgroup clusters. Some sites provide component data sheets, which can be very helpful. They can be very useful when you’re making a PCB layout or looking for a component with suit- able specifications. • Many manufacturers let you order free samples. In this case, you can obtain a few components either free of charge or by paying the shipping charges only. • In quite a few cases, you can also order directly from the manufacturer. This may not be the least costly approach, but it is certainly the most direct. • Data sheet sites such as www.alldatasheet.com, www. datasheetarchive.com, and www.datasheetcatalog.com are especially useful. • Exercise caution with orders direct from China and other far Asian countries, since they are a source of many fake items. Group purchasin Some components are only available in large quantities. As a pri- vate person, you often need only a small quantity or just one, so it’s unreasonable and not affordable to buy 1 00 or more at once. A group purchase often provides a remedy in such situations. Some- one takes the initiative to organise the purchase of a particular com- ponent (or even a complete product) from a wholesaler at a reduced price. If enough people can be found to participate in the group pur- chase, the initiator orders the components or products and forwards them to the other members of the group after they are received. These purchases are usually organised via a website in order to find enough participants. Group purchases of specific items, such as en- gines for model aeroplanes, are often organised on hobby sites. As you are dealing here with an individual who organises the pur- chase, rather than a webshop, it’s a good idea to first make sure that the person concerned is trustworthy, such as by looking for previous group purchases organised by this person. Of course, there’s always a certain risk, but if you find many positive comments and few if any negative comments, you generally don’t have to worry. NOS and NIB A noteworthy phenomenon is companies that sell what are called ‘NOS components’. ‘NOS’ stands for ‘new old stock’, which means components that are unused (and thus new) but which are no long- er in production and have been in stock for a while, perhaps tucked away in the back of a warehouse (‘old stock’). In particular, there is a surge in demand for valves that were once produced by compa- nies that no longer exist. ‘NIB’ (new in box) is also sometimes taken to refer to the above type of component. This can even go so far that a company buys a full fabrication system - the complete production line with all the original machinery - in order to produce and sell ‘old-fashioned’ components. For example, Russian Sovtek valves are made using former Telefunken machinery. elektor n- 20 og 15 i6 11-2009 elektor elektor 11-2009 17 Reader feedback We received a few responses to our request in the i-TRIXX e- Weekly item for week 35, 2009. Here we would like to share one of them with you. Dear Elektor, sadly we have found that all the electronics shops in our region have disappeared. This is not such a great problem for us as a com- pany, since we can do business with all sorts of distributors. However, I was looking for MRF 286 FF transistors for a personal project. We managed to find a few via Hl< Inventory, so we initiated a request for quotation (RFQ). We received several hundred re- sponses to this request from the Hong Kong and China region, with unit prices ranging from $ 5.50 to $ 150 . I happened to know from one of my customers that prices in this re- gion depend on whether you are a Chinese or non-Chinese custom- er. He has a native Chinese employee who requests prices for his needs and has the orders delivered to an address in China, and who personally organises the transport from that location. If suppliers have any idea that you are a foreigner, the prices increase sharply. In addition, the suppliers are not paid until the goods are delivered Prices and charges The enormous free market created by the Internet results in fierce competition and very price-conscious consumers. This naturally puts strong pressure on the prices charged by suppliers, but the downside is that shipping charges and import duties are almost always added to Internet orders because the shop isn’t just around the corner or there simply isn’t any shop where the components can be picked up. Finding the lowest price is an entertaining challenge, but it is some- times like looking for a needle in a haystack. It often happens that some of the components you need for a project are available at very good prices in one webshop, while some other components are less expensive in another shop. It sometimes takes a lot of calculation to figure out that it would have actually been less expensive to order everything from that webshop with the high shipping charges. Overview To make your searching a bit easier, we have put together two tables with some useful internet addresses. Unbiased and by no means exhaustive, it presents an overview of the best known suppliers of electronic components, along with their characteristics or special features. Where a supplier is marked ‘distributor’ in the Notes col- to my customer in China, as otherwise you apparently never receive your goods. Knowing this, I asked my customer for a favour: to have his buyer order the transistors for me. I was quite willing to purchase several hundred, as long as I got a fair price. The specifications were clear: this transistor in this package with this manufacturer code. I sent the buyer a list of the responses I had already received that ap- peared to me to be plausible. However, it turned out that things weren’t that simple. Some people tried to tell me that there were different versions of the transistor (despite the fact that the specifi- cations were so clear that there was only one possibility), while oth- ers did their best to sell me development services because it takes professional expertise to solder components on a circuit board. It ultimately turned out that all the suppliers who initially respond- ed to my RFQ were beating about the bush. They were presumably trying to get a foot in the door so they could supply other products. A year later, some of them are still sending me lists of their product lines. None of them include RF transistors, which is what I am inter- ested in. The friend of the Chinese buyer also told us that salvaged items are often sold as new. At that point, we put an end to the exercise and started looking for a different solution. Jeff V. (Belgium) umn it is not usually possible to order from them as a private indi- vidual — but feel free to try. “Broadband supplier” indicates that a wide range of components and materials is stocked, including pas- sives, semiconductors, connectors, cables and electromechanical parts. These companies typically pride themselves in publishing catalogues “thicker than the Bible”. We welcome additions and updates to the tables, so all readers can benefit. Naturally, you can also visit our forum [1], where other users may be able to point you in the right direction and where you can tell other users about your favourite supplier or webshop. (090592-I) Internet Link [1 ] www.elektor.com/forum 18 11-2009 elektor QUASAR electronics The Electronic Kit Specialists Since 1993 Quasar Electronics Limit PO Box 6935, Bishops Sto CM23 4WP, Tel: 01279 4 United Kingdp 67799 led rtford m Fax: 01279 267799 E-mail: sales@quasarele ictronics.com Web: www.duasarelectrcnics.com 01279 Postag^ 3-7 Day Europe SOrder We acc to Quas Please project4 95 & Packing Op Delivery - £4 (EU) - £8.95; Rtf cfnline for reduc ^pt all major cr ar Electronics. Visit our online modules and ions (Up to 0.5 UK Mainland st of World - £ ed price UK Pc Vdit/debit cards Prices include shop now for publications. Credit Card ,5K ery - £9.95; 9 ) Di 00 kits, Ik quantities. VISA Electron 4 467799 OOOOOOOOOOOOO ' — ; OOOOOOOOOOOOO OOOOOOOOOOOOO OOOOOOOOOOOOO ' — ! 0000000000 , ' — 0000000000s' f — ■' oooooooooor X ’ — oooooooooor -X ‘ oooooooooor -X ’ 1 | oooooooooor Or - M oooooooooor 0000000000 ^ C • u O 0 o oooonctono 1 V 2 1 ELEKTOR Webserver 11/2009 WI Zne t , GLYN & Dacom West Elekt or him . .mm l. It 1 iff in in 1 r e-Mail, FTP and much more by Jinbuhm Kim (South Korea) and Joachim Wiilbeck (Germany) The R32C microcontroller goes Internet! A small add-on module for the application board from our September 2009 issue combines a TCP/IP chip plus Ethernet interface, a network connection with built-in transformer and status LEDs. This handy combination makes it child’s play to implement a web server and many other Internet applications without getting involved in complexities such as TCP/IP protocol. Free downloads of an Open Source driver, a short web server program and other sample software complete this attractive proposition. The South Korean electronics company WIZnet [1] has its origins at the University of Seoul eleven years ago. Within a short while it had produced the W3100, the first hardwired TCP/IP chip on the market with a 10/100 M Bit/s Ethernet interface. The Internet protocol stack in this was created in hardware, so as to relieve the MCU of complicated TCP/IP protocol processing. 20 ii-20og elektor +3V3D SI S2 S3 63 R32C111 - P9.3/DA0/TB3IN RESET P2.0/AN2.0 P2.1/AN2.1 P2.2/AN2.2 P2.3/AN2.3 P2.4/AN2.4 P2.5/AN2.5 P2.6/AN2.6 P2.7/AN2.7 P10.0/AN0 P7.0/TA0OUT/TXD2 P7.17TB5IN/TA0IN/RXD2 P7.2/V/TA10UT/V/CLK2 P7.3/TA1IN/V" P7.4/TA20UT/W P7.7/TA3IN/CLK5 P8.3/TNT1 P3.0/TA0OUT/CLK3 P3.1/TA30UT/RXD3 P3.2/TA1 0UT/V/TXD3 P3.3/TA1 IN/V XIN XOUT P8.7/XCIN P8.6/XCOUT P8.4/INT2 P8.5/NMT P7.5/TA2IN/W P7.6/TA30UT/TXD5 P8.0/TA4OUT/U P8.1/TA4IN/U P8.2/TNT0 P6.0/TB0IN P6.1/TB1IN/CLK0 P6.2/TB2IN/RXD0 P6.3/TXD0 CTS1/P6.4 P6.5/CLK1 P6.6/RXD1 P6.7/TXD1 J9 J8 J6 J5 J4 _36 _3S _34 33 28 27 26 25 U4.B JT-\ R11 (+) +3V3D +3V3A +1V8D Q © +1V8A FBI 1 uH 12 18 44 2 +3V3D 0 6 RESET 59 44 DO 26 43 D1 25 42 D2 24 41 D3 23 40 D4 22 39 D5 21 38 D6 20 37 D7 19 WIZ SCS CD O 1 1 WIZ_CS 55 24 | WIZ_MOSI 28 23 ! WIZ_MISO 27 22 | WIZ SCLK 30 21 ' 1 1 R8 SCS 29 1 0R 1 1 20 ' ' WIZ_RD 58 17 WIZ_WR 57 13 WIZJNT 56 SPI _EN 31 12 54 11 53 U4 = 74LVC2G14 U5 = 74LVC1G79 U6 = 74LVC1G32 U7 = 74LVC2G08 090607- 11 Figure 1 . Schematic of the network module and R 32 C connection (for clarity the application board section shows only the LEDs and press switches, whilst the 3.3 V regulator and some passive components in the network module are not shown either). This enabled Internet applications such as web server, e-mail, FTP and plenty more to be implemented even on small 8-bit microcontrollers without the need for an operating system. Users need not worry about programming the PHY, MAC, IP and TCP layers but can instead rely simply on the built-in driver functions (see panel for explanation of these abbreviations and [8] for how these layers work). Family connections After the W3100 the company developed several more chips, with varying levels of integration. The W5100 that we are using here is a 3-in-i chip that combines the TCP/IP, MAC and PHY functions in hard- ware and is controlled either by SPI bus or over an 8-bit parallel interface. Net- work modules in DIL form, comprising the TCP/IP chip and an RJ-45 connector with transformer, simplify the hook-up further. In this project we employ the WIZ812MJ module, which plugs very conveniently into our R32C application board. WIZnet’s product range also offers higher performance Internet chips, handling data rates up to 80 Mbit/s. These are for demanding applications such as HD video or image recognition. In the near future the 4-in-i chip W7100 will further enhance the range; as well as the protocol functions already mentioned this also includes an 8051 core, 64 l> 8);// send address high byte // send address low byte // send data // CS=1, SPI end Listing i: Writing data over the SPI bus void SpiSendData (uint 8 Val) { #ifdef USE_PORT_IO uint 8 i; void uart_end ( void ) { while ( !ti_u2cl ); empty while ( !txept_u2c0 ); empty re_u2cl = 0; te_u2cl = 0; } // software SPI // wait for tx buffer to // wait for tx register to // disable rx // disable tx received data (for instance the URL of a web- site requested) from the receive store of the W5100. If requested, the reply data will be written to the output store and the com- mand send() given. When the Client closes the connection, having received all of the desired data (in multiple packets should the need arise), the socket reverts to ‘closed’ after the corresponding handshake, The socket will now need to be initialised afresh before a Client can be registered again. Additional protocol information, check- sums, flags and so forth are processed by the W5100 internally during transmission and reception of data, with only the pay- load itself put into store. The W5100 can handle a maximum of four sockets simultaneously and independently from one another. This means the server remains reachable when a socket is occu- pied (established), momentarily shut off (closed) or is just initialising itself afresh (init). Different sockets can also act simul- taneously as a server or as differing clients and consequently monitor various ports or connect to servers. A socket can be a DHCP client first and when activated call up the network configuration from a DHCP server. Afterwards this socket can then become a web server. At the same time another socket can be forwarding an e-mail by SMTP. The third port is then (for example) another web server and the fourth an FTP server. Source code for all these applications is available free from the chip manufacturer. You can check out more on the subject of TCP/IP protocol on the Internet, for example in the ‘TCP/IP Guide’ [3]. Accessing the outside world As already mentioned, the R32C application board provides not only SPI control but also parallel connection in indirect mode. Using parallel data transmission the W5100 is in a position to achieve data rates up to 25 Mbit/ s. Anybody who feels like it is welcome to implement indirect mode and check out the maximum data rate of the R32C/111, but for this article we have concentrated on SPI mode. Figure 4 sets out the signal timings of the SPI interface for writing and also for for (i = 0; i < 8; i++) { W5 1 0 0_P_SCLK = LOW; if (0x80 & (val << i)) W5100_P_MOSI = HI; else W5 1 0 0_P_MOSI = LOW; W5 1 0 0_P_SCLK = HI; } W5 1 0 0_P_SCLK = LOW; #else // hardware SPI uart_begin ( val ) ; uart_end ( ) ; #endif } void uart_begin ( register char cmd ) { te_u2cl = 1; uart tx ( cmd ) ; // enable tx // send the command 24 ii-20og elektor reading a byte. The protocol is extremely simple and consists of four bytes. The pre- amble (opcode) signalises whether reading or writing is being performed. The middle two bytes contain the 16-bit address and the fourth byte the actual data. To read or write a single byte thus requires four bytes. Maximum clock rate at 14 MHz is so large, however, that a data rate of up to 3.5 Mbit/s can be achieved. The SPI interface can be realised in software on any desired port pins of a microcontrol- ler. The R32C/111 and many other micro- controllers support SPI with a synchronous serial interface but also in hardware. Rene- sas calls this method ‘clock synchronous serial interface mode’. In the downloada- ble driver source code files you will find both implementations and can swap between them simply with the compiler directive ‘USE_PORT_IO’. Chris Vossen (Elektor Labs) und Jinbuhm Kim (Head of Application & Software for WIZnet) have written an SPI driver for the Renesas M16C product family, especially for the R32C. Listing 1 includes extracts from the SPI driver. First the interrupts are switched off, in order to avert further inter- ruptions. Then the SPI chip select (/ SCS) is set and the four bytes are sent sequentially. Following this the SPI chip select is removed and interrupts are activated once more. Sending a single byte follows by software or hardware SPI. Sample web server A small, very simple sample application is shown in Listing 2. The Elektor server moni- tors Port 5000 and responds to any request that includes the string ‘elektor’. The main loop splits into a switch case statement according to the status of the connection in the subroutines SOCK_ESTABUSHED, SOCK_CLOSE_WAIT and SOCK_CLOSED. If the socket is closed the socket is reactivated with the commands socket() and init(). If data is being received the server responds with („elektor“). A step from this ‘text server’ to a proper web server is taken by initialising the socket on port 80 and performing an analysis rou- Architecture and source code files The web server application consists of a number of source code files that handle the func- tions listed above. In detail these are: Main.c: The actual web server and status management controller. Can be customised for implementing an individual server. Web server.c: Fundamental web server functions that can be used without alteration for users’ own applications. HTTPD.c: HTTP functions that can be used without alteration for users’ own applications. SOCKET.c: Functions for socket handling that can be used without alteration for users’ own applications. W5100.C: Driver (here in a version for hardware/software-SPI and the R32C controller). Re- quires rewriting if another form of communication (parallel) is employed. hwsetup.c: R32C-specific hardware set-up. OLED28.C: Driver for the OLED. If a different controller is used then W51 00. c and hwsetup.c will need to be adapted cor- respondingly (the chip manufacturer has, however, already produced drivers for some con- trollers [1]). Listing 2: Main loop ‘Elektor Server’ socket (i, Sn_MR_TCP, 5000, 0x20); // open Socket, Port 5000 listen(i); // go into listen mode = Server while ( 1 ) { sock_status = getSn_SR(i); // get socket status switch (sock_status) { case SOCK_ESTABLISHED : len = getSn_RX_RSR ( i ) ; // get size of buffer if (len > 0) { if (len > M AX_BUF_S I Z E ) len = MAX_BUF_SIZE ; len = recv(i, sock_buf, len); // return received size send ( i , "elektor\r\n" , 9); // send „elektor" } break ; case SOCK_CLOSE_WAIT: disconnect ( 0 ) ; // send „FIN, ACK" break ; case SOCK_CLOSED: closed); // close Socket socket (i, Sn_MR_TCP, 5000, 0x20); // reopen Socket listen(i); // to listen mode break ; } } elektor n- 20 og 25 Marc Oliver Reinschmidt from Glyn has also integrated the OLED rou- tines that were described in our May issue [5]. Messages can be written to the OLED display line by line using the text input box. Of course the WIZnet logo is included as well. All the images shown on the web- site are compiled statically in our sample program. Anyone who wishes to can also implement an FTP server and bring on board image files from the external SD card. The source code files of the small web server (are well commented. Addi tional sample servers and clients for a variety of controllers are available to download from WIZnet [1] as free Open Source software. The R32C application board [2], the R32C tine for data received from the client (e.g. URLs from websites you have requested, etc.). A small, proper web server is waiting for you to download at [4]. Figure 5 shows what you see in the browser. The appli- cation first sends a request by DHCP automatically as client to obtain con- figuration from the router. You now have a web server that will respond to requests as a simple website. This example is a web form with two check boxes for indicating the status of two LEDs on the application board. Naturally the user can also switch these LEDs on and off. Rtaral* < trtlrtl min* V.'l HM'l - Jftuill . fa. Id; jfljt ■ C ■ 1'U n‘lVtr !*>■ I UAJlfl W lllXl ism L 1 ■ krn I _LaJlLbijC*r+.j licHi Figure 5 . The sample web server software lets you control the LEDs on the application board across the Internet. Words that you type into the text box appear on the OLED! starter kit including the controller board [6] and the WIZ812MJ network card are all available from Elektor [4]. This versa- tile and comprehensive range of hard- ware has in fact so many possibilities that it won’t take long for Elektor read- ers to come up with their own ideas. Tips and suggestions to the editorial address will be most welcome! (090607-I) Internet Links [1 ] www.wiznet.co.kr/en/ [2] www.elektor.com/090209 [3] www.tcpipguide.com/free [4] www.elektor.com/090607 [5] www.elektor.com/081 029 [6] www.elektor.com/080928 [7] www.dacomwest.de/e_index.htm [8] http://en.wikipedia.org/wiki/OSLmodel The authors Jinbuhm Kim manages the applications de- partment at WIZnet [1 ] and is head of the support team for their global distribution company. Joachim Wulbeck is a field application engi- neer with the distributor Dacom West [7], with responsibility for interfaces and sensor technology. The authors can be contacted via their orga nisations’ home pages. 26 11-2009 elektor Don’t just test it,,, ."Analyse it! Special Offer prices for limited period or while stocks last! electronic design ltd The New Atlas ESR Plus, Model ESR70 This new model of the famous Atlas ESR offers all the great features of the ESR60 but with extended measurement range and audible alerts. This is the Atlas ESR Plus ! • Capacitance from luF to 22,000uF. • ESR from 0.01 ohms to 40 ohms. • Great for ESR and low resistance measurements (short tracing etc). • Automatic controlled discharge. • Audible Alerts (for good ESR, poor ESR, open circuit and more). • Gold plated croc clips. Atlas SCR - Model SCR100 Connect Triacs or Thyristors any way round. Auto part+pinout identification Check gate lOOuAto 100mA. Measures gate voltage drop. Regulated load test conditions WsS Atlas IT -Model UTP05 Identify network cabling type. Identify many fault types. Tests sockets and cables. Complete with all this: Atlas ESR - Model ESR60 Capacitance and ESR! Capacitance luF to 22,000uF ESR O.OIohms to 20 ohms Gold plated croc clips £75.00 inc VAp (£65.21 +VAT) Atlas DCA - Model DCA55 I Atlas LCR - Model LCR40 I Atlas Star Pack (LCR/DCA) The famous Peak Atlas! Now with premium probes. Connect any way round to identify semiconductor type, pinout and lots of parameters Transistors Darlingtons MOSFETs Diodes LEDs and more. £53.83 i (£46.81 Passive component analyser. Identify inductors, capacitors and resistors. Auto frequency selection. Removable probes. Includes the Atlas LCR, Atlas DCA and a premium padded carry case, with extra spare battery. £12:4.99 inc VAT (E108.69+VAT)' Peak Electronic Design Ltd, West Road House, West Road, Buxton, Derbyshire, SKI 7 6HF. tel. 01298 70012 www.peakelec.co.uk sales@peakelec.co.uk UK: Please add £2.00 p&p per order. Prices include UK VAT. See website for overseas prices. Tel: 01 635 40347 "|JT| LIieLtviizs Llrl rjAiOlEH :in*: r JJ-J. T.i. Ykit*r h‘i c i iii'LiiaiJia-r.t'air.xaTux.i K nw. wlIs rj4-a Ihaas-j'auf Q) {/) V Q_ O v to o u Q_ Technology The new PicoScope 4000 Series high-resolution oscilloscopes ■ T * 1 ^ ■, ■ ^ >3, a 1 TT^= 1 - - - - The PicoScope 4224 and 4424 High Resolution Oscilloscopes have true 12-bit resolution inputs with a vertical accuracy of 1%. This latest generation of PicoScopes features a deep memory of 32 M samples. When combined with rapid trigger mode, this can capture up to 1000 trigger events at a rate of thousands of waveforms per second. • PC-based - capture, view and use the acquired waveform on your PC, right where you need it Software updates - free software updates for the life of the product USB powered and connected - perfect for use in the field or the lab Programmable - supplied with drivers and example code Resolution 12 bits (up to 16 bits with resolution enhancement) Bandwidth 20 MHz (for oscillscope and spectrum modes) Buffer Size 32 M samples shared between active channels Sample Rate 80 MS/s maximum Channels PicoScope 4224: 2 channels PicoScope 4424: 4 channels Connection USB 2.0 Trigger Types Rising edge, falling edge, edge with hysteresis, pulse width, runt pulse, drop out, windowed www.picotech.com/scope1045 01480 396395 elektor 11-2009 27 MICROCONTROLLERS ATM18 BASIC Computer ATM18 simulates vintage home computers By Wolfgang Rudolph and Jorg Wolfram (Germany) The constantly escalating processor power of today’s PCs makes it a doddle to simulate another computer in software without the user even noticing any difference. Our ATM18 is a feeble performer by comparison but it still does a fine job if all you need is a small BASIC computer. So cast aside all longings for stylish graphics and lavish sound capabilities and get back to basics with this fabulous retro machine. Not that it skimps on essentials though; it features a serial interface, an EEPROM connection for saving programs and a couple of I/O lines. Everything you need in fact! Let’s face it: computers are remarkably dumb devices. After all they’re nothing more than hardware. Add some BIOS and you can start to carry out a few basic — and very simple — input and output tasks. Things only get interesting with an operat- ing system, which is what transforms ano- dyne hardware into a Windows machine, Linux box or some other characterful com- puter. Backing up these operating system are the drivers that make hardware-spe- cific hook-ups possible. But even this level of sophistication doesn’t let us do any- thing practical; certainly not write letters, edit photos, create spreadsheets or listen to music. Our maid of all work still needs programs to become a practical servant: equipped with one or more programs the computer is now a radio or a typewriter, a calculator, a musical notation tool and a million and one other devices! It can even simulate other computers, perhaps many different ones. Devices like this are known as Virtual Machines and they exist not as hardware, only in software. Despite this we can use them as real computers. Making all this possible are the constantly improving combinations of hardware and software — and of course the burgeoning processing power of today’s computers. BASIC computer So could our little ATmega do something similar? Could it simulate a totally different computer in the form of a virtual machine? Of course not; it’s too slow, the memory is miniscule, there’s no sound processor and no graphic chip onboard. It’s a player all right but in a totally different league from the big processors of the Pentium class. But is there a compromise position? Elektor reader Jorg Wolfram has been giving this consideration and has implemented a small BASIC computer in software. What’s more, the program (written in assembler) is so compact that it fits into an AVR con- troller. Remarkably this includes not only a BASIC interpreter but also an editor for programs! Jorg has modified the ‘AVR Chip Basic 8-88’ that he developed and optimised it for this ATM18 project. To make it even better we’ve also provided convenient input and output capabilities with sound and graphics. Our BASIC com- puter requires only a normal PS2 computer keyboard for input plus a TV receiver (with SCART or video input) for the output, just 28 ii-20og elektor Features • BASIC computer implemented in (AVR) software • Program Editor with 20 lines of code and maximum of 25 usable characters • 1 program in internal Flash memory • 26 variables each of 1 byte • Graphic output via phono socket • Single-channel audio output (notes in 1 timbre + noise) with envelope curve • Serial RS-232 interface (1200 baud) • 4 Port pins deployable as I/O and analogue inputs • Interface for EEPROM (24C16) for 4 saved programs • Upload/download of programs via serial interface like in the old days. The video signal, like the sound, is produced entirely in software! For total authenticity the image is in black and white alone. Daughterboard The necessary I/O hardware is on a small auxiliary printed circuit board (PCB) that plugs in piggyback fashion into the moth- erboard/test board (directly above the con- troller, see heading photo). All connections required are made automatically into the multipin socket strips on the test board, without any need for flying leads (see circuit diagram in Figure 1). Beyond the Mini-DIN- 6 connector for the keyboard the daughter- board provides one phono socket each for sound and vision. The output is a black and white video signal (75 ohms) and an audio signal. We tested the level of the latter sig- nal on a TV set and found it worked fine; you may need to adjust the value of the 5l<6 resistor for best matching. Finally there are two multipin connector strips on the board (serial interface and I/O). Interfaces The serial interface is implemented in soft- ware because the USART is fully occupied handling the keyboard connectivity. The nature of this system means that the TX (send) line is updated at the same rate as video lines are created on screen (in other words once every 64 ps). This explains the rather low data transfer speed of just 1200 bit/s. The serial interface is accessed via pins 4 (RX) and 5 (TX) of the multipin connector strip K5, which are cross-con- nected to port pins PD5 and PB4. To this we can connect (for example) a TTL USB cable/ converter. The allocation of the connector pins is exactly the same as on the ATM18 test board, right down to the jumper that lets you apply the +5 V supply voltage to pin 3 if you wish. Using the four I/O lines (port pins PCo to PC3, together with Vcc and GND available on multipin connector strip K4) we can read in and out digital signals. It’s also possible to measure analogue voltages in the range 0 to 5 V here. EEPROMs of the type 24C16 using the serial I2C connection to save programs. The signals flow across two lines, SCL (Serial Clock) and SDA (Serial Data). Commissioning Once the controller has been flashed with the software from the project webpage [1] and the finished daughterboard has been plugged in, we can connect a keyboard equipped with a PS/2 connector. The video cable can then be plugged into a TV receiver or video monitor equipped with a phono socket input. If the set has only a SCART con- nector it won’t cost much to adapt a SCART cable, which will also enable you to inject the audio from the auxiliary board. SCART con- +5V Figure 1 . All necessary connections are grouped on the multipin connector strips of the test board. elektor n-20og 29 The Editor Programs are written and edited using a simple full-screen editor. At the top is the program name. Below this is the status line, where errors are flagged up for instance. The position of the cursor is indi- cated by an inverse flashing character. Editing takes place in ‘insert’ mode, with the characters entered below and to the right of the cur- sor shifting to the right. On the bottom line there are four menu op- tions for which you use the keys FI , F2, F3 and F4 on the keyboard: FI F2 F3 F4 Load Name Disk Run Load Load a new program into the Editor Name Edit program name Disk Shows programs saved in the ‘Program Selection Box’, if the EEPROM is provided Run Saves and starts the current program The key FI has a secondary function. If the CTRL key is also pressed this enables a program to be input via the serial interface. In addition the following keys and key combinations provide special functions: DEL Deletes the character under the cursor; remaining characters move up from the right. Backspace Deletes the character to the left of the cursor; remaining characters move up from the right. ENTER Cause cursor to move to the start of the next line. ALT+DEL Deletes the current line and fills it with spaces. Fn Outputs the current program via the serial interface. If the ‘Program Selection Box’ is displayed, the program to be read or written can be selected by the cursor keys. The L key loads the pro- gram into the Editor and the S key saves the program in the Editor into the EEPROM. This takes up to 20 or 30 seconds, as the transfer is made only one byte at a time. Hitting ESC returns you to the Editor without loading or saving. nections are shown at [2]. An old computer monitor (a C64 one for example) with video and audio inputs would of course be ideal! The system is equipped with a simple auto- start arrangement. To enter normal mode a button must be pressed while the intro screen is being displayed. If no button is pressed or no keyboard is connected, the stored BASIC program starts automatically. This makes it possible to implant a chip run- ning a preset BASIC program, without any need for a keyboard. The software supplied with this article requires a keyboard with keys set out in the German layout, which is mainly the same as those used in other countries but you may need to do some minor tinkering to adapt the key assign- ments [3]. Note that the @ symbol is avail- able only by hitting SHIFT+3. To simplify operation a menu is provided at the bottom of the screen. This has four choices that you select by pressing keys Fi, F2, F3 and F4. There are also a few key combinations that may well be familiar from PCs: • CTRL+ALT+DEL starts from new, deleting all previous variables and unsaved programs in the process • CTRL+C interrupts the program at the nearest possible point in time • CTRL+P sends a screenshot to the serial interface. The most famous program in the world Now comes our first program, known to every computer enthusiast everywhere: Hello World! We need to input the following (the line numbers appear automatically): ?@10, 9 /"Hello World!" VID 0 : SY 10 VID 1 : SY 10 INP K ?K Loading and saving programs via the serial interface The following settings are required on the PC: 8 bits, 1 200 Baud, no parity, 1 stop bit. Normal text transmission is used for all functions. Under Windows you can install HyperTerminal for instance (send/record text) whilst Mini- corn or the program chiptrans8.pl are recommended for Linux users. Sending to the AVR: 1 . Select LOAD (CTRL+F1 ) in the Editor 2. Start transfer to PC with ./c hiptrans8.pl -r Filename 3. Program appears on the AVR system, with status shown on the PC. Receiving from the AVR: 1 . Start transfer to PC with ./c hiptrans8.pl -r Filename 2. Activate SEND (F1 1 ) to the Editor 3. Indicates status on the PC You can configure how you send the New Line signal by means of the command CFG n. Currently only the lowest two bits of n are analysed. Value (binary) New Line PC Platform 00 no end of line for test purposes 01 CR only MAC 10 LF only Unix/Linux 11 CR and LFWindows This setting is stored in the EEPROM and normally needs to be en- tered only once. 30 11-2009 elektor A small oscilloscope COMPONENT LIST This program scans the analogue input I/O 0, taking 50 samples a second. Pressing the space bar freezes the display. If we now start this program by hitting F4, the text ‘Hello World!’ appears on the screen (see Figure 3). After this the screen goes dark for 0.2 of a second, then the Figure 2 . Next to the keyboard connector are twin phono sockets for the video and audio outputs from the board, plus some I/O pins. words appear once more and after another 0.2 of a second comes a prompt. The BASIC computer now waits for an input. All func- tions of the editor are described in detail in the panel ‘The Editor’. The commands avail- able are set out along with some examples in the ‘BASIC Reference’, available for down- load from the Elektor website [1]. Take a look at the short sample programs — it won’t take long before you are scripting your own applications! When your new baby boots up for the first time all those old feelings will come flood- ing back. Just like it was when you had a ZX81. Except that back in 1981 the ZX81 stung you £ 69.95 (equivalent to about PRG: SCOPE- 01 01 CLS : B = 3 0 : BX 3,3,42,56 02 ?@0 , 0 ; "CB8 -Oscilloscope" 03 ?@2 0 , 0 ; " 0" ; 04 ?@3 , 0 ; " 5 " ; 05 A=AD ( 0 ) / 7 06 DR 41-A, 54,41-B, 55 : B=A 07 SUB 9 : SY 1 : SCR 3 : GO 5 08 09 IF KY (0) =32 GO 9 10 RET £ 300 in today’s money), with less function- ality than our ATM18 BASIC machine. Today the processing power of the ‘personal com- puters’ of those days is easily matched by a Figure 3 . The first program is naturally Hello World! small microcontroller, which is able also to generate a video signal, produce the right sounds and even replicate the serial inter- face in software. Already a quarter of a cen- tury has passed since then! This project gives you a vivid insight into a past that really seems like another world now. ( 090159 -I) Internet Links [1] www.elektor.com/0901 59 [ 2 ] www.theavguide.co.uk/view_page. php?page=23 [3] http://en.wikipedia. org/wiki/KeyboardJayout Resistors R1 -R4 = 2.2k£l R5 = 1 ka R 6 = 470a R7 = 5.6I<£2 Capacitors Cl -C4 = 1 0OnF (SMD 0805) Semiconductors IC1 = 24C16 Miscellaneous K1 = 6 -way mini-DIN socket (female), PCB mount K2,l<3 = Cinch socket, PCB mount l<9 = 7-way SIL pinheader, lead pitch 0.1 ” (2.54mm) K1 0,l<1 2 = 9-way SIL pinheader, lead pitch 0.1” (2.54mm) K1 1 = 5-way SIL pinheader, lead pitch 0.1 ” (2.54mm) l<4 = 6 -way SIL socket strip, lead pitch 0.1 ” (2.54mm) l<5 = 6 -way SIL socket strip, right angled, lead pitch 0.1 ” (2.54mm) JP1 = 2-way pinheader with jumper PCB # 0901 59-1 , artwork download at [1 ] Project source code und hex files, free download # 0901 59-1 1 from [1 ] elektor 11-2009 3i MICROCONTROLLERS no + Theremin = Theremino / \ heremin oscilmtor as a proximity sensor By Martin Nawrath (Academy of Media Arts, Cologne, Germany) / / The Theremin is one of the very first electronic musical instruments, dating back to the 1920s. It is / played by the musician bringing his hands close to its / jr two antennas. The oscillator at the heart of the Theremin remains an interesting circuit in itself, and in this project we connect such an oscillator to an Arduino microcontroller board. M | The processor can detect the shifts in the HF signal from the oscillator and convert them into an audible sound. However, this is by no means the only possibility: we can also use the circuit to convert hand and body movements into control signals for other musical instruments, servos and computers. This tiny oscillator circuit, when coupled with the software running on the Arduino microcontroller board, has a huge range of potential applications, allowing prox- imity-based control of any other circuit or system. The circuit has already found use in many installations and objects at the author’s college. One example is where the device is interfaced to the Max/MSP music and mul- timedia development environment, which is capable of producing sounds that provide a pleasant contrast to the square waves that the Arduino can generate directly. What makes a theremin a theremin? The Elektor editorial team felt it was possible that calling this project a ‘Theremin’ might be a little misleading. The musical instru- ment named after Russian inventor and engineer Leon Theremin (born LevTermen) consists of two antennas, each connected to an oscillator. One oscillator controls the pitch of the instrument and the other the volume. The original Theremin is a purely analogue device, with the conversion from the modulated high-frequency signal to an audible frequency being performed by a superhet circuit: the oscillator output is mixed with a fixed frequency generated by a further oscillator, arranged so that the dif- ference frequency is in the audible range. Our circuit has just one oscillator, never- theless designed around the same princi- ple as the Theremin. The oscillator is con- nected to an antenna, and the oscillator’s Figure I.The parallel capacitance of a human hand near to the oscillator affects its frequency. frequency changes when a human hand (or other electrically conductive object) is brought nearto the antenna. The addi- tional capacitance of the hand affects the frequency of the resonant circuit in the oscillator (Figure i). It seems reasonable to call this circuit a ‘Theremin oscillator’. As in the original Theremin, we convert the modulated high-frequency signal into the audible range; but rather than using a superhet converter, we do the job in soft- ware on the Arduino board. Our ‘There- mino’ therefore replicates just the pitch control part of the original instrument. It would be possible to build a second Ther- emin, suitably modified to provide a vol- ume control, to emulate the analogue Theremin fully. LC oscillator using a 74HC00 The circuit shown in Figure 2 consists of an amplifier, made to oscillate by coupling its output signal back to its input. At the input to the amplifier is a parallel resonant circuit, made from a coil and a capacitor, which determines the frequency of the oscillator. Any extra parallel capacitance due to the connected antenna will affect this frequency. 32 ii-20og elektor Figure 2 . Circuit of the LC oscillator using the 74 HC 00 . To increase the sensitivity of the circuit to the proximity of a human hand, an antenna, made from a length of wire, is connected to the LC network. The amplifier is made from two NAND gates from a 74HC00 connected in series. Each is equipped with a resistor (Ri and R2) to pro- vide negative feedback, which causes the gates to behave as amplifiers. C3 provides feedback from the output to the resonant circuit at the input consisting of Li and Ci. C4 couples the signal on the resonant circuit into the input of the amplifier. The resonant circuit is also connected to the antenna. The theoretical resonant frequency of the LC combination is 4.11 MHz. The oscillator is followed by the two remain- ing gates of the 74HC00, used to square up its output waveform into a TTL-compatible signal. This signal is suitable for connection to a digital input on the Arduino board. Components and construction Capacitor Ci in the LC network should be a ceramic NPo type (such as Farnell order code 9411720) for best temperature stabil- ity. Li should have a high Q factor. A suita- ble type is the Fastron SMCC-100K-02, which has a Q factor of 65; it is difficult to do better than that, even with a hand-wound coil. The circuit can be built, like the author’s prototype, on a small piece of prototyping board. To reduce drift with temperature, it is a good idea to mount the board in a small plastic enclosure. The software running on the Arduino board also has features to help compensate for temperature drift and com- ponent tolerances. The antenna that is connected to the LC cir- cuit should be no longer than about one metre (3 feet). A loop of 1.5 mm copper wire (or, for greater mechanical strength, steel wire) works well. With the antenna operating at 4 MHz metal objects and cables near to it (including USB cables) will also act as parasitic antennas. It is therefore important to keep the unit fixed in place to avoid unwanted frequency drift. Arduino software For our tests in the Elektor lab we used an Arduino Diecimila board [1] with software downloaded from the author’s project web- site. In principle any Arduino board could be used, including the ‘Elektorino’ design that we published in February 2009 [2]. The oscil- lator circuit of Figure 2 is provided with +5 V and ground from the Arduino board and the oscillator output (f out ) is connected to dig- ital pin 5 (PD5, pin 11 on the AT megai68 [3]). This pin has the extra function of acting as an input to hardware counter/timer Timen in the ATmegai68. To detect the frequency shifts of the oscillator, an accurate fre- Figure 3 . The oscillator can be built on a small piece of prototyping board. elektor 11-2009 33 Listing i. Frequency is measured using Timen as a counter and Timer2 to measure the gate time. / /****************************************************************** void f_meter_start ( ) { f_ready=0 ; i_tics=0 ; sbi (GTCCR, PSRASY) ; TCNT2 = 0 ; TCNT1 = 0 ; cbi (TIMSKO , TOIEO) ; Sbi (TIMSK2 , OCIE2A) ; TCCR1B = TCCR1B | 7; } // reset period measure flag // reset interrupt counter // reset prescaler counting // timer2=0 / / Counterl = 0 // disable TimerO again // millis and delay // enable Timer2 Interrupt // Counter Clock source = pin T1 , start counting now / /****************************************************************** // Timer2 Interrupt Service is invoked by hardware Timer2 every 2ms = 500 Hz // 16Mhz / 256 / 125 / 500 Hz // gate time generation for freq. measurement takes place here: I SR (TIMER2_COMPA_vect ) { if (i_tics==50) { TCCR1B = TCCR1B & ~7; Cbi (TIMSK2 , OCIE2A) ; Sbi (TIMSKO , TOIEO) ; f_ready=l ; f req_in=0xl0000 * mlt; freq_in += TCNT1; mlt=0 ; // multiple 2ms = gate time = 100 ms // end of gate time, measurement ready // Gate Off / Counter T1 stopped // disable Timer2 Interrupt // enable TimerO again // milli-s and delay // set global flag for end count period // calculate now frequency value // multiply number of overflows by 65536 / / add counterl value } i_tics++ ; if (TIFR1 & 1) { mlt++ ; Sbi (TIFR1 , TOV1 ) ; } // count number of interrupt events // if Timer/Counter 1 overflow flag // count number of Counterl overflows // clear Timer/Counter 1 overflow flag } quency counter is realised in the Arduino firmware using Timeri as a counter and Timer2 as a timebase. When suitably con- figured by the software, the counter incre- ments by one for each pulse on the input pin, typically over four million times per sec- ond. Timer2 provides a gate time of exactly i/io s (100 ms). With an input frequency of 4.1 MHz Timen will increment 410 000 times during the gate period, and the frequency can be measured to a resolution of 10 Hz. This precision is required in order to detect the relatively small frequency shifts caused by the Theremin effect. Timen is only a 16-bit counter and so it will overflow several times in each gate period. The overflows are counted and combined with the counter value to produce a final result at the end of the gate period. All the timing work is handled by an interrupt func- tion, called every two milliseconds under control of Timer2 (see Listing 1). At the end of the gate period a global flag variable is set. This signals to the main code (see Listing 2) that a new result is ready. Since we are only interested in relative changes in the input frequency and not its absolute value, we subtract the first meas- ured frequency after power-up from each reading. If after a preset number of read- ings the frequency shift is less than a certain threshold value, an automatic calibration is performed: this compensates for the effect of long-term oscillator drift. The two par- ameters (number of readings and threshold value) can be adjusted to suit a particular application. The calculated frequency shift value (variable ‘tune’ in the listing) can be used as a starting point for your own appli- cation ideas. The frequency shifts and calibration values are output on the serial port for further processing or for viewing using a terminal program on a PC. A rudimentary DDS tone generator function is implemented in software to produce an audible frequency on port B. The signal can be heard by connecting a piezo transducer or small loudspeaker to digital pin 8 (PBo, or pin 14 of the ATmegai68) via ai kH series resistor. You can see and hear the circuit in action in a video on the author’s project website [4]. (081163-I) 34 ii-20og elektor Listing 2. Excerpt from the main loop. The variable ‘tune’ contains the frequency shift as produced by the proximity sensor. Automatic calibration compensates for the effect of long-term oscillator drift. void loopO { cnt++ ; f_meter_start () ; tune = tune +1 ; while (f_ready==0) { // wait for period end (100ms) using interrupt PORTB= ( (dds+=tune) >> 15); // kind of DDS tone generator: connect speaker to portb . 0 = Arduino pin8 } tune = f req_in- f req_zero ; // use the tune value here for your own purposes like control of servos, midi etc. // startup if (cnt==10) { f req_zero=f req_in; f req_cal=f req_in; cal_max=0 ; Serial .print ( "** START **"); } // automatic calibration if (cnt % 20 == 0) { // try automatic calibration after n cycles Serial .print ( "*" ) ; if (cal_max <= 2) { freq_zero=freq_in; Serial . print ( " calibration"); } f req_cal=f req_in; cal_max=0 ; Serial . println ("" ) ; } cal = f req_in- f req_cal ; if ( cal < 0) cal*=-l; // absolute value if (cal > cal max) cal max=cal; Internet Links [1] www.arduino.cc/en/Main/ ArduinoBoardDiecimila [2] www.atmel.com/dyn/resources/ prod_documents/doc2545.pdf [3] www.elektor.com/080931 [4] http://interface.khm.de/index.php/lab/ experiments/theremin-as-a-capacitive- sensing-device/ Figure 4. Arduino board with oscillator circuit and piezo transducer. elektor n- 20 og 35 AUDIO & VIDEO New Developments in Class D reduced EMI and no output filter By Thijs Beckers (Elektor Netherlands Editorial) There’s no stopping technological progress, including Class D amplifier technology. New developments reduce the amount of electromagnetic interference (EMI) and enable amplifiers to work without an output filter. Read more to learn how clever designers managed to pull this off. Figure 1 . Simplified schematic diagram of a Class D amplifier. Thanks to their high efficiency, Class D amplifiers are ideal for compact and portable applications. However, conventional Class D amplifiers need an external low-pass filter to recover the audio signal from the pulse-width modulated signal (see below). In addi- tion, they often lead to EMI problems, and the distortion level (THD+N) is not especially good. However, advanced techniques are used in modern Class D amplifiers to overcome these problems and eliminate the need for an output filter, which not only reduces the amount of space necessary on the PCB but also in many cases reduces the overall cost of the compact or portable system. Class D First let’s have a brief look at how Class D technology works. A Class D amplifier does not simply amplify the input signal as is (see Figure i). Instead, it uses a technique called pulse-width modulation (PWM). The output voltage is proportional to the width of the pulse (see Figure 2). Increasing the switching frequency improves the match between the output signal and the original signal. Unfortu- nately, high switching frequencies create all sorts of problems, such as interference and high switching losses. Consequently, a switch- ing frequency in the range of 250 kHz to 1.5 MHz is commonly used, depending on the application. The PWM signal is passed through a low-pass filter to recover the original signal in amplified form. The switching pulses are largely fil- tered out, leaving the ‘average’ value. The necessary filter not only increases the cost and the amount of space required on the PCB, but also increases the likelihood of distortion due to nonlinearities in the filter. Filter-free Due to the ongoing demand for circuits that are even more com- pact and provide even better performance, circuit techniques that do not require an output filter have been developed. An example is the technique used in the Maxim MAX9700 (see the schematic diagram in Figures). This technique works as follows. Each push-pull output stage has its own comparator, so each output stage can be driven separately. The comparators are driven by differential audio signals and a shared sawtooth generator. When the outputs of both comparators are low, the two outputs of the Class D amplifier are both High. At the same time, the output of the NOR gate is High, but this signal is delayed by the RC network R 0N / C 0N . When the delayed output of the NOR gate exceeds a certain threshold level, switches Si and S2 are closed. This causes OUT+ and OUT- to both go Low until the start of the next sampling interval. As a result, the two outputs are active (High) for only a minimum period t 0N(min) . The duration of this period is determined by the values of R 0N and C 0N . If the signal level at the input is zero, the OUT+ and OUT- outputs are exactly in phase and the pulse width is t 0N(mjn) . When the ampli- tude of the audio signal at the input varies, the two comparators trigger at different times. In combination with the minimum t 0N circuit, this causes the pulse width of one output to vary while the pulse width of the other output remains the same (t 0N(min) ). The aver- age value of the signal present on each of the outputs corresponds to a half-wave rectified version of the audio signal. The difference between the two average values on the outputs forms the full audio signal. As the outputs are in phase when the input signal is zero, there is no difference signal across the load under this condition and the power consumption is minimal, all without any need for an output filter. The circuit also makes use of the impedance of the connected loud- speaker. This impedance consists of a real part (R e ) and an induc- tive part (L e ) where the subscript ‘e’ indicates the electrical compo- nent They effectively form a first-order low-pass filter with a corner frequency fc = 1 / {2nLJR e ) [Hz], 36 ii-20og elektor With most loudspeakers, this first-order filter is sufficient to restore the audio signal and prevent excessive power dissipation (from the high switching frequency) in the loudspeaker. However, this requires the loudspeaker to maintain an inductive characteristic at the switching frequency of the amplifier in order to ensure that the maximum rated power can be achieved. Power spectrum Class D amplifiers typically emit a relatively large amount of power at the switching frequency in the form of electromagnetic radiation. The steep edges of the pulse waveform at the output of the ampli- fier make it difficult to design a circuit that can comply with the applicable EMI and EMC standards without an output filter. One way to circumvent this problem is to use a ‘spread spectrum’ switching frequency. With this technique, the switching frequency of the amplifier is varied randomly over a certain range (such as 10%). Although this broadens the frequency band within which the amplifier emits HF signals, it considerably reduces the peak values in this band (which otherwise would often exceed the maximum permissible value), with the result that the amplifier remains within the allowable emission limits. Here it is important to ensure that the duty cycle of the PWM signal remains constant, as otherwise part or all of the audio signal will be lost. In other words, the total amount of power in the output spectrum remains constant, but it is spread over a broader frequency range. The peak values of the HF signals are reduced, and the amount of EMI emitted by the speaker cables is lower. Although spread-spectrum modulation significantly reduces EMI, it has the disadvantage that the length of the loudspeaker cables is limited. The amount of EMI increases with the length of the cables, with the result that at a certain point the circuit no longer com- plies with the CE mark of approval. At this point, a filter is necessary, although in many cases a simple ferrite bead is sufficient. ERC There is also another way to tackle this problem. The latest design innovations minimise EMI and THD+N without sacrificing efficiency. A technique called edge rate control (ERC) has been developed to further reduce the EMI generated by devices. The high-frequency power emitted by a Class D amplifier results from the edges of the pulses in the output signal. The shorter the rise and fall times of these pulses, the more HF power that produced by the edges. If these times are increased so the edges are not as steep, the amount of radiated high-frequency power is reduced. However, putting this idea into practice is not so easy. Increasing the lengths of the transition times can have a negative impact on the performance of the amplifier. The longer the output stages remain in the state between fully on and fully off, the more power they dis- sipate in the form of heat, which reduces the efficiency. In addition, the PWM signal will deviate from the ideal pulse waveform, which will cause the distortion (THD+N) to increase. Although ERC can have a negative impact on amplifier perform- ance, designers are forced to use this technique to improve their designs in order to achieve potential EMI reductions. If the tech- nique is implemented properly, power losses as well as THD+N can be minimized. The correct approach is to slow down only part of the ► t[s] 080277 - 12 Figure 2 . After filtering, the PWM signal (yellow) yields a sine-wave signal (red). edge. In this way, EMI is minimized and power dissipation is reduced to the same level as with a Class D amplifier that does not use ERC. Errors in the PWM audio signal are corrected by means of internal feedback. Practical aspects Despite the fact that the techniques described here can significantly reduce EMI, it is still necessary to observe certain design guidelines very closely when designing a PCB for a Class D amplifier. These guidelines include isolating the tracks that carry switched signals and separating the analogue inputs and supply lines from all switch- ing components. With the constantly increasing demand for portable, energy-effi- cient devices, Class D amplifiers are being used more and more due to their high efficiency. Improvements in quality and EMI perform- ance have considerably simplified the design of these amplifiers. Relaxed layout rules and fewer external components help reduce design time and drive down overall cost while enabling more com- pact designs and longer battery life in portable use, all without sacri- ficing the quality of the audio signal. As a result of all these improve- ments, Class D is no longer inferior to Class AB, and in the future it will probably be the only reasonable choice when energy-efficient, compact amplifier circuits are necessary. (090557-I) V D d Figure 3 . With suitable adjustments, a Class D amplifier can manage without an output filter. elektor 11-2009 37 MICROCONTROLLERS Solder Station ‘Plus’ temperature control and DVM in one unit By Bernd Marz, DC6RB (Germany) This article describes a low-cost energy controller for a standard 12 V 30 W soldering iron. A PIC18F4520 delivers a controlled pulsewidth modulated energy supply to the soldering iron. In addition the unit functions as a two-input digital voltmeter. Main Features • Suitable for use with 12 V / 30 W (max.) soldering irons. • Temperature control using PWM. • Power supplied from a low-cost 12 V 1333 A mains adapter. • Two DC voltage measurement inputs. • Measurement ranges: 0 to 10 V (channel 1), 0 to 40 V (channel 2) • Displays supply voltage. • Microcontroller PIC18F4520 with flash memory • LC display 2 lines of 24 characters (with HD44780 controller) • Software calibration of measurement channels. The author is a radio amateur and a member of the German Amateur Radio Club (DARC). Each year the club organises a practical activity for the younger electronics enthu- siasts to occupy them during the holidays. Every year the members come up with a new circuit design to build, the main criteria are that is should be low-cost, useful, simple and fun to build. The project described here was the subject of one of these events. All together the materials for this solder sta- tion/DVM design cost around 25 pounds. The same amount of money would prob- ably buy you a simple soldering station but it would not give you the same satisfaction as one that you built yourself and besides it would not have the energy control or DVM features of this design with its in-built microcontroller. A combined soldering iron and DVM would undoubtedly be a useful addition to the workbench of any young engineer or electronics enthusiast. Measurement and Control A low cost microcontroller type PIC18F4520 (IC2) from Microchip is the main element in the circuit diagram shown in Figure 1, its clock is derived from an economical ceramic 4 MHz resonator (Xi). The firmware stored in microcontroller flash memory performs temperature control of the soldering iron and all the measurement functions. The four pushbuttons (Si to S4) are used to select menu options. The display (LCDi) shows two lines of text with 24 characters per line. It is an LCD with an on-board HD44780 compatible control- ler. To reduce costs this type of display can often be salvaged from an old telephone or similar piece of redundant equipment. Alternatively it is a completely standard display which can also be ordered quite cheaply from the majority of component suppliers To reduce the number of micro- controller I/O pins required by the LCD it is driven in 4-bit mode. The spare I/O pins are connected to the pin header l<2 to K4. With suitably modified software these pins could 38 ii-20og elektor TP1 TP2 TP6 R2 4x 10k SI 7 + K5 R6 PRG INTERFACE S2 S3 S4 T ■0 0- W n< hr Ho T- ON/ OFF MODE R7 ■go- RST RB7 RB6 KEY4 KEY3 KEY2 KEY1 K4 O 2 h\_ C4 lOOn JT' ^Toon 40 39 38 37 36 35 34 33 15 16 17 23 24 25 26 18 +5V 1 11 I 32 © © MCLR/VPP/RE3 IC1 RB7/KBI3/PGD ' ~ ' RD7/SPP7/P1 D RB6/KBI2/PGC RD6/SPP6/P1 C RB5/KBI1/PGM RD5/SPP5/P1 B RB4/AN11/KBI0/CSSPP RD4/SPP4 RB3/AN9/CCP2/VPO RD3/SPP3 RB2/AN8/INT2/VMO RD2/SPP2 RB1/AN10/INT1/SCK/SCL RD1/SPP1 RB0/AN12/INT0/FLT0/SDI/SDA RD0/SPP0 PIC18F4520 RC0/T1 OSO/T1 3CKI RAO/ANO RC1/T1 OSI/CCP2/UOE" RA1/AN1 RC2/CCP1/P1 A RA2/AN2A/REF-/CVREF RC4/D-A/- RA3/AN3A/REF+ RC5/D+/V+ RA4/T0CKI/C1 OUT/RCV RC6/TX/CK RA5/AN4/SS/HLVDIN/C20UT RC7/RX/DT/SDO RE0/AN5/CK1 SSP RE1/AN6/CK2SSP VUSB RE2/AN7/OESPP _l_ OSC1/CLKI OSC2/CLKO/RA6 J. C3 lOOn 12 13 XI H I 14 4MHz 31 LCD1 PC2402LRS-AWA-B-Q LC DISPLAY 2x24 V J lOOu 25V 090022-11 Figure 1 . The simple circuit uses a PIC microcontroller for control and measuring. be used in the future, for example, to meas- ure values of capacitance. Pin header l<5 is the programming interface to the microcontroller allowing the software to be updated or changed as necessary. A ribbon cable on Ki connects to the LCD and preset Pi is used to adjust the display contrast. Pushbuttons Si and S2 control the solder- ing iron temperature. These buttons change the on/off ratio of the Pulse Width Modu- lated (PWM) signal output from pin 7 of the microcontroller. The waveform switches power MOSFET Ti which supplies current to the soldering iron connected to points TP11 and TP12 on the circuit diagram. Power con- trol is very smooth and the front panel dis- play shows the amount of power supplied to the iron as a percentage of the irons power rating (30 W max). The type of soldering iron used is a standard low-cost 12 V iron without any temperature sensor. The red measurement input sockets are wired to TPg for channel 1 and TP10 for chan- nel 2. Voltage divider networks on these inputs formed by (R4/R8 and R3/R5) scale the measured input voltages so that they are within the input range of the controllers ADC inputs pins 2 and 3. The 1 resistors define the impedance of the meter inputs. Zener diodes Di and D2 prevent damage to the input if the applied input voltage is too high. The third ADC input of the microcon- troller (pin 4) measures the power supply voltage (nominally 12 V) scaled by the volt- age divider network R9/R10. Power to the unit can be supplied by a 12 V DC mains adapter rated at 3 A (minimum). A quick trawl through some supplier’s web- sites identified several 12 V switched-mode supplies with an output rated at 3.3 A retail- ing for less than 10 pounds. The 5 V supply for the circuit is produced by the 7805 volt- age regulator ICi. Putting it all together The simple single-sided PCB layout (Fig- ure 2) ensures that construction is quite straight forward even for a novice. Start by fitting the 1 C socket ensuring that pin 1 lines up with 1 on the layout. Next fit the ceramic capacitors, the wire link between TP3 and Ci, the resistors, diodes (make sure they are the right way round) and the preset resistor. The resistor network R2 is fitted so that pin 1 is nearest to C6. Both electrolytic capacitors Ci and C2 must lie flat on the board otherwise there will not be enough room for the LCD which is fitted 15 mm above the PCB. Voltage regulator ICi is mounted on the board using a short M3 nut and bolt. The power FET Ti has an SMD outline and is the only component mounted on the under- side of the board. It is not necessary to make any connection to the middle pin (see Figures). elektor n-20og 39 COMPONENT LIST Resistors R1,R7,R10 = 1kft R2 = SIL array 4x1 0k£2 (5 pins) R3,R4,R8 = 1M£2 R5 = 100k£l R 6 = 1 0I<£1 R9 = 2.2kn PI = 1 0I<£2 multiturn preset, vertical, top ad- justment, e.g. Bourns type 3266X-1 -1 03LF Capacitors Cl ,C2 = IOOjiF 35V radial C3,C4,C5 = 1 0OnF Semiconductors D1 ,D2 = zener diode 5.1 V 0.5W T1 = FDD8445 (Fairchild, N-channel MOSFET, 40V, 5A, 8.7m£2) IC1 =7805 IC2 = PIC1 8F4520-I/P, programmed, Elektor Shop# 090022-41 Miscellaneous SI -S4 = pushbutton, single contact, e.g. Mul- timec 3FTL6 with cap 1 D09 K1 = 14-way IDC connector for flatcable LCD module, 2x24 characters (5.55mm height), 1 1 8x36x1 4 mm, e.g. Powertip PC2402LRS-AWA-B-Q (Farnell #1671511) with connector and flatcable. 40-way DIL socket (for IC2) XI = 4MFIz ceramic resonator, 3-pin 1 M3x5 screw with nut (for mounting IC1 ) 2 M3x20 screw with nuts (for LCD mounting) 2 plastic spacers, 1 5mm length (for LCD mounting) 1 2 V / 30W soldering iron simple version with out temperature sensor PCB no. 090022-1 [1 ] Figure 2. Fitting the components will be no problem on this single-sided PCB. Figure 3. The power MOSFET is soldered to Figure 4. A 1 4-way ribbon cable connects the LCD module to the PCB. the PCB underside. No connection to the centre pin is necessary. 40 n- 20 og elektor The only cable required is a 14-pin connec- tor and ribbon cable to connect between the PCB (Ki) and the LCD module as shown in Figure 4. The pin headers l<2 to K4 are available for future expansion of the circuit and K5 is not required unless you plan to program/reprogram the microcontroller ‘in circuit’. The 12 V mains adapter and 12 V soldering iron are the only two external components connected to the controller. The circuit does not include a diode in series with the input supply to protect against reverse polar- ity supply so it is important to ensure that the board is wired correctly to the mains adapter output. The polarity symbols are printed on the PCB: plus to TP7, minus to TP2. The polarity of the supply to the sol- dering iron itself is not important; connect the two wires from the soldering iron to TP11 and TP12. This only leaves wiring between the PCB and the voltage measurement input sockets (two red and two black). The black sockets are wired to ground (TPi or TP6). As already described the red socket for channel 1 (10 V range) is wired to TPg and red socket for channel 2 (40 V range) with TP10. The mechanical layout is simplified if the 4 mm sockets for the measurement chan- nel inputs are positioned to the right of the PCB and mounted on the front panel of a suitable enclosure. The PCB itself can either be mounted behind the front panel in which case cut-outs will be required for the display and pushbuttons or the simpler solution used by the author is to fit the PCB on the outside of the front panel. The result is not quite so neat but allows easy access to the circuit. Programming and Function The simple option is to buy the PIC controller ready-programmed from the Elektor Shop but alternatively if you prefer to compile and program the chip yourself all the C source files including the compiled program file are available for free download from the Ele- ktor website [1]. The author has written the firmware in C using the CCS-C-Compilerfor PIC18 processors [2] and the MPLAB V8.20 CD .l£) 4—1 1 — "O < development environment from Microchip [3]. The last link in the chain if you are pro- gramming yourself is the Microchip ICD2 programmer which connects to the target board at the pin header connector K5. Fuses HS, NOWDT, NOPROTECT and NOLVP must be set in the software. Before the circuit is first powered-up spend a few minutes checking all solder joints and the polarity of the wires from the mains adapter to the PCB. Check that the micro- controller is correctly inserted in its socket (and of course don’t forget to program the controller firmware into flash memory!). When the circuit is powered up it enters sol- dering mode and the display indicates the soldering iron power level (Figure 5). Should you see nothing on the display try adjust- ing the contrast (Pi) failing that it could be a hardware failure (check your soldering!) or (hopefully not) a software problem. Pushbuttons Si to S4 provide the following control: Si: Increase bit temperature. S2: Decrease bit temperature S3: Soldering iron ON/OFF S4: Switch the unit between soldering and voltage measurement modes. Pressing S4 toggles the unit through the fol- lowing modes: 1. Solder (Figure 5) 2. Voltage measurement on channel 1, DC 0 to 10 V (Figure 6) 3. Voltage measurement on channel 2, DC 0 to 40 V (Figure 7) 4. Voltage measurement on channel 3, the 12 V nominal DC input to the circuit (Figure 8) 5. Display all three measurements (Figure 9). Calibration and use Before we can have any confidence in the measured voltages it will be necessary to calibrate the unit. The circuit enters calibra- tion mode when button Si is held down as the circuit is powered up. The display shows Multii: 1000 indicating calibration mode for multimeter input 1 where 1000 is the mul- VINCULUM VINCULUM VNC1L EMBEDDED USB HOST CONTROLLER 1C ■ Handles USB host interfaces and data transfer functions using the in-built 8 or 32-bit V-MCU. ■ Configurable options to interface via UART, FIFO or SPI slave interface. ■ 2x USB 2.0 Slow speed or Full speed host or Slave ports. ■ Royalty free firmware field upgradable over UART or USB. BB Development modules and programmer are available. Chip Future Technology Devices International Ltd. Unit 1,2 Seaward Place Centurion Business Park Glasgow, G41 1HH , UK Tel: +44 (141) 429 2777 Fax: +44 (141) 429 2758 E-Mail (Sales): sales1@ftdlchip.com Now available to order at www.ftdichip.com elektor 11-2009 4 i Figure 5. The start menu at power-up shows the soldering iron control. Figure 6. Measurement using channel 1 (range 1 0 VDC). Figure 7. Measurement using channel 2 (range 40 VDC). tiplication factor of the measured value. Using the calculation: measured value x Multii/iooo. The unit can be accurately cal- ibrated using a reference level. Pushbuttons S2 and S3 are now used to change the dis- played value. S4 switches to the next chan- nel for calibration using S2 or S3 as before. The measurement functions of the unit are designed for low voltage applications only. This includes jobs such as measuring dry or rechargeable cell voltages, DC test point voltage level monitoring in a circuit or adjustment of DC input voltage to a circuit. It is vital that the input is never connected to mains voltage! Power control of the soldering iron is not as sophisticated as you might expect from a professional workstation costing a couple of hundred pounds but it is suitable for a beginner or anyone who only occasion- ally needs to use a soldering iron. It gives very fine control of power to the soldering bit and with a little practice it’s possible to produce good results on different types of soldering jobs. Another advantage of this design is that it uses a low-cost iron which can be replaced quite cheaply. Any low-volt- age 12 V iron, for example fine soldering irons with a power rating of 6 W or 7.5 W (up to 30 W maximum) are suitable for use with this design. The display indicates power supplied to the iron as a percentage of the iron rating. (090022 1) Figure 8. Channel 3 measures the supply voltage to the circuit (12 V nominal). Figure 9. Display of all three channels. Internet Links [1 ] www.elektor.com/090022 [2] www.ccsinfo.com [3] www.microchip.com 42 11-2009 elektor AVR, dB and D/A Junction By Daniel Rodrigues (Elektor Labs) Nothing exceptional about it, I thought, and in line with most of the article proposals we have the pleasure of seeing in the earliest stages of publication. The circuit and the idea behind an ‘Innovative Digital Volume Control’ proposed by one of our very remote free- lance authors was duly taken through our evaluation system and considered a fine candidate for the Summer Circuits edition by the joint editorial team. So we pressed ahead and the paperwork was landed on my desk. In the original circuit, the key component was an LDR (light depend- ent resistor) in series with the loudspeaker connection. The LDR is illuminated by a white LED whose brightness is controlled by a PWM In plain English, the power variation using that finest of LDRs is, oh dear, 1 6 dB, which is disappointingly low. As a practical example, 1 6 dB equals the variation of raising speech from a soft whisper to whispering, well, a little louder. The idea proposed by our valiant author is still nice, but sadly not for an audio volume control as he had hoped. After all, what we have here is a nice and inexpensive gadget which can be safely called a digital potentiometer, or ‘Digipot’ in electronics journalese. Corny signal produced by a microcontroller — there you have it: state of the art contactless audio volume control! However, when I started testing the device I realised the span of the volume control wasn’t too impressive, to put it mildly. In an attempt to overcome the prob- lem I looked for an LDR with a larger resistance variation and the best I was able to locate at the time was rated 50 to 2,000 ohms. Now let there be Science instead of AVR programming. If we take into account that the human ear is able to comfortably handle sound levels within a range of 30-90 dB we should expect something like 60 dB of span to be afforded with ease by our volume control. Let’s not forget that power is inversely related to resistance, mean- ing the lower the resistance, the higher the power. So, the sound power level ratio can be expressed as L w = 10log(P max /P min ) = 10log[(L/ 2 /R min )/ (LP/Rmax)] = 1 0log[(L/ 2 /50) / (U 2 /2000)] = 10log(40) = 16 dB as it may sound, the use of the LDR based DigiPot is only limited by your imagination: control of currents, voltages, brightness, gain, you name it. All optically — sort of — but with better reso- lution, stability and dynamic control than some more traditional approaches. Fine AVR programming, no doubt, but with insufficient attention paid to the real world of human hearing and some basic physics, specifically where the dB comes in. (080654-1) Daniel Rodrigues (1 983) has a B.Eng. degree in Electronics and Telecom- munications Systems from ISEL Higher Polytechnic Institute in Lisbon, Portugal. Daniel’s fortes and hobbyhorses include radio, digital commu- nications and microcontroller systems. Daniel started working in the Ele- ktor Labs in June 2008. When not pondering over electronics on his desk or computer screen, he enjoys hiking and cycling. LO OO elektor - 11/2007 43 E-LABS INSIDE CAD Bed [MteDs&eF 44- TVH 25V ]3?T c- lOOn o o 44 44 W 44 44 gg JP7 ►! «“ JP8 r 1 44 44 44 4T 44 44 tol * 10 ( pulse/cont _ cal. dSSffl SW-DIP4 a ■ 8MHz ■ C4 15p iz F RBO/INT RBI RC1/T10SI/CCP2 RB2 RC2/CCP1 RB3/PGM RC3/SCK/SCL RC5/SDO RB6/PGC RC6/TX/CK RC77RX/D 1 RA0/AN0 RD0/PSP0 RA1/AN1 RD1/PSP1 RA2/AN2/VREF- RD2/PSP2 RA3/AN3/VREF+ RD3/PSP3 RA4/T0CKI RD4/PSP4 RA5/AN4/SS RD5/PSP5 RD6/PSP6 OSC1/CLKIN RD7/PSP7 RE0/RD/AN5 RE2/CS/AN7 VSS VDD VSS VDD PIC1 6F877-08/P INI OUT1 IN2 IN3 OUT2 OUT3 IN4 OUT4 IN5 OUT5 IN6 OUT6 IN7 OUT7 IN8 OUT8 GND COM D ULN2803A _IT ■ C7 lOOn R7 10k IC4 4N25 ■ C6 lOOn Project_Title Project_Title Modified 7/2/2009 Project Number Project Number (File Date) Project_Engineer Project_Engineer Size: A4 Project_Revision: Project_Revision_And_Date Project_Fon Project_Fon Project_Web_Address ProjectWebAddress Project_Fax Project_Fax Project_E_Mail_Address Project_E_Mail_Address Print-Date: 9/22/2009 Print-Time:08:41:00 Sheet of File: C:tAltium-Repository Projects\Fiat\2008t080064\hardware\processor_boardt080064„alarme_inclinaison-1.SchDoc Project_Company_Name1 Project_Company_Name2 Project_Street Project_ZIFProject_City Project_Country Example of a schematic designed with Altium Designer (project ‘Car Tilt Alarm’ from the September issue). Elektor illustrator Mart Schroijen subseguently uses a special CAD program to convert this schematic into the familiar Elektor style. By Luc Lemmens (Elektor Labs) It is about three years now since our lab migrated from Ultiboard/ Oread to Altium Designer CAD software for the drawing of engi- neering-level schematics and the design of those famous Elektor printed circuit boards. It is an enormous improvement to work with a completely integrated CAD package, but there is, of course, the odd situation every now and then when you think nostalgically of the old software, even though this changeover has been a big step forward and Altium has taken a lot of work off our hands. Without doubt, the biggest improvement was the direct linking of the schematic and the PCB design, which we did not have previ- ously because each job was done using a dedicated CAD package. It is now much simpler to verify whether the circuit and the PCB actually correspond to each other. This is of course not a unique characteristic of Altium Designer, other CAD packages may do that too, but in Altium it is very easy to make alterations to the sche- matic and then propagate these changes to the PCB, and the other way around. This does not work in other CAD packages, either not as easily or not in both directions. laders To be honest the libraries that came with Altium were a big dis- appointment initially. It was certainly a case of watching out for the incorrect pinning of components. And the standard through- hole parts may be perfectly suitable for assembly by a manufac- turing company, but the pads and holes are so small that solder- ing by hand and certainly desoldering requires more than aver- age soldering skills. At the request of many readers we therefore quickly changed the footprints and they are now almost the same as those created by Ultiboard from the old days. This, of course, also makes things much easier for ourselves when building and test- ing the prototypes. Since then we use the bigger footprints for kit sets and individual printed circuit boards, the smaller footprints are only used for boards that are available in pre-assembled form only. We, incidentally, do the latter only with SMD boards if we think that most readers will have difficulty completing the soldering task successfully. The work on the libraries is not finished as yet — we are still busy with the database libraries, where the components are linked di- rectly to footprints, order codes, etc. But this is a very time con- suming job and the daily work for the magazine always has higher priority. That is why it is not quite completed. However, when com- pleted, this should save a considerable amount of time. Making new PCB footprints in Altium is very easy, by the way. Us- ing the IPC Footprint Wizard, the shapes for complex SMD ICs are easily made and at most a small amount of cosmetic work needs to be done to the overlay (silk screen) as it appears on the PCB. Sometimes the pads on the board need to be made a little larger to simplify hand soldering. But even without this wizard, making new (through-hole) components is very straightforward. Lots of things can be done in Altium Designer — too many we say sometimes. It is sometimes hard to see the forest for the trees be- cause of all the options, tools and settings the program has on offer. 44 elektor - 11/2009 to be honest the libraries that came with Altium were a big disappointment initially More than once you need to search where a settings is ‘hidden’ or think how you solved a particular problem on an earlier occasion. It is of course also a consideration that no one in our lab has a full- time job as PCB designer and the complexity of designs varies enor- mously. The more complex functionality of Altium is not used very often and it is then difficult to become very familiar with it. Every now and then it’s also difficult that there are multiple roads that lead to Rome in Altium. It is a frequent occurrence that you ask a colleague for help and that he happily uses a different set of menus than those that you are used to yourself, this is not always enlightening. On the other hand it can, of course, be very useful that you can obtain the same result using different methods. Altium is very capable at importing PCB layouts from other CAD packages. Unfortunately the very popular Eagle is not one of them, this CAD software that is by far the most popular among our read- ers, for as far as we can determine. We have asked Altium wheth- er this option can be added to the program, but unfortunately we have not yet received a positive response to this request. That is why in our lab we also frequently use Eagle to change board layouts so that they meet our needs or requirements. Handy 3D viewer The Altium software even has the option of running Delphi scripts, but we have not used that feature yet. Such scripts could be used, for example, to generate parts lists to your own requirements or formatted appropriately, but can also be used the carry out batch operations on schematics or PCBs. We haven’t looked into the de- tails too deeply, but it appears that you could control just about anything within Altium. Although everything is extensively docu- mented in the help files, looking at the number of questions on the Altium Designer forum it nevertheless appears to be quite challenging. Like every (??) other self-respecting PCB design program, Altium has a 3D viewer which can show a model of the final assembled board from any angle. A prerequisite is that for each component there is a correct 3D model available. Not only does it result in nice pictures on the screen, it can also be of practical value if the finished board has to fit inside a particular enclosure. Altium also offers the functionality to develop FPGAs, core and embedded projects, programming and testing. The version 6.9 of Altium that we acquired three years ago does require a separ- ate licence for that. At the time we bought only one such licence, which is sufficient for our lab. We mainly use the program for the ‘classic’ tasks, that is, drawing schematics and designing printed circuit boards. Everything considered, it may appear that we are shooting at a mos- quito with a cannon, considering the average Elektor design, but it does save a lot of time. As already mentioned, we have discovered a few drawbacks in the program, but it is still head and shoulders above the other CAD packages we have tested and used here. (090586-1) f 1 f~< B k » i B*> I I EH* | Using the Footprint Wizard the Elektor designers have increased the size of solder pads and holes, so that hand soldering is made much easier. ?rl| (*«■“’'! Part of the circuit board for the October 2009 Car Tilt Alarm, developed in Altium Designer. Schematic - General KTr-uk* [ ifcr V - j¥i™i "rrtwil tfliflr _) « L'Jv.ljC* ■ jlMLiltMl "pH ahnM I- iiiahfkiidH I till hfatfa ad IhM 9 ml Itjai BtljMt-jjWlW E^vl'niOri IhAbteMl thrills- ■*’1 ri|r * m I r«&3 ■j-.wwr v-w/ii 1 VfTVkW? ] CL LiiUfr? 2 m MH tataU I-M&h o i CrfsJl Kw jtmLinra lit^vha li'mrr nluLrui '..UTWJ li-jyrm fW-M tip* I* * an ■,*. . ■J.1 f Uijas'lSMl ■'j- r-s I -? >> 1 - The Altium CAD program offers an overwhelming number of settings! 11/2009 " elektor 45 E-LABS INSIDE Sine Wave Service By Jens Nickel (Elektor Germany Editorial) We are lucky to have so many subscribers who have been reading Elektor long term. Occasionally when we get a plea from a loyal subscriber we have been known to go the extra mile... A few months ago I took a call from a gentleman from Munich who had built a function generator featured in the December 1 984 edi- tion of Elektor. Unfortunately his trusty old ‘scope had recently giv- en up the ghost and he was faced with the problem of how to cali- brate the circuit. Any chance he could maybe send the equipment in for us to have a look at? You have probably already guessed how it turned out... normally pressure of work in the lab means that there’s no time at all to even consider looking at reader’s builds and besides that’s your job! Well he must have been in a good mood because after a short discussion the ICE (international coordinating editor) decided that for once we could make an exception and try to revive a 25 year old function generator originally published by Elektor. those were the days: design engineers writing the articles and edi- tors cheerfully soldering! The 1 984 design was an improvement on an even earlier generator published in the UK edition in January 1 978. A rotary wafer switch on the front panel selects sine, square or triangular output wave- form. One preset allows optimisation of the sine wave purity. BNC sockets on the front panel provide SYNC output and VCO input. Although the output amplifier is built with discrete components it has the configuration of an opamp with a differential input stage and symmetrical output drivers. The PCB is double-sided but does not have through-hole plating so it is necessary to solder both top and bottom pads of some components on the board. Twiddling the presets Calibration of the unit requires adjustment of nine pots and pre- sets. Thanks to the systematic description of the procedure pro- vided in the original article, Ton Giesbert’s expertise an old Hameg I am probably the only one amongst the team of Elektor editors who was not raised from an early age on a diet of banana plugs and breadboards. This, I thought, is going to be an ideal opportunity for me to get to grips with some real engineering. The original ar- ticle 25 years ago stated that “A digital solution (with the waveform stored in an EPROM followed by a D/A converter) would be very up to date but would require expensive, difficult to find components”. For this reason the design used the Exar XR2206 function generator chip. The chip was not new in fact it had already been available for ten years (and is still available to this day!). Ernst Krempelsauer, a venerable member of the Elektor editorial group, was keen to point out that a few years earlier he had worked on the design which first introduced the chip to Elektor readers. Ah 1 507 oscilloscope it took around 1 5 minutes to get the generator working again. Out of interest we connected up an Audio Preci- sion System 2 distortion analyser (according to Ton “one of the best audio analysers there is”) to test sine wave purity. Harmonic distortion was around 0.5 % and it was possible to adjust the 1 kHz low end to within 0.5 Hz. Calibration complete, but a gentle tap on the case caused the output frequency to shoot up to the up- per end of the scale plus around 5 %. Clicking the frequency band selector switch backwards and forwards settled it down to the correct value again. This intermittent fault is probably the result of a flaky connection; we checked all solder joints and switches before we wrapped up the case and sent it back to the grateful gentleman from Munich. (090606-1) 46 elektor - 11/2009 o r~\ n o r~r A N T E X v i \ i \ i \ i \ i mi* Hov-tc t3 ::^r U 60 + years of experience It may surprise you bul buying arc Antex soldering if on casts less than you 4 Kink in the long run. British made to exacting standards,, they last significantly fr-nger than many impoinn: brands, Wirh a wide range of thwmaJly b&lfiricfld fr)Qdch r ^rict rem|H:rature coi^troliiKi irons too. you c an always he Sure to find *in iron that meek yuuf needs, A large range of replacement Ups are available for most irons, and technical he^p is on hand from our oFficcs in Devon UK. Buy Online Our new vvi' 1 UMt f‘ 1 1 as .ill gf finr Irons., and soldering S|>are£ and actnierlH availiibli 24hn a day- Most item* n shipp'd nnxi lv I IvJ H (7) 100n (s) lOOn lOOOu Y Y 16V -HI • -I 4 1 C6 C7 C9 lOOn CIO In R9 T6 T7 T8 T9 T2...T9 = BC547B +9VA "[DIO Dll I D2 4 D25 D38 D39 D52 D53 D66 D67 D80 D81 081066 - 11 Figure 1 . The most conspicuous part in this circuit is the matrix containing 84 blue LEDs. ICs from the standard CMOS 4000 series in the trusted through-hole packaging. The largest part of the circuit in Figure 1 is obviously taken up by the numerous LEDs: there are 84 of them. In this case it makes sense to buy 100 pieces, since that usually works out cheaper due to quantity pricing. The LEDs have been positioned fairly close together on the board, so they present a uniform area of light. One row of LEDs is used as a simple display for the timer. The time that the LEDs are lit for can be adjusted with a potentiometer from about 4 minutes to 30 minutes. After this period has elapsed the LEDs are automatically turned off. A second potentiometer is used to adjust the brightness of the LEDs steplessly. Because we’ve used pulse-width modulation instead of normal voltage regulation the brightness range isn’t affected by the value of the for- ward voltage drop of the LEDs. As we wanted to make the turn-on time fairly accurate we’ve used a 4060 for the clock, which is an asynchronous counter with an oscillator. Due to the long period involved we had to use an RC oscillator (if we used a crystal oscillator we required a much larger frequency division). By taking the output from the last stage of the divider (pin 3) and choosing a value of 1 M Q for the potentiometer, the value of the capaci- tor used in the oscillator section (C3) can be kept small. For the longest period the frequency is theoretically 4.61 Hz. The fre- quency of the RC oscillator is about 1 / (2.3-RC) [Hz] The time before the last (14 th ) divider out- put becomes high is then about 1776 sec- onds (2 13 x 4.61 1 ), or 29.6 minutes. For the shortest period a frequency of about 35 Hz is needed, which results in a period of 3.86 minutes. In practice the period will be affected by various tolerances. Often the potentiometer, which can have a tolerance of 20%, will be the cause of a difference in the period. The output of the last divider stage is con- nected via a diode to the oscillator section. When this output becomes high the oscilla- tor stops and the 4060 will stay in this state until the reset input (pin 12) is pulled high. With Si the 4060 can be reset at any time, after which the turn-on period starts again. The indication of the time elapsed is achieved using a 4015 shift register. This twin 4-bit shift register is used as an 8-bit shift register by connecting the fourth out- put of the first register to the data input of the second register. This 8-bit shift regis- ter is clocked by output Qg (pin 15) of the 4060. The data input of the first register is connected to the positive supply line, result- ing in ones being shifted along every clock pulse. The clock input of the shift register acts on the rising edge of the pulse. After 8 clock pulses from Qg the register has become ‘full’. One clock pulse later out- put Q13 of the 4060 goes high and blocks the oscillator via diode D3. In this way the selected time period is visualised by the shift elektor n-20og 49 COMPONENT LIST Figure 2 . The size of the board is mainly determined by the LEDs. Resistors R1,R6 = 150k£l R2 = 2.2MQ R3,R8 = 100£} R4=100kn R5 = 220kn R7 = 10kft R9-R16 = 1 5l<£2 R17-R58 = 270^ PI ,P2 = 1 M£2 potentiometer, linear P3 = 1 00I<£1 preset, horizontal Capacitors Cl ,C5,C6,C9 = 1 0OnF MKT, lead pitch 5mm or 7.5mm (0.2” or 0.3”) C2 = 2.2nF MKT, lead pitch 5mm or 7.5mm (0.2” or 0.3”) C3 = 82nF MKT, lead pitch 5mm or 7.5mm (0.2” or 0.3”) C4 = 4.7nF MKT, lead pitch 5mm or 7.5mm (0.2” or 0.3”) C7,C8 = 1 OOOpF 1 6V axial, lead pitch 28mm ( 1 . 1 ”) Cl 0 = 1 nF ceramic, lead pitch 5mm (0.2”) Inductor LI = 40pH 2A, axial (Epcos B821 1 1 EC23, Far- nell# 9753354) Semiconductors D1 ,D2,D3 = 1 N4148 D4.-D87 = blue LED, 5mm, 300mcd, wave- length 465nm, (e.g. Optek OVLLB8C7, Farnell# 1678692) D88 = Schottky diode 60V 2A, (e.g. STPS2L60, Farnell #9907637) T1 = SPP1 8P06P (P-channel MOSFET 60V 0.13a Farnell# 1056550) register on the LEDs in eight equal steps. At the bottom of the matrix are eight groups of two LEDs that are driven by the register outputs via T2 to Tg. In order to keep the intensity of these LEDs as similar as possible to the others in the matrix a ‘discrete’ circuit with normal transistors was chosen, instead of driver ICs (these often contain darlingtons, which results in too high a knee voltage; the knee voltage of T2 to Tg in the prototype turned out to be close to only 10 mV). There are many ICs available for the pulse- width section that are specifically designed for this task. However, it can also be done simpler, using a modified Schmitt-trig- ger oscillator designed around the 4og3 (quad NAND with Schmitt-trigger inputs). The standard resistor in the feedback loop is replaced by two resistors, each of which have a diode in series in opposite polarities, and a potentiometer in between. The ratio of the charge and discharge times of C2 is greater or smaller than 1, depending on the position of the potentiometer. At one T2-T9 = BC547B IC1 =4093 IC2 = 4060 IC3 = 401 5 Miscellaneous SI = push button, panel mount extreme the charge time is determined by R6 and the discharge time by R5+P2. At the other extreme the charge time is deter- mined by R6+P2 and the discharge time by R5. Since the hysteresis of the 4og3 doesn’t occur around exactly half the supply volt- age, the values for R5 and R6 had to be adapted to provide an almost symmetrical control range, for example from 10% to 90%. Due to this asymmetrical behaviour of the 4og3 the frequency changes when the duty cycle is adjusted. In our prototype it was between 1 kHz and 750 Hz. This variation won’t be visible to the eye; it only reacts to the pulse width. A simple integrator has been added after the oscillator in order to be able to turn the LEDs fully on or off. The time constant of R7+P3 and C4 can be adjusted using preset P3 such that the voltage across C4 won’t cross the threshold voltage of ICiB at the minimum pulse-width setting (for both pos- itive and negative pulses) and the output of 2-way pinheader, right-angled 2-way pinheader 2 3-way pinheader, right-angled 2 3 -way socket PCB # 081 066, see www.elektor.com/081 066 this gate stays low or high. The integrator has been made adjustable because the hys- teresis window of the Schmitt-trigger is not the same for different manufacturers and can even deviate within the same series of a single manufacturer. The output of ICiB is the control signal for P-channel MOSFET Ti, which in turn provides the driving voltage for the LEDs. When the set time has expired, pin 3 of the 4060 goes high and is inverted by gate ICiC and the other input of ICiB is made Low. The output of ICiB stays High and Ti no longer conducts. For the LEDs a type made by Optek was cho- sen (OVLLB8C7), which combines ample brightness (min. 170 mcd, typ. 300 mcd) with a large viewing angle of 85°. The wave- length of the generated light is 465 nm. The maximum DC current through the LEDs is 20 mA. The difference in brightness between an LED current of 10 mA and 20 mA was so small for this type that we decided to limit the current to 11 mA. 50 ii- 20 og elektor Instructions for use Ml?,! '"J cams MQ995HH fl IOM3QHD > zzm<6 & [j, 001 066-1 ©ETLEZKTOS ■ I lU s Lm • B | § j 1 ■ | ■ Ell'T’E ; mmi H 1k1 Iffjilim: T1F Me 3? C301&P3 iB HnnSSM 4 ^ Figure 3 . The completed prototype in all its glory. • The recommended daily usage period is between io and 30 minutes. The exact period has to be found by trial and error, along with the optimum brightness setting. Start with a short period and see if it has any effect. If it doesn’t work, try it for a longer period. • Start with a fairly low setting for the brightness and increase this in step with the duration until you notice a result. • The blue-light generator has to be positioned next to you at an angle, so you won’t be looking directly into the light. The intention is that the blue light shines onto your eyes from the side. Place the circuit at a distance of about 50 to 80 cm, for example next to your monitor on the desk if you’re working with the computer. • This therapy works best if you start at the beginning of the winter (before any of the winter blues symptoms are noticed) and have a blue light session daily, preferably in the morning. Warning: Don’t look directly into to burning LEDs for long periods since they produce a significant amount of light at higher brightness settings! A somewhat higher voltage drop across the series resistors was chosen in order to reduce the effect of any differences in the forward voltage drop of the LEDs. Using a 9 V mains adapter as a power source, we can connect two LEDs in series. The LEDs in the prototype were found to have a forward voltage drop of just over 3 V, which resulted in a value of 270 Q for R17 to R58. The total current consumption of the LEDs adds up to almost 0.5 A (42 x 11 mA). Inductor Li has been connected in series with the positive supply to the LEDs for interference suppression. It is therefore not meant to smooth out the current through the LEDs. The same applies to C10. Schottky diode D88 is a freewheel diode that prevents negative spikes from damaging the LEDs. Two electrolytic capacitors of 1000 pF have been placed close to Li and Ti to provide decoupling of the supply voltage. A side effect of these relatively large decoupling capacitors is that when the supply volt- age drops below the forward voltage drop of the LEDs (temporarily unplug the mains adapter) the supply will drop very slowly and the circuit continues running for a con- siderable time. Construction The population of the board (Figure 2) is fairly standard. The LEDs are best mounted last. Start with the two wire links, followed by the resistors, 1 C sockets, preset, capaci- tors, transistors T2 to Tg, Li, Ti and finally the two electrolytic capacitors (C7 and C8). For connecting the potentiometers and Si you can use pin-headers (right-angled ver- sions due to the height restriction) with sockets, but you can also solder the wires directly onto the board. To keep the height of all components to a minimum, we’ve used axial versions for electrolytic capaci- tors C7 and C8 and indictor Li, and Ti has been mounted flat on the board. The LEDs can be mounted in different ways. The easiest method is to solder all of them as closely as possible to the board. That way they will automatically be in position and may at worst have to be bent slightly into line. If you prefer to mount the LEDs through a front panel, and hence have to mount them about 2 cm above the board to stick out above the other components, things become more difficult. In this case it helps if you first make a template. Take a piece of experimenter’s board and drill 5 mm holes in the right places (the LEDs are mounted at every fifth hole of the experi- menter’s board). For the case it should be easy to find some- thing to your liking. You can place a piece of Plexiglass in front of the LEDs. Remember to add a riser at the back of the case, so it will be angled when you place it on the table. And finally here is a little tip: if you’re not interested in the time progress bar, you can replace transistors T2 to Tg with wire links (from emitter to collector). In this case there is also no need to mount IC3 and Rg to R16. (081066-I) elektor n-20og 51 MICROCONTROLLERS Driver-free USB Interface Data collection using ECIO and an HID m * * i * * * « # * • i ' : i i A * r r E[ [ECJ040R 3 c **.’ J ^ Hli .!> r hfltT I 1 1 ■ r 9 r Eon " , r '■ rs i; d .■*."*>* ■“ s 8 * WJ* .«!'■* ^fri*wQw iWi-SS* * u “ a *i S* « J J S^SWMI 5 9 % QrEcioAopi —iff* S-^lUppS ITS tn^ B Si'USJSJ — ■ r r .- .. . - T .. .. -ft ■ -Y -J* .- ■ -) J|JT - J ‘ ■ Pt pp Pi >4 ■* pp pp ■* -- P- ■- - PI pp Pi p t. p; c > copyr>9nt sokst Matrix nuitir>tdia By Bert van Dam (The Netherlands) The ECIO40 is a modern 18F4455 PIC microcontroller mounted on a miniature PCB and sporting a ready to use USB bootloader. The latter enables you to program the ECIO40 without having to buy an expensive programmer. The only things you need are a USB port on your PC and a small (free) program. In the E-Blocks article published in the March 2009 issue of Elektor, you could read how to measure an analogue and a digital signal using the ECIO40 and make these vis- ible on your PC using the USB interface and a suitable driver. In this article we do not use a separate driver, but use the standard HID driver which is already present on all mod- ern Windows based computers. This is what we’ll do The purpose of this project is to send an analogue signal via the keyboard interface to a PC, where this information can be used immediately in any software application. You can, for example, open a spreadsheet and position the cursor in the first cell. You now push a button on your circuit or press a key on your normal keyboard. The analogue measurements will now be carried out and are entered into the spreadsheet completely automatically. The data collected in this way can then be analysed in Excel using meth- ods with which you are already familiar, for example plotting the values in a chart. HID HID means Human Interface Device and is specifically intended for peripherals that are operated by people, such as a mouse or a keyboard. Devices in the category can be connected to the USB interface and do not need a special driver. The operating sys- tem in your computer (Windows XP in this project) does effectively take over the task of the driver. When the device under consideration is con- nected for the first time, it sends (among other things) two numbers to the PC, the PID (Product Identification number) and the VID (Vendor Identification number). In this project we use a PID code of F040 and a VID of 72BF. If the PC does not already know these numbers then the circuit has to sup- ply additional information. First the type of device is supplied, this is called usage. In this case the usage is a keyboard. This is some- times also called usage page 7. The exchange of information takes place in groups. These groups are called a report. The next step therefore is to detail the con- tents of the reports, the so-called report descriptors. In this case two are required. One to send data to the PC and one to receive data. Note: when the PC already knows the PI D/VI D combination, the connection is started immediately. Once you have estab- lished a usage page and report descriptors you cannot then change them very easily. That is because the PC does not request 52 11-2009 elektor them again and assumes that you have not changed anything. Send report The send report contains the data that the circuit will send to the PC. Note that because we use a standard HID (i.e. that of a key- board), we cannot change the contents of these reports. The reports consist of eight fields. The first field contains the status of the special keys such as Alt, Ctrl, etc. The second field is reserved. This must contain a ‘o’. The remaining fields can be used for keystrokes. Table i shows an example of a Send report. In a normal keyboard there are two scan codes associated with every key. The first code is sent when the key is pressed and the second when the key is released again. In this way the computer can detect the difference between a very rapid series of key presses and a key held down for a long period of time. Table 2 lists a few examples. There is fortunately a simpler method. When a scan code is followed by an empty report the PC interprets this as the release code for the most recently pressed key. In this project we do not worry about the make and break codes, we simply send the make code followed by an empty report. You have probably already noticed that the keyboard scan codes do not correspond to the ASCII-code that you are familiar with. Table 3 shows an overview of the key- board scan codes that are relevant to this project. Receive report The receive report (Table 4) contains the information that the circuit has to receive from the PC. We are actually only interested in the state of the LED for the NumLock key, but the report which contains that informa- tion also contains the status of other spe- cial keys. You can therefore easily add other functions to the circuit. This report con- sists of only one 8-bit number, where each bit indicates which LED is on or off. Among these are also the Compose and Kana keys which are used in Asia for the entry of, for example, Japanese characters. Table 1. Example of a Send report. Offset Field Length Description 0 modifiers 1 status of keys such as Alt, Ctrl, etc 1 reserved 1 reserved (0x00) 2 keycodes[0] 1 keyboard code 1 3 keycodes[1 ] 1 keyboard code 2 4 keycodes[2] 1 keyboard code 3 5 keycodes[3] 1 keyboard code 4 6 keycodes[4] 1 keyboard code 5 7 keycodes[5] 1 keyboard code 6 Table 2. Examples of Make and Break codes. Key Make code Break code A 1C F0,1 C 5 2E F0,2E FI 0 09 F0,09 Right arrow E0,74 E0,F0,74 Right Ctrl E0,14 E0,F0,14 Table 3. Make codes of the keyboard with the ASCII code of the number on the key. Key HID make code Number key HEX decimal legend ASCII Return 28 40 - - Tab 2B 43 - - Num Lock 53 83 - - Keypad Enter 58 88 - - Keypad 1 End 59 89 1 49 Keypad 2 Down 5A 90 2 50 Keypad 3 PageDn 5B 91 3 51 Keypad 4 Left 5C 92 4 52 Keypad 5 5D 93 5 53 Keypad 6 Right 5E 94 6 54 Keypad 7 Home 5F 95 7 55 Keypad 8 Up 60 96 8 56 Keypad 9 PageUp 61 97 9 57 Keypad 0 Insert 62 98 0 48 Keypad . Delete 63 99 - - Table 4. Structure of the receive report. Offset Field Length LED description 0 indicators 1 BitO NumLock Bit 1 CapsLock Bit 2 ScrollLock Bit 3 Compose Bit 4 Kana Bits 5. ..7 Reserved elektor n- 20 og 53 ECIO40 (18F4455) OOOOOOOOOOOOOOOOOOO USB °o° o o ggogoooooooogoooooo 10k lin V reed switch ^ 10k [ LED H — \ 33or h ii 090200 - 1 1 Figure 1 . The ‘schematic’ of the circuit. Only five external components are required. Hardware configuration The analogue signal is generated from a potentiometer which is wired as a voltage divider and can provide a voltage in the range from o to 5 volts to pin Ao. An LED is connected to pin Co via a series resis- tor of 330 Q. Instead of using an ordinary push button for the switch you could also, for example, use a reed switch. This is a switch that reacts to a magnetic field. Such a switch, which consists of two con- tacts in a glass tube, is normally open. When a magnet is held in the vicinity of the switch it will close. Of course, you can also use a normal switch. The schematic is shown in Figure 1 . We start by building the circuit on, for example, a breadboard. The power supply for the circuit comes from the USB-port in the PC. You therefore do not require a sepa- rate power supply. The jumper link on the ECIO40 has the be in the USB position. USB pack If you are using Flowcode V4 then you already have the required USB functionality available by default and you can skip this section. If you are using V3 then you will have to install the USB-pack from Matrix Multimedia [1] into your version of Flow- code. It is probably a good idea to upgrade to the most recent version of Flowcode V3 first. After you have unpacked the USB pack, you copy the Flowcode V3 direc- tory over the top of the directory with the same name in the Flowcode installation directory (this is usually C:\Program Files\ Matrix Multimedia). You subsequently have to run the ‘Install USBPack.bat’ file in the Flowcode V3\components directory to register the new components. On most PCs you will have to be logged in as an adminis- trator or have administrator rights. When you start Flowcode there will now be three additional hardware components in the component toolbar. If 1 etvd - 1 ’ “ O/jJ U5EMI PfO) : : ■5wdOifc-sR r «s! :WAtlkia 'V.'ifVl J irJih*t 0 ] - IMIJ ujbhKf Ll - tt.fij uiWbJSJ -GjuB U-sWrcJsj - (MB i nfclwf'1] - Lf.lll usbbtl'jl - nyrij uvWmWCwW - Li. .CO luieiK l m ncwmiy tMa ii U 0 &) 110*01 •; idra**Oi i [Dau avnfaMft I ttw data jOHIDiOI .etval X * nX & Iflur.* in P«t / iWvaI / Ll™. IS/ Haiawit w (t« tallriy - r«av. ratvaMjjWULXOj: :OwPC*TC vvrplr * retvai Uti I h Figure 2. The generation and sending of a send report. Figure 3. Part of the code for processing the receive report and possibly starting the data logging. Software In this article we use the ‘HID’ component. Click on this to add the HID component to your project and the following macros can now be used: lnitialise_HID UpdateData SendData SendDataDirect CheckRx ReceiveByte ReceiveString Open the USB component and ensure that the correct PID and VID codes are entered (PID F040 and VID 12BF). Select the HID Options tab. Here you have to indicate how large the packets are. A packet is the sum of all the reports. We are using one send report which contains eight bytes, so the total send packet is eight bytes. We also use only one receive report and that is one byte in size, so the complete receive packet is therefore only one byte. We increase the maximum current to 100 mA, so that there is sufficient current available from the USB- port for our circuit including the LED. For the Subclass we select Boot and for the Interface Keyboard. Subclass Boot means that we want to make use of the standard reports that are loaded by the operating system when the PC starts up (boots). Now click on the HID Descriptors tab and select keyboard. The other settings are not rele- vant for this project. We start the program with an Initialise _HID macro. When the USB connection is func- tioning properly the program ends up in an endless loop where first the state of the (reed) switch is checked. You can therefore use the Flowcode switch component. When the switch is closed an HID send report for the PC is generated which contains the key- board scan code for the NumLock key, 0x53 according to Table 3, at offset 2, the first location where we may place our codes. This report is sent immediately, see Fig- ure 2 . After that, the program will wait until the switch is opened, after which an empty report will be sent to indicate that the ‘key’ has been released. 54 ii-20og elektor Before we actually send any information we have to wait for the answer from the PC. The PC has to confirm that the key has been received. Incoming answers are sent directly to port C. Only pin Co of this port is used (connected to a red LED), but you could eas- ily extend the circuit by using the other pins of port C as well. This allows you to receive various different commands. Once the PC confirms that NumLock (Co) is turned on, the data logging can begin. To indicate this, the variable sample is given the value Y. In the program the instruction sample = retval AND i is used for that. When bit zero (that is NumLock) of the answer from the compu- ter ( retval ) is equal to Y then the value of sample will have the value of Y. In all other cases the value will be o (you can therefore use this variable to check whether the USB connection has actually been established (retval= o) or not (retval= 255). If retval is not equal to zero the program will stop in our project). The handy feature of this method is that it does not matter what the values of the other bits in retval are. Only the value of bit 0 is tested (see Figure 3). By starting the logging only after the PC has sent the confirmation, it is also possible to start the logging by pressing the NumLock key on the keyboard of your PC. This also results in a confirmation from the PC, which is sent to both the normal keyboard and our circuit. For the same reason the NumLock light on your keyboard turns on and off at the same time as the LED in the circuit. The analogue measurements are done the familiar way using pin Ao. First the ADC component is placed on the work area and assigned to the analogue-to-digital con- verter on pin Ao (that is, ADCo). From now on the ADC measurement is carried out Internet Links [1] www.matrixmultimedia.com/Flowco- deUSBPack.php [2] www.elektor.com/090200 A 1 0 2 a 3 u 4 G S 2 5 2 a 7 4 ? 0 S4 "FI 91 10 1 117 n 1AM ill 131 13 | 310 14 20 _Ld 7S& ID 2S& 1/ 10 250 15 75S 20 253 2] m 22 222 23 ?re> 24 109 25 174 20 100 27 144 20 130 20 113 30 103 ai an E 0 D E F G H 1 J USB HID data collection Figure 4 . Example of collected data represented in a chart. which results in a data byte. The measured value ends up in the variable retval. You cannot just send this value to the PC, when the value is 28, for example, you would first have to type the 2 and then the 8 on the keyboard, and not both at the same time. The circuit therefore also has to send the different digits of the measure- ment one by one. We do that by convert- ing the value into a string and then tak- ing the characters from the string one at a time in the form of an ASCII value. The next step is to convert these characters into keyboard scan codes. Since NumLock is active it makes sense to use the codes from the numeric keypad area of the key- board. The easiest way is to add 40 to the ASCII value, see Table 3. This goes wrong with the number zero, but we correct for this afterwards. After each number we send an empty report to indicate that the key has been released. We finally send an ENTER, again followed by an empty report. In Excel this ENTER ensures that the cursor moves to the next cell down. In practical use To make practical use of this application, carry out the following steps: 1. Start an empty Microsoft Excel spread- sheet and place the cursor in cell Ai. About the author Bert van Dam writes books for Elektor: PIC Microcontrollers (50 JAL projects for begin- ners and experts), Artificial Intelligence (23 2. Operate the (reed) switch or press the NumLock key on the keyboard. 3. The LED will turn on and every 100 ms the voltage on pin Ao is measured. This value is added to the column in the spreadsheet. 4. Operate the (reed) switch again and the data collection stops (and the LED turns off). 5. The data can now be processed into, for example, a chart (see Figure 4). What if it does not work? If it doesn’t work as you expect, check that you have selected an unused PID/VID com- bination. When the circuit is connected there should be an ‘HID keyboard device’ in Device Manager. If that is not the case then you will have to use another PID/VID combination. You can also check whether the jumper on the ECIO is in the USB position (if the jumper is in the EXT position an external power sup- ply is expected). The source code and the HEX file for the program discussed here can be downloaded from the Elektor website [2] as usual. ( 090200 -I) JAL projects to bring your microcontroller to life), Microcontroller Systems Engineer- ing with Flowcode (45 Flowcode projects for ARM, PIC and AVR microcontroller). elektor 11-2009 55 REVIEW IGLOO Nano & Icicle FPGA kits Cool, cooler, igloo! By Clemens Valens (Elektor Editorial France) Often when we talk about FPGA, the first we think of are Altera or Xilinx (in alphabetical order) - but these are not the only manufacturers of this type of devices. Actel is another one. Among its ICs, we find the Fusions, the ProASIC3S and the IGLOOs. Actel is currently playing the low consumption card and states that its IGLOO ICs are the most energy-efficient on the market. We tried out two IGLOO evaluation boards, the Icicle and the nano. Here are the results we got. Wc tel Windows OS AtjL-JCftLfc-KJT CD ftey 0 February 2003 You will have realised that the name of the IGLOO family refers to its power consumption, so low that the ICs always stay cool, round the clock. The Icicle board is the size of a ‘Magnum’® ice-cream (less the stick) - only it doesn’t melt in your hand! In spite of what you might think, the IGLOO nano board is more than twice as big as the Icicle, and its large number of pins (226) will undoubtedly delight the fakirs out there. The IGLOO family This currently comprises a dozen or so devices, from 15,000 to 3 million gates, and they’re almost all available in several differ- ent packages. The family breaks down into three branches: IGLOO (AGL), IGLOO nano (AGLN), and IGLOO PLUS (AGLP). The nanos are aimed at compact, low-consumption products, while the PLUS offer more I/Os, with greater possibilities. These ICs achieve their low consumption thanks to optimized power management, particularly through the Flash*Freeze mode. This stand-by mode makes it possible to ‘freeze’ the FPGA without los- ing what’s in it. Its memory stays intact, just like the register, and the output pins can maintain their levels. In the Flash * Freeze mode, the consumption is 5 pW for the smallest 1 C, as against 114 pW for the largest. Enabling or disabling this mode takes only 1 ps and is achieved via a dedicated input. Among other specifications, we can also mention a dual-port SRAM of 504 kb maximum, up to six built-in PLLs (phase-locked loops), and up to 620 input/outputs (in an 896-pin package). Certain members of the family are optimized to take a Cortex- Mi ARM processor. 56 12-2009 elektor Specifications of the nano kit (around £45 / €50 • IGLOO AGL250 FPGA with 250,000 gates • 8 LEDs • 5 push buttons (one of which is a reset) • 8 DIP switches • Flash* Freeze • USB serial port • All pins accessible via an expansion connector • Test points • Programmable I/O and core voltages • FlashPro3 programmer included • LiberoDVD • two USB cables Figure 1 . The IGLOO nano kit has lots of pins. These ICs need no other components to operate, no configuration memory nor crystal, and they work as soon as power is applied. The IGLOO nano kit The nano board is a development and evaluation board. Its name may lead to confusion, since the board does not carry an IGLOO nano, but an AGL250 1 C with 250,000 gates. It also includes a PSU, a USB serial port, and a few LEDs and switches. Numerous jumpers allow you to configure the voltages for the FPGA’s I/O banks, or its core voltage. Certain contacts allow you to measure various cur- rents— this is the evaluation side of the board. On the development side, there are two strips of 3x20 contacts on a 2.54 mm (0.1”) pitch that make almost all the FPGA’s pins accessi- ble. In this way, it’s possible to fit a piggy-back board onto the nano board and incorporate the FPGA into a personal circuit. Thanks to the JTAG programmer via USB, the FPGA is very easy to program. In the kit box, we find two boards, two USB cables, a bag of screws and spacers, a bag with some jumpers, a Libero V8.4 DVD-ROM (Actel’s development tools, see below) and a quick-start guide. The two boards are of course the nano board and the FlashPro3 pro- gramming board. The quick-start guide contains a table showing the jumper positions to make the demonstration application work. Once our board was powered up, via one of the two USB cables sup- plied, the demo application didn’t seem to work, even with all the jumpers (except JPi) correctly positioned. Fortunately, the explana- tion was soon found: you also have to fit the 20 jumpers supplied in the bag ontoJPi3, JP14, and JP15. These jumpers make it possible to connect the boards LEDs and switches to the FPGA. elektor i2-20og 57 Specifications of the Icicle kit (around £90 / €1 00 • IGLOO AGL125 FPGA with 125,000 gates • 96x16 pixel OLED graphic display • 3 LEDs • 3 push-buttons (one of which is a reset) • Flash* Freeze • 120 mAh Li-ion battery • USB serial port • Expansion connector for 34 I/Os • JTAG port • Test points • FlashPro3 programmer included • two USB cables • CD-ROM with documentation, tools, and software Figure 2 . The IGLOO Icicle board is a bit lop-side due to the battery on the solder side. With all the jumpers properly in place, you can play around a lit- tle with the LEDs by pressing the buttons or changing the switch positions. (It’s worth noting that the references for the buttons and switches in the quick-start guide are wrong). The demonstration application also lets you check the board’s USB serial port. If you run, for example, HyperTerminal on the computer and configure the serial port correctly (g6oon8i), the board will send back the characters transmitted by HyperTerminal. Our board passed this test too. The IGLOO Icicle kit About the size of a mobile phone, the Icicle board includes on one side of the PCB an AGL125 FPGA with 125,000 gates, a tiny (25x7 mm) green or blue 96x16 pixel OLED graphic display, three LEDs, three push-buttons, a switch, a few jumpers, a USB serial port, a JTAG port and an extended JTAG port for the FlashPro3 programmer. On the other side of the PCB we find an LIR2450 format Li-ion battery with a capacity of 120 mAh. The Icicle board can be used in one’s own cir- cuit thanks to a 2Xig contact (2x20 if you count the keyway) expan- sion connector in the Mini Edge Card format. This connector gives access to 34 of the FPGA’s I/Os. All the Icicle’s devices are low-consumption, which means the board can be powered just from the battery. Note that when the battery is charged, the only way to turn off the power to the board is to remove jumper JP11. Besides the Icicle board itself, the Icicle kit contains a FlashPro3 programmer, two USB cables, and a CD-ROM on which are found the data sheets for the Icicle board, the programmer, and certain devices, and the circuit diagrams of the card, along with the pro- grammer driver, the software for the FPGA, and other potentially interesting documents. Everything is packed in a recyclable brown box made from recy- cled cardboard. So it’s a kit with low environmental impact - it’s ‘green’! The board’s manual describes howto measure the current in the dif- ferent parts of the board and the influence the Flash* Freeze mode has on these measurements. So we measured the core current run- ning at 1.2 V (2.7 mA) or at 1.5 V (3.6 mA), but the In view of this problem, added to the fact that the pre-loaded application failed to behave as described in the manual, we decided to reprogram the board with the software found on the CD-ROM. The latter compiled with no problem, though Libero V8.5 (see below) had to convert the project, which had been created with an earlier version. About a minute later, the time taken to reprogram the FPGA, the board worked as described. The LEDs worked differ- ently now (a 3-bit binary counter) and the core current at 1.2 V had dropped to 1.5 mA, or 2.0 mA for a core voltage of 1.5 V. The most important thing is that now the Flash* Freeze mode was working. We measured around 28 pA at 1.5 V and around 16 pA at 1.2 V. As a result, the board’s indicator, which shows if the core current is belowioo pA, also lights up when Flash*Freeze mode is enabled. Libero Like the other FPGA manufacturers, Actel also makes available a free version of its development tools. The suite, called Libero Gold, includes not only the manufacturer’s own tools, but also ‘light’ ver- sions of other software for FPGA programming specialists, like Mod- 58 12-2009 elektor Libero IDE v8.5 specifications: • Windows XP Pro with SP 2 or Vista Business Edition • Graphical environment • Design via circuit diagram entry or programming • Synthesis elSim from Mentor graphics and Synplify from Synplicity. There’s also a demo version of WaveFormer by SynaptiCAD. We started off by installing Libero V8.4, supplied with the nano board. Note that Libero requires Windows XP Pro SP2 or Vista Busi- ness Edition as a minimum. The installation went off alright (though you do need to allow nearly 4 GB of space free on your hard drive) apart from a message at the end saying that the installation wizard couldn’t find the drivers for FlashPro3, the little FPGA programmer. The Actel website [2] mentions this error number SAR 46033. After obtaining a licence, we started the ‘Libero IDE Quick Start Guide & Tutorial’ [3] (don’t forget to download the Design Files as well, also available from [3] ) Concerning the error message at the end of instal- lation, we had to manually create the links in Libero between the tools and their location on the hard drive. Everything was going fine until we needed to use the WaveFormer Lite tool to create graphically a stimulus file for a simulation. This tool simply refused to recognise the temporary licence supplied by the manufacturer. There was nothing to be done about it, even with the help of the manufacturer’s tech support. This was all sorted out by uninstalling Libero V8.4 completely - and manually, to boot, as the installation wizard that also takes care of uninstallation didn’t want to know either. Fair enough, all this was probably owing to a slip-up on our part - but all the same, we preferred to order a free DVD of Libero V8.5 (the current version at the time of our experi- ments) from the Actel website before continuing. It is also possible to download the DVD. We received the DVD a few days later, and it was as simple to install as the previous version, with the same error at the end. For your information, our test computer runs under Windows XP Pro SP3. The licence management seemed simpler, but perhaps because we hadn’t (properly) deleted all the licences etc. from the previous installation. Once the IDE (integrated development environment) was running, everything worked and the tools were recognised. Windows recognised the FlashPro3 programmer when we con- Internet Links [1] www.actel.com [ 2 ] www.actel.com/download/program_debug/flashpro/ fpro85.aspx • Simulation • Placement and routing • Programming nected it to a USB port, and this time WaveFormer Lite worked per- fectly. So go for Libero V8.5 (or better still v8.6, which had just come out as we were finishing off this article), and follow the instructions given in the messages accompanying the licences to the letter. The tutorial refers to V8.4 of Libero, and certain details are no longer correct. There’s nothing serious and with a bit of patience, you can get through all the stages. But there are a lot of them, and it can take one to two hours. The reward is a board that can make three LEDs flash thanks to a 3-bit counter. It’s decidedly less spectacular than the demo application preloaded onto both boards (which you delete as you go through), but it’s so gratifying that you stay watch- ing, mesmerised, for a long time. Just to finish, let’s once again clarify one little subtle point. Libero needs to know which FPGA is being used, and offers a long list of all the models it knows, from which you have to choose the right one. In this list, there are two versions of the AGL250 on the nano board, V2and V5 (the same goes for the AGL125 on the Icicle board). How- ever, the version is not marked on the device itself, and on the Actel website [l] the information is well hidden. But if you know where to look, you can find it - for example, on the AGL family data sheet [5] (the note on page III, of course!) It’s simple: if there is no version shown on the device, it’s a V2. This model can operate with a core voltage between 1.2 V and 1.5 V, unlike the V5, which only works with a core voltage of 1.5 V. Final remarks Actel has gone to a lot of trouble to create comprehensive evalua- tion and development platforms that are easy to use and relatively cheap. The systems are not very complicated to use and are acces- sible even for novices. The two nano and Icicle kits are supplied with matching FlashPro3 programmer (blue for the nano board which is blue and green for the Icicle board which is green), which shows a certain attention to detail (or a lucky coincidence!) With such a com- plex product, encountering a few minor hiccups is acceptable. ( 090528 -I) [3] www. a cte I . co m / p rod u ct s/ h a rd wa re / d e vki ts_bo a rd s / igloo_starter.aspx#docs [4] www.elektor.com/090528 [5] www.actel.com/documents/IGLOO_DS. pdf elektor 12-2009 59 MISCELLANEOUS The World’s Smallest Electric Motor Elektor reader listed in the Guinness Book of Records By Harry Baggen (Elektor Netherlands editorial staff) Jos d’Haens is an especially versatile indi- vidual who has done many different things in his life. Although he was especially inter- ested in technical subjects in his youth, he began his professional career as an econo- mist with Bell Telephone in Antwerp. There he had an opportunity to switch to engi- neering and concentrate more and more on technical matters and electronics. He was especially interested in microelec- tronic and micromechanical aids for indus- trial and medical applications. His first invention was a tiny electric motor for use in biomedical applications, which at the time (1958) was the smallest electric motor in the world. In 1962 he developed an ‘endomotor probe’, which is a device for examining the gastrointestinal tract. To improve his theoretical knowledge, in 1966 he enrolled in a course of study at the Faculty of Science of the Sorbonne. His fur- ther career consisted of a variety of large projects, such as setting up and manag- ing two PCB plants in Belgium and several electro-optical plants outside Belgium, as well as pursuing his own inventions. These involved a wide variety of devices, such as equipment for measuring air pressure and relative humidity and the very first Euro- pean wristwatch calculator. What would you say to an electric motor smaller than the head of a pin, and what’s more, mostly hand made? It really exists. With this motor, Jos d’Haens recently established an official world record recognised by Guinness World Records. We could mention a lot more examples, but in any case it’s clear that what we have here is an inventor and engineering adept who always has to be doing something. It should thus come as no surprise to our readers that Jos has been a faithful reader of Elektor mag- azine since the very first issue. Now that he is retired, he still keeps busy with electronics and engineering. In his well equipped personal shop, he works regu- larly on his favourite hobby: making micro- motors. His latest product is a hand-made miniature electric motor that, according to him, is the smallest mechanical motor in the world. 60 11-2009 elektor Figure 1 . The Guinness World Records certificate. Figure 2 . Special equipment was developed to fabricate the miniature components. A few months ago, Jos reported this remark- able device to Guinness World Records, in the hope that his product would be recog- nised as the world’s smallest electric motor. After a long wait, in February he received a certificate from Guinness World Records stating that his new electric motor estab- lished a new world record, which of course will be reported in the next edition of the Guinness Book of Records. The primary stimulus for the develop- ment of a new, even smaller motor was a contest, but it is entirely possible that the resulting motor will be used in a practical application. Although Jos can make use of special equip- ment of his own design (as shown in Fig- ure 2) in the preparation of his prototypes, we imagine that Elektor readers would be especially interested in the design and con- struction of this motor. If the dimensions are enlarged somewhat, a motor of this sort can also be built using ordinary tools. First let’s have a look at some of the specifi- cations of the micromotor: Diameter: 1.65 mm Length: 0.90 mm Weight: 9.8 mg Volume: 1.92 mm 3 Operating voltage: 0.220 V Operating current: 18 mA Speed: 600 to 6000 rpm (variable) The miniature electric motor has three windings that are driven by an electronically generated three-phase signal. It is thus an example of what is called a ‘brushless DC motor’. Figures 3 to 9 show the various components of the motor. Figure 3 shows one winding, which consists of 80 turns of 0.02-mm cop- per wire. A total of three such windings are necessary. They are formed into the proper shape (flattened and slightly curved) as Figures 3 - 9 . The various components of the micromotor. 1 JFK v „ i ■ r \ Jf-A 4 * elektor 11-2009 61 Figure 1 0 . Schematic diagram of a micromotor drive circuit. With suitable modifications to a few component values, this circuit can also be used to drive larger motors with three windings. shown in Figure 4. The rotor consists of a very small magnet (5) that is eroded and ground to the right dimensions and has a hole for the attachment of the shaft (6). Two tiny plates with cutouts (7) act as the upper and lower portions of the motor housing. Figures 8 and 9 show the complete assem- bly. The winding are glued in place between the upper and lower plates, so they effec- tively form the rest of the housing. If you want to experiment with your own DIY motor, you can use the schematic dia- gram shown in Figure 10. This is the origi- nal circuit that Jos used to drive his micro- motor. The design is simple but very effec- tive. Starting from a g-V supply voltage (provided by several penlight cells in a bat- tery holder or a single g-V battery, which is adequate for a micromotor), a 7805 voltage regulator generates a stable 5-V operating voltage. This voltage is used to power the other ICs in the circuit. A second voltage regulator (an LM317) is used to reduce the voltage to 1.5 V, since the windings of the micromotor require a relatively low operat- ing voltage. The frequency of the three-phase drive sig- nal is controlled by a 555 configured as a square-wave generator whose output fre- quency can be adjusted by a potentiometer over the range of 60 to 600 Hz. This signal is fed to the clock input of a CD4018 preset- table divide-by-N counter. The Qi, Q3 and Q5 outputs of this counter drive the motor windings via a set of BC517 Darlington tran- sistors with 33-^ series resistors to limit the motor drive current. The CD4018 is con- figured to operate as a divide-by-six counter by connecting pin 6 to pin 1. The signals on the Qi, Q3 and Q5 outputs drive each of the windings in sequence with a certain amount of overlap, which creates a well-defined rotating magnetic field in the motor. If you want to use this circuit for your own projects, you can modify the frequency and voltage of the winding drive as necessary. Bear in mind that the BC517 transistors have a maximum rated peak current of 1 A, so a larger type must be used if higher currents are necessary. ( 090499 -I) Advertisement Prototype & small series PCB specialists CIRCUITS pC® V * 0 s e t M\ce Instant online pricing and ordering Low order-pooling prices - 1-8 layers Full options service On demand - 1-16 layers Deliveries from 2 days Stencil service Call us: 020 8816 7005 Email: euro@eurocircuits.com www.eurocircuits.com PROTO 2 boards in 2, 3 or 5 days No tooling charge Low PCB-Proto prices E.g. 2 x 100 x 80 mm: 2 layers 38.12C each* 4 layers 77.23C each* Immediate online ordering No minimum order charge 62 11-2009 elektor Memory «, Discover Deep Memory Performance. Du* to memory constraints, traditional digital stooge oscilloscopes do not haw iJhe capability of displaying a complete electronic signal at a high samplp #at*. The GD5-1QQQA Series uses Memory Prime technology to overcome ihe problems assoc lated with memory constants- By displaying com pie?* signals with greater detail, the GD5-1000A Series can maintain a high sample rate over a wider horizontal range, without affect ing performance. Challenge yourself to go deeper P CDS1M0A I CDS 1000A Series Digilnl Storage Osci loscope * 1 50/1 CM/60 MHz Bandwidth, 2 Input Chamets * Sample Rales up to tCSa/s Real-Time Maximum, 2SGsa/s Equivalent Time ■ 2M Points Record Length MaKrnwnli * ImV^IOV Vertical Scale,! ns-ifts Horizontal! Range ■ Up to 27 Automatic Measurements ■ USB mi SD ruterlace Supported ir'-armiiicn jtuHji Ihr ardvanlajc^of MemfryP^rneEKhnn 1 ^. %na-«l O'jr A.P&5. «e ,.| w^-^n-e^&ry-pr-irc.cfir'. ur coni.ultrwj r k-:jl d^Lribol^f. |buy CDFI-nrrir-. fir L a lirnilvd li^clitwPTJfTinLT & a cornplimefihor SO card reader \ GOOD WILL INSTRUMENT CG. P LTD. Ho. 7 - 1 , fiaad, TuC^tSIf Clft Oipti C^yFYffrJJG. Uiwj- r «fH4-U£frti)£9 f4U3rZHI G^mSTEK Wrtde to Measure sh=f rjjt www.gwins1ek.com HOBBY & MODELLING AVR-Max Chess Computer A minimalist homebrew chess computer With contributions by Andre Adrian (Germany) For just a few pounds you can take a microcontroller, add a few pushbuttons and some 7-segment displays to build a chess computer reminiscent of the legendary Mephisto I. The low component count (and no SMDs!) allows the entire machine to be shrunk onto a neat pocket-sized PCB. Despite LED displays it draws just 20 mA and will run until the battery supply falls below 1.9 V. Following on from last month’s feature on the ATM18 Mini Chess Computer for the Elektor AVR board we now present, as promised, a dedicated stand-alone chess computer featuring the same firmware with optimised hardware. This mini project originates from the SHAH computer devel- oped by Andre Adrian, described in detail last month. The original firmware has been ported to run with 7-segment displays and the prototype PCB produced by the author was reworked in the Elektor Labs to produce a professional job just half the size of the original. The computer’s basic operation has already been described in the previous arti- cle so we will just concentrate on construc- tion and operation with the 7-segment LEDs which replace of the two-wire serial inter- faced LCD display of the ATM18 project. The circuit The central element in the circuit diagram (Figure 1) is an ATMega88 microcontroller in a 28-pin skinny DIP package. The con- troller’s clock is derived from its on-board RC oscillator running at 8 MHz (max). A 3 V supply is provided by two series con- nected AA or AAA batteries via coil Li. On power-up the network formed by R13/C2 generates a reset to the microcontroller. Connector l<2 provides an ISP program- ming interface for either the AVRISP-MKII or compatible Elektor USB AVRprog [1]. The controller firmware is available for free download from the Elektor website [2]. A ready-programmed controller is also avail- able from the Elektor Shop so you don’t need to program it yourself. Port pins PDo and PDi connected to K3 pro- vide a serial interface for a PC. The signal lev- els are compatible with the USB TTL adapter cable featured in Elektor June 2008 [3]. Features • Minimal component count • Low power (20 mA @ 3 V) • Battery power using two AAA or AA cells • Nine playing levels • Look-ahead 20 halfmoves • Elo rating approx. 1200-1399 • Display of principal variant mode (on/off) • Opening set-up possible • Select black/white at start of play • Change sides during play • Computer can also compete against itself The rest of the circuit consists of a multi- plexed interface to drive the 7-segment LED displays (LDi to LD4) via transistors Ti to T4. Seven port pins read the push button matrix Si to S11 in precisely the same way as the ‘ATM18 Mini Chess Computer’ described last month. The C routines driving the dis- play and scanning the push button matrix are optimised to help reduce power con- sumption. The C source code is well docu- mented and worth downloading. And PCB Construction is quite simple, despite the small (100 mm X40 mm) PCB (Figure 2) no SMD components are used in the design. The layout is double-sided and through- hole plated. For simplicity all components are mounted on one side only (Figure 3). Connectors l<2 and K3 need not be fitted if you do not intend to program the con- troller in-system. Use an 1 C socket for the ATmega88. The project is also available as a kit from the Elektor Shop, with all the nec- essary components. To make a really neat job the finished board can be fitted into a suitable enclosure. Game on... The chess engine and keypad input routines are identical to those used on the ATM18 mini chess computer described last month. The AVR-Max chess computer however has a more basic 4-digit LED display which allows it to display a maximum of four characters. Before powering the unit up take a few minutes to inspect all the soldered joints to make sure you have not accidentally bridged two pads with a blob of solder and that ICi is fitted the correct way round. Once you are sure that the supply leads are correctly con- nected the unit can be powered up. If every- thing is in order the word ‘SHAH’ appears on the display. Pressing the CL button clears the display ready for your first move to be entered. Enter for example E2E4 and press the GO 64 11-2009 elektor COMPONENT LIST Resistors R1 -R 8 = 470£1 R9-R13 = 1 0kn Capacitors Cl ,C2 = 1 0OnF (lead pitch 0.1” / 2.54mm) Inductor LI = 10|iH (fixed inductor) Semiconductors LD1 -LD4 = SA52-1 1 (Kingbright), 7-segment LED display, red, common anode, 13.2mm height T1-T4 = BC559C (or-B) IC1 = ATmega88P-20PU (Atmel), pro- grammed, Elektor Shop #081101 -41 Miscellaneous SI -S1 1 = push button, 1 make contact, PCB mount, e.g. Multicomp MCDTS6-5N K1 = 2-way pinheader or 2 solder pins l<2 = 6 -way DIL pinheader l<3 = 6 -way SIL pinheader, right angled (optional) Battery holder for 2 AA or 2 AAA batteries Kit of parts # 081 101-71 (see Elektor-Shop, www.elektor.com) PCB#081 101-1 Project software, free download #081101- 1 1 .zip from www.elektor.com/081 101 shows the players move while a static dis- play shows the computers move. When Figure 2. The double-sided PCB measures just 100 mm x38 mm but does not use any SMDs. button twice to enter the move and instruct attempt to enter an illegal move will gen- the computer to calculate its move. An erate ‘ILL’ on the display. A blinking display +3V + to LI /YVYY 10pH K1 R13 vcc © C2 ^^00n K2 o o- o a o o ISP vcc © 21 9_ 10 17 18 19 * K3 SERIAL 0 o o o o] 2 ci 100n 20 VCC AVCC AREF PCO(ADCO) IC1 PCI(ADCI) PC6(RESET) PC2(ADC2) PC3(ADC3) PC4(ADC4/SDA) PC5(ADC5/SCL) PDO(RXD) PB6(XTAL1/TOSC1)) PDI(TXD) PB7(XTAL2/TOSC2)) PD2(INT0) PD3(INT1) PD4(XCK/T0) PD5(T1) PD6(AIN0) PD7(AIN1) ATmega88 -PDIP PB3(MOSI/OC2) PB4(MISO) PB5(SCK) GND PBO(ICP) PBI(OCIA) PB2(SS/OC1 B) GND 8 X 22 23 24 25 26 27 28 14 15 16 R1 3 , R2 4 R3 5 R4 6 R5 11 R6 12 R7 13 R8 470Q 470Q 470Q 470Q 470Q 470Q 470Q 470Q VCC 1 BC559C LD1 6 4 2 1 9 10 5 CA CA :0 • U o g dp SA52-11 3 * A1 S5 ^ E5 S9 ^ FN BC559C LD2 6 4 2 1 9 10 5 CA CA :0 • U g dp SA52-11 B2 t F6 S10 t rtiD^S BC559C LD3 6 4 2 1 9 10 5 CA CA :0 ■U o g dp SA52-11 S3 ^ C3 G7 S11 GO rOil^S BC559C LD4 6 4 2 1 9 10 5 CA CA :0 •Oo g dp SA52-11 S8 ^ H8 081101 - 11 Figure 1 . AVR-Max circuit diagram. The ATMega88V uses its internal 8 MHz RC oscillator. elektor 11-2009 65 Figure 3 . The fully populated circuit board. checkmate occurs ‘MATE’ is displayed. At power-up the computer will always play black. To switch it to white press CL then GO. To set up an opening position (e.g. E2E4, E7E5, G1F3 and B8C6) enter both black and white moves while pressing the GO but- ton once only after each move. The FN button gives access to all the set up functions. FN and 1 starts a new game, FN and 2 changes the playing level (press GO to return from play level setting). FN and 3 switches the principle variant mode off or on (see last month’s ‘ATM18 Mini Chess Computer’ feature). The CL button clears input values. The philosopher and Al sceptic Hubert Drey- fus predicted that a computer would never be capable of playing chess at the highest level. Since then we have seen Grandmas- ters humbled by super-computing number- crunchers. One tip for the faint-hearted: When your situation looks a little grim dur- ing a game just press the GO button to swap places with the computer, see if it’s smart enough to get itself out of the position it played you into! Too bad we don’t have a GO button to get us out of tricky situations in real life! ( 081101 -I) Internet Links [1 ] www.elektor.com/080083 [2] www.elektor.com/080947 [3] www.elektor.com/080213 Author’s website (German): www.andreadrian.de/schach/ Author’s email: Andre.Adrian@gmx.net Advertisement MODULE The Parallax Say It Module (#30080) Sjjj provides voice recognition functions for 23 built-in pre-programmed or up to 32 user-defined commands. The yljfc 5. : GUI software for the BASIC Stamp 2 BT*' provides an easy interface for training ^ ( the module and producing template code. Or use the simple and robust serial protocol to access the Say It module functions from other microcontrollers. The 10-pin SIP fits the Board of Education AppMod header, and code for the Boe-Bot robot is provided Application ideas include: voice controlled robots home automation, and voice activated projects. * 3: — m HP ISffifrU I ** 31 jo-tf-wu * - X’Efi F^RMLlMX www.parallax.com Friendly microcontrollers , legendary resources. z Milford Instruments www.milinst.com Spinvent www.spinvent.co.uk 66 ii- 20 og elektor AUDIO & VIDEO Booster for Audio Signals Cranks up bass & treble By Markus Aebi (Switzerland) Dull and washed-out sound? With modern recording technologies this is unlikely to happen. There are nevertheless situations where a fuller sound would do no harm (live bands, for example, but cheap headphones could also benefit). A small amount of ‘effect* could make the sound experience just ‘perfect*. Weak bass and dull treble frequencies are things of the past with this circuit. The ingenious principle of the project described here makes the reproduction more delicate, fuller and subjectively louder. The circuit was originally intended to be built into a mixing desk (immediately before the Mas- ter Fader), but works just as well as a stan- dalone device when the input and output voltages are adjusted appropriately (about 1.5 V / 0 dB at the first op amp). The principle The high and low frequencies are processed independently of each other. The left and right channels are identical, with the exception of the part of the circuit controlling the ampli- fication of the low frequencies, which is used for both channels and therefore does not need to be implemented twice (see Figure 1). After the high-pass filter with C4 (C15 for the right channel) the high frequencies are amplified ‘quick and dirty’ with the circuitry around Ti (T2). The diode pair Di, D2 (D3, D4) generates higher harmonics which are added to the original signal with potentiometer PiA (PiB). This makes it sound ‘fresher’. The low frequencies are separated from the original signal with the network around ICiB (IC2B) and subsequently passed on to the current-controlled operational transcon- ductance amplifier (OTA), which is con- figured as a VCA here (Voltage Controlled Amplifier, IC4Aand IC4B respectively). The ‘Dynabass’ potentiometer P2A (P2B) deter- mines how much of the original signal is processed. RC network R16/C11 acts as a variable low-pass filter (and also has a vari- able phase shift with respect to the original signal, which results in a subjective ampli- fication of the low frequencies). The values of the RC pair affect the tuning of the filter. The selected resistor of 33 kO in combina- tion with a capacitor of 22 nF gives optimum tuning. The control current of the VCA, which deter- mines the gain of this 1 C, is generated with the circuit around T3. This circuit works as a kind of limiter circuit (quasi limiter func- tion) and shows via LED D7 how much ‘control’ is applied. The processed signal is added to the signal immediately after the ‘Harmonics’-potentiometer (PiA and PiB respectively). When both potentiometers are set to their minimum positions the signal passes through unchanged. An external symmetrical power supply of ±15 V completes the story. The current con- sumption at this voltage is about 40 mA for the positive supply rail and 35 mA for the negative supply rail. Each 1 C is provided with decoupling capacitors and the PCB is fitted with additional 100 pF buffer electrolytics. Construction When assembling the PCB you follow the traditional procedure: first the ‘small’ parts such as resistors and diodes, then the ‘big- ger’ parts such as capacitors and transistors. We used sockets for the ICs so that swap- ping the op amps for a different sound is very easy. The construction is not all that difficult because no SMD components are used. In our prototype we chose to use headers and sockets for the connections to the two double potentiometers. These are men- tioned in the parts list. It is, of course, also possible to omit those headers and connect the potentiometers directly to the board using short wires. The double-sided PCB has been made as compact as possible (88 x 69 mm) and has not been designed with a specific enclosure in mind (see Figure 2). The PCB layout can be downloaded from the project page [1]. Measurements The two graphs summarise how the circuit influences the signal. The graph in Figure 3 shows the amplitude characteristic of the low-pass filter. This shows that the low-fre- elektor 11-2009 67 +15V JR6 Icnl I co I R5 |— I 390k I— 1 C 5 1 1 ( 10pll (Y C6 HH In TI \ - D2 ►I T 1N4148 R di ci ■ lo BC550C < 1N4148 | 470p CIO R1Q - 1 - TQ— lOu ' +15V ®- 0 ~ 080094 - 11 Figure 1 . The schematic may strike as quite sizeable, but the dimensions of the PCB are very reasonable. quency part of the circuit operates below about ioo Hz. At the high-frequency end the circuit operates from around 5 kHz, based on the clipping of Ti (T2). The second curve (Figure 4) shows the ratio between the amplitudes of the input and output signals of the VCA (green curve), measured at pin 9 of IC4. It shows that the curve is linear up to about -10 dB, after which compression occurs. The effect of this is that the low frequencies are accentu- ated a bit more and the entire sound sounds fuller. The same graph also shows the distortion of the output signal at 60 Hz and 1 V input 68 11-2009 elektor COMPONENT LIST Resistors R1,R19=100kft R2,R3,R20,R21 = 92I<£1 R4,R22 = 1k£2 R5,R23 = 390kft R6,R24 = 3.9kn R7,R8,R1 5,R1 8,R25,R26,R33,R36,R39 = ^oka R9,R27 = 39kft R10,R28 = 100£1 R11,R29 = 47kn R12,R30 = 1.5I<^ R1 3,R1 7,R31 ,R35,R38 = 4.7kft R14,R32 = 2.2l<£2 R16,R34 = 33kn R37 = 470^ PI ,P2 = 4.7k£2 logarithmic, stereo Capacitors Cl ,C1 2,C23 = 220nF, lead pitch 5 or 7.5mm C2,C1 3 = 1 0nF, lead pitch 5 or 7.5mm C3,C1 4 = 47nF, lead pitch 5 or 7.5mm C4,C1 5 = 3.9nF, lead pitch 5 or 7.5mm C5,C1 6 = 1 0pF, ceramic, lead pitch 5mm C6,C1 7 = 1 nF, lead pitch 5 or 7.5 mm C7,C1 8 = 470pF, ceramic, lead pitch 5mm C8,C19 = 220pF ceramic, lead pitch 5mm C9,C20 = 1 pF, lead pitch 5 or 7.5mm Cl 0,C21 = 1 OpF 50V, radial, bipolar, lead pitch 2.5mm, diam. 8.5mm max. Cl 1 ,C22 = 22nF, lead pitch 5 or 7.5mm C24 = 1 0pF 63V, radial, lead pitch 2.5mm, diam. 6.3mm max. C25-C30 = 1 0OnF, lead pitch 5 or 7.5mm C31,C32 = 100pF25V, radial, lead pitch 2.5mm, diam. 8.5 mm max. Semiconductors D1 -D6 = 1 N4148 D7 = low current LED, red, 3mm T1 ,T2 = BC550C T3 = BC547B IC1 JC2.IC3 = NE5532, 8-DIP case IC4 = LM 1 3700 1 6-dip (e.g. Farnell # 1651866) Miscellaneous 1 1 pcs PCB solder pin 4 pcs 3-way pinheader (PI ,P2) 4 pcs 3-pway socket PCB, #080094-1 see [1] Figure 2. The components are quite close so the circuit will fit on a compact PCB. voltage, measured at pin g of IC 4 (blue). The -10 dB value is also represented in this curve, with the difference that the distor- tion increases exponentially from that point onwards (this makes sense because the sig- nal is compressed above that value). This is naturally not a circuit of particular interest for audiophiles. But they probably only use flawless signal sources. For every- one else who would like their sound to be fresher and livelier this booster circuit is a good alternative to an equalizer. (080094-I) Internet Link [1 ] www.elektor.com/080094 Elektor 1 1 1 1 /% _LL L 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1111 l l 1 1 1 1 1 1 1 1 1 1 III! 1 1 1 1 INI 1 1 U 1 1 1 1 20 50 100 200 500 Ik 2k 5k 10k 20k HZ 080094- 12 Figure 3. This clearly shows the frequency range of the low frequency part of the circuit. Elektor Figure 4. The gain and distortion of the low frequencies depends on the input voltage. elektor n-20og 69 MICROCONTROLLERS USB Mouse using R8C/13 Starter Kit Helmut Posselt (Germany) The ‘Tom Thumb’ R8C/13 starter kit described in Elektor in February 2006 has proved popular with our readers and has found its way into many applications, as a glance at the Forum on our website will show. The original idea behind the project presented here was to make a friction-free device for measuring linear movement using the R8C/13 and an optical mouse. The advantage of the optical mouse over its mechanical brother is that it has no moving parts that inevitably get dirty and jam. The system consists of a C program running on the R8C and a short terminal program in Visual Basic to display the results on the PC. Early tests showed that the displace- ment values reported by the optical mouse seem to depend on the speed of the motion: when moved faster over the same distance, the reported total count was considerably smaller. This is not ideal for a measurement application, but the project still provides a useful demonstration of how a mouse can be driven from a microcontroller. No doubt our ingenious readers will find other applications for these very low-cost sensors. Most USB optical mice come with a USB-to-PS /2 adap- tor to allow them to be used on older PCs via the PS /2 connec- tor. The mouse uses four pins on the con- nector, as shown in Figure 1 (and see also [ 1 ]). By tapping into a PS /2 extension cable it is possible to look at the data and clock sig- nals that run between mouse and PC using a two-channel oscilloscope. Similarly, the USB connector has four pins (Figure 2) and again we can tap into an extension cable to Figure 1 . The prototype built and tested in the Elektor labs. USB socket type A (PC side) USB plug type A 4 3 2 1 (mouse side) 1 - VCC (+5V) 2 - D- (MouseData) 3 - D+ (MouseCLK) : 4-GND 080457 - 12 Figure 2. pinut of the PS2-to-mouse conneection. Figure 3. Pinout of a USB mouse with Type-A plug and socket. 70 ii-20og elektor monitorthe signals. The surprise is that the USB signals are the same as the PS/2 signals! The USB-to-PS/2 adaptor is in fact entirely passive and simply connects the USB signal wires through to the PS/2 connector. For our experiments with mouse and micro- controller we simply need to obtain a suit- able PS/2 or USB socket and connect the two control signals to spare port pins, for example via 1 k£l resistors on the R8C/13. It is also necessary to connect GND on the mouse connector to GND on the R8C/13, and to supply the mouse with +5 V, which can also be done via the microcontroller board (Figures). For test purposes we con- nect the R8C/13 board to a PC using its RS- 232 interface (RXDi and TXDi). The short terminal program, written in Visual Basic 5, along with ‘port.dll’ [4], allows command codes to be sent to the R8C/13 at the click of a button; the R8C/13 in turn carries out the desired command. Where necessary, addi- tional data values required for its execution are appended to the command code (for example, in the case of SetSampleRate). The returned values are sent back to the PC for validation and display. This makes it easy to check that the mouse and the R8C/13 program are running correctly. Figure 4 shows an example of received data when the mouse is ‘hot plugged’, and at the top of the figure is an oscilloscope trace of the data and clock signals. Communication between mouse and R8C/13 uses a bidirectional synchronous serial pro- tocol [1], one byte at a time. Each byte is sent as a string of 11 bits, consisting of one start bit (always logic 0), eight data bits (sent LSB first), one parity bit (logic 1 if the number of Y bits is even, logic 0 otherwise), and one stop bit (always logic 1). When transferring data from the host to the mouse there is an additional acknowledge bit. The clock signal is always generated by the mouse. However, the R8C/13 can hold the clock signal Low in order to interrupt the mouse. The R8C/13 reads data bits from the mouse on the falling edge of the clock sig- nal, and the mouse reads data bits on the rising edge of the clock. Figure 4 . The minimal system with the R 8 C /1 3 carrier board complemented with a mouse connection. At the beginning of a mouse command (see [2] for a more complete description of the commands) the R8C/13 first pulls the clock signal Low for 100 ps, which inter- rupts any communication from the mouse. The R8C/13 must then take the data signal Low and the clock signal High, forming a ‘request to send’ instruction to the mouse. The mouse is now permitted to start gener- ating clock pulses. Figure 5 shows the status information that a Status Request command elicits, and Fig- ure 6 shows the movement and button information. An example of command exe- cution is shown in Figure 7, where the com- mand ‘ReadStreamData’ has been sent: one of the movement data packets (containing status, X-movement and Y-movement infor- mation: compare with Figure 6) is shown in the figure. Further examples can be found in a PDF file at [5], where software files (includ- ing source code) for this project are availa- ble for download. If a standard PS/2 mouse is used, move- ments in the X and Y axes and the state Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 BitO Byte 1 const. 0 Mode Enable Scaling const. 0 centre button right button left button Byte 2 resolution Byte 3 data rate 080457 - 14 Figure 5 . Status register structure and content. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Byte 1 Byte 2 Byte 3 Figure 6. Data on movement and switch status. Y overflow X overflow Y sign bit X sign bit const. 1 centre button right button left button X movement Y movement 080457-15 elektor n-20og 7i of the left, right and middle buttons are reported. With certain non-standard PS/2 mice it is also possible to obtain the status of additional buttons and of a scroll wheel. In this project we ignore acknowledge bytes and the overflow bits in the mouse messages, and we do not check parity bits. Figure 8 shows the partial sup- port for PS/2 keyboards. In the log the first line shows the keyboard being reset followed by a ‘GetDe- vicelD’ command being issued. The ‘A’ key on the keyboard is then pressed and released. The R8C/13 program In ‘main’ the program runs in an infinite loop. On each pass through the loop the serial input buffer is checked for data. If a byte has been received from the PC a mouse command is issued. First ‘RequestToSendFlag’ is set by a call to ‘RequestToSend’. This func- tion holds the clock signal Low for at least 100 ps by disabling inter- rupts and configuring the port pin as an output. Then, after 100 ps, the data signal is taken Low and the clock signal taken High: inter- rupts are enabled and the port is configured as an input. Finally ‘RequestToSendFlag’ is cleared. Negative-going clock edges are detected via INT2. INT3 is used to detect the level of the data signal from the mouse when receiving data from it and to set the data signal to the appropriate level when transmitting. This behaviour is controlled by the subroutine ‘mClockLow(i)’, which can sup- port two mice or one mouse and one keyboard [3]. The byte coun- ter writes the number of received data bytes into the second byte of the transmit buffer. The first byte in this buffer indicates via a value of 1 or 2 that valid mouse data are available. If a negative-going edge is detected and no mouse command is being sent, then either a ‘hot plug’ event has occurred (Figure 6) or a data packet is being received in stream mode (Figure 7). Flag ‘ucModeFlag’ is used to control how the transmit buffer is filled with mouse data and with position data accumulated since the last external reset of the X and Y move- Figure 7 . ReadStreamData from a mouse captured on an oscilloscope (above) and in the VB Terminal program (below). £ <*-!*• - • - - n m y ? +■ wn.iin j H sl75j.»o H run* Lr.-S> Uy T-»J jam, an*- sj* - 0i 4 £1 rr-2T— r»l UIHIIQ 39 s»si 5 a * 1 u 1 a a l . II EjLpLltLE *■<- 1 .. . l.|* O-if.'tL *$l ** t- Dr . Li. Li Dill CLOliETCE LLL- -rail- (| bk-im# sit) imim uh "te! - (r pv*. Grt-L**. f-irtuv fcs* I] P* in'^Vf PuLin :) -Ni l-- m*i E*i firtLiiCi Sill -SiS Lit ’■JtttLI" 1 . 11*1 Dw-Iwf Tinrmr m l.lh "Pete" £| An rnTFjFr * f.nti Lpr ME LLA *E*fP 1, [P AF Cmipil BrcLbic r ita: i. L.-i hi LjIi Tt'Lt" - Q ts ZnLcgrL t'l-lir. nm-LLi-r KS LLL "Pis L ■ £| Aj Ipupir Gf-llae* Siii 1 ELl¥ 1 11 "lwr r fGriAi: *11 PicLui lit TCniCUlT LLb ■toci" (| 4 W SEIWEiPST'M LID Mml' [J Dl-.-Lr.Li rim L L 33 Tin: LEAD Lit 'ItiL" 1 J S 3 L'.'VJ phi- 1- Firvi i - r TlUTHCitfra F.ih "Tvi irr ■ || !.■ Lrap *« IH 4 TO* rlt< i+ytml L ■# DvcLuv iilj Itunn LlI- -Kcl" 1 Aj JJT ["mT Irt' |>* rsif ipiiEEi I ap*3ii«3 [ ' art CJiiKk. -i I' n .1 - x nil iihuii Em* ¥ - - ■ PUrcH n 0 til Ltw-Cpsi QWp Acqj-joar i'e* F« | 84 11-2009 elektor I Description Price each Qty. Total Order Code Complete practical measurement systems using a PC l £28.50 Practical Eco-Electrical Home Power System 1 ES3 { £24.90 Your own Eco-Electrical Home Power System ] i £16.50 Elektor Personal Organizer 2010 | ES3 i £24.90 310 Circuits £29.90 C# 2008 and .NET programming for Electronic Engineers £29.50 Free Elektor Catalogue 2009 Prices and item descriptions subject to change. The publishers reserve the right to change prices without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. Sub-total P&P Total paid Name Address + Post code Tel. Date Email Signature EL1 1 Yes, I am taking out an annual subscription to Elektor and receive a free 2GB MP3 player*. I would like: Standard Subscription (11 issues) _ Subscription-Plus (11 issues plus the Elektor Volume 2009 CD-ROM + exclusive access to www.elektor-plus.com) Offer available to Subscribers who have not held a subscription to Elektor during the last 12 months. Offer subject to availability. See reverse for rates and conditions. Name Address + Post code Tel. Date Email Signature EL1 1 METHOD OF PAYMENT (see reverse before ticking as appropriate) □ □ □ □ Bank transfer Cheque (UK-resident customers ONLY) Giro transfer Expiry date: Verification code: Please send this order form to* (see reverse for conditions) Elektor Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com sales@elektor.com *USA and Canada residents should use $ prices, and send the order form to: Elektor US PO Box 876 Peterborough NH 03458-0876 Phone: 603-924-9464 Fax: 603-924-9467 E-mail: custservus@elektor.com METHOD OF PAYMENT (see reverse before ticking as appropriate) □ □ □ □ Bank transfer Cheque (UK-resident customers ONLY) Giro transfer r» cnc-fcnp. .& ,Ydd irCdn? Expiry date: Verification code: Please send this order form to Elektor Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com subscriptions@elektor.com ORDERING INSTRUCTIONS, P&P CHARGES All orders, except for subscriptions (for which see below), must be sent BY POST or FAX to our Brentford address using the Order Form overleaf. Online ordering; www.elektor.com/shop Readers in the USA and Canada should send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Elektor US for applicable P&P charges. Please allow 4-6 weeks for delivery. Orders placed on our Brentford office must include P&P charges (Priority or Standard) as follows: Europe: £6.00 (Standard) or £7.00 (Priority) Outside Europe: £9.00 (Standard) or £11.00 (Priority) HOWTO PAY All orders must be accompanied by the full payment, including postage and packing charges as stated above or advised by Customer Services staff. Bank transfer into account no. 40209520 held by Elektor Electronics with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20. BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Giro transfer into account no. 34-152-3801, held by Elektor Electronics. Please do not send giro transfer/deposit forms directly to us, but instead use the National Giro postage paid envelope and send it to your National Giro Centre. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in this magazine. If difficulties in the supply of components are envisaged, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not guarantee this time scale for all orders. Returns Faulty goods or goods sent in error may be returned for replacement or refund, but not before obtaining our consent. All goods returned should be packed securely in a padded bag or box, enclosing a covering letter stating the dispatch note number. If the goods are returned because of a mistake on our part, we will refund the return postage. Damaged goods Claims for damaged goods must be received at our Brentford office within 10-days (UK); 14-days (Europe) or 21 -days (all other countries). Cancelled orders All cancelled orders will be subject to a 10% handling charge with a minimum charge of £5.00. Patents Patent protection may exist in respect of circuits, devices, components, and so on, described in our books and magazines. Elektor does not accept responsibility or liability for failing to identify such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, diskettes and software carriers published in our books and magazines (other than in third-party advertisements) are copyright and may not be reproduced or transmitted in any form or by any means, including photocopying and recording, in whole or in part, without the prior permission of Elektor in writing. Such written permission must also be obtained before any part of these publications is stored in a retrieval system of any nature. Notwithstanding the above, printed-circuit boards may be produced for private and personal use without prior permission. Limitation of liability Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in connexion with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser any money paid in respect of the goods. Law Any question relating to the supply of goods and services by Elektor shall be determined in all respects by the laws of England. January 2009 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION Standard Plus United Kingdom £49.00 £61.50 Surface Mail Rest of the World £63.00 £75.50 Airmail Rest of the World £79.00 £91 .50 USA £64.95 See www.elektor-usa.com Canada £75.95 for special offers HOWTO PAY Bank transfer into account no. 40209520 held by Elektor Electronics, with ABN-AMRO Bank, London. IBAN: GB35 ABNA 4050 3040 2095 20. BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Giro transfer into account no. 34-152-3801, held by Elektor Electronics Please do not send giro transfer/deposit forms directly to us, but instead use the National Giro postage paid envelope and send it to your National Giro Centre. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL- protected for your security. SUBSCRIPTION CONDITIONS The standard subscription order period is twelve months. If a permanent change of address during the subscription period means that copies have to be despatched by a more expensive service, no extra charge will be made. Conversely, no refund will be made, nor expiry date extended, if a change of address allows the use of a cheaper service. Student applications, which qualify for a 20% (twenty per cent) reduction in current rates, must be supported by evidence of stu- dentship signed by the head of the college, school or university faculty. A standard Student Subscription costs £39.20, a Student Subscription-Plus costs £51.70 (UK only). Please note that new subscriptions take about four weeks from receipt of order to become effective. Cancelled subscriptions will be subject to a charge of 25% (twenty-five per cent) of the full subscription price or £7.50, whichever is the higher, plus the cost of any issues already dispatched. Subsciptions cannot be cancelled after they have run for six months or more. January 2009 ElektorWheelie Elektor's DIY self-balancing vehicle Everyone agrees; the internal combustion engine is coming to the end of its life cycle. However you don't need to go to the expense of a Prius or Tesla to experience the future of transportation devices. If you would prefer something more personal (and don't mind turning a few heads) why not build the astonishing ElektorWheelie? First take two electric motors, two rechargeable batteries and two sensors, now add two microcontrollers and the ElektorWheelie is ready to transport you in style to your destination. ijlektor SHOP Ml Characteristics Two 500 W DC drive motors Two 1 2 V lead-acid AGM batteries, 9 Ah Two sixteen-inch wheels with pneumatic tyres H-bridge PWM motor control up to 25 A Automatic power off on dismount Maximum speed approx. 1 1 mph (1 8 km/h) Range approximately 5 miles (8 km) Weight approximately 35 kg The kit comprises two 500-watt DC drive motors, two 1 2-V lead-acid AGM batteries, two 1 6-inch ABS wheels, casing, control lever and assembled and tested control board with sensor board fitted on top. Art.# 090248-71 • £1380.00 • € 1599.00 • US$2275.00* Inch VAT, excl. shipping costs. Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 82614509 Further information and ordering at www.elektor.com/wheelie Index of Advertisers Antex Electronics Ltd APD, Showcase Avit Research, Showcase Beijing Draco Electronics Ltd Bitscope Designs Black Robotics, Showcase ByVac, Showcase Decibit Co. Ltd, Showcase Designer Systems, Showcase EasyDAQ, Showcase Easysync, Showcase Elnec, Showcase Eurocircuits First Technology Transfer Ltd, Showcase FlexiPanel Ltd, Showcase Future Technology Devices, Showcase Good Will Instruments Flameg, Showcase FlexWax Ltd, Showcase Labcenter www.antex.co.uk 47 www.apdanglia.org.uk 79 www.avitresearch.co.uk 78 www.ezpcb.com 73 www. bitscope. com 2 www.blackrobotics.com 78 www.byvac.com 78 www.decibit.com 78 www.designersystems.co.uk 78 www.easydag.biz 78 www.easysync.co.uk 78 www.elnec.com 78 www.eurocircuits.com 62 www.ftt.co.uk 78 www.flexipanel.com 78 www.ftdichip.com 41, 78 www.gwinstek.com 63 www.hameg.com 78 www.hexwax.com 78 www.labcenter.com 88 Lcdmod Kit, Showcase London Electronics College, Showcase MikroElektronika MQP Electronics, Showcase Netronics, Showcase Newbury Electronics Nurve Networks Parallax Peak Electronic Design Pico Quasar Electronics Robot Electronics, Showcase Robotiq, Showcase Showcase USB Instruments, Showcase Virtins Technology, Showcase www.lcdmodkit.com 78 www.lec.org.uk 78 www.mikroe.com 3 www.mgp.com 79 www.cananalyser.co.uk 79 www.newburyelectronics.co.uk 27 www.xgamestation.com 27 www.parallax.com 66 www.peakeiec.co.uk 27 www.picotech.com/scope1045 27 www.guasarelectronics.com 19 www.robot-electronics.co.uk 79 www.robotig.co.uk 79 78, 79 www. usb-instruments. com 79 www. virtins. com 79 Advertising space for the issue 17 December 2009 may be reserved not later than 17 November 2009 with Huson International Media - Cambridge House - Gogmore Lane - Chertsey, Surrey KT16 9AP - England - Telephone 01932 564 999 - Fax 01932 564 998 - e-mail: ros.elgar@husonmedia.com to whom all correspondence, copy instructions and artwork should be addressed. The latest version of the Proteus Design Suite harnesses the power of your computer’s graphics card to provide lightning fast performance. Together with unique transparency options it’s now easier than ever to navigate and understand large, multi-layer boards. PROTEUS DESIGN SUITE ■ Hardware Accelerated Performance. ■ Unique Thru-View™ Board Transparency. ■ Over 35k Schematic & PCB library parts. ■ Integrated Shape Based Auto-router. ■ Flexible Design Rule Management. ■ Polygonal and Split Power Plane Support. ■ Board Autoplacement & Gateswap Optimiser. ■ Direct CADCAM, ODB++ & PDF Output. ■ Integrated 3D Viewer with 3DS and DXF export. ■ Mixed Mode SPICE Simulation Engine. ■ Co-Simulation of PIC, AVR, 8051 and ARM7. ■ Direct Technical Support at no additional cost. All levels of the Proteus Design Suite include a world class, fully integrated shape-based autorouter at no additional cost - prices start from just £150 exc. VAT & delivery www.labcenter.com Electronics Labcenter Electronics Ltd. 53-55 Main Street, Grassington, North Yorks. BD23 5AA. Registered in England 4692454 Tel: +44 (0)1756 753440, Email: info@labcenter.com Visit our website or phone 01756 753440 for more details