PC Oscilloscopes <& Analyzers DSO Test Instrument Software for BitScope Mixed Signal Oscilloscopes 4 Channel BitScope 2 Channel BitScope Pocket Analyzer Digital Storage Oscilloscope Up to 4 analog channels using industry standard probes or POD connected analog inputs. Mixed Signal Oscilloscope Capture and display up to 4 analog and 8 logic channels with sophisticated cross-triggers. Spectrum Analyzer Integrated real-time spectrum analyzer for each analog channel with concurrent waveform display. Logic Analyzer 8 logic, External Trigger and special purpose inputs to capture digital signals down to 25nS. Data Recorder Record anything DSO can capture. Supports live data replay and display export. Networking Flexible network connectivity supporting multi-scope operation, remote monitoring and data acquisition. BitScope DSO Software for Windows and Linux BitScope DSO is fast and intuitive multi-channel test and measurement software for your PC or notebook. Whether it's a digital scope, spectrum analyzer, mixed signal scope, logic analyzer, waveform generator or data recorder, BitScope DSO supports them all. Capture deep buffer one-shots or display waveforms live just like an analog scope. Comprehensive test instrument integration means you can view the same data in different ways simultaneously at the click of a button. DSO may even be used stand-alone to share data with colleagues, students or customers. Waveforms may be exported as portable image files or live captures replayed on other PCs as if a BitScope was locally connected. BitScope DSO supports all current BitScope models, auto-configures when it connects and can manage multiple BitScopes concurrently. No manual setup is normally required. Data export is available for use with third party software tools and BitScope's networked data acquisition capabilities are fully supported. Data Export Export data with DSO using portable CSV files or use libraries to build custom BitScope solutions. www . bits cope . com enou 1 1 1 j— 1 4- T~ 1 1 t— 4 1 1— 1 1-4 1 r- 1 1 l -t- l 4 1 J— j — -h- i H — 1 4- 1 4 1 4-, l 4- l 4 I f- _L_ 1 _L_ 1 J 1 Memory trime bu ,lt-, n Discover Deep Memory Performance. Due to memory constraints, traditional digital storage oscilloscopes don't have the capability of displaying a complete electronic signal at a high sample rate. The GDS-1000A Series uses MemoryPrime technology to overcome the problems associated with memory constraints. Able to display complete signals with greater detail, the GDS-1000A Series can maintain a high sample rate over a wider horizontal range, without affecting performance. Challenge yourself to go deeper, GDS-1000A ! GDS-1000A Series Digital Storage Oscilloscope • 150/100/60 MHz Bandwidth, 2 Input Channels • Sample Rates up to lGSa/s Real-Time Maximum, 25Gsa/s Equivalent-Time • 2M Points Record Length Maximum • 2mV~10V Vertical Scale, 1 ns~50s Horizontal Range • Up to 27 Automatic Measurements • USB and SD Interface Supported For more information about the advantages of MemoryPrime technology, visit our website at www.memory-prime.com or consult your local distributor. GOOD WILL INSTRUMENT CO., LTD. No. 7-1, Jhongsing Road, Tucheng City, Taipei County 236, Taiwan T +886-2-2268-0389 F +886-2-2268-0639 E-mail: marketing@goodwill.com.tw Gffi inSTEK Made to Measure since 1975 www.instek.com lektor electronics & microcontrollers All solar power charged For the first time in the history of Elektor we have examined the practi- cal use of small solar cells specially designed (it seems) to charge batteries for mobile equipment like cell phones, navigation aids and PDAs. The range of commercially available products is large, and with no sidewalk or power lines in sight for miles around, a solar charger seems to be the only viable alternative to lugging spare batteries over cliffs and mountains. These chargers operate wherever sunlight is plentiful, they do not leave waste behind and do not consume natural resources in use. On the down side, the prices are still high considering what you get terms in terms of watts out, which also tend to drop instantly and dramatically with anything less than full sunshine. Less known are the practical value and quality of the products available in this relatively new area. As a positive outcome of tests car- ried out by the Elektor labs, genuine doubts on our part regarding certain electrical specifications found in the product catalogues were not sub- stantiated. Overall, with the modules tested, the rated output power stated with 1 00,000 lux worth of sunshine is rarely achieved in our neck of the woods (western Europe) where the skies seem to default to cloudy. Still, the specified data appears to be cor- rect and the output power that can be achieved at realistic light intensity levels can be 'downsized' from the rated value with a fair amount of confidence. This month our editorial focus is on energy (mostly electrical as that is our specialty) and at least two articles in this issue show how electronics can contribute to saving natural resources, especially within the 'great outdoors' context: our Campsite AC Monitor on page 62, and ElektorWheelie on the centerfold. Sure, the Air Ioniser mini project on page 74 is for indoor use but it should help to disperse stale air and make you feel healthier at home, too. However, it's no match for a brisk walk along the cliffs, or an excursion in the woods exploring the trails! Jan Buiting Editor Especially on somewhat longer trips in sun drenched countries, a portable so ar panel can come in very handy to ensure that you always have enough power for your mobile phone, iPod, GPS receiver, and even the car battery. 26 True RMS Digital Voltmeter r he module described here displays the frequency and RMS amplitude of a signal on a two-line LCD panel. The circuit can also be used as a stand-alone true RMS voltmeter with frequency measurement. Thanks to a new controller board with a powerful ARM processor and a new, robust Z-axis with floating head you can upgrade your existing Profiler milling machine to a 'Pro' version. The software has also been adapted to take advantage of this and has many improvements and new features. Profiler Pro CONTENTS Volume 35 June 2009 no. 390 We selected some of the products currently available in this area and checked what they have to offer. 58 Power in the Pocket (1 ) Here we present a very compact class-D amplifier that can be powered from four AA batteries and because of its relatively high efficiency can elicit quite a few decibels from a loudspeaker. 62 Campsite AC Monitor Camping hook-ups for power line supplies usually have a limit on the amount of current that can be drawn. When a larger current is drawn it trips a fuse, which most likely has to be reset by the campsite manager and which probably results in a fine (or 'service charge') to be paid. To prevent such inconveniences we have designed this controller that can quickly limit the maximum current drawn. projects 26 True RMS Digital Voltmeter 34 Automatic Running-in Bench (3) 40 Profiler Pro 44 ElektorWheelie 46 ATM1 8 = RFID Savvy 58 Power in the Pocket (1 ) 62 Campsite AC Monitor 61 The Three-Quid Light Box 68 Getting Started with Em- bedded C (2) 74 Air Ioniser info & market 6 Colophon 8 Mailbox News & New Products 8 Portable Solar Modules 80 ElektorSHOP 8^ Coming Attractions infotainment 55 BeeProg-i- in use at Elektor 73 Hexadoku 76 Retronics: Hewlett Packard Model 3 3 00 A function generator (1969) TOR ELECTRONICS WORLDWIDE elektor international media Elektor International Media provides a multimedia and interactive platform for everyone interested in electronics. From professionals passionate about their work to enthusiasts with professional ambitions. From beginner to diehard, from student to lecturer. Information, education, inspiration and entertainment. Analogue and digital; practical and theoretical; software and hardware. Volume 35, Number 390, June 2009 ISSN 1 757-0875 Elektor aims at inspiring people to master electronics at any personal level by presenting construction projects and spotting developments in electronics and information technology. Publishers: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 www.elektor.com The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor is published 1 1 times a year with a double issue for July & August. Elektor is also published in French, Spanish, American English, German and Dutch. Together with franchised editions the magazine is on circulation in more than SO countries. International Editor: Wisse Hettinga (w.hettinga@elektor.nl) Editor: Jan Buiting (editor@elektor.com) International editorial staff: Harry Baggen, Thijs Beckers, Eduardo Corral, Ernst Krempelsauer, Jens Nickel, Clemens Valens. Design stct Antoine Authier (Head), Ton Giesberts, Luc Lemmens, Daniel Rodrigues, Jan Visser, Christian Vossen Editorial secretariat: Hedwig Hennekens (secretariaat@elektor.nl) Graphic design / DT Giel Dols, Mart Schroijen Managing Director / Publisher: Paul Snakkers Marketing Carlo van Nistelrooy Subscriptions: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+44) 208 261 4509, fax: (+44) 208 261 4447 Internet: www.elektor.com/subs 6 elektor - 6/2009 r / Low-cost development system with a USB interface All the big electronics manufacturers supply micro' controllers offering a wide range of functions. Texas Instruments supplies handy USB evaluation sticks with related software for its low-cost MSP430 controllers. Unfortunately the I/O facilities are somewhat limited. These can be substantially enhanced with the help of the Elektor MSP430 board! [-jlektor L^Sshop r Together with Rotterdam's Technical College Elektor developed a low-cost development system that should appeal to those of you just starting out into microcontroller land. The basis of the system is the MSP-eZ430 USB-stick from Texas Instruments, a chip graced by a free develop- ment platform and a programming language (C). The associated experimenter's board easily accommo- dates the hardware for the project examples like a buzzer, a 7-segment display, some LEDs and pushbuttons. Specifications * • Experimenter's board with several I/O possibilities • Powerful 1 6-bit MSP430F201 2 controller running at 1 6 MHz, 2 KB Flash and 1 28 bytes RAM • 4 indicator LEDs • 7-segment display • Piezo buzzer • 3 pushbuttons • I2C/SPI connector • Powered via the USB stick or an external adapter Order in the Elektor Shop PCB, populated and tested Art.# 080558-91 • £35.00 • US $55.00 Tl eZ430-F201 3 Evaluation Kit Art.# 080558-92 • £24.50 • US $35.00 Further information and ordering at www.elektor.com/mspboard w Email: subscriptions@elektor.com Rates and terms are given on the Subscription Order Form. Head Office: Elektor International Media b.v. P.0. Box 1 1 NL-61 1 4-ZG Susteren The Netherlands Telephone: (+31 ) 46 4389444, Fax: (+31 ) 46 43701 61 Distribution: Seymour, 2 East Poultry Street, London EC1A, England Telephone:+44 207 429 4073 UK Advertising Huson International Media, Cambridge House, Gogmore Lone, Chertsey, Surrey KT1 6 9AP, England. Telephone: +44 1932 564999, Fax: +44 1932 564998 Email: p.brody@husonmedia.com Internet: www.husonmedia.com Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photo- graphs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software carriers and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopy- ing, scanning an recording, in whole or in part without prior written permission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may ex- ist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publisher to alter the text and design, and to use the contents in other Elektor International Media publications and activities. The Publisher cannot guarantee to return any mate- rial submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2009 Printed in the Netherlands 6/2009 - elektor 7 ia W Making printed circuit boards for electronic designs is an art. Many a designer is regularly confronted with the difficulties associated with producing prototype PCBs. To make things easier for our readers and anyone else who may need a PCB for some reason, Elektor has joined forces with Eurocircuits to launch Elektor PCB Service. 0^0 o° o o o o .0^0 OO o o° ^ o W \ O o^ ° Vo^ o0 ^°l o°o\ ^ oO o O ^ o X% % >•.»; \ -,«0 0 0 r k (v> ■ 0 ® 0 0 0 -O e k 1 l qO q * 0 °o V 0 0 ° < fiiL. 2 o' \0 J rtO° o O n O O P o 0\0 0 ° o° o o _ 0 o >r^* N Elektor PCB Service is a new service from Elektor. You can have your designs con- verted into a professional-quality PCBs via the www.elektorpcbservice.com web- site. Elektor PCB Service is intended for prototype builders and designers who want to have their PCBs made to profes- sional standards, and for users who want customised versions of Elektor PCBs. If you need a couple of 'protos' with fast turnaround or a batch of 5 to 50 units, we can meet your needs at a favourable price. When you place your order, simply send us a WinZip file containing the Ex- tended Gerber files (RS274X format) of your layout. Most layout programs can generate Gerber files in this format. - Available to private and commercial customers. - No film charges or start-up charges. - There is no minimum order quantity or charge for this service, and all prices include handling and shipping charges. - Choice of double-sided or four-layer PCBs. - The PCBs are professional quality, finished with an industrial (lead-free) finish with two solder masks and one silkscreen overlay. - The supplied layout must be in RS274X format. Almost every popular layout program can produce files in this format. - After your project has been checked and found to be producible (which will be reported to you within four hours), your PCBs are produced after receipt of payment. - In case of a prototype order, you receive two PCBs sent to you five working days after receipt of payment. In order to sup- ply two PCBs, we make three. If the third board is also good, you receive it as well -free of charge. - In case of a batch order (any quantity from 5 to 50 boards), your PCBs are shipped ten working days after receipt of payment. - You can use our online payment module to pay easily, quickly and securely with Visa or MasterCard. Procedure available for everybody! To keep costs as low as possible, Elektor PCB Service employs a fixed production process. There is no room for exceptions here. All information in text documents or other instruc- tions that do not comply with the specifications of this service will be ignored (such as a second silkscreen overlay, other solder mask colours, material specifications, con- struction, etc.). For this reason, please do not send any other data along with your order. We produce your PCBs ac- cording to the data in the files that you send with your order (the layout data in the Extended Gerber files and the Excellon drilling data). This data must comply with the following specifications: - Minimum track width and track clearance: 150 pm - Minimum restring on outer layers: 125 pm - Minimum restring on inner layers: 175 pm - Smallest hole (finished): 250 pm - Two solder masks (green) - One silkscreen overlay (white) - Outline and internal milling, to the extent that this can be done with a 2-mm milling cutter - Lead-free finish (our choice of chemical silver, chemical nickel-gold, or lead-free HAL) - FR-4 RoHS-compliant material with standard construction - Minimum dimensions 20 x 20 mm; maximum dimensions 425 x 425 mm 1 Create your account pi I . -B ™ n> - ' — «r «P fcn ***** * * r ( ‘ t ^ - W- lektor lf‘€ D 'jfr# c r PC&arnto cod- Tfldt («**• ■‘rmrr ■# mn 7 r 1 n< J#i.- «Vr- - ip ■ l M fa** hb-wi Pr < '■ r la r*i"T -i- .*•**•. r*m' h-« »- bf-i* a WM+s l*-r 0 Ui n*. AJTji fc— wi w - hi - m Mn. uu ia-w Ik# 14 b im |Wp ^ s *#■» -* ’** tow >*to 4* V i I *++* wtf j* ■». ■ *•* ■■ w rHP «ip%^ w r » “ l « * jin Q: mj p- fr: -3 f.d£cdl,= 3 jj»w pmr Ci I* llMara x'k.r % ■ O m • hn- to* m • » #< «* 'to ton 4 to V •«*#•! I *« •! >«M |44 O •*-*•*• C rittoPI IMT* »-*r-n | tpfe* Id * « " t* f“ 'r-«“ >4 7* 4*0 • ' llektor proforma invoice Itch ^..r. 9 The first step in the procedure is to visrt^ www.elektorpcbservice.com and create your account (note: this site does not use the same accounts as the Elektor magazine website). Be sure to enter your address data correctly. This is essential to ensure that you actually receive your boards! For access to the site, use your e-mail address as your user name together with a password of your own choosing. To place an order, click the Order button. Click Order PCBs to navigate to the order page. Select the Proto tab to order a set of two prototype boards, or select the Batch tab to order a batch of PCBs of the same type (5 to 50 (max.) units). Click the Calculate button to see the calculated order price. For the actual order, you must submit your project files in Extended Gerber format (RS274X). Within four hours, Elektor PCB Service will advise you whether we can produce your project. If we cannot execute your job, you w ill rec eive a report stati ng the reason for our refusal, along with some suggestions for suitable modifications to your data. Before we process your order, you must pay our pro-forma invoice. You can pay with Visa or MasterCard under Pro-forma Invoice by clicking the Pay Invoice Online button. After we receive your payment, we schedule your PCBs for production. lektor PCB Service Your prototype boards are shipped to your postal address five working days after receipt of payment. The turn-around time for batch orders is ten working days. INFO & MARKET NEWS & NEW PRODUCTS New: mikroC PRO for PIC® 2009 Belgrade-based mikroElektronika have recently launched a new C compiler for PIC® microcontrollers: mikroC PRO for PIC 2009. The IDE features project-based design and supports an impressive range of PIC microcontrollers. mikroC PRO for PIC 2009 offers a set of libraries which simplify the initiali- sation and use of PIC MCU and its modules including libraries for ADC, CAN, CANSPI, Compact Flash, EEPROM, Ethernet, Flash Memory, Graphic LCD, l 2 C, Key- pad, LCD, Manchester Code, MMC/SD Card, OneWire, Port Expander, PrintOut, PS/2, PWM, RS-485, Sound, SPI, Graphic LCD, UART, USB HID, Standard ANSI C, T6963C GLCD, Miscellaneous, SPI and more ... MikroC PRO for PIC also has plenty of practical examples and a comprehensive set of documen- tation which allows a quick start in programming PIC devices. PIC hardware development tools that completely support mikroC PRO for PIC 2009 are also available. A fully functional demonstration version (hex output limited to 2 K of program words) is available on the mikroElektronika website. www.mikroe.com (090410-11) Touch-sensing controls on new washing machines Cypress PSoC®-based CapSense Plus™ solution has been selected to control the touch-sensing buttons in the new AWOE Premium Collection line of wash- ing machines from Whirl- pool. The flexible solution is claimed to offer leading noise immunity and water- resistance to deliver uninter- rupted operation in the harsh sensing conditions prevalent in household appliances. Cypress' touch-sensing products have resulted in over 2.5 billion mechanical buttons replaced in mobile handsets, laptops, con- sumer electronics, white goods, automotive applications and more. Engineers can take now advantage of PSoC flexibility to implement functions beyond CapSense — a capability called CapSense Plus. The Whirlpool AWOE Premium Collection washing machines feature 6 th -Sense technology, which recognises the size of a load and automatically adjusts resources to ensure optimal per- formance, saving up to 30% on time, water and energy. The CapSense Plus capability specifi- cally controls the 6 th Sense indica- tor lighting on the main display. The durable, user-friendly interface in the Whirlpool line employs one CapSense Plus device to imple- ment 14 buttons and drive LEDs in the rotary dial control. A second device in the control display pow- ers eight buttons, LED backlighting with dimming functionality and a buzzer. www.cypress.com /go/ capsense. www.whirlpool.com. (090410-III) Gumstix: OMAP35x modules and expansion Gumstix expanded its tiny Overo™ computer-on-module (COM) series with the addition of Overo Fire, Overo Water and Overo Air. Two new expansion boards were also released to provide the addi- tional options of an LCD with touch screen options and 10/100baseT Ethernet. The Overo series consist of four different modules that are based on Texas Instruments (Tl) OMAP35x applications proces- sors with an ARM Cortex™-A8 CPU. Each Overo COM operates at 600 MHz and includes 256 MB RAM, 256 MB NAND Flash and a microSD card slot for additional on-board memory. The tiny modules (17x58x4.2 mm) run Linux kernel 2.6.28 or higher and developers have access to extensive online software docu- mentation. The Overo modules are pin-compatible, which means each expansion board fits every Overo. The popular Overo Earth is based on Tl's OMAP3503 Applications Processor that features an ARM Cortex-A8 CPU. Overo Air provides the same fea- tures and function as Overo Earth while adding WLAN and Blue- tooth® capabilities by way of the on-board W2CBW003 module from Wi2Wi. Overo Water has been devel- oped with the high-perform- ing Tl OMAP3530 Applica- tions Processor instead of an OMAP3503. The OMAP3530 adds the TMS320C64x+ DSP and OpenGL® ES graphics engine to boards for Overo series the Cortex CPU to enhance applications designs with such features as a smart user interfaces and photo-realistic graphics. Overo Fire builds on the OMAP3530- driven Overo Water by providing WLAN and Bluetooth communications through the same Wi2Wi module as used on Overo Air. Since each Overo is a computer- on-module and easily expandable, design engineers can leverage the Overo to get their new prod- uct ideas to market much faster than building from scratch. As such, each Overo COM is recom- mended for integration into com- mercial products projected to sell up to 50,000 units each year. www.ti.com/omap35x www.gumstix.com (09041 0-IV) 10 elektor - 6/2009 LED-based street lights and night lighting in Portugal BlueSpan recently announced that it has developed and imple- mented the first solid-state street lighting solution in Portugal along the Fidalgo Aprendiz in Pombal City, using LUXEON® Rebel LEDs. The new street lights are approxi- mately 60% more efficient than the most common High-Pressure Sodium lamps that were initially considered to replace the actual Mercury Vapor lamps installed. Both high pressure sodium and various LED solutions were origi- nally considered as replacement options. Ultimately a Luxeon Rebel based design consuming ess than 80 watts of power was selected because of the compelling energy sav- ings, high effi- The street lamp technical design was the result of a coopera- tive development effort Philips Lumileds and optics expert Fraen. Working closely with teams from BlueSpan and Future Light- ing Solu- tions, the ciency, uniform light dis- tribution and long lifetime that could be delivered. complete system came together in a very short period of time and offers excellent performance. With a revolutionary new optical solution that ensures uniformity and reduces glare, a correlated color temperature tuned for the environment, and a 7-year war- ranty, the new street light is being considered for broader imple- mentation through the country. BlueSpan: Tel. (+351) 234 639 230 www.philipslumileds.com (090410-1) 0.7 Volt tinyAVR microcontroller Atmel® introduces the first AVR® microcontroller with an inte- grated boost converter: the ATtiny43U. The boost converter ena- bles the device to oper- ate from a supply voltage as low as 0.7 volts. With the ATtiny43U it is now pos- sible to develop simple, low- cost and trouble-free applications that are small in size and operate from a single AA, AAA or similar battery. Like all tinyAVR microcon- trollers, the ATtiny43U integrates several fea- tures and benefits. It has a 4-channel 10-bit ADC, two 8-bit timer/counters, a temperature sen- sor and an USI on-board. For on- chip debugging an debugWIRE interface was implemented. The controller has 4 Kbytes Flash memory, 64 bytes EEPROM and 256 bytes SRAM. The ATtiny43U is available in 20- Pin QFN and SOIC package at MSC. www.atmel.com (09041 0-V 36 Krpm, 27-bit optical encoders Renishaw's new RESOLUTE™ opti- cal encoder system is the world's first true absolute encoder capable of 27-bit resolution at 36,000 rpm. The fine-pitch system offers excel- lent dirt immunity, while delivering market-leading resolution of just 1 nanometer at up to 100 m/s, for both linear and angle encoding applications. Using a unique single-track optical scale, RESOLUTE acquires abso- lute position immediately upon switch-on - without battery back- up - simplifying machine design by completely eliminating the need for reference returns. The sys- tem's ruggedness, ultra-high speed capability and exceptional resolu- tion make it ideal for high-perform- ance lathes, as well as slower-mov- ing axes requiring the highest lev- els of precision and motion control integrity. The RESOLUTE absolute encoder uses sophisticated new optics to read a fine-pitch, 30-|jm scale, resulting in exceptionally low noise levels (jitter <10 nm R J for out- standing positional stability. The enhanced detection technology intrinsically provides a very low sub-divisional error (SDE) of ±40 nm. The result is better sur- face finish of machined parts from CNC machine tools, better scanning and velocity control, and rock-solid servo stiffness on linear motors or rotary direct- drives when holding position. The unique 'single- track' combines both the absolute position and embedded phase informa- tion into a single code, eliminat- ing the de-phasing problems that can occur with dual-track scales when small amounts of angular misalignment are introduced. The single-track design allows far wider set-up tolerances for quick and easy installation and superior long-term reli- ability, even if the motion axes settle or move over time. An integral set- up LED on the read- head further simpli- fies installation and diagnostics. www.renishaw. com/encoders (09041 0-VI) 6/2009 - elektor 11 INFO & MARKET NEWS & NEW PRODUCTS Development Kit for Plug-and-Play Touch Screen GUIs Amulet Technologies supply a com- plete, self-contained development kit for the implementation of inter- active, touch-screen graphical user- interfaces (GUI) in new or legacy embedded systems, based on the company's 'Plug-and-Play' interac- tive Color GUI 1C. Amulet's AGB75LC04 Color GUI 1C is a fully-integrated, stand-alone, single-chip GUI sub-system that inte- grates an ARM7 core with a 24- bit, 800x600 pixel LCD controller, resistive touch-screen controller with 4- or 5-wire interface, 160 Kbytes of SRAM, SDRAM controller, power management controller, standard communications interfaces, GPIO and Amulet's embedded Graphi- cal Operating System. The Graphi- cal Operating System supports 8-bit alpha blending with up to 24-bits of full color, or up to 256 shades of gray, for photo-realistic graph- ics and a high-resolution PC-like appearance. The LCD controller supports up to 800x600 pixel TFT and STN displays. Communication interfaces includeIX) High-speed USB, TWI, UART and SPI. The Colour GUI 1C operates inde- pendently of the embedded system, requiring no MCU-cycles. It can be deployed in new or legacy embed- ded systems in a week or less via a simple UART connection. There is only a very small amount of code to be written on the applica- tion side in order to implement the Amulet protocol. Amulet's royalty- FREE, embedded Graphical-OS manages all graphics rendering and servicing of user interaction with external input devices such as touch buttons, slid- ers, or touch screens. Amu- let's Graphical- OS eliminates the need for conventional operating sys- tems such as Win CE or Linux that would typically be required to run an interactive GUI. The STK-480272C GEM develop- ment kit consists of a 480x272 TFT display with integrated touch panel and a controller board with Amu- let's Color GUI 1C with embedded Graphical-OS, 32 MBit DataFlash memory for graphics storage and 64 Mbit external SDRAM, Amulet development tools and sample GUI source code. The kit also includes a 5 V DC power supply, stylus, and USB PC interface cable. The STK-480272C GEM Develop- ment Kit is available now for an introductory price of $299. The GEM Compiler and GUI Operat- ing System is included in the kit, with no licensing fees for produc- tion. The AGB75LC04 Colour GUI 1C is available now in 208-PQFP with 17 GPIO and 225-ball LFBGA with 39 GPIO. www.AmuletTechnologies. com/GEMDemo (09041 o-vm) ViewPort Software V 4.1 for Propeller micro Parallax is now selling ViewPort Software (Standard and Ultimate versions). ViewPort, developed by Hanno Sander at MyDanceBot. com, is the premier debugging environment for Parallax's 8-cog multiprocessing Propeller micro- controller. The tool combines an integrated debugger with power- ful graphics that show you what's going on within the Propeller. You can monitor variables over time with the built in oscilloscope or change their value while your Propeller is running. You can also solve hardware problems with the logic analyzer at sampling rates up to 80 Msps, or ad intelligence to your programs with the fuzzy logic module or integrate computer vision using the OpenCV library. Both Standard and Ultimate ver- sions come equipped with a debugger. The Standard version is lowspeed (up to 1 1 5 Kbps) while the Ultimate version is high- speed (up to 2 Mbps) and includes OpenCV (state of the art computer vision processing), Development Kit, and Designer (customize the graphic instrumentation via drag and drop). ViewPort can be integrated into any Spin program. It requires one cog and a single line of code at the start of your program. It's easy to get started with plenty of tutori- als, videos and documentation. ViewPort is also configurable and extensible so you can customize it to your needs. The Propeller chip makes it easy to rapidly develop embedded applications. Its eight processors (cogs) can operate simultaneously, either independ- ently or cooperatively, sharing common resources through a cen- tral hub. Three programming languages are available: C (via ICC for Pro- peller), the easy-to-learn high-level Spin (native), and Propeller Assem- bly (native), which can execute at up to 160 MPS (20 MIPS per cog). ViewPort is available for purchase from Parallax or MyDanceBot.com. Standard version: $59; Ultimate version: $149 plus shipping. www.Parallax.com (search 'ViewPort' or 'Propeller' http://www.mydancebot.com ( 090410 -VII) * juu t." .urnnrrii^-mnn.iu _ rr .wmimiiuunnr .if TUI" ~su * r-^i p — n t* i f j r i — n J-1|LU Ii-sn j m y m ottl U r~- ftt nitrn.|j pi 1 7 T.t* . rs<-^ 13 4 * 5 fr i <• >a r i > A - j 1 L£M*3£f i " i it u La J ■§!- ry*ji - Tilt ;Vl* I:; I-’ K ft ll id m tr « a wmiK 'cub if n if n ip p ■■ r *:■ n n \\# th *> M ti M ft II -V II -Y ** tf N H II M II a v: r r. Pl'IifaH W 4 fr K 12 elektor - 6/2009 QUASAR electronics Quasar Electronics Limit' PO Box 6935, Bishops Stc CM23 4WP, Tel: 08717 1 Fax: 07092 United Kingdd [77168 03496 E-mail: sales@quasarele Web: www.quasarelectrc ed rtford m ctronics.com nics.com (EU) - £8.95; R^st of World - £ nline for reduced price UK Pd & Packing Options (Up to 0.5 Delivery - £4.95; UK Mainland Postage 3-7 Day Europe !Order We accept all major cr^dit/debit cards to Quas Please ;ar Electronics, visit our online projects, modules and Prices include shop now for c| publications Credit Card UK Standard ery - £9.95; Kg) ( 0x11) Tx_ID = 0x10; // Check overflow ♦endif ♦ifdef N0DE2 if (Rx_ID = 0x10) { // Check if this is our message PORTB = RxTx_Data[0] ; // Display incoming data on PORTB RxTx_Data[0] = RxTx_Data[0] « 1; // Prepare data for sending back if (RxTx_Data[0] = 0) RxTx_Data[0] =1; // Reinitialize if // maximum reached Delay_ms(10) ; // Wait for a while CANSPIWrite (Tx_ID, &RxTx_Data, 1, Can_Send_Flags) ; // Send one byte // of data back } ♦endif ♦ifdef N0DE3 if (Rx_ID = 0x11) { // Check if this is our message PORTD = RxTx_Data[0] ; // Display incaning data on PORTD RxTx_Data[0] = RxTx_Data[0] » 1; // Prepare data for sending back if (RxTx_Data[0] = 0) RxTx_Data[0] = 128; // Reinitialize if //maximum reached Delay_ms(10) ; // Wait for a while CANSPIWrite (Tx_ID, &RxTx_Data, 1, Can_Send_Flags) ; // Send one byte //of data back } ♦endif } else { ♦ifdef N0DE1 ErrorOount++; Delayms (10) ; if (ErrorCount > 10) ErrorCount = 0; Tx ID++; // An error occured, wait for a while // Increment error indicator // Wait for 100ms // Timeout enquired - process errors // Reset error counter _ // Switch to another message if (Tx_ID > 0x11) Tx_ID = 0x10; // Check overflow CANSPIWrite (Tx_ID, &RxTx_Data, 1, Can_Send_Flags) ; // Send new message . -w V' } ♦endif } } } Microchip®, logo and combinations thereof, PIC® and others are registered trademarks or trademarks of Microchip Corporation or its subsidiaries. Other terms and product names may be trademarks of others. Portable power for people on the go Harry Baggen (Elektor Netherlands Editorial) With the summer coming up, many of us are again making preparations for recreational trips in the great outdoors. Especially with somewhat longer trips, a portable solar panel can come in very handy to ensure that you always have enough power for your mobile phone, iPod, GPS receiver, and even the car battery. We selected some of the products currently available in this area, and here we describe what they have to offer. We all lead very busy lives these days. When we're not stressing ourselves out at work, we're busy with projects at home, sports, or attending meetings of the local foot- ball club. It's thus no wonder that many people look for a chance to relax and restore their balance when they have a few days off. For many people, this means spending a day hiking, or even going hiking for several days, with only a backpack and the bare essentials. In many cases, during your trip you often discover that it's not so easy to do without all the conveniences of modern Figure 1. Many portable solar panels come with an extensive set of adapters. life. It can be very handy to occasionally call someone with your mobile phone or check your GPS receiver to see where you are. During long trips, this can lead to problems with your collection of battery-powered devices, because their battery life is often relatively short. The solution in such cases is to take along some spare batteries, or perhaps a portable solar panel. If you choose the latter option, you can also choose from a variety of portable solar panels presently available. There are even small solar panels that can be placed behind the window of a caravan or the windscreen of a car to main- tain the battery charge while the vehicle is parked. We chose several models of both types and subjected them to closer examination. We wanted to see what they can do and how useful they are in practice. Types The available solar panels can be roughly divided into a few categories. For instance, there are fixed panels that are intended to be used for topping up a car battery in a car or caravan. In most cases, you can simply put a panel of this type behind a window and connect the included cable directly to the battery or plug it into the cigarette lighter socket. Depend- ing on its dimensions, a panel of this type can supply a current of 100 to 1000 mA. These panels are reasonably priced, and the smaller models are well suited to powering a small stand-alone circuit or a home-made garden lamp. Another category consists of portable solar panels. These models are specifically designed to be easy to take along on a trip, such as a hiking trip. Folding and roll-up panels are available, with or without an integrated battery pack. The battery pack (often a rechargeable lithium-ion battery) has a built-in charging regulator and can be connected 18 elektor - 6/2009 ▼ V // T # T T D if* i \ / xA 1 \ / ill directly to the solar panel. When the battery pack is fully charged, it can be used to charge or power other devices, such as a mobile phone. For this purpose, many of these chargers come with a broad selection of adapters for con- nection to the most popular types of portable devices. Various adapters are also included with the models that do not include a battery pack, so that external devices can be connected directly to the solar panel. In this case, you should pay careful attention to the required supply voltage. Technology Most of the solar panels examined for this article are fitted with thin-film solar cells fabricated using vapour-deposition technology. The manufacturing cost of this type of solar cell is relatively low, but it has lower efficiency than monocrystalline or polycrystalline solar cells. The advantage of thin-film solar cells is that they are relatively flexible, which makes them quite suitable for use in foldable and roll-up panels. Every solar panel consists of a group of solar cells con- nected in series to obtain the desired output voltage, such as eight cells for an output voltage of approximately 4.8 V (each cell has an output voltage of 0.6 V). The maximum output current depends on the size of the individual cells. Most panels intended to be used in or on a car or caravan are made from a large sheet of glass or transparent plastic that forms the base for the solar cells. With portable solar panels, the solar cells are laminated between plastic sheets and fitted in a frame made from nylon or a similar mate- rial, with the connections formed such that they can bend with the frame. How well do they work? How much power can a solar panel supply? Can you use it to charge a car battery, mobile phone or iPod, or even to power a laptop computer? This depends primarily on the size of the panel and the amount of sunlight available. The surface area of the solar panel in many small battery charg- ers is very small, so the time required to charge a pair of penlight cells can be rather long. Solar panels are usually specified in terms of the amount of power they supply. For this article, we generally limited our attention to panels rated at less than around 1 0 W (with a few exceptions) to keep everything reasonably comprehen- sible, but much larger panels are also available. The panel power specified by the manufacturer is usually achieved with illumination corresponding to a specified Figure 2. A light meter calibrated in lux is indispensable for measuring light intensity. For our measurements, we used a Voltcraft LX- 11 08 provided by Conrad Netherlands. 6/2009 - elektor 19 INFO & MARKET SOLAR PANELS standard spectrum and a light intensity of 100,000 lux. At central to northerly European latitudes, this requires a bright summer day with a cloud-free sky, which means that the panel will supply much less power under 'normal' weather conditions. To give you an idea, on a sunny day with a light overcast the supplied power can easily decline to 50-70% of the rated value. With partially cloudy weather, it drops to 20-40%, and with full cloud cover and no direct sunlight it decreases considerably more to around 2-10%. These are very rough values, but they give you an approximate idea of what you can expect in terms of power yield. If you take your holiday in Africa, you can draw a lot of power from your solar panel, but if you take your holiday here at home, you may have to make do with much less power (but of course, here you can find an electrical receptacle on almost every street corner). In practice, this means that a solar panel rated at a few watts will unquestionably have to lie in full sunlight for sev- eral hours in order to charge a small battery. You are thus forced to stay put during this period. A handy alternative here is a backpack with a built-in solar panel, and we examined one example of this sort of solution. A solar panel with a matching battery pack is a good com- bination. This configuration often includes a charging regu- lator to optimise the use of the available power. Although these combined packages are a good deal more expensive, you can unfold or unroll the solar panel while you take a break without having to connect your mobile phone or other device directly to the panel. In the evening, you can then use the battery pack to charge your mobile phone or GPS receiver at your leisure. Practical experience To get an idea of how well the various panels work, we tested them outdoors on a bright blue spring day (light inten- sity approximately 75,000 lux) with various loads. Under these conditions, most of the panels managed to deliver around 75 to 90% of their rated power. In particular, the roll- up panel from Powerfilm, the foldable 6.5-watt panel from ME 2 , and the solar panel case from ELV scored very high. The 'car panels' also performed reasonably well. Unfortu- nately, the two Solar products proved to be under-achievers, with a maximum output of around 70% of their rated power. They obviously need to spend more time in the sun. We made all these measurements on a bright spring day. The results are not nearly as nice on a cloudy day, when the output can easily drop to around a tenth of the rated power. This is something that you have to bear in mind. Prices Is a portable solar panel a reasonable investment? The prices of standard panels are fairly attractive, with small models rated at around 2 watts available for around 30 pounds/ euros and up. However, the practical utility of such models is questionable. Foldable and roll-up models are generally a good deal more expensive due to their construction, with prices ranging from 100 to 600 pounds/euros. When selecting a panel of this type, you should primarily con- sider your intended use. In many cases, the main issue is not the price, but instead how urgently you need electrical power in a remote area. If you spend a month in Tibet, it's nice to be able to use a solar panel to charge your camera or mobile Solar cells Jens Nickel (Elektor Germany Editorial) All solar cells are made from at least two different materi- als, often in the form of two thin, adjacent layers. One of the materials must act as an electron donor un- der illumination, while the other material must act as an elec- tron acceptor. If there is some sort of elec- tron barrier between the two materials, the result is an electrical potential. If each of these materials is now provided with an elec- trode made from an electrically conductive material and the two electrodes are connected to an external load, the electrons will follow this path. The most commonly used solar cells are made from thin wa- fers of polycrystalline silicon (polycrystalline cells have a typical 'frosty' appearance after sawing and polishing). The silicon is very pure, but it contains an extremely small amount of boron as a dopant (an intentionally introduced impurity), and it has a thin surface layer doped with phosphorus. This creates a PN junction in the cell, exactly the same as in a diode. When the cell is ex- posed to light, electrons are released and holes (positive charge carriers) are generated. The holes can recombine with the elec- trons. The charge carriers are kept apart by the electrical field of the PN junction, which partially prevents the direct recombina- tion of electrons and holes. The electrical potential between the electrodes on the top and bottom of the cell is approximately 0.6 V. The maximum current (short-circuit current) is proportional to the surface area of the cell, the impinging light energy, and the efficiency. Higher volt- ages and currents are obtained by connecting cells in series to form strings and connecting these strings of cells in parallel to form modules. The maximum efficiency achieved by polycrystalline cells is 1 7%, while monocrystalline cells can achieve up to 22%, although the overall efficiency is lower if the total module area is taken into 20 elektor - 6/2009 phone now and then. You should carefully estimate how much power you need and how much sunshine you can expect at your intended destination, and then make your choice on this basis. It's better to choose a panel that is somewhat larger than what you absolutely need, since the available power decreases considerably when the sun is obscured by cloud. On the following pages, we provide an overview of several modules to give you an idea of what types are available and what they have to offer. ( 070798 - 1 ) Brand Type r.r.p. Importer/supplier Voltaic www.voltaicsystems.com Backpack Solar-power backpack £/€ 225 Ecotopia www.ecotopia.co.uk The Electronic Zone www.electroniczone.co.uk Solar www.solarmio.com Supra survival kit £/€ 600 ME2: www.selectsolar.co.uk/ pics/6. 5W%20Sunlinq%20E- Sun.php Solar Mio 31 £/€ 1 40 ME 2 www.mobile-energy2.com Foldable solar panel 6.5 W max. £/€ 1 75 Sunforce www.sunforceproducts.com Battery trickle charger 5 W £/€ 90 Sunsei www.sunsei.com SE400 Order no. 857032-89 £/€ 1 05 Sunsei: www.conrad-int.com Sunforce: www.selectsolar. co.uk Sunsei SE1 35 Order no. 857030-89 £/€ 36 Sun Force Solar-powered battery maintenance charger 1 .8 W Order no. 853784 - 89 £/€ 35 Mobile solar power case TPS-936 Order no. 68-693-25 £/€ 90 www.towsure.com PowerFilm www.powerfilmsolar.com R1 5-600 £/€ 256 www.selectsolar.co.uk/pics/rol- lable.php account. On a sunny day in central Europe, the available solar energy is approximately 1 000 W/m 2 , and around 1 50 W/m 2 of this can be converted into electrical energy with currently avail- able solar cells. Cells made from selenium, gallium arsenide, or other com- pounds can achieve even higher efficiency, but they are more expensive and are only used in special applications, such as space travel. There are also other approaches that are aimed primarily at reducing costs instead of increasing efficiency. The objective of such approaches is to considerably reduce the amount of pure silicon that has to be used or eliminate its use entirely. One example is thin-film solar cells made from amor- phous silicon, which have an efficiency of 8 to 1 0% and a good price/performance ratio. The silicon can be applied to a glass sheet or plastic film in the form of a thin layer. This thin-film technology is quite suitable for the production of robust, flexible modules, such as the examples described in this article. Battery charging From an electrical viewpoint, an ideal solar cell consists of a pure current source in parallel with a diode (the outlined com- ponents in the accompanying schematic diagram). When the solar cell is illuminated, the typical U/l characteristic of the diode shifts downward (see the drawing, which also shows the open- circuit voltage U Q c and the short-circuit current l sc ). The panel supplies maximum power when the load corresponds to the points marked 'MPP' (maximum power point) in the drawing. The power rating of a cell or panel specified by the manufactur- er usually refers to operation at the MPP with a light intensity of 100,000 lux and a temperature of 25 °C. The power decreases by approximately 0.2 to 0.5 %/°C as the temperature increases. A battery can be charged directly from a panel without any problems if the open-circuit voltage of the panel is higher than the nominal voltage of the battery. No voltage divider is neces- sary, even if the battery voltage is only 3 V and the nominal volt- age of the solar panel is 1 2 V. This is because a solar cell always acts as a current source instead of a voltage source. If the battery is connected directly to the solar panel, a small leakage current will flow through the solar panel when it is not illuminated. The can be prevented by adding a blocking diode to the circuit (see the schematic). Many portable solar mod- ules have a built-in blocking diode (check the manufacturer's specifications). This simple arrangement is adequate if the maximum current from the solar panel is less than the maximum allowable over- charging current of the battery. NiMH cells can be overcharged for up to 1 00 hours if the charging current (in A) is less than one-tenth of their rated capacity in Ah. This means that a panel with a rated current of 2 A can be connected directly to a 20-Ah battery without any problems. However, under these conditions the battery must be fully discharged by a load from time to time. Practical matters When positioning a solar panel, you should ensure that no part of the panel is in the shade, as otherwise the voltage will de- crease markedly, with a good chance that no current will flow into the connected battery. Most modules have integrated bypass diodes connected in re- verse parallel with the solar cells. These diodes prevent reverse polarisation of any cells that are not exposed to sunlight, so the current from the other cells flows through the diodes, which can cause overheating and damage to the cells. To reduce costs, it is common practice to fit only one diode to a group of cells in- stead of providing a separate diode for each cell. 6/2009 - elektor 21 INFO & MARKET SOLAR PANELS ME 2 Solar Foldable 650 This foldable panel is made from very sturdy nylon fabric. The manufacturer uses c-CGIS cells, which according to the manufacturer have higher efficiency than the commonly used amorphous cells. The panel is weather-resistant, and on closer examination we see that the cells are integrated almost seam- lessly into the nylon fabric, so the structure can indeed tolerate a certain amount of rain. The included accessories consist of a variety of adapter ca- bles with a cigarette-lighter plug and matching socket, a 5-mm power plug, an extension cable, and two battery clips. A sound product with impressive cell efficiency and outstand- ing finish. Voltage/current: 12 V/ 0.433 A Dimensions: 23 x 12 cm folded; 75 x 12 cm unfolded PowerFilm R 15-600 This rather unusual panel is the only roll-up model in our overview. The solar cells of this panel are fitted between two layers of tough plastic that can handle a certain amount of abuse and is weath- erproof and UV-resistant. This type of flexible solar panel is often used on boats, among other applications. The price of a model with a power rating of 1 0 W (around 250 pounds/euros) may seem high compared with the other panels, but for this price you have a robust panel that can withstand a bit of rough treatment and poor weather conditions. This panel can be secured using four grommets in the corners. It can be connected directly a 1 2-V battery with the included cable. The best way to connect relatively small devices is to use a 1 2-V battery charger for in-car use. An outstanding panel, primarily suitable for special applica- tions due to its unusual features. Voltage/current: 15.4 V / 0.6 A Dimensions: 23 long by 1 1 cm diameter rolled up; 97 x 29 cm unrolled Solar Mio 31 This small foldable panel with a striking colour can be folded into a compact package. It has a fairly low output voltage of 6 V, and it is intended to be used for charging portable de- vices. A bracket with an included box is fitted on the back, and the box contains a lithium polymer battery with an integrated charging regulator. You can charge this battery during the day and then use it whenever desired to charge another device. A USB connector (5 V) and a 2. 5-mm power plug are included for this purpose. An extensive set of adapters allows a wide variety of devices to be connected to the battery. An AC power line adapter and a car adapter are also included for charging the battery without the solar panel. A handy kit, but it's a pity that the battery capacity isn't a bit larger. Voltage/current: solar panel 6 V / 0.42 A; battery 5-6 V/0.5 A Dimensions: 23 x 8 cm folded; 235 x 23 cm unfolded Voltaic Backpack A few companies, such as Ecosolar and Voltaic, produce back- packs with integrated solar panels. We chose the popular Back- pack model for this overview. The sturdy, comfortable backpack with a capacity of 30 litres has a three-section panel of monocrystalline solar cells, which can collectively charge an included lithium-ion battery rated at 7.2 V / 2.2 A. An AC adapter for charging the battery from a power outlet and a large number of adapter plugs are also included. The main advantage of this backpack is that you can walk all day with it, with the battery being charged while you are under- way. The other panels have to be laid out somewhere while in use, which means you have to stay put for the duration. An excellent choice for frequent hikers. Voltage/current: 10.2 V / 0.4 A Dimensions: 51 x 25-38 x 18-25 mm; weight: 1.6 kg 22 elektor - 6/2009 Solar Supra Survival Kit The foldable panel of this especially luxurious but rather expen- sive set has 16 large triple-junction cells that can collectively supply a maximum power of nearly 1 3.5 W. The nylon case into which the panels are fitted is very sturdy and also has space for the included battery and charging regulator. This 'powerbase' contains a hefty rechargeable battery (probably a lithium type) that can supply 50 W. The actual capacity is not stated, but the manufacturer does say that it can power a notebook computer for several hours. This the best battery pack of all the ones we have seen in this overview. The output voltage of the internal DC/DC converter can be adjusted in steps over a range of 5 to 1 9 V, and its capacity is indeed reasonably large. This is one of the best combinations we have seen, with numer- ous accessories. Voltage/current: 8 V / 1 .68 A Dimensions: 23 x 15x9 cm folded; 49 x 46 cm unfolded Battery pack: 50 W / 5-1 9 V TPS936 mobile solar panel This solar panel is actually out of place in this overview in terms of dimensions and portability, but in light of the attractive price for such a large panel we considered it worthwhile to include it in the selection. This a sort of small case in approximately A3 format, which can be opened up to expose large solar panels on the two inner surfaces. Although the efficiency of the amorphous cells used here is not especially high, this unit delivers 13 W and is thus ideal for topping up the battery of a car or caravan. You can also use the included adapters and clips to connect the cable in the case to a wide variety of other devices. The case is fairly heavy, but this does not matter for use with a car or caravan. With a price of around 90 pounds/euros, it's a real bargain. Voltage/current: 15V/ 0.88 A Dimensions: 34 x 52 cm closed; 68 x 52 cm open The new PicoScope 4000 Series high-resolution oscilloscopes Technology — _l w- L- 1 - 1 = i — 1 c . It r 1 The PicoScope 4224 and 4424 High Resolution Oscilloscopes have true 12-bit resolution inputs with a vertical accuracy of 1%. This latest generation of PicoScopes features a deep memory of 32 M samples. When combined with rapid trigger mode, this can capture up to 1000 trigger events at a rate of thousands of waveforms per second. PC-based - capture, view and use the acquired waveform on your PC, right where you need it Software updates - free software updates for the life of the product USB powered and connected - perfect for use in the field or the lab Programmable - supplied with drivers and example code Resolution 12 bits (up to 16 bits with resolution enhancement) Bandwidth 20 MHz (for oscillscope and spectrum modes) Buffer Size 32 M samples shared between active channels Sample Rate 80 MS/s maximum Channels PicoScope 4224: 2 channels PicoScope 4424: 4 channels Connection USB 2.0 Trigger Types Rising edge, falling edge, edge with hysteresis, pulse width, runt pulse, drop out, windowed www.picotech.com/scope1017 01480 396395 6/2009 - elektor 23 INFO & MARKET SOLAR PANELS Sunsei Solar Charger 135 This panel is designed for use in or on a car, boat, or caravan, and it can be connected to the battery with the included cables and clips. This is a fairly small panel with a rated power of 1 .5 W, so it has to be used as a trickle charger. The panel has four fold-out supports that can be used to at- tache it to a car window with the included suction cups. After this, you can simply leave the panel where it is. The finishing is good, and the unit is made to be weather-resistant. It has a but- ton and blue LED for checking whether the panel is working. Voltage/current: 15V/ 0. 1 35 A Dimensions: 38 x 13 cm Sunsei Solar Charger 400 This panel is a larger version of the Solar Charger 1 35 (there are four different models in this series). Here again the panel can easily be connected directly to the battery with the included cables and clips. The panel is nicely finished, and the connec- tors have protective caps with silicone washers, all of which makes a reasonably weatherproof impression. Several panels can be connected together in a daisy-chain arrangement. There is sun-pattern button for checking whether the panel is supplying current. A blue LED lights up if it is working. A special pivoting bracket is available for easy installation of the panel. Voltage/current: 15V/ 0.4 A Dimensions: 36 x 37 cm Sunforce Battery Maintainer This panel as also intended to be used to maintain the charge of a car battery. The current output is low, and you shouldn't expect too much from a panel of this size. It can be connected to the battery with the included cable and clips. A built-in blue LED blinks when the panel is supplying power. The LED is constantly connected to a portion of the solar panel, with the result that the voltage decreases considerably in cloudy weather and the battery can't take advantage of the panel's full capacity. The panel has the same surface area and dimensions as the Solar Charger 1 35, and nearly the same price. It has open- ings at the top and bottom for attachment to a window. A few suction cups are included for installation, but they are rather small. Voltage/current: 15V/ 0. 1 25 A Dimensions: 35 x 13 cm Sunforce Battery Trickle Charger This panel is similar to the large Sunsei panel. It has nearly the same dimensions and nearly the same power rating. This panel has a permanently attached cable that can be con- nected to the car battery with the aid of a few adapters and clips or via the cigarette lighter socket. In contrast to the other car panels, it does not have an indicator LED (which is not nec- essarily a drawback). The dimensions and weight of this panel make it more suitable for fixed installation somewhere. You can use the four mount- ing holes and the included screws to make your on bracket for this purpose. Voltage/current: 15V/ 0.35 A Dimensions: 35 x 34 cm 24 elektor - 6/2009 . p'w-iy- rr*i 4 i c ■ ■ i mu : i h i i cr^up u - -hi mm ± r i fi hike b^li -a 2 0845 226 9451 Your source for MikroElektronika Development Tools and Accessories in the United Kingdom We can supply all MikroElektronika development tools including compilers, development boards, add-on boards, programmers and starter packs. We aim to keep all products in stock for same-day dispatch and can offer next-day delivery within the UK as well as insured delivery by airmail post or courier worldwide. EasyPIC5 PIC Development Board - £89 BIGPIC5 PIC Development Board -£119 LV18FJ PIC Development Board - £89 Get off to the best start with PIC microcontrollers with the EasyPIC5. Supports 8, 14, 18, 20, 28 and 40-pin PIC10F/12F/16F/18F devices and features built- in USB programmer, in- circuit debugger and useful I/O devices. LCD displays sold separately. An advanced development board for 64 and 80-pin PIC microcontrollers in the 18F family, the BIGPIC5 provides on-board USB programmer, in-circuit debugger plus extensive I/O devices and communications interfaces. LCD displays and SD card- sold separately. Designed for low-voltage PICs in the LV18FxxJxx family with on-chip Ethernet connectivity, the LV18FJ incorporates USB program- mer, in-circuit debugger and useful I/O devices and supports 64, 80 and 100-pin MCUs. LCD displays and SD card sold separately. EasyPIC5 Starter Packs also available comprising EasyPIC5, character and graphic LCDs, touch panel, tem- perature sensor and either BASIC, C or Pascal compiler. BIGPIC5 Starter Packs also available comprising BIGPIC5, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. LV18FJ Starter Packs also available comprising LV18FJ, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. EasydsPIC4A dsPIC Development Board - £89 dsPICPR04 dsPIC Development Board - £149 LV24-33A PIC/dsPIC Development Board - £99 A versatile development board for 18, 28 and 40-pin digital signal controllers in the dsPIC30F family, the EasydsPIC4A provides built-in USB programmer, in-circuit debugger and useful I/O devices. LCD displays sold separately. The new dsPICPR04 is an advanced development board for 64 and 80-pin dsPIC30F devices with built- in USB programmer, in-circuit debugger and extensive I/O features and communications interfaces. LCD displays and SD card sold separately. Easily develop 16-bit PIC24 and dsPIC33 applications with the LV24-33A. Features USB programmer and in- circuit debugger plus useful I/O devices and supports 64, 80 and 100-pin low-voltage devices. LCD displays and SD card sold separately. EasydsPIC4A Starter Packs also available comprising EasydsPIC4A, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. dsPICPR04 Starter Packs also available comprising dsPICPR04, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. LV24-33A Starter Packs also available comprising LV24-33A, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. EasyAVR5A AVR Development Board - £89 BIGAVR2 AVR Development Board - £89 Easy8051B 8051 Development Board - £89 Get off to the best start with AVR microcontrollers with the EasyAVR5A. Supports 8, 14, 20, 28 and 40-pin AVRs and features on- board USB programmer and useful I/O devices. LCD displays and SD card sold separately. l “l m Work with 64, 80 and 100-pin AVR microcontrollers with the BIGAVR2 development board. Includes built-in USB programmer and range of on- board I/O devices. LCD displays and SD card sold separately. Get off to the best start with Atmel’s Flash 8051 micro- controllers with the Easy8051B. Supports 14, 16, 28, 32, 40 and 44-pin 8051s and features on- board USB programmer and useful I/O devices. LCD displays sold separately. EasyAVR5A Starter Packs also available comprising EasyAVR5A, character and graphic LCDs, touch panel, temperature sensor and either BASIC, C or Pascal compiler. BIGAVR2 Starter Packs also available comprising BIGAVR2, character and graphic LCDs, touch panel and either BASIC, C or Pascal compiler. Easy8051B Starter Packs also available comprising Easy8051B, character and graphic LCDs, touch panel, tem- perature sensor and either BASIC, C or Pascal compiler. EasyARM ARM Development Board - £109 Easily develop for NXP’s 32-bit ARM microcontrollers with the EasyARM. Includes on-board USB programmer and useful I/O devices and supports 64 and 144-pin devices. LCD displays and SD card sold separately. Compilers EasyPSoC4 PSoC Development Board - £89 Learn about and develop for Cypress’s exciting PSoC mixed-signal array devices with the EasyPSoC4. Features built-in USB programmer and advanced I/O devices and supports 8, 20, 28 and 48-pin PSoCs. LCD displays and SD card sold separately. Add-on Boards UNI-DS3 Universal Development Board - £99 With the UNI-DS3 you can easily work with a number of popular microcontrollers from different manufacturers simply by buying optional plug-on MCU cards. Devices sup- ported include PIC, dsPIC, AVR, 8051, ARM and PSoC. MCU cards, LCD displays and SD card sold separately. Starter Packs mikroBASIC, mikroC and mikroPascal compilers now available in versions for PIC, dsPIC, AVR and 8051 microcontrollers. All feature user-friendly development environments, built-in library routines and easy integration with MikroElek- tronika’s programmers and debuggers. We stock an extensive range of add-on boards that plug straight onto Mikro- Elektronika’s development boards including A/D, D/A, RS-485, CAN, LIN, Ethernet, IrDA, RTC, EEPROM, Compact Flash, SD/MMC, MP3, Bluetooth, ZigBee, RFid, stepper motor driver and many more. Save money by buying one of our Starter Packs. Each includes a development board with options such as LCD displays, touch panel, temperature sensor and come with a full version of either mikroBASIC, mikroC or mikroPascal. Available for PIC, dsPIC, PIC24/dsPIC33, AVR and 8051. NEW PRO versions just released for PIC and AVR - existing mikroBASIC, mikroC and mikroPascal customers can upgrade free-of-charge! Contact us for details. NEW range of GSM/GPRS and GPS add-on boards and accessories just released. Contact us for details. NEW PIC and AVR Starter Packs now come with PRO versions of mikroBASIC, mikroC or mikroPascal. Please see our website at www.paltronix.com for further details of these and other products We also stock components, control boards, development tools, educational products, prototyping aids and test equipment Paltronix Limited, Unit 3 Dolphin Lane, 35 High Street, Southampton, S014 2DF \ Tel: 0845 226 9451 | Fax: 0845 226 9452 | Email: sales@paltronix.com Secure on-line ordering. Major credit and debit cards accepted. Prices exclude delivery and VAT and are subject to change. INSTRUMENTATION True RMS Digital Voltmeter with frequency counter 1 Kai Riedel (Germany) Many simple function generators do not offer the facility to measure either the frequency or the amplitude of the output. The module described here fills that gap, displaying the frequency and RMS amplitude of a signal on a two-line LCD panel. The circuit can also be used as a stand- alone true RMS voltmeter with frequency measurement. A wide range of frequency coun- ter designs has been published in Elektor [1]. None of these, however, has offered the ability to measure the amplitude of the input signal. Measur- ing the RMS (root-mean-square) ampli- tude properly is more than matter of applying full-wave rectification, aver- aging, and multiplying by a suitable magic constant, the method used in low-cost multimeters. The magic multi- plication factor used in these meters is correct if the input waveform is a pure sine wave, but the error in the reported value increases as the input wave- form deviates from the pure sinusoidal shape. Table 1 shows the degree of error for a few example waveshapes. The instrument described here can determine the true RMS amplitude [2] (or ‘effective value’) of signals with practically any waveform. The maximum permissible ‘crest factor’ (ratio of peak amplitude to RMS amplitude) is a way of specify- ing for what kinds of waveforms can have their RMS value measured with sufficient accuracy: for the true RMS converter used here the maximum crest factor (for an overall accuracy of 1 %) is 4. Figure 1. Block diagram of the meter. The circuit The principle of operation of the circuit can be understood using the block dia- gram (Figure 1). The system is divided into two main modules: the input amplifier and the display board. The input circuitry consists of a switch- able voltage divider with subsequent amplifier and a true RMS converter. Alongside this is a pulse shaper used in measuring the signal frequency. The amplifier is needed because the error in the output of the true RMS converter increases noticeably at input levels of 5 mV or less. The display module includes the processing circuit, consisting of a 26 elektor - 6/2009 Main Characteristics • Four measurement ranges: 0.1 V, 1 V, 10 V, 100 V • Voltmeter bandwidth: 20 Hz to 1 MHz (basic accuracy ±1.0 % of full scale) • Frequency counter bandwidth: 1 Hz to 10 MHz (typ.), 25 MHz (max.) (±timebase error) • Minimum input voltage for counter: approximately 50 mVRMS • Input impedance: > 1 Mfl 1 1 < 50 pF • Counter timebase: 100 ms, 1 s • Adjustable trigger level: approximately ±0.15 V • Autoranging (may be disabled) • Offset correction and calibration facility • Automatic scaling of frequency display • Voltage displayed as RMS value or peak-to-peak value (for sinusoidal input) • Crest factor: <4 • Two measurement inputs Table 1. Mean absolute value versus RMS He assume a mean signal amplitude of 1 V. 'SCR' stands for Silicon Controlled Rectifier, or thyristor: we use this as shorthand for the waveforms found in AC phase angle control circuits. Wave shape Crest factor True RMS value [V] Error in using mean absolute value [%] Sine 1.414 0.707 0 Square, 50 % 1.0 1.0 + 1 1.0 Triangle 1.73 0.577 -3.8 SCR, 50 % 2 0.495 -28 SCR, 25 % 4.7 0.212 -30 microcontroller, LCD panel, analogue- to-digital converter and an RS-232 interface. Figure 2 shows the circuit diagram of the input amplifier module, where the parts of the block diagram can clearly be seen. As the input voltage is AC, a frequency-compensated volt- age divider is used. Without this, the voltage divider would form a low-pass filter with the input capacitance of the subsequent circuit, which would severely limit the maximum frequency of operation. To avoid various potential problems associated with matching and with high input voltages, relays are used to switch the voltage divider. The output of the divider is matched to the amplifier using a classical imped- ance conversion stage using a dual field-effect transistor. This guarantees good stability down to DC (see [3]). To allow for operation up to high fre- quencies the main amplification is car- ried out in three stages. The amplifier used, the ADA4862-3 [4] has internal frequency compensation and consists of three opamps, which, connected in series, deliver an overall gain of 8. A particular feature of this device is its very good linearity: gain variation is within 0.1 dB up to a frequency of 65 MHz. The output of the amplifier feeds IC3, an RMS-to-DC converter [5] [6], and IC4, a high-speed comparator [7]. Potentio- meter PI allows the switching thresh- old of the comparator to be adjusted slightly. If it is desired to process sig- nals with a greater DC component, we recommend adding a series high-volt- age capacitor of (for example) 330 nF before the input amplifier circuit. According to its datasheet, the Lin- ear Technology LTC1968 RMS-to-DC converter has a 3 dB bandwidth of 15 MHz. The arrangement in our circuit broadly follows the manufacturer’s rec- ommendations. Capacitor C15 allows the response time of the converter to be set. A smaller value can be used to reduce the response time, but this will increase the error in the result at fre- quencies below 100 Hz. C14 ensures that only the AC component of the sig- nal is processed. Display module using R8C The display module is based around the popular R8C/13 microcontroller from Renesas (see Figure 4). The wir- ing of the microcontroller (with pro- gramming over the RS-232 interface, crystal and LCD panel) follows the cir- cuits from the R8C series published in Elektor from February 2006 [8] [9]. IC2 is an external 20-bit analogue-to-dig- ital (A/D) converter [10]. It uses the delta-sigma conversion technique and can effectively suppress the ripple that appears superimposed on the output of the RMS-to-DC converter. To sim- 6/2009 - elektor 27 INSTRUMENTATION Figure 2. Circuit diagram of the amplifier module, including voltage divider, amplifier and RMS-to-DC converter. Figure 3. Printed circuit board for the amplifier. COMPONENT LIST Measurement Amplifier Resistors R1,R2, R5 = 47C2 (SMD 0805) R3,R4 = 27Q (SMD 0805) R6 = 1 00 kQ R7 = 10k (SMD 0805) R8 = 470kQ (SMD 0805) R9 = 900kQ0.1% R10,R1 1 = 4kQ7 R1 2 = 90kQ 0. 1 % R13 = 9kQ 0.1% R14 = 1 kQ 0.1% R1 5 = 430Q (SMD 0805) R16 = 430Q (SMD 1206) R1 7 = 4kQ7 (SMD 0805) R18 = 4k£27 (SMD 0805) 28 elektor - 6/2009 Two ways to calibrate Method 1: 1 . Connect an oscilloscope to the output of 1C 1 in the amplifier module, using a 10:1 probe. 2. Connect K4.1 to ground: this sets the highest voltage division ratio. 3. Apply a symmetrical squarewave with an amplitude of around 1 V to the junction of re- sistors R1 2 and R1 3. This can be obtained, for example, from the calibration output of the oscilloscope. 4. Now the value of C25 must be selected to obtain as accurate as possible a squarewave on the oscilloscope screen. The value given in the circuit diagram is a good starting-point. One approach is to fit a 1 00 pF capacitor for C25 and then try adding 1 00 pF and then 220 pF capacitors in parallel. If you have good eyesight and a steady hand you can solder these as SMDs on the reverse of the board: this makes it easier to change them later. 5. Enable the next measurement range by grounding K4.2. 6. Apply the squarewave signal to the junction of R9 and R1 2. 7. Adjust trimmer C2 1 appropriately. Repeat for C20. Method 2: Follow steps 1 and 2 above and then apply a symmetrical squarewave to the amplifier mo- dule input. Now adjust C25, C20 and C21 until an accurate squarewave appears at the output of IC1 . Since the choices of values for C25, C20 and C21 jointly affect the response in each measurement range, considerably more trial and error is required than in the 'text- book' approach described above. Nevertheless, the author has found that it can quickly lead to good results. It is of course possible to start using method 1 and then use method 2 to make final fine adjustments. plify the required calculations the A/ D converter is provided with a 2.048 V reference voltage (IC3). An important factor is the temperature coefficient of this device: at 10 ppm/°C, we have a variation in the reference voltage of 0.02048 mV/°C. The A/D converter outputs its con- version results to the R8C over an SPI port. Frequency measurement is car- ried out by feeding pulses into the CNTR0 counter input of the micro- controller. For this to work, the pulse width must be at least 40 ns and the period at least 100 ns. This means that we can measure frequencies of up to 10 MHz without a prescaler. Four pushbuttons are provided for the user interface. Pressing SI switches to manual ranging mode (automatic rang- P1 = 1 OkD (Alps type 290061 ) Capacitors Cl ,C2,C1 1 ,C1 3,0 6,C1 9 = lOOnF (SMD 0805) C3,C4,C1 0,C1 2 = 4jL/F7 10V (293D/A) C5,C6 = 1 OnF (SMD 0805) C7 = 27pF (SMD 0805) C8 = 1 OnF C9 = InF (SMD 0805) Cl 4 = 1/iF 1 0V (SMD 0805) Cl 5 = 10jL/F 1 0V (SMD 0805) Cl 7, Cl 8 = 10jL/F 1 0V (2 93 D/A) C20,C21 = 2. 5-35pF trimmer (C-TRIMM808-7.5) C22 = 2nF2 C23 = 22nF C24,C25 = 220pF Semiconductors IC1 = ADA4862-3 (SMD) IC3 = LTC1 968CMS8 (MSOP-8) IC4 = LT1016CS8 (SO-8) D1,D2 = BAS45 (1N4148) D3,D4 = BZW55-2.7 (SMD) T1 = Dual FET PMBFJ620 (NXP) Miscellaneous Re 1 -Re4 = SIL7271-L5V or MEDER SIL05-IA72-7ID K1,K2,K3 = 2-way pinheader K4,K5 = 4-way pinheader 2x SMA case socket Metal case e.g. TEKO # 372 BNC case socket Miniature rocker switch 7x 1 nF feedthrough capacitor PCB # 080331 -1 , see www.elektor. com/shop ing then remaining disabled until the next reset). S2 switches the timebase (and hence sample rate) between 1 s and 100 ms. The current state is indi- cated by an LED. An extended press on S3 will perform an offset correc- tion; and S4 switches the readout to peak-to-peak amplitude for sinusoidal signals. Pin P01 on the microcontroller is con- nected to test point TP1, which is used in calibrating the module. Construction The overall construction of the unit is shown in the wiring diagram (Fig- ure 6) and in the picture of the proto- type (main photograph). Observe cor- rect polarity on the relays (the 1 T- ’ sym- bol on the package and the dot on the printed circuit board). The dual FET is fitted correctly when the dot on its package (indicating pin 1) is next to the dot on the board. The circuit should be built in a metal enclosure to minimise interference (Figure 7). The DC signals are con- nected to the input amplifier via feed- through capacitors, and the signals being measured are connected using SMA or BNC connectors. The output of the comparator (which is a square- wave) is also taken via an SMA con- nector. If the module is to be built inside a function generator, the gen- erator’s output should be connected to the SMA input of the module using a screened cable. The LCD, the four pushbuttons and the timebase indicator LED are all mounted on the front side of the dis- play board, with all the other com- ponents on the back. This allows the board to be mounted in an enclosure as a self-contained module. Software We will only describe the structure of the software in broad outline here. Fur- ther details can be found in the source code itself and in the file ‘Dokumenta- tion_S oft ware, chm’ (created using the free software tool Doxygen). Source, hex and help files are of course avail- able for free download from the web- site for the project [11]. The software makes use of various tim- ers and interrupts (timers X, Y and Z, and the key input interrupt). If a cal- ibration sequence has already been 6/2009 - elektor 29 INSTRUMENTATION + I Figure 4. Circuit diagram of the display board with microcontroller, display, A/D converter IC2 and voltage reference IC3. 30 elektor - 6/2009 performed at some point, the first thing the software does when power is applied is to load calibration and off- set values from the microcontroller’s flash memory; otherwise default val- ues are loaded (and the display shows ‘LOAD DEFAULTS’). The microcontrol- ler then goes into an idle mode. TimerX is configured in event counter mode and counts the pulses on the CNTRO input. An interrupt is triggered when the counter overflows. The interrupt routine that gets called then incre- ments a counter variable. When the TimerZ interrupt is triggered (this depends on the timebase setting, and can be every 100 ms or every 1 s) the frequency and voltage values are cal- culated and output. Calculation of the frequency takes into account the values in the counter variable, in TimerX, and in the TimerX prescaler. The voltage is determined by reading the A/D converter over the SPI port. Twelve of the possible twenty bits of A/D converter resolution are enough for the calculation, which auto- matically takes into account the gain of the amplifier and the measurement range. Because of the lag in the RMS-to-DC converter, automatically finding the optimal measurement range takes a few seconds, during which the display shows ‘Busy’. If an overrange occurs the module will automatically switch to the next higher range for safety rea- sons, and the display will show ‘Over- flow’. This automatic switch happens also in manual mode, although the unit will remain in manual mode after the range change. The finishing touches We shall discuss setting up the ampli- fier and the display board separately. Programming the microcontroller for the display board is described briefly in the text box ‘Programming’. Calibrating the amplifier is a some- what more involved task (see text box). An oscilloscope, a digital volt- meter (ideally one that can make true RMS readings) and a sine wave genera- tor are required. First make a simple check that the RMS-to-DC converter and the com- parator are working correctly. Then connect the two modules together as shown in Figure 6. With the input short-circuited a press of S3 will store Figure 5. Printed circuit board for the display. COMPONENT LIST Display board Resistors R3,R5 = 1 OkD (SMD 0603) R4 = 1 Ok R6 = 33k (SMD 0603) R7 = 4kQ7 (SMD 0603) R8 = 1 OOkQ (SMD 0603) R1 1 ,R1 2,R1 3,R1 4 = 1 kD (SMD 0805) R1 5 = 1 kQ (SMD 0603) Capacitors C2,C4 = ljL/F 1 0V (SMD 0603) C3 / C6 / C7 = lOOnF (SMD 0603) C5 = 4jL/F7 10V (SMD 0603) C8 = 1 8pF (SMD 0603) C9 = 27pF (SMD 0603) C10= 20pF trimmer (C-TRIMMCTZ3) Semiconductors IC1 = R8C13 (R5F21 134FP, LQFP32) IC2 = LTC2420CS8 (SO-8) IC3 = LT1 790ACS6-2.048 (SOT23-6) D1..D4 = 1N4148 (SOD-323) T1 = BC558C (SOT-23) T2-T6 = 2N7002 (SOT-23) LED1-LED4 = LED, green (SMD 1206) LED5 = LED, 3mm Miscellaneous LCD1 = LCD 2x16 JP1 = 2-way pinheader and jumper K1,K2,K3 = 2-way pinheader K4,K5 = 4-way pinheader XI = 20MHz quartz crystal, HC-49US1 2SMD S1-S4 = pushbutton (Schurter # 1241.1614) S5 = pushbutton (6mm) PCB # 080331 -2, see www.elektor. com/shop the currently displayed value as the calibrated offset voltage (and the dis- play will show ‘OFFSET SAVED’, fol- lowed by ‘0.0 mV’). Now apply a sinewave with an RMS value of 100 mV to the input. Connect test point TP1 to ground and the volt- age readings for the lowest measure- ment range will be calibrated (with display ‘CALIBRATION OK’). The fre- quency of the sinewave signal should be chosen to obtain best accuracy from the voltmeter being used for comparison. Calibration is now complete, and the unit can be put to use. Programming 1 . Connect the RS-232 interface to a PC. 2. Fit mode jumper JP1 . 3. Briefly press the reset button once: this activates the microcontroller's boot loader. 4. Load the program 'FreqCounter.mot' [11] into the microcontroller using the Renesas Flash Development Toolkit in 'Basic' mode. 5. Remove the mode jumper. 6. Briefly press the reset button. The program will then start up using default parameter values. 6/2009 - elektor 31 INSTRUMENTATION 9 8 7 6 RS232 I OOOO SUB-D9 // O O O O O ? O display board 4 3 o X K5 LV T T T T u u u v> ▼ ▼ 080331-2- u w V1.0 • K1 It K4 LED5 0 q measurement amplifier board 4xC=1n 1 1 K4 K5 RE4 | • # -W- • • . _7^. 3x C = In K1 K2 IT . ■!§„!□ - \uwug efl «[!l . “ s( © j • internal if#2>d K3 Q1 c > ft-n, * u u# -a* ©Elektor 080331-1 VI .0 external N0<] 080331 - 14 Other possibilities The module can be constructed in the form of a stand-alone voltmeter or it can be built into a function generator. In the latter case, rather than going via the input amplifier circuit, the synchro- nisation output of the generator can be connected directly to the microcontrol- ler. The measured frequency can be used to index a stored table to allow correction for the frequency response of the instrument. Another possibility would be to arrange for the software to output readings over the RS-232 port for fur- ther processing. The microcontroller has 16 KB of pro- gram memory, of which around 5 KB is used. This gives plenty of room to implement new features. Readers are welcome to contact the author [12] or Elektor with their ideas. ( 080331 - 1 ) Figure 6. Overall wiring diagram. Figure 7. The measurement amplifier should be built into a metal casing Internet links [1 ] http://www.elektor.com/070954-l [ 2 ] http://en. wikipedia. org/wiki/Root_mean_square [3] http://tietze-schenk.com/tsbook.htm [4] http://www.analog.com/en/audiovideo- products/video-ampsbuffersfilters/ada4862- 3/ prod ucts/ prod uct. htm I [5] http://www.linear.com/pc/productDetail. jsp?navld = H0,O ,0 1 54,0 086, P7526 [ 6 ] http://www.linear.com/pc/downloadDocu- ment.do?navld = HO,0 ,0 1 54,0 086, PI 70 1 ,D24931 [7] http://www.linear.com/pc/productDetail. jsp?navld = H0,O ,C1 1 54,0 004,0 01 2, P 1225 [ 8 ] http://www.elektor.com/0501 79-2 [9] http://www.elektor.com/0501 79-3 [ 10 ] http://www.linear.com/pc/product- Detail.jsp?navldhttp://www. elektor. com/ 080331 = H0,C1 ,d 1 55,0 001 ,C1 1 52, PI 823 [11] http://www.elektor.com/080331 [ 12 ] kairiedel@yahoo.de 32 elektor - 6/2009 CHINA PCB SUPPLER GENERA L CIRCUITS CO., LTD l«iA TaJ hi cj^^b % f ‘ r jiW VVv 1 . *1 I.' ll AF # 0 ^ ^ . :v w^-'A V hi iff V ML ekk i^mir *■• T i ■-• m yJP r a K-. ■F ■ &A tf QUALITY PCB & SERVICE PROTOTYPE TO PRODUCTION instant online quote ,4-.' <1* >A •awSSKl X l 5' r v - ,-«■ V+ At. r J r- tfr 6 * shopping carl ordering system China competitive prices free electrically test W (Vi>l5 ^i^sytaw 1 pc6ca nwn saHd-E^f>c4JC#1 «>ti f*x mms AJ?i Nv.?$0to Cm Kf. Hi^fipg. CJi.nff « Bi" WWW. PCB CART. COM C Programming for Embedded Microcontrollers Learn by doing New microcontrollers become available every year and old ones become redundant. The one thing that has stayed the same is the C programming language used to program these microcontrollers. If you would like to learn this standard language to program microcontrollers, then this book is for you. No programming experience is necessary! You'll start learning to program from the very first chapter with simple programs and slowly build from there. Initially, you program on the PC only, so no need for dedicated hardware. This book uses only free or open source software and sample programs and exercises can be downloaded from the Internet. Although this book concentrates on ARM micro- controllers from Atmel, the C programming language applies equally to other manufacturer's ARMs as well as other microcontrollers. This is an ideal book for electronic enthusiasts, students and engineers wanting to learn the C programming language in an embedded environment! -llektor ISHOP 324 pages • ISBN 978-0-905705-80-4 £32.50 • US $52.00 Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 V J Further information and ordering atwww.elektor.com/books ■ irr 6/2009 - elektor 33 MODELLING Automatic Running-in Bench for internal combustion engines Part 3: application software Michel Kuenemann (France) Our series of three articles about the running-in bench for model i/c engines begun in April concludes this month with a presentation of the automatic running-in software. In order to take full advantage of the software (CBRMrun- ning-in.hex, [1]) we're going to be describing here, you'll need the following equipment: • A built and tested CBRM board and a GMMI pocket ter- minal (described in the April 2009 issue of Elektor [2]); • A test bench fitted with all its detectors and actuators, as described in the May 2009 issue of Elektor [3]. You will already have carefully checked that the bench works properly, using the CBRMtest_sensors.hex[ 3] software and an engine that's already been run-in; • A model i/c engine that's already been run-in, fitted with a suitable twin-bladed propeller; • An engine to be run-in with its twin-bladed prop; 34 elektor - 6/2009 • Some fuel, and a means of starting the engine. If you have a laptop PC running under Windows 2000/ XP/Vista, you can if you wish install the CBRMmonitor [1 ] software on it and connect it to the bench via a USB link. As its name indicates, this software will let you monitor all the bench parameters on your computer screen in Veal time' as they change during the running-in process. Moving on to the nitty-gritty... Rather than systematically describing all the menus in the application, without more ado we're going to go through a try-out operation — preferably using an already run-in engine. Figure 1. The bench's welcome screen. Flash the CBRMrunning-in.hex software as per the proce- dure given in the April 2009 article, and check that the application runs; the pocket terminal should give three short beeps and the screen should display the welcome message (Figure 1). This display soon changes to the manual mode screen (Figure 2) which summarises seven vital parameters of the engine operation: Throttle (abbreviated to Thr.); • Engine (Tmp.) and ambient (Amb.) temperatures; • Speed (Rpm.); • Mixture richness ('Ned/ for needle); • Ignition battery condition and voltage (Ig n .) ; • Board supply voltage (Sup.) Richness setting The asterisk in the first column on the third line indicates that the richness adjustment is enabled. Temporarily loosen o ff the mechanical coupling between the stepper motor and the richness screw. Screw the richness screw all the way in lightly by hand, then retighten the coupling appropriately so that the link shaft cannot slip. By turning the encoder knob anticlock- wise ('unscrewing), you'll see that the step- per motor will slowly and carefully open the richness screw as you wish. Choose a rich setting, i.e. open by around two or three turns (this is only by way of an indication — the exact value depends on your particu- lar installation and engine). The display will appear as in Figure 3. The left-most figure on the 'richness' line indi- cates your set value. In the centre of the line, an animated 'propeller' turns when the engine is running. Check that the richness needle closes fully when you go back to zero turns. The mechanical coupling should be such that it rotates freely, so that the motor won't miss any steps. If it does, the indication of the needle opening will be incorrect! The richness screw setting is retained as long as the board has not been re-booted using the reset or emergency stop button or powered down. Starting the engine Now press the button by the first line. An asterisk appears in the first position on the first line, indicating that the throt- Figure 2. The manual mode screen. Figure 3. The asterisk indicates the parameter whose value can be adjusted using the encoder knob. Figure 4. Full throttle! Figure 5. The ignition is on. Watch out for your fingers! 6/2009 - elektor 35 MODELLING Figure 6. The engine is running and the ignition can be turned off. Figure 7. Press the encoder knob to store the servo position in idle. Figure 8. This screen lets you set the engine speed. Figure 9. The CBRMmonitor software for PC shows the key engine parameters live as they change. tie control is enabled. To check this, turn the encoder knob anticlockwise. The servo should turn in the direction to increase the throttle - if this is not the case, you'll need to alter the bench parameters. Set it to 100%: full throttle! (Figure 4). Important safety note: if the throttle control is not work- ing satisfactorily, check and adjust the throttle control setting ('Parameters' menu — see below) before continuing. Now prime your engine as usual, then reduce the throttle to around 10 or 20%. Turn the propeller a few more turns to finish priming the engine, then briefly press the button alongside the fourth line (Figure 5). The '+' sign at the start of the fourth line indicates that the glow-plug is enabled. You should also clearly hear the beeping from the pocket terminal sounder. This indicates that the ignition is enabled and that the engine is ready to start at the next attempt. From now on, keep your fingers well away from the propeller! Start the engine, then adjust the idling speed using the throt- tle control. Turn off the power to the glow-plug by pressing the button on the fourth line again. The sounder will stop and the display will appear as in Figure 6. Now increase the throttle to 100%. Since the mixture was set to 'rich', the engine will not reach its maximum speed, the 'peak'. To adjust this, press the button on the third line and gradually close the richness screw by turn- ing the encoder knob slowly clockwise until peak speed is reached, just as you would do if operating the mixture needle manually. Take care not to weaken the mixture too much. As the setting resolution is 1/100 of a turn, this set- ting can be made very accurately. Then go back to idling by pressing the first line button and turning the encoder knob clockwise. When you are satisfied with the idling speed, you can store the corresponding servo setting (Idle) by briefly pressing the encoder knob (Figure 7). At this moment, a pop-up win- dow will appear for one second, confirming that this value has been saved in non-volatile memory. Speed setting... ... comes into operation when you press the button on the second line (Figure 8). By turning the encoder knob, you can alter the engine speed set point (Set). You'll see that the engine speed will automatically adjust to this value and remain there. To avoid abrupt jumps in speed, the set point automatically adopts the speed the engine is set to at the moment the adjustment is enabled. In the same way, when returning to manual throttle control, the servo maintains the same position at the moment of leaving the 'speed control' mode. If you have a (portable) PC, you can now connect it to the bench, run the CBRMmonitor software and see the par- ameters on the screen as they change (Figure 9). In the event of a problem with the bench, don't panic! Quickly hit the emergency stop button to stop the engine at once. The functions offered by the manual mode let you run-in an engine in a 'controlled' way. The speed adjustment will let you ensure that the engine runs fast enough to run it in prop- erly, whilst avoiding any risk of damaging it with excessive 36 elektor - 6/2009 speeds. The 'automatic running-in' mode lets you control the process even better; but before we get to that, we need to go back to the main menu and enter a few safety limits and other parameters. The main menu... ...is displayed by a pressing the button on the first line twice (Figure 10). Press the button on the fourth line to modify the safety limits. The safety limits... ... define three parameters that are vital for the safety of the bench in operation. These are: • Maximum permitted engine speed; • Maximum permitted engine temperature; • Minimum board supply voltage (to protect your batteries from deep discharge). The values for these parameters can be modified in the screen shown in Figure 1 1 . Select the parameter to be modified by pressing the cor- responding button. Confirm the data entered by pressing the encoder knob. The parameter is then saved into non- volatile memory and will not need to be entered again next time the bench is turned on. Now go back to the main menu by pressing the first button twice, then select the Par- ameters menu. The parameters... ...that can be adjusted are as follows: • Servo travel; • Number of propeller blades (Pro.); • DSC (Direct Servo Control) throttle channel. The values for these parameters can be modified in the screen shown in Figure 12. The key servo travel adjustment is done in three steps: 1 . Press the second line button twice to position the cursor in the neutral position (marked 'N' on the third line), then adjust the throttle servo rod mechanically so that it is per- pendicular to the latter. If necessary, adjust the value slightly using the encoder knob, then confirm the data entered. 2. Put the cursor into the 'throttle closed' position (marked Closed), then adjust the throttle control linkages mechan- ically so that the throttle flap is closed when set to the -1 00% position. If the servo moves in the wrong direction, turn the encoder knob until a value of +1 00% is displayed. Save the data entered. 3. Set the servo to the 'full throttle' position (marked Full) and check that the throttle flap is fully open. If the servo moves the wrong way, turn the encoder knob until a value of -100% is displayed. Save the data entered. These adjustments need to be made each time the engine is changed or if there is any modification to the servo installation. Before proceeding, go back to Manual mode (via the main menu of Figure 10) and check that turning the encoder knob anticlockwise ('unscrewing') increases the throttle set- Figure 10. The main menu. Figure 11. Don't forget to enter the limits for these three parameters that are vital for safe operation of the bench. Figure 12. The adjustments to be made each time the engine is changed or if there is any modification to the servo installation. Figure 13. On this screen, you can define just how the automatic running-in is performed. 6/2009 - elektor 37 MODELLING ting. Check too that the throttle flap moves over its full travel between 0% and 1 00%. Tweak the setting until you get the proper travel for the servo. Important safety note: it is absolutely vital that the throttle adjustment operates in the correct sense. If not, going into 'speed control' mode will make the engine race! What's more, pressing the emergency stop will not stop it — quite the reverse, the engine will be set to full throttle! It's also very important to enter the number of propeller blades correctly, as this factor is used for measuring the speed. Con- firm and save the value by pressing the encoder knob. Lastly, the DSC parameter allows you to define the chan- nel number associated with the throttle control. Once the parameter has been entered and saved, go back to man- ual mode, connect your transmitter to the DSC socket and check that the throttle control drives the servo correctly. The servo also needs to be adjusted in the transmitter (direction and travel). Now go back to the main menu and select the 'Automatic Running-In' mode. Automatic running-in... ...consists of carrying out successive acceleration/decelera- tion cycles with a fuel-rich mixture. Running-in takes place during the high-speed phase, but the engine temperature can have a tendency to rise dangerously. So it is necessary to lower the speed every now and then to allows the engine to cool down. This cycle needs to be repeated, gradually increasing the periods of high-speed running and reducing the richness of the mixture. All these parameters depend on the type of engine, the manufacturer's recommendations, and your own habits. The second line of the automatic mode parameters (Fig- ure 13) lets you define the high-speed settings. The first parameter on this line is the speed for this phase, and the second parameter is its duration in seconds. At the end of the line, you'll find the maximum temperature reached during the current cycle. The third line lets you define the low-speed settings. The first parameter on this line is the speed for this phase, and the second parameter is its dura- tion in seconds. At the end of the line, the software indi- cates the minimum temperature reached during the cur- rent cycle. Move between the different fields on the line using the relevant button, and store the parameters using the encoder knob. The fourth line lets you adjust the rich- ness, specify the number of cycles to be performed, and choose the way the bench behaves at the end of the cycle. If you select the number of cycles as zero, the bench won't stop of its own accord. At the end of the cycle, you can choose between stopping the engine (St.), running it at idling speed (Id.), or leaving it running at low speed (Lo.) Lastly, the first line indicates, from left to right, the current phase ('h' or T), the current engine speed, the number of seconds left in this phase, and the number of cycles remaining to be performed. By way of a conclusion... So now here you are the proud owner of an original, com- prehensive automatic running-in bench. We hope you have great fun using it safely. ( 090250 - 1 ) References and weblinks [1] www.elektor.com/090250 [2] www.elektor.com/080253, Elektor April 2009 [3] www.elektor.com/081 187, Elektor May 2009 [4] breakinbench.free.fr [5] author's e-mail address: breakinbench@free.fr Corrections The first part of this series was published two months ago [2] and since then, we have found a few small points that deserve special attention: • The speed detection circuit uses a 'stabistor' diode (D4) — it's like a zener diode, but for voltages under 3 V. Un- like the zener diode marked on the 080253-1 PCB, a stabistor diode is mounted like an ordinary diode. So D4 must be fitted 'backwards', i.e. with its cathode to ground. The 080253-71 kit contains the stabistor diode, so take care!; • If you can't find the stabistor diode for D4, you can re- place it by a 3 mm red LED. Fit the LED with its cathode to ground, it should light up when the board is powered; • The speed detector may be lacking in sensitivity. If this is the case, you can increase the value of R40 up to 22 k£T; • There are some minor typos in the pocket terminal com- ponents list and circuit: T1 should be a ZXM61 P02F; • The value of D1 0 in Figure 3 (April 2009, page 45) should be 3V3 instead of 5V6. The component list gives the correct value; • At the start of the paragraph 'Testing the pocket terminal' (April 2009, page 49) you are told to fit jumper JP8. This is wrong, it is JP6 that needs to be fitted, otherwise the pocket terminal won't be powered; • Those who have taken a close look at the circuit will have already realised: use a non-crossed (straight through) cable for connecting the pocket terminal to the controller board, as shown in the figure here. RJ11 RJ11 6p6c Straight-Reverse Cable RJ1 1 1 1 2 2 3 3 4 4 5 5 6 6 6-pin RJ11 Connector 38 elektor - 6/2009 THE ORIGINAL SINCE 1994 PCB-PnOL Specialising in Prototype PCBs Free Laser Stencil with all Prototype PCB orders 1 WD prototype service Chemical Tin Finish (no extra cost) LZJ Free Phone UK 0800 389 8560 © Simply send your layout files and order ONLINE PCB-POOLCOM • sales9pcb-pool.com Bela LAYOUT I PULSONIX V- tel. 01298 70012 flPi|iM 1298 70046 wraw.niaMec.co.uk sales@peakelec.co.uk The famous Peak Atlas Range: Atlas D includes new premium probes! Atlas ESR Atlas DCA Model DCA55 Atlas ESR Model ESR60 Semiconductor Analyser Identifies type and pinout! A ESR and Capacitance Meter Resolution of 0.01 ohms! Atlas SCR v includes new premium probes! TT" Atlas SaMWBMEDRI QQ Atlas LCR Mggel LJBP40 Inductor, Capacitoi Resistor Analyse^yjTriac andlilMkgi^alyser Automatic part identification. Auto gate teS : MBBWIBrto 1 OQmA UK: Please adl £2 p&p to your orderfPricespToiuo eJJK 'Wm Please see website for overseas p7i£Trig^l ISBN 978-90-5381-159-7 £24.90 • US $39.50 Completely updated The program package consists of eight databanks covering ICs, transistors, diodes and optocouplers. A further eleven applications cover the calculation of, for example, zener diode series resistors, voltage regulators, voltage dividers and AMV's. A colour band decoder is included for determining resistor and inductor values. Each databank contains the following on (almost) any component: enclosure drawing, pin connections, tech- Elektor's Components Database 5 nical data (as far as known). Also included is a search engine acting on user supplied parameters. The ECD gives you easy access to design data for over 5,400 ICs, more than 35,800 transistors, FETs, thyristors and triacs, just under 25,000 diodes and 1 ,800 opto- couplers. All databank applications are fully interactive, allowing the user to add, edit and complete component data. This CD-ROM is a must-have for all electronics enthusiasts! “Jlektor SHOP Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel. +44 20 8261 4509 L J Further information and ordering at www.elektor.com/shop 'll 6/2009 - elektor 39 PROFILER MILLING MACHINE Harry Baggen (Elektor Netherlands Editorial) and Frank Jacops (Colinbus, Belgium) 3D workpieces, G-code, milling printed circuit boards: thanks to a new controller board with a powerful ARM processor and a new, robust Z-axis with floating head you can upgrade your existing Profiler milling machine to a 'Pro' version. The software has also been adapted to take advantage of this and has many improvements and new features. About two and a half years ago, when Elektor and Belgium-based manufacturer Colinbus thought of putting together a simple, handy and (importantly) affordable milling machine for use in the home workshop, none of the company rep- resentatives involved in the discussions had any idea about the runaway success their joint project was to become. The Elektor/Colinbus Profiler turned out to be a 'hit' and an enormous number of kit sets for this machine were sold. Very quickly an active community formed whose members would analyse the machine down to the tiniest of details. Equally quickly there were modifications and suggestions for improvements. Both the users and the manufacturer actively continued to explore all possibilities of further improving Profiler. The designers from Colinbus have spent a considerable amount of time improving and advancing the development of the Profiler, and the developments have now reached a point that allows us to publish the various new features. In particular the combination of all these new features (a new processor board, modified software and several mechani- cal upgrades) results in a revolutionary improvement. Not every user will have the need for these improvements however. It depends entirely on what you expect from your Profiler and the types of task you want to have it perform. If you only want to mill 2D shapes from lighter materials and don't have any special demands then the existing machine will work very well for you. For these users, the existing Pro- filer will already cater for the most complex shapes, much faster and more accurate than before. But other users demand more and often have been active exploring various solutions and possibilities for themselves. We lis- tened care- fully to all these wishes and Colinbus has attempted to steer further development accordingly. By offer- ing the parts described here we hope to have met the most important requests. With these changes the Profiler becomes a more professional machine with many new capabilities. What's new? As already mentioned, there are quite a few new develop- ments. The most important ones will be introduced in this article. • Requested by many and now available: the new 3D controller! A new processor board has been developed, fitted with a state-of-the-art 32-bit RISC processor. Just like the original controller PCB, it has all logic on board. This new board can simply be fitted on the driver board, in place of the original board. Profiler Pro New processor board, increased software capabilities and mechanical upgrades 40 elektor - 6/2009 fl.ODD ColiD rive, the Colinbus control software has been expanded with quite a few new options. The program can now import G-code and is more user-friendly and more powerful in combination with the new controller. A new Z-axis is available, it's more stable and easier to mount and calibrate. And the most important option: a floating head, an accessory that you cannot do without when doing high- quality engraving work. ^ • With the new Z-axis and floating head now available, an engraving head for the Profiler is now also offered. New 3D controller Ex factory the Profiler is fit- ted with a 2.5D controller. This somewhat older con- troller is used in thousands of machines and works well. With a little effort it can also be used for mill- ing 3D objects, but when doing this you will have to take into account that the computing power of the control- ler is only enough to control two axes at a time. When creating 3D workpieces you really need a real (more powerful) 3D controller. The end result will be much nicer and the time it takes to complete a milling job will be much shorter. The FPGA and DSP based controllers used by Col- inbus in their bigger machines are too expensive and not suitable for the Profiler. So, it was decided to build a new, cheap, but nevertheless powerful, CNC controller board. This is now available and will be included in a special ver- sion of the Profiler. The new controller board is built around an ARM7, 32-bit RISC processor, which, because it uses 'pipeline' technol- ogy, is eminently suitable as a CNC controller. There is not enough space is this article to elaborate on this, but if you are interested you can consult the datasheet from NXP for more details (www.nxp.com/acrobat_download/datash- eetsAPC2212_2214_4.pdf). Even though you're using a state-of-the-art processor, all the cleverness is of course in the embedded software. This, in fact, contains four years of development. 3D circular and collinear interpolation, adjustable exponential acceleration curves and adaptive corner speeds are only a few of the Figure 1. The new PB3D controller board uses an ARM7 processor made by NXR many new features that make this controller board so fast and interesting. What makes the new PB3D controller unique, is its price. That is because it functions in ways you will only encounter in systems that are considerably more expensive. All other controllers in this price range make the attached PC carry out the necessary calculations. Such a PC has much more computing power than an embedded controller and the simultaneous interpolation of multiple axes does require a significant amount of computing power. Writing the soft- ware for a PC is therefore much simpler and cheaper. But as is often the case, the easiest path is not always the best, and there are a few disadvantages with this approach. The most important disadvantage is the PC itself. Its operating system (typically Windows) is never completely dedicated to the CNC machine, but it carries out all sorts of other tasks in the meantime as well. This strongly reduces the reliability. In addition, writing your own control software is practically impossible because the software is not open source and the manufacturer does not want to reveal all the control details. The option of working in a Linux or Mac environ- ment is usually not available or desired. But with the PB3D controller board all the intelligence resides in the controller itself. The PB3D is really a small computer capable of operating completely independently thanks to its powerful embedded software. If desired, users Figure 2. The new version of ColiDrive has quite a few changes and improvements to offer. 6/2009 - elektor 41 PROFILER MILLI Figure 3. The new Z-axis is more stable and much easier to adjust than its predecessor. In addition it also has a floating head. Here the IAC500 motor from Colinbus is mounted on the Z-axis. can write application software themselves — you only need to send the correct commands to the Profiler. On the Colin- bus website you can find extensive documentation for this (www.colinbus.com/download.htm). Because of the great computing power of the ARM control- ler, it is possible to work with much more complex routines, resulting in a more dynamic machine. In combination with the Colinbus software you will have an additional number of powerful features. These features are only available with the new board. These are also related to the processor speed and the new processor technology. And finally — we nearly forgot to mention it — you can convert your existing Profiler into a real 3D machine simply by plugging in the PB3D controller board! New version of ColiDrive The latest version of ColiDrive is available to all Pro- filer users. We strongly recommend that you download this software because there are quite a few changes and improvements. Note that there are now two versions: one for the original Profiler with the 2.5D controller called Robby, and one for the PB3D, the new 3D controller. The latter version has more features simply because the powerful 32-bit RISC pro- Figure 4. This engraving head follows the surface of the material accurately and thereby ensures a constant depth. cessor fitted on the PB3D has more features. What follows is an overview of the new features, where we will also indicate which functions are only available in the 3D version. • Import: this is what many users were waiting for: the lat- est version of ColiDrive can import and process G-code directly (with automatic detection of positive and nega- tive Z-coordinates). • Plug-in: milling or engraving of text in any size. This uses any of the True type fonts' that are available on the PC. • Direct milling or engraving of circles and squares without the need to use a CAM package. The user can select a tool and indicate whether to mill inside, outside or on the line. The software calculates the offset. • Support for a series of new drill functions: - drilling - counter boring - peck drilling - boring • New improved tool library with 'Tool Life' calculation. • Calculation of the expected processing time and costing. • Complete 3D-support ( only with PB3D controller). • The progress of the operation can now be followed in real time on the screen ( only with PB3D controller). • Every mill depth has its own colour ( only with PB3D controller). • Pause function: you can interrupt the machine at any time, perform some action and then resume, (only with PB3D controller). • Obstacle database: Enables the user to place an obsta- cle on the screen. The milling head will not go to that location. In this way you can protect objects. Obstacles can be stored and reused at any time ( only with PB3D controller). • ColiDrive now has an Undo and Redo functions (5 lev- els deep). • The project explorer keeps track of all data for a loaded file. This gives you a complete overview of all the opera- tions that have been carried out on loaded files. • New positioning options for jumping to a corner or cen- tre of an object. • Aligning different files above or next to each other has become much easier. Alignment can be done using dif- ferent reference points such as 'bottom left', 'From-file centre point' and from 'calculated file centre'. • Modern user interface with active icons. These appear only when required, which makes the software a lot more user friendly. • Many time saving features such as 'optimised down movement'. This makes the head move downwards at full speed up to a preset distance above the workpiece and then changes to the working speed. This function can reduce the working time by up to 65%. • 'Slow retract feed': this function allows you to have inde- pendent up and down speeds — very interesting when making deep holes. • Support of tool length measurement in a very simple manner (only with PB3D controller). • In the event of a problem, Colinbus Support can, with your agreement, make contact with your machine. Long telephone conversations or the sending of a series of emails can so be avoided (only with PB3D controller). The above is a limited overview if the most significant changes. You will have seen that it is certainly worth the effort to download the update. You will also receive 42 elektor - 6/2009 an update to ColiLiner. This also contains a number of improvements. New Z-axis Most buyers of the original Profiler kit had little trouble with the assembly of the machine. When there was trou- ble, it was almost always related to the Z-axis. Adjusting the guide wheels was indeed not that simple. When a number of Profilers are set up next to one another — for exam- ple at a training session — you may notice that there is some play in the Z-axis of some of the machines and this, of course, leads to poor milling results. While this can be solved with a small adjustment, this is not so easy to do because of the way the Z-axis is constructed. The Z-axis is actually the weakest part of the Profiler — it's more than adequate for light-duty milling, but unsuitable for heavier spindle motors. That is why Colinbus have designed an entirely new Z-axis for the Profiler, which is not only stronger but also more accurate than the first. Assembly and mounting is a breeze and the fact that this Z-axis also has a floating function is the icing on the cake. All these improvements come at a cost however — the new Z-axis is more expensive than the previous one and is therefore mainly intended for Profiler users requiring the heavier milling capability or more accu- rate results. Since many users are using the Profiler for milling printed circuit boards and for engraving front panels, a decision was made to provide this new Z-axis with a floating head. If you need to do heavier milling work then you can lock this function. A nice feature of this is that ColiDrive has a number of provisions to make optimum use of this engraving func- tion. So for example, it is no longer necessary for you to set the Z reference point ('zero') when milling printed circuit boards. ColiDrive saves all the parameters in a database, so that milling identical materials (such as PCBs, for exam- ple) becomes much easier. Engraving head For quality engraving work you need, in the first instance, a head which will follow the surface of the material. But you also need some mechanism that sets the milling depth. The engraving head now offered with the Profiler comes from the professional machines produced by Colinbus and has been made especially for the milling of printed circuit boards. With this head the milling depth can be set very accurately. On the side there is a facility for attaching a vacuum cleaner. This is important because otherwise the Figure 5. A few 3D workpieces made using a Profiler Pro machine. head will slide over the top of the dust pile and the set milling depth will no longer be correct. This milling head can currently only be used in combination with a high-fre- quency motor. If engraving text is the only thing you want to do then you could also make an engraving head yourself, because the professional engraving head is quite expensive. The only objective is to maintain a constant distance between the material and the tool. A few construction drawings for this are available on the Colinbus website. Certainly of inter- est is the file 'graveerhet.doc', which clearly explains the how and why of engraving (see www.colinbus.com/free- howto.htm). Finally By simply plugging another controller board into your Pro- filer you will obtain an entirely different machine. The new PB3D controller makes the machine faster, increases the number of features and enables you to make real 3D work- pieces. The new and improved ColiDrive software is sup- plied free. Users who want a more robust and more accurate Profiler can fit a new Z-axis. On the Elektor website you'l find a short video which shows the new configuration in operation: WWW.elektor. com/profilerpro. Elsewhere in this issue you will find more about the prices and ordering options of the upgrades described here. ( 090163 - 1 ) Upgrade your Profiler to a PRO milling machine! New 3D controller board, extended software and various mechanical upgrades 3D controller-board (assembled and tested) inch ColiDrive en ColiLiner update New Z-axis with floating head (assembled) Professional grade engraving head £ 339.00 / $ 494.00 / € 380,00 £ 404.00 / $ 590.00 / € 454,00 £ 263.00 / $ 384.00 / € 295,00 Prices include VAT, exclude postage and packing. For more information, a demo video and ordering go to via www.elektor.com/profilerpro 6/2009 - elektor 43 Everyone agrees; the internal combustion engine is coming to the end of its life cycle. However you don't need to go to the expense of a Prius or Tesla to experience the future of transportation devices. If you would prefer something more personal (and don't mind turning a few heads) why not build the astonishing ElektorWheelie? First take two electric motors, two rechargeable batteries and two sensors, now add two microcontrollers and the ElektorWheelie is ready to transport you in style to your destination. The power train Two sturdy 24 V DC electric motors power the ElektorWheelie up to a maximum speed of 1 2 km/h (7.5 mph). A combined power of up to 1 kW is delivered to the two axles via a reduction (approximately 1 :6) gearbox. Two 16-inch air-filled road wheels ensure good ride comfort and stability for both indoor and outdoor use. Power source Energy for the personal transporter is supplied by two 12 V rechargeable lead-acid gel cells from CTM in China Our prototype uses the 9 Ah variant but cells with 7 Ah capacity also give an acceptable range. The range depends on your driving style and road gradient. With a full battery you can expect 1 hour to 1.5 hours of use before you need to recharge from a power line outlet. C ° ns tru, Alt detail! Ucf 'o n °P a n 'J r »W briber V^sZ Wi H V^ its *-*-V t f ° *» ih y n °' v enbi!" *»/ b, y »im e , Control This vehicle which effectively has a single axle can almost automatically maintain its balance. A 3-axis acceleration sensor from Analog Devices and a gyro from Invensense are the only sensors necessary to provide attitude information to the controller. An ATmega32 samples the sensor outputs at approximately 100 times a second and continuously supplies commands to the motors to maintain the correct inclination of the ElektorWheelie. It also reads signals from the control lever. Control is quite intuitive; a light forward pressure sets the ElektorWheelie gliding ahead, while pulling back moves it backwards. Left or right pressure changes the direction of travel correspondingly. It's wasteful of energy but rotating on the spot is also no problem! Sof twa re Calculation of the vehicle's positional attitude and motor control are managed by an ATmega32 while drive motor supply current is monitored by an ATtiny25 microcontroller. Both are programmed in BASCOM. Despite the software sophistication the program size ensures that its complexity is quite manageable: altogether there are just 800 lines of code. Construction The driver stands on a rigid metal chassis which houses the rechargeable cells and compact control electronics in a protective metal casing. Safety has not been overlooked; in the event of a fall an emergency switch disconnects the motors from the batteries. - & 6/2009 - elektor - *' MICROCONTROLLERS ATM18 = RFID Savvy EM4095, ATmega and Bascom Wolfgang Rudolph and Gerhard Gunzel (Germany) RFID appears to be well on its way to becoming a technology of the future. Many people mistrust this technology, while some see it as the answer to every problem. One thing is certain: these tiny devices will be everywhere around us in the future, whether or not we notice them. Our ATM18 board provides the ideal basis for experimenting with RFID devices and implementing your own ideas. One of the potential applications of the Bascom program for this project is using RFID to control a door opener. Naturally, you can also use the relay card to connect the board to many other types of equipment and switch a specific function on or off, with the process being triggered by an RFID device. But first let’s take a brief look at the theory. RFID operating principle Let’s start by considering a mains transformer. If you connect the pri- mary to the mains and the secondary to a load, a current flows in the pri- mary winding as well as the second- ary winding. After all, how else could a current flow in the secondary? If you now remove the iron core but leave the two windings as they were, they are still coupled by the magnetic field and the same effect still occurs - although the secondary cannot supply as much power with this arrangement. If you connect an ammeter in the primary cir- cuit, you can clearly see that the pri- mary current changes when the load on the secondary winding is connected or disconnected. Even if the two wind- 46 elektor - 6/2009 VDD VSS SHD AGND FCAP MOD DMOD IN CDEC OUT CDEC IN DC2 080910 - 14A vss c □ DC2 RDY/CLK E □ FCAP ANTI E □ SHD DVDD E EM4095 □ DEMOD_OUT DVSS E □ MOD ANT2C □ AGND VDD E □ CDECJN DEMOD IN E □ CDEC_OUT S016 080910 - 14B Figure 1. Block diagram and pin assignments of the EM4095 RFID reader 1C. ings are separated by a few centime- tres, the effect of the load on the sec- ondary winding is still measurable in the primary circuit. This is the operating princi- ple of a passive RFID trans- ponder, in which an HF gen- erator drives an antenna to generate an electromagnetic field. This field induces a voltage in the receiver cir- cuit, and the energy trans- ferred in this manner powers the receiver chip. The soft- ware in this chip controls a load in the receiver circuit. Just as with a mains trans- former, the different current levels in the receiver can be detected in the primary circuit. In this way, a RFID chip can send data to the transmitter without itself transmitting a signal. Incidentally, utilisation of this principle was explicitly pro- hibited in the early days of radio broadcasting. After the first German broadcasting station started operating on 29 October 1923, it didn’t take long for a few hobby garden- ers in the surrounding area to discover that with a suit- able antenna, they could not only listen to the radio pro- gramme but also power their jury-rigged lighting system. This significantly reduced the effective range of ‘Radio Berlin Welle 400’, and it was consequently prohibited. Getting back to the present, there are now a variety of semiconduc- tor devices that you can use to build a very simple RFID receiver. For our RFID reader we selected the EM4095, a transceiver IC made by the Swiss com- pany EM Microelectronic-Marin SA, which can be used with various trans- ponder chips made by the same com- pany. The transponder, which is also called a ‘tag’, simply consists of a chip and a coil. The transponder chips that are compatible with the EM4095 include the EM4100, EM4102, EM4150, EM4170, and EM4069. We used a transponder with the EM4012 chip for our experiments. Although this chip is still available, according to the manufac- turer it has been replaced by the EM4200, which can also replace the EM4005 and EM4105. Unlike many other RFID devices, such as the Mifare cards already used in some Elektor projects, these EM chips are not ISO standard- ised, but they are neverthe- less widely used and readily available. The EM4095 The block diagram and pin assign- ments of the EM4095 (Figure 1) show a handful of pins for the exter- nal circuitry. For our project, we use the application cir- cuit shown in Figure 2. It has separate power rails for the antenna portion and the chip (DV dd and V DD ). However, a single power supply is ade- quate for our simple appli- cation. The resonant circuit of the antenna coil has two tasks: it must generate the transmit signal for the trans- ponder, and it must receive the amplitude-modulated sig- nal from the transponder. The resonant circuit consists of the antennal coil L A and Figure 2. EM4095 application circuit diagram. Main specifications RFID Reader: • Connects to Elektor ATM18 test board • Compatible with RFID tags using EM4102 and EM4200 • 5 V supply voltage Bascom RFID software for ATM18: • Reads RFID data • Outputs RFID data via RS232 • Shows RFID data on LC display • Relay control by RFID 6/2009 - elektor 47 MICROCONTROLLERS Figure 3. Block diagram of the EM4102 transponder chip. Figure 4. The 125-kHz signals on the reader and transponder . the capacitor C RES . These components determine the resonant frequency, which should be approximately 125 kHz. The EM4095 is designed for operation in the frequency range of 100 to 150 kHz and uses a phase-locked loop (PLL) to control the frequency. Naturally, the transponders also oper- ate in this range. The series resistor R SE r keeps the current in the antenna driver below the maximum rated value. As backup protection, the EM4095 also has a short-circuit detection circuit that disables the output stage in case of an overload. C DV1 and C DV2 form a capacitive voltage divider that feeds part of the antenna voltage back to the DMOD_IN input (pin 6). This input is used to feed in the amplitude-modulated signal gener- ated by the transponder. The maximum rated voltage on this input is 4 V. Capacitor C DEC decouples the DC sup- ply voltage between the sampler out- put and the filter input. Capacitor C DG2 works with an internal filter circuit to form a bandpass filter. Four lines are normally necessary for the connection to the microcontrol- ler: SHD, MOD, DEMOD_OUT, and Ready/Clock. The RDY/CLOCK line initially transmits the status signals, and later on, after the EM4095 has started operating, it transmits the clock signal to the micro- controller. The MOD signal is used to write data to the transponder. The microcontroller holds the MOD input Low during read operations. SHD is the enable input of the EM4095. The reader IC enters sleep mode when this input is set High, and in this mode its cur- rent consumption is only a few micro- amperes. When SHD is pulled Low, the EM4095 wakes up and executes a start-up process that takes 41 clock cycles. DEMOD_OUT feeds the demod- ulated Manchester-coded data stream to the microcontroller. The manufacturer provides several formulas in the data sheet and Appli- cation Note 404 for calculating the values of the external components. If RFID Good things last long Radio-frequency identification (RFID ) technology is actually old hat. The first commercial predecessors of the current technology were launched in the 1 960s. However, only now is the world ready for com- prehensive data collection. RFID is a refinement of a technology that originated during the Sec- ond World War. A system called 'Identification Friend or Foe' (IFF) was developed at that time, with the objective of enabling the American armed forces to distinguish allied aircraft from enemy aircraft. The original equipment was a large as a suitcase and very expensive. RFID technology was also used in electronic article surveillance systems as early as the 1 960s. At that time, the memory capacity of an RFID tag was only 1 bit. The 1 980s saw the introduction of RFID technology in the automobile industry. RFID chips were initially used in anti-start sys- tems, fuelling cards, and remote vehicle entry systems. As in all other fields of electronics, miniaturisation proceed rapidly. This opened up more and more application areas, such as credit cards, ac- cess control systems, and personal identification systems. In addition to security and logistics, animal identification is an impor- tant application area for RFID. In November 2002, the US Food and Drug Administration (FDA) approved a controversial use of RFID tech- nology: chips embedded in people. The 'Verichip' RFID chip produced by the US company Applied Digital Solutions is designed to be embed- ded subcutaneously (beneath the skin). In an emergency, doctors can immediately read out vital patient information, such as the person's blood type and any current allergies or illnesses. However, there are now access control systems for companies and even discos that are im- plemented using embedded RFID tags. Everyone should carefully con- sider whether he or she is willing to have a system of this sort 'installed' in their body. Lending libraries, such as the new Vienna Main Library, use RFID tags for inventory control. Special types of RFID readers can read a group of RFID tags in a single operation. This technique is called 'bulk reading'. Another application for RFID technology, which is already extensively exploited, is electronic transport cards that can be read without physical contact and reloaded. They are used successfully in numerous Asian metropolises, such as Hong Kong and Singapore. 48 elektor - 6/2009 1111 1 1 1 1 1 8 version bits or D00 D01 D02 D03 P0 customer ID D10 Dll D12 D13 PI D20 D21 D22 D23 P2 32 data bits D30 D31 D32 D33 P3 D40 D41 D42 D43 P4 D50 D51 D52 D53 P5 D60 D61 D62 D63 P6 D70 D71 D72 D73 P7 D80 D81 D82 D83 P8 D90 D91 D92 D93 P9 PC0 PCI PC2 PC3 SO 4 column parity bits 9 header bits 10 line parity bits 080910 - 18 Figure 5. Configuration of the 64 bits stored in the EM4102. you find this too complicated, you can use a spreadsheet available from the manufacturer’s website or the project page on the Elektor website (www. elektor. com/080910). This makes the calculations relatively easy and semi-automatic. The transponder RFID devices are actually modules that are available in a variety of forms, such as smart cards, small glass tubes, and key fobs. Figure 3 shows block diagram of the EM4102 transponder chip and its indi- vidual functional blocks. The only external component is the coil con- nected to the Coill and Coil2 pins. The voltage induced in the coil is fed to a full-wave rectifier and used as the operating voltage. The clock frequency is generated in the Clock Extrac- tor. The Sequencer uses this clock to shift data out of the memory into the data encoder. There the data is proc- essed according to the protocol that is used and fed to the Modulator, which drives the antenna coil. The reader and transponder frequencies are syn- chronised. The modulator produces an amplitude-modulated HF signal in the transponder coil, with the data in the sidebands. The signal envelope at the reader is exactly the opposite (see Figure 4). As previously mentioned, part of the mod- ulated voltage is tapped off, and the reader can filter the transponder data out of its own ‘attenuated’ signal. The read data can be coded in various manners. Protocols such as Manches- ter, bi-phase, PSK and FSK are widely used. In our EM4102, the data (which is hard-coded in the memory) is Man- chester coded for output. Manches- ter coding is commonly used for serial data transmission on a data line. The payload data is XORed with a signal at twice the data clock rate, which elim- inates the need for a separate clock line. The clock and payload data are first synchronised at the start of the coding process, and the clock and data are XORed on each edge of the clock signal. This produces the transmitted data stream, which is used to modu- late the 125-kHz carrier signal. In our case, the data stream consists of 64 bits. This is broken down as follows: header (9 bits), data (40 bits), row parity (10 bits), column parity (4 bits), and stop bit (1 bit). This is illustrated in graphic form in Figure 5. The data is read out row by row from the top left to the bot- tom right as 64-bit data string. The nine ‘1’ bits are the header. Each of the next ten rows consists of four data bits and one parity bit. The last row consists of the four column-parity bits and the stop bit, which is always ‘O’. The first eight bits of the data field are customer- spe- cific. The purchaser can store a fixed company ID or internal company code here, assuming that a sufficiently large quantity of chips is ordered. However, rapid technological progress in recent years has led to a con- fusing proliferation of incompatible systems, in part due to the failure to define uniform standards in a timely manner. The future widespread use of RFID technology will doubtless depend in part on the extent to which agreement on uniform standards can be achieved. To enable RFID technology to be used across company boundaries and nation- al borders, interested parties in the industrial and mercantile sectors acting under the guidance of European Article Numbering (EAN) In- ternational and EPCglobal have founded the Uniform Code Council (UCC). EPCglobal has developed the 'Electronic Product Code' (EPC), which can be used to describe manufacturers and products uniquely. This code consists of 96 bits, divided into four groups: an 8-bit header, a 28-bit manufacturer code, a 24-bit object class code, and a 36-bit serial number. This is sufficient to identify 6.87 x 10 10 items in each of 1.67 x 10 10 object classes for each of 2.68 x 10 8 manufacturers. This standard is currently supported by Wal-Mart, the Metro Group, Carrefour, and Tesco. With the combination of the product code and a database, it should be possible to fully describe every merchandise item in the world. Several manufacturers, such as NXP, Infineon and Texas Instruments, produce various types of RFID tags for a wide range of applications. In the simplest and most economical versions (read-only tags), the transponders contain fixed, non-alterable ID codes These tags are very small and maintenance-free. Transponders are often attached to a plastic film along with their antennas. This form of transponder can be printed with visible information and handled similarly to paper. These 'smart labels' are available in several versions. Depending on the type and the frequency band, they can be read out at distances ranging from a few centimetres to 1 00 metres. RFID tags with writable memory offer higher performance and in- creased versatility. Depending on the type, the memory capacity ranges from a few bits to several hundred kilobytes. RFID tags with built-in encryption mechanisms are used in applications with high security re- quirements RFID tags with a microprocessor and an internal operating system are also available now. These tags are usually produced in the form of smart cards (dual-interface cards). RFID devices are basically classified as passive, active or semi-active, depending on how they are powered. In contrast to active RFID de- vices, passive RFID devices do not have an internal source of power. Semi-active devices switch automatically into sleep mode, and they can attain a very long battery life of up to six years. Active tags have the advantage that they can be used together with integrated sensors for temperature monitoring or precise localisation (in combination with a GPS receiver). 6/2009 - elektor 49 MICROCONTROLLERS +5V Figure 6. RFID reader circuit for connection to the CC2 AVR board. The transponder sends this 64-bit sequence repeatedly as long as oper- ating power is available, which means as long as it is within range of the reader. The coded signal starts and ends with the same phase state. As a result, the start sequence of nine ‘1’ bits can be detected unambigu- ously when the received signal is processed. Transponders using the EM4102 are among the simplest type of RFID devices. They emit only the data stored in the chip during manufacture, with no possibility of storing user-gener- ated data in the RFID device. Their sole utility arises from the fact that each EM4102 contains a code that is issued only once, which means that each tag can be identified uniquely. This is fully sufficient for applications such as door openers, anti-start systems, or identi- fying cattle. The RFID reader board The ATM 18 board needs an extension to enable it to recognise and read RFID devices. This extension is the RFID reader board. For this purpose, we use the previously described EM4095 in the circuit shown in Figure 6. The IC is wired the same as in the data-sheet application circuit diagram shown in Figure 2. The capacitor values are: C RES = 2 nF (C3 + C4), C DV1 = 47 pF (C5), and C DV2 = 1 nF (C2). Series resistor R SE r has a value of 68 Q (Rl). The sec- ond capacitor position C6 in parallel with C5 allows the value of C DV1 to be adjusted if necessary. A small PCB (Figure 7) has been designed for assembling this circuit. It connects to the ATM18 board. The extension board is available from the Elektor Shop with the SMD compo- nents pre-assembled, so you only have to solder the coil leads and the con- necting links to the ATM 18 board. The antenna coil is a DIY construction. The circular coil, which can be seen in the photo, consists of 160 turns of 0.6-mm enamelled copper wire. The coil diameter is approximately 23 mm, which means that you need 12 metres of wire. If you can find a suitable form in your junk box and chuck it in a drill, winding the coil is very easy. The inductance of the coil is approxi- mately 780 jL/H. If you have an induct- ance meter or a multimeter with an inductance range, you can check the value of the finished coil. However, the exact value is not especially criti- cal. In our tests with this antenna coil, the transponder with the EM4102 was recognised immediately every time. We obtained the same result with the rectangular coil shown in the photo at the head of this article. It comes from an EM4095 reference design kit that is available from MCS Electronics (which also produces Bascom). The circuit dia- gram is described at a site referenced by one of the links at the end of the article. In practice, the EM4095 reader board works OK without any alignment or tuning, but for maximum sensitivity the oscillator frequency should be as close as possible to 125 kHz. To avoid accidentally shifting the oscillator frequency while measuring it, do not make the measurement directly on the coil, but instead use a small ‘sniffer’ coil brought within range of the antenna coil. A circular or rectangular coil with a diameter or edge length of around 60 mm, made from insulated or enamelled wire with a diameter of 0.5 to 1 mm, is suitable for use as a sniffer coil. If the frequency measured using the sniffer coil differs significantly from 125 kHz, you can correct the situation by changing the number of turns of the coil. Reducing the number of turns Figure 7. RFID reader PCB for assembling the reader circuit shown in Figure 6. COMPONENT LIST Resistor (SMD 0805) Rl = 68D Capacitors (SMD 0805) C5 = 47pF C2 / C3 / C4 = 1 nF C7,C8 = 1 OnF Cl ,C9,C1 0 = lOOnF C6 = not fitted (see text) Semiconductors IC1 = EM4095 (SMD SO 16) Miscellaneous K1 = solder pin K2 = 2-way pinheader, 0.1” lead pitch K3 = 5-way pinheader, 0.1" lead pitch PCB with SMD parts prefitted, incl. pinhead- ers, order # 080910-91 50 elektor - 6/2009 increases the frequency, and of course, increasing the number of turns reduces the frequency. Testing and connection For the first functional test of the EM4095 reader card, you need a 5-V power source and an RFID tag that can be detected by the EM4095. This can for example be a transponder with an EM4102 in the form of a key fob, as shown in the large photo. Figure 8 shows an example of the acquisition of an RFID tag. The upper waveform in the oscillogram is the modulated 125-kHz signal, and the lower waveform is the data signal at the DEMOD_OUT output (pin 13 of the IC or pin 2 of connector K2 on the PCB). As you can see, the transponder sends its data as it is supposed to - this is what you should see when everything is in order. In order to evaluate and display the data, the reader board must be con- nected to the CC2 system as shown in Figure 9. Here SHD is connected to PB3, MOD is connected to PB4, and DEMOD_OUT is connected to PD2, along with the connections for +5 V and ground. The connections between the CC2 board and the LC display mod- ule and the relay board are also shown in the wiring diagram. The only thing you still need at this point is the Bas- com program, which is our next topic. RFID and BASCOM The program code is very simple because almost all of the tasks are handled by a library (‘lib’) function. The lib function formats the data read from the RFID tag into bytes and places the data on the stack. If you read this data as a normal array using the example Bascom code, the byte sequence is reversed. You should bear this in mind and take it into account in the further processing of the data. Familiar subroutines are used to dis- play the data on the LCD module and to control the relays on the relay board. All of these routines have been used before in related articles in this series, where they are described in detail. The program outputs the data to the serial interface in addition to displaying it on the LCD module, so the data can be saved or further processed on a PC and displayed using a terminal emula- tor program. Figure 8. Oscillogram showing the modulated 125-kHz signal (top) and the data signal at the DEMODOUT output of the EM4095 (bottom). □□□□□□□□□□□□□□□□□a □□□□□□□□□□□□□□□□□□ □□□□□□□□□□□□□□□□□a □□□□□□□□□□□□□□□□□□ 080910 - 12 Figure 9. Wiring diagram of the RFID project with the RFID reader board, ATIVI18 board, LC display module, and relay board with port expander. 6/2009 - elektor 51 MICROCONTROLLERS Figure 10. Flow chart of the Bascom software for the RFID project. The flow chart in Figure 10 depicts the logical structure of the RFID reader program. The actions shown in red and green are not handled by normal Basic commands, but instead call assembly- language routines in em40951ib. The RFID library for the EM4095 reader IC is integrated into Bascom version 1.11.9.0 and later. When a transponder is recognised, the data is decoded using an interrupt rou- tine. The data is saved in memory and can re read out as a byte array. The details A number of entries in the main rou- tine are necessary in order to link in the library. The entries shown in red relate to interrupt handling, while the entries shown in green are for calls to the library function. Config Hitag = 64 , Type = Em4095 , Demod = Pind.2 , Int = @intO ‘Hitag’ is the division factor for the clock frequency. ‘Typ’ is the reader IC type. ‘Demod’ is the number of the input pin for the Manchester-coded signal. ‘Int’ is the expected interrupt. ‘Demod’ and ‘Int’ are physically linked together. As you can see from the data sheet, interrupt 0 is associated with PIND.2. Config IntO = Change The Manchester-coded signal is applied to interrupt pin D.2. The inter- rupt routine is triggered by the rising and falling edges of the input signal. On IntO Checkints ‘On IntO’ declares the interrupt routine ‘Checkints’. Enable Interrupts This sets the Interrupt bit in the sta- tus register. Checkints: Call _checkhitag Return ‘Checkints’ is the interrupt routine that was previously declared with ‘On IntO’. DIM Array(5) as Byte ‘DIM Array(5)’ reserves memory space for five bytes. The main routine runs in a DO loop, and initially all it does is to indicate via the LC display that nothing is happening. The Checkints interrupt routine is only triggered when a transponder enters the range of the EM4095. The interrupt routine in turn calls the library function ‘_checkhitag’. This assembly-language routine reads in and decodes the Man- chester-coded bit string. It calculates and checks the parity and then stores the data bytes in an array. If a time- out or any other sort of error occurs, the function terminates without writ- ing new data to the array. The main routine then continues from the point where it was interrupted. The IF statement evaluates the return value of the ‘Readhitag(Array(l) )’ function. The ‘Readhitag’ function, which is integrated in Bascom, also calls EM4095.1ib. It passes the start address of the previously defined byte array (with ‘1’ as the initial address) as a call parameter. The library rou- tine stores the data at the address passed in the call and returns a ‘1’ if the result is valid (data present in memory). The Interrupt bit in the status register is then cleared to pre- vent the data from being changed by 52 elektor - 6/2009 another interrupt. Now the data can be read from the array and displayed in a FOR... NEXT loop. The example program also actuates a relay for one second at this point. After this, the Interrupt bit is set again in the status register and the entire proc- ess starts again from the beginning. A wealth of possibilities As usual, this project is intended to provide a sound basis for developing your own applications. The hardware and software described here are suit- able for recognising and reading RFID devices fitted with the very economi- cal EM4095 chip (see Figure 11). A relay on the CC2 relay board closes and opens at one-second intervals as long as a RFID device is acquired by the reader. The relay contact can be used to control another device, such as a door opener. However, the potential applications are practically unlimited. Some examples include a cat door controlled by a ‘cat RFID’ tag, a battery charger with RFID battery identification, childproofing a PC or television set, a DIY anti-start unit for a motor boat, and so on. We’re sure that you can come up with many other potential applications. ( 080910 - 1 ) Internet Links http://avrhelp.mcselec.com/index.html (EM4095 reader under: Bascom Hardware > Reference Designs) www.elektor.com/08091 0 (Elektor project page for this project, with download files for the software and PCB layout) Advertisement Schaeffer 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. FRONT PANELS & HOUSINGS Cost-effective single units and small production runs • automatic price calculation • delivery in 5-8 days • 24- Hour-Service if required Sample price: 32,50€ plus VAT/shipping Schaeffer AG • Nahmitzer Damm 32 • D-12277 Berlin • Tel +49 (0)30 8058695-0 Fax +49 (0)30 805 8695-33 • Web info@schaeffer-ag.de • www.schaeffer-ag.de Tel: 01 635 40347 ■+, .v:ij!i Ll9Elruii:s Llrl an*: o i j - :■ h-i c i biau.uHtftiF.t-flEp.xaTux.i H nw. wda rW-a Ihaaz-ja i h 6/2009 - elektor 53 specialised Whatever your programming needs, you'll find the solution at Dataman Dataman's next generation programmers are built to meet the demands to support all device technologies and designed to achieve the highest speed of programming required for todays production. Features... USB 2.0 and parallel connectivity Universal ZIF socket up to 8 x 48 pins Intelligent pin drivers allow varying voltages to be applied to any pin Multi-Programming support ISP capability with JTAG Interface Concurrent and Semi-concurrent gang programming Stand-alone operation with touch screen control Easy to use software supporting over 45,000 devices Free software upgrades and technical support for the life of the product All goods are ex-stock ready for same day despatch 30 day money back guarantee (returns during trial period are less than 1°/o) from £295 +VAT nArAniAn For over 25 years Dataman have been at the forefront of supplying high quality, reliable programmers and this is maintained by offering up to three years parts and labour warranty on programmers. Dataman Programmers Ltd. Station Road Maiden Newton, Dorset DT2 OAE UK Tel (01300) 320719 Fax (01300) 321012 www.dataman.com LABTALK INFOTAINMENT BeeProg+ in use at Elektor The meaning of 'One for All' Jan Buiting (Elektor UK/US editorial) Many readers are curious to know just what gear, software and tools is in daily use in the Elektor Labs. One really crucial piece of equipment is our BeeProg+ multi-device microcontroller programmer system. The guys from Elektor Labs are talkative like no other and good e-pranksters from time to time. On the cathode (down) side, they suffer from perennial writer's block and are too modest about their discoveries of real gems in electron- ics and embedded land. In other words, they are sitting on heaps of useful information you have to pull from them — from hidden FAT32 partitions or from under their desks. That happens to be my job. A little history - from the lab It must have been in 200 5 when a Slovakian company called Elnec kindly supplied a sample of their SmartProg2 multi-device programmer for writing a few words about in Elektor (Figure 1). That was duly done but the program- mer was never returned — sure, we told Elnec, they did not mind. In fact the SmartProg2 was so good it was sort 6/2009 - elektor 55 INFOTAINMENT LABTALK Figure 1. Elnec's SmartProg2 was used for a number of years in the Elektor Labs for one-off microcontroller programming and small series. of confiscated for use in the Elektor Labs, more specifically in the ESS department (Elektor Software Service) where it went into permanent service. Since then, many hundreds of master devices for microcontrollers, (E)PROMs, EEPROMs and other programmable devices have been 'burned' on the SmartProg2 for use in our prototype circuits (or bin- ning or erasing if an error was found). The programmer was also cheerfully used by lab workers Luc, Robert-Jan, Chris, Antoine, Paul and myself (for occasional program- ming of 24C16 EEPROMs). For a number of years we laughed at every new micro thrown at us by Silicon Val- ley's joint forces. We pulled the latest device parameters from the Elnec website, plugged in the odd adapter board and burned a guinea pig. Here I have to mention that Elektor, unlike some of its com- petitors, is an independent publication not restricted to one specific kind of microcontroller for use in published projects. A solid principle for sure (very open-minded & all that) but one that calls for programming support of a galaxy of devices from an ever longer list of manufacturers great & small, famous & obscure. Equally long is the list of device housings like SOIC, PLCC, DIP, you mention it. While you (or your boss) may be happy to stick to just one brand and have a matching programmer to burn your own micros, Figure 2. At Elektronica 2008 meeting up with Elnec representatives Jan and Vladimir. here at Elektor we have far wider requirements because we will strive to support whichever microcontroller our readers care (or dare?) to propose for their projects, once accepted for publication. In Munich The story continues in Munich, at the 2008 edition of the immense 'Elektronica' show, with an unplanned visit to the booth of Elnec. Joined by Paula Brady, Elektor's advertise- ment executive, I talked to Elnec's Sales & Marketing Direc- tor Vladimir Doval and R&D Director Jan Puobis (see Fig- ure 2 for the backdrop). Vladimir explained that many of Elnec's programmers were marketed under different brand names in countries all over the world. In Continental Europe, for example, the programmer cov- ered in this article is known as BeeProg+ and sold by Elnec directly [1]. In the UK, the brand name is Dataman- 48Pro+ [2], in the USA, BK Precision Model 866B [3]. Together we recalled the story of the SmartProg2 sup- plied to Elektor and discussed the range of programmers currently manufactured by Elnec. It seemed to me that the BeeProg+ was the logical successor to the SmartProg2 and Vladimir did not hesitate to send me one by courier — it was on my desk within a week. In the lab again You can guess what happened. At Elektor House the BeeP- rog + box was immediately opened by the lab guys to "inspect the build quality" but really to satisfy their instinc- tive urge to know "what's inside" (Figure 3). They were greeted by two (!) Spartan FPGAs, a PIC 1 8 F micro, a Cypress CY7 chip and lots of assorted logic, all on three high-density stacked boards. In what little time it took them to fit the cover again, and me to tell that the BeeProg-i- was a 'Universal 48-pindrive programmer with USB/LPT inter- face and ISP capability', the software was installed on the resident ESS PC and the unit powered up. The program- mer was in full use within the hour and according to the main user, Jan Visser of our ESS, its distinct advantages are (quote): 1 . "versatility to the highest level" 2. "kissable software" 3. "device updates whenever I need them" 4. "a socket converter to suit even the quirkiest of 1C housings" 5. "ISP connectivity alongside the friendly 48-pin ZIF socket" 6. "great for small series too" (end quote). As with the SmartProg2, I had to pull the BeeP- rog+ from my colleagues' hands to get the photos done for this article. It is truly a Programmer's Delight. 45k + devices supported Recently the lab guys ran into "this horrible 1C" they were struggling to get programmed and in fact an entire project based upon it, the LED Spinning Top with Special Effects (December 2008) almost got delayed for publication. Almost. I decided to make a case of it and asked Vladimir at Elnec for a matching TQFP32 adapter (# 70-0135) to 'do' this particular Atmel beast, the ATmega8-l 6AU. Within a week, shouts of hooray and a working prototype. Still later, a highly successful article. 56 elektor - 6/2009 The list of devices you can program on the unit is so long it would easily fill a com- plete edition of Elektor. If you are not convinced, or into really esoteric micros, give the Devices section on the Elnec website a try — you'll be amazed 4]. From a 2708 EPROM (8 kbit and 30 years old) right up to Actel IGLOOs, it's all there. The most recent device list we found (v. mid March 2009) had a length of 45,797 devices. The Beeprog-i- is also capable of testing logic ICs (54/74 S/LS/ALS//H/HC/ HCT series, 4000, 4500 series) and static RAMs (6116 through 624000). It also supports user definable test pat- tern generation. The socket converter list at [5] may well be the longest I have seen. From commonly found housings like DIL, TSSOP, SOIC and PLCC right up to esoteric stuff like QFP256 and FBGA484. The socket converters are very high quality builds without exception, but relatively expensive compared to the programmer proper. The ISP connector is a polar- ised 20-pin type with six TTL pin- drivers, lx VCCP (2-7 V, 100 mA); lx VCCP (sink or source); lx VPP (2- 25 V 50 mA); 1 x target system supply (2-6 V, 250 mA); ESD protection (IEC1 000-4-2); 2x sta- tus indicator and a YES! equivalent input signal (max. 0.8 V active level). Out of the box The BeeProg+ comes with diagnostic pods (test adapters) for ISP and ZIF-48, an ISP flatcable, an anti-dust cover for the ZIF socket, a USB cable, software on CD, and paper- ware (including a fine manual). Remarkably the program- mer also supports the vintage 25-way parallel printer con- nection. The power supply is internal and happily takes anything between 1 1 0 and 240 volts AC, 50 or 60 Hz. A quad version of the BeeProg+ is also available under the name Beehive4+ while a nest of eight BeeProg+s is contained in the stand-alone BeeHive8S. Figure 3. A look inside the BeeProg+ — a very powerful microcontroller system on its own! Technically speaking The BeeProg+ has three internal DACs for the programming voltages VCCP (0-8 V, 1 A), VPP1 and VPP2 (both 0-26 V, 1 A) supporting controllable rise and fall time. It has a USB 2.0 high-speed compatible port with up to 480 MBit/s transfer rate, and an FPGA based IEEE 1284 (ECP/EPP) slave printer port with up to 1 MB/s transfer rate. The pindrivers on the ZIF socket are capable of 'being' either TTL (H, L, CLK, pull-up and pull-down) or analogue (1 .8-26 V) with protection against overcurrent, power fail- ure and ESD (IEC 1000-4-2). ( 090006 - 1 ) Internet Links [1] www.elnec.com [2] www.dataman.com [3] www.bkprecision.com [4] www.elnec.com/$earch/device-li$t/?prog = 22 [5] www. elnec.com/produ cts/ socket- co n ve rte rs/ Advertisement 2 boards in 5 days No tooling charge Low PCB-Proto prices E.g. 2x 160x100 mm: 2 layers 49C each* 4 layers 99C each* Immediate online ordering No minimum order charge ^excluding transport and VAT Prototype & small series PCB specialists PROTO Instant online pricing and ordering Low order-pooling prices - 1-8 layers Full options service On demand - 1-16 layers Deliveries from 3 days Stencil service CIRCUITS Call us: 020 8816 7005 Email: euro@eurocircuits.com www.eur0circuits.com NEW show - Earls court, stand H31, 16-18 June 6/2009 - elektor 57 MINI PROJECT Ton Giesberts (Elektor Labs) The audio power ampli- fier described in this article is no ordinary analogue amplifier stage, but a ‘digital’ version that uses pulsewidth modulation (PWM). In fair- ness, we will be upfront and state that this amplifier has quite a bit of distor- tion and so this is absolutely not a hi-fi or high-end amplifier. The circuit is far too simple for that. On the other hand, the circuit does give a unique sound to the music. The digital amplifier has perhaps a ‘tube-like sound’ quality. PWM amplifier A PWM amplifier has, in principle, a very high efficiency, because the out- put is switched at high frequency between the positive and negative power supply voltages (or ground) (see Figure 1). Since the output transistors, are driven, one at a time, either fully on or fully off, the voltage drop across the transistors when on, and the cur- rent through the transistors when off, are minimal. This means that the (heat) losses of the transistors remain small. While the transistor is on, there is a pulse at the output. The width of this pulse is proportional to the amplitude of the original input signal. The width of this pulse is also a measure of the size of the output signal (and by exten- sion the volume level of the amplifier). There are plenty of designs for simple audio power amplifiers. These generally have a dass-AB or dass-B topology. Here we present a very compact dass-D design that can be powered from ^ four AA batteries and because of its relatively high efficiency can elicit quite a few decibels from a loudspeaker. This can be seen clearly in Fig- ure 1: the places where the positive side of the signal is the largest cor- respond with the highest (sine) sig- nal levels. This, of course, is also true for the negative half of the signal: the smaller the positive side of the pulse (and therefore the wider the negative side), the smaller (‘more negative’) the output signal. The size of the output signal is there- fore determined by the ratio between Technical specifications • 1 W into 8 Q, 1 .7 W into 4 Q • Class-D • Power supply 6 to 9 V (4x AA cell) • Very compact • Simple construction without SMDs the positive and negative pulse. The bigger the difference, the bigger the output signal. And the other way around: as the ratio between positive and negative pulses approaches 50/50, the lower the output signal becomes. Only a low-pass filter is required to convert the PWM signal back into the (amplified) original signal. This filter removes the high switching frequency from the signal so that only a kind of ‘average’ remains, which corresponds exactly to the original signal. The circuit The circuit (see Figure 2) is a so-called self-oscillating pulsewidth modula- tor. This is actually an amplifier stage which is oscillating badly. A low-fre- quency signal affects the oscillation, which results in pulse-width control. Because the amplifier is powered from a single-ended power supply (6 to 9 V), decoupling capacitors are required at the input and output (Cl and C7). It is mainly the output capacitor that determines the lowest frequency that is passed. The selected value is always a compromise between physical size and bandwidth, just as with analogue amplifiers. For driving the output stage, a few buffers from the ‘4000’ series logic series are used. The main advantage of this series is their large supply voltage range. Their limited speed is not really a concern here. In order to obtain suffi- cient gain, two gates are connected in series and the remainder are connected in parallel with the second buffer. This results in a better drive signal for the output stage (necessary because of the 58 elektor - 6/2009 Figure 1. The PWM signal corresponding to a sine wave. After filtering of the PWM signal the original signal reappears. high input capacitance of the output stage). We chose MOSFETs in an I-PAK pack- age (TO-251AA) made by IRF for the output stage. These small transistors can handle more than 4 A (the N-chan- nel MOSFET can cope with more than 7 A). The channel resistance of the N- channel MOSFET is about 0.25 Q and for the P-channel MOSFET it is about 0.5 Q. Because of these low values of chan- nel resistance, it is important that both transistors do not turn on at the same time (dead time is required). In series with the outputs from the gates are 220 Q resistors, each in parallel with a Schottky diode. This ensures that the voltage at the gate of one MOSFET is discharged quicker than it is charged at the gate of the other one. In our prototype we used a reasonably common noise suppression choke for the output inductor in the low-pass fil- ter (LI). This choke is rated for loads up to two amps. But you can also use a smaller choke, such as axial versions for medium-current applications. Just make sure that such a choke will fit on the PCB. We deliberately selected a coil that can handle more current than strictly necessary (at a load of 4 Q the peak current is less than 1 A). In order to keep the physical size of coil small, a core is used, but this results in non-linearities which become increas- ingly larger as the core approaches saturation. So as to operate in a rea- sonably linear region, a slightly big- ger inductor was selected. By using an axial version and mounting it upright, the space required has been kept to a minimum. An air-cored coil would have been the best choice, of course, but that is not an option here because of its physical size. As already mentioned, only a low-pass filter is required to turn the digital sig- nal back into an analogue signal. LI, together with C5 forms a 2 nd order low-pass filter (Butterworth) which suppresses frequencies above 40 kHz. This is also necessary to ensure that the circuit does not cause interfer- ence to other devices (EMC). The RC network R6/C6 ensures that the filter continues to work properly at higher frequencies. R1 maintains the input side of Cl at ground level, so that no annoying sounds are generated when the sig- nal source is connected with the cir- cuit already turned on. With the loud- speaker we assume that it is always connected (which is why there is no resistor in parallel with the output terminals). Loudspeakers are complex loads and are mainly inductive at higher frequen- cies. The ‘gain’ of the circuit is deter- mined by the feedback R2/R3. With the values we selected the gain is about one, which, given the power supply +9V jl BT1 9V 5_L C2 C3 0 2 ici 100n lOOu (J) 40V 0 Cl R2 lOu 63V R1 R3 72k ICI A ICI = 4050 ICI B ■> C4 270p ■> +9V O IC1C < i — • ICI D 10 ICI E 11 > 12 ICI F 14 15 BAT85 IRFU9120 IRLU120 LI n j /-vwn 40 uH C7 lOOOu BAT85 R6 Dh 25V C5 ■/[ LSI ce 330n ^220n 080277 - 11 Figure 2. The circuit has very modest dimensions so it will all fit on a compact printed circuit board. 6/2009 - elektor 59 MINI PROJECT Figure 3. The frequency curve depends in the connected load. Here are the curves for an 8£2 resistor (blue) and a loudspeaker (red). voltage and output range, gives suffi- cient sensitivity. From practical tests it appeared that typical sound cards will probably not supply a sufficient signal to obtain a full output signal from the amplifier. But don’t panic: in Part 2 we will describe a board of the same size, which contains a matching preampli- fier and extensive tone control. Results The current consumption in the idle state is at 44 mA clearly too high for battery use, certainly if more than one board is used. This is caused mainly by the relatively high switching fre- quency of 660 kHz at a power supply voltage of 9 V and the absence of a proper dead-time control (the value of 220 Q for R4 and R5 is therefore also a compromise). Fortunately, the frequency reduces at lower power supply voltages (this is because the buffers that are used here become slower at lower supply voltages), which benefits the current consumption. At 6 V (/ s is 510 kHz) the current consumption is down to 10 mA and it is possible to use a set of four AA dry cells. At 5 V ( f s is 450 kHz) the current consumption is only 6 mA. However, we recommend that you use the circuit with a power supply volt- age in the range from 6 to 9 V. The absolute maximum is 9.5 V, which is an overvoltage of a little more than 5%. At this voltage the current consump- tion has increased to 60 mA. A power supply voltage below 5 V gives an insufficient drive signal (not enough voltage for the gates). At 9 V the maximum output power into 8 Q (clipping) is 1 watt. Into 4 Q the maximum power has not doubled but is about 1.7 watts. Voltage drops across the choke and output capacitor, for example, begin to have a significant effect on the maximum available out- put voltage. At 9 V this amplifier, sitting on the desk, produces quite a bit of noise already, even when a small loud- speaker is used. At 1 mW the distor- tion is less than 0.5%. The bandwidth with an 8 Q load ranges from 18 Hz to 40 kHz (blue curve in Figure 3). The low corner frequency is determined by C7, the high corner frequency by the low-pass filter (Ll/C 5). With small loudspeakers this is more than enough because this is often more than what small speaker boxes can reproduce. As already mentioned the blue test result (Figure 3) shows the amplitude characteristic into a pure 8 Q load. When a loudspeaker is connected, a small increase (about 1 dB) of output voltage can be observed around the resonance point (red curve). At the corner frequency of the filter (around 40 kHz) a peak of several dBs can occur. This is because the Butterworth filter is no longer terminated correctly. In the figure it may appear that this peak is rather large, but if you have a look at the scale it is obviously not that bad. At 20 kHz the peak is only 2.5 dB. This does no harm in principle, and a lot of people actually appreciate this. The PCB is very compact. The accom- panying pre-amplifier, which is planned for next month, has the same dimen- sions so that a complete and very com- pact mini- amplifier can be realised. We will elaborate on the availability of the PCB in the next instalment (September 2009). ( 080277 - 1 ) Figure 4. Although 'standard' parts are used the PCB is still very small. The parts are packed quite close together however. COMPONENT LIST Resistors R1 = 470ka R2 = 1 OkQ R3 = 1 2k£2 R4,R5 = 220£2 R6 = 8 £22 Capacitors Cl = 1 0jL/F 63V, radial, 6mm diam. C2 = lOOnF ceramic, lead pitch 5mm C3 = 1 00jL/F 40V, radial, 8mm diam., lead pitch 0.1" (2.5mm) C4 = 270pF, ceramic, lead pitch 0.2" (5mm) C5 = 330nF, MKT, lead pitch 0.3" (7.5mm) C6 = 220nF, MKT lead pitch 0.3" (7.5mm) C7 = 1 000jL/F 25V, radial, 10mm diam., lead pitch 0.2" Inductors LI = 40jL/H 2A axial (mount vertically) e.g. Epcos type B821 1 1 EC23; Farnell # 9753354 Semiconductors D1,D2 = BAT85 T1 = IRFU9120NPBF (TO-251 AA/I-PAK, International Rectifier) e.g. Farnell # 8659206 T2 = IRLU120NPBF (TO-251 AA/I-PAK, International Rectifier) e.g. Farnell # 8651345 IC1 = 4050 Miscellaneous SI = 1 make contact, lAmin. (noton PCB) 60 elektor - 6/2009 GI-UK-2 gte fetor /iternet ' Elektor PLUS advantages • Cheaper than 1 1 issues from the newsstand j save: £41 .00 £ 6.10 £17.50 £31 .50 Subscription PLUS 1 0 Magazines 1 Double Issue (Juiy/Augus ) Annual DVD-ROM 2GB MP3 player I - = £43.10 Your saving £8.50 Discount on the new Annual DVD-ROM With every issue subscribers get up to 40% discount on selected Elektor products As a welcome gift you get a free 2GB MP3 player worth £31 .50 No queues, travelling, parking fees or “sold out”; Elektor is supplied to your doorstep every month Always up to date - read your copy before everyone else ■r. liN The Elektor PLUS subscription Keep 43.1 ( in your pocket! www.elektor.com/subs • Tel. +44 (0) 20 8261 4509 electronics worldwide Or use the subscription order form near the end of the magazine. POWER SUPPLIES Ton Giesberts (Elektor Labs) Campsite AC Monitor Those of you who go camping regularly will have experienced this before: you switch on a powerful electric hob just when the fridge is on and the campsite fuse blows. It's a pain because the campsite manager usually has to be called to replace or reset the fuse and the exercise can cost a lot of money. This campingsite AC monitor makes these occurrences a thing of the past. Camping hook-ups for power line supplies usually have a limit on the amount of current that can be drawn. When a larger current is drawn it trips a fuse, which most likely has to be reset by the campsite man- ager and which probably results in a fine (or ‘service charge’) to be paid. To prevent such inconveniences we have designed this controller that can quickly limit the maximum cur- rent drawn. 62 elektor - 6/2009 Primary operation This circuit ensures that the current cannot increase any further once a presettable value has been exceeded. One consequence of this is that elec- tronic devices (such as TV sets, radios, energy saving bulbs) must not be con- nected to this circuit. The circuit is primarily intended to be used with energy-hungry appliances such as electric ovens, hobs (without electronic controls!) and pressure cookers. These can sometimes consume as much as 3 kW. The turning on of such an appli- ance can result in the immediate drop- ping out of the power line voltage. To avoid this it is best to connect the controller between these devices and the AC power line. The smaller appli- ances can then be connected directly to the power line. You should still bear in mind what the total current con- sumption of these devices is, how- ever. For example, if this is just under 1 A then the value set in the controller should be one Amp less than the maxi- mum current that can be drawn from the camping hook-up. The circuit At the hart of the circuit AtU is IC1, a U2008B made by Atmel (see Figure 1). This 8 -pin phase controller requires only a few exter- nal components. The IC has a facility to measure the load current, which is ideal for the prevention of an overload. The inclu- sion of automatic retriggering means that inductive loads won’t be a prob- lem. The IC also offers a soft-start function (connect a capacitor between pin 1 and ground) or detection of the load current via a shunt resistor in series with the triac (also between pin 1 and ground). We’ve chosen to use the soft-start function here. The current through the load is meas- ured using a shunt resistor in series with the triac. A separate detector cir- cuit drives the control input (pin 3) of the IC. The (‘negative’!) supply of the circuit is internally regulated by the U2008B. In our prototype the voltage was found to be just below 16 V. The IC requires at least 3 mA, the applied rail-to-rail opamp (TS922IN) needs at most 3 mA (unloaded), the LED 4 mA (pulsed) and the reference, 1 mA. This is the reason for increasing the current of the sup- ply for the U2008B to 10 mA. For this we’ve used two 5-watt resistors of 4kQ7 and D1 in series with the power line AC. The voltage across C4 is actu- ally determined by the average current flowing through R1 and R2. This cur- rent can be calculated using the fol- lowing formula: ( ^mains — ^supply) X V2 / [71 (R1+R2)] We’ve ignored any voltage drop across Dl. This formula is very similar to the one for the resistor found in the datash- eet for the U2008B. The effective value of a half-wave rec- tified voltage is U peak /2. The average value, however, is U peak /7i. Because of the half-wave rectification, the heat Technical specification • For 230 VAC or 1 10 VAC campsite power lines • Limits at 3 A, 4 A, 5 A, 6 A, 7 A, 8 A or 10 A • Indicator LED • Activation level configurable by jumper or rotary switch generated in resistors R1 and R2 ( U 2 / R) is about 2.5 times greater than it would be for a DC current with a value equal to the average value of an AC current. From a safety aspect we FI ■*hS> 10A Dl -M- 1N4007 m VSYNC |Qi RPHASE U2008B CONTROL OUT ♦ -fH S> LU C/3 LU C/3 o o a. O C3 lOOn Cl 1 u 63V CNI BTA16-600BW C2 lOn R9 BF245A BAT85 R11 R21 IC2 = TS922IN — r~ 3 VS o LIMITING JP1 -VS R20_ 10k R1^ 100k I CM t D5 5V6 0W5 CO CO CNJ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 CO • R18 R17 H 1k40 H H 698R H in RJ^ 715R a> co C7 Jj ^T c CIO lOOn % _[e: 10u 63V