www.elektorxom LET THE RULE! A 32-bit ARM7 fast prototyping system + Low power design for AVR applications + LED Mixer with DMX Interface + Linux on a chip + Parking Radar Ultra-compact ... MODULO D A full-fledged stereo amplifier QUASAR electronics fbe ftecfroo/c XW SpaoJfitffb Since 1993 Quasar Electronics Limited PO Box 6935, Bishops Stortford CM2 3 4WP. United Kingdom Tel: 01279 467799 Fax: 01279 267799 E-maN: sales@quasarelectromcs.com Web: www.quasarelectronics.com J ■ « -r I r — iii Postage & Packing Options (Up to G.5Kg grass weight): UK Standard 3-7 Day Delivery - £4.95. UK Mainland Next Day Delivery * £9.95, Europe (Eli) - £8 95; Rest of World £12 95 (up to Q.SKg) [Order online for reduced price UK Postage! We accept aH major credit/dehit cards. Make cheqnes/PO ; s payable to Quasar Electronics. Prices include 15.0% VAT. Please visit our online shop now for details of over SOD kits, projects, modules and publications. Discounts for bulk quantities. m >,■ .tv',’. V/SA Eltctran Mtreslw Motor Drivers/Controllers Here are just a few of our controller and driver modules for AC, DC, Unipolar/Bi polar stepper motors and servo motors. See website for full range and details. Computer Controlled / Standalone Unipo- lar Stepper Motor Driver Drives any 5-35Vdc 5, 6 or 8-lead unipolar stepper motor rated up to 6 Amps. Provides speed and direc- tion control. Operates in stand-alone or PC- controlled mode for CNC use. Connect up to six 3179 driver boards to a single parallel port. Board supply 9Vda PCB. 80x50mm. Kit Order Code: 3179KT - £15,95 Assembled Order Code: AS3179 - £22.95 Computer Controlled Bi-Polar Stepper Motor Driver Drive any 5-50Vdc. 5 Amp b i -polar stepper motor us- ing externally supplied 5V levels for STEP and DI- RECTION control. Opto- isolated inputs make it ideal for CNC applica- tions using a PC running suitable software. Board supply 8-3GVdc. PCB: 75x85mm, Kit Order Code: 3158KT - £23,95 Assembled Order Code: AS3158 - £33.95 Bi-Directional DC Motor Controller (v2) Controls the speed of most common DC motors (rated up to 32Vdc. 10A) in both the forward and re- verse direction. The range of control is from fully OFF to fully ON in both directions. The direction and speed are controlled using a single potentiometer. Screw terminal block for connections. Kit Order Code: 31 66v2KT - £22.95 Assembled Order Code: AS3166v2 - £32.95 DC Motor Speed Controller (1QQW7*5A) Control the speed of almost any common DC motor rated up to 100V/7 5A. Pulse width modulation output for maximum motor torque at all speeds. Supply: 5-15Vdc. Box supplied. Dimensions (mm): 6QWx10QLx60H, Kit Order Code: 3067KT - £17.95 Assembled Order Code: AS3067 - £24,95 Most items are available in kit form (KT suffix) or assembled and ready for use (AS prefix). Controllers & Loggers Here are just a few of the controller and data acquisition and control units we have. See website for full details. Suitable PSU for all units: Order Code PSU445 £7.95 8-Ch Serial Isolated I/O Relay Module Computer controlled 8- channel relay board 5A mams rated relay outputs. 4 isolated digital inputs. Useful in a variety of control and ^sensing applications. Con- trolled via serial port for programming (using our new Windows interface, terminal emula- tor or batch files). Includes plastic case 1 30x 1 0 0x30 m m . Po we r S u ppf y : 12VdC/50QmA. Kit Order Code: 3108KT - £64.95 Assembled Order Code: AS3108 - £79,95 Computer Temperature Data Logger 4-channel temperature log- ger for serial port. °C or °F. Continuously logs up to 4 separate sensors located 200m + from board. Wide range of tree software applications for stor- ing/using data. PCB just 45x45mm, Powered by PC Includes one DS1820 sensor Kit Order Code: 3145KT - £19.95 Assembled Order Code: AS3145 - £26*95 Additional DS1820 Sensors - £3,95 each Rolling Code 4-Channei UHF Remote State-ofThe-Art, High security 4 channels. Momentary or latching relay output, Range up to 40m. Up to 15 Tx's can be learnt by one Rx (kit in- cludes one Tx but more avail- able separately) 4 indicator LED 's. Rx: PCB 77x85mm, l2Vdc/6mA (standby). Two and Ten channel versions also available. Kit Order Code: 3180KT - £49.95 Assembled Order Code AS3180 - £59*95 DTMF Telephone Relay Switcher Call your phone num- ber using a DTMF phone from anywhere in the world and re- motely turn on/off any of the 4 relays as de- sired. User settable Security Password. Anti- Tamper, Rings to Answer, Auto Hang-up and Lockout. Includes plastic case, Not 6T ap- proved, 130x110x30mm. Power: 12Vdc. Kit Order Code: 3140KT - £74*95 Assembled Order Code: AS314Q - £89*95 Infrared RC Relay Board Individually control 12 on- board relays with included infrared remote control unit. T ogg le or m om enta ry 1 5 m + range. 112x122mm, Supply: 12Vdc/0.5A Kit Order Code: 3142KT - £59.95 Assembled Order Code: AS3142 - £69.95 New! 4-Channel Serial Port Temperature Monitor & Controller Relay Board 4 channel computer serial port temperature monitor and relay can- trailer with four inputs for Dallas DS18S2Q or DS18B20 digital ther- mometer sensors (£3 95 each Feu- = - rated relay channels prov de output ; : Relays are independent PCB-DIY All the Way V 1 machine end pick 8, place tooll L It’s clear that a good set of tools is required for PCB production and SMD component stuffing. With the Elektor stencil machine you get the solder paste accurately positioned, and the pick & place device is ideal for manual fitting of SMT compo- nents on circuit boards. _ Elektor Pick & Place Tool For manual fitting of SMT components on circuit boards * Adjustable anti-static arm rest for stable positioning of components * Anti static component storage system * Magnetic supports for PCB * Suction tool with different pickup needle sizes * Maintenance-free vacuum pump * Kit of parts for home assembly, with dear manual Elektor Stencil Machine Use a stencil for accurate applying of solder paste on circuit boards Accurate X, Y alignment of PCB frame For single and double side ^ single-sided populated RGBs Magnetic standoff supports for PCB Rapid and secure fixing of stencil Stencils do not need fixing holes Maintenance- free and robust aluminum frame Kit of parts for home assembly, amir ' Prices including VAf (EU destinations), excluding shipping. with clear manual 45(f x 300 k GO mm ] 5*5 kg £395.00 | US S 645*00 | €445,00 Further information and ordering at www.elektor.com/pcbtools Emn il: su bscri pi i ons^-'ef ektor.com Rales arid terms are given On the Subscription Order Form. Elektor Interna Lie rial Media b.v. P. O, Box 1 1 N L-Gi 14-ZG S u ster en The Nethe rid nds Telephone: (+31)464339444, fax: (+31)46437016] rJistiJbutJori] Seymour, 2 East Poultry Street, London ECiA, England Telephone: +44 307 429 4073 ,JK Advertising; Huson international Media, Cambridge House, Gogmore Lane. Cher tsey. Surrey KTiG 9A.P, England. Telephone: +44 1932 564999, Fax: +44 1932 564993 Ema il: r.elga rvIPhus onmedia . com internet: wvwv.h usonmcdia.com Advertising rates and terms available on request. Copy UyM Nuti • The circuits describee ' m ■ magazine are for domestic use only. All drawings, phutog-aphs, printed: circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software carriers and article p :: shed in our books and magazines (other than third-part , advertisements) are copyright Elektor International Media 2.; s~c -nsv not be repioduced or transmit' ted in any Form or b. am means, including, photocopying, scan- ning an recording t ■■ n part without prior written per- missi on from th e F . + so ■? - : h .vr it ten perm ission m ust a Iso be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may exisL in lespecL of circuits, devices, components etc, described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other piotecliou. The submission of designs or articles implies permission to the Publisher to alter the Lext and design, and to use the contents in other Elektor International Media publications and activities. The Publisher cannot guaran- tee to return any material submitted to them, Disi la inter Prices and descriptions of publication -related Items subject to change. Errors and omissions excluded. ■ 1 Elektor International Media b.v. 2009 Printed in the." ftl^rherigncte elektor 03-2010 7 NEWS & NEW PRODUCTS Low-cost, synchronous DC-DC regulator delivers up to 3 A in a 3mm 2 package Maxim Integrated Products introduces the MAXI 5041, a synchronous DC-DC converter with integrated MOSFETs in a small 3mm x 3mm package. The built- in MOSFETs offer higher efficiency (93%) than asynchronous solutions, while sim- plifying design and minimizing EML Capa- ble of delivering up to 3 A, the MAXI 5041 is ideally suited for a variety of point-of- load applications including telecom and networking equipment, as welt as low- cost consumer products. This device operates from a fixed 350 kHz PWM frequency and utilizes a peak-cur- rent-mode architecture to simplify compensation. This topology ensures excellent load transient response, thus enabling an all-ceramic-capacitor design. Other features include an enable input and power-good indicator. This converter also offers the ability to safely start up into a prebiased output. The MAXI 5041 operates from a 4.5 V to 28 V input voltage and provides ±1 % output-volt- age accuracy over temperature. Available in a space -saving, 3mm x 3mm, 1 6-pin TQFM package, the device is fully specified over the -40 degrees to +85 degrees Celsius extended temperature range. www.maxim-Ec.com/MAX15041 (091 076-X) 8-channel driver for ten 100mA LEDs with 3000:1 true colour PWM dimming Linear Technology's LT3760 is an 8-channel LED driver, utilizing a step-up DC/DC controller capable of driving up to a 45 V string of 1 00 mA LEDs per channel. Its internal 60 V, 1 MHz DC/DC boost mode controller is designed to operate as a constant current LED driver for up to 80 white LEDs, From a 1 2 V input, the LT3760 can drive 8 channels, each with up to ten 1 00 mA white LEDs in series while delivering efficiencies exceeding 92%, Its multichannel capability makes it ideal for medium and large-sized TFT-LCD back- lighting applications. Its input voltage range of 6 V to 40 V is ideal for automo- tive, avionic, HDTV and industrial display applications. The LT3760 offers ±2.0% (±0,7% typi- cal) LED current matching to ensure uni- form brightness of the display. Dimming ratios as high as 3,000:1 can bo attained by using True Color PWM m dimming. A programmable 1 00 kHz to 1 MHz fixed frequency operation and current mode architecture offers stable operation over a wide range of sup- ply and output voltages while minimizing the size of the external components. Addition- ally, the switching frequency is synch ronisabie to an external clock. Its thermally enhanced TSSOP-28 package offers a highly compact solution footprint for most LED backlighting applications. The LT3760EFE is available in a thermally enhanced 28-lead TSSOP package. An industrial grade version, the LT3760IFE is tested and guaranteed to operate from a -4G l? C to 1 25-C operating junction temperature. vwvw.linear.com (ogtoyS-X!) 300 V Trite Calm PWM'" Qiimhty UH-tO l&U OF LEIhPSfl > j . — LTUm Big, bigger, BIGAVR6 mlkroElektronika is proud to announce the B1CAVR6 Development System as an addition to its AVR development tool product line. The new BIGAVR6 supports 64 and 100- pin AVR devices (TQFP packaged) and gives designers an easy to use platform to try a multitude of designs. The B1CAVR6 includes new features such as: CAN Module, Serial EEPROM, RTC and many more. Each feature of the board Is supported by example written in mikroC PRO, mlkroPascal PRO and mikro Basic PRO compiler for AVR. Also, BICAVR6 comes with the full colour printed documentation. The system price is US$139.00 and it is available for purchase on the mlkroElektronika website and through authorised distributors. www.mikroe.com (091 103-1) ISP/JTAG programmer & boundary scan test platform Atomic Programming's new portable all-in- one solution is for In-System Programming (ISP) of both JTAC and non-jTAC devices. Boundary Scan Testing and out of system device programming. Available now, the AP-114 offers JTAG Programming, configuration and testing for all compatible devices. The supplied software supports STAPL, JAM, JBC and 5VF files. Universal support for non-JTAC devices is also provided and includes Serial Flash and EEPROMs, Altera EPCS and Xllinx configuration S PRO Ms and Atme! AVR microcontrollers. Optional Boundary Scan software provides a powerful but low cost JTAC test solution 8 03-2010 elektor NEWS & NEW PRODUCTS for production and debugging applications* Additional features include serial number handling, user and product log files for audit trails and a Netlist importer. Control is achieved through a fully flexible graphical user interface (GUI), which can also be easily integrated into a users own system software for even greater flexibility. The software runs on Windows 7, Vista, XP, Server 2003 and 2000. Other features include a Generic GDB Proxy server, and with an additional cable assembly and SDK, the AP-1 14 can be used to debug the Jenn ic JN 5 1 48 ZigBee Wi reless Microcontroller A training platform is also available and provides everything required to help understand JTAG Boundary scan testing and FPGA configuration and ISP programming, as welt as a development kit for Jennie ZigBee PRO applications. Manufactured in the UK, the programmer is RoHS compliant and CE approved and is powered from the USB Port Dimensions are 83 x 52 x 16 mm, and weight is 200 g (8 oz ). www.atomicprogramming.com (ogiio3-ll) Atmel MCUs feature integrated wireless interface At mel's new family of AVR wireless microcon- troller (MCU) devices is targeting wireless appli- cations such as ZigBee and IPv6/6LoWPAN.The ATmegallSRFAl is IEEE 802.15.4 compliant and combines At mel’s picoPower AVR MCU with a 2.4 GHz RF transceiver. Atmel's picoPower technology offers ultra- low power consumption to enable longer battery life for wareless ZigBee applications, including smart energy, building automa- tion, telecom and health care. The ATmeg- a128RFA1 is supported by AtmePs QTouch Library, making it easy to combine capaci- tive touch functionality with RF in a single chip. The ATmegal 28RFA1 combines AtmePs IEEE8Q2*! 5,4 2,4-GHz transceiver with an AVR MCU on a single chip. The single-chip design enables designers to save board space and reduce the overall system com- ponent count so savings can be passed on to customers. In addition, these devices include a low-power, high performance AVR MCU with embedded flash memory. Other key features Include a long-range, high performance RF transceiver to ensure a reliable wireless link and low current con- sumption for extended battery life. The MCUs in these devices can operate at low supply voltages without compromising per- formance. Finally, a wake-on-radio func- tion enables autonomous RF transmission and reception, further reducing power con- sum ption by keeping Trx R F active wh tie the microcontroller remains in sleep mode. www.atmel.com (091103-fll) Parallax Xbee USB adapters and modules The newXBee USB Adapter Board from Par- allax is compatible with any of their XBee RF modules, and provides a means to con- nect the XBee to a computer via a simple USB A to Mini-B cable. Once connected, this adapter board can be used to either config- ure the device using the X-CTU software available form Digi, or to use a computer to communicate with other XBee modules. The adapter retails at US$24,99* This board is kitted with two 10-pin sock- ets with 2 mm spacing which can be sol- dered to the PGB for easy mounting of the XBEE RF Module, Also included is one 40- pin header with 0,1" spacing which can be soldered to the PCB for easy accommoda- tion to a breadboard. Therefore, basic sol- dering knowledge and tools are required for this product, A non-USB version of the XBee Adapter Board (#32403) is also availa- ble, On the Parallax website, search for ‘USB Adapter' (32400), The new Digi XBee 802.1 5.4 modules pro- vide two friendly modes of communication - a simple serial method of transmit/receive ora framed mode providing advanced fea- tures. XBees are ready to use out of the pack- age, or they can be configured through the X-CTU utility or from your microcontroller. These modules can communicate point to point, from one point to a PC, or in a mesh network. And, all of the modules sold by Par- allax are compatible with one another! Choosing the right XBee module Is best accomplished by taking a look at the XBee Comparison Chart available on the Parallax website. You only need to choose an antenna style (chip or wi re) and power level ( 1 m W fo r up to 300 ft and 60 mW for up to 1 mile). Because the XBee modules have 2 mm pin spacing, it's recommend to use an adapter board for each module* The adapter boards available provide several advantages to the XBee modules such breadboard-friendly standard 0*1 -inch pin spacing, mounting holes, and easy-to-solder connections. Even if you are communicating point-to- point without a PC, you should always have at least one XBee USB Adapter Board (# 32400) so you can easily configure and test each XBee module prior to putting it In a point-to-point application* search for*X8ee' or 32404, 32405, 32406, 32407. The new modules retail at US$19.00 and US$32.00. www.Parallax.com (0911034V) elektor 03-2010 9 NEWS & NEW PRODUCTS Wolfson signs up Future Electronics as a global distribution partner OS RAM ORBEOS OLED launched by RS Wolfson Microelectronics recently signed a franchise agreement that makes Future Electronics its primary global distributor* The franchise agreement is effective immediately and Future Electronics is authorised to sell all Wolfson products globally: The new partnership with Future Electronics is part of a drive by Wolfson to widen its customer base and address the proliferation of audio and mixed-signal applications in consumer and industrial products. Andrew Bickley, Sales Director (Europe) at Wolfson, said: "High performance audio and mixed-signal semiconductor solutions are no longer only found in portable music players and hi-fis; they are being designed into hundreds of products, from TVs and set- top boxes, to mobile phones and mobile accessories, car infotainment, secu re-access systems and medical electronics devices* This broad base of potential customers needs the technical and logistical support of a top-ranking, global technical distributor, and that is why we have chosen to franchise Future Electronics* 51 Wolfson selected Future Electronics because of its expertise in technical sales, in par- ticular its teams of Field Applications Engineers in local branches across Europe, the Middle East* Africa (EMEA), the Americas and Asia; and its System Design Centres in Egham (UK) and Montreal (Canada), which provide design services and Future-Blox development boards to customers, and Asia which provides turn-key design services and proof of concept designs. In addition, Future Elec- tronics has proven capa- bility in tracking new designs across borders* Many of the consumer and industrial devices that use Wolfson devices are designed in EMEA or Morth America and man- ufactured in Asia. Cotin Weaving, Technical Sales Director at Future Electronics (EMEA), said: l This is a fantastically exciting new opportu- nity for Future Elec- tronics* Wolfson makes world-class products that offer market- leading performance in terms of sound quality and power efficiency. l We can see a huge amount of demand for products such as sili- con microphones, high- performance digital-to- audlo converters and low-power audio ICs.' Picture, left to right; Andy Keenan, VP of Marketing, Future Electronics (EMEA); Dan Casey, Managing Director, Future Electronics (EMEA); Mike Hickey, CEO, Wolfson Microelectronics; Andy Brannan, Chief Commercial Officer, Wolfson Microelectronics, www. wo I fso nm i c ro .co m www.f utu ree I ec tron ic s . co m ( o gi 1 03-V ) RS Components have effectively launched the new OSRAM ORBEOS OLED (Organic LED) lighting tile and the product is now available on RS websites. The ORBEOS is a new lighting tile ideally suited to designer luminaires, decorative lighting and mood lighting. Extremely thin and flat, with very low heat dissipation, OLEDs can be embedded into most materi- als with ease. With an instant on /off func- tion, plus high quality of fight, this ambient light can become an integral part of objects and architecture, rs WWW, co m elect run ic s www. osram-os.com (0911 03-V I ) Low cost, high performance ISM band RF modules at 2.4 GHz Radiocrafts AS have expanded their prod- uct line with two new modules, the low cost RC2500-RC232 and RC2500HP-RC232. These are multi-channel RF transceivers with embedded protocol, RC2500 is below US$10 in vol u me. RC2 500H P i nciudes a range exten- sion LIMA and lOOmW PA. The new modules have numerous applications in M2 M commu- nication, sensor and control networks. The module is a complete RF system solu- tion including a high performance multi- channel FSK radio transceiver and a packet protocol handler, with an easy-to-use UART interface. The embedded RC232™ protocol provides a point-to-multrpoint solution with individual addressing or broadcast, andCRC check for signal integrity* The module can also be used as a wireless RS232 / RS485 cable replacement. 10 03-2010 elektar NEWS & NEW PRODUCTS The com pact modules, measu ri ng only 12,7 x 25,4 x 3.3 mm. makes up a complete RF modem rn 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 produc- tion. it's small size and low power consump- tion makes it ideal for integration into size constrained battery operated equipment. The modules are based on a new very low cost platform, and have been developed for volume applications with a price target of less than U5S 1 0 at 50 k , The new modu les a re pin compatible with the RC 1 1 xO series giving the customer a complete range of replaceable modules at 433, 868. 91 5 and 2450 MHz, The RC25Q0-RC232 and RC250OHP-RC232 (set to 1 0 mW) are pre-tertified for opera- tion under the European radio regulations for license-free use. When used with quar- ter-wave antennas a line-of-sight range of 1000 and 3500 metres, respectively, can be achieved at low data rates. Both mod- ules are also designed for operation under the FCC regulations. Modules and Demo Kits arc available now. vvww. ra d iot ra fts .com ( 0911 03-VIJJ) Emitter antenna designer kit for automotive electronics Developers of automotive electronics applications could benefit from our emitter antenna designer kit This sample kit inte- grates different kind of antennas suitable for applications in Passive Keyless Entry Sys- tems, Keyless Go as well as immobilizers. The kit includes door handler antennas, trunk antennas, SMD emitter antennas, interior antennas and bumper antennas that have been developed with a frequency between 21 kHz, 1 25 kHz and 1 34,2 kHz and can operated In a temperature range between -40 -C to +85*C. These antennas are available in two ver- sions, overmoulded, with connector inte- grated in the enclosure to assure the IP67 requirements and mechanical robustness, and potting, with connector located out- side the assembly housing plastic base. Ail of them have been designed to meet the strictest qualification test (mechanical, thermal, waterproof, chemicals ...) and opti- mised to allow long reading distances in the smallest volume. The emitter antennas with frequencies of 125 kHz are included in Atmel development kits, NXP (345uH) and Austria Microsystems (KGEA-BFCR-B-0500J), Also, emitter anten- nas with frequencies of 1 34 kHz and 20 kHz, are included in Texas Instruments and Aus- tria Microsystems development kits, www, g ru po p rcm 0 . co m ( o 911 03 -I X ) UMJS/HSDPA modem supports 7.2 Mb/s download speed u-blox announces LUCY, a new family of high-speed wireless modules supporting the world's fastest globally adopted mobile communications standard. Based on UMTS/HSDPA, LUCY supports a wide range of M2M applications such as high- bandwidth multi media systems for mobile Internet and VoIP routing, in-car multimedia as well as streaming video for remote media panels and transfer of large data volumes for medical diagnostics, secu- rity and surveillance. LUCY supports tri-band UMTS/HSDPA and quad-band GSM/GPRS/EDGE class 1 2 with embedded TCP/IP stack and SSL client. A key feature of LUCY is its low idle-mode power consumption of less than 2 mA, and wide operating voltage, 3.2 to 4.5 V. The module includes an assisted GPS cli- ent for on- and offline telematics applica- tions, and comes in a compact 45 x 37.5 x 3 mm package with 60-pin board-to-board connector. The highly-integrated module supports both voice and data, and requires only an external antenna. Availability of samples and evaluation kit is announced as end of April, 2010 www.ublox.com (ogi-103-X) r — Prototype & small series PCB specialists EURO PCB proto STANDARD poof TECH pool IMS pool Ort demand Call us: 020 8816 7005 Email: euro@eurocircuits.com New website - new services dedicated prototype servirc widest choice 1-8 layers I0D pm technology metal-hacked PCBs all options tip to 16 tayfers ALL SERVICES Instant online pricing Instant online ordering Low pooling prices Deliveries from 2 days No tooling charges Stencil service www.eurocircuits.com elektor 03-2010 11 MICROCONTROLLERS & By Jens Nickel (Elektor Germany Editorial) Mention ‘open source" and your first thoughts are probably of a software application running on a PC. Developers of embedded systems should be aware that there is a wide range of open source programs, programming tools and hardware platforms now available. Not only do you save the cost of a user licence but the forums are an idea! learning resource. We asked some engineers which products they rated. Open source software offers a number of advantages: The product is independent of a particular manufacturer there are no licence costs and the product is usually of a high quality because it is often supported by a large and active comm un tty of users . When a program's source code is available it gives you the chance to fix any errors, change the behaviour of the program or even add new features. Providing the open source code is not too complex you will certainly learn a great deal from the experience. This alone should be a good reason for any designer of microcontroller applications to consider the advantages of using open source software. PC toots such as editors, documentation programs, toolchains (for the vast majority of microcontrollers), oper- ating systems and libraries are available in large numbers with open source code. We also need to mention the growing array of open source hardware including microcon- troller boards where the circuits, PCBs and CAD files are made available to the user who in turn is free to modify, improve or add more features for a particular application. Open source hardware is always supported by software code and libraries so that new- comers to the system can be up and run- ning very quickly. Any attempt to give meaningful overview of all the available open source resources would be doomed to failure in an article of this size; there is just too much material for so many different systems and platforms. Instead we asked four engineers to name the open source projects they had person- ally benefited from and would recommend. Maybe you too have had a good experience using these resources or maybe you feel we have overlooked a gem that deserves wider recognition, whatever the case please let us know. Hardware (suggestions by Clemens Valens, Elektor France Editorial) Arduino Th/s very popular platform offers a range of simple microcontroller and development boards (these can be purchased ready-built from some suppliers). The site has an active forum and the wide range of software exam- ples will ensure that you are up and running in minimum time . http://arduino.cc Licensin Although the use of open source software (OSS) indicates that there are no royalties or fees payable for their use there are only really a few programs which have no restrictions on how they are used. The majority of OSS has a license which controls how the program can be used. The most well known of these is the GNU General Public License (GPL). This quite strict licence allows you to modify or ex- pand the original program providing the modified program is also published with a GPL Included in this are any programs running in a GPL protected operating system or any programs which use a GPL library. Anyone planning to market an embedded project for com- mercial gain would do well to familiarise themselves with the finer details of the appropriate licenses, it may be prudent to seek special- ist legal advice before any commitment is signed and sealed. for purely evaluation purposes (or for hobby use) there are essential- ly no restrictions on use of the software. In any case it is necessary to make reference to the copyright and licence in the source code, A good overview can be found on t he Open Source Initiative (QSI) Website: www. opensource, org / lice nses/alphabeticaf . 12 03-2010 elektor MICROCONTROLLERS Openmoko Nothing less than a complete software stack for a smart phone is the open source project being developed here. The Neo FreeRunner mobile phone is the target hardware plat- form , . Development and debug boards are also available. www, open moko.org GNU Radio & Universal Software Radio Peripheral The GNU Radio project is a software toolkit to produce a software defined radio. The open source hardware for this project is the USRP- Board (Universal Software Radio Peripheral) which is based on an FPGA . www. gn u radio.org KiCAD This is one of the best known suites of CAD programs for hardware production. Tools for generating circuit diagrams and PCBs are all included. 3D representations of the finished board can also be viewed. http; //kicad.sourceforge. net/wiki/index.php Fab Lab Very interesting and unusual this project offers 3D laser cutters , 3D printers and other machines for general usage by the public. In open source tradition details of objects made become pubtidy accessible. Very useful for making robot parts and art objects. http://fab.cba, mit.edu Libraries & run time tools (suggestions by Benedikt Sauter, www.ixbat.de) ulP/lwlP Two outstanding network stacks , the first is for 8- bit microcontrollers , IwiP is a develop- ment of the first and more suited to medium sized controllers. The ulP licence is not so strict allowing the stack to be used in commercial products . www.sics.se/~adam/uip www. 5ics.se/~adam/lwip / LUFA (formally MyUSB) A large library of applications for interfacing (both Host and Device) USB enabled AVR con- trollers. The demonstration applications allow on AVR controller for example to emulate a keyboard and many other devices (moss stor- age device, audio I/O etc.) wwwiourwalfedcubtcle.com/LUFA.php USB stack for LPC2148 ARM fans should take a look at the USB library here , Written for the Philips LPC2148 which has an ARM7 compatible core. http://wikisikken,r»l/fnctex.php7title=LPCUSB Crypto-avr-lib A library of optimised cryptographic routines for the ATmega controller. Issued under the GPL Version 3, licence. Contact the author for other types of licence . http://www.das-labor.org/wiki/ AVR-CryptoUb/en FreeRTOS FreeRTOS is a lightweight Real Time kerne I which can run on many control ter families, it can be used in commercial applications and allows the use of closed-source software , www.Freerios.org A list of many more Open Source operating systems can be found elsewhere in this magazine! U-Boat Universal bootloader with a large range of routines for memory. UART interface , 5D cord, network and USB etc. Conceived originally as a bootloader but now through comprehensive hardware support can be used as the basis of a C code module . www.denx.de/wiki/U-Boot FabCentral Mgn Twh . software ■ ({Kiwi&nil lin* * * X rtWHVit * HD -JtiiiiCi ■ Drr>j' 3 fri.TlT:^ * ji’PW' pi l.i : K flilt tli- CUnHISfiUI £ trend Is ind aMcrocMTtFUSeiT * d*ctronk parts * AMtgr.iftg PCBs * fiftg PCSs from Estfl* to 1 1 jd.pv - ■ j‘ : ! ,■ : H C e: vinyl cutte; modela . -..wtnr i jm- 4s s'Js9> wb «mf worsts iTrilti i-^ [!■* f flbJfP. m JkVTt in-system «ner | HP \ t i: v v ju-i (Kurd [O IM ETOfltpUtCr c omprlrnfi; and Lfihudin? progr aim . input 4 Walk'd Cubicle LUFA | Formerly MyUSB? i2QG9 1 u iM" llriH' "itf***.* M* ' "(I tvn-trS*-. M* Ei* . -L ^lwl i tf I >. SS * in, i r» !r- ivll ••if mm*3 .T*.:*.. ■. , .* • ...... i, ...h .-Jr- -r » •«' t i -"i.Kr-1# ■KC'Wn» Wy*-~ ’• ii l-kh "M =snt.»*> rm :■ -!r» L it ‘ ■a, L ii *v t -.zvi,. .. ■ riiurct h, *7 MWi ■ fl I 111 | l Mil - r| 1 #llfeOT#K#ittU - ihvtiti r-B -.x i >■ “"Xfan &*-■ fc-Bir-.Ti - l^TkiCOOt - *i-+r i ■« ■ Hfl f • “"i till Feature?. LtIP: TCP/IP for 8-bit-Controlfer - with well documented code. .NET Micro Framework: Open Source from Microsoft. Kdevelop; Automatic code completion and much more (photo: kdevebp.org). Embedded Filesystems Library A very useful (FAT-) file format, when you are short of memory. The GPL licence includes a clause allowing static linking to the library without public disclosure of your code . http://efs1.be .NET Micro Framework Now open source this very compact, t rimmed - down MET Framework running on diverse ARM platforms. Programmable using the object ori- entated C variant C#; lots of resources includ- ing support for !2C, Ethernet and many more. Flelps reduce development time , www. m i c rosof t . co m / n c t m f / default, m s px PC tools (suggestions by Antoine Authierand Jerry Jacobs, Elektor Labs) Eclipse This is a good deveiopment environment. It has a modular structure which mokes it very easy to configure. There are around LOGO plug-in modules (both open source and commercial) for a range of program languages and target systems. See also the Elektor article in Octo- ber 2006, www.edipse.org wwW.elektor.com/06001 8 Kdevelop Kdevelop is an integrated deveiopment envi- ronment which should satisfy most power-user needs. Runs in MS Windows, Mac OsX, Linux f Solaris and FreeBSD . Plug-in expandable, www.kdevelop.org Programmer's Notepad A lightweight but efficient editor for writing source code. Allows fast, simple and comfort- able program production . Con be expanded with plug-ins. www. p n o te po d . org D oxygen An intelligent tool which can automatically generate code documentation (C, C++ java etc,). The programmer provides tags in the source file ; Doxygen generates the comprehen- sive documentation in PDF or HTML format it can also extract the code structure from undocumented source files. www, stack.nl/ ~dimTtri / d oxyg e n WinMerge A good tool for code comparison and code synchronisation . The program can also com- pare the contents of folders/ files and display the results in a visual text format that makes it easy to understand. h ttp : / / wi n m e rg e.o rg / TeraTerm A terminal program to access COM ports t supports Telnet communication Proto- col . A debugging tool to eavesdrop on serial communications. http :/ / i tssh 2. sou reef orge.jp GNU Too I chains Toolchains for GNU projects are available most processor architectures AVR, Coldfire , ARM t MIPS, PowerPC and Intel x86. The GNU -tool - chain includes not only compilers for C, C++ and in most cases also java (GCC - GNU Com- piler Collection), but also Linkers, Assemblers and Debuggers together with C libraries (Hbc = C library). The tools are used from within other open source projects like WinAVR which gives a familiar user interface to speed program development . GNU Compiler Collection: http://gcc.gnu.org WinAVR: http:// winavr.so urceforge, net Yet another GNU ARM toolchain: www.yagarto.de (091033) £ tatoto 1_* • hto ■■■ jsdaii Imhb IUbIi togfkb ™ t 1 2 t S^L" ■ 1 if.ui | i rh=J O DKhrii.rxjhMi 1 G»l jTVPIbJEI a. ti.rtrnj BWU Miia l Jm « U ■ I WNlHtelu Proyr.inun^[ ’' a f-lotPpAfl 1 LUlhsi/WI i j, 1 j-KB KH L5f>wnl&iKi 4^ Frw < ±j.-- i«Li r-i !b«> _ FfaHli "h -i ■ ■ 1 :.H*rr tf-MuhBi! rr*#iin« :3BB * 4 - 'ItBIBS ■ .■■I 1 rr,. : —■ 1 pjir ■„ I u^. 1 v. v,j .i, ~ j v ’ 1 i-’d.d^.ti ? .. .j'- a.* y--' pWirt) m#i m t nlC— * tr :> *f . ■ j.> '' 1 [d.v m pr^ . cr-mvara. . -r,»IV . k .,l j. u mm id i. r n^Kpij 1 . eh 4. 1 , ”hi E_k_h*. vi ^ ■ ■ " inn ,i±v;i nil ■ vj- ’■-i.V! , . Itli- . *■ rill. W •! lintel I.IWI ■WI » -J |r — H h ifniri ri 1 ifn i 1 .: 1 1 3 -r.il "i , H 5 ” - - ' i i 1 i j - H(1 .1 " .m <,Mr> T.i ton . . i . T"- r. t.TiM '-‘d'^l'-T i.kii ta im 1 iipi*^ . : ■>: rri" .3 Knnrii^ r -f * - i . m.*.. u Eclipse: Powerful software development environment with 1 000 plug-ins. Programmer’s Notepad: Regular expressions, Unicode and other features. WinAVR: Compiler, Debugger, Programmer - everything For AVR developers. 14 03-2010 elektor Schaeffer FRONT PANELS & HOUSINGS Cost-effective single units and small production runs Customized front panels can be designed effortlessly with the Front Panel Designer. The Front Panel Designer is available free on the Internet or on CD. ■ automatic price calculation - delivery in 5-8 days * 24 -Hour-Service if required F f rrrr Sample price; 32,50 € plus VAT/shipptng Schaeffer AG ■ Nahnutzer Damm 32 ■ D-12277 Berlin - Tel +49 (0)30 SC38636 0 Fax +49 (0)30 B05B6 95-33 • Web mfo@scbaeffer-ag.de - www.schaeffer-ag.de WWW. elektor. com S 8-Bit Main PCB Board'. amepad Controller. Page Printed Manual.- lel AVR ISP MKII Programmer, y Power Supply & A/V Cable. *C Serial Port to XGS Converter PC DVD-ROM. IGB Micro SD Card + Adapter 4 Bonus: eBooks on Hardware, ' |Ga me Console Design, and More! The new PicoScope 4000 Series high-resolution oscilloscopes 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. * PGbased - 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 Bandwidth Buffer Size Sample Rate Channels 12 bits (up to 16 bits with resolution enhancement) 20 MHz (for oscillscope and spectrum modes) 32 M samples shared between active channels 80 MS/s maximum PicoScope 4224: 2 channels PicoScope 4424: 4 channels USB 2.0 Tr igge r Types Ri si ng ed(ge, fa! I ing edge , edge with hysteresis, pulse width, runt pulse, drop out, windowed Connection www.picotech.com/scope1 059 01480 396395 - * — . .. 11 ** 1 . . * 4 ■ - i t * i h- ■ f * ; «£ *■ - W « # | . ii 4 a elektor 03-2010 1 EMBEDDED OPERATING SYSTEMS Linux on a chip By jerry Jacobs (Elektor Labs) & Thijs Beckers (Elektor Netherlands Editorial) Linux on a chip is much more common than you might think, it’s very likely that your ADSL modem or router makes use of it. And the same applies to that advanced Smartphone in your pocket that uses Google Android. In this article we’ll show you how you can quickly get started with Embedded Linux yourself. In this article we make use of a nanoUAB board made by Linux-in-a- Box [1 1. The processor on this board is an AT91 RM920O ARM micro- controller On board we find a 10/ 100Mbit Ethernet controller, a serial port and an audio DAC. The board also contains 16 MBytes FPROM flash and 32 MBytes RAM. This board is perfect for beginners because it comes with excellent documentation and has Embedded Linux 121 pre-in stalled so that you can get started right away. Booting After applying power to the board, the boot loader starts with ini- tialising the hardware. The boot loader then loads the kernel. One function of the kernel is to act as an interface between the applica- tion software and the underlying hardware. It is started when the boot loader jumps to the location in RAM where the kernel has been loaded. You can follow the progress of the boot loader and kernel via the serial port (see Figure 1 ). As you can see, the boot loader displays some kernel parameters, such as the MAC address, an IP address and the directory from which the rest of the applications are loaded. We used a system with Ubuntu Linux 131 as the host system and ran a terminal emulator to start an interactive session with the nano- UAB board. In this session you can pass on commands to the board and change its settings. The interactive session occurs via the serial port. On the Ubuntu machine you run the command 'cu -fjdev/ttySO -s 1 15200\ which creates a connection via serial port ttySO (this is the Linux equivalent of the COM I port found in a Windows-based system). When the board is connected to a different serial port the ‘ttySO 3 should be replaced with the corresponding serial port to which the board is connected. If the serial port you’re using was created via a USB adapter, you should use the name l ttyUSB* fol- lowed by the port number. Installation In theory it is possible to modify the firmware and to transfer the data via the serial interface to the flash memory of the board. To do this we would first have to convert the binary image into ASCII (uueneode), because the transfer via the serial port is text-based. However, since the board already comes installed with a stable working system and all compiled applications function correctly, we saw no need to modify the firmware. Applications In Listing 1 is an example of how easy it is to write a 'program' by creating a small script for a console application. The script can be transferred from the computer to the board via an ftp program (the board has an ftp running). Keep in mind that the transferred files end up in the working memory rather than the flash memory. When the power is removed the program will therefore disappear. Using the command tar -c led_countei.tar /ed counter.sh the script is put inside a tar archive on the PC to make sure the line endings are correct. When the serial session has completed the transfer of the archive to the board it can be unstuffed on-board with the com- jerry @ ubuntu: - fC~l raTfXfl File Edit view Jenminal Meip — o LIAS Bootloader o p Release; 1.0, April 18, 20Q7 at 13:52 by root Copyright LIAB ApS, GZIP inage no. 1 found at addr 8 x 00020000 Filenaefte vmlinux.bin Times tarup : Apr 13 11: 51; SI 2087 UTC Bootloader; now putting Linux boot tags at 2Q0Q0100 Starting Linux kernel . . . Linux version 2.6.16 (root^sa) CD1.'EINT1.'EDA1 pa l&ttll-ElKTf.'ADI a HI. tMiHTft'M ATB.i,-CAP0.3 Pfl 17,'CAPl^SCKl.WATI.i FD. l&'CAPl.l'l.llSDUMATVD FD. ! S ■'. l ATI ? T.IOSI ! iC AP 1.2 Fn.2C,WAT1.3l3SEL1.'EINF:i PG.?ll,lPW«5lA01 MAPI .3 PU.Z2.'AI>i ttCAPU.a-MATO.Q W.SNflUfc Pl.ai.'THBT Pt 3IVTU3 Pt fJFTCX P1.3B.Tm P1.2?miQ P1Jj&rtt7CR PL2S.T XTINQ Pi J4/TRACECLK Pt.231OT£STAT3 Pi 22> - P*PES7AT1 Pr.ilWPESTATd ^l.ai'rRACES’fNC PI.13.TRACEFKT] Pl.l aTPAGEPKn PI 1 7'THAC-E PKT1 PI 15.T RACE PKTO POJ^ADQ.iiAqifT 0* D- FG.2H.AEK> l/CAFD.Zl'MA 1 E.2 Fn2G.'4.BC2.EIAP33*MATC.3 Ft? SinAOO.S-ei'MTJ.'CAPC- 0 P0.31OIP U:P.CO«NECT U CA cA 5 5 5 LPCZliSFODM UTACi R1HC2 J?T*U XTAL2 4 ui u> y7 r sr 12Mtti = I I VE:-.T / - , VREF \ PI IS « p 1 'll'- ^ 545 SO i" ^ PI. 2 ' ^ 24 1 PI 2 i ^ » P. EE N 33 Pl J 4 ^ X \ Pt» Pt 2 ?^ 44 Pi 21 ^ PI 2C- ^ 4 FI IS ^ P 1 !! ’N 1 ? PI . 57 ^ If PI .16 ^ \ 9 PC2S 10 D. ’ Sl n ^ i 3 pc n ^ 1 4 PGZ 9 ^ 15 P 53 S ^ 1 1 push ^ ♦3V3 © rhefffMJfnetef E m 25 1 1A2 6 K 91 42 DO DS- iCl 2 H | H 1 H pi H @ ♦ Of 020 Cl t CIS 4—1 !2p 4 ?2p 100 tsp 5 nci 1 DSIBBZQZ +3V3 © T tii 1 vcc IC3 MR RST L M3 724 .ayoe QNO GND R IS 1 RE5FI S '* Reset Circuit Figure 3. The full circuit diagram of the Sceptre. It’s a bit big, 22 03-2010 elektor MICROCONTROLLERS +3V DNEG 15 15 27 23 213 vcc 3V30UT RESET vecio CBUM CBUS1 1C5 TKQ C8U92 RJCD CBUU CT3 CBUfU OCD FT132HL OSR U5BDM RF >.?FLHDF WTS OTft OfrCI Used TEST gnd CMC GND AGND IB 21 17 zu? [5~^T J 1 10 3 f 3 i » Sen's/ OTSP /oferfsce IBP TX ISM PO.Ci ■\ I <-J U ■ JP2 tap AH' tflftl -QD JFla Mil R1-0 "Hin-c]i> JP1£ ME SET through it in detail, but confine ourselves to a few comments: First the power supply. The board can be powered from a battery or via the USB port. USB powering takes priority, and is also used for charging the battery. The MAXI 551 It is a Li-ion battery charger with just five pins* The device detects If a voltage is available on one of its two inputs (we're only using one of them}. In order to minimize the volts drop when the board is being powered from the bat- tery, the circuit used to switch between the 5 V rails from the USB port and the bat- tery (D9, T4 and T5) is a bit more compli- cated than the two diodes usually found in this type of circuit. Naturally, the aim is to make the battery last as long as possible. The voltage from the battery or USB port is then converted to 3.3 V by the MAX7 1 0. This operates down to 1 .8 V, so we can dis- charge the battery quite along way. Cheaper, ready-made PMIC (Power Man- agement Integrated Circuit) devices do exist offering all the functions described above and more. But the problem is that these PMICs only exist in QFN packages, or worse still, BGA— in short, packages we have sought to avoid at all costs. — Double Footprint SluOlQOth Circuit SO 23 23 2T ■ yPIQS id Pirj'.- 2 b 24 33 32 11 » 13 ia 15 3VS Vi Rf m 11 pioft PIOO PIO& pioi p»m 0 Plda AJKM PI03 AHJ1 FIDi RESET PHJ5 SPI iilBG "■105 SPI.CS-B WCtf SM.CLK 0‘iti DM SPI Mtftl USB DP UART GTS PCM Cl* UART TJ ! PCM IN UANT .RTS POM .SVNC UART UK PCM out pjon BTM.T12 GNO GM12 END 17 T — I >□!: pvCc vcc AK51 V2 T * rf m ! akji TO10 FIDO PM11 pidi SPr.MISO l»10£ GPl &.K PIOl SPI C5E P104 SPI UDSI PtOi UflRT CTg p:o6 UART RTS PiG7 UART TK Pioa UART.RK PI03 PCM CLK fTOEIT PCM OUT UEF CM PCM IN us a □ P PCJU SVNC BTM,2?£ CNO QUO nur: c.m gho gno 17 a ANTENNA # KS ■ f ’ rri * JC! T_ © k ■■ ■ 11 v ■■ 12 11 ^ 2b IQ v P0„* g B ^ "is 7 y f-c ■ 5 V 1 J \ ■•'d.e 3 ^ 0.31 2 1 2V Uh H~ FT -ly UART CTSV 27 w 21 35 ■pa y S\ T\JPEO PC 1 1 3b pti. a p.,JPi? pd.b 3 b '■'.Mr Ig/ \pir4 K9 u K1Q V»1.1E 11 T •• ; .. 13 t 3 V 3 £\JJL kPUM^ 11 ^ PO It ID \ ■ g g \ 7 \ P 3 : : 5 \ FOU 5 4 \ [ fJtifi - j DPOS j GI059* ■ 13 owing to the number of components, but there's nothing terribly complicated about it. There are two USB port on the board, but only one socket. Two jumpers let you choose which of the two ports will be entitled to use the on-board socket. In the event that you need to use both ports at the same time, it's possible to connect a USB socket for ICS to the expansion port KID. ICS is provided first and foremost for programming the board via USB, Le. during the development phase. Once the application is finished, it is possible to disconnect it and free up four I/Os. The 1C is powered solely from the USB 5 V rail and so doesn’t drain the battery power. Solder bridges J PI 5 and JP16 can make programming a little more convenient by allowing automatic switching between the programming mode and the microcon- troller's normal operating mode. Without these bridges, each time you want to pro- gram the board, you have to fit JP1, press the reset button, program the microcon- troller, remove J PI , and press the reset but- ton again, which can become a pain after a while. elektor 03-2010 23 MICROCONTROLLERS Figure 4. Configuring Flash Magic. The communications parameters are the most important ones. For programming, the serial port speed must not be above 38,400 baud. For the terminal, you can choose a higher speed. LED D4 is intended as an indicator that the microcontroller's USB port is connected, but there’s nothing stopping you using it for something else. In this event, remember to remove R1 6 if the microcontroller's USB port has to operate at the same time. To save power, the SD card reader and the Bluetooth module are switched using tran- sistors (T2 and T3 respectively). The board has two positions for a Blue- tooth module, one for a Class 1 module (BTM-222), the other fora Class 2 module (BTM-1 12). Once again, the reason is the board's power consumption, A Gass 1 mod- ule (100 m, 300 ft) draws significantly more than a Class 2 mod ule ( 1 0 m , 3 0 ft). The little V network C8, L2, and C9 has Figure 5. Options -> Advanced Options...: Checking this box enables Flash Magic to put the Sceptre in programming mode and reboot without your having to do anything. been provided in case the impedance of the Bluetooth module’s RF output needs to be matched to the aerial. In most cases, this network isn’t required, and L2 can simply be replaced by a wire link or 0 Cl resistor. A 31 mm length of wire will do as an aerial, but it's possible to fit an edge-type SMA connector to the board. That way, you can screw a ‘WiFi’ aerial onto the board — now there's class for you! The suggested Bluetooth modules require just two wires (RX and TX) for communicat- ing with the microcontroller. The RTS and CTS signals are however available (well, you never know,,,) and they can be connected together if necessary via JP9. The 3-axis accelerometer IC2 can be put into standby in order to limit power consump- tion. Its sensitivity can be altered using two jumpers. It is least sensitive when they are not fitted. See the data sheet for further details. The thermometer only uses power when you actually talk to it. It’s a good little device. Lastly, jumpers JP6 and JP7 let you choose the voltage sources for V, r . (required by the real-time clock) and V f (needed for the CNA). Development environment Programming a microcontroller requires tools, and that’s often where things get complicated. Not for the Sceptre, as the development tools were part of the original specifications: they must be free and multi- platform, The advantage of the ARM core as used by Sceptre is that there are actu- ally several free compilation chains based on CCC (GNU Compiler Collection G) which operate under Linux, Mac, and Windows. We’ve opted fora collection of tools that is beginning to get a bit dated now, but which is really easy to install and includes every- thing you need to get going right away. The drawback is that It only operates under Windows. We’re referring to the Win ARM distribution [4 k a big file that you’ll have to unzip after downloading it This distribution includes the compiler, the link editor, a spe- cial text editor for programming, a tool for flashing the microcontroller, and lots more besides. Of course, just because we happened to choose WinARM doesn't mean you have to do the same. Ail the source codes developed for the Sceptre ought to compile using any C/C++ compiler that can produce executa- bles for the LPC214S, Another reason for staying with Windows Is the Flash Magic' 51 flash took Even though WinARM does include Its own flash tool (IpcZItsp), Flash magic, which is free for private use, Is user-friendly and helps avoid finger trouble. This tool also incorporates a serial port terminal, very handy for debug- ging. A serial port is often used during pro- gram development to send messages about whether the program is working correctly or not. Flashing the microcontroller requires a serial port too; by using the same port for both these tasks, we can make do with just a single cable between the computer and the Sceptre. Flash Magic avoids conflicts between the flash tool and the terminal, as they can't be enabled at the same time. So it's impossible to forget to free off the serial port each time you want to reprogram the microcontroller — Flash Magic takes are of everything. It seems that Flash Magic works under Linux and MAC OS X in the WINE Windows emu- lator 16 !. For the sake of completeness, IpcZlisp also includes a terminal, but in order to use it, you have to use the same communication speed for flashing and debugging, as they can’t be specified individually. Installation So installing the Win ARM -based develop- ment environment is child’s play. Down- load the latest distribution w (currently ver- sion 20060606, we haven't yet tried the beta version 2008033 1 ) and unzip the file o nto your hard drive. Ad d the foil owi ng line to the Windows pathname (assuming you have unzipped the file to the C drive root directory): C:\WinARM\bin;C:\WinARM\utils\bin; This step is not obligatory, you can also enter it at a command prompt or put it into a batch file (.bat) that you run each time you start a Sceptre programming session, like this: 2 4 03-2010 elektor MICROCONTROLLERS path = %path% ; C : \WinARM\ : n; C: \HinARM\utils\bin -s Win ARM knows everything . ou need, installation is now com- plete. You can test your installation dv compiling one of the examples n eluded in WinARM, which can be found here (for the LPC2148): , . inARM\examples\lpc213x_ Ipc214x_examples\ r or greater convenience, we recom- mend you also install Flash Magic (which replaces the LPC2000 Flash Util- sion 2.12, To do the same thing using the IpcZI Isp, you’ll need to use the following command: lpc21isp -detectonly - control main. hex com4 384Q0 12000 You need to enter a HEX file, even if there isn't one. As identification, you should get: Synchronizing. OK Read boot code version: 2 . 12.0 Read part ID : LPC2148, 512 ity, now obsolete), This application is constantly being updated to add new processors, so download and install the most recent version. Then con- figure the tool for Sceptre as shown in Figure 4, selecting the correct COM port. The options in Step 4 only slow programming down, so it’s up to you to see if you want to use them or not. You may not yet have installed the drivers for the Sceptre's serial port via USB, This port uses a standard FTDI chip, and you can fi nd the driv- ers on 1 ® 1 (VCR drivers). If you don’t know i f you ' ve a Iready got the d riv- ers or not, connect the Sceptre up to your computer and your operat- ing system (OS) will tell you. Modern OSs are able to find and install the correct driver all by themselves. To check the communication between the Sceptre and the computer, it's worth try- Using Sceptre, you’re in control! kiB ROM / 40 kiE SRAM (67305253) ing to detect the microcontroller, if the advanced options are correct (Figure 5) , using Flash Magic this is achieved by the command “ISP -> Read Device Signa- ture...". If everything is alright, you'll get the ID 0x0402 FF2 5 and the bootloader ver- The last number is decimal for 0x0402 FF25 t the number found by Flash Magic. To be continued... Experienced readers will now be able to set about developing applications for the Sceptre, You can already download frorrd 2J the first version of the C/C++ library we're i n the process of developin g . Although still far from finished, this library is going to contain functions for quickly developing an applica- tion based on the Sceptre. Readers in less of a hurry may pre- fer to wait till next month to find out how to implement the Sceptre in detail. See you soonl ( 090559 - 1 ) [ 1 ] arduino.ee [2 1 www.elektor.com/ 090 5 59 [3 1 gcc.gnu.org HI www.si wawi.arubi, u n f-kl ,de/avr_projects/a rm_prcjects ! -v. i na rm j 5 1 www. flash mag ict oo L e o rn / [6] www.wfnehq.org/ [7] www.pnolepad.org |8) www.ftdichip.com elektor 03-2010 25 By Folker Stange (Germany) ir mplifie I control, adjustal gnal levels, and an output power h a single 12-V supply volt age. Th it or motor home. 20 W (Class es it perfect * 2 x 20 W continuous output power with 4-n loudspeakers * remotely controlled bass, treble, volume, and preset signal level * can be used with RCs-compatible remote control transmitters * all functions digitally controlled by an ATmegaS microcontroller * operating status displayed on a three-line 1 C display with 20 characters per line * stereo input on Cinch sockets * auxiliary input on a pin header (selectable under software control) * display board with IR receiver can easily be fitted separately using a to- way flat cable * expansion port for extensions, such as an MP3 player or manual control * open-source firmware enables individual extensions for specific application areas * extremely compact because no heat sink is necessary * dimensions {module without enclosure): 65 * 40 x 35 mm {23 x 1.6 x 1.4 Inch) * efficiency up to 93% * operating voltage range 11-14 V * can be used with an onboard vehicle electrical network or an inexpensive 12-V power supply (4 A min.) The required Installation space is very small thanks to the extremely compact construction. This Is primarily made possible by the very high efficiency of the PWM output stage (up to 94%), which reduces the complexity of the circuit and minimises the cooling footprint. Weighing only 150 grams (5.3oz.), this audio amplifier module essentially consists of two application-specific ICs and an inexpensive ATmegaS microcontroller, which handles the control functions of the Class D amplifier The only thing smalt about this Class D amplifier module is its size. With a meas- ured output power of 2 x 20 W, it features not only an amazing amount of power but also a rich set of features. With two sets of stereo inputs, configurable settings for volume, tone {treble and bass) and sensi- tivity, an infrared receiver for RC5 remote control, a backlit LC display, and down- loadable firmware with source code and hex files, it can serve as a versatile basis for your own projects. The heart of the amplifier is a IVlaxim MAX9744, whose high efficiency has already been mentioned, tt requires only a small number of external components. The ‘filterless' spread-spec- trum modulation of this 1C reduces or mit- igates the effects of noise emissions from the loudspeaker cables (a typical prob- lem with Class D amplifiers) thanks to the flatter and broader noise spectrum. The 26 03-2010 elektor AUDIO & VIDEO K11 Maitfrfl SYNC K1 Figure 1. Schematic diagram of the microcontroller card, which In addition to the Atmel microcontroller holds the preamplifier 1C with two selectable stereo Inputs, which is controlled via the PC interface. Figure 2 . Block diagram of the STMIcroelectronics TDA7449 digitally controlled preamplifier 1C. tiny MAX9744 has the potential to fun- damentally change the process of DIY audio amplifier construction. The usual approach to building a final amplifier is to first find a suitable heat sink, which effectively determines the enclosure dimensions. After this, cooling methods are devised, along with preventive meas- ures in case the ambient temperature rises higher than expected. All this is unneces- sary with the MAX9744, which can deliver a total output power of 44 W without any need fora heat sink, despite its tiny 10- mm 2 QFN44 package size. Trinity The circuitry of the amplifier module Is divided over three PCBs {Figure 6), which are arranged In a stack as shown in the photos. The amplifier input connectors are located on the rearmost PCB. As can seen from the schematic diagram for this PCB (Figure 1 ) t the Cinch sockets are connected to the preamplifier 1C, a TDA7449 (IC6). As you can see from the block diagram of this 1C in Figure 2 taken from its data sheet PI, It is a complete stereo preamplifier with two selectable inputs, Input level control, vol- ume and tone controls (treble and bass}, and output level control. All of these func- tions are configured digitally via the l 2 t bus port (pins 18,19 and 20), The input signal level (gain) control allows the sensitivity of the amplifier to be adjusted to match the signal source — including via the remote control interface with our design. The out- put level controls are used to adjust the stereo balance. elektor 03-2010 ^7 Measured performance figures from the Elektor lab The following figures were measured using the Modulo D prototype: Output power (80, 1 kHz, 10% THD) 10W(V S -12V) 13,5W(V S =14V) Output power (4 £2, 1 kHz. 1 0% THD) 1 6,5 W (V s - 1 2 V) 22 W (V s *= 14 V) THD+N 0.08% (SO, 1 W) 0.12%(4a 1 W) Input sensitivity 3 5 mV (at maxim urn gain setts ng) (8 a 13.5 W, 10% THD, V s = 14 V) 1 . 1 2 V (at minimum gain setting Lower cut-off frequency (-3 dB) 27 Hz Tone adjustment range Bass: +8.1 dB / ~8.5 dB Treble: +1 3.4 dB / -1 3.5 dB Efficiency (22 W / 4 Si) 79 % Quiescent current consumption 1 1 0 mA Maximum current consumption 4 A at 2 x 22 W output power The lone control characteristic curves show the frequency response with the control set to minimum, midrange and maximum, in each case with the other control set to midrange. The second plot shows the distortion (THD) as a function of frequen* cy. The distortion was measured at 1 W with a 4 Q. load (green curve) and an 8 Q. load (blue curve). The reason for the increased distortion level at low frequencies is not clear. According to the data sheet, the Class D amplifier 1C is not the cause. We found that the distortion level In this region is dependent on the setting of the gain control. The distortion is slightly higher (0.2 to 0.3%) with the lowest gain setting and a 1 -V input signal level The plotted curve was measured using a 300-mV input signal level with a correspondingly higher gain setting. The distortion at 1 kHz with 1 W output power is the lowest with this setting, but the distortion in the low-frequency range is twice as high as with the lowest gain setting. Ton Giesberts This PCB also holds the ATmegaS micro- controller. which handles all the control tasks of the amplifier module. It processes the signals from the IR receiver, converts them into corresponding l 2 t signals for the preamplifier, and provides the opera- tional status Indications on the LC display, A single signal line runs from the micro- controller (pin 1 1 ) via K1 1 and K1 to the PCB holding the final amplifier, whose schematic diagram is shown in Figure 3. There it is connected to the Sync Input of the MAX9744, which selects the operate ing mode for PWM modulation (fixed fre- quency or spread-spectrum modulation). The external circuitry of the MAX9744 is just as straightforward as its block diagram (Figure 4), To enable this 1C to handle the currents needed to supply such a high level of output power relative to its small dimen- sions, several leads of the 1C are wired in parallel. High-capacitance electrolytic capacitors (1000 pF) next to the 1C buffer power peaks. Wide PCB traces for the sup- ply rails are necessary due to the high cur- rent levels. Even small deviations from the manufacturer's specifications can easily cause enormous problems with a project of this sort. Consequently, the layout is suit- ably robust. The LC networks at the loud- speaker outputs of the 1C are designed for operation in ‘filterless Class D“ mode. They provide adequate attenuation of harmonic emissions for speaker leads up to around 1 metre (3 ft.) in length. For even stronger attenuation or operation in fixed-frequency PWM mode, you can take the values of the filter components from a table in the 1C data sheet E 2 h 28 03-2010 elektor The middle PCB also holds the power sup- ply. The external supply voltage connected to K4. with a range of 1 1 to 1 4 V, is reduced to 9 V for the TDA7449 by ICS and further red uced by IC3 to 3 .3 V for the input stages of the MAX9744 and the ATmega8. D1 pro- vides protection against reverse polarity and overvoltage. This leaves the circuitry on the front PCB (Figure 5}, which holds the Lt display and the IR receiver. They operate from a 5-V sup- ply voltage provided by an on-board volt- age regulator (IC1 ). The voltage regulator receives its input voltage (9 V) from the underlying final amplifier board via K1 5. This voltage is also connected via resistor R5 to anode pin A1 of the backlight LEDs, which are wired in series via pins A 2 and Cl . The backlight is switched on or off by T1 , which is driven by the microcontroller. For this pur- pose. R6 is connected to pin 14 of 1C7 via K15, K2, K1 and K11, The output signal of the JR receiver also reaches the microcon- troller via the same series of connectors. DIY construction projects with SMD com- ponents are inherently more difficult than projects using leaded components. Although it doesn't take long to learn how to work with SMD components, fitting the MAX9744 forms a challenge even for expe- rienced hot-air soldering specialists. To solve this problem, the PCBs in the parts kit available from the Elektor Shop PI have the SMD components pre fitted and tested. As a result, assembly is limited to fitting the con- ventional components and the mechanical assembly. The display board snaps onto standoffs fit- ted to the final amplifier board. If necessary, the display board with the IR receiver can be fitted separately from the rest of the mod- ule, connected by a flat cable with a length up to 80 mm (3.1 in,). The final amplifier and microcontroller boards are joined by socket headers and pins (see Figures 7 and S). Matching 10-way socket headers are located on the Class D amplifier board and the microcontroller board. To link them together, extract the pins from a 20-way pin header and plug them into the socket head- figure 3. Schematic diagram of the Class D power amplifier using the MAX9744, which is fitted on the middle PCB of the amplifier module. 3MT0 3SV 45V TO 14V 030563-15 Figure 4. Block diagram of the MAX9744. The PWM operating mode is selected by the logic level on the Sync pin. elektor 03-2010 59 1C1 +5V Figure 5. Schematic diagram of the display board, which also holds the IR receiver for remote control. ers. This arrangement provides a secure con- nection between the boards, along with the right spacing. A standard audio input can be connected to the Cinch sockets, while the power source and loudspeaker leads can be secured to the generously dimensioned ter- minal blocks. On the rear side of the microcontroller board, connectors for the expansion port (K7), the programming interface (KS and K9), and the second stereo input (K 1 2) can be fitted as necessary using the optional pin or socket headers. The expansion port (K7) can be used to add buttons for volume con- trol, muting, and tone control (bass and tre- ble), although this has not yet been imple- mented in the software. COMPONENT LIST Resistors R7 = 0a(SMD0603) R26,R27,R28,R29 - 10.0 (SMD0603) R17,R18 = 22n(SMD0603) R5 = 1 00£1 (SMD0603) R22.R23 = 180(1(SMD0603) R1 5.R16 = 2.2HQ (SMD0603) R6.R8 = 4.7kfi (SMD0603) R9,R10.R19,R20,R21 ,R22,R24,R25 = 10k£i (SMD0603) R1,R2,K3,R4 = 20 kit (SMD0503) R1 1 . R12.R13.R14 = 47kQ (SMD0603) inductors 11 ,L2,L3,L4,L5 “ VHP choke (6rhoie ferrite bead) Capacitors C44, C45 = 22pF (SMD0603) C20.C2 1 ,C22,C23 = 470pF (SMD0603) C33.C34 = 5.6nf (SMD0603) C3,C4,C5,C6,C17,C1 8,C19,C41 .C42.C43, C46.C48 = 1 0OnF (SMD0603) C35.C38 = 150nF (5MD0603) C3G.C39 = 330nF (SMD0603) C29.C30,C40,C50,C51 ,C52 = 470nF (0603} Cl ,C2,C7,C9,C1 0.C1 3.C1 4.C1 5.C24.C25.C26, C27,C28,C31 .C32 = lpf (SMD0603) C37.C47.C49 = lOgF 16V (SMD tantalum ease style 8) C8 = lOOpF 16V radial Cl 1.02 = 1000pF 16V radial Semiconductors □ 1 = P6SMB16A(SMB) T1 = BC847 (SOT23) IC1 =78105(508) IC2 = TSOP34836 IC3 = LD1 1 1 7-3V3 (SMD SOT223) IC4 = MAX9744 (MI.F44) !C5 = 78M09 (DPAK) IC6 - TDA7449 (DIL20) IC7 = AT M EGAS- 1 6 (TQFP32) (programmed) XI - 8MHz quartz crystal (HC49U-V) Miscellaneous LCD1 = EA DOCM 1 63 with backlight K1 . K3, K10, K1 1 = 10-pin receptacle, straight, lead pitch 2.54mm (0.1 ”), h = 8.5mm K2 = 10-way Rateable, I - 140mm (5,5") K4.K5.K6 = clamp connector SPRINGCON 6- way lead pitch 5,0mm (0.2") K7 = expansion port (optional) 1(8, K9 = ISP Programming connector for MegaS, 6-pin (2x3) (optional) 1(13,1(14 = Cinch socket, PCB mount, lead pitch 7.5mm (0.3") 4 plastic PCB standoffs, 1= 4.8mm (0.18”) 20-pin pinheader Kit of parts with SMD prestuffed boards and ali parts, Efektor Shop # 090563-7 1 , see www.elektor.com/090563 PCR design (.pdf); free down load from www.elektor.corn/090563 0J0.0.0, Figure 6. The three RGBs assembled in a stack: display board, final amplifier board and microcontroller board. 30 03-2010 elektor Figure 7. The Modulo D from various angles. The software for the ATmega was devel- oped using WinAVR GCC and is available for download as commented source code, so you can adapt the firmware to suit your personal wishes and requirements. The compiled software (hex file) is available for download from the Elektor website f 3 i and the author's website f 4 l in two versions according to the desired operating mode of the MAX9744. You should normally use the hex file ClassDVOI .GOFilterless.hex, which configures the amplifier 1C to oper- ate with spread-spectrum modulation of the PWM signal. The initialisation routine max9 744init(MAX9 744_FILTERLE5S); is called to initialise this operating mode. For operation in PWM output mode with fixed-frequency operation, rnainx calls the MAX9744 initialisation routine mox9744init(MAX9744_PWM);. The down- loadable hex file for this operating mode is called ClassDVOI .OOPWM.hex. If you use this version of the firmware, you must also fit the PCS with loudspeaker output filter components having the values specified for this operating mode on the 1C data sheet. The hex file can be loaded directly into the microcontroller using a programmer, such as the one described in f 5 l A screen dump included in, the zipped download file shows the essential fuse settings for this. The microcontroller In the parts kit is prefitted and pre-programmed (using ClassDVO 1 .OOFilterless.hex). The pro- grammed ATmegag initialises the MAX9744 and the TDA7449, processes the received Figure 8. The final amplifier and microcontroller boards are joined by socket headers and pins. elektor 03-2010 31 www . elektor. cgpi Figure 9- This welcome message appears after the module is switched on. IR commands, and controls the LC display. The software responds to RC5 remote con- trol signals. The relationship between RC5 device addresses and RC5 commands is defined in main»h. It's a good idea to first connect the Modu- lo D to a power supply with current limiting set to approximately 200 mA p and with no loudspeaker connected. The current com sumption under these conditions should be around 1 20 mA. The display should first show the welcome message (Figure 9) P fol- lowed around 5 seconds later by the volume setting (Figure 10). After this you can quickly check whether the module responds to commands from an RCB-compatible remote control unit The following button arrangement is present on a universal RC5 remote control unit: loud- S* lilW' Figure 1 0. The volume setting is shown around five seconds after the welcome message. Other settings are shown below. ness = Volume + and bass = 1 and 4 P tre- ble - 3 and 6 P and gain - Fast Forward and Rewind, If you do not have a suitable remote con- trol unit available, you can still checkout the amplifier module since the volume is set by default to around 35% instead of zero. If you connect a loudspeaker, you should certainly be able to hear something after connecting a line-level signal to the Cinch input. When connecting the loudspeaker, pay attention to the recommended maximum length of the loudspeaker cable (approximately 1 metre or 3 feet with the standard output filter; see also the MAX9744 data sheet). As can be seen from the performance fig- ures measured in the Elektor lab. the maxi- mum rated power of 2 x 22 W is only possi- ble with 4-Q loudspea kers and a 1 4-V supply voltage. This can be obtained from a well- charged 1 2-V car battery oral 4-V power supply with a rated current capacity of 5 A. A 1 2-V power su pply rated at 4 A is sufficient for a slightly lower power level The individual output stages of the MAX9744 operate in bridge configuration, so it is not possible to connect a loudspeaker between the Rand L outputs to obtain twice as much power in monophonic mode. The compact construction of this module allows it to be used in applications that are otherwise difficult to handle, such as in models, iPod stations, or a portable ghetto blaster with a gel-cell battery. Other options include using the expansion port to inte- grate an MP3 player or other signal source. With this arrangement, there’s nothing stopping you from enjoying your personal MP3 collection at full blast (090563) [1 1 www.st.com/stonline/products/litera- ture/ds/6317.pdf [21 http://datasheet 5 .maxim-ic.com/en/ds/ MAX9744.pdf [3] www . e le kto r. co m / 090 5 63 4] wvv, stange-distribution.de !5; v vww. elektor. com/08008 3 3 2 03-2010 elektor Digi XBee 802,15.4 modules The Digi XBee 802* 1 5*4 modules are the easiest-to-use, most reliable and cost-effective RF devices weVe experienced. XBee modules provide two friendly modes of communication - a simple serial method of transmit/receive or a framed mode providing advanced features. XBees are ready to use out of the package, or they can be configured through the X-CTU utility or , from your microcontroller, These modules can communicate point to point, from one point to a PC, or in a mesh network. ***** Milford Instruments www, iiiifinst.com Span vent wwwsp/nvent.co,uk www.paraUaxxom Friendly microcontrollers, legendary resources Power LvL 2 mW 2 mW 60 mW 60 mW Antenna Chip Wire Chip Wire Stock Code #32404 #12405 #22406 #32407 PIC Cookbook for Virtual Instrumentation Several case studies included The software simulation of gauges, control-knobs, meters and indicators which behave just like real hardware components on a PCs screen is known as virtual instrumentation. In this book, the Delphi program is used to create these mimics and PIC based external sensors are connected via a USB/RS232 converter communication link to a PC. Several case studies of virtual instru- ments are detailed including a compass, an oscilloscope, a digital and analogue thermometer, a FFT-based Frequency analyser, a joystick, mouse-control panels and virtual displays for cars and aircraft. Full source code examples are provided both for several different PIC's, both in assembler and C, together with the Pascal code for the Delphi programs which use different 3rd party Delphi virtual components. 264 pages ■ J5BIU 978-G 905705-S4-2 £29.50 - USS47.G0 Elektor Reyns Brentford 1 000 Great West Road Brentford TWS 9HH United Kingdom Tel. +44 20 8261 4509 k j gatwww.ele elektor 03-2010 33 MICROCONTROLLERS LED Mixer with DMX Interface By Dirk Gehrke and Walter Nttzoid (Germany) The DMX512-A system has long since become established in the stage lighting world. This standard is also being used more and more for lighting systems in buildings. The DMX LED lamp controller described here uses a Tl MSP430 microcontroller to support DMX bus communication and generate PWM control signals for three power LED drivers. The DMX address can be set using DIP switches. DMX512, which is also known as DMX or DMX512/199G* is a digital control proto- col. It defines a serial data communica- tion interface between controllers, lighting equipment and lighting accessories* DMX is based on the RS485 interface, which is commonly used in the industrial world and provides high noise immunity thanks to its differential data transmission mode. This interface can be used to connect a control- ler to one or more receivers, with practical upper limit of 455 m (1 ,500 ft) for the bus length, although the theoretical upper limit is 1 km (3,000 ft}. The data rate is typically 250 kbit/s, with data being transferred in packets having a maximum of size of 513 bytes. This combination of data rate and packet size allows a repetition rate of 44 Hz with the largest packet size. As suggested by the name of the standard, up to 51 2 chan- nels can be controlled individually, with each channel having a resolution of 8 bits, A max- imum of 32 receivers can be connected in series in a single segment (daisy chain con- figuration). Repeaters must be connected between the segments If it is necessary to implement a configuration with more than 32 receivers. Each daisy-chain segment must be terminated by a 1 2(M2 resistor to avoid signal reflections. There are certain recommendations regarding the cabling to be used, although they are not always fol- lowed in practice. The cables are connected to the equipment or interconnected by 5- way or 3-way XLR connectors. In contrast to audio equipment used in stage setups, the transmitter of a DMX sys- tem is fitted with a female XLR connector and the receivers are fitted with male XLR connectors. LED wal [washer A wallwasher is a strip lightthat illuminates a wall from below or above. In the project described here, the strip light consists of one or more narrow PCBs fitted with three 350-mA power LEDs. Several of these PCBs can be connected in series* 34 03-2010 elektor MICROCONTROLLERS For this application, we have designed a three-channel DMX512-A receiver that processes the DMX512-A signal and com- pares it with an address set by a DIP switch. The receiver generates three 8-bit PWM signals that control constant-current driver stages. As can be seen from the block diagram in Figure 1 , the key component here is an MSP430 microcontroller, which receives a logic-level signal via an RS485 receiver !C As already mentioned, the specification says that 5-way XIR connectors should be used by preference, but 3-way connectors are most often used in practice. Conse- quently, the adapter board for connecting the DMX cable (see the schematic diagram in Figure 2) Is designed for 3-way XLR con- nectors (male and female). Operating power is provided by a standard AC power adapter, which supplies 1 2 VDC at 1 A and is connected to J1 (DC power socket) on the adapter board. All three constant- current sources on the main board (see the schematic diagram in Figure 3} oper- ate directly from this power source. Linear voltage regulator U8 (a TPS7 1 550) provides a 5-V supply voltage for the RS485 1C (U9). Table 1 , JTAG to DMX board adapter pinout MSP430JTAG connector pins DMX512-A receiver board connector pins NC [ 9 j 2 1 1 | 3 ] 7 4 4~" r 5 j J NC j 6 i^C = not connected A series resistor (R25) and Zener diode (D4) reduce the 5-V supply voltage to 3.3 V for the MSP430F2274. MSP430 circuitry The 3.3-V supply voltage is connected to the AVcc and DVcc pins, with decoupling capacitors wired between these pins and ground. A pull-up resistor on the Reset pin ora Reset signal on the programming adapter Reset lead ensures controlled start- up in stand-alone or programming mode. Spare port lines for potential extensions are fed out to pin headers J3 and J4. This gives the user access to an additional commu- nication module (UC1 ), three analogue to digital converter inputs (AO, AT and A2), or optionally eight parallel I/O port pins. Due to the narrow PCB shape, the Spy-by- Wire interface was chosen for device pro- gramming, This Interface needs only a small number of lines, while still providing full programming and debug capability. As a result, we managed to achieve desired slender form factor for fitting to an alumin- ium profile and managed to do without a 1 4- way J TAG connector. However, this means that you will have to assemble an adapter for connection between a 14-way JTAG connector and a 6- way Mill - Max con nector for on-board board programming. The pin assignments of this adapter are listed in Table 1. A means for assigning a specific DMX frame address to the board (receiver) is necessary. This takes the form of a DIP switch fitted! on the board, which allows the address to be set using binary coding. Constant cur- rent sources LJT U5 and U7 can be ena- bled or disabled by the Enable signal from Figure 1 . Block diagram of the three-channel DMX receiver and LED driver. J3 elektor 03-2010 Figure 2. Schematic diagram of the adapterboard for the DMX receive rand AC powerline adapter cable connections. 35 MICROCONTROLLERS *av3 Figure 3. Complete schematic diagram of the D MX 51 2- A three-channel receiver. port P2 A One USG module (UCO) of the MSP430 ts used to receive the DMX signal. The DMX bus signal conforms to the RS485 standard, but the USG module can only process RS232 signal, so signal conversion is necessary. A type SN65HVD3082E level converter (U9) is used for this purpose. Timer modules A and B of the MSP43QF2274 are used to generate the variable PWM signals that control the constant-current sources U1 , U5 and U7. Using software. It is possible to generate up to three PWM signal using only two timer modules (see the L RGB LED Mood Lighting' article in the February 2008 issue of Elektor). Constant-current sources The three constant-current sources are implemented using synchronous downcon- verter ICs with integrated power switches (type TPS621 10). Figure 4 shows the cir- cuit diagram of one source built around U1 . Thanks to the high switching frequency of 1 MHz, the external components are rel- atively small - coil LI has an inductance of 6.8 uH, while each of the two output capacitors connected in parallel (C4 and C5) Is rated at 22 pF. The power stage can switch a peak current of 2.4 A, which allows power LEDs with rated continuous operat- ing currents up to 1 .5 A to be used. With the Indicated component values, the circuit described here is configured fora current of only 350 mA. This circuit can operate over an input voltage range of 5 to 1 7 V. Downconverter U1 is configured as a con- stant-current source instead of a voltage regulator. In place of a voltage divider, a sense resistor is used to produce a volt- age drop that is proportional to the current through the resistor As the switching con- verter needs a feedback signal of 1 ,1 35 V at the input of the error amplifier for proper regulation, the power dissipation of sense resistor R5 would be rather high because a resistance of 3.3 Q would be necessary with a constant current of 350 mA, or 0.8 Cl with a constant current of 1 .5 A. The corre- sponding power dissipation would be 0.4 W or 1 .7 W. A bit of circuit magic is employed here to reduce the power dissipation of resistor R5. An external reference voltage is used to apply a small bias voltage to the error amplifier input, so that the voltage drop across resistor R5 can be reduced by the amount of the bias voltage. Resistor R5 has a resistance of 0.51 Cl the circuit shown in Figure 2, which produces a voltage drop of 179 mV at 350 m A and results in only 63 mW of power dissipation in the resistor. The value of R5 can be reduced for use with a higher current. The drawback of this solution is that it degrades the regulation accuracy, which causes the operating point (setpoint cur- rent) to shift in response to a step change in the load. With a resistance of 0,51 Ofor R5, the accuracy is 1 0% at 500 mA, 5% at 1 A, and 2% at 2 A. Seethe inset for a description of how to determine the component values for different operating currents. As the TPS621 10 has a rated maximum output voltage of 1 7 V, it is also possible to connect two or more LEDs in series. If you do this, bear in mind that the sum of the for ard voltage drops of the LEDs and the co stage drop over R5 must be less than the nput voltage of the voltage converter 1C.. In add: : on. output capacitors C4 and C5 must 36 03-2010 elektor MICROCONTROLLERS have rated operating voltages correspond- ing to the higher output voltage. Three constant-current sources with iden- tical component values are implemented here with U1 , US and U7 in order to drive three power LEDs (red, green and blue). Software Program execution is divided into two phases. In the first phase the modules of the MSP430 are initialised, after which the pro- gram enters the second phase where it can receive and process DMX signals according to the DMX protocol. The initialised modules include timers A and B for generating the PWM signals, parallel port 1 for reading the device address for comparison with the DMX frame, and U5CI module UGQ for receiving the DMX data. In addition, calibration data stored in the data memory of the MSP430 is used to configure the clock module for a system clock rate of 3 MHz. The timers are operated in continuous mode and docked directly by the main clock sig- nal The output units of the timers are used here to generate the PWM signals. They can produce PWM signals without any involve- ment of the CPU until the microcontroller enters Low Power Mode 3. the design: pin PI .3 TA2 was accidentally routed to pin header J4 i nstea d of Dl P switch 5W1 , which causes gaps in the DMX address range. This error can be worked around by using the following formula: Address for comparison with DMX frame = DIP switch value + 8 x (DIP switch value DIV 8) where DIV is an integer division operation. If you configure an address using the DIP switch, you can use the formula to deter- mine which slot of the DMX frame the unit will process. To make things easier for novices, the download file for this project includes a table of switch settings. The binary values listed in the table can be set directly on the DIP switch. If you correct this error when fitting SW1 during PCB assem- Current source component values After determining the desired operating current for the circuit shown in Figure 2 (such as 350 mA) and choosing a value for R5, you can calculate the values of the resistor network (K2 and R3). This always involves a trade-off between regulation accuracy and power dis- sipation in R5, The accuracy increases as the voltage drop across R5 increases, but this also causes higher power dissipation. The following calculations are based on a design value of 1 mA for the current through the voltage divider. V seilse = I LED x R5 = 350mA x 510m — l79mV V liy = V F8 - = L 1 53 V - 0. 1 79 V = 0. 974 V 974 mV R3 = — ^ = — = 974 Q -> selected: 887 Q ] mA 1 mA V R2 = V REF - V FB = 2.5V - i . 1 53V= 1 .347V The ports used here must also be initialised for proper operation of the interface to the peripheral devices. Forthls purpose, Periph- eral Module mode is selected for the timer and USC1 ports is selected. The DIP switch is connected to port 1 for address entry, so this port must be configured as an input in Parallel Port mode. A special feature here is that no external pull-up or pull-down resis- tors are necessary because the M5P430 has integrated resistors in the input stages of the ports. To reduce power consumption, all unused port pins are configured as out- puts. This sets them to a fixed voltage level, which avoids the risk of short-circuit condi- tions due to floating inputs. The DIP switch works with binary coding. The desired address in digital form must therefore be converted into binary form, which can be done with any scientific or engineering pocket calculator. Here you have to take into account a small error in imA 1.347 V ImA = 1.347k -> selected: 1 33 kn Figure 4. A constant-current source using aTPS621 TO. elektor 03-2010 37 MICROCONTROLLERS bly, you can ignore this formula for dealing with the gaps in the address range. The USCI module must be configured prop- erly to receive the DMX signal The most important configuration parameter here is the baud rate. The DMX standard spec- ifies a baud rate of 250 kbit/s. With a sys- tem dock rate of 8 MHz, this can easily be obtained by setting the division factor of the baud rate generator clock divider to 32 (8 MHz* 250 kHz), Modulation is not necessary because the desired clock rate can be obtained using integer division. The MSP430 is synchronised to the DMX frame boundary by searching for the occurrence of a Break error in the DMX data stream. For proper processing of the signal, reception of Faulty characters must be enabled in the USCI module. Figure 5, State machine flow chart. Figure 6 . Adapter board fitted with XLR connectors and a power connector. After all the initiation activities are com- pleted, the timers are started and the MSP430 is put into tPMO mode, it awakes from this mode only when a new character is received. When this happens, the MSP430 must first synchronise to the start of the DMX frame. This is done by utilising the fact that a Break error occurs at the end of each frame when the transmitter sends a ‘Space for Break', which according to the standard must have a minimum duration of 88 us. This error is indicated by the USCI module when the next character is received, which allows the software to interpret this charac- ter as the start of the next frame. Each time a character is received, the con- tents of the U5G status and data registers are stored in variables so they can be proc- essed by a state machine or used for other purposes. The first action is to check the first value in Slot 0, which is called the Start Code. If it is zero, data reception can continue because this is the ID code for dimmer applications. The DMX frame data address set in the DIP switch is read in, and the state machine a dvances to the next state. Now the received slot count is decremented and compared with the read-in address. When the first dimmer channel is reached, the value for this channel and the values for the two subsequent channels are stored in an array. After all the values have been received, the 3.8 03-2010 etektor MICROCONTROLLERS About the authors Dirk Gehrke, who holds a Dipl. Ing. degree, was born m / . . i Westphalia, Germany) and studied communication engine e - ~Q at the Technical University of Dortmund, in 1998 he joined Texas n- struments, where he has worked as a field application engineer (FAE) in England, France, the USA. and most recently In Germany (Freis- ing). Since 2006 he has held the position of Europe. Middle East and Africa (EMEA) Business Development Manager for analogue prod- ucts at TJ 5 s Freising site. Contact; www.Lixom/europe/csc Walter NitzoJd has been studying Electrical Engineering since 2005 at HTKW Leipzig (Leipzig College of Technology, Economics and Cul- ture), specialising in communication technology. During his course of study, he completed a practical training stage in the ! ield Applica- tion Engineering department of Texas Instruments In Freising, where he worked with the MSP430. This was followed by an appointment :o Leipzig Research and Transfer Centre, where he concentrated on software development for the M5P43Q. Since April 2009 he has been working on his graduation project In the field of mobile communica- tion, Walter also holds a scholarship from the Karl Kolle Foundation. ■■ mm \ ■■ill ■ -B 1 ■ ■■ m.m ■ ■ | i » ■ -fe * ■ Figure 7. DMX receiver PCB. timer registers can be updated. Here it is important to ensure that the registers are updated only when a timer overflow occurs, as otherwise asynchronous write operations to the registers would cause the LEDs to flicker. In the case of timer R, this synchro- nous updating Is a built-in function of the module and is configured during device ini- tialisation, for tinier A, the interrupt serv- ice routine for the timer overflow must be used for this purpose. To this end, the most recent value for the PWM channel associ- ated with timer A is stored temporarily in a variable and the interrupt enable flag is set for the overflow. When the interrupt occurs, the timer register can be updated synchro- nously to the overflow inside the interrupt service routine. The actual values that are written to the TxCCRs registers when an overflow occurs are not the same as the values read from the DMX frame. Here the program uses three arrays with 256 entries each, which are stored in the program memory of the M5P430, The data type of the stored values is 'integer', which corresponds to a value range of 0 to 65,535. The values from the DMX frame are used to address the values in the arrays, and the values stored In these locations are copied to the timer registers. This makes it possible to store LED-specific brightness profiles in the arrays, so that lin- ear brightness changes can be generated despite the fact that the LEDs do not have linearcharacteristics. After all the timer registers have been updated, the state machine of the DMX receiver returns to the Idle state (Initial state} and waits for the start of a new DMX frame. Figure 5 shows the full logic of the state machine. PCB and downloads Figure 6 shows the adapter board for the DMX and power supply connections (see Figure 2 for the schematic diagram). The narrow PCB for the three-channel DMX receiver Is shown In Figure 7 (see figure 3 for the schematic diagram). LEDs 01, D2 and D 3 can be fitted as individual compo- nents (red, green and blue), or a single RGB LED can be fitted in position D8 (with DI- OS not fitted). The adapter board plugs In to the side of the DMX LED board. Another DMX boa rd ca n be connected at the fa r end , and yet another board to the end of the sec- ond board. A zip file containing an Excel file with the bill of materials (BOM), a table of address settings, the C code of the firmware, Ger- ber files for the RGBs, the schematic dia- grams and PCB files In PCAD format, and the PCB layouts can be downloaded from the web page for this article (www.elekton com/081004). Future prospects A wide variety of extensions are possible. For example, you could cascade two 8-bit DMX5 1 2-A channels and use the MSP430 to generate a PWM signal with 16-bit resolu- tion for brightness control. You could also use a DRVBSxx 1C to drive a stepper motor, A connector (J4 on the DMX board) Is already present for a potential extension to provide wireless interface support, which could be implemented using an RF2500T board. You could use this arrangement to communicate with board without stringing any cables, or even control battery powered receivers. It would also be conceivable to extend the address range to include all 512 channels, display the address on an LCD module, and use two buttons or an Incremental encoder to set the address. (081004) Internet Links and References www.OpenDMX.net (open source DMX projects) http:// focus, ti.com/ lit/ds/sym I in k/msp43 0f22 74. pdf (MSP430F2274 data sheet) http://focus.ti.com/1rt/ds/5yTnlink/sn65hvd3D82e.pdf (SN- 65HVD3082Edata sheet) http://focus.ti.com/ 1 it/ds/ sy mli nk/ 1!4 3 1 a. pdf (TL43 1 A data sheet) http://focus.ti.com/IIt/ug/sivu254/slvu254.pdf (TPS621 1 0EVM-346 user guide) elektor 03-2010 39 ENERGY Life Cycle Considerations Byjens Nickel (Germany) New refrigerators and washing machines now carry an energy efficiency label, and we are becoming ever more conscious of the importance of the standby power consumption of televisions, battery chargers and other electronic devices. But it is not just the operation of these devices that produces significant amounts of carbon dioxide (CO2); so too does their production, transportation and their ultimate disposal. We show that these other factors can make a considerable difference to the environmental friendliness or otherwise of an appliance. Energy l.Wiacturer Mode! More efficient Fridge' -Freezer Less efficient Enflrgyoeratmplon kWhtycar jr* n*. Jif J kiJ nr-tfu hj *tf(| ■fciwdruirif!. rr* .1 UteildKi'H Fresi fooc voijne ! f rczsn f(K:d vofune I Nqj$g l P'JV) ptbdtKi/rvn €1 325 190 126 Consumers are becoming more and more aware of the power con- sumption of electrical and electronic devices. Whether a refrigera- tor, tumble dryer or washing machine carries a green 'A 1 or a yel- low ‘D’ efficiency label is no longer just a detail of specification but is now an important buying criterion. The eye-catching coloured labels have brought the question of energy efficiency to the fore- front of the consumer’s mind. The EU is now looking to extend its energy efficiency measures to cover stand-by power consumption [1 ], in particular of electronic household appliances. And with good reason: the total power con- sumption of all the devices in Britain In stand-by mode is compara- ble to the entire output of a coal-fired power station. For example However, we want to look in more detail at our energy budget. Fitting out a house with appliances already has a significant cost in terms of C0 2 production. A simple calculation will make this dean Mr N from Liverpool is a parsimonious gentleman looking for a new washing machine. With an eye on his ever-increasing electricity bill he carefully seeks out an appliance that needs less than 0.9 kWh for a standard wash cycle, giving it a category TV efficiency rating. However, he does not also take into account that the machine has already travelled a considerable distance. From the container port En China it has been transported by ship to Felixstowe, and from there by lorry to Liverpool. Of course, the lorry is carrying other appliances too: to keep things simple we will estimate that the machine is one percent of the lorry’s load and that the journey uses 1 50 litres of die- sel. We will reckon the same again for the journey from the factory in China to the port, and the ship journey at twice this amount. However, that is not the end of the story. Mr N has also made a 30 km journey by car to the shop to collect the appliance. Now we move a little into the future: after about 800 washes the washing machine develops a fault in its electronics. It is beyond economic repair. As a good citizen, Mr NS puts the machine in his car and takes it to the council recycling point; from there it is taken by lorry to the recycling company, another 300 km, A total of approximately 20 litres of fuel has been used in transporting the appliance; and its total electrical energy consumption has been approximately 700 kWh. 40 03-2010 elektor ENERGY The C0 2 budget of a kilowatt-hour How much CO 2: Is produced in the generation and transmission of a kilowatt-hour :* electrical energy? We want to include not just the CO 2 emitted as a result of burning the fuel, but also that resulting from the building of :he power station, the production of raw materials, and the transport of the fuel and other items. The calculation is not an easy one and depends on a number of figures and estimates: for example, where does the energy used in the manufacture of a solar panel come from? As you might Imagine, various studies, for example into the overall C02 budget of wind and solar power stations, have come to rather different conclusions, the figures often reflecting: the political re- quirements of the bodies commissioning the studies. A particularly bitter struggle Is fought over the carbon footprint of renewable energy sources and over nuclear power. Although attractive from a carbon Footprint point of view, nuclear power suffers from the problems of dea- ling with the waste and from considerations of safety and security. For example, one report has claimed that the overall emissions that can be at- tributed to a wind turbine capable of generating 1 ,8 MW are around 900 tonnes of CG2, mostly in steel and concrete manufacture. According to the study, the unit offsets this production in just five months of operation. However opponents claim that a Idlowatt-hour produced by a wind turbine cannot be offset against coal-fired or nuclear generation because the wind turbine can only produce ener- gy unpredictably when the wind is blowing) rather than on demand. The table gives a few figures calculated using the 'GEM IS' software model produced by the German Institute for Applied Ecology, Figures for the first three types of power station are rather lower if they are used to generate heat as well as power. Overall CO2 emissions of various forms of power generation (values given in g CO a /kWh) Coal-fired power station (lignite) 1,142 | Coal-fired power station (anthracite) 897 Gas-fired power station 398 : Nuclear power station 31 " Wind farm 23 j Hydroelectric power station 39 Solar cel 1 5 ( po ly crystal! i ne ) 89 "n Many a mickle... The story is still not complete. Assembling the washing machine In the factory in China takes approximately one man-day. The energy use for lighting, machinery and tools comes, suitably amortised , to around 4 kWh, Component manufacture probably accounts for another 8 kWh, and transporting the components between facto- ries consumes another 5 litres of fuel, A considerable amount of electricity Is used in the manufacture of the steel and plastic components: we will estimate that this adds another 5 kWh to the budget. And so we go on: the steel raw mate- rial from which the components are made has been produced using fossil fuels, and iron ore has had to be extracted from the earth and transported to a blast furnace for processing. And then there is wear and tear on all the vehicles and machinery involved at all stages of the production and delivery process, and so we have to add a smalt fraction of the energy used in their manufacture to the energy budget for the washing machine. Then we add in the energy involved in producing and transporting fuels, building oil wells, building power stations; the list goes on. The budget How does the total budget over the life of the appliance look when written in terms of C0 7 ? First we collect together the various figures above: 700 kWh of electricity to run the machine, 50 kWh of elec- tricity (in China} for Its manufacture and a total of 50 litres of fuel for transport. This last element is easy to assess: burning one litre of diesel produces approximately 2.6 kg of CG Z . Now, how much CO, is produced in generating one kilowatt-hour of electricity? The Even a wind turbine creates CO : , mostly via the steel and concrete used in its manufacture and instal lation. elektor 03-2010 41 ENERGY electricity delivered to a house is generated in several very differ- ent kinds of power station. Also, as you no doubt expect by now, we have to take into account not just the gas, coal or oil burned to generate the electricity, but also the C0 2 impact of construction and final decommissioning of the power station (see inset). The balance of different fuels used varies from country to country, but in Britain the generation and transmission of 1 kWh of energy releases around 0,5 kg to 0.6 kg of C0 2 . The figures for China are somewhat different, because of the large number of coal -fired power stations running at low efficiency. In the EU as well there are still power stations that emit more than 1 ,3 kg of CCt, per kWh generated. Of course, the environmental impact of generating one kilowatt- hour is not limited to the corresponding C0 2 emissions: we are reminded of the enormous (and highly controversial} hydroelectric stations in China. There are also studies that estimate the effects of nitrogen oxides and other gases on the environment and hence on human life expectancy [2a] [2b], These impacts can be converted into hard pounds and pence, allowing a direct comparison of dif- ferent energy sources. Conclusion Back to the washing machine: although running it accounts for the lion's share of its associated C0 2 emissions (around 350 kg), the amount involved in production, transport and disposal Is far from negligible (around 200 kg according to our calculations). For less power-hungry appliances this element becomes even more signifi- cant, The same goes even for appliances which are designed with energy economy in mind, although efforts in this direction nev- ertheless are and will remain worthwhile. If we want to do some- thing to help the environment, perhaps the best thing is to consider whether we really need to buy a new computer, DVD player or dig- ital camera every two years, (070800-!) Web Links [1 ] http://rejrc.eceuropa,eu/energyefficiency/html/ sta n d by J mtiative.htm [2a | www, needs-project.org |2h| www.externeJnfo Larger solar in sta Hat ions off set the CO- emissions resulting from their manufacture, transpon at! on in a small number of years. 1 r c to: German Federal Environment Ministry/ Brigitte Hi 5= 4 2 03-2010 elektor Looks like I found a bug... ppi ' : ' ; 2^ No it's a feature! This predictable reply was ^■IX met with a chorus of groans. No it's defi- nitely a bug, look.,, he handed me the solar powered battery charger. He was right; this | feature had six legs and spots on its back. The ladybird must have flown in through ¥ a win ^ ow decided to hibernate in our *iaiR eco-friendly solar charger thafs now almost ready for publication. How apt, I thought, of all the equipment and gear laying around in the lab this tiny creature had picked this piece of equipment The solar charger generates power but in operation produces no pollution or greenhouse gases; It was almost as if Mature had given the solar charger its seal of approval. It says what? ... How many times have ! got to tel! you, R-T-D-S! (look at the data sheet) We often hear these words of advice given to a young engineer struggling to get their circuit to behave. We have faith in data sheets they are the font of all knowledge. What if the data sheet is wrong? It doesn’t happen often but take the BC639 transistor. This device comes packaged in a plastic TG-92 outline and all the data sheets agree; with the transistor's flat face on the bench and its leads pointing towards you they read, from left to right; base, collector and emitter. I say they all agree but I overlooked a data sheet by Siemens, it tells us the leads are emitter, collector and base! Well at least i Emitter 2 . Collector 3. Base founded Phikp-i they agree on the cen- tre lead. In the years Bl (before internet) engi- neers would have a stack of data books to which they could refer, any printing errors could be corrected with a pencilled note. Nowadays Google finds the information for us. On a bad day you would by chance click on the Siemens data sheet and end up wiring the transistors incorrectly. The result is an afternoon of frustration hunting for the source of the problem. This is exactly what happened to one of our engineers working on a new design. He wasn't happy, maybe the advice should be: have you checked the data sheet for errors! SIEMENS So what's new? We are familiar with microcontroller evaluation boards that come in a small memory-stick format to plug into a PCs USB socket. Simi- lar designs are available from many semiconductor and software tool manufacturers and make a convenient development platform. So when this system from Ti dropped on our desk (http:/ /focus, ti.com/docs/toolsw/folders/print/ez430-chronos. ' html) we weren’t expecting any surprises, just . — like similar systems from other manufactur- ers, the development board is made up of ftv L w o s m all p I u g - 1 o g e t he r c a rd s , The fi rst contains the chip programmer and plugs into a PC USB port. The second tiny board contains the microcontroller. This kit however has one more trick up its sleeve (literally); it includes an e x ample target s y stem w i I h a n L C D d i s p other II kits. Once the microcon- t\S« troller card is programmed it can be fitted into the watch and the cover sc re wed dow n . 'I i e a ) n t it ) I - . ype C C4 3 0 k ' h n R F co i ft \ i i W sensor or pedometer. We haven’t yet h ad a c h a nc e to p ut this sy ste rra to t he test but look out for more details in the future. ELa bs t n si de@ E I ekto r * Cot a question for the designer of an Elektor circuit? * Any contributions or comments on the E-Labs Inside stories? * Suggestions of boards or electronics software that you think would be interesting to review * Discovered anything new that you want to tell us about? Don't hesitate; we look forward to your feedback sent to el a bs insid e@e I ektor. co m , please include [e-labs] in the subject line. elektor 03-2010 E-LABS INSIDE A look at the Altium NanoBoard 3000 By Jens Nickel A few months ago Australian software and tools specialist Altium cut the price of its Altium Designer electronic CAD soft- ware suite considerably; they also added a new, relatively low- cost, member to their NanoBoard family of FPGA-based devel- opment boards. The NanoBoard 3000 sells for around three hundred pounds I 1 3 and includes a special twelve-month licence for the Altium Designer software along with various items of licence-free intellectual property (IP), such as an 8051 -com - would need In building modern applications, especially in the mobile arena. At the heart of the board is a (soldered- in) Xilinx Spartan TAN FPGA. The board contains everything needed to develop and test a complete embedded system, including processor, memory and peripherals: in fact, these components are implemented as 'soft IP cores' in the FPGA, and can be used without the developer needing to be famil- iar with Vertlog or VHDL Programming is done by connect- ing together ready-made functional blocks using a graphical interface. patible soft processor core. The manufacturer has been kind enough to let us have one of these kits. First impressions on opening the box were very positive. The board, mounted in an elegant black frame. Includes everything the electronics engineer could possibly want: a TFT LCD panel (with touch-screen), an audio codec, large amounts of SDRAM, SRAM and Flash memory, two SD card slots, eight full RGB LEDs, four PWM outputs, a four-channel ADC, a four-channel DAC, four relays, a real-time clock, and much more besides. The interfaces available include USB and R5232, as well as Ethernet and a range of audio and video interfaces (S/PDIF, MIDI, VGA and so on). The wide range of peripherals covers most of the possibilities that an engineer The manufacturer’s hope is that once a prototype has been developed using the NanoBoard 3000, the designer will obtain the “Custom Board Imple- mentation’ version of the software, which has features for printed circuit board design and for interfacing to a mechanical engineering CAD pro- gram. This integrated approach can drastically reduce the time taken to reach mass production; the disad- vantage is that it takes considerable effort to learn to use the powerful features of the electronic CAD suite. We found that a good way to get started was to follow the step-by- step tutorials on the NanoBoard 3000 website (click on “Training Room' towards the bottom of the home page PI). The short, well-produced videos show how to develop an example application, which makes it easy to understand how the software works and how powerful it is. The Altium website Dl, especially under the 'Community' and “Training 1 menu items, contains a great deal of additional information on Altium Designer, including further training videos and manuals, a wiki and user discussion forums. Installing the program is straightforward, and as soon as you have created an account on Altium’ s website, you can obtain the twelve-month licence mentioned above for use in conjunction with the board. A software package can also be downloaded (free, but registration required) from the website of Xilinx, the FPGA manufacturer. These tools, which are responsible behind the scenes for placement and routing in the FPGA, integrate seamlessly with Altium Designer. The user interface is, of course, professionally presented and 44 03-2010 eiektor LED Cuulinfcla-r easy to use* There are many project examples, arranged into groups under headings such as ‘Analogue', ‘Audio 1 , 'Display' and ‘Networking’, and these can be loaded into the main project window with a click of the mouse. From here various views of the project are available. For example, the circuit diagram view shows the connections between various peripherals (such as the display) and the modules in the FPGA. A further click compiles the project, and uploading the design (over USB) is also easy. In order to get a better impression of the program we worked through the first example from the training videos. The aim of this example Is to drive the RGB LEDs on the board and control their colour and brightness* This involves appropriately config- uring and connecting the LEDs themselves, an LED controller, and a control interface with sliders and a seven-segment dis- play* The wiring is all carried out In the virtual on-screen world; there is no need to set jumpers on the board, plug in new com- ponents or do any soldering . * The LED controller is one of the many soft IP components for the FPGA that come with the board. The control interface, however, is hosted on the PC, which must therefore remain connected to the board while the design is running. As everything is manually driven from the PC, this first example application does not need to use the microcontroller core in the FPGA* The steps in building the design are well documented in the video and in a downloadable PDF, and we managed to get to the desired result quickly (see accompanying screen shots). How- ever, it took some practice to get to the point where we were comfortable developing our own projects, which is hardly sur- prising in view of the complexity of the program. In conclusion, the kit is primarily aimed at those with little expe- rience of ‘soft designs 1 , perhaps small development groups or teams of university students who have already worked on sev- eral microcontroller projects and who wish to broaden their experience by learning how to use FPGAs* For a reasonable price you can buy a fulJy-kitted-out system to experiment with this modern approach to development. The FPGA is then just a means to an end, namely that of developing a prototype as quickly as possible* If, on the other hand, you are interested in FPGAs for their own sake, and simply want to experiment with using VHDL, you will be able to find smaller and cheaper boards on the market. Assuming you have a suitable program- mer, files created using Altium Designer can be used to program any FPGA of the same type, even if it is on a different make of development board or even on a purpose-designed board. (090555) [ 1 ] httpi//uk,fame1ixom/altium/ [ 2 ) htt p: / / n b 3 000 .a I tm m .co m / i ntro* h tm \ elektor 03-2010 45 c p -in s ? E-LABS INSIDE but do it properly! solves the oxide layer but leaves a residue which unless removed will eventually dry out and make a poor contact again. The vapour produced is flammable so ensure there is no source power line before you start. There are three steps altogether in the correct cleaning sequence. Ventilate properly! 1 . Spray the contacts sparingly with Kontakt K6Q, rotate the pots and wafer switches back and forth to distribute the fluid. If the contacts are accessible clean them thoroughly using a fine brush. Carefully remove any debris. Leave the contacts to dry, 2, Spray liberally with Kontakt WL, this will dissolve and remove the residue left by the K6Q, now leave to dry, 3. Finally spray with Kontakt 61 (K61) sparingly; this coats the con- tacts with a thin protective film to inhibit further oxidation. Sometimes the pot has been so well used that the resistive track is worn out in places or pits have developed on the surface. In extreme cases oxide build-up can cause the pot to fail The only real solution then is to replace it. When all else fails take a look at internet reference I 'I where you'll find some really novel sugges- tions to help bring the pot back to life and helpful tips also. We suspect there are some of our [WITT7 ■■ ST readers who choose not to equip Iwl ill II their listening space with the lat- r lm est surround-sound. Ethernet-con- * nected, WiFi-enabled, 5,1 THX-cer- iOl tiffed media player. Instead they n^B| would most probably be using a f A fl quality turntable or transcription iti p gjl deck. For sure the heat rising from p the valve amplifier would be keeping P ^A s! the room nice and cosy. Old equip- ..|H ment has a certain charm that some people find preferable to the more modern equivalents. Often with equipment of this age, pots and wafer switches become distinctly noisy. It can spoil the atmosphere if every time you adjust the volume the speakers make a sound like a sack of spanners being dragged across the floor. The switch contact surfaces and pot wipers tend to build up an oxide layer with time which leads to increasing contact resist- ance and sometimes intermittent contact. Contact cleaner squirted through an opening in the pot or switch housing usu- ally makes a huge Improvement but the effect can be short- lived, Eventually the crackle returns and sometimes it seems even louder than before. There are several proprietary switch contact cleaning sprays available and Kontakt 60 (K60) is one of the best known. It is manufactured by Kontakt Chemie, a sub- sidiary of CRC USA. CRCs web site HI contains detailed usage instructions of their product range, it appears little known that to clean switches and pots effectively Kontakt 60 should be used strictly in combina- tion with Kontakt WL and Kontakt 61 , The reason is that KGO dis- KOMtAHT 0-tE=ri/i]E (100022) www. crci n d.to m/csp / web/ Prod 0 is p. csp?cou ntry = ALL & p ro d u ct=KONTAKT 6G&b rand= KOC&I ng = 3 h ttp: / / www. vi ntage-ra d io. net / for u m / $h 0 w th read , php?t-36778 03-2010 elektor YVVlI |i Spr-if fur carttuti SpfQCiwimprjy vupr EOiir-lfii i' ip r j,y nrrtny.li ' IJtiur cnntatli SprtlhwaieUr f.lp Hi 1 ill. .lit. Ara|£ com »*i *vi li|LHr,ii| fl?, I#liTMfl ArUk-il ui mBiiT imvnrnihJL**! idm c.nnlj£l#n LutifK* aHC ■aCi-ElWrdh^n p-rj* <*aLli£i K nrrciLinaccliL:Li Lrii! Sc hrn»wrn!l*!«l Air Kairrakta Conract dbjncr Corn Alt'. Nertoyafic fiuur toniAiu Prototype / Production We add value to PCBs when others just sell it. 1 n zj ) THE ORIGINAL SINCE 1994 Email: sales@pcb-pool.com Free Phone UK: 0800 389 8560 Servicing Your complete PCB prototype needs. HP* 8 hour prototype service now available Free Laser SMT Stencil 1th all PCB prototype D-Dool.com Now available: Tools and accessories for prototype PCB assembly r Supported File Formats HUllHIE Easy -PC; PULSONIK V- ■2 LAYOUT elektor 03-2010 47 MICROCONTROLLERS By Wolfgang Rudolph and Dr. DetlevTietjen (Germany) Passwords are important but also annoying. The more secure the password the more difficult it is to remember. This project based on the Elektor ATM18 ATmega board provides a neat solution. piece of paper and stuck under the key- board! It's like hiding your front door key under a flowerpot, that's the first place burglars look* it is also important to regu- larly change your passwords. This means that before long we could typically have around fifty such passwords to remember and if, as recommended we change them every month this amounts to 600 strings of meaningless random characters to memorise every year* Hands up alt those who follow this advice.*, no I thought not. Unless you possess Rain Man's ability of total recall you probably take a chance by using easy to remember short passwords and never bother to change them* There are some commercial solutions available on the market to help manage passwords, some good, some not so good and they are often difficult to use. The solution suggested here requires a few components together with the ATM1 8-con- trailer test board plus software which can be downloaded for free from the Elektor website !i i. The controller generates secure passwords and sends them to the PC's USB port; we only need to remember a short four digit PIN. All the complex calculations are performed by the microcontroller. The Hardware To transfer the passwords from the ATM1 8 :est board to the PC it is necessary for the ATM 18 to emulate the function of a USB connected keyboard* Communications c“ ia K passing between such a keyboard ard PC will therefore be generated in t u e ” V-1 8 software. The only additional n arc/*a'e needed for this project is a small e wen dir board which fits between the USB # If The word posse- par- tout is of F r e n c h origin meaning literally 'pass everywhere'. A single key that can open several locks is also known as a passkey or master key. In the real world such a key would be used by a house manager of say student accommoda- tion. Here each student's personal key only opens their own door but the house manag- er's passkey can open all of them* If the key is stolen however every door is insecure. For this reason it is important that we don’t use the same password on our computer and every secure website that we visit on the Internet. Each password must be unre- lated and as random as possible and under no circumstances should be written on a 43 03-201 o elektor MICROCONTROLLERS Figure 1 , The socket on the left connects to K5 on the test board. The socket on the right plugs into a PC USB port. port and the controller board. The extender board is fitted with two 3.6 V zener diodes and two 68 Q resistors. An additional resis- tor connected between pins 1 and 2 on the USB con necto r signals to the PC that a sfow USB peripheral is connected, The circuit with the Zener diodes and resistors (see Figure 1 ) can also be found on the Internet [2]. A cur- rent of 20 mA flowing through the 3.6 V Zeners produces a voltage of 3,3 V. This is exactly what the level needed to enable the interface to work with USB signals. The circuit is so small it could in fact be built directly on the ATM I S board’s RS232 con- nector (K5). It could also be hand wired to a connector or built on a small square of perf board as we have done here. Be aware that pin 6 (CM D) of the extender board con- nects to K5 pin 1 on the ATM 18 test board, pin 5 connects to I<5 pin 2 etc. Looking at the board from above with the printing the right way up, pin 1 of all the connectors is always to the left. On pin header K1 2 of the ATM 18 test board it is necessary to bridge PD1 and PD2 (INTO) so that INTO is available at connector K5. The two-wire LCD connects to PC4 (Data) and PC5 (Clk), the push buttons to PCI to PC3. In Icd.h and btn_config.h it is possible to re-assign these pins if necessary. The Software The USB routine is a little tricky. We have used the familiar v-usb driver 13 and a part of the HIDKeys project i4 L As long as our "keyboard* complies with the HID (Human Interface Device) specification it will not be necessary to Install any driver. Both projects are under GPL. The USB driver essentially consists of two parts; an Interrupt Service Routine (I5R) and the function usbPollQ, which in the main loop must be called as often as pos- sible, at least every 50 ms. Should it fait to achieve this we get a TimeOut by the host (PC) error and the link stops working. Like- wise the ISR response time is critical, any other ISR must be kept as short as possible or stopped to avoid slowing down the con- troller’s response time. To meet the 50 ms time constraint the pro- gram does not use any wait loops i.e, where the program is held in a loop waiting for a key press. Instead execution is controlled by the value of the ’status’ variable which is continuously updated, A sequence of switohQ statements takes the program to the necessary routine. Otherwise the pro- gram remains in its main loop. The list of Internet addresses which require a codeword to be generated must be typed into the source code before the program is compiled. Four entries have already been included in ‘main.c' starting at line 22 (see Listing f ). The number of entries can of course be added to or deleted and the block expanded as necessary. Each entry in this block has the same for- mat: two numbers indicate the password length (it can be up to twenty characters long) now following the colon the web address of the site is entered by hand (20 characters maximum). The 20 character limit is to ensure that both the address and password will fit onto one line each of the display. The program uses around 4 KB of memory and each address entry uses 24 bytes. The Flash memory has around 3 KB free to store the addresses. The ATmega test board does not store the password in memory, instead it calculates it using the displayed web address and sends it to the PC when the button is pressed to transfer it. At the PC it receives the string of characters and deals with them as if they had been ty ped in on the keyboard. When the password generator is connected to a different PC w th say a foreign keyboard lay- out there w re some compatibility issues. Some lang ua c es ha v e special cha racters and position the — mon characters in different places on the cutil/ delay . h> c avr / pgmspace . h > #include # include t include tinclude #include "usbdrv .h" '"oddebug , h 11 "btn_conf ig .h" Ir btn . h ri "led 2wire.h lf tdefine ENGLISH tinclude "locale . inc" typedef char entry_t[24J; entry_t addresses [] PROGMEM =■ { r, 20:www* elektor , com 1 ' , " 12 : www . anywhere * com", " G8:www. mybank , com " f n l l ; www . anyweb . com" } ; const uint8_t n_o_address = sizeof (addresses) / sizeof (entry_t.) ; const char empty string [21] PRGGMEM = " Listing 2 , #def ine KEY_R 21 # define KEY S 22 /* Keyboard usage values, see usb-org's tdefine KEY T 23 * HlD-usage- tables document, chapter 10 tdefine KEY_u 24 * Keyboard /Keypad Page for more codes , tdefine KEY_V 25 */ tdefine KEY W 26 #def ine KEY_X 27 # define MOD NOMOD 0 # define MQD_COMTROL _LEFT (l< _ ill find all manner of downloads, tips and tricks as well as news. elektor 03-2010 55 SHORT-RANGE BUSES SPI, Microwire & friends By Dr. Bernd vom Berg and Peter Croppe An important application of synchronous serial communications is in short-range buses, which provide a simple and reliable means of connection between ICs on a single printed ci board, between the circuit boards or modules in an enclosure or rack, or between a piece of equipment and its control panel. 8 us systems such as these are called (synchronous) serial device buses, inter-IC connections, or just simply short-range buses. The best-known examples are SPI, Microwire, the 3-wire bus and the I ’C bus. In this article we will look more closely at the first three of these* Microwire This synchronous serial bus was introduced by National Semieon- doctor as one of the first ways to connect serial peripherals to their COP microcontroller. The four possible synchronous serial interface modes, of which Microwire uses mode- 0 , are also referred to as the SPi (Serial Peripheral Interface) modes: frequently peripheral chips from other manufacturers are described as 'SPI/ Micro- wire compatible 1 , which means that the chip must be driven according to mode 0 and does not oper- ate In the other modes. The Serial Peripheral Interface (SPI) 'SPI' Is used as an umbrella term for all four modes of synchronous serial data communication (Table-1 ) and was introduced by Motorola In their 6805 microcontroller. However, things are not completely standard- ised and an SPI chip must be checked care- fully to find out which of the four operating modes are supported. Mode 0 is the most common (because it is compatible with Microwire) but many chip manufacturers also use other modes, A close look at the relevant datasheet, in particu- lar at the timing diagramsand serial interface description, is there- fore essential. 3-wrre In designing the 3-wire interface, shown in Figure 1 , the engineers at Maxim/ Dal las reasoned as follows: when serial data transfers are examined closely, it often becomes apparent that either the master station is sending data to the slave or the slave is sending data to the master — not both at the same time, in other words, the data transfer is generally half-duplex, even when full-duplex operation would be possible. This means that we need just a single data trans- fer wire DQ, where the direction of data transfer is changed as necessary: we have bidirec- tional com- munica- tion over a single wire. Sometimes the DQ pin on the slave is an input, sometimes an output, and the same goes, of course, for the master. This saves a precious digital I/O pin at the cost of having to follow strict rules for data transfer: 1 . When power is first applied the slave must always wait for a message from the master before proceeding. The slave connection is thus initially an input. 2 . The master is responsible for waking the slave up. The slave can react to its wake-up cal in two possible ways. If the master pro- ceeds to send configuration settings or commands, these are 5 ^ 03-2010 eiektor SHORT-RANGE BUSES Table 1. The most commonly-used names for the serial port connections on peripheral chips. Signal Generic name Motorola-specific name Maxim/Dallas-specific name Clock SCLK SCK.CIK SCK, GLK 1 Transmit (master to slave) SO/SI MOST: master out - slave in DOUT/DIN (date out/in) or DQ Transmit (slave to master) 50/51 MI5G: master in - slave out DOUT/DIN or DQ Slave enable CS (chip select) SS (slave select! RESET, RST, LOAD | Some slaves require an active-low signal for enable (CS, 55 or LOAD), while some staves require an active- high signal (R5T), processed by the slave, which remains in receive mode. Alterna- tively, if the master asks for data, the stave will switch to transmit mode. When the transmission is complete the stave automati- cally returns to receive mode and waits for a new command mes- sage from the master. The rules guarantee that on ty one participan t on the bus tries to transmit data on the DQ wire at any one time, while the other receives the data. Applications A panoply of SPf chips is now available covering the whole spectrum of possible applications (Table 2). We wifi pick out three interesting peripheral devices from the range and look at them in more detail, and put them through their paces. We connected the chips to an 8051 -series microcontroller and used software written using C51. Other microcontrollers can of course be used: SPI modules and pro- tocol Implementations are ubiquitous and thoroughly documented. Other programming languages can also be used. We have assembled a data pack, containing detailed information including data sheets and further details on the chips discussed It Is available for download from the Etektor website. There are two possible ways to implement SPI on a microcontroller: 1 . If the microcontroller already has the necessary interface hard- ware as an on-chip peripheral module, the software must set the parameters CPOL and CPHA in the relevant SFRs (special func- tion registers). Then the data byte to be transmitted is stored in the transmit SFR and then, once the start command is issued, the data transfer is handled completely autonomously under hardware control in the SPI module. This method can achieve the highest data transfer rate. Receive operation is equally simple. The SPI module receives the serialised bits autonomously (according to the trans- fer mode specified by CPOL and CPHA) and then informs the microcontroller, for example using an interrupt, when a com- plete byte has been assembled. The application software can then process the data byte. The software effort required to Implement synchronous serial communications in this way is minimal. 2, If the microcontroller does not have a dedicated on-chip SPI module, the synchronous serial communications protocol must be implemented using spare digital I/O port pins. The program- mer must set the port pins individually high and low in soft- ware in such a way as to generate the appropriate clock signal and to ensure that the data bits are transmitted on the correct edge of the clock. 040241 - 2-11 Figure- 1 , The 3-wire Interface, For reception, the clock must again be generated 'by hand' and the state of the input pin read in on the correct edge of the clock signal. The dock pulses and data bits must be counted exactly. DIN CS REFAB REFC RESET Vdd Vss GNO EH ($41 ■ i- \2 Figure-2. Block diagram of the MAX51 2. elektor 03-2010 57 SHORT-RANGE BUSES Table 2. The world of SPI. Data converters A/D and D/A converters memories EEPROM and flash EPROM Clock modules Real time clocks (RTCs) Sensors Temperature, pressure, etc. Display controllers LED matrix, alphanumeric LCD Asynchronous serial interfaces UART Bus controllers CAN, USB Miscellaneous Digital potentiometers, digitally-controlled amplifiers, etc. Figure-3. SP3 timing diagram (SPI mode 0 ), These shenanigans are called 'bit banging', where a synchronous or asynchronous serial communications interface protocol is emu- lated using individual port pins by setting and clearing these pins in software. Although not especially complicated to program, this method results in data communication considerably slower than that which can be achieved using an on-chip module. Since we are working with an 8051 -series microcontroller we shall have to employ the bit-banging technique since many members of the 8051 family do not offer an on-chip SPI module. SEG A“SEG G DP DIG 0-DIG 7 1— L \ 1 LOAD (CS) ► CLK 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ■ (LSE) 1 , _ _ ( ) MAX7221 ONLY 340241-2-15 Figure-5. Block diagram of the MAX7219. 53 □ 3-2010 elektor SHORT-RANGE BUSES Urefab +5V extern 040241 - 2 ■ 16 Figure-4. Connecting the MAX512 to a microcontroller Figure-6. Connecting the MAX7219to a microcontroller MAX512 Serially-controlled D/A converter SPI mode 0 and Micro wire compatible This chip contains three D/A converters with a resolution of eight bits. Figure 2 shows the block diagram of the device, Fig- ure 3 the SPI timing diagram and Figure 4 the connections to a microcontroller. MAX7219 Serially-controlled LED matrix display driver SPI mode 0 and Microwire compatible, castadable The MAX721 9 can drive up to 8-8=64 individual LED segments in multiplex operation. It also includes a BCD decoder module, and so is equally suitable for driving individual LEDs or 7-seg- ment or S-segment displays. The chip also has an DOUT output which makes it easy to cascade the devices to construct displays of almost any size. Figure 5 shows the block diagram of the chip, and Figure 6 shows how it can be connected to a microcontroller. To cascade devices, connect the DOUT pin of the first to the DIN pin of the second, and so on: the dock and load inputs are all wired in parallel DS1620 Serially-controlled thermometer with thermostat SPI mode 3, 3-wire interface This device contains a thermometer, for temperature measure- ment, as well as a thermostat, for temperature control. Figure 7 shows the block diagram and Figure 8 the connections to a microcontroller. The chip employs bidirectional communication over a single wire. First of all the master sends a command to the DS1620 (for exam- ple, 'measure temperature now') and then the DS1 620 replies with the measured value. The DQ wire Is thus used in both direc- tions, and the master must switch its I/O port pin between output mode and input mode as necessary. (040241-2) Figure-7 Block diagram of the DS162Q. figure-8. Connecting the DS1620 to a microcontroller. elektor 03-2010 59 MICROCONTROLLERS Every Mi crowatt Matters By Andreas Riedenauer (Germany) This article will help you design energy-efficient circuits based around AVR microcontrollers. Even cutting a single microamp from the current consumption of a circuit can be important in designs powered from batteries, Cold caps, solar cells or 20 mA current-loop interfaces, and in designs that use so-called ‘energy harvesting’. An important aspect of low power design is the consumption of a device in stand-by mode. In the UK consumer devices left in stand- by mode are estimated to be responsible for as much as ten per cent of total domestic power consumption. Energy efficiency starts with the design of the circuit. For this article we will look at the AVR microcontroller, a firm favourite in Elektor micro- controller projects. AVRs are among the most frugal of microcontrollers in terms of absolute power consumption as well as in terms of process- ing power per watt. The reasons for this are its static CMOS design. Its Harvard architecture and Its RISC-like instruction set. The device also Incorporates features such as ‘Flash sampling', whereby the program memory is disabled to save power when it is not being accessed. Application Notes AVRQ40 11 and AVRQ42 14 give a good introduc- tion to the subject. They include a lot of useFul advice on hardware design, with regard to power saving as well as more generally. We will now look at some of the concrete power-saving ideas and recommendations in these Application Notes. External components - Use high-efficiency LEDs and flash them only briefly if possible. - Prefer latching relays as they require just a brief pulse of current to change their state. When using ordinary relays, use PWM to reduce the co i I tu rrent to a lower ( ’ hold 1 ) va lue after the relay has pulled in. - Piezo sounders are more efficient than loudspeakers, especially when driven at their resonant frequency. Device selection Members of the AVR family of microcontrollers vary in the power- saving features they offer. If possible, choose one of the ‘pico- Power* devices. Also, the devices with a part number ending in ‘A' are between ten and sixty per cent more efficient than than oth- ers in the range. So, for example, prefer the ATmegaBSPA over the ATmegaSBP or ATmegaBS. Devices in the XMEGA range come with the most comprehensive power-saving features. I/O ports Unused I/O port pins should be configured as inputs. All digital inputs (including unused ones) must be held at a defined logic level, either by external circuitry or by activating interna! puli -up resistors. Beware; the default situation in the reset state is that these resistors are not activated. External resistors are therefore required if current consumption during reset must be minimised. XMEGA devices also include internal pull-down resistors. Clocking The current drawn by an ordinary CMOS circuit is approximately pro- portional to the frequency at which it is clocked. For circuits that run continuously a dock frequency must be chosen high enough to guar- antee that the necessary processing can be performed in time. What should be done if we do not need continuous operation but rather occasional rapid bursts of processing? In such cases we need to use the sleep modes of the processor to disconnect the CPU from the system dock for the majority of the time (or the system dock can be completely disabled). We wake the CPU up when it is required, have it perform the necessary tasks, and then return it to sleep. Table 1 gives an overview of the various sleep modes available. In all these modes it is possible to wake the CPU up in response to an external interrupt, reset, two-wire interface (EC) address match or watchdog event (if enabled). If an external wake-up event, such as a button press or a signal on an interface, is to be used, then it Is possible to put the AVR into powerdown mode, At 0.1 pA this is the most efficient of all the sleep modes. If the processor is to wake itself autonomously, the real time dock (RTC) must be enabled. In this power save mode a pico Power AVR will draw less than 1 uA, around one tenth of that drawn by a standard AVR device. These figures are for operation at a tempera- ture of 25 u t and are ‘typical values': in practice current draw varies from device to device. If processing is carried out only occasionally it is better to have brief periods of activity at a high dock frequency than longer periods at a lower dock frequence The choice of supply voltage may affect the maximum possible dock frequency, and, except in the case of XMEGA devices, the interna RC oscillator can only be used at up to half of the maximum rs te c : :k frequency of the device. If the length of a n acti ve pe _ : d is fixed , for exa mple by the baud rate of a UART, then the dock f-equency can be reduced to the lowest Go 03-2010 elektor MICROCONTROLLERS Table 1 : Summary of sleep modes Sleep mode Main clock RTC 1 Wakeup SPM/EEPROM ready wakeup ADC complete wakeup RTC wakeup Wakeup from other interrupts Notes Idle On On Fast Yes Yes Yes Yes ADC noise On On Fast Yes Yes Yes No As idle mode, but fewer modules reduction active Power down Off Off Slow No No Yes No Only external wakeup Power save Off On Stow No No No No As powerdown mode, but auto- nomous wakeup possible Standby On Off Fast No No No No As powerdown mode, but with main clock on Extended standby On On Fast No No No No As power save mode, but with main clock on feasible value. For computations the clock frequency should then be raised as high as possible, it is more efficient to switch between two alternative dock sources than to alter the division ratio of the clock prescaler: essentially, it is best to avoid generating higher frequen- cies than necessary anywhere m the device* The XMECA range is particularly flexible in this regard: for example, it is better to dock an XMECA device at 1 6 MHz by using the 2 MHz RC oscillator and the PLL than by using the 32 MHz RC oscillator and dividing it down. If the CPU and Its peripherals require different clock frequencies then the master dock, from which these are derived, should run as slowly as possible (see Application Note AVR1 010 Clock oscillators It is important to consider not just the frequency of the clock oscil- lator, but also its type. Different types of oscillator differ in their cur- rent consumption and in their start-up time. If the sleep modes are to be used and frequency accuracy and stabil- ity requirements are not too demanding, the best choice is the inter- nal RC oscillator. Quartz crystals have a number of disadvantages: they are sensitive to vibration, they take up valuable space on the printed circuit board, and they are slow to start up, which wastes energy. A crystal can take 1 5000 cycles before it is oscillating stably, while an RC oscillator is stable after about six cycles. Ceramic reso- nators fall somewhere in between, needing 200 to 1000 cycles to start up. The accuracy of resonators is sufficient for asynchronous serial communications, but not for long-term timekeeping. Newer AVRs sport a temperature sensor that allows the RC oscillator to be calibrated via the OSCCAL register. The final accuracy that can be achieved, about one or two per cent, is good enough for a UART. XMECA devices are better in this regard, offering a 32 kHz RC oscil- lator calibrated to within 1 % over the entire range of operating volt- ages and temperatures. If crystal accuracy is a requirement, then energy can be saved by programming the CKSEl fuses to low power crystal oscillator' rather than ‘full swing crystal oscillator", although this increases the circuit's EMC susceptibility. If a suitable permanent clock source is already available elsewhere in the circuit, using this is the most efficient option. Table 2 gives an overview of the various oscillator types. Supply voltage Current consumption is approximately proportional to supply volt- age. The minimum supply voltage for most modern AVRs is 1 .8 V t and for the XMECA range it is 1 .62 V. The lower the supply voltage, the lower the maximum permissible dock frequency. The ATtiny2 3 U and ATtlny43U include a step-up converter that allows operation from a single cell. Reliable start-up is possible at 0.9 V and above, which means that almost all the energy in the battery can be used. Below 0.6 V the entire chip is switched off, in the interests of pre- venting a very deep discharge of the ceil. The step-up converter Power Figure 1 . Brief bursts of rapid activity reduce average current consumption. elektor 03-2010 61 MICROCONTROLLERS Table 2. Oscillator types j Oscillator type Accuracy Start-up time in cycles Quartz crystal 1 0 ppm to 50 ppm 16000 32 kHz watch crystal 1 0 ppm to 50 ppm 16Q00to 32000 j Ceramic resonator [as % to 1 % 200 to 1 000 1 RC oscillator \ 1 % to 2 % (calibrated) 6 External dock - r & 1 itself draws 1 7 pA, and so this may not be the ideal solution In appli- cations where a timer must run continuously. Brown out detection If the battery voltage falls below a certain level the microcontrol- ler will no longer operate reliably. To avoid this, a voltage monitor called a brown out detector (BOD) is provided, which will put the microcontroller into its reset state if the supply voltage falls below a threshold value. The picoPower AVRs (apart from the ATmegal G9P and ATmegal 69PV) have a “sleeping BOD" or SBOD. which can be turned off in sleep mode. When powered from a battery the supply voltage falls very slowly indeed and can be monitored using an ADC input or an ana- logue comparator. This can be used to warn of a low battery well before the BOD threshold is reached. Power reduction register (PRR) Peripherals should be shut down when not En use. Many AVRs have a power reduction register (PRR) for this purpose. By setting appropriate bits in this regis- ter the timers. ADC. USART and two-wi re interface (PC) can be disconnected from their dock source, remaining En their last state until the dock is re-enabled. A further step, setting the ACD bit in the ACSR register, is needed to switch off the analogue comparator, saving around 60 pA at 3 V, The AC interrupt must first be disabled. by clearing the AGE bit in the ACSR register, as otherwise an interrupt can inadvertently be triggered when the com pa rator is switched on or off. ff the bandgap diode (gen- erating Vref) is internally connected to a comparator input, it adds a further 1 5 pA to the current budget, even in sleep mode. In this case it is therefore also important to dear the ACBG bit of the ACSR register. The savings that can be achieved by switching off various peripherals are outlined in Table 3. General-purpose I/O registers and virtual ports (XMECA only) Modern AVR devices have many more special function registers (SFRs) than can be accommodated in the address space origi- nally planned for them. This means that the fast IN. OUT and other instructions can only be used on some of those registers, and so by carefully choosing the peripherals it is possible to save a few clock cycles. Newer AVRs have general-purpose I/O registers which can be accessed more quickly than the SRAM area. In the XMECA range the length of the active period can be reduced by talcing advantage of virtual ports, which allow access to the DIR, IN, OUT and 1NTFLAGS registers of up to four ports by single -cycle data transfer and bit manipulation instructions. register can be read and then the ADC switched off. Digital input disable register (DIDR) All the AVR s analogue inputs can also be used as digital I/Os. When an analogue voltage is applied to an input, significant leak- age currents can flow in the digital input stages, as both transistors in the circuit conduct to some extent. The current can be in the tens of microamps per port pin. Devices in the picoPower range have a digital input disable register' (DIOR) which allows the dig- ital input circuits to be disconnected from the analogue inputs on a pin-by-pin basis. Analogue-to-digital converter (ADC) The ADC draws about 200 pA at 3 V, and so should preferably only be switched on when absolutely necessary, and even then used in single conversion mode. Enabling noise reduction mode stops the CPU during the conversion, which saves power and improves accuracy, as the ADC no longer suffers from interference arising from the activities of the CPU. Since an eight- bit conversion takes only 1 2 us (as opposed to 65 jis for a ten-bit conversion), energy can be saved if eight-bit accuracy is sufficient for the application. There is no special eight-bit mode, but we can set the ADC dock rate to a suitably high value {1 MHz) and use the ADLAR bit to ensure that the more significant result byte will appear in the ADCH regis- ter. Twelve microseconds after the conversion is initiated, this Tables. Savings achieved by switching peripherals off Module Saving when CPU active Saving when in idle mode US ART | 2 % i 6 % I Asynchronous timer (RTC) 1 5 ^3 Timer /counter 2 % 6 % ADC 1 ** ■j , 0 SPI 3 % T I ^ 62 03-2010 elektor MICROCONTROLLERS Dynamic clock switchinq in a remote keyless entry example application For the design of an electronic radio key we selected a classic ATmegal 28 device, as picoPower AVRs with 128 kbyte of Flash were not readily available at the time. Today a more economi- cal ATmegal 284 PA or ATxmega 128 AT would be chosen, but the principles remain the same. The key transmitter spends 38 % of its time in power down mode; for testing purposes we activate it once per second by pressing a button. The power supply voltage is 3 V* Communica- tion with the base station is by radio and is encrypted using AES; the data rate is 9600 baud. Data processing, including encryp- tion, requires about 100 000 dock cycles, and each transmission consists of eight bytes. S.3 mA — ICC -'-f — 12.5 ms — 4j*- 8.3 ms 24 mA — » 1 0.2 uA-- h\k = 8 MHz 25B uJ Average Energy Consumption ft- 12.5 ms 8.3 ms 979. 2 ms 1 -►Time Iqc fl-S mA 0J mA M uA - F c sk = 1 MHz HMms 6.3 ms 248 u J Average Energy Constimpllon 591.7 ms 100 ms - k- 8.3 ms -►Time 5.3 mA — In fee Jz.4 mA — 9,2 uA J- ■12.5 ms 8.3 rrvs F^k = Mixed 8 MHz and 1 MHz 20V uJ Average Energy COFisupuplicr 12,5 mi 8.3 nvs First we try using the internal RC oscillator at its maximum fre- quency, 8 MHz. This gives a total energy use of 259 p] (micro- joules) per transmission. If the clock frequency is reduced to 1 MHz, we save some power during the actual transmission, which takes a fixed amount of time determined by the baud rate. The processor also draws less current when performing the mathematical operations, but fora longer period The overall effect is to reduce the energy use to 248 llJ, a saving of 4 % com- pared to 8 MHz operation* ff we perform the calculations at 8 MHz and then switch the dock down to 1 MHz for transmission, we reduce the energy use still further to 207 llJ, a total saving of 20 %. T 479.2 ms -►Time 090157-12 Process Case Clock (MHz) Duration (ms) Current (pA) Power (mW) Energy (nJ) Calculation (active). 100 000 cycles 1 1 8 12.5 5300 15.9 198 2 1 100.0 ,800 ' 2~40 240 3 8 12.5 5300 15*9 I [ 198 Transmission (idle), 3 bytes 1 8 J 8.3 ! 2400 j 7.2 1 60 2 1 •83 300 0.90 ; 8 3 1 8.3 300 0~90 H \ ? ] 0 9793 0*2 0.001 1 1 Power down 2 r 891.7 0*2 0*0006 0.5 3 Q 979,2 0.2 0,0006 ‘ 0.6 1 - 1 000.0 [ 86 | 0*26 i 259 Total /average 2 - ioqclo" 1 83 025 f 248 3 1000,0 69 0,21 [ 207 EE PROM and Flash access The XMEGA series allows the non -volatile memory (NVM) controller to be configured to consume less power. The EEPROM and unused parts of the Flash memory can be shut down while the rest of the microcontroller is stilt active. It is more efficient to write to the EEP- ROM in page mode rather than in byte mode* Switch off WDT and CPU Switching off the watchdog timer (WDT) saves about 6 pA at 3 V; it is of course possible to keep the WDT enabled during develop- ment if needed. XMEGA devices have DMA and event features, which give more opportunities to put the CPU into sleep mode while retaining the ability to react to events. For example, a data logger can run almost entirely without CPU intervention: the RTC periodically triggers A / D conversions using the event system, and the results are trans- ferred directly to memory under DMA* The CPU can be woken only when needed, for example if the conversion result falls outside a defined window* DMA reduces CPU use by 96 % during SPI com- munication at 4 Mbps and by 57 % during UART communication at 2 Mbps. An AES encryption operation can run in an XMECA device without involving the CPU. In general, software solutions are being replaced by hardware resources, and the microcontroller should be chosen accordingly* An important factor in current consumption is software design. Use subroutines sparingly, use fast algorithms rather than those with a small memory Footprint, use look-up tables to replace slow calcula- tions, use interrupts rather than polling, and, where possible, use RCALL clektor 03-2010 63 MICROCONTROLLERS | Table 4: Low power design technique checklist for AVR microcontrollers Technique Register Fuses OK Optimise external circuitry Lower supply voltage | BODLEVEL Use picoPower/W-type/XMECA AVR device Definite logic levels at inputs: use pull-ups [ PORTx Define unused pins as inputs with pull-ups DDRx Use sleep modes SMCR Periodic operation using RTC and RC oscillator CKSEL Make active period brief and Fast CLKPR ; cKDivs — Dynamic dock switching CLKPR Use low power oscillator mode CKSEL Short oscillator start-up time CKSCL/SUT 1 Use sleeping BOD or turn BOD off MCUCR BODLEVEL Turn on-chip debugger (OCD) off OCDEN Turn DebugWI RE/ 1 TAG interface off MCUCR DWEN/|TAGEN Use power reduction register PRR | Use general-purpose I/O registers CPIO Use virtual ports (XMECA only) V PORTx Use EEPROM/Flash power reduction mode (XMFGA only) CTRLB (EPRM/FPRM) Disconnect digital path on inputs used for ADC and comparator DIDR Use ADC noise reduction mode SMCR j Use only eight ADC bits if accu rate enough I ADCSR(A), ADMUX j Turn analogue comparator off ACSR j Turn bandgap diode (Vref) off ACSR, ADCS R( AT | BODLEVEL | Tu rn watch d 0 g 1 1 m e r ( W DT) off 1 MCUSR* WDTCSrT " 1 WDTON Use event system and DMA (XM EGA only) | see datasheet Check LCD waveforms and use tow frame rate LCDCCR.LCDFRR.LCDCRA. LCOCRB j Use hardware resources rather than software Optimise software for speed; use assembler if necessary ~CPIO | rather than CALL and RjMP rather than J MR Keep frequently-used val- ues in working registers. If prog ramming in a high-level language, com- piler optimisation options can help produce faster code. This question is examined in more depth in an AtmeJ white paper 34]. LCD Some AVRs feature an LCD controller. To minimise its current con- sumption, special drive waveforms are selected and the frame rate is set as low as possible. The details are given in the device datasheet under ‘Minimising power consumption’ and ‘Low power waveform \ Using a synchronous LCD dock allows the LCD module to operate in idle and power-save modes; using an asynchronous LCD dock also allows operation In ADC noise reduction mode. In conclusion The remarks above are summarised as a checklist in Table 4. If all the suggestions are implemented it is theoretically possible, for exam- ple, to make a temperature monitor that transmits a reading every 30 seconds over a Zigbee radio network run for ten years on two AA cells. The calculation includes the current drawn by an AT86RF212 or AT86RF231 radio transceiver. Indeed, it may be difficult to find a battery with a shelf life as long as ten years! ( 090157 ) Internet Links 1 1] AVR040 - FMC Design Considerations: www.atmelxom/dyn/re- sources/prod_documents/doc! 61 9.pdf [2] AVR042 - AVR Hardware Design Considerations: www.atmel.com/ dyn/resources/prod_documents/doc252Cpdf 1 3] AVR1Q5 - Power Efficient High Endurance Parameter Storage m Flash Memory: www.atmel .com/dyn/ resources/ prod_docu ments/ dot2546.pdf \4] Innovative Techniques for Extremely Low Power Consumption with 8- bit Microcontrollers' by A.IVl Ho I berg and A. Saetrc (Atmel white pa per) : www, atmel. com/dyn / resou rces/prod_docu ments/ doc7903.pdf Andreas Riedenauer studied electronic engineering at the Technical University of Dortmund and at the Hagen distance learning university, both in Germany. He is currently a Field Applications Engineer for Atmel distributor Ineltek and also works as a visiting lecturer, technical author and seminar leader (including for the Elektor AVR workshops). His interests, besides microcontrollers, include energy harvesting* RFID, neural networks* autonomous robots, image processing, capacitive touch interfaces, cryptography and product piracy prevention. In his spare ti me he is a keen glider pilot. 64 03-2010 elektor r DISTANCE LEARNING COURSE Programming Embedded PIC Microcontrollers c=> using Assembly, C and Flowcode i n this course you will learn how to program an embedded microcontroller. We will start with the absolute basics and we will go into a lot of detail. You cannot learn about software without understanding the hardware so we will also take a close look at the components and schematics. At the end of the course you will be able to design your own embedded applications and write the appropriate software for it. Your course package: * Courseware Ring Binder (747 pages) * CD-ROM including software and example files * Application Board * Support at Elektor Forum * Elektor Certificate Contents: Background Digital Ports Serial Communication (RS232) Analog Signals Pulse Width Modulation Timers/Counters/Interrupts Memory LCD Display PC Communication SP1 Communication USB Communication Configuration (Fuses) Answers to the assignments Appendix Price: £395.00 / $645.00 / €445.00 Please note: to be? able to follow this course. E-blocks hardware is required which you may already have (in part). All relevant products are available individually but also as a set at a discounted price. Please check www.el ekto r. com j distancel ea m i n g for further information. * SWITCHING Multi Function Switch I u m ■ H B ™ Peter de Bruijn (The Metherlands) With this smart switch you can turn mains-powered devices on and off easily and conveniently. Applications such as TVs, radios, basement and outside lights and the like come to mind. Thanks to various sensor options this can also be done automatically or with a delay. In addition, this circuit also helps to save energy. The smart switch that we describe in the article is a 230-VAC or 110/115/127 VAC switch which can be used for many different applications. This can be achieved without needing to change the software for each individual application. There is a 5-pin connection on the printed circuit board where the IR receiver, the LDR t etcetera, can be connected. It is also possible to program the processor via these pins. The 'green' smart switch saves power because in any of its configurations the load Is completely disconnected from the mains after a certain time, so that the stand-by power consumption is minimised, its simple operation completes the design. Functions This switch can be used in three different ways: * as an Infrared Switch, * as a Twilight Switch or * as a Countdown Switch, The first function, the infrared switch, is ver\ useful if you have, for example, a TV which can only be switched l off into the stand-by mode. With the aid of this circuit the appli- ance can be completely switched off. By connecting the infrared switch in series with the power cable, the TV can be completely switched off, without having to sacrifice the convenience of the remote control. The system; is very simple and works with any remote control. If a button on the remote con- trol is pressed for longer than 0.4 seconds the TV will be turned on and you can zap to your heart's content. When in the on- state and a button on the remote control is pressed for longer than one second, the infrared switch wilt turn the TV off. The TV is completely disconnected ‘Tom the mains so there is a reduced risk of CAUTION The circuit is at mains potential 66 03-2010 elektor SWITCHING Pi C11 ID R11 m RIO III LDR a G C 12 HF 1(Wn 1C 3 rn TS0P1738 0 00 j£ twilight switch W 0 0 i ci ci lOfln K2 PQ^ PI ^ NI'V K1 V+ O i 3 3 > GP0 GP1 GP2 1 GP3 a 0 > ggo PIC10F206E countdown VDD TS414A MMBF170 Jm 'rei , J ± 0 --{ C „ lOKl m* [R4* 37* WPR C4* "fln X2 I pin © R11 5K6 I R12 1W L if — — -it Rl* R 3 * 2x TS4149: U 3 C5 "On V+ o IC2 10Qu 63V & L78L05ABD A IN uu 1 NC NC GND I f*>| 40 **— * C9 IQQn VDD Q CIO ItSOn CS 124 V}. When the relay rs turned on this voltage will drop down to 1 2 V. This is sufficient to keep the relay energised. It is possible that switching the relay on causes the processor to be reset. This Is because of the sudden application of the mains voltage to PO. This generates a volt- age spike. Even if R2, C4, etcetera are not fitted, the processor will still be reset. To overcome this problem, the software keeps track of which state the processor is in. A reset is recognised after which the pro- cessor nevertheless continues in the correct state. The functionality of the smart switch is therefore not affected by the reset. If you Intend to use the circuit as a twilight or infrared switch, you will have to add a little daughter board to connector K1. This connector, in addition to functioning as the expansion connector, also serves as programming interface: the PIC10F206 can be programmed via K1 with, for exam- ple, an I CD2- programmer or a Microchip Picket 2. The required connections are GND, PCD, VPP, PGC and VCC. There is no need for an external power supply when programming. If there are enthusiasts among you who would like the use the circuit for some other application, then you will have to change the software via this inter- face yourself. The PIC10F206 is very sensitive to ESD. Make sure that you place Cl as close as poss- ible to ICT* Software The design of the software is very simple, but can nevertheless be confusing because it appears that three programs are running simultaneously. The entire program just fits inside the 512 bytes that are available in its program memory. As already discussed, there are 3 functions Implemented in the software: IR switch, twi- Operating modes GP0-X GP3=1 Countdown mode GP0=<100 ms Low GP3-0 Infrared mode GP0=>10Gms Low 1 GP3=0 Twilight mode 68 03-2010 elektor SWITCHING light switch and countdown switch. The program oper- ates tn the following order: * Initialisation; * ESD recognition; * Mode selection; * IR switch, twilight switch and countdown switch. The software automatically makes a selection between t h ese th ree prog ra m s de pend- ing on what is connected to K1 , When the circuit is first turned on the signal on GP3 is checked first: * if the signal is High for 1 5 ms during the first 100 ms then countdown mode is selected. Once in count- down mode the circuit will stay in countdown mode until a reset occurs. * if the signal is Low after 100 ms and if it has not been High for 1 5 ms during these 1 00 ms then the soft- ware will switch to infrared mode. Once in infrared mode the software can choose whether twilight mode needs to be selected. To do this, the software checks the signal on GP0. If GP0 is Low for more than 100 ms then the circuit will switch to twi- light mode. Once in twilight mode the circuit will stay in that mode, in infrared mode GP0 will never be Low for more than 100 ms because the serial communication sig- nal from the remote control to the TV consists of pulses that are a few ms long at the most. The signal from the twilight LDR will never be shorter than 1 00 ms because of the electro- lytic capacitor Cl 1 (lOpF)that was added for hysteresis. Note that pin GP1 checks whether at least 24 V is avail- able. Only then can the relay be switched on. At a mains voltage of 230 VAC the volt- age available to the 5-V regulator will drop to 1 2 V when the relay is turned on. This is more than enough to keep the relay ener- gised and also saves power The switching threshold of GP0 is around CAUTION Do NOT connect the circuit Lo the mains while programming. There is a real risk that the programmer or even the PC will be damaged. Construction To enable the circuit to be made as compact as possible, so that it could be built into an adapter plug, for example, requires that the majority of components are SMD parts (see Figure 2). This means that the package for the PIC is very small, but beca use of the option of ICP (in-circuit pro- gramming) via K1 , program- ming need not be a problem. The RGB is, incidentally, avail- able from www.ThePCBshop.com. When using the countdown function, R1\ R3 and C3 are not fitted. These component locations could potentially be used to fit the two 5k6 resistors and a con- nection to switch SI . In IR and twilight modes R2, R4, 04 T D5 and D7 may be omitted. 2 V. The recommended LDR requires that the potentiometer is set to about 80 k. The relay is switched off when GP0 is High and is on when GPO Is Low (and the voltage is > 24V), H S L if n i \ 'V" - ■*- ■ ■ By the way, SI requires special attention. For safety reasons a class II push button needs to be used here. These can, however, be hard to find and are physically quite large. A practical solution is to mount a push but- ton inside the enclosure and attach a short plastic rod. This small rod then protrudes through the enclosure and acts as the push button actuator. It is also recommended to mount the PCB with plas- tic screws in a (plastic) enclosure. A final tip: to allow the cir- cuit to be safely tested it can also be powered from a (lab) power supply instead of directly from the mains. (080257-I) elektor 03-2010 MINI PROJECT Outmanoeuvred By Ton Giesberts (Efektor Labs) based on an idea by Ludovic Meziere (France) lt*s not always easy to reverse a car* There are some good reasons why modern ears are often fitted with sensors that indicate when the rear bumper comes dangerously dose to an object behind the can The circuit described here is the perfect solution to make parking easier in fixed locations, such as in a garage. Most people find it more difficult to reverse a car than drive forwards. In any case, it is much trickier to estimate how much space there is between an object and the rear bumper, and looking behind you can result in an unpleasantfeeling in your neck. A solution to this problem is the reversing aid, which indicates how much further you can drive backwards without hitting any- thing, The circuit presented here should be mounted in a fixed position, for example on the back waif of a garage. With the help of a clearly positioned visual display you can tell if you can reverse further without crashing into a walk Principles For the measurement of the distance we use a special sensor made by Sharp, the CP2D120. The sensor measures the dis- tance with the help of an !R LED that has a wavelength of about S50 nm. The output voltage of the sensor becomes less as the distance increases. The visual display of this 'radar' consists of a number of LEDs that start to flash when an object comes within range of the sensor. The closer the object comes to the sensor, the faster the LEDs will flash. A VCO (Volt- age Controlled Oscillator) has been used to Implement this. The LEDs will turn on per- manently when a minimum distance has been reached. Circuit diagram As we mentioned earlier, the CP2D120 (MODI ) measures the distance and reduces its output voltage as the distance to the object (the car) becomes greater. The rela- tionship isn't inversely proportional and nei- ther Is it linear, since the angle of reflection changes less as the distance increases. In order to properly drive the following VCO built around 1C 1 B, the signal is first inverted using SCI A , Preset PI has been added to shift the output voltage of IC1 A such that It comes completely within the operating range of the VCO. The VCO is turned on when T1 is made to conduct. This is easily implemented by con- necting the base resistor of T1 to the out- put of 1C 1 A. To make the LEDs light up con- tinuously the output voltage of IC1 A has to be adjusted with PI to be just under 0.5 V while an object is held at the required mini- 7° 03-2010 elektor ■M2V -h* IC2 IC1 = MCP6004*E/P +5V o MODI Jl lit J? mu 2SV PSD “*[ii •ftiSeEaSaitfi Of^UlT LEC '■c-L'i'jr OSi-iokutt OJT«jT CIMsfl GP2D120 2 © 12V © 3V6 T VV3 G7 78L05 $ 4 (N 220 u 25V +5V Q ^2 5~ — r C6 @ !C1 10u (5) 53V y C5 1 DC r R13 Di +5V BAT85 9 ^ i. BAT85 R8 H 47 Qk h K1 fp Q Pi BAT85 _ RI2 R14 47f H S 1 D o j aSOv" | 1N40Q7 DP I 3 m.sgu DP2- ft 133 3^ TtHDu asv *5V til 1 GO Li +$Y P? PO (JV D 20V o- 52.0 P -5 000» 0JJJj)Ji 3 SV 0 2 1 X 23V t ' S2.C * ■Q aixjv if ( / - 6 - IN* Veil Oman PJL1 LED/S % HKJ*. lx Moiai ii By jean Herman (Belgium) The instrument described here lets you check that zener diodes up to 200 V are working correctly, and it lets you find out the reverse breakdown voltage of an unknown zener diode (note that zener diodes are only called zeners from 2 V to 5,6 V — those above 5.6V ought strictly speaking to be referred to as 'avalanche diodes \ as the avalanche effect then becomes predomi- nant) The voltage stability of a zener diode depends on its internal resistance and its temperature coefficient, ft's for this reason that this tester lets you measure them at various currents. The internal resistance can be calculated from f? - dV/di. The d/ is achieved by sub- jecting the diode under test to two dif- ferent currents (e.g, 10 mA and 5 mA), d/ Is the difference between these two cur- rents (= 5 mA), By measuring the voltage in both cases (let's say 6.6 V and 6 .3 V), we can determine dV (6.6 V - 6.3 V = 0,3 V) and hence calculate the value of R |NT (0.3/0.005 31 60 Q). A zener diode's temperature coefficient depends on its reverse voltage. For a diode of less than around 5.6 V, the temperature coefficient is negative, around 5.6 V it is zero, and above 5,6 V it is positive (not for all device brands). We can determine it by measuring the voltage across the diode and the diode’s temperature with a con- stant current (10 mA) passing through the diode* The device has two voltage ranges. 0-20 V and 0-200 V. which requires at least two different transformers. To generate the required voltage differences, we have three small standard transformers* Transformer TR3 is only used to provide a 5 V dc supply for the digital voltmeter module. Switch S2 (A to D) is the 4-gang voltage range selector, and also has a central ‘off 1 position* 20 V position Transformer TR1 feeds a bridge rectifier via the 20 V position of S2A This produces a DC voltage of around 32 V. The BD244 tran- sistor is wired as a constant current genera- tor. Switch SI .A changes the emitter resis- tor in order to generate three different cur- rents: 5 mA, 1 0 mA, and 50 mA. The current generated by the BD244 can be calculated roughly as: Usr" M3-4V)- (0.6 V) /emitter resistor A 20 V zener diode (select on test) limits the output voltage to 20 V (or if possible to 19.9 V) so as to avoid saturating the digital voltmeter. A 1EM4007 diode in series with the current generator output avoids short- ing out the measurement circuitry. In this case, 52, C is also in the 20 V position* 200 V positron Switch S2*A redirects the 24 V AC voltage to transformer TR2, which steps the voltage up from 24 V to 230 V. This is just an ordi- nary 230 V/ 24 V 5 VA transformer. The bridge rectifier here produces a DC voltage of around 250 V. The BF470 transistor is also wired as a constant current generator* It’s not easy to find high-voltage PIMP transis- tors - the BF470 is a type used as a video driver for CRTs. Here again, switch 51. B this time changes the emitter resistor in order to generate three different currents: 1 mA, 5 mA, and 1 0 mA (see calcufation above). These currents are lower, as the diodes have a higher voltage. But at 1 0 mA and 200 V, that still means the BF470 transistor has to dissipate 2 W with the output shorted — i.e, fora 200 V zener. 0 V position Note that selector S2 also has a middle posi- tion where nothing is switched. With this device, you can also test the insu- lation of ordinary diode, as well as gas regu- lator tubes like the OA2, 082, etc, and VDR varistors (some are polarised). The meas- urement accuracy of the voltmeter will give the true value of the zener voltage and the temperature drift of the device voltage. Selector 52. D changes the module’s decimal point position between 19.99 V and 199,9 V — though the sensitivity always stays the same at 1 99,9 mV. Don't forget to remove the solder bridge which is fitted by default on the voltmeter module's P3* (090181) elektor 03-2010 73 INFOTAINMENT Hexadoku After last month’s curious format using the character set i through G we’re back to normal again with the Elektor Hexadoku challenge. Crack the puzzle, send the hexadecimal numbers in the grey boxes to us and you automatically enter the prize draw for four Elektor Shop vouchers. Have fun! The instructions for this puzzle are straightforward. Fully geared to electronics fans and programmers, the Hexadoku puzzle employs the hexadecimal range 0 through F. In the diagram composed of 16 x 16 boxes, enter numbers such that all hexadecimal numbers 0 through F (that’s 0-9 and A-F) occur once only in each row, once Solve Hexadoku and win! Correct solutions received from the entire Elektor readership automa- tically enter a prize draw for one Elektor Shop voucher worth £ 80.00 and three Elektor Shop Vouchers worth £ 40.00 each, which should encourage all Elektor readers to participate. in each column and in each of the 4x4 boxes (marked by the thicker black lines), A number of clues are given in the puzzle and these determine the start situation. Correct entries received enter a draw fora main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. Participate! Before April 1 , 2010, send your solution (the numbers in the grey boxes) by email, fax or post to Elektor Hexadoku - 1000, Great West Road - Brentford TW8 9HH United Kingdom, Fax (+44) 208 2614447 Email: hexadoku@elektor.com Prize winners The solution of the January 2010 Hexadoku is: 26FB4. The E-blocks Starter Kit Professional goes to: Martin Mil Her (Switzerland). An Elektor SHOP voucher goes to: jean Philippe Poket (Belgium); Jean Pierre Vandecandelaere (Belgium); Raimund P. Neubauer (Switzerland), Congratulations everybody! 1 3 8 D 4 E B 4 6 0 F C 3 9 A 8 3 6 0 C 2 7 8 F E 8 E B 5 4 F 9 C 7 1 0 2 6 F D 5 A 8 D B 7 4 1 0 3 E 2 3 D C 4 B C B E 1 0 8 2 8 1 B C 5 9 F D B 7 0 6 E A D 8 C 1 8 D 7 2 A E A F 0 5 3 2 5 8 0 7 1 B 9 9 D 4 E 1 7 A 9 4 0 5 C 3 D F 6 1 7 2 it} PZZJ, tern 4 9 E 7 C 8 F 3 2 5 D A B 0 1 6 1 5 2 C 9 4 A 6 0 7 B F E 8 D 3 6 D 0 3 B E 1 7 C 4 9 8 F 5 A 2 8 B A F D 2 5 0 E 3 1 6 9 7 4 C 0 4 C 9 F 6 3 E D B 5 7 8 A 2 1 B 6 F 5 4 0 8 9 A 1 2 3 C D 7 E 7 8 3 1 5 D 2 A 6 E F C 4 B 9 0 2 A D E 1 7 C B 4 9 8 0 6 3 F 5 I A 0 B 4 3 1 9 C F 8 E 5 D 2 6 7 D [C 5 2 6 F B 4 7 A 3 9 0 1 E 8 9 3 7 8 E 5 0 2 1 D 6 4 A C B F E F 1 6 7 A D 8 B [iC 0 2 3 9 5 4 F 7 6 B 0 C 4 D 3 2 A 1 5 E 8 9 C 2 9 0 A B 7 5 8 '6 4 E 1 F 3 D 3 E 8 A L 2 9 6 1 5 F C D 7 4 0 B 5 1 4 D 8 3 E F 9 0 7 B 2 6 C A The competition is not open to employees of Elektor International Media, its bu slness partners and/or jmc-c in ted publishing houses. 74 03-2010 elektor g ^ktor " u * NDVi. ngf* EW» W1V1E to wsstNiPU ldwid« electrons 5 §282 |M)g ; t ,'„ h So | t a tm ****«, * Jennie JN51 48 ZigBee Development Applications * Training Platform available (± AVIT RESEARCH www.avit research .co.uk USB has never been so simple... with our USB to Microcontroller Interface cable. Appears just like a serial port to both PC and Microcontroller, for really easy USB connection to your projects, or replacement of existing RS232 interfaces. See our webpage for more details. From £10.00. BETA LAYOUT www.pcb-poolxoni Beta layout Ltd Award- winning site in both English and German offers prototype PCBs at a fraction of the cost of the usual manufacturer's prices. BLACK ROBOTICS www.bfackrobotics.com Robot platforms and brains for research, hobby and education, Make your robot talk! TalkBotBrain is open-source Free robot speech software Robot humanisation technology Mandibot Gripper Robot ByVac www.byvac.com * PIC32 With BASIC * ARM With Forth * USB to I2C * Serial Devices * VT1GG LCD Displays DECIBIT CO.LTD www.decibit.com • Development Kit 2.4 GHz • Transceiver riRF24L01 • AVR MCU ATmega168 CEDA www.ceda.in ceda@vsnl.com -learninq pJsGRO $5 Hourly • PCB Layout @ S5 Hourly • Learn PCB Designing with Multimedia DVD in QrCAD, PADS & ALLEGRO • Self or e-learning with support by email, phone & web-meeting DESIGNER SYSTEMS http://www.designersystemsxo.uk Professional product development services. • Marine (Security, Tracking, Monitoring & control) • Automotive (AV, Tracking, Gadget, Monitoring & control) • industrial (Safety systems, Monitoring over Ethernet) • Telecoms (PSTN handsets, GSM/GPRS) • Audiovisual ((HD) DVD accessories & controllers) Tel: +44(0) 845 5192306 , no h ill' EASYDAQ www. easydaq .biz t * * USB powered, 4 relays + 4 DIO channels •Will switch 240VAC @ 1 0 A * LabVIEW.VB, VC, C#, Java * Screw terminal access * Free shipping • From £33 Design & supply of USB. Wireless, LAN, Internet & Serial Relay. DIO & DAQ products. info@easydaq.biz EASYSYNC X " http://www.easysync.co.uk w EasySync Ltd sells a wide " range of single and multi- " % f? port USB to RS232/RS422 and RS435 converters at competitive prices. 0 ELNEC www.elnec.com * device programmer manufacturer * selling through contracted distributors all over the world * universal and dedicated device programmers * excellent support and after sale support * free SW updates * reliable HVV * once a months new SW release * three years warranty for most programmers FIRST TECHNOLOGY TRANSFER LTD, http://www.ftt.co.uk * Training and Consulting if ^ to r IT, Em b edd ed an d Trans ter ltd Real Time Systems * Assembler, C, C++ (all levels) * 8,16 and 32 bit microcontrollers * Microchip. ARM. Renesas, T3, Freescale * CMX, uCOSfl, FreeRTOS, Linux operating systems * Ethernet, CAN, USB, TCP/IP Zigbee, Bluetooth programming FLEXIPANEL LTD wwwJEexipanelxom TEAclippers - the smallest PIC programmers in the world, from £20 each: • Per-copy firmware sales • Firmware programming & archiving • In-the-field firmware updates • Protection from design theft by subcontractors FUTURE TECHNOLOGY DEVICES http ://w w w: ftd ich ip , co m FTD1 designs and sells USB-UART and USB- FIFO interface i.e.’s. Complete with PC drivers, these devices simplify the task of designing or upgrading peripherals to USB Instruments A Rohde & Schwarz Company 0 Oscilloscopes 0 Power Supplies 0 Radio Frequency Measuring Instruments 0 Programmable Measuring Instruments Great Value in Test & Measurement www.hameg.com HEXWAX LTD www.hexwaxxom World leaders in Driver-Free USB IDs: * U SB - U ART/SPI/I2C bridges * TEAleaf-USB authentication dongles * expandID-USB I/O USB expander * U SB -FileSys flash drive with SPI interface * USB- DAQ data fogging flash drive 78 03-2010 eiektor products and services directory LONDON ELECTRONICS COLLEGE http://wwwJeaorg.uk Vocational training and education for national qualifications in Electronics Engineering and Information Technology (8TEC First National, Higher National NVQs, GCSEs and GCEs). Also Technical Management and Languages. RFID COMPONENTS http/www.apdanglia. org.uk For DIY, OEM's a Experimenters • EM41Q0 Cards .99 p (Prices inc vat) • Keyfobs £1 .09 • R/WKeyfobs £ 1,65 • RFID Coils £2.95 • RFID PCR with RS232 port * RFID IC s EM4095 - U2270R * microRFID module (similar to Core ID1 2) * Free Reader download - Technical pages Order online 24 hrs - Tel: 01 244 520684 www. elektor. com MQP ELECTRONICS www.mqp.com * Low cost USB Bus Analysers * High. Full or Low speed captures * Graphical analysis and filtering * Automatic speed detection * Bus powered from high speed PC * Capture buttons and feature connector * Optional analysis classes ROBOT ELECTRONICS http: if www. ra bot- e I ect ron i cs .co . u k Advanced Sensors and Electronics for Robotics * Ultrasonic Range Finders * Compass modules * Infra-Red Thermal sensors * Motor Controllers * Vision Systems * Wireless Telemetry Links * Embedded Controllers WWW. ROBOTIQ http://www.roboiiq.co.uk Build your own Robot! Fun for the whole family! Now. available in time for X-mas • Arduino Starter Kits 1\IEW!I* • Lego NXT Mindstorms • Affordable Embedded Linux Boards • Vex Robotics (kits and components) • FOB Robots (kits and components) email: sales@robotiq.co.uk Tel: 020 8669 0769 USB INSTRUMENTS h it p : //www. usfa - 1 n stru m ents . co m USB Instruments specialises in PC based instrumentation products and software such as Oscilloscopes, Data Loggers, Logic Analaysers which interface to your PC via USB. VIRTINS TECHNOLOGY www.vlrtins.com PC and Pocket PC based virtual instrument such as sound card real time oscilloscope, spectrum analyzer, signal generator, multimeter, sound meter, distortion analyzer LCR meter. Free to download and try. SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business. Showcase - a permanent feature of the magazine where you will be able to showcase your products and sendees. For just £242 + VAT ( £22 per issue for eleven issues) Elektor will publish your company name, website address and a 30- word description For £363 + VAT for the year (£33 per i ss ue fo r e I e ve n issues) we w ill p u bl i s h the above plus run a 3cm deep full colour image - e g. a product shot, a screen shot from your site, a company logo - your choice Places are limited and spaces will go on a strictly first come, first served basis. So-plcase fax back your order today! ■ ■ a nan l ■ bb b j b j bii ■ u ■ a ■ ■■■■■■■■■■ b j bb ■ a aa I a ■ bb'BB bb b i bb ra k b n b ibis rats pbi pi p i a B a a a ■ b ■ m i an bb bb bb bb bb bb ■ ■■■■■■■ i bb bb bb ■ b ■ b ■ bb. bb b b r b Bit! bb p a a- s p a -a b B a 4 e B a a a BB r B B- B B' B B' B B' P B BB BB'BB BBB-EB-BB-PBBB B ■# + rr. I wish to promote my company, please book my space: * Text insertion only for £242 + VAT * Text and photo for £ NAME J a i! 1 i T !L ,1 a B B 1 BJ. BB BJ fa B fa B BBBBBBI BB BB'BB BB BB BB BB BB BBBBB-B'BB-BEBBB'rs-BBB-STBB-P-^P + P-* 1 JOB TITLE:. I B B B B B I fl B BB BB B B B B P B BB PB BB BB PB r B B B B- B B P B H + ? + • + ■ 1 1 + 1 * 1 t t P 1 ■ P *■ ■ ■*■ P p B .fa B J- B J. ■ J BJ BJ ■ j"\ D D RE S S' . r ..... .. .J.J .... ........ ..... .... . a .1.1. 1.1.1. . J .. n . .. .... ....... .. .. a . i 3 + VAT ......ORGANISATION:.... ■ BB'BB BB BB B B B* B B" B B" H B BB'BB PB J . fa Bj J. B J. B J BJ.BJ B I B ■ fa I BJ BJ IIBBBBBBBB B B- B B- P B- B B - -P B * p - » ■§ P B "P + + B + 4 B B + P 4 -P +*4 b - *■ - l 1 * i + I * I * B * B J. I ■ BJ faj faj faJJ BJ fa l ajfajfajfajBjfaj iHMIil TFI ■ I - % 4 - P B P B B- P 4 “ “ ” “ PB BP “B “BfB-BB — - B--TBB.BB'BB'PB PB BBB'BB'BB P- BB BB BB'Pi'BB — ““PBB i B - P - P - - - - --- PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 00-44-(0)l932 564998 COMPANY NAME V -■ X/ Ll I J n j b Ji l II 1 J. T 4 ini u n it ii*m itii i»n im n ranti t itii b*bb bi bipitip Bf ib bpis pb rai a bbbi ....fa.fafafajfajfajifa - - - - B a p. a .fa a i WPR ADDRESS T T Lj ILjF J Is J a 1 X J— ■ pJ V J BTiiiTPtr + H-H + i'iiMTiti + H" 30- WORD DESCRIPTION PB BBB-B P B B B B- B B !" -P H B - B B B P B BB BB-PB 4 -P*P 4 P 4 P - - B BB P 4 4 - - P«-PP 4 -« 4 "B 4 -P 4 BB B - ■ I t B B I » I * HI t M P ■* P 4 *■ * P ■ » pb bb b 4 bb ra ra-rS + a + 4 + S + a + pJ PI B ■* ■ ■ ■ J PJ BJ BJ BB faBJ BJ BBJ. BJ BBBB BB BB rB BB BB PB PB -. ____.fa_.faJ.BJ.fa_.BJ fa fa fa fa fafa fa fa fa fa fa m .1 fa J B B Bil B B B B BBBB B B B!> fl li B B BB BBB-B j.„-- T _f__fafa.Bfa.faJ fafa fafa fafa fafa fafa fafa. fafa fafa |-BPBB-B-B- + --*-a.»- B q « ■ r b ■ ■ ■ bi a ■ a a r a b a a a a a ■ a r ■ -p ■ "B a * b t - b * a- r p M H M + * ■ M*b*bjibbbibii ■ ■ mm m a ra ra r a -p b -r b a- b a- - » P 4 - P 4 - p 4 4 fa - - fafafafafaBj fa J fa fa fafa faJJ-fa fa fa J- - i + M*C + M fafa fafa fa fa. fafa fafa faj BJ faj faj fafafafafaBj ■ J. B J faj faj La.LBJ-BJIBillBJiBJ'B'l BB BB BB BB BB BB BB'B BBBBBB-BB E + § + ►+ = 4 H H P + + PB pbBbpbpbpb Bi + a + 8#'*# *■“ PB PBB-BB-B + B + g + fc + ba HM + ? + • 4 ■ * P 8 B 4 - P 4 MH M M 4+M + i + ltl+Mtltlt* BJ.BJ.BJ fa J elektor 03-2010 79 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES Jahrgang Annee Jaargang Anual Complete your coiiku 20% DISCOUNT PER elektpr.com WWW A world of electronics from a si All articles from Elektor Volume 2009 on DVD-ROM DVD Elektor 2009 The year volume DVD/ CD-ROMs are among the most popular items in Elektor's product range. This DVD-ROM contains ail editorial articles published in Volume 2009 of the English . American , Spanish. Dutch, French and German editions of Elektor* Using the supplied Adobe Reader program, articles are presented in the same layout as originally found in the magazine. An extensive search machine is available to locate keywords in any article. With this DVD you can also produce hard copy of PCB layouts at printer resolution , adapt RGB layouts using your favourite graphics program, zoom in / out on selected PCB areas and export circuit diagrams and illustrations to other programs. ISBN 978-90-5381 -251 -S * £17*50 ■ US 523.30 1 1 0 issues, more than 2,1 00 articles DVD Elektor 1990 through 1999 This DVD-ROM contains the full range of 1990-1999 volumes (all 110 issues) of Elektor Electronics magazine (PDF). The more than 2.100 separate articles have been classified chronologically by their dates of publication (month/year), but are also listed alphabetically by topic. A comprehensive index enables you to search the entire DVD. I5BW 973-0-905705-76-7 £69,00 * US $11130 See the light on Solid State Lighting DVD LED Toolbox This DVD-ROM contains carefully-sorted comprehensive technical documentation about and around LEDs. For standard mod- els, and for a selection of LED mod Liles, this Toolbox gathers together data sheets from all the manufacturers, application notes, design guides, white papers and so on. It offers several hundred drivers for power- ing and controlling, LEDs in different con- figurations, along with ready-to-use modules (power supply units, DMX con- trollers, dimmers, etc.). In addition to opti- ca! systems, light detectors, hardware, etc., this DVD also addresses the main shortcoming of powder LEDs; heating. This DVD contains several Elektor articles (more than 100) on the subject of LEDs. ISBN 978-90-5381 -245-7 £28,50 * US$46.00 8 o Prices and item descriptions subject to change. E* & 0,E 03-2010 elektor Modern technology for everyone FPGA Course FPGAs have established a firm position in th e mode rn el ec t ron I cs d esig ne r's too I kit. Until recently, these ‘super components' were practically reserved for specialists in high-tech companies. The nine lessons on this courseware CD-ROM are a step by step guide to the world of Field Program* mabie Gate Array technology. Subjects covered include not just digital bgic and bus systems but also building an FPGA Webserver, a 4-channel multimeter and a USB controller. The CD also contains PCB layout files in pdf format, a Quartus man- ual, project software and various supple- mentary instructions. ISBN 9 78-90’ 5331 -225-9 £14.50 * US S 2 3.40 Completely updated Elektor’s Components Database 5 The pro g ra r n package co ns i sts of eight data- banks covering Its. germanium and silicon transistors, FETs, diodes, thyristors, triacs and optocouplers. A further el even applica- tions cover the calculation of, for example, LED senes droppers, zener diode series resis- tors, voltage regulators and AM Vs. A colour band decoder is included for determining resistor and inductor values. ECD 5 gives in- stant access to data on more than 69,000 components. All databank applications are fully interactive, allowing the user to add, edit and complete component data, ISBN 978-90-5381 -15.9*7 £24.90 * OS $40.20 V J elektor 03-2010 Look into the electronics of eco- power Practical Eco-Electrical Home Power Electronics This book is a sequel to Tour own Eto- Electrical Home Power System and goes deeper into the electronics of photovol- taic and thermal solar technologies, wind power conversion, inverter circuits, and bads such as electronic lighting. Power electronics circuit theory is presented while analyzing commercial circuits, including little-known converters and subtleties such as snubbers and leakage inductance. The book also offers in-depth coverage of power system strategizing for optimal efficiency and utility, inclu- ding a 1 70 V DC bus, commercial solar charger design with detailed circuit explanations, wind generator electric machine electromechanical theory, wind converter design requirements and the 5 er ie s- L zero - cu men t-sw itching con ve rter and power supplies found inside loads connected to home power systems and their potential problems and conse- quences for inverters. 192 pages * ISBN 978-0-905705-33-5 £24.90 * US $40.20 v J More information on the Elektor Website: www.eIektor.com Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel: +44 20 8261 4509 Fax: +44 20 8261 4447 Email: 5ale5@elektor.com Home electric power Your own Eco-Electrical Home Power System This book provides the semi-technical, power- co ns do us homeowner a place to begin in the quest forhome electric power. Both the essential principles and detailed information on how to build or maintain a home electric system off the utility grid are presented i n an easy-goi 1 lg style. This booklet will help you to safeguard or de- velop y 0 u r own ho m e e feet ri d ty su pply.lt contains step-by-step calculations, practi- cal details, exam ples and much more. 96 pages * ISBN 978-0-905 7G5-82-S £16*50 * US$26.70 PIC Cookbook for Virtual I nstru mentation Several case studies included PIC Cookbook for Virtual Instrumentation The software simulation of gauges, con- trol-knobs, meters and indicators which behave just like real hardware components on a PC’s screen is known as virtual instru- mentation. in this book, the Delphi pro- gram is used to create these mimics and PIC based external sensors are connected via a USB / RS232 co nverte r co m m u n teat ion link to a PC Case studies of virtual instruments a re detailed including a compass, an oscillo- scope, a digital and analogue thermometer and virtual displays for cars and aircraft. 264 pages » ISBN 978-0-905705-84-2 £29.50 * US $47.60 81 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES r (February 2010) Circuit design and programming Complete practical measure- ment systems using a PC This book covers both hardware and soft- ware aspects of designing typical embed- ded systems based on personal computers running the Windows operating system , It k s use of modern techniques in detailed, numerous examples has been designed to show dearly how straightforward it can be to create the interfaces between digital and ana tog electronics, programming and Web-design. Readers are encouraged by examples to program with ease; the book provides dear guidelines as to the appropri- ate programming tech niques "on the fly 1 ’. 292 pages ■ ISBN 978-0-905705 79*B £2850 ■ US $46.00 A variety of remote control devices for Winamp and other PC-based media pla- yers have been available for a good while. All of these systems have one thing in common, which is that they are limited to buttons or keys or use virtual progress bars on the computer monitor. If you want to have a complete hardware interface unit with the same level of sophistication as the virtual Winamp design, you need a physical progress bar. In this project a small ATmega microcontroller uses the USB interface to provide a bidirectional link between the Winamp software and a hardware studio fader, which acts as a combined indicatorand entry device. Kit of ports, including PCS Learn more about C# programming and .NET C# 2008 and .NET programming This book is aimed at Engineers and Scien- tists who want to learn aboutthe .NET en- vironment and t# programming or who have an interest in interfacing hardware to a PC. The book covers the Visual Studio 2008 de vel o p m ent e n vi ron m ent . the « N ET f ram e wo rk a nd C # prog ra m mingla ngu a ge from data types and program flow to more advanced concepts including object ori- ented programming.. 240 pages * ISBN 978-0-905705-81 -1 £29,50 * US $47,60 An r* 0*90531 -71 * £35.00 * US S143.6 i*i MLAC for Home Automation (January 2010) AM 1AC is an industrial programmable lo- gic controller (PLC) that can be used in a wide variety of electronic systems. Inter- nally it has a powerful 18F4455 PIC micro- controller which is connected directly to a US8 port. As a result it can be easily pro- grammed using either Flowcode, C or as- sembly. The article in Elektor's January 2010 issue shows howto implementate a simple home automation system with an alarm by using three MIACs, Populated PCS in enclosure ,Vrt. 09027 8-91 * £ J 54, till * US $248,49 (December 2009) Elektor's Software Defined Radio (SDR) is deservedly popular. The performance of a receiver depends to a large extent on its input filters. A selective input circuit im- proves antenna matching and immunity to interference from other strong signals. This preselector allows the use of up to four filters, tuned under software control using varicap diodes. A tuned loop anten- na is also described that lets you use our SDR without an outdoorantenna. Kit of parts, contains portly populated board , coil formers , ferrite rod with coils (September 2009) The compact OBD2 Analyser in the June- 2007 issue was an enormous success - not surprising for an affordable handheld onboard diagnostics device with auto- matic protocol recognition and error codes explained in plain language. Now enhanced with a graphical display, Cortex M3 processor and an Open Source user interface, the next generation of Elektor's standalone analyser sets new standards for a D!Y OBD2 project. The key advan- tage of this OBD2 Analyser NG is that it' s self-contained and can plug into any OBD diagnostic port Kit of ports including DXM Module, PCB SMO-prefitted, cose, mounting materials and coble Art# 09G451-7I 4 £84,00 * US 5135.50 V J 8a Prices and item descriptions subject to change. E. & O.E 03-2010 elektor r i i March 2010 (Mo* 399) £ USS + + + Product S h or 1 1 r s t March: See www.elektor.com + +■ + February 2010 (No. 398} Battery Checker 071131-41 .... AT mega32-1 6PU, programmed ............. 1 7.80 28.80 071131-71 .... Kit oF parts, end. enclosure .....www.dektor.com Winamp Controller 090531-71 ....Kit of parts ■ r ■ ■■-■ ii ■ ■■ ■ i a ■ i ■ ■ m it ■ pti ■ i ■ ■ ■ i-i ■ r rh r ■ r i ■ fe i ■ r i ■ ■ n ■ r ri ■ ■ a ■-■■■ 1 1 ■ 89.00 143,60 The ATM1 8 Radio Computer 090740-71 .... PCB with 51473 4/35 radio 1C ready mounted and tested... 27.50 44.40 January 2010 (No, 397) USB Magic Eye 090788-1 Printed circuit board 9.00 .16,00 090788-41 .... ATtiny2313-20PU. programmed 9.90 16.00 M I AC for H o me Au to mat ion 090278-91 .... Populated PCS in enclosure 1 54.00 248 .40 Dimmer with a Micro 090315-41 .... PIC12F629A, programmed 7.60....... 12.30 Dece m ber 2009 (No. 396) Preselector for Elektor SDR 090615-71 .... Kit of parts . co nta i ns parti y pop u I ated board , coil formers, ferrite rod with coils... 47.00 75.90 Top-of -the-E il t Li g hts Segu ence r 0901 25- 1 ...... PCS, bare (master module)... 1 0.80 1 7.50 0901 25-2 PCB, bare (lamp module). 2.30... 3.80 090125-4 1 Controller (PIG 8F2550) for main PCB. programmed . 1 4.50., 23.40 0901 25-42,., Controller (PIC1 2F508-I/5NJ for lamp unit, programmed 2.30 3,80 The Vikings Are Coming! 080948-7 1 .... Kit of parts: bare PCB and bluetooth module BTM222 * „ 23.70 38,30 MEnimalistic Time Switch 090823-41 .... P1C12F683-I/SN, programmed 6. 50 ....... 10.50 November 2009 (No. 395) Solder Station ’Plus' 090022-41 .... PIC1 8F4520. programmed 1 1.50,. 18.60 AVR-Max Chess Computer 081101-1 Printed circuit board 1 2 . 90,., .,..20.90 081 101 -41 .... Programmed controller ATmega88 1 1.50 1 8.60 081101-71 ....Kit of parts incl.PCB, prog ram med contro Her and com po n e n ts 29.90 48 ,30 R32C Web Server 080082- 71 . . . . Ap plicatio n Boa rd wt th SM D pa r ts p refitte d , plus all other components 1 24,50 200.90 080928-91 .... R32C Starter Kit: processor board populated and tested, Toolchain on CD 27.00 43.60 0906U7-71 .... PCB, populated and tested WIZ81 2MJ module with W51 00 chip... 18.00, 29.10 October 2009 (No. 394) Pocket Preamp 080278-71 „„ Kit of parts ■ HiHiHiiiirniriaii rri r i ta-i iMiHictOir ■ - fa-fen fa H HiMJMs fa-i i-i i 65,00 104,90 Digital Barometric Altimeter 080444-41 .... PIC18F2423, programmed...., 15.00 ..24.20 September 2009 (No* 393) R32 C App licati on B o a r d 08 008 2 - 7 1 .... Kit o f pa rt s i n c lud ing A ppl i catio n Boa rd with SMD parts prefitted, plus all other components 1 24.50 200.90 080928-91 R32C Starterkit: Processor board populated and tested, Toolchain on CD 27. 00...... .43. 60 J O o CO 2 3 4 5 1 O 0£ I D 3 PIC Cookbook for Virtual Instrumentation ISBN 978-G-905705-S4-2. £29.50 US$47,60 Complete practical measurements^ a pc ISBN 978-0-905705-79-8.... £28.50 U5S46.00 Practical' Eco-Electrical Home Power Electronics ISBN 978-0-905705-83-5.... £24.90 US S40.20 C# 2008 and .NET programming ISBN 978-0-905705-81-1 .... £29.50 US S47.60 Your own Eco-Electrical Home Power System ISBN 978-0-905705-82-8..,. £1 6.50 US S26.70 DVD El ektor 1990 through 1999 ISBN 978-0-905705-76-7.,,. £69.00 ...US$1 1 1 .30 DVD LED Toolbox ISBN 978-90-5381 -245-7.... £28, 50 USS46.00 FPCA Course ISBN 978-90-5381 -225-9.... £14.50 US$23.40 ECD 5 ISBN 978-90-5381 -159-7.,.. £24,90 US$40.20 Ethernet Toolbox ISBN 978-90-5381-214-3.... £19.50 .... USS31.50 SDR Preselector Art. #09061 5-71 £47.00 US$75.90 R32C/1 1 1 Starterkit Art. # 080928-91 £27.00 US $43.60 MIAC for Home Automation Art. # 090607-91 £1 54.00 ...US $248.40 WinAmp Controller Art. #090531-71 £85.00 ...US $143.60 R32C Application Board Art. #080082-71 £1 24.50 ...US $200.90/ Order quickly and securely through www.elektor.com/shop or use the Order Form near the end of the magazine! Elektor Regus Brentford 1 000 Great West Road Brentford TWS 9HH * United Kingdom TeL +44 20 8261 4509 Fax +44 20 8261 4447 Email: sales@elektor.com dektoi 03-2010 83 COMING ATTRACTIONS NEXT MONTH IN ELEKTOR SMD Tweezers S u re. S M D parts a re wid ely used and accepted for high volu me productio n , but increasing ly in prototypes and DIY projects also. In view of the small size, It’s useful to have purpose designed tweezers available for manual positioning of these tiny parts. Several Ingenious test instruments are on the market that allow the value of the SMD part to be 'seen 1 while you hold it in the tweezers. For the April 2010 issue we've tested a number of these tools, including all-in-one SMD tweezers as well as meters with a separate pair of tweezers. Universal Benchtop Supply An a djusta b le power supply is a m ust-ba ve i instrument if you’re serious about you r experi- ments in the electronics lab — preferably a symmetrica! supply, with clear meters for out- put current and voltage. Our small switch-mode supply allows these wishes to come true fairly easily. The circuit supplies o to 25 V at up to 3 A with voltage and current controls. Depending on your requirements, either one or two boards can be built for a benchtop supply with single or dual output supplies. Wireless OBD-2 Analyser The l OBD Analyser NG S published last September Is a great tool for extracting data and fault conditions from motor vehicles. Now we present an extension to this module that allows the control and readout of OBD data to be handled wirelessly from a laptop PC. This allows vehicle data to be captured and logged in a file while driving. We regret that "AT Mi 8 VisiOLED" could not he published in the March 20 10 issue as planned. Art stir titles and magazine content s suhjec 1 10 change: phase check the Magazine tab an mvw.efefcf-or.com tlektor UK/Lurapean edition: 00 safe March 18. 2010. Elektor USA edition: published March it, 2010. vww.elektor.com www.elektor.com www.elektor.corr Elektor on the web All magazine articles back to volume 2000 are available online in pdf format. The article summary and parts list (if applicable) can be instantly viewed to help you positively identify an article. Article related items are also shown, including software downloads, circuit boards, programmed ICs and corrections and updates if applicable. Complete magazine issues may also be downloaded. In the Elektor Shop you’ll find all other products sold by the publishers, like CD-ROMs, DVDs, kits, modules, equipment, tools and books, A powerful search function allows you to search for items and references across the entire website. elektor LET YOUR GEEK SHINE Id, lb* liOi •HTTtlMilL spark fun Hogaiini Shop suhi Lritw flow ■twi Also on the Elektor website: Electronics news and Elektor announcements • Readers Forum PCB, software and e-magazine downloads • Time limited offers FAQ, Author Guidelines and Contact ,# i rrfurrnJli,* arytlri v Pfftjecll lawcnad ttcrnjrli'ri', tr*** IlqkK- (tf.njnlp kit rtjt c .-nfliK-Ti faj-ii.ir: Jj'J ’j.hk'i- v ; * C&- v vti 4 PMum V, L-3'Kk» ,j. e v Uffei-t u Ck-i:l3r * 5v*K':prt-.| SUM Ijppmilifl •Tl'WtWiEBn# p,«K‘ 149 t *Tfl / C SC E!£EH[MJbl Pi0^r,nttifling EmbodiiEft PIC Wicrccunl rollers Kit of p.irt-s EEekt«Wt>^E>l ’rtW Mil r.rifti njiq bhc* d i i»Sril ifie r* tr-o ii«Ul fIsvt 1"" E«!E' r^Ltf Eb*ti HldiEja: O 1 Biprv nr rtdrina • Flare to?' ana as* a Mfl* mM«S MSfl) *K*Mn»l I I L.'Z fmt 84 03-2010 elektor Description Price each Qty. Total Order Code DVD Elektor 2009 £ 1 7.50 PIC Cookbook for Virtual Instrumentation £29.50 Complete practical measurement systems using a PC £ 28 . so Practical Eco-Electrical Home Power Electronics £24.90 Your own Eco-Electrical Home Power System £1 6,50 Sub-total Prices and item descriptions subject to change. The publishers reserve the right to change prices P&P without prior notification. Prices and item descriptions shown here supersede those in previous issues. E. & O.E. To tat paid Name METHOD OF PAYMENT (see reverse before ticking as appropriate) I i Bank transfer l~~] Cheque (UK-resident customers ONLY) □ Giro transfer □ □ Expiry date: Verification code: Please send this order form to ' (see reverse [or conditions) Elektor Regus Brentford 1000 Great West Road Brentford TW8 9HH United Kingdom Address + Post code Email Date Signature E103 let: +44 20 8263 4509 Fax: *44 20 8261 4447 www.elektor.com sales&tolektor.com USA and Canada residents should u^e $ prices, iind send the- order form to: Elektor US 4 Park Street Vernon C T 06666 USA Phone: 860-875-2199 F.ix: 860-871*04 1 1 E -mad: v> I es 1,1 elckinr.com Yes, I am taking out an annual subscription to Elektor and receive a free 2GB MP3 player*. I would like: □ □ Standard Subscription (1 1 issues) Subscription-Plus (1 1 issues plus the Elektor Volume 2010 DVD-ROM + exclusive access to www.elektor-plus.com) ' Offer available to Subscribers tvrio have not held a subscription to Elektor during the last 12 months. Offer subject to availability : See reverse for rates and conditions. Nome Address + Post code Tel. Email Date Signature METHOD OF PAYMENT (see reverse before ticking as appropriate) □ Bank transfer | | Cheque [UK- resident customers ONLY) I ' Giro transfer □ V^SA □ nmnnmnnnnn Expiry date; Verification code: Please send this order form to Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom to!.: +44 20 8261 4509 fox: +44 20 8261 4447 www. e. i e k t or.com su b s cr i p t ro nstp e le kto r. co m EL03 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 Features Board Autopiacement & Gateswap Optimises 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. 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 I levels of the Proteus Design Suite include a world class, fully integrated shape autorouter at no additional cost - prices start from just £150 exc. VAT & delivery 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