www.elektor.com 770268 451 December 2011 AUS$ 14.50 - NZ$17.50 - SAR 102.95 - NOK99 £4.80 Does time on riHsEfe' USB Data Logger Store serial data conve C J *.* Tfl ■ fflU» iPIni *> K 3 a Dl OH J. f 1 'OOp i Dh r ' ps a m - oi m * * ■ ■ n IS ilfik 1 I 0 *3 0 fsl I? LED Cycle Lamp High-tech on the trail o & • PIC16F57 > • PIC18F2620 PIC16F506 * m PIC16HV610 PIC1 8F45K22 PIC16F737 PIC1 8F4682 PIC16F676 I PIC16F785 PIC16F684 PIC1 8F4523 PIC1 8F4553 PIC16F687 PIC16F690 PIC16F616 PIC 1 6F883 ■ PIC18F2420 I PIC18F242 PIC1 8LF14K50 Li PIC16F916 PIC18F2610 1C18F2685 BHHj PIC12F615 | PIC18F2585 PIC16F689 PIC18F2410 PIC1 8F2331 PIC16F526 PIC18F2480 | PIC16F914 PIC16F1933 PIC1 8F2682 EasyPIC PIC16F677 PIC12HV615 v7 ...and 167 more devices which could not fit into this ad. connectivity k. www.easypic7.com Personal Download for I © Elektor Elektor’s air intake One of the most frequent questions I get, usually by email and occasionally by tel- ephone or letter (hey!) is: “can I contribute to your wonderful publication and if so, what are the requirements and the specific subjects you are interested in?” The answer is invariably, “Yes, please, we’re ready to evaluate the publication value of your article proposal. Every edition of Elektor covers a wide variety of subjects and fields of interest. Please review our Author Guidelines, they’re available under the Service tab on our website at www. elektor.com. To this I usually add a few encouraging words like “we’ve been around since 1974” and some guidance on the size of the article. Some authors have been with us for many years and are totally at ease with supplying copy and illustra- tions in the preferred ways; others need extensive assistance with the file formats, spelling issues, style or the depth of the technical content they can manage. The air intake is actually a manifold — contributions from companies, journalists and specialists in the industry are also welcomed. The approach works well but also creates a queue of articles awaiting publication and in many cases we have to reassure authors that they aren’t forgotten and their project is being worked on in the Elektor Lab. Now, for the solemn bit: about 7 out of 10 article proposals reaching us through all international channels sadly gets rejected for publication. The reasons for the team of editors and designers to be so harsh and unkind to budding authors are diverse: uninventive use of components; ditto for obsolete components; ragchewing manu- facturer’s datasheets or old Elektor articles (!); nebulous circuits nicked from nebu- lous websites, poor electronic design and attempts to use the magazine to get rid of stock gathering dust. The rest is happily considered for publication or post-engi- neering by our lab, no matter if the piece is poorly written or the prototype built on breadboard — in general we are good humoured with a keen eye for originality. Even if it takes a while for us to get back to you due to the workload here at Elektor House, give us a try and eventually see your name (and circuit!) in print — it’s by no means difficult, we’re here to help. Enjoy reading this edition, Jan Buiting, Editor 6 Colophon Who’s who at Elektor. 8 News & New Products A monthly roundup of all the latest in electronics land. 16 Android as a Development Platform Tablet PCs are cheap and make excellent embedded devices. Here’s how. 20 Time-lapse Photography with an Android Tablet With an Android tablet and a handful of hardware, you can put together a remote control for a still camera doing time-lapse photography. 24 The PCB Prototyper in Practice Here’s a user report on the advanced PCB milling machine sold by Elektor. 26 Robusta: a Satellite built by Students Montpellier University’s cubesat picosatellite carries a scientific experiment of interest to the space community. 32 Xport your Ideas to the Web Lantronix’ Xport Pro device proves remarkably simple to configure and use as an advanced network interface module. 38 Here comes the Bus! (10) This month we come to grips with interfacing a high precision ADC to the bus, using a slick HTML interface. 43 E-Labs Inside: Work in progress Some pictures taken in the Elektor Labs of projects under active development. 44 E-Labs Inside: LED Exorcism The riddle solved of the ‘LED that flashed before-it died’. 45 E-Labs Inside: Pins to length Howto prevent DOCM displays from being damaged when fitting them on a board. 46 E-Labs Inside: Itsy Bitsy Spider... Here’s how we solved another fine mess caused by a mixup between TSSOP and SOIC packages. 4 Personal Download for I © Elektor 12-2011 elektor CONTENTS Volume 37 December 2011 no. 420 16 Android as a Development Platform Tablet computers (PCs) running the Android operating system are now available for under 100 pounds/euros. They are packed full of electronics and are visually attractive. Many functions that cost considerable effort to implement in an em- bedded environment are standard features in tablet computers. In this article we examine the factors involved in using tablet PCs in electronics projects. 20 Time-lapse Photography with an Android Tablet The design described here can be used with a still camera to cause it to take pictures at regular intervals. If you make a film from these pictures, the result is what is called a time-lapse film in which hours or even days are reduced to a few seconds. The project described here operates the camera button mechanically using a servo of the sort used in RC (remote controlled) models. 60 Electronic LED Candle Imitation candles using an LED as the illuminating element are available com- mercially. But here we’re describing a rather different project with a few unus- ual characteristics — after all, candles are meant to be blown out! 66 USB Data Logger The USB data logger described here is a low-energy, universal solution to the problems with adding EEPROM and RAM to microcontrollers performing data logging functions. It takes all the serial data sent from any external micro and stores it in a file on a USB memory stick which can be analysed later with a PC. 46 Smelly Bus Nasty fumes and odours from a blown electrolytic capacitor, but no major worries! 48 Pick-proof Lock Here we show how the very secure 128-bit AES encryption scheme can be applied to an infrared remote control. 52 Audio DSP Course (6) This month we use our DSP board to build a lab-grade DDS signal generator. 60 Electronic LED Candle The unique feature of this ersatz candle is that you can actually blow it out! 64 Turn your Oscilloscope into a Reflec- tometer Combine an oscilloscope and a signal generator to do measurements on (long) cables. 66 USB Data Logger Got a USB stick? And a microcontroller outputting serial data you want to store? Then this design is foryou. 70 LED Cycle Lamp It’s Lithium-Ion powered and has 600 lumen on tap. Check it out. 74 Gerard’s Columns: Speaking out Loud From our monthly columnist Gerard Fonte. 75 Hexadoku Elektor’s monthly puzzle with an electronics touch. 76 Retronics: RCA Cosmac Development System IV (CDP18S008) (ca. 1978) hELLO wORLD from Embedrock City. Series Editor: Jan Buiting 84 Coming Attractions Next month in Elektor magazine. elektor 12-2011 Personal Download for I © Elektor 5 elektor international media bv 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. Ejg;es time-lapse'photography. M‘ i iq 1 2 8-bil At t?i ll r y pticui USB Data Logger Store serial datrt conveniently, safely Electronic LED Candle 'ifera see EfterazDScscoaU HiqMecIvon the trail •Vj* d V Whv WIL H liJ*? in-ratf iatlon ektor f « ■>* Supw dektor dfet ANALOGUE • DIGITAL' MICROCONTROLLERS & EMBEDDED AUDIO TEST & MEASUREMENT ■ Ipf Volume 37, Number 420, December 2011 ISSN 1757-0875 Elektor aims at inspiring people to master electronics at any personal level by presenting construction projects and spotting developments in electronics and information technology. Publishers: Elektor International Media, Regus Brentford, 1000 Great West Road, Brentford TW8 9HH, England. Tel. (+ 44 ) 208 261 4509, fax: (+ 44 ) 208 261 4447 www.elektor.com The magazine is available from newsagents, bookshops and electronics retail outlets, or on subscription. Elektor is published 11 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 50 countries. International Editor: Wisse Hettinga (w.hettinga@elektor.nl) Editor: Jan Buiting (editor@elektor.com) International editorial stafl Harry Baggen, Thijs Beckers, Eduardo Corral, Ernst Krempelsauer, Jens Nickel, Clemens Valens. Design stafl Christian Vossen (Head), Thijs Beckers, Ton Ciesberts, Luc Lemmens, Raymond Vermeulen, Jan Visser. Editorial secretariat: Hedwig Hennekens (secretariat@elektor.com) Graphic design / DTP: Giel Dols, Mart Schroijen Managing Director / Publisher: Don Akkermans 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 Personal Download for I © Elektor 12-2011 elektor Elektor eC-reflow-mate Professional SMT reflow oven with unique features r The eC-reflow-mate is ideal for assembling prototypes and small production batches of PCBs with SMD components. This SMT oven has a very large heating compartment, which provides plenty of space for several PCBs. The accompanying PC software allows you to monitor the temperature curves of all sensors precisely during the soldering process, and it enables you to modify existing temperature/time profiles or create new ones. Special features: • Optimal temperature distribution thanks to special IR lamps • Drawer opens automatically at end of soldering process • Glass front for easy viewing Technical specifications: • Supply voltage: 230 V/ 50 Hz only • Power: 3500 W • Weight: approx, 29 kg • Dimensions: 620 x 245 x 520 mm (W x H x D) • Heating method: Combined IR radiation and hotair • Operation: Directly using menu buttons and LCD on oven • Remotely using PC software and USB connection • Temperature range: 25 to 300 °C • Maximum PCB size: 400x285 mm • Temperature sensors: 2 internal and 1 external (included) V. Price: £21 70.00 / € 2495.00 / US$3495.00 (plus VAT and Shipping) Further information and ordering at www.elektor.com/reflow-mate Email: subscriptions@elektor.com Rates and terms are given on the Subscription Order Form. Head Office: Elektor International Media b.v. P.O.Box ii NL-6114-ZC Susteren The Netherlands Telephone: (+31) 46 4389444, Fax: (+31) 46 4370161 Distribution: Seymour, 2 East Poultry Street, London ECiA, England Telephone:+44 207 429 4073 UK Advertising: Elektor International Media b.v. P.O.Box 11 NL-6114-ZG Susteren The Netherlands Telephone: (+31) 46 4389444, Fax: (+31) 46 4370161 Email: t.vanhoesel@elektor.com Internet: www.elektor.com Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic use only. All drawings, photographs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, software 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 transmit- ted in any form or by any means, including photocopying, scan- ning an recording, in whole or in part without prior written per- mission 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 exist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The submission of designs or articles implies permission to the Publisher to alter the text and design, and to use the contents in other Elektor International Media publications and activities. The Publisher cannot guaran- tee to return any material submitted to them. Disclaimer Prices and descriptions of publication-related items subject to change. Errors and omissions excluded. © Elektor International Media b.v. 2011 Printed in the Netherlands elektor 12-2011 Personal Download for I © Elektor 7 NEWS & NEW PRODUCTS DB9 USB-to-digital modules introduced by FTDI USB solutions specialist Future Technology Devices Inter- national Limited (FTDI) has added a series of USB to dig- ital level interface modules, in DB9 form factors, to its product portfolio. The new DB9-USB-D3-F (3.3 V output female connector), DB9-USB- D3-M (3.3 V output male con- nector), DB9-USB-D5-F (5 V output female connector) and DB9-USB-D5-M (5 V out- put male connector) enable implementation of USB interconnection into legacy equipment without the need for alteration of the enclosure or for any noticeable increase in the overall bill of materials. These modules all utilize FTDI’s FT232R USB to serial UART bridge chip, which is capa- ble of supporting data rates of 1 2 Mbits/s (USB Full Speed). They allow for the quick and easy upgrading of pieces of hardware to today’s most widely used serial interface standard in a highly convenient and cost effective manner. Drivers for the modules are available to download direct from the FTDI website. Supplied in a compact 30.8 mm x 19.8 mm x 1 1 .5 mm package, each of the modules uses a standard USB mini-B connector. They have an operational temperature range of -40 °C to +85 °C, permitting them to be specified for heavy duty industrial applications. The FTDI DB9 to digital modules are each priced at US$1 5.50 (for 1 -9 pcs). The FTDI DB9 to digital modules datasheet is available for downloading. www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_DB9-USB.pdf (110675-XVII) Secure RFID keys for access control, e-Cash, and ID cards worldwide Maxim Integrated Products (NASDAQ: MXIM) introduces a new line of RFID keys and cards designed for the two- billion-units-per-year automatic iden- tification, access control, and elec- tronic cash (e-cash) markets. This new contactless RFID product family (the MAX66000/020/040/1 00/120/140) lever- ages the expertise utilized in the compa- ny’s popular 1-Wire( R ) secure authentica- tion ICs, which protect intellectual property in embedded systems. With a 13.56 MHz interface, these secure keys are ideally positioned to gain market share because 13.56 MHz is becoming the worldwide standard for access control and e-payment applications. Some regions of the world have already begun deploying this RFID technology for passport and national ID cards. As the critical data found inside many of these RF credentials becomes more and more valuable, efforts to crack, counter- feit, and duplicate cards and credentials will increase. System integrators are already looking for increased security and authenti- cation techniques to protect those assets. Maxim’s new RF devices are packaged in a laminated plastic key fob or ISO thin card format and are available in either the ISO 1 4443 B or ISO 15693 HF protocol. Each protocol family offers three products: 64-bit ROM ID only (MAX66000/MAX661 00), ROM ID plus 1 Kbit EEPROM (MAX66020/ MAX661 20), or ROM ID plus 1 Kbit EEPROM and SHA-1 authentication (MAX66040/ MAX66140). Custom form factors are also available. The MAX66040 and MAX66140 employ the secure hash algorithm (SHA-1), a proven technology designed by the NSA for pro- tecting a system’s critical data without using expensive encryption techniques or an untested, proprietary protocol. SHA-1 is an ISO standard that is publicly avail- able and has been thoroughly tested in the marketplace. It is designed to maintain the integrity of the stored data so that one can verify the authenticity of any credential. Maxim’s RF keys and cards are custom pro- grammable to match the requirements of new and existing tag populations. They work with most 13.56 MHz readers on the market, thus providing an alternative tag source for existing systems. www.maxim-ic.com/rfid (110675-VIII) Granny knows how to keep iPads and Tablets clean iPads and tablets are sure to appear on holi- day gift lists this year again. Music, movies and the internet all available with a simple touch of the screen. And there’s one more thing that comes with that simple touch: greasy fingerprints. Thousands of them - all over the screen! Wiping it with a shirt- sleeve isn’t effective, and sprays, tissues and cloths are inconvenient and only make the fingerprint mess even worse. Now there’s a solution. SideKick™ by LensPen® is a new screen cleaning tool specially designed to remove fingerprints from iPads and tablet touch- screens. There are no tissues, no cloths, no sprays and no liquids. SideKick features a patented carbon technology that quickly and easily removes the oily fingerprints. “It’s not high tech, it’s old tech,” said Peter Meurrens, Vice President of Operations at Parkside Optical and inventor of SideKick. “My grandmother knew how to clean an 8 Personal Download for I © Elektor 12-2011 elektor NEWS & NEW PRODUCTS iPad forty years ago.” SideKick’s carbon compound is similar to the one found in printer’s ink. That carbon compound is why newspapers have been an effective way to clean windows for generations. “When you get a fingerprint on a lens or a computer screen, it’s an accident. But when you get fingerprints on an iPad or tablet, it means you’re using it! SideKick is not just an acces- sory, it’s a necessity.” SideKick is available at electronics stores nationwide in the US. Replacement cleaning pads are available in packages of two. Each pad gives 1 50 cleanings. MSRP for SideKick is $1 9.95, and $14.95 for the package of two replacement pads. www.lenspen.com www.youtube.com/lenspennews (110675-X) Cypress: new Gen4 TrueTouch® controller line is ultra noise resilient Cypress Semiconductor Corp. (NASDAQ: CY) introduced its new Gen4 family of Tru- eTouch® touchscreen controllers. Gen4 is clainmed to deliver industry-best per- formance in all categories, including the world’s best Signal-to-Noise Ratio (SNR) and unparalleled performance in the pres- ence of all noise sources— the biggest chal- lenge faced by touchscreen designs. The Gen4 family was designed from the ground up to deliver the world’s high- est SNR in real world applications. It is the first and only touchscreen 1C that delivers built-in 10 V Tx to drive the touch panel at 10 V. Because SNR is directly propor- tional to the voltage at which the panel is driven, this feature allows Cypress to offer nearly four times the SNR of the next clos- est competitor. The Gen4 family further raises the SNR bar as the first touchscreen device family to completely eliminate display noise in hardware. Gen4’s patent-pending Display Armor™ offers unprecedented immunity to noise from every type of display, even low cost noisy displays such as ACVCOM LCDs. This allows touchscreen designers to make their products thinner by removing the air gap between the display and the sensor, and also less expensive by removing the shield layer in the sensor. Display Armor allows Gen4 to operate seamlessly with direct lamination, on-cell and in-cell stack- ups, regardless of the display chemistry. The Gen4 product family offers the indus- try’s fastest refresh rate of 400Hz, and has the unique ability to scan a capacitive touch panel at 1 ,000 Hz — both industry-best met- rics. This level of performance is enabled by the 32-bit ARM® Cortex™ core at the heart of the Gen4 products. The Gen4 family also provides the industry’s best accuracy and linearity of 0.2 mm while boasting the world’s lowest active power consumption of 2 mW, and a deep sleep mode that only draws 1.8 pW with wake-up via address match on the COM port. Gen4 also offers more capacitive sensing I/O than the competition, while still fitting into the world’s smallest touch- screen packages. With up to 40 I/O for mobile phone applications, Gen4 can support up to four standalone CapSense® buttons while still deliv- ering ideal sensor pitch for up to 5-inch screens. The Gen4 family also offers features that only TrueTouch can deliver, including waterproof- ing functionality that allows products to meet IP-67 standards; 1-mm stylus support for Asian character sets and accurate handwrit- ing capture; and hover sensing to provide mouseover-like features and true fingernail or thick-glove support in mobile devices. touch.cypress.com (110675-XI) TrueTouch® Gen4 - Rise above the Noise! Revolutionary Touchscreen Solutions from Cypress K’.wtPM J7F* mj_ Intersil: DC/DC Controllers for embedded and low power CPU/GPU cores Intersil Corporation recently expanded its portfolio of industry leading multi-phase DC/ DC controllers by introducing the ISL95835 and ISL95837. Both controllers provide a complete low cost solution for CPU and GPU core power while delivering best-in- class transient response and efficiency. Each complies with Intel’s IMVP-7/VR1 2™ specifi- cation for smart voltage regulation to reduce power dissipation in the second-generation Intel® Core-i5/i7 processors. Both the ISL95835 and ISL95837 are the industry’s smallest solutions available and offer combined functionality and reduced pin count, saving valuable board space and reducing the total bill of materials. The ISL95837 has been optimized for lower power, thin and light applications. Compl Dual Outputs • Configurable 3-, 2- or 1 -phase for the 1st Output * 1-phase for the 2nd Output Features and Specifications • The ISL95835 includes two internal MOS- FET drivers for a 3+1 solution and can be configured as a 3-, 2- or 1 -phase VR • The ISL95837 can be considered as an ISL95835 dedicated for a 1+1 application with an output of 1 -phase VR, maximizing flexibility • Both devices operate in diode (or sleep) mode when a CPU enters light load modes for added efficiency and battery life • Accept input voltages from 4.5V to 25V and deliver output voltages from 0.25V to 1.5V. The controllers are based on Intersil’s Robust Ripple Regulator (R3)™ technology, a hybrid of fixed-frequency PWM control and variable-frequency hysteretic control that delivers the industry’s fastest transient response. The R3 modulator delivers faster transient settling time than typical modu- lators and automatically adapts switching frequency to optimize light load efficiency. www.intersil.com/products/deviceinfo asp?pn=ISI_95835 www.intersil.com/products/deviceinfo.asp7pnHSL95837 (110675-XII) elektor 12-2011 Personal Download for I © Elektor 9 NEWS & NEW PRODUCTS ChdrgftPeiiYt caJ US nationwide rollout of electric vehicle charging stations to begin Car Charging Group Inc. (OTCBB:CCGI), a provider of electric vehicle (EV) charging services and Central Parking System Inc. and its sub- sidiary, USA Parking System Inc., the nation’s largest parking garage operator, have teamed up to provide EV charging services at loca- tions nationwide in the US via Coulomb Technologies’ Charge- Point® Network. “There are close to 1 7,000 parking garages in the U.S., and they will play one of the most vital roles in the development of a national EV charging infrastructure,” said Brian Golomb, Direc- tor of Sales of Car Charging. “By partnering with two of the most important companies in this sector — companies that understand the benefits of electric vehicles — we will move much quicker in the rollout of this nationwide infrastructure.” Car Charging Group plans to install EV charging stations at sites owned by the two parking garage operators. The opera- tors have 2,200 locations nationwide with 1 .1 million parking spaces. As part of the agreement, Central Parking has the right to pur- chase five percent of the Common Stock of Car Charging Group. We are very excited about this partnership, because it will greatly expand the reach of our nationwide EV charging network,” said Michael Farkas, CEO of the Miami Beach, Fla. -based Car Charg- ing Group. “Furthermore, we hope to further enhance our already strong relationship with these companies by giving Central Parking the opportunity to be a shareholder in our company and to take part with us in electrifying the U.S. transportation system.” Central Parking believes that electric vehicles can make a difference in the transportation sector, and they look forward to being a partner in building a nationwide network of EV charging stations. “Electric vehicles are no longer a mirage — they are becoming an ever increasing presence on our roads and we are proud to be working with such an innova- tor in the EV sector,” said James Marcum, CEO of Central Parking Systems. “By install- ing EV charging stations in our garages, we will be providing added services to our cli- ents and strengthening our position as an industry leader in environmentally-friendly initiatives.” USA Parking System, a wholly owned subsidiary of the Nashville, Tenn. -based Central Parking System Inc. also aims to benefit both the clients and the environment through its agreement with Car Charging. Car Charging Group provides EV charging stations at no charge to property owners/ managers while retaining ownership, thus allowing their partners to offer their custom- ers, tenants and employees charging services without incurring any outlay of capital. In addition, Car Charging Group’s partners realize a percentage of the charging revenue generated by the charging services paid for by the EV owners. www.CarCharging.com www.Parking.com www.USAPark.com (110675-XIV) SMI Antenna with comprehensive protection for automotive applications PREMO launches a new family of its 1 1 03 standard, universally adopted by indus- try. This format provides up to 55 mV/ App/m sensitivity which gives it the best sensitivity by cm 3 in the market. The new SDTR1 1 03CAP, is a SMD antenna for low frequency 20 kHz-1 50 kHz receiver appli- cations. This series offers upper and lateral side protection with co-polyamide poly- hexamethylene polymer walls, gamma radi- ated with high thermal stability (supports up to 290 g C) and mechanical resistance (exceeds 1 50 Mpa if mechanical strength). This antenna is equipped with NiZn ferrite core with high surface resistivity (>1 0 M £2/ mm) that provides a highly stable behavior (rather than ±2%) over a wide temperature range (-40 9 C to 1 25 g C). The new SDTR1 1 03CAP is an SMD antenna with ‘Super-Drop-Test-Resistant’ technol- ogy with an extended range of operat- ing temperature (-40 °C to 1 25 g C), which makes it particularly suitable for applica- tions such as TPMS (Tyre Pressure Monitor- ing Systems) which requires an excellent performance under extreme conditions, according to AEC-Q200 and additional requirements as EU regulations. PREMO offers four standard values, 2.38 mH, 4.91 mH, 7.2 mH and 9 mH at 125 kHz. Others inductance values and frequencies, from 340 pH to 1 6 mH, upon request. Its surface mount (SMT) allows an easy use in the automated process of mounting cir- cuit boards, thus eliminating any manual handling. www.grupopremo.com/es/file /805 (110675-XIII) World’s first 1 CS/s USB- powered oscilloscope The three new oscilloscopes in the PicoScope® 2000 Series are the first USB- powered oscilloscopes to offer a real-time sampling rate of 1 GS/s. With two channels, bandwidths ranging from 50 MHz to 200 MHz, a built-in function generator, arbitrary waveform generator and external trigger input, these compact and economical scopes are perfect for engineers and technicians needing a complete test bench in a single unit. The scopes are supplied with a full version of the PicoScope oscilloscope software. As well as standard oscilloscope and spectrum analyzer functions, PicoScope includes valuable additional features such as serial decoding, mask limit testing, segmented 10 Personal Download for I © Elektor 12-2011 elektor NEWS & NEW PRODUCTS memory and advanced triggers. It provides a large, clear display that shows waveforms in great detail and allows easy zooming and panning. Other advanced features include intensity- and color-coded persistence displays, math channels, automatic measurements with statistics, and decoding of l 2 C, UART/RS232, SPI and CAN bus data. Free updates to the software are released frequently. Like all PicoScope oscilloscopes, the new PicoScope 2000 Series devices use digital triggering, which ensures lower jitter, greater accuracy and higher voltage resolution than the analog triggers found on many other scopes. The advanced trigger types include pulse width, interval, window, window pulse width, level dropout, window dropout, runt pulse, variable hysteresis, and logic. A Software Development Kit (SDK), supplied free, allows you to control the new scopes from your own custom applications. The SDK includes example programs in C, C++, Excel and LabVIEW. The SDK and PicoScope are compatible with Microsoft Windows XP, Vista and Windows 7. The new PicoScope 2000 Series oscilloscopes are available now from Pico distributors worldwide and from www. picotech.com. Prices range from £349 for the 50 MHz PicoScope 2206 to £599 for the 200 MHz PicoScope 2208, including a 5-year warranty. www.picotech.com (110698-I) New EasyPIC V7 development system For the first time in EasyPIC’s almost 10-year history, EasyPIC v7 has grouped PORT headers, LEDs and Buttons into Input- Output groups, making them easier to use than ever before. The v7 boards come equipped with tri-state DIP switches, so connecting pull-up or pull-down jumpers to desired pins is now just a matter of pushing the switch. Connectivity is the main focus of EasyPIC v7, providing three separate PORT headers in the Input-Output groups and another one on the opposite side of the board, allowing users to access those pins from any side. The new board has a dual power supply supporting both 3.3 V and 5 V microcontrollers. It’s like having two boards instead of one! Probably the best feature of the v7 board is its powerful on-board mikroProg programmer and In-Circuit debugger capable of programming over 250 PIC microcontrollers. Debugging is supported with all mikroElektronika PIC compilers — mikroC, mikroBasic and mikroPascal. 7-segment displays have returned at the request of many users, which brings the number of displays on the board to three: GLCD 128x64, LCD 2x16 character and 4-digit 7-segment displays. EasyPIC v7 is the first board supporting the mikroBUS pinout standard. Mikroelektronika are preparing many mikroBUS compatible Click Boards, which will make development easier then ever. No configuration or jumpering, just plug-n-play. The new board has the following new modules: Serial EEPROM, Piezo Buzzer and support for both DS1 820, and LM35 Temperature sensors. The EasyPIC v7 User Manuals and schematics haven been redesigned; the documentation is now more informative with a good number of clear photos and expanded text sections. www.mikroe.com (110698-II) Sensirion: first digital temperature sensor Following the successful market launch of the SHT2x family of humidity and temperature sensors, Sensirion is now launching a sensor designed exclusively for temperature measurement. The newSTS21 temperature sensor is based on the same chip as the SHT2x family and is housed in a tiny DFN package measuring only 3x3 mm. This makes the sensor ideal for use in applications where only very limited space is available. It also delivers outstanding performance and remarkably high accuracy Advertisement PCBs *7^ Muuuuch Cheape No-frills policy 16.94 EURO" 5 pcbs, 1 00 mm x 1 00 mm ♦per piece, incl. UHT (2 1 %) + shipping costs e. g. Germany 1 0.71 EURO * JaCCaltac iuLULU.jackaltac.com elektor 12-2011 Personal Download for I © Elektor 11 NEWS & NEW PRODUCTS of ±0.22 °C over the temperature range of 5 to 60 °C, combined with very low power consumption — an especially important consideration for battery-operated devices. The STS21 is pin and protocol compatible with Sensirion’s standard SHT21 humidity sensor, but it has a different l 2 C address. This allows the STS21 to be used as alternative to the SHT21 in applications where temperature measurement is required and humidity measurement is optional, since the same hardware can be used with both sensors. The STS21 temperature sensor is fully calibrated, provides a digital output, and is very competitively priced. It therefore fulfills the stringent requirements of many applications in terms of both performance and cost effectiveness. www.sensirion.com/sts21-datasheet (110698-III) 132 LED driver features industry’s highest efficiency and smallest size austriamicrosystems has announced the AS1 130, the most advanced and smallest dot-matrix LED driver (channels vs. PCB space) available. The AS1 130 drives 132 LEDs but requires only 5 mm 2 PCB space, reduces external component count, allows use of cheap connectors and requires fewer PCB (printed circuit board) layers. Benefits for end users include up to 80% longer battery lifetime, more colorful effects and smoother running animations. Using a 12x11 cross-plexed technique, austriamicrosystems’ AS1 1 30 LED driver is targeted for dot-matrix displays in mobile phones, toys, small LED displays in personal electronics, but also non-battery powered household goods, indoor public information displays, and industrial applications such as power meters. The AS1130 drives 132 LEDs, each with an 8-bit dimming control and no external resistor required. Additionally, an 8-bit analog current control allows fine tuning of each current source to compensate for different brightness of different colors, or to adjust the white balance on RGB LEDs, austriamicrosystems’ AS1 1 30 incorporates 36 frames of memory for small animations or for use as a buffer to reduce host processor load, saving energy and processing time. The AS1 1 30 LED driver can also extend battery life by controlling an external power supply (e.g. charge pump) which is required when LEDs need a higher voltage than the battery can supply, allowing continuous operation even under low battery voltage conditions. “The AS1130 dot-matrix LED driver is designed to make driving LEDs an easier task,” commented Rene Wutte, austriamicrosystems’ Marketing Manager for Lighting. “It enables driving a large number of RGB LEDs from one 1C for creative light designs while providing the highest efficiency available, an important feature for both battery-powered and AC-powered applications. The AS1 1 30’s features simplify design and programming, optimize total cost, and allow developers to provide the lighting features required to stay ahead in this market.” In addition to the ultra-small sized CS-WLP-20, the AS1 1 30 LED driver is also available in a gull winged SSOP-28 package, allowing easier handling in applications that are not so space sensitive. This makes the AS1 130 a perfect replacement for indoor high pixel density video walls, easily replacing up to eight 16-channel PWM LED drivers, or reducing the complexity of externally (user designed) multiplexed systems. Only 12 lines are required to drive all 132 LEDs. This is accomplished with austriamicrosystems’ multiplexing technique called cross-plexing. It reduces line count on the PCB as well as pins on the connectors, saving space & costs. Other features include control via a 1 MHz l 2 C compatible interface, open and shorted LED error detection, and low-power shutdown current. The AS1 130 LED driver operates over a temperature range of -40 to +85°C and a wide 2.7 to 5.5 V power supply range. www.austriamicrosystems.com/LED-driver/ AS 1130 (110698-IV) Vector Fabrics Joins ARM Connected Community Vector Fabrics recently announced it is now a member of the ARM® Connected Community®, the industry’s largest ecosystem of ARM technology-based products and services. As part of the ARM Connected Community, Vector Fabrics will gain access to a full range of resources to help it market and deploy innovative solutions that will enable developers to get their ARM Powered® products to market faster. Mike Beunder, CEO at Vector Fabrics: “Many of our customers have adopted multicore ARM-based architectures and use our vfEmbedded tool to optimize their software applications for it. That’s why vfEmbedded already provides support for the ARM CortexTM-A series of multicore applications processors, including the ARM NEONTM technology. We’re excited to be working more closely with ARM to ensure our tools integrate well with the ARM architecture.” The vfEmbedded multicore development tool allows developers to unlock the performance potential of the multicore high-performance ARM Cortex-A architectures. Optimizing software for multicore processors by hand is simply too complex, is error prone, takes too much time, and won’t result in an optimal implementation. VfEmbedded thoroughly analyzes the program code, predicts parallel performance and swiftly guides the developer toward an optimal multicore implementation that is free of errors. The ARM Connected Community is a global network of companies aligned to provide a complete solution, from design to manufacture and end use, for products based on the ARM architecture. ARM offers a variety of resources to Community members, including promotional programs and peer-networking opportunities that enable a variety of ARM Partners to come together to provide end-to-end customer solutions. Visitors to the ARM Connected Community have the ability to contact 12 Personal Download for I © Elektor 12-2011 elektor QUASAR Quasar Electronics Limited PO Box 6935, Bishops Stortford CM23 4WP, United Kingdom Tel: 01279 467799 Fax: 01279 267799 E-mail: sales@quasarelectronics.com Web: www.quasarelectronics.com ronics 01279 All prices INCLUDE 20.0% VAT. Postage & Packing Options (Up to IKg gross weight): UK Standard 3-7 Day Delivery - £4.95; UK Mainland Next Day Delivery - £1 1 .95; Europe (EU) - £1 0.95; Rest of World - £1 2.95 (up to 0.5Kg). lOrder online for reduced price UK Postage! Payment: We accept all major credit/debit cards. Make cheques/PO’s payable to Quasar Electronics. Please visit our online shop now for full details of over 500 kits, projects, modules and publications. Discounts for bulk quantities. 467799 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ HokBo! Ho! Cferistma s way feut ave some fantastic gf leas for yofiffig (and old) enquiring min ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ 30 in ONE -£19.95 Order Code EPL030KT 130 in ONE -£59.95 Order Code EPL130KT 300 in ONE -£79.95 Order Code EPL300KT 500 in ONE -£179.95 Order Code EPL500KT Robot Sensor - £21 .95 Order Code EPLR20KT Digital Recording Laboratory - £34.95 Order Code EPLDRKT AM/FM Radio Kit -£11.95 Order Code ERKAFKT Shortwave Kit -£11.95 Order Code ERKSWKT Crystal Radio Kit - £8.95 Order Code ERKCKT Electronic Bell -£8.95 Order Code EAKEBKT Electronic Motor - £8.95 Order Code EAKEMKT Generator - £8.95 Order Code EAKEGKT Room Alarm - £4.95 Order Code EAKRAKT Hand Held Metal Detector - £9.95 Order Code ELMDX7 Metal Detector - £9.95 Order Code ELMDKT Robotic Arm - £49.95 Order Code C9895 Tyrannomech -£14.95 Order Code C21-601KT Running Microbug - £12.95 Order Code MK127KT Trainmech — £14.95 Order Code C21-606KT Crawling Bug with Case - £21.95 -Order Code MK1 65 Riding Santa - £17.95 Order Code MK116KT 60 LED Multi-Effect LED Star - £17.95 Order Code MK170KT Musical LED Jingle Bells -£21.95 Order Code 1176KT Flashing LED Christ- mas Tree - £7.95 Order Code MK100KT See our website for special offers and even more great gift ideas! WWW. com Secure Online Ordering Facilities • Full Product Listing, Descriptions & Photos • Kit Documentation & Software Downloads Personal Download for I © Elektor NEWS & NEW PRODUCTS members directly through the website. “The Connected Community is all about companies working together to provide the most complete solutions in the shortest possible time. By joining the Community, which now comprises more than 850 companies, Vector Fabrics increases the large portfolio of skills, products and services that are centered around the ARM architecture, and currently available to developers worldwide,” said Lori Kate Smith, Sr. Manager Community Programs for ARM. Vector Fabrics’ vfEmbedded software development tool addresses the hard problem of partitioning and mapping software onto heterogeneous multicore SoC platforms. VfEmbedded lets you model your embedded platform, then takes you through the process of analyzing, parallelizing, and implementing your code. It is the only tool that gives you the precise information you need to make sure that the parallelized software works correctly and has the highest performance on your multicore machine. http://cc.arm.coin www.vectorfabrics.com/products/vfembedded (110698-V) Parallax: laser range finder module Designed in conjunction with Grand Idea Studio, the Parallax Laser Range Finder (LRF) Module is a distance-measuring instrument that uses laser technology to calculate the distance to a targeted object. The design uses a Propeller processor, CMOS camera, and laser diode to create a low-cost laser range finder. Distance to a targeted object is calculated by optical triangulation using simple trigonometry between the centroid of laser light, camera, and object. KNX-RF Multi module for building automation Radiocrafts AS now expand their product line with a new module complying with the KNX-RF Multi specification. KNX is the only open international standard for Home and Building Control, used in Smart Home, Building Automation and Building Management Systems. RC1 1 80-KNX2 is the world’s first RF module including a complete KNX-RF Multi protocol stack. The KNX-RF Multi is an extension of the European Norm for building automation adding redundancy and increased reliability. The main features of the new Multi standard is; frequency agility by using up to 5 frequencies, fast link acknowledgement of up to 64 receivers with automatic retransmission, and multi-hop repeaters extending the range by two hops. Battery operated transmitters and receivers are also supported by the new standard. The embedded protocol is backward compatible with KNX-RF 1 .1 and KNX Ready, and can be used for unidirectional and bidirectional devices. The new module is designed for sensors, actuators and other home and building automation equipment. Due to its small size, easy to use interface, complete embedded protocol and low power consumption, it can easily be integrated into any product making a very cost efficient solution. Radiocrafts is a member of the KNX Association and has participated in the development of the new standard. KNX is one of the leading standards for home and building control. The interest for such systems is increasing, meeting the demands for energy saving technology. Studies have shown up to 50% energy savings using KNX technology. Radiocrafts is also considered as one of the leaders in Wireless M-Bus technology, and the new KNX product series gives the customers an easy transition to KNX with compatible products. Interoperation between Wireless M-Bus and KNX-RF is also possible using the new module. The module operates in the 868 MHz band, using Listen Before Talk (LBT) and frequency agility to reduce collisions. Up to 5 frequencies are scanned and automatically selected. One receiver can be linked with up to 64 transmitters, enabling very large RF networks. The fast acknowledge and retransmission feature ensure link reliability. Complete repeater functionality is also built in the protocol stack, and can retransmit messages in two hops. It can be used with S, A and E modes of installation. Among other features, the module offer automatic battery supervision and signal strength information. The new RC1 1 80-KNX2 is a surface-mounted high performance transceiver module measuring only 1 2.7 x 25.4 x 3.3 mm. A UART interface is used for serial communication and configuration. An antenna is connected directly to the RF pin. The RC1 1 80-KNX2 module is certified for operation under the European radio regulations for license-free use. When used with quarter-wave antennas a line-of-sight range of 800 meter can be achieved. The module and Demo Kits are available now. The module is delivered on tape and reel for volume production. www.radiocrafts.com (110698-VI) Features: • Compact module with integrated CMOS camera and laser system; • Optimal measurement range of 6-48 inches (15-122 cm) with an accuracy error <5%, average 3%; • Maximum object detection distance of approx. 8 feet (2.4 meters); • Range finding sample rate of 1 Hz; • Single row, 4-pin, 0.1 ” header for easy connection to a host system. The Laser Range Finder is priced at $1 29.99 and available direct from Parallax, or its national distributors. www.parallax.com, search 28044 (110698-VII) M Personal Download for I © Elektor 12-2011 elektor DesignSpark chipKIT" Challenge DesignSpark is the perfect environment for engineers to work together, challenge each other to think outside the box and engage with fellow designers from around the world. Participants of the DesignSpark chipKIT™ Challenge are encouraged to post photos/videos, summaries, and questions about their projects, code, and PCB designs at www.chipkitchallenge.com Register today and you could be selected for a chipKIT™ Community Choice Award! DJGILEH Prizes include a $100 voucher for RS Components/Allied Electronics and a free digital subscription to Circuit Cellar and Elektor magazines. Community Choice Awards will include a winner of the most creative project proposal, selected by the DesignSpark team, and most popular project, selected by the DesignSpark community.* DesignSpark ctiipKIT" Challenge DESIGNSPARK l COrFilUN'CnT chip Kill Pun/OIGITAL POKER for complete rules and details Participation in the Community Choice Awards does not increase your chances of winning the Grand Prize with your Final Project(s) submission. See website for more information. Plektor DIGILENT Microchip EIIC'jWMCS P e IcMbXlt ^ £&/&ITte}t&iJefed tradelbte'kterMicrochip Technology Inc. Max32™ is a registered trademark of Digilent, Inc, jf/y // // f // . / ■■r // / p ' w & £ ANDROID-TABLETS Electronics designers are accustomed to developing their systems from scratch or using development boards. An interesting alternative is to use a tablet PC as an embedded device. By Elbert Jan van Veldhuizen (The Netherlands) Android as a Develo Using low-cost tablet PCs in embedded ap, Tablet computers (PCs) running the Android operating system are now available for under 1 00 pounds/euros. They are packed full of electronics and are visually attrac- tive. Many functions that cost consider- able effort to implement in an embedded environment are standard features in tablet computers. In this article we examine the factors involved in using tablets in electron- ics projects. Hardware What can you expect to find in a tablet com- puter priced below 1 00 pounds/euros? To start with, a nicely finished enclosure. A tab- let is perfectly at home in you living room or mounted on the dashboard of your car. It can also be fitted on the front panel of an enclosure to serve as a control panel with a professional look, which is one of the major potential uses. A tablet has a backlit touchscreen display, which make it an ideal platform for a user interface, and in particular a graphic user interface. The combination of a screen and a touchpad allows you to create virtual buttons (which can even be context sensi- tive) and entry fields, and you can present elaborate menu structures. Tablets are also suitable for multimedia applications, allowing you to display live imagery from a camera (with or without an IP interface) or play instruction videos. The displays of the low-cost tablets have diagonal dimen- sions of 7 to 1 0 inches (18 to 25 cm) and resolutions of 800 x 480 to 1 024 x 600 pix- els. Most low-cost models have a resistive touchscreen, which allows only one touch at a time, but this is generally good enough for our purposes. You might be thinking that tablets can only be used as a sort of dumb terminal, but this is by no means true. Even the low- cost models have an ARM1 1 processor with over 600 MIPS of computing power. This is more than 1 0 to 1 00 times faster than the microcontrollers we normally used in our designs, and it means that tasks that need a lot of processing power can run without major problems on a tablet. Some exam- ples include computations that are nor- mally executed by a DSP, such as Fourier transforms and filtering. Android is not a real time operating system, so a tablet can- not be used for real-time computations. However, Android can handle near real time tasks with response times in the sec- onds range. Programming Android apps was described in detail in this year’s June 201 1 edition [1 ]. Android is a multitasking operating system, which means that different applications for different purposes can run in parallel. Another important aspect of tablet com- puters is Internet connectivity. All tablets have a WiFi port for connecting to the Inter- net. Various Internet apps are available for Android devices, including a web server, an FTP server and a variety of e-mail applica- tions. These apps are able to run concur- rently, including in the background. This makes it easy to use an Internet connection to view or download data remotely or to control electronic devices remotely. Some tablets (typically the more expensive mod- els) also have a 3G mobile telecommunica- tion port. This allows them to be used in areas outside the range of a WiFi router, as long as mobile phone coverage is available. Tablets have integrated non-volatile (flash) memory, and most of them also have a micro-SD slot for memory expansion. This allows up to 32 GB of memory (with cur- rent devices) to be added. A typical appli- cation for this is data logging. This amount of memory is sufficient to store a year’s worth of data at a data rate of 1 000 sam- ples per second. This memory can also be used for the previously mentioned multime- dia applications. Furthermore, most tablets have speak- ers (as well as an audio out connector), a microphone and a webcam built in. Tablets can provide a regulated 5 V supply voltage (from the USB port), taken from the inte- grated (or replaceable) rechargeable bat- tery. Although this is not the main reason for using a tablet in an electronics project, it’s a handy bonus. Incidentally, tablets are not the only Android devices worth considering. Android 16 Personal Download for I © Elektor 12-2011 elektor ANDROID-TABLETS Figure 1 . USB Micro B to Type A bus cable for use with a tablet operating in host mode. smartphones are also available for under 150 pounds/euros. Although they have smaller displays, they are equipped with 3G functionality as standard. If 3G functional- ity is more important than display size, an Android smartphone is an excellent choice. These smartphones also support Blue- tooth wireless communication. The Ama- rino project [2] uses the Bluetooth inter- face to link an Arduino board to an Android smartphone. USB interface Every tablet has a USB port, which appears to be the logical way to connect the tablet to external circuitry. In theory this is a sim- ple task, but in practice it is full of pitfalls. First of all, you need to realise that Android tablets have evolved from Android mobile phones. The USB port of a mobile phone acts as a USB device (‘slave’ mode) and is intended to be used for purposes such as connecting the phone to a PC, and the USB ports of Android tablets are also device ports. This means that the connected cir- cuitry must acts as a USB host (‘master’ mode), which generally requires a relatively complex USB controller. However, many tablets are able to switch the USB port to host mode (which requires a special conver- sion cable) or have a second port that oper- ates in host mode. This port is intended to be used for connecting a mouse, keyboard or memory stick. Simple USB controllers with a USB device port can also be con- nected to this second port. Microchip pro- vides code that can communicate with an Android unit configured as a USB device. A number of development boards are also available [3]. In addition to the hardware, you need the right driver software, which is not so easy. Android does not have any standard sup- port for USB devices other than those men- tioned above. Although the most recent versions of Androids (2.3.4 and 3.1) have enhanced capabilities, using them is not straightforward. In order to install the right drivers, you must first install a modified ver- sion of Android. This requires not only the software (the ‘ROM’), but also root access permission in the tablet. Apps that can pro- vide this access are available for low-cost tablets with a standard Android installa- tion, but creating a new ROM is a task for advanced users, and it is essential to have all of the necessary drivers available. This is a lot of work for a single project, but if a particular tablet can be used in various pro- jects, it may be worth considering. Fortunately, it appears that this problem will be remedied in the future. Google, the maker of Android, is hard at work on ver- sion 4 of Android, named Ice Cream Sand- wich, which combines version 2 (for mobile devices, including low-cost tablets) and ver- sion 3 (for fancier tablets). One of Google’s explicit goals is to allow Android devices to communicate with many different types of accessories. The software class ‘accessory’ [4] has been developed specifically for this purpose. Although this functionality is implemented in Android versions 2.3.4 and 3.1 , there is no standard support for it in the ROM. The USB port is configured as a host with the new class, which allows simple USB controllers to be connected to the port. This simplifies the connection of USB devices to Android tablets. Support for this will prob- ably be provided in the standard ROM ver- sion, eliminating the need for upgrades. Android version 4 is expected to be avail- able in late 201 1 . The system requirements for the new version exceed the capabilities of current low-cost tablets. It will probably take a while before low-cost tablets that support this version become available, since the prices of processors with sufficient com- puting power are presently too high. Architecture If you use a tablet in an electronics project, the place where you put the software that provides the ‘intelligence’ (eitherthe tablet or the external circuitry circuitry) is a signifi- cant architectural issue. The advantage of putting the intelligence in the tablet is that you can work in a well defined program- ming environment with an API that provides direct access to the various components of elektor 12-2011 Personal Download for I © Elektor 17 ANDROID-TABLETS elopers m y» QffV LjuidP piiblictlais Rwowcfc* UsbAccessory •MfimSs QfeLpcb-pool.com PfllJTH'l p-CfltiZOQg % T? mshopui nHTRr.iVihTI RS-27 4-X aihHi tj'..' 1 1 In MfHHf ] | \\ . B23J PULiONIK ■Sr- F.lvPC^ PCB-POOL® is a registered trademark of www.pcb-pool.com LAYOUT Schaeffer FRONT PANELS & HOUSINGS Cost-effective single units and small production runs Customized front panels can be designed effortlessly with the Front Panel Designer. The Front Panel Designer is available free on the Internet or on CD. • automatic price calculation • deliveryin 5 -8days • 24-Hour-Serviceif required f rrrr r— - r Sample price: 34,93€ plus VAT/shipping THE NEW PICOSCOPE 2205 MSO MIXED SIGNAL OSCILLOSCOPE GREAT VALUE, PORTABLE, HIGH END FEATURES AS STANDARD AND EASY TO USE For your chance to WIN a PicoScope 2205 MSO visit www.picoscQpemso.com/3114 and enter the code ELK1 Technology Cnanric 5 ? Annlo-p, it Digital Resolution 8 bit Bandwidth Analog 2i MHz, DijjpmI frequency D.:gj7aJ IOQMHt combined Sampling rate 200MS/S Trigger modes Edge, Window* Pulse width* W ndnW pulse winh, Drcpdi.;. W ndow dropout, nlcn.'ol. Rum pulse. Digital, Logic Price £i4? Schaeffer AG • Nahmitzer Damm 32 • D-12277 Berlin • Tel +49 (0)30 8058695-0 Fax +49 (0)30 8058695-33 • Web info@schaeffer-ag.de • www.schaeffer-ag.de www.picoscopemso.com elektor 12-2011 Personal Download for I © Elektor 19 AUDIO, VIDEO AND PHOTOGRAPHY By Elbert Jan van Veldhuizen (The Netherlands) With an Android tablet and a handful of hardware, you can put together a remote control for a still camera for time- lapse photography. It also allows the picture settings to be configured from a web browser on a PC, which sends to them to the tablet via the local WiFi network. Time-lapse Photography with an Android Tablet Using a servo-operated shutter release The design described here can be used with a still camera to cause it to take pictures at regular intervals. If you make a film from these pictures, the result is what is called a time-lapse film in which hours or even days are reduced to a few seconds. A similar pro- ject for cameras with an external shutter release input was published in a previous edition of Elektor. The product described here operates the camera button mechani- cally using a servo of the sort used in RC (remote controlled) models. A special feature of this project is that an inexpensive Android tablet (as described elsewhere in this edition is used to provide the GUI (graphic user interface) and enable operation over the Internet. This article is handy for learning more about the basic building blocks for programming Android tablets in embedded systems. Design and user interface This design is intended to operate a still camera mechanically with the aid of an RC servo, which makes it usable for all types of still cameras. The author first tried to access the shutter button leads of a com- pact digital camera in order to operate the camera electronically, but the components are so small that it is virtually impossible to do this without destroying the camera. As can be seen in Figure 1 , the servo actu- ates a lever with a plunger that presses the shutter button on the camera. Other mechanical arrangements for operating Figure 1 . A prototype put together with a few Meccano parts. Figure 2. This circuit boosts the audio output signal to 5 V TTL level. A small 5-V AC power adapter provides an adequate source of power. 20 Personal Download for I © Elektor 12-2011 elektor AUDIO, VIDEO AND PHOTOGRAPHY the shutter button with a servo are also conceivable. As described in the article on Android tablets elsewhere in this issue, it is pres- ently not easy to use the USB port of an Android tablet. In practical terms, doing so would mean that for each different type of tablet, different instructions and soft- ware would be necessary to make the design described here work properly. For this reason, the author decided to use the audio output to drive the servo. The position of a servo is deter- mined by pulses having a width between 1 and 2 ms, or with some servos between 0.5 and 1.75 ms. These pulses are repeated every 20 ms. A pulse signal of this sort can be generated directly using the tablet’s audio output. The pulse amplitude at the audio output is typically under 1 V, so this signal needs to be converted to TTL level. This is done by the circuit shown in Fig- ure 2. Transistors T1 and T2 amplify the sig- nal. As the zero level of the audio output sig- nal is not necessary the same as the circuit ground level (it may be floating), quasi-DC coupling is provided by R1 and Cl . None of the component values here is critical. If no modifications to the software are nec- essary, the program can be installed by cop- ying the file t i me L a p s e . a p k (in the binary folder of the zip file) to the tablet over the USB port or from a flash memory card. Sending the file to the tablet as an e-mail attachment doesn’t work. The installation program included with the tablet must be used to install the program. Under Settings / Application settings / Unknown sources, enable ‘Allow installation of non-market applications’. The circuit can be operated in two differ- ent ways: either via a GUI on the tablet (see Figure 3) or via an external web interface (see Figure 4). On the GUI the number of pictures and the time between pictures (in seconds, with a minimum value 3 s) can be best in the two text boxes. Three different servo positions can be set with the three sliders. The first position is with the camera at rest; the second position is for pressing the shutter button halfway for focussing; and the third position is for taking a pic- ture. Check to make sure that the slider set- tings are right, since the position between 0.5 ms and 2 ms varies. For some servos this is outside the working range, and they may be damaged if they are driven with corre- sponding pulses for a prolonged time. The Phase button selects either positive or negative pulse output. Depending on the tablet, it may be necessary to invert the pulses (this doesn’t matter for audio out- put). Finally, the Start button starts and stops a time-lapse sequence. The application can also be operated over the web. It listens to port 8090 at the IP address of the tablet. Start by accessing the tablet from your browser (on another com- puter), for example by entering the address ht t p: / / 1 9 2. 1 6 8. 1. 1 0 1: 8 0 9 0 / . The current status will be shown. New values can be entered in the form, and the time- lapse sequence can be started and stopped with the links. The logo on the web page (at the top left) must be entered by the user by placing a I o g o . j p g file in the / s c a r d / webser ver_TL folder on the tablet. This folder is created automatically when the application is launched for the first time. GUI programming The basic aspects of programming Android devices and the necessary resources were described in the June 201 1 edition. The author also used Eclipse [1 ] and the Android Development Toolkit (ADT) [2] for this purpose. The GUI can be designed in a fully graphic environment in Eclipse (see Figure 5). But- tons, entry fields, text fields and so on can be dragged from the toolbar to the virtual tablet screen. This generates a file named ma i n , x ml containing descriptions of all of the elements, including their unique IDs. The main routine is located in the T i me - L a P S e A c t i v i t y . j a v a file (created by Eclipse) under the class T i me L a p S e A c - t i v i t y . This class provides the interac- Figure 3. The GUI for camera operation using the tablet. Time Lnpsc remote control fir Bin btzri SHK-. SlCCQtfL ■ sfpmiti lac 9’,0 n-bv ' a ■. Nbc \ ffSm nn: i 1 "in r N c p^r r OK !-■ >,□ | O-t I- 1 " :< FtTU-M Sfd*: RjrAnl _] Figure 4. The accompanying web interface on the computer monitor. tion with the buttons. To access a button, you have to link an object to the previously mentioned ID as illustrated by the follow- ing example: Toggl eButton mtoggl eButtonl = ( Toggl eButton) f i ndVi ewByl d( R. elektor 12-2011 Personal Download for I © Elektor 21 AUDIO, VIDEO AND PHOTOGRAPHY Figure 5. The graphic design in Eclipse. i d. toggl eButtonl) ; Buttons can be used in two ways: actively or passively. An object’s functions can be used to read buttons and set values. This is passive use. If a function of the class should be actively invoked when a button is pressed (or when the status changes), this is done with mtoggl eButtonl. setOnCI i c k L i st ener ( t hi s) .Only the Start button is used actively in this program. The time-lapse portion of the application is a procedure that runs for a very long time. This is not possible in the main class (Ti meLapseActi vi ty) because this class is responsible for handling the GUI. If this class is busy, the GUI will not be refreshed, with the result that the GUI will freeze solid. Furthermore, Android terminates a class of this sort if it does not respond within 5 sec- onds because it assumes that the program has crashed. This is why Android provides the class AsyncTask.lt runs in a separate thread that is allowed to be constantly busy. This thread may be launched only once, for which reason it is not launched every time a time-lapse sequence is started but instead runs continuously, even if a time-lapse sequence is not being executed. Writing directly from AsyncTask to the GUI elements is not allowed (it causes a Figure 6. Interclass communication. crash). The functions publ i shProgress and onProgressUpdate are provided for this purpose, publ i shProgress is used to call onProgressUpdate from AsyncTask. Writing to the GUI is only allowed from the latter function. As only this one function is available for driving all of the buttons, a specific action is defined in onProgressUpdate according to the value of the first passed-in parameter (see the code in onProgressUpdate and the p p_ * variables). The variables (I oop_st at e,l oop_count and I oop del ay) are used for com- munication to start or stop a time-lapse sequence (communication in the opposite direction of publ i shProgress). Figure 6 illustrates the communication between the various classes. The pulse waveform for the servo is stored in an array, which is read out by the function a u d i oTr a c k . Web server This project also uses the WiFi Internet link. The status and settings can be viewed in a web page, and the application can be oper- ated from this page. There are essentially three options for making all of this possible. The first option is to use a separate web server app, for which there are many free downloadable versions available. This allows files to be viewed in the file system. This is a simple solution, but it has the draw- back that it is limited to viewing the system; it does not support operating the system. It also requires frequent updating of the HTML file, which in time will wear out the flash memory. At the other end of the spectrum there is the option of using an extensive package such as i-jetty [3]. This allows you to imple- ment a versatile web server, but such an extensive range of functions (and the asso- ciated complexity) is not always necessary. The author chose to use the open-source software ‘android Webserver’ [4] for this purpose, by including the code in the appli- cation and modifying it where necessary. The most significant modification is that the web server still reads files from the file system, which allows images such as I o g o . j p g (as used here) or CSS files to be used in the directory, with the exception of a file with a user-defined name (in this case i n d e x . h t ml ) that the program uses to generate the web page on the fly. Because the web server runs in a separate thread and therefore does not have direct access to the main routine Ti meLapseActi v - i t y , the settings and status data are trans- ferred using static variables (see the c mm_ * variables). A static variable can be regarded 22 Personal Download for I © Elektor 12-2011 elektor AUDIO, VIDEO AND PHOTOGRAPHY as a fixed memory location. Unlike normal variables, which require a new variable to be created for each object of a class, a static variable is the same for all objects of a class, and it can also be read and written from another class. For this reason, static varia- bles are called by their class name instead of their object name. The application is checked by analysing the link. In the same manner as for HTML forms (in GET mode), the variables are placed after a question mark in the URL (URI). In this case the URI i n d e x . h t ml ? a c t = s t a r t starts the TimeLapse process. The same approach can be used to set the number of pictures and the delay, for example with i ndex. html ? d e I =5. This is generated automatically by the HTML FORM order. Static variables are also used to communi- cate these settings and orders. These vari- ables are monitored inAsyncTask loop. Another way to do this would be to use a handler for this communication, for which there are two options: a general handler or a handler that is specified when the object is created. However, that was not necessary in this case. Other functions Here we can make a few general comments regarding programming for Android. It is user friendly to save the settings (pulse widths, phase, number of pictures and delay) in the program so that they do not have to be entered again the next time the program is launched. Android has specific functions for this, comparable to the reg- istry of MS Windows. These functions are elements of the SharedPref erences class. The parameter values are read when the program starts up and are saved when the program is stopped (by OnStop). These settings are also retained when a new ver- sion of the program is installed. Current versions of Android do not include an application manager, so it is not possi- ble to see which applications are running (regardless of whether they are running in the foreground or the background). This means that it’s easy to lose sight of your application. If you then launch the appli- cation again, you will end up with two instances of the application running in par- allel. This is especially problematical with the application described in this article because the web servers of both instances will listen to the same port, making the results unpredictable. Three provisions have been incorporated in the program in this connection. Firstly, the icon is displayed on the status bar to make it easy to switch back to the application from the status bar. Functions for this purpose are provided in the N o t i f i c a t i o n M a n a g e r class. Sec- ondly, the setting androi d: I aunchMode = “si ngl el nstance" is included in the T i me L a p s e ma n i f e s t . x ml file to indi- cate that a second instance of this program is not allowed to run in parallel. Addition- ally, the tablet should not be allowed to enter screensaver mode, since that makes the application unstable for some unknown reason. This is prevented by the setting androi d: keepScreenOn = "true". Incidentally, there are rumours that this problem will be mitigated in Android ver- sion 4 and later. When an application is installed in Android, the user must give permission to grant the application specific privileges for communi- cating with various hardware and software components of the tablet. For this program this consists of access to the WiFi interface, access to the flash memory card (for the web server files), and access for blocking the screen saver. These permissions must be placed in the T i me L a p s e ma n i f e s t . x ml file in the form of u s e s - p e r mi s - s i o n s (take care to avoid the common typo ‘user-permissions’) Finally, you can dress up the program with your own icons. This requires placing three images in .png graphic format in the pro- ject’s Res directory under drawable-hdpi, drawable-mdpi and drawable-ldpi with sizes of 72x72, 48x48 and 36x36 pixels respectively. All files for this project can be downloaded free of charge from www.elektor.com/ 1 1 0690. (110690) Internet Links [1] http://eclipse.org/ [2] http://developer.android.com/sdk/ eclipse-adt.html [ 3 ] http://code.google.eom/p/i-jetty/ [ 4 ] http://code.google.eom/p/ android-webserver/ Advertisement EURO CIRCUITS The European reference for PCB prototypes & small series www.eurocircuits.com elektor 12-2011 Personal Download for I © Elektor 23 INFO & MARKET The PCB Prototyper in Practice The PCB Prototyper introduced a year ago by Elektor has now found a place in many labs and companies. This machine allows users who do not have extensive experience with milling machines to mill single-sided or double-sided PCBs quickly and easily. We visited a PCB Prototyper user to learn about their experience with the machine. By Harry Baggen (Elektor Netherlands Editorial) After Elektor presented the PCB Prototyper in December 201 0, it didn’t take long for the first orders to come in. The manufac- turer (Colinbus) was already busy with the first production batch, and after a while the first units were delivered. The responses from users proved to be extremely positive. They hadn’t expected to be able to buy such a precise, easy to use machine at a budget price — after all, PCB milling machines are usually much more expensive than the 3,500 euro (ex VAT) price tag of the PCB Prototyper. Here in the Elektor editorial office we were wondering how this machine is used in practice, so we arranged a visit to Avasto in Oudewater (The Netherlands), a firm that has been using a PCB Prototyper for a while. Avasto is a multifaceted facility services contractor that is active in construction work, automation of production pro- cesses, and the design and maintenance of saunas, whirlpools and the like. Electronic controllers are used in various projects, often based on PLCs. However, this has also involved more and more in-house develop- ment of electronic devices in the last while. Their latest product is a slide safety device for swimming pools. This system provides a signal at the top of the slide to indicate when the next swimmer can jump onto the slide. The swimmer can also press a button to start a time measurement. After exiting the slide, the swimmer presses a ‘Finish’ button in the catch basin, and the elapsed time is displayed on a scoreboard. In addi- tion to preventing blockage of the slide, this system introduces a competitive element that makes the slide more attractive. Avasto developed the entire system in- house and has already installed several sys- tems. The system is approved by the Dutch Keurmerkinstituut, which is responsible for assessing and certifying product safety. Co-owner Swen van Vrouwerff is a dyed- in-the-wool technology buff who knows absolutely everything about the projects underway in his company, including their mechanical, electrical and electronics aspects. Nowadays the company is devel- oping more and more electronics devices in-house. When the PCB Prototyper was presented in Elektor, he thought it would be the perfect machine for his company, since it would allow them to make PCBs quickly for small product volumes. Although order- ing small quantities of PCBs from a PCB manufacturer is also possible, this takes more time and is relatively expensive. Swen is convinced that the investment will pay for itself quickly. 24 Personal Download for I © Elektor 12-2011 elektor INFO & MARKET Right now the PCB Prototyper is primarily being used to produce PCBs for the slide safety system described above. All of the circuitry for the system, distributed over nine PCBs, is housed in the robust enclo- sure of the display unit. All of the PCBs are made on the PCB Prototyper (photo 1). It is controlled by a netbook located next to the machine (photo 2). It’s worth men- tioning that the user interface for the PCB Prototyper and the structure of the entire slide safety system were designed by two young employees with intermediate voca- tional school education. They told us that the PCB Prototyper is very easy to use. After spending a day trying it out, they were able to use it properly and they managed to mill top-quality PCBs. Producing a PCB with roughly Eurocard dimensions takes around half an hour. The machine stops automati- cally when it’s time to change the drill bit or milling cutter, so you don’t have to be there all the time and you can do other jobs in the meantime. Photo 3 shows the end result — in this case a PCB for a display segment. The PCBs from the machine are assembled and then coated with a thick plastic film on the copper side (photo 4) to protect the cop- per against the effects of chlorine, which is abundantly present near swimming pools. Photo 5 illustrates the quality of the milled tracks on the PCB. Finally, photo 6 shows the enclosure of the slide safety system with the fitted boards. This is just one example of the many poten- tial uses of the PCB Prototyper. Presently Avasto produces mainly single-sided PCBs for leaded components, but if the company wishes to switch to SMDs in the future, the PCB Prototyper can easily mill PCBs for them as well. Furthermore, a variety of extension options for the PCB Prototyper to make it even more versatile will be available in the near future. ( 110694 -I) Internet Links www.elektor.com/projects/ pcb-prototyper-(1 0061 9). 1 599728. lynkx www.avasto.nl elektor 12-2011 Personal Download for I © Elektor 25 READERS’ PROJECTS Robusta: a Satellite Built by Students Picosatellites to promote SDac By Frederic Giamarchi (France) rv^-4 ; J France is well known for its significant participation in the European space programme and for its front-line space industry, but perhaps rather less so for the training of its elite in this field. This is why in 2006 the National Centre for Space Studies (CNES) launched Expresso: the first call for projects to higher education. Montpellier 2 University applied with their Robusta project — a cubesat picosatellite carrying a scientific experiment of interest to the space community. The Robusta ( Radiation On Bipolar University Sat- ellite Test Appli- cation, Figure 1) satellite [1] is going to be launched by the new European ‘Vega’ rocket in late 201 1 . It will carry a scientific experiment to measure deterioration in electronic components. It will be placed into an elliptical orbit between 340 km and 1 ,450 km at an inclination of 71 °. Throughout the whole flight, it will trans- mit to the student ground station located on the campus of the University of Montpellier measurement data for the components being tested and the various status parameters. Subjected to the various sources of radiation, solar wind, particles trapped in the radiation belts, and cosmic rays, it will gradually fall back down towards the Earth and after two years will disintegrate on entering the atmosphere. The Robusta satellite This satellite has a real scientific mission: to measure the deteriora- tion of electronic components based on bipolar transistors caused by ionizing radiation. The components chosen fortesting are LM1 39 voltage comparators and LM1 24 voltage amplifiers, frequently-used components on satellites. This deterioration is quantified by meas- uring currents, voltages, temperature, and dose received (Figure 2). This dose corresponds to the absorbed radiation per unit of mass. The results will then be compared with those obtained by a ground test method devised by the researchers at Montpellier University’s IES laboratory (IES stands for Institut d’Electronique du Sud, Southern Electronics Institute) [3][4]. The duration of the mission is fixed at two years. The data will be measured at least every^ 1 2 hours. They will then be transmitted to the Montpellier campus ground station using an amateur radio protocol and frequencies. Transmission will take place in broadcast mode, i.e. continuous every minute, whether or not the satellite is in a window of visibility for the ground station. A crucial point for the success of the mission is power manage- Note. Readers’ Projects are reproduced based on information supplied by the author(s) only. The use ofElektor style schematics and other illustrations in this article does not imply the project having passed Elektor Labs for replication to verify claimed operation. 26 Personal Download for I © Elektor 12-2011 elektor READERS’ PROJECTS ment. The satellite will be powered by Saft Li-Ion batteries, which will be recharged by special triple-junction space solar cells with 27 % efficiency. Internal structure The mechanical structure, the dimensions and positioning of the electronics boards, and the aspects of the launch system via a p-pod (Figure 3) are being taken care of by the CMP ( Genie Mecan- iqueetProductique, Mechanical & production Engineering) and CEII ( Genie Electrique et Informatique Industrielle , Electrical & Industrial Computing Engineering) sections of NTmes Polytechnic. The power supply board and power management for the battery and solar cells sub-system is also being dealt with by NTmes Polytechnic’s GEII sec- tion. The controller board sub-system, which manages the com- mands between boards and stores the measurement data, and the microcontroller programming and test receiver elements are being operated by departments within Polytech’Montpellier. The experi- menfboard sub-system, which includes the components under test and the dose and temperature sensors, is being designed by EEA (Electronics, Electrical Engineering, and Automation) degree and Master’s students in the Faculty of Science. The radio communica- tion board and ground station sub-systems specifically are being handled by Microwave students. The components and materials used in this project are commercial components that are not hardened, apart from certain ones like the battery and solar cells. A rigorous radiation quality assurance pro- cess has been operated to minimize the risks associated with their exposure to radiation as far as possible. The project will be consid- ered a success if it operates for more than a year. Mechanical structure The mechanical structure has been designed and machined out of a solid block so as to form a single piece (Figure 4). The structure is made from aluminium 6061 , which has stable density in a space environment. The various elements of the satellite, solar cells, PCBs, screws, connectors, wires, etc. have all been designed and dimen- sioned as the project has progressed. It’s taken constant interac- tion between the different teams for various the parts to keep the various measuring elements up to date with developments in the various corrections validated. Figure 1 . CAD model of the Robusta satellite, (source: RobustaCom) Figure 2. Example of modelling for calculating the dose absorbed by a component in Robusta using the FASTRAD software. (source: RobustaCom) Cubesat ‘Cubesat’ satellites are part of an educational programme put in place in 2000 by California Polytechnic University (CalPoly) [2], the aim of which is to offer students concrete experience and in-depth knowledge in relation to research and the aerospace industry. A cubesat is a satellite in the form of a 1 0 cm cube, weighing a maxi- mum of 1 kg and having a maximum power of 1 W. It consists of a useful load referred to as the payload, corresponding to the on- board experiment, and a platform comprising the various electron- ics boards allowing control of the experiment, communication with the Earth, and power management. The whole thing represents the simply a very small equivalent of a conventional larger satellite, sub- ject to the same stresses, with thermal shocks, extreme vibration at blast-off, radiation, and the vacuum of space. elektor 12-2011 Personal Download for I © Elektor 27 READERS’ PROJECTS Figure 3. 3D exploded model of a p-pod. (source: CubeSat Project) Power board The power board recharges the battery and distributes the different voltage rails needed for the various sub-systems. It also includes the system required for triggering deployment of the antennas once in orbit. The component ratings chosen allow a significant margin in terms of the power required. The battery charging system allows for the temperature-dependent variation in the solar cell voltage, as well as their deterioration over time. Three rails are provided: 8 V for the amplifier used to transmit the data back to Earth, 6 V for the logic circuits, and -5 V for the components under test. The six faces carrying solar cells will be subjected to the sun’s rays in a ran- dom order, depending on the rotation of the satellite. It has been decided to measure the voltage and current from these six faces in order to verify proper charging of the battery and implicitly meas- ure the satellite’s rotation. An l 2 C bus was chosen by the students for dialoguing between the power board and the controller board. Experiment board The electronic circuitry for the experiment board had to be very Figure 4. 3D exploded model of the satellite, (source: RobustaCom) thoroughly designed and tested. Each of the integrated circuits under test (LM1 24 and LM1 39) includes eight elements, for which currents, voltages, temperatures, and doses have to be measured. So it was necessary to find an architecture based on analogue switches driven by the microcontroller in order to multiplex the measurements made at the various pins of the devices (Figure 5). The students had to choose a bus that would allow managing the large number of addresses allocated to the switches, and in so doing learnt a lot about l 2 C and SPI buses. Apart from the power board, the other boards each have a PIC1 8F4680, an ADC interface and an anti-latchup system (protect- ing the microcontrollers against short-circuits generated by ioniz- ing particles). Controller board The brains of the satellite: its function is to organize the tasks of the other boards. It manages the dialogue with the other boards and it is responsible for managing the power available. For example, it inhibits communication with the ground station while an experi- Composants Testes 2x LM124 2x LM139 Interrupteurs Bus SPI Metrologie de I’environnement Dosimetrie Dosimetrie OSL Temperature Capteur de temperature 1 Capteur de temperature 2 Systeme de mesure Microcontroleur PIC18F4680 Software I/O Memoire Vers carte controleur Bus CAN 110493 - 11 I Antenne 1 Carte Experience Carte Communication ■ 1 Bus CAN 1 1 Support Electrique Carte Puissance Bus I2C Carte Controleur Figure 5. Block diagram of the experiment board, (source: RobustaCom) Figure 6. Interconnection of the four boards using l 2 C interface and CAN bus. 28 Personal Download for I © Elektor 12-2011 elektor READERS’ PROJECTS 100% student The Robusta satellite and dedicated ground station have been entirely designed and produced by the students from the vari- ous courses at the Montpellier 2 University: NTmes Polytechnic, Polytech’Montpellier engineering college, and the EEA (electronics, electrical engineering, automation) degree and master’s courses in the Faculty of Science. This project in partnership with the CNES is also being supported by major manufacturers in the electronics sector. tions and making the project information accessible for the media. The satellite has to be conceived, produced, and tested by the stu- dents, guided by educators who are experts in the field concerned, and always under the control of the CNES. The students are also re- sponsible for the project management. This project represents real experience of an industrial nature, but on a scale that remains accessible to students by virtue of its duration, cost, and technical level. Robusta, as a system, makes it possible Several major educational themes can be identified within this pro- ject: the system design and associated project management, the mechanical structure, the environmental tests, and the sub-systems involving several fields within the EEA: power management, payload, controller board, radio communication board, and the associated ground station. And lastly, there is an element involving communica- tor college students from 2 nd year degree to PhD level to develop sophisticated engineering prototypes and to improve their sense of communication, while discovering the world of space. They are deeply committed right from defining the mission to exploiting the measurement data, through all the phases of design, component sourcing, production of prototypes, and testing. ment is in progress, as these two actions are too power-hungry. In the course of the inter-sub-system meetings, it was decided to use a CAN bus for the communication between the various sub- systems (Figure 6). But as part of the prototype design process, the students have been able to develop their own data exchange protocol. As there are such a large number of messages to be sent to the other boards, a Petri net has been used to avoid jams and losing messages, and to correctly handle the imposed restrictions. Radio board For the radio communication sub-system, the students have paid due attention to the selection of the frequency band allocated for an application. After studying various transmission/reception architec- tures, they opted for a system using two separate frequencies in the radio amateur bands: 435.325 MHz for transmission to the ground station and 1 45.95 MHz for receiving the remote commands. The choice of components, in particular the amplifiers, was made in direct consultation with the ground station sub-system students, in accordance with the link budget. In addition to learning a great deal about the problems specific to using radio frequencies, they were also called up to implement signal processing processes when choosing the type of modulation and demodulation. And simula- tion has not been overlooked, particularly for the satellite antennas, which were fully simulated using CST Microwave Studio, a special professional microwave application. Ground station The ground station is an integral part of any space mission and is vital for it to function properly. It becomes the sole communication interface possible once the satellite is in orbit. Thus it makes it pos- sible to receive all the experimental data and the flight parameters (telemetry), as well as to send remote commands for modifying the experimental protocol or the behaviour of the satellite (for exam- ple, manage the power supply, activate or disable certain sections). Expresso The Toulouse Space Centre (CST) which comes under the CNES offers students an opportunity to gain concrete experience in the field of orbital systems. This is also the occasion to test out new technolo- gies and to perform scientific experiments for the space community at minimal cost. To support the project, the CNES is offering financial resources and is making available a project co-ordinator and experts from the CST for the thermal analysis, the solar cells, vibration test- ing, frequency use permissions, etc. elektor 12-2011 Personal Download for I © Elektor 29 READERS’ PROJECTS Figure 7. The Robusta ground station, (source: RobustaCom) Figure 8. The Vega rocket, (source: ESA) The Robusta ground sta- tion (Figure 7) is con- structed around ama- teur radio hardware. The central element in its architecture is a transceiver that allows modulation/demodula- tion of AFSK signals, in the 430 MHz band for the telemetry and in the 144 MHz band for the remote commands. Two motorized anten- nas establish the link with the satellite. A PC manages the motori- zation of these anten- nas, as well as sending the remote commands and the reception of the telemetry. All this ground station soft- ware has either been developed internally or comes from the world of ‘open source’ — start- ing with the Ubuntu operating system on the ground station PC. This means we can adapt the software to our specific needs and upgrade it over time with no par- ticular restrictions. The Vega launch vehicle Following a call for applications, the Robusta satellite was chosen to be put into orbit along with eight others during the Vega rocket’s (Figure 8) qualification flight. The Vega project should make it possible to put small satellites - between 300 and 2,000 kg — into low or polar orbits. This will be a first for this launch vehicle which will blast off from the Kourou space base in French Guiana in late 201 1 . In all, nine cubesats will be released from the launcher at the same time as the main payload, a scientific satellite called LARES System along with the educational mini-satellite ALMASat. (110493) Internet Links & References [1 ] Project Robusta: www.ies.univ-montp2.fr/robusta/ [2] Cubesat by California Polytechnic State University: http://polysat.calpoly.edu/ [3] J. Boch, “Estimation of Low Dose Rate Degradation on Bipolar Lin- ear Integrated Circuits Using Switching Experiments”, IEEE Trans. Nuclear Science, vol. 52, pp. 2626-2621 , December 2005. [4] J. R. Vaille, F. Ravotti, P. Garcia, M. Glaser, S. Matias, K. Idri, J. Boch, E. Lorfevre, P.J. McNulty, F. Saigne, L. Dusseau, “Online dosimetry based on optically stimulated luminescence materials” IEEE Trans, on Nuclear Science, vol. 52, Issue 6, December 2005 pp. 2578-2582. The space adventure continues with Friends and Ristretto Robusta, Expresso, Friends, Ristretto — no, these aren’t terms from some galactic coffee bar, but rather the names of student projects for conquering space. Small student satellites of increasing size — this is what Montpellier 2 University is offering us, in collaboration with the CNES, the ESA, and the Baumann University in Moscow. To meet these new challenges, Montpellier 2 University will shortly be setting up a university space centre named SOLARIUM (Sys- temes Orbitaux Lies auxActivites de Recherche Interdisciplinaires de IVniversite Montpellier 2), with support from the Van Allen founda- tion — the first in France to exploit the potential of small satellites 30 Personal Download for I © Elektor 12-2011 elektor Elektor App for iPhone and iPad <=> > The Elektor Electronic Toolbox Elektor now offers an App you cannot afford to miss on your iPhone, iPod Touch or iPad. The Elektor Electronic Toolbox is a collection of no fewer than 28 electronic tools that can be picked from a comprehensive set of icons! Highlights: - Databases for Transistors, FETs, Triacs, Thyristors, Diodes and ICs - NE 555 circuit design - An Ohms Law calculator - Schematic Diagrams - Number base converter - LED / resistor calculation - R/L and BJT calculations - And more Further information at Now available from the Apple ITunes Store for just $ 5.99 1 € 4 . 99 ^ www.elektor.com/.app SEDP 3201 NCOA2015 AUK <.-!***■ g UTJt -rfiT0dijIc.com Class D Audio Amplifiers High {Jjualily, liiRh Efteciency DC/DC Converters Nigh ElTeciencj, No I Edit Sink FM Audio Transmitters J I i !■ L Sound Quality evaluation Boards Lm* Cost Ready -lo-Use Features: e c * t A integrated design Ultra compact Almost no external parts Soldo rod r?v SMT or by hand Lew cc st High Reliability Many ready-to-use EVR Dealer Wanted] u Applications ■ Consumer © Auto accessories o Instruments 0 Industry 9 Toys c Comm unication Equipments 9 And many mare Products to choose , from! ’ Experiments witn Digital Electronics llektor llektor toolbox llektor utions lectronics Valve Amplifiers 2 models ond applications Electronic Engineers Limited to available stock tfkUkKiTiORlP.RUUUUiltS PIC Microcontroller projects FOR BEGINNERS AND EXPERTS Bert van Dam 31 0 Circuits lr. NVenno van der Veen Discounts up to 58% Offer valid until 1 January 2012 liBUbltMilUWlflTlW.WWjbUiiKtTOltfliOM^UHHISTMflSUHEbrtl elektor 12-2011 Personal Download for I © Elektor 31 EMBEDDED LINUX XPort your Ideas to the Web More and more microcontroller systems come with an Ethernet port. At Lantronix they took the opposite approach: XPort Pro is a network interface module with an integrated microcontroller. This article gives you some pointers for setting up a software development environment and presents three example applications. By Kevin Petit (France) [kpet@free.fr] From the hardware perspective, the XPort Pro module [1 ] is a Freescale MCF5483 Cold- fire microcontroller. It operates at 1 66 MHz, has a built-in Ethernet interface and an encryption accelerator, is equipped with 8 MB of RAM and 1 6 MB of flash memory, and is housed in an RJ45 enclosure measur- ing 3.3 x 1 .6 x 1 .4 mm. It has five I/O pins, with two of them reserved forTxD and RxD, while the other three can be used for RTS, CTS and DTR on the serial port or for gen- eral-purpose I/O under the monikers CPI , CP2 and CP3. All of this runs under Linux, or more precisely, under uCLinux (pronounced ‘you see Linux’). You don’t need to make a PCB in order to get acquainted with the XPort Pro module - you can use a demo board from Lantro- nix (Photo 1 ) or the XPort (Pro) to bread- board interface described in our Embed- ded Guide 2010 supplement, which was included in last year’s December issue. If you’re totally new to installing and con- figuring a Linux SDK, you may quickly find yourself wondering where to turn next, so we should first explain what a Linux SDK is. Usually it’s a collection of source code files, including the Linux core, a C library, applica- tions and so on, along with a set of rules for putting everything together - which take the form of what is called a make file. There are several other essential ingredients, such as the compiler chain, a utility for creating images, and so on. After all this hotchpotch has been installed and configured properly, it’s very easy to use it to develop all sorts of software for anything you may dream up. However, it’s a good idea to bear in mind that no SDK is entirely foolproof (don’t say we didn’t warn you!). Usually there are a lot of settings that need to be dealt with, espe- cially when you’re just getting started. If all this is making you feel a bit nervous, we hope that the pointers below will put your mind at ease (more or less). SDK installation The Lantronix SDK only runs under Linux. However, it’s possible to run Linux on a Win- dows machine in a virtual PC environment. This is a good solution, not only for devoted Windows users but also for everyone who is willing to sacrifice a bit of performance for easier installation. The downloads for this are available at [2], although you may find a bit of explanation necessary. If you prefer not to take the virtual machine approach, you will have to install the SDK yourself. There are two options here: you can burn the ISO image of the SDK on a CD, or you can mount the image (to use the Linux jargon). The author chose the second option. Start by creating a directory to hold the image, for example with the mkdir / mnt/ iso command (note that this requires you to be the root user). Now you can mount the image with the command mount -o loop / path/to/iso/image / mnt/iso. Next, create a directory for installing the SDK, for example by typing mkdir ~/xport-sdk. Then type cd ~/xport-sdk to go to this directory, fol- lowed by /mnt/iso/install.sh to launch the installation script. If your Linux distribution is based on Debian or Red Hat, things should be very easy from this point onward. Otherwise, such as in the author’s case, you must first copy the entire CD to a new folder of your choice. This is because you need to modify the script file install. sh, and no matter how hard you try, you can’t modify a file on a CD. Install. sh calls another script named scripts/ host_depend.sh, which installs the software required for the SDK. However, this doesn’t work with distributions that use the RPM or DPKG package manager, so you have to comment out the lines in install. sh that call host_depend.sh by placing a number sign (#) at the start of each of these lines. In SDK version 2. 0.0.0, these are lines 167 to 171 (inclusive). All of these lines must be commented out with a number sign at the start. Now you can run the installation. If you choose this method, you will have to install all of the software necessary for the SDK yourself, guided by the error messages displayed during the installation process. After completing the installation, you can unmount the image with umount /mnt/iso. Elektor patch Once the SDK is installed, you can add the demo applications for this article. They are intended to form part of the image, and they should be located in /home /elektor. Start by downloading the zip file from the Elektor website [3]. Extract it in the folder of your choice (such as /tmp). This creates 32 Personal Download for I © Elektor 12-2011 elektor EMBEDDED LINUX A software development environment for XPort Pro, including three example applications a folder named Elektor-XPort. Open this folder and type the command ,/elektor_ install. sh dossier_d'installation_du_SDK (“SDK installation file”). If everything goes well, you will see the message ‘SUCCESS’. Partitioning flash memory You can partition the flash memory of the XPort module using one of the schemes defined by Lantronix, or using your own scheme if you know what you’re doing. The author chose the ‘kernel + romfs + JFFS2’ option. What all this means is explained in the documentation for the SDK. One par- tition contains the core image with rootfs in romfs , where ‘fs’ stands for ‘file system’. Rootfs is the space where system files are stored, similar to the C: volume on a Win- dows machine. Romfs is a read-only file system that is used to prevent files from becoming corrupted, since viruses cannot burrow into files that cannot be modified or overwritten. The third partition is for- matted as JFFS2. JFFS2 is a file system spe- cifically designed for flash memory, and you can use it to store whatever you wish. The advantage of this arrangement is that you can leave data undisturbed in the JFFS2 par- tition when you download new firmware to flash memory, which is certainly practical. Configuring and using the SDK Before you can create an image for down- loading to the XPort Pro module, you must configure the SDK. Start by open- ing the directory where you installed the SDK. In this directory, issue the command source env_m68k-uclinux, which config- ures the environment variables so the SDK will work properly. You must enter this com- mand every time you open a new terminal session. Then start the configuration pro- cess with make menuconfig. Before you see the main menu, you have to answer a series of questions. Choose the default answer in each case, and press the Enter key. After this you will see the actual menu. Select the first submenu, Vendor /Product Selection, and verify that the vendor is set to Lantronix and the Lantronix product is set to XPort_Pro. You can also select a pro- file to be used. A profile consists of a set of parameters for the Linux core, uCLinux, and the applications to be installed with them. A good choice here (the author’s choice) is the DEVELOPMENT profile. The various options belonging to each profile are documented in 900-548c_Linux_SDI<_ UG.pdf, which is located in the SDK docu- mentation folder. Press Exit to return to the main menu, and confirm with Enter. Now select the second menu, /Library /Defaults Selection, and use the space bar to select Customize Kernel Set- tings and Customize Application /Library Set- tings. Finish off with Exit and Enter twice in succession. Answer Yes to the question whether you wish to save the configuration. A second configuration menu for the Linux core will open a few seconds later. Select Processor Type and features and set the Lant- ronix CP Manager option to General Purpose I/O. This allows three of the five I/O lines to be used for your own purposes, as previ- ously mentioned. By default, two of them are used by the serial port driver for RTS and CTS. If you use the Lantronix demo card, be sure to remove all jumpers from JP6 except numbers 1 and 7. Tick Reclaim page before process loading to reduce memory fragmen- tation. Now you can exit the menu as previ- ously described, and of course you should save the configuration again. Next you come to the third and final menu. Here you only have to close the menu, but once again you must save the configuration when asked. Now you can issue the make command to start compilation. This takes a while, so it’s a good opportunity to go for a coffee break. After you get back, you should find a num- ber of images in the linux/images folder of the SDK, ready for downloading to flash memory. The most important items here are the image.bin file and the romfs file system. To load an image into the XPort Pro module, you must use a TFTP server. This is not the place to delve into the details of configur- ing a TFTP server for all possible Linux dis- tributions, but Google can be helpful in this regard. The server must be configured so that the root points to linux/ images in the SDK. The author can strongly recommend tftpd-hpa. Other servers caused a few prob- lems in combination with the XPort module, but you shouldn’t encounter anything truly insurmountable. Open the XPort! At this point you should be fully ready to flash an image via the TFTP server. If you’re in a hurry or you don’t have the time or the inclination to install the SDK yourself, you can download a ready-to-use image from the Elektorweb page for this project [3]. elektor 12-2011 Personal Download for I © Elektor 33 EMBEDDED LINUX frfirhwi £u ■ «jj Miuii J'j U.IR uhr ^riJiLtr Vuk i i t ■dnich-i::c : arr ■ 4- r UT1 LIkH?!. j eft run- m f T m : 15 fl jib Leon a □ Cl tf Eparvi DC] ua DO] it kvniid: 1 1 i2 aa ■IU l.LlknK> L AuLubivL r 4. Lair ! . -a a h □ — r sc - a I'JSMGflr.US cl l*fr t i l 92. 1*0. a, H r] H r ptuMV' n, n ,o . n MtU'-da'S. ; 255. 255. 255. Q filed -BIBB a uiAga.bia z l _ntypD j Lnago otroddj:] 00:20: / ■I 1 ■% i ra. a .a, n D rr,ijnia:aa uf l tc’ r 1 cfeue> | rn-n-E ? ■ L yp+i “ rc:nJ i itr- M vv - r i i *■ iirt nftj i rrn rr=. n n^F Figure 1 . Boot loader configuration. Now we get down to brass tacks with a few practical examples (at last!). First let’s configure the boot loader dBug. Using your favourite terminal emulator program (set to 115,000 baud, 8 data bits, 1 stop bit, no parity and no flow control), establish a serial connection to the XPort module Then switch on power to the card. Now you have to be fast: you must press a key within three seconds to bring up the command prompt for the boot loader. If you manage this, you will see dBUG> on the screen. You can use the help command to view help text, show to display the current configuration, and set to configure the various configura- tion options. Figure 1 shows our chosen configuration. set watchdog off: We don’t use the watchdog. set silentboot off: Silent boot starts up faster, but you have to hit Ctrl X light- ning fast to access the boot loader menu, and that’s not helpful in a development environment. set romfs_flash on: The romfs file system is not loaded into RAM, but instead runs directly from flash memory. This frees up a lot of working memory, although at least in theory it slows things down a bit. However, the author didn’t notice any difference for the applications described below. set autoboot flash: We want to boot auto- matically from flash memory. Another option would be to boot from the network. set server ip_server_TFTP: Sets the IP address of the TFTP server, for example in the form 192.168.0.1. set client ip_client: The boot loader needs a valid IP address for all transactions on the network. This address is not related to the address that is used after Linux is launched. set netmask uw_netwerk_masker: If you don’t know what to enter here, there’s a good chance that ‘255.255.255.0’ will get you what you want (most of the time). set filename image.bin: The file we want to load into flash memory is named image.bin. set kcl rootfstype=romfs: This tells the Linux core that rootfs is of type romfs. After making these configuration settings, you can issue the command dnfl (which stands for ‘download from network and flash’). This should start downloading image.bin. If it doesn’t, you should check whether your TFTP server is working prop- erly - for example, by using a TFTP client on another computer in the network. Once the download is complete, you will be asked whether you wish to clear flash memory (which means overwriting it); answer Yes. The actual flashing starts after this. You will receive a message if the process completes without errors. In this case, press the Reset button on the demo board. In response, you will see that Linux is launched, and a short while later the command prompt will appear. Give yourself a pat on the back - the hard part is done, and now it’s time to have fun. Let’s see what neat things you can do with this system. The old standby: blinking LEDs Lantronix supplies a utility called cpm (for ‘Configurable Pin Manager’) that can be used to manage the GPIO pins of the XPort Pro module. This program expects to receive an input file containing the con- figuration of the three I/O pins. The proper syntax is described in the Lantronix docu- mentation, although you can also get good idea of this by examining the included file. This small demo program uses a shell script that calls the Lantronix cpm utility for the I/O pins. If you don’t know what a shell script is, don’t worry - it’s simply a text file with a list of commands to be executed in sequence. If you want to see anything with this demo, you need to connect a pair of LEDs to the CPI and CP2 lines. Then use the cd command to go to the folder /home/ele- ktor/ledcpm and enter ./led-blink.sh. You should see the LEDs blinking alternately. A touch of Internet Making a pair of LEDs flash is good fun, but it’s not really world news. We have a built- in network link in the XPort, and it would be a sin and a shame to not use it, so we need some sort of Web application. Let’s do it! For this purpose we use Boa, a lightweight web server included with the SDK. It has to be provided with a configuration file named boa.conf. The syntax rules for this file can be FORM_GPIOCP Won ' FOP,M_GP'IOCP2 = "on' F0RM_GPIOCP3="on' Turning CPI on. Turning CP2 on. Turning CP3 on. State of CPI State of CF2 State of CPS Submit O □ □ Figure 2. Screenshot of the web application that controls the GPIO ports. 34 Personal Download for I © Elektor 12-2011 elektor EMBEDDED LINUX found on the Boa website [4]. After modify- ing this file as appropriate, you can launch the server with the command boa -c rep_ config, where rep_config is the name of the folder containing the boa.conf file. This application allows the I/O pins to be set and read from a web page (see Figure 2). The author used CGI [5] to enable the XPort module to do something. The XPort mod- ule does not support languages such as Perl or Python that can be used to gener- ate CGI scripts. The author was not inter- ested in writing a C program for this specific purpose, and manually processing HTTP requests was not a desirable option. After nosing around on the Web, he found ProCGI [6], a small C program that processes HTTP requests and allows users to configure varia- bles that can be used directly in shell scripts, which as already mentioned are lists of exe- cutable commands. However, a few modifi- cations to ProCGI were necessary to enable it to work with the command interpreter in the XPort module. That’s enough theory for now; let’s get the application up and running. Before you launch the web server, the XPort module must be given an IP address. If there is a DHCP server on the network, this has prob- ably already happened. You can verify this with the ifconfig command. Otherwise you will have to assign an address manually using the command ifconfig ethO up ip_adres. Then go to the folder /home/elektor/webgpio and enter boa -c . (note that the space and the point must be entered as shown). Voila: the web server is up and running. You can connect to it by entering http://ip_ van_XPort in the address bar of any desired web browser. Set the desired levels on the outputs and click the button. The script in the XPort module decodes the request and uses the cpm utility to configure the out- puts. Cool? Cool! And speaking of cool, we have something else for you. Web-based temperature logging To show what this little module can do despite its limitations, the author decided to do something a bit more complicated: connect a temperature sensor to the XPort module and display a plot of temperature versus time on a browser. The architecture of this application is shown in Figure 3. The □ your applications In this article we dispense with the usual ‘Hello World’ introduction, so we thought it would be a good idea to mention a few aspects of compiling applications for the XPort module. Applications can be integrated into the SDK, but they can also be compiled from a sepa- rate directory. If you want to have your applications be included in the image.bin file, you must choose the SDK option Regardless of you choice, there’s no getting around the task of generating a make file. A handy tool for this is available at [7], and you can draw inspira- tion from the examples there. The compiler can be invoked directly (m68k-uclinux-gcc) for very simple applications such as ‘Hello World’, but for anything else this method is very tedious, which is why we use make files. Figure 3. Architecture of the webtemp application. CLinux: can we live without an MMU? In virtually every computer a memory management unit (MMU) controls traffic to and from the memory. The absence of an MMU in the XPort Pro module creates limitations and forc- es us to use uCLinux - a Linux distribution specifically created for systems without an MMU. Some functions that are included in the standard package of ‘normal’ Linux are completely absent under uCLinux or exhibit abominable performance (fork and mmap). Another major irritation, especially in a development environment, is the absence of memory protection. There is no strict partitioning of memory areas for different processes, so if your program crashes, it may take the entire system down with it. For this reason, you must keep a close lookout for potential problems such as null pointers and other memory-related bugs. elektor 12-2011 Personal Download for I © Elektor 35 EMBEDDED LINUX The La ntronix virtual machine After downloading the compressed file for the virtual machine from the website [2], extract it in a folder of your choice. Then install the program VMware Player, which you can find at [8]. Launch VMware Player and open the .vmxfile from Lantronix. The program asks whether you have relocated or copied the virtual machine; select the latter option. In response, the virtual machine starts up and requests your user ID. The password is ‘PASS’. The default keyboard configuration is QWERTY, which is OK for most English-speaking users. If you wish to change it, open the configura- tion dialog under System -» Preferences —> Keyboard. You can add the desired keyboard layout on the Layout tab. Then use Move Up to put it at the top of the list. Click Close to close this window. That takes care of the keyboard. To get started, launch a terminal session via Applications Accesso- ries -» Terminal. The SDK is located in /home/lantronix/linuxsdl<. One final remark: if you configure the TFTP server, remember that it must be installed on the virtual machine, so you must use the IP ad- dress of the virtual machine to allow it to establish a connection to the server. Have fun! Figure 4. Screenshot of the webtemp application. sensor is a TMP1 02, which is connected to the XPort Pro over an l 2 C interface (SDA to CPI and SCL to CP3). The author originally planned to use rrdtool to generate the chart, but due to some of the limitations of the XPort module he was not able to get it to work reliably. He then realised that it would be better to leave chart generation to the client, which in this case is the web browser. At the XPort end there is a C program that simulates an l 2 C bus interface on the I/O pins of the XPort module. The cpm utility does not provide enough performance for this task, so the author used the Lantronix libcp library instead. Temperature readings are written to a file at regular intervals. A web server (Boa) runs on the XPort module. At the PC end there is a mixture of HTML, CSS and Javascript. The Javascript portion use AJAX to retrieve data from the server running on the XPort module. The server calls a small C program that converts the data file to JSON (a format used for exchang- ing data over the Web) and returns the con- verted data. After this, Javascript calls the Plot library, which generates a plot of tem- perature versus time. A button on the web page allows the plot to be updated man- ually, and another button enables auto- matic updating at 1 -second intervals (see Figure 4). All of the source code is reasonably well commented, and as usual it can be down- loaded from the Elektor web page for this project [3J. To run this application, open the directory /home/elektor/webtemp. Type boa -c . & to launch the web server, then type tmp102 -q -F /tmp/temp.dat -nO to initiate communication with the sensor. After this, point your favourite browser to http://ip_van_XPort and click one of the buttons. This article, although far from exhaustive, is intended to get you off to a running start with the XPort Pro module. Despite its limi- tations, you can do a lot with this module. We hope our efforts stimulate you to start XPorting your own ideas. (100388-I) Web links [1] www.lantronix.com/device-networking/embedded-device-servers/xport-pro.html [2] http://forums.lantronix.com/forumdisplay.php?f=20 [3] www.elektor.com/ 100388 [4] www.boa.org/documentation/boa-2.html#ss2.3 [5] http://en.wikipedia.org/wiki/Common_Gateway_lnterface [6] www.fpx.de/fp/Software/ProcCGI.html [7] www.makelinux.net/make3/ [8] http://downloads.vmware.eom/d/info/desktop_downloads/vmware_player/3_0 36 Personal Download for I © Elektor 12-2011 elektor Elektor Academy Webinars in partnership with element14 Elektor Academy and elements have teamed up to bring you a series of exclusive webinars covering blockbuster projects from recent editions of Elektor magazine. Participation in these webinars is COMPLETELY FREE! All you need to do is register at www.elektor.com/webinars . Webinar programme: Let’s Build a Chaos Generator Date: Thursday December 1 5, 201 1 Time: 15:00 GMT (16:00 CET) Presenters: Maarten Ambaum and R. Giles Harrison (Reading University) Join us in this webinar to look at the making of the Chaos Generator project published in the September and October 201 1 editions of Elektor. Get out your opamps, wipe your monitor and glasses and turn up the volume loud! Here comes The Elektor Bus! Date: Thursday January 19, 2012 Time: 15:00 GMT (16:00 CET) Presenter: Jens Nickel (Elektor) Many Elektor readers have actively participated in designing what’s now known as the Elektor Bus. Elektor editor Jens not only tells the story of how it all came about, but also delve into protocols, bus confl icts and hardware considerations. Now available to view on demand at www.element14.com E-Blocks, Twitter and the Sailing Club Presenters: Ben Rowland and John Dobson (Matrix Multimedia) E-blocks are small circuit boards containing a block of electronics that you would typically find in an electronic or embedded system. In this webinar Ben and John demonstrate rapid prototyping of an E-Blocks configuration capable of automatically sending Twitter messa- ges to members of a sailing club. Platino - an ultra-versatile platform for AVR microcontroller circuits Presenter: Clemens Valens (Elektor) Many microcontroller applications share a common architecture: an LCD, a few pushbut- tons and some interface circuitry to talk to the real world. Platino offers a fl exible through hole design for such systems based on the popular AVR microcontrollers from Atmel. Platino supports all 28 and 40 pin AVR devices, several types of LCD and has a fl exible pushbutton and/or rotary encoder confi guration. e I e k FoT'‘ ACADEMY the school of electronics elementiu www. element 1 4. com Places are MICROCONTROLLERS Here comes the Bus! (1 0) Readings with 22 By Jens Nickel (Elektor Germany Editorial) This month we up the resolution: an external ADC attached to a node delivers samples with 22 bits of precision. Getting the samples into the microcontroller is easy using its SPI port. Also, we show how to display the results on a PC with a judiciously-modified version of the HTML page from the previous instalment in this series. bits of precision One of the pleasing things about electron- ics is the way you can get inspiration from other projects. In this case it was the reader project ‘Temperature Gradient Meter’ from last month’s issue [1]. Author Dr Diet- mar Schroder selected an external type MCP3551 ADC from Microchip for use in his circuit in order to obtain the high pre- cision required to detect minute tempera- ture changes. This device converts voltages to digital values with 22 bits of precision. Figure 1 shows the tiny circuit built around +5V Figure 2. Printed circuit board designed by Dietmar Schroder. XI 00 and XI 01 are connected to l<4 on the experimental node. f < ■-pptr.il p ' r ? 1*. . vac C Hn«T l. lnr l T n 1 LUC I E \E : Cwrf ■ r " lW 1 Fau’ p Ml 11 II % Figure 1 . Circuit diagram of the high-resolution temperature sensor, with connection to our experimental node. Figure 3. Display of ADC values and temperature readings in the ElektorBus browser. Elektor Products & Services • Experimental nodes: printed circuit board 110258-1 or set of three • Free software download boards 110258-1C3 (microcontroller firmware plus PC software) • USB-to-RS485 converter (ready built and tested): 110258-91 Products and downloads available via www.elektor.com/ 1 1 061 0 38 Personal Download for I © Elektor 12-2011 elektor this delta-sigma converter, an NTC thermistor and a couple of sup- port components. Figure 2 shows the corresponding printed circuit board designed by the author, which can be downloaded at [1 ]. The ADC makes a new conversion result available at its output (an SPI port) approximately fourteen times a second. The circuit is tailor- made for connection to one of our experimental bus nodes. Two pins of our eight-way connector [2] serve for the digital interface, and two more provide power to the sensor circuit. And because the temperature gradient meter also uses an ATmega microcontroller to process the results, we also have a solid foundation on which to build our code (again, see [1 ] for download). Bit banging The SPI port is driven using ‘bit banging’, that is, by controlling the interface signals directly rather than using the microcontroller’s built-in interface. I swiftly converted the C functions responsible for this into BASCOM (see Listing 1 ). Function Readext er nal a d c ( ) waits for the ADC to pull its SDO pin low. The microcontroller then takes the SCL signal alternately high and low: after each rising edge one bit of the conversion result is made available by the ADC on its SDO pin, with the most-significant bits coming first. The long vari- able Da t stores the result as it is built up: the variable is shifted left and if SDO is high a ‘1 ’ bit is added in. The datasheet [3] explains that 24 bits must be read in and that an extra clock pulse should be emitted for safety. Note that in this circuit we operate the ADC in ‘continuous conversion mode’. All that remains to be done is apply a voltage to the ADC’s input and look at the results. As the original article noted, because of inevitable noise in the cir- cuit only about 1 9 bits of each conversion result are significant, which corresponds to a still rather impressive temperature resolu- tion of around three ten-thousandths of a degree. There is there- fore no reason not to drop the bottom two bits of each result using a right-shift operation. Twenty bits remain, of which the most sig- nificant will always be zero for temperatures above — 35°C. That fits perfectly with our ‘Application Protocol’ which allows nineteen-bit integers (plus sign bit) to be transmitted [4]. The BASCOM code, available for download at [5], shows clearly how the nineteen bits are divided among the three data bytes. Doing the initial tests was easy enough, as using the author’s board design saved a lot of time. All I had to do was add a user interface on the PC. I implemented this using the ideas presented in the previous instalment in this series, based on HTML pages and the dedicated ‘ElektorBus browser’. The HTML page ‘lndex.htm’ from the last instalment was modified to receive a ‘VALUE4’ instead of a ‘VALUE2’ and display the received value in the text box. User interface With the addition of the sensor board we have turned a bus node into a high-resolution sensor device: even just bringing your hand near the unit produces a marked change in the temperature read- ings. Naturally, we would like to display the readings in Celsius, and so I have implemented the required conversion routine in the sen- sor node firmware, using the NTC characteristic curve values (in Listing 1 : BASCOM code to read a value from the ADC F u n c t i on Rea dex t e r n a 1 a d c 0 Da t = 0 Sc k = 1 No t i me 0 u t — 100 Wh i 1 e Sdo — 1 And Not i me No t i me out = Not i me out Wa i t ms 1 We nd Fo r 1 a = 0 T 0 23 Sc k = 0 Wa i t u s 80 Sh i ft Dat , Left , 1 Sc k = 1 1 f Sdo — 1 Then Dat — Dat + 1 En d 1 f Wa i t u s 80 Ne xt Sc k = 0 Wa i t u s 80 Sc k = 1 Wa i t u s 80 1 f No t i me out = 0 Then Re adex t er n a 1 a d c = 0 El s e Re adex t er n a 1 a d c = Dat En d 1 f End F u n c t i 0 n Long > 0 1 steps of five degrees) from the temperature gradient meter code with suitable modifications. This demonstration firmware com- pletely avoids the use of floating-point and of division operations. The result can be expressed in units of one ten-thousandth or one thousandth of a degree and transmitted as a four-byte integer. Note that the absolute accuracy of the temperature readings is not espe- cially high unless the sensor is suitably calibrated. The HTML user interface (Figure 3) allows switching between raw ADC values and readings expressed in thousandths or ten-thou- sandths of a degree. This gives a good demonstration of how a sensor’s physical quantity, units and scaling settings can be modi- elektor 12-2011 Personal Download for I © Elektor 39 MICROCONTROLLERS | Listing 2: Script within the HTML page j | var Set FI ag = f al se; j var Quant i t yToSet = 0; ! var Seal eToSet = 0; ! var Di spl ayScal e = 0; function ProcessPart(part) { if (( par t . Sender == 2) && ( pa r t . P a r 1 1 y p e == PARTTYPE_ VALUE4) ) { if ( par t . Channel == 0) {Text boxSet val ueScal ed( ' ADC' , part. Numval ue, Di spl ayScal e) ; }; } if ( Set FI ag==t r ue) { if (( par t . Sender == 2) && ( pa r t . P a r 1 1 y pe == PARTTYPE_SCALE) && ( p a r t . Ch a n n e I == 0)) { if ( Quant i t yToSet ==TEMPERATURE) {Text Set v a I u e ( ' u n i t ' , ' 0 C' ) ; } ; if ( Quant i t yToSet = = RA WV A L U E ) {TextSetval ue( ' uni t' , ' ADC-Val ue' ) ; }; Di spl ayScal e = Seal eToSet ; Set FI ag = false; } else { var parts = I ni t Par t s( ) ; parts = Set Seal e( par t s, 10, 2, 0, 0, Quant i t yToSet , 0, Seal eToSet ) ; SendPar t s ( parts, true); } } function SetSensorScal el ndi rect(quanti ty, scale) { Set FI ag = true; Quant i t yToSet = quantity; Seal eToSet = scale; fied. The command bytes to set a sensor to report values in ten-thousandths of a degree using channel O are (in decimal) 40, 193, 33 and -4. The JSBus Javascript library lets us avoid the need to calculate these bytes by hand. The commands shown below can be included within the HTML page, and they will gener- ate the appropriate ‘part’ and send it. var parts = I ni t Par t s( ) ; parts = Set Seal e( par t s, 10, 2, 0, 0, TEMPERATURE, 0, -4); SendPar t s ( parts, true); Reliable transmission I arranged for the above lines of code to be called when the corresponding button on the HTML form is clicked on, exactly as in the previous instalment of this series [6]. However, I discovered in testing that clicks did not always have the desired effect. Now the ‘OutCommand’ text box in the Elektor- Bus browser showed that the message data bytes were being generated correctly, and so it was probably a problem with the node firmware. My hunch was that that the mes- sage was not being correctly received by the sensor in the case where it was busy deal- ing with the external ADC. I noticed that 40 Personal Download for I © Elektor 12-2011 elektor MICROCONTROLLERS the transfer of commands was reliable if the variable i n t F r e e B u s T i me in the ElektorBus browser was reduced: strictly speaking in this application we do not need any ‘Free- BusPhase’ at all, although we might imple- ment the ability to control this from within Javascript code at a later date. Unfortu- nately, in the absence of a bus monitor or firmware debugging facilities I was unable to track down the source of this bug. How- ever, it does give us an opportunity to see how this kind of problem can be worked around. Listing 2 shows a solution. The buttons for changing the unit setting call a Javas- cript routine called SetSensorScal el ndi - r e c t ( ) , which simply sets a flag rather than directly sending the required command. The master repeatedly sends this command as long as the flag is set. The code to imple- ment this can be integrated into the routine ProcessPart ( part) , which is periodically called by theJSBus library whenever a read- ing arrives. The flag is cleared when an acknowledge- ment is received from the node. (The BASCOM firmware packs the four bytes required along with the reading in the reg- ularly-transmitted message.) Only then is the display of the selected unit updated on the HTML page. To display the decimal point properly in values shown in the text box we call the function TextboxSetval - u e S c a I e d ( ) , which is implemented in the new version of JSBus [5]. The download- able HTML file also now includes a little CSS [7] to make the user interface some- what prettier. A touch of ‘optimisation’ Further testing showed that after a few min- utes the display would lockup. Firing up the oscilloscope it transpired that bits were still zipping about on the bus, at least until I stopped the scheduler. Next I arranged to display all the bus bytes in a separate text box, which showed that the only messages being sent were ‘FreeBusMessages’ from the scheduler. It was not easy to track down the reason for this, as the scheduler is based on three processes running in parallel. The first is the scheduler loop itself, which inter- rogates the nodes one after another. The second is the routine S h o wMe s s a g e , which is executed in parallel when a sixteen-byte message arrives: if this message comes from the interrogated node then the next node in sequence can be processed. And the third adds a timer to the mix: if a bus partici- pant is not heard from for a certain period, the next node is processed anyway. I finally realised that I had made a schoolboy error. To indicate which node comes next in sequence I had allowed all routines direct access to the global variable i ntPol I e d No- de s C u r s o r , which points to the next node in the scheduling list. If, however, this vari- able is changed externally while the sched- uler loop is at work, the above subtle prob- lem can be triggered. I modified the code so that instead a flag bool Next Node was used to indicate when the scheduler should move on to the next node. The flag is inspected only at the start of the scheduler loop and otherwise does not affect the flow of the code. Success! The system was running reliably, and fortunately there was time to upload the corrected files to our website to accompany the previous instalment of this series. The improved ElektorBus browser can also be downloaded at [5], in the form ofVB.NET source code and as a .EXE file. Some more ideas I would have liked to implement further features, such as a display of temperature gradient including a filter with adjusta- ble parameters. That would have made a complete replacement for the processor board, display and potentiometers of Diet- mar Schroder’s original project. However, time caught up with me, and time will be even more limited in future after a slight problem with my USB-to-RS485 converter (see elsewhere in this edition). Interested readers should be able to implement vari- ous extensions to this project without too much difficulty, given a little expertise in C programming, the source code of the tem- perature gradient meter, and the Bus tools we have previously described. Incidentally, the ElektorBus is also capable of receiving messages from nodes. In prin- ciple it would only be possible to have two Setting the interval between readings In principle a single sensor could be re- motely controlled over the ElektorBus without using the scheduler. We simply tell the device how often to report a new reading, just as we would in a data log- ger application. BIT 7 6 5 4 3 2 1 0 0 0 SET 1 0 1 C2 Cl CO CHANNEL 1 1 1 0 0 0 0 0 0 INTERVAL VALUE 0 INTERVAL SCALE 1 BYTE Address Command First Second 110610 - 13 The figure shows the four-byte applica- tion protocol command. The interval value is encoded in seven bits. The cod- ing is as follows. Hex Dec Interval 04 4 1 ps 05 5 10 ps 06 6 100 ps 07 7 1 ms 08 8 10 ms 09 9 100 ms 0A 10 1 s 0B 11 10s OC 12 100s 10 16 1 minute 11 17 10 minutes 12 18 100 minutes 18 24 1 hour 19 25 10 hours 20 32 1 day 21 33 1 0 days 22 34 1 00 days 28 40 1 month 30 48 1 year 31 49 10 years elektor 12-2011 Personal Download for I © Elektor 41 MICROCONTROLLERS Checksums and reliabilit When designing a bus system it is almost impossible to pay too much attention to the problem of how to ensure messages are reli- ably transmitted under all conditions. In the previous instalment in this series we described two acknowledge mechanisms: one at the message level, chiefly designed to detect collisions occurring during the uncontrolled ‘free bus phase’; and one at the level of the application protocol, designed to cope with interference and other types of problem. The latter mechanism is even used when colli- sions cannot occur, as described in the main text. In both cases the receiver sends the received bytes back to the sender, with a simple flag bit discriminating between the acknowledge message and the original message. This approach seemed pretty safe to me, and so I postponed the implementation of a message CRC or checksum. Fortunately in the meantime many others have started to think about how to make use of the bus. Elektor reader Werner Koch came to the conclusion that the acknowledge mechanism was inadequate. The mechanism does allow for a message that is lost to be resent by the sender; but it can also happen that interference causes a receiver to see a phantom message which has not actually been sent. As a re- sult an actuator would generate an acknowledgement of this phan- tom message, from which the master can deduce that something has gone awry. However, the bad news is that the actuator might already have changed the state of a relay, with potentially unfortu- nate consequences. One solution to this problem is to have the actuator wait for a con- firmation of the command before switching the relay (a three-way handshake). An alternative is to add redundant information to each message: only when the checksum bits are correct will an actua- tor switch the relay. Using this approach it is much less likely that random interference will generate a valid message than if there had been no checksum. Next we have the question of whether to use a 1 6 bit CRC or a sim- pler sum. My suggestion of banning the value AA hex from appearing in the last two bytes, which are allocated for the checksum, met with vehement opposition from some participants on the mailing list, although the advantage it brings of allowing simpler synchronisa- tion in unarguable. The alternative proposal was for a 1 6 bit CRC and a more sophisticated approach to synchronisation. For example, the CRC itself can be used to determine when a message is complete. Finally I made the compromise suggestion of allowing both possibili- ties. The distinction is indicated by a bit in the mode byte, whose layout is now as follows. Bit 1 0 7 no ID bytes, payload from byte 2 ID bytes from byte 2 6 bytes 2 and 3 are ID bytes bytes 2 to 5 are ID bytes 5 no CRC/checksum bytes E and F form a 1 6 bit CRC/checksum 4 advanced synchronisation AA hex does not appear from byte 2 onwards 3 last ID byte is fragment number all ID bytes used for addressing 2 top six bits give bus segment no segment address 1 acknowledge message original message 0 acknowledge message expected not expected At least one of the checking functions will need to be implemented in the AVR microcontroller C library that is currently in development. A little later I had the idea of adding redundancy within the data pay- load bytes, for example, an important two- or four-byte command could be repeated within a single message, respectively four times or twice. With non-periodic interference the probability of a valid message of this type arising is vanishingly small. nodes talking to one another under such a scheme, but RS485 in combination with our protocols nevertheless form a good basis for the remote control of sensor equipment. With the sensor no longer being regularly interrogated by the scheduler it needs to be possible to instruct it to emit readings at specified intervals. The text box shows how such an ‘interval command’ can be encoded using the application protocol. There is plenty more in the pipeline: in the next instalment we will look at the prom- ised connection to an Android smartphone. (110610) What do you think? Feel free to write to us with your opinions, ideas and applications. [1] www.elektor.com/ 1 101 51 [2] www.elektor.com/ 1 10258 [3] http://ww1 .microchip.com/downloads/ en/DeviceDoc/21 950e.pdf [4] www.elektor.com/ 1 10428 [5] www.elektor. com/1 10610 [6] www.elektor. com/1 10517 [7] http://en.wikipedia.org/wiki/ Cascading_Style_Sheets 42 Personal Download for I © Elektor 12-2011 elektor Work in progress The Elektor Labs generally remain a closed fortress, with access to Elektor House limited to those who happen visit the castle during one of the annual Dutch Open Monument Days. Whatever happens in the lab usually remains behind closed doors. That, of course, does not mean that there is nothing interesting going on. So here’s a first, small ‘peep show’ of two projects that are being worked on in the lab at the moment. First the new LCR Meter. Designer Raymond Vermeulen and colleague Jan Visser are The second photo series shows the efforts of Head of Design Chris Vossen working on his version of a 3D printer. The publication date remains a secret for now, but for more information about this exciting project and the latest state of affairs you can take a look at www.techthefuture.com/3D-printer. elektor 12-2011 Personal Download for I © Elektor 43 E-LABs INSIDE E-LABs INSIDE LED Exorcism Ghostly goings-on (2) By Dr. Thomas Scherer (Germany) & Elektor readers In the September 2011 issue I recounted how I had witnessed the demise of two different LEDs both of which inexplicably began to flash on and off before they died. In the absence of any reasonable explana- tion we blamed it on an LED spirit. The ink was hardly dry on the Sep- tember edition before your replies started coming in, some interest- ing, some informed, some tongue in cheek and some, well, bizarre. Just to recap before we start with your replies: a standard low the LED is cool, but loses contact when the LED heats up, then the power LED used in a recharging circuit of an electric corkscrew LED will blink until the break becomes permanent See: http://www. and a high powered display LED both showed the same behav- emsnow.com/cnt/files/White Papers/DFRLEDFailures.pdf. ,, iour when they were about to give up the ghost; they started Craig was not the only one to point the finger of suspicion at the flashing. In both cases the circuitry around the LED couldn’t wire bond contact point on the LED chip as the cause of the inter- be much simpler, a series resistor to limit current and an AC mittent behaviour. One reader even went on to suggest a fix... power adapter to supply, ermm, current. It’s no wonder engi- neers were rubbing their eyes in disbelief. We couldn’t explain Karl-Heinz Ziener from Germany: the phenomenon; the editors agreed we should draw on the “I would guess that a hairline crack has developed in the bonding combined wisdom of our readership to help lay the ghost: wire to the LED chip. When power is first connected the LED is cold and the two parts either side of the crack are touching, current Wolfgang Bredow from Lilienthal, Germany wrote: flows and the LED lights up. The LED warms up, expands and breaks “ When I read your article in the September edition it immediately the contact. Now with no current flowing the LED cools down, con- put me in mind of an experiment I carried out in the late 7 970s. At tracts and makes contact again, so the cycle repeats, that time I was using a curve tracer to record the operating charac- A ( not entirely sincere) repair bodge suggestion is shown in Fig- teristics of electrical components. On a whim I decided to over-drive ure 2: Connect a capacitor in parallel across the LED. When the an LED to record its characteristics as it failed. The resulting curve LED goes out the capacitor will charge to full battery voltage. As the can be seen in Figure 1. LED cools down contact is made again and the capacitor releases The curve shows the victim (a green LED) being driven way beyond its stored charge through the LED, permanently welding the two is recommended safe operating area. With the supply approaching parts either side of the crack together, job done! “ 7 V the LED was drawing around 500 mA when the emitted light changed to dark red. Next it began to flash (aha!!!), the electrome- chanical curve tracer now started to go a little crazy trying to keep up with the step changes in the LED's characteristics. The dashed line indicates where it failed in this task! ” Mr Bredow assured us that this was the only time ever he had been guilty of deliberately causing the demise of an innocent component... Craig Hyatt writes from a .com email address: “ The answer Is pretty simple. The LED is made of a variety of materials with different expansion coefficients. When the LED cycles on and off, the materials expand and contract at different rates, and this causes mechanical stress that can cause a bond wire to Figure 2. Heal Thyself: Charge stored in the capacitor should be separate from the substrate. If the bond wire makes contact when sufficient to weld the wire bond back on the chip. TU L * 4 Figure 1. Original curve trace of a failing LED from the 1970s. 44 Personal Download for I © Elektor 12-2011 elektor For this to have any chance of working the LED must still be partly working i.e. flashing but not completely dead. ;-) Gwyn Evans in Munich got in touch via his smartphone: Obviously the reason for your observations is that the 9 VDC isn’t quite DC, it's half rectified AC and what you are observing is a localized breakdown in the space-time continuum, resulting in a 50 times or so reduction in perceive time. This is nothing to worry about, and due to the induced effect resulting from Lorentz Con- traction your flat will appear bigger too. Alternatively the result is probably due to a heating effect. As an LED ages it can become more sensitive to ambient temperature. The LEDs temperature rises causing the LED to fail. The LED then cools allowing it to recover and start working again. Right, OK, glad we got that one sorted out then... Gwyn went on: “It is possible to extend the life of an LED by pulsing it; usually 1 kHz is sufficients I’m wondering now if I should suggest to the utility companies that they derive the powerline frequency directly from the out- put of wind turbines... Hubert Maiwald from Neutraubling, Germany: “ The majority of LEDs consist of a single die cemented to the lead frame with silver-loaded conductive adhesive forming one electrical connec- tion and a wire bond forming the other contact on top of the die. This adhesive is the weak point; it can be damaged by excessive solder temperature during installation or dissipation of too much power in operation. At high temperature the adhesive starts to give offgas, generating voids in the interface between the die and lead frame. This damage degrades the thermal path and reduces the LED’s power handling abilities further, leading to more localised adhesive gassing and more voids. As die temperature increases the emitted light wavelength shifts, becoming longer. Eventually there is very little contact area remaining and the LED mould material becomes locally heated so that expansion of the materials exerts pressure on the die and interrupts the current flow. With no current flowing the die temperature falls and contraction pulls it back to its original position, re-establishing contact. The die now heats up again and the process repeats... The thermal time constant of this oscillation is in the range 0. 1 to 1 0 s, depending on current and power dissipated. This flashing mech- anism is effectively the same as the old mechanical bi-metal relays. Incidentally of all the ways an LED can be destroyed this mechanism is not particularly probable. For it to occur it must be assumed that the diode junction is not damaged and also that the bond wire is still intact. More often than not the die bond adhesive just becomes irre- versibly damaged and the LED simply goes open-circuit. “ Seems logical? So, dear reader, did any of that sound like a plausible explana- tion? The consensus suggests a link to thermal effects but that is the fascination with electronics there are always puzzles to solve, sometimes in the most unexpected places. (110668) Pins to length By Thijs Beckers (Elektor Netherlands Editor) In a previous E-LABs Inside instalment we already mentioned placing a piece of experimenter’s board between an LCD and a (mother)board, with the objective of making the display eas- ier to remove and without damaging it. This was targeted spe- cifically at the more fragile displays, such as the DOGM-series made by Electronic Assemblies. Now there is even a second trick for this experimenter’s board. The DOGM displays mentioned above ‘stand quite tall on their legs’ (have quite long connecting pins). This length is neces- sary when they will be provided with a backlight that — and the name gives it away already — is fitted behind the display. But when this backlight is omitted, it is often much better that the display is mounted closer to the PCB, so that, for example, the entire assembly is more compact when building into an enclo- sure. When there are sockets on the PCB for connecting the dis- play, then the only option for fitting the display closer to the PCB is to shorten all the pins. It is then desirable that all the pins have the same length. And here is where our experimenter’s board comes in handy again: insert the pins of the display as far as they go into the board and cut off the part that sticks through. The length of the pin that remains is then perfect for plugging into a header. And all the pins have exactly the same length, so that the display cannot not rock in its socket. Do you have any handy tips for us? Mail them to editor@elektor.com. (110664) elektor 12-2011 Personal Download for I © Elektor 45 E-LABs INSIDE After weeks of devotion to a project it has finally reached that stage: you order the circuit board, the components and when everything has arrived you start the assembly. Then it turns out that the footprint for one of your ICs is not right. What now? In my case the culprit was a DS2003 relay driver. Since 2009 the version in the TSSOP-package is (apparently...) no longer made. Only the SOIC version still runs off the production line. It is nice that we now know that, but too late! Instead of ordering a new circuit board with the footprint cor- rected, which takes another few weeks (faster is possible, but gets a bit expensive) and wasting the time and effort that you have invested in that part of the board you have built already, it is time to improvise. The solution in this case (see photo) is ‘quick’ but ‘very dirty’. Fortunately this 1C is only used to switch a few relays. In appli- cations where the signal quality is important, this method is not so suitable. What I have done: First I soldered a piece of very thin enam- elled wire to each of the little legs. Then I cut all the wires to the same length and bent the ends over. The reason that the wires are this long, is not only so that you can get a soldering iron in between, but also because otherwise the other end of the wire is likely to unsolder because of heat conduction when you are soldering this end. If you have a steady hand then the soldering is not that diffi- cult. For people with a slightly less steady hand, such as me, this becomes rather tricky, but I was still successful in the end. It’s a good idea to fix the 1C in place first and to strip the wires of enamel where they will be soldered. But the best solution of all is just to use the correct footprint on your circuit board... (110692-I) ItsyBitsy Spider... By Raymond Vermeulen (Elektor Labs) Smelly bus By Thijs Beckers (Elektor Netherlands Editor) While quietly working on the article about the use of cheap tablets in embed- ded electronics (see elsewhere in this edition) I suddenly noticed that typical smell of burnt electronics. Following my nose (and as a member of the First Aid team I’m of course more or less obliged to act on the smell of fire), I arrived in the adjoining room with the German editorial staff, where colleague jens Nickel was working on the Elektor Bus project. Was, because it appeared that the tantalum elec- trolytic capacitor on the USB/RS485 converter, which is part of the Elektor Bus system [1 ], had given up (see photo). Jens was already back in the lab with the faulty board, but an odour like that of burnt bakelite was still in the air. We were of course not at all happy with this. What if this could happen to all the boards that have already been sold? Was this a manufacturing fault or are the tantalum capacitors mounted the wrong way around? Do we have to recall all those boards out there? Is this our fault or that of the assembler? Who will go ballistic? Who will foot the bill? Checking the stock that was still in the warehouse should give a definitive answer. It was already towards the end of the after- noon, so this would have to wait till tomorrow, because our ware- house is in an industrial area about 6 miles from Elektor House. v * / / '1*. In short, the next day we immedi- ately checked whether the remaining stock (and therefore also the boards already supplied) were built correctly or whether we had a big problem. What emerged: We could breathe a sigh of relief, because the boards we pulled out of stock were built correctly. What we noticed though, is that different components were used on the boards we have in stock. And then it dawned on us... The modules that Jens was using were early prototypes built in the lab, hence the different components compared to the produc- tion version. Probably whoever assembled them didn’t realise that with tantalum capacitors the + is marked (with electrolytic capacitors the - is usually marked). So this fortunately ended in a fizzle (well, more like smoker). So here you have one example of all the kinds of things you can come across during the development of a project. It is cer- tainly not likely to be boring! What surprised us quite a bit how- ever, is how long this tantalum capacitor was able to hang on while being reverse polarised. There was nothing unusual to be noticed about the functionality of the circuit. (110693-I) 46 Personal Download for I © Elektor 12-2011 elektor Do your electronics speak to you? Are the words audio ' , "vacuum tubes" and "speaker technology" music to your ears? Then you should be reading audioXpress! Recently acquired by The Elektor Group, audioXpress has been providing engineers with incredible audio insight, inspiration and design ideas for over a decade. If you're an audio enthusiast who enjoys speaker building and amp design, or if you're interested in learning about tubes, driver testing, and vintage audio, then or a combination of both for maximum accessibility. Subscribe to audioXpress at www.cc-webshop.com today! Audi amotGL Lou ds pea X% / C?i h ■ I batti’i than ever; this ft & "Sn "Bj- • i : -- ‘-vi ■ y- hirg you noca to ^ rtmwmdvsqnv. Tb * rm \\\ V%, -nun i o^ wduSts ki pf>m anafr £* * i h;,p!i^ on autf speaker vOlcinq ■ e&l ug and c«osicvsr changes. a ■i Li^fi mw 1 Stipe complex yijlh -ftrifuinrw; oviw ICO .t-riili: ona fg j ii sal of oudsooakor dosiun « A 39 £ vuluot What will you find in audioXpress ? • In-depth interviews with audio industry luminaries • Recurring columns by top experts on speaker building, driver testing, and amp construction Accessible engineering articles presenting inventive, real-world audio electronics applications and projects Thorough and honest reviews about products that will bring your audio experiences to new levels Yours today for just & Jhis honk, and snai |eurprodui Cl audioXpress is the magazine for you! HOME & GARDEN Pick-proof Code Lock Using 128-bit AES encryption By Elbert Jan van Veldhuizen (The Netherlands) How secure is the remote control of your car or other valuable vehicle? This project shows you how to use a couple of ordinary microcontrollers together with a transmitter and a receiver to implement an IR remote control system that uses a secure code with 128-bit AES encryption and bidirectional IR data communication. We’re all familiar with remotely controlled door lock systems in cars. The remote con- trol transmits a code, and if the receiver of the lock system recognises the right code, it unlocks the doors. A drawback of systems of this sort is that people with malicious inten- tions who eavesdrop on the code transmis- sion can effectively pick the lock, since they can transmit the code at any desired time to unlock the car. A much more secure method is the chal- lenge-response handshake authentication protocol, which is used for many forms of Internet banking. With this approach the lock transmits a specific code and the remote control must perform a defined computation using this code. The result is then send back to the lock. The lock remains locked unless the right computation has been performed. Eavesdropping on the communication between the lock and the remote control is useless in this situation, because the next time the lock will send a different code for the computation. As long as anyone with malicious intentions does not know the computation, the lock cannot be picked. Here it’s important to choose a good com- putation method. Encryption is very suit- able for this. Encryption uses a key to con- vert data into new data, which is exactly the type of computation that we need for the remote control system. Encryption algorithm What makes an encryption algorithm good? Encryption is a process in which data to be encrypted (in) is converted into encrypted data (out) with the aid of a key, which is something like a password. • The encryption algorithm implements the function out = f (in, key). The inverse function in = f tnv (out, key) also exists, but the function key = f key (/n, out) does not exist. • For each value of in there is a unique value of out. In other words, there are not multiple values of in that generate the same value of out. • This also applies to the key: two different keys produce two unique encrypted out values. The first condition ensures that if persons with malicious intentions learn the values of both in and out by eavesdropping, they will not be able to derive the key by using a function f key . The only way to determine the key is to use what is called a brute force attack, which consists of trying all possi- ble keys in the encryption function f. This requires spending so much time search- ing for the key that trying all possible val- ues takes too long. Powerful computers can try all possible values of a 64-bit key in approximately one day. With a 1 28-bit key, this would take more the lifetime of the uni- verse, which is long enough to be secure. We chose the AES protocol for the encryp- tion algorithm. This encryption algorithm :( IC2 * 17_ 18_ 1_ 2 _ 4 9_ 10 11 GP1UX31QS 1 ft 14 VDD RAO RA7 RA1 RA2 |C1 RA3 RB2 RA5 RA4 RBO RB3 RA6 RB4 PIC16(L)F1827 RB5 RB6 18-Pin PDIP RBI RB7 VSS 16 15 12 13 1V8...5V -© Lock . 330R 330R w 330R o o J1 o o J2 IR 110358 - 11 Figure 1 . Schematic diagram of the base station. 48 Personal Download for I © Elektor 12-2011 elektor HOME & GARDEN u is used in devices such as WiFi routers to prevent eavesdropping on data traffic and breaking into the network. This algorithm has not been cracked up to now. In other words, nobody has found a function f key or some other way to determine the right key with fewer attempts. The AES algorithm needs a lot of resources compared to what is customary in the microcontroller realm. Over 240 bytes of RAM are necessary for the computations, the code consists of approximately 1 500 instructions, and execution of the compu- tation takes approximately 30,000 instruc- tion cycles. Furthermore, tables and arrays are used extensively. The new PIC1 6F1 827 enhanced microcon- troller from Microchip is a device that ful- fils these requirements. It has 4096 words of code memory and 396 bytes of RAM. It can also run at up to 32 MHz using its inter- nal clock, and the microcontroller has a new instruction set called “enhanced mid range” that makes working with arrays a good deal easier. Although the RAM is split into individual blocks of 80 bytes each, the enhanced instruction set allows these indi- vidual blocks to be viewed as a single large block (linear mode), which facilitates access to tables. The circuit Aside from the microcontrollers, only a few components are needed to implement prac- tical circuits (transmitter and receiver) that utilise this encryption method. Figure 1 shows the circuit diagram of the base sta- tion (the lock), while Figure 2 shows the circuit diagram of the remote control. They communicate using infrared LEDs, in the same was as remote controls for television sets. LED D1 is used for transmission, while IC2 (a standard IR module from Sharp with an operating frequency of 36 kHZ) is used for reception. The switches for operating the devices and configuring the parameters are connected directly to the I/O ports. The ‘weak pull-up’ capability of the microcon- troller make resistors unnecessary here. A keypad for entering a PIN code can also be connected to the remote control. A matrix keypad should be used for this purpose. The remote control operates directly from two AAA batteries, but a lithium button cell can also be used. The base station can be powered from a mains adapter. The usable supply voltage range is 1 .8 to 5 V. Note that the maximum rated voltage of the LF ver- sion of the microcontroller is 3.3 V. Operation A communication session starts when the remote control sends the code ‘A6h’. The base station then generates a random 1 28- bit number. A random number is better than a predictable number because the lock can potentially be picked by ‘code phishing’ if a predictable number is used. The encryp- tion algorithm is also an excellent random number generator (see inset), using an input value derived from a counter. The encryption algorithm converts the input value into a random number (using a sepa- l di 2 3 cf? * 0 # r^4 7 7 J ~s7 77 r°4r4r°4 o7 7 7 :( IC2 * GP1UX31QS 17 18 10 11 14 VDD RAO RA7 RA1 RA2 IC1 RA3 RB2 RA5 RA4 RBO RB3 RA6 RB4 PIC16(L)F1827 RB5 RB6 18-Pin PDIP RBI RB7 VSS lOOn + S BT1 3V BZ 16 W- 330R 330R 15 ft 330R 12 O o- J1 13 o o- J2 IR 110358 - 12 Figure 2. Schematic diagram of the remote control. elektor 12-2011 Personal Download for I © Elektor 49 HOME & GARDEN Usinq encryption for random number qeneration Linear feedback shift registers are commonly used to generate random numbers. Their output bit streams have the statistical characteristics of randomness, but the bit streams are predictable. As the algorithm is known, the state of the shift register can be reproduced after a specific data set has been read in. This allows the values to be predicted. A good encryption algorithm also has the statistical characteristics of randomness. Due to the unique mapping from input to output, the ratio of ones and zeros will be exactly 50%. However, the bit stream is totally unpredictable because the key is not known. The pat- tern repeats itself (or the key can be determined by calculation) only after the entire bit stream has been generated (in this case 2 131 bits). If this bit stream is transmitted at a rate of 1 Gbit/s, it will take a trillion times as long as the lifetime of the universe to transmit the entire bit stream. 0,5 ms 0,5 ms 0,5 ms Figure 3. A variant of the Sharp protocol is used to transmit data using IR pulses. rate key). The countervalue is saved in flash memory so that unique numbers can still be generated after a power interruption. As the flash memory has a maximum rated life of 1 00,000 write operations, the value is saved to memory only once every 65,536 times, and a different memory location is used each time. In the unlikely event that the maximum number of write operations is reached (after 13 million power inter- ruptions or 900 million transactions), an emergency procedure is invoked to ensure that the user is not left standing in front of a locked door. This procedure requires the user to press the remote control button 1 6 times in a row. After this the random num- ber is derived from the timing of the code transmission by the remote control. IR communication The remote control first reads the 128-bit number. Standard modules can only han- dle a maximum duty cycle of 30% with such long transmissions. The commonly used Manchester coding method (used in the RC5 protocol, for example) has a duty cycle of 50%. For this reason, a variant of the Sharp protocol is used here. The ‘1’ and ‘0’ values are defined by the length of the break between two pulses. A break of 0.67 ms is a ‘O’, while a break of 1 .33 ms is a ‘1 ’. The pulse width is 0.5 ms, and the end of the pulse train is indicated by a break lasting longer than 2 ms (see Figure 3). The tim- ing tolerances are loose and the algorithm is self-synchronising, so the accuracy of the clock oscillator does not need to be espe- cially high. This protocol can also be used to transmit 8-bit words (or words of any desired length) as easily as 1 28-bit words, thanks to the use of a stop bit. Both the remote control and the base sta- tion apply encryption to the 128-bit ran- dom number, using the same key. The remote control sends the encrypted 128- bit number back to the base station. The base station compares the received num- ber to the one it computed itself. If they match, the base station opens the lock. Depending on the setting of jumper 1 , the base station may return a code indicating a match (OxAB) or no match (0xB5). In theory, returning a result code makes it possible to pick the lock using an automated method, although this is rather unlikely in practice. Nevertheless, if you consider the risk too great you can fit jumper 1 to prevent trans- mission of result codes. Jumper 1 on the remote control board has a similar function: the remote control emits a low beep tone if the code is wrong or the base station does not send a response. Fit- ting the jumper disables this beep. Generating the key Jumper 2 enables key programming. This requires switching the base station off and on again. If you now press SI 32 times in a row, two keys will be generated. The red LED goes dark briefly when this has been completed. The timing of the button presses yields totally random numbers due to the speed of the counter. These numbers are stored in the EEPROM. After this the remote control must be programmed with the same key. For this purpose, jumper 2 on the remote control board must also be fitted. After this the remote control sends the code ‘OxAD’ (you may have to press the # button or enter the PIN code first). The base station then sends the key twice. The remote control checks that the two trans- mitted numbers are the same and then saves the key in the EEPROM (the green LED lights up and a beep sounds). This can be repeated with each remote control unit. Remove the jumpers and switch the units off to restore the base station and the remote control to normal operation. For security reasons, the key can only be sent to the remote control immediately after it has been generated in the base sta- tion. This prevents the ‘clandestine’ pro- gramming of another remote control at a later time. This can only be done by generat- ing a new key, with the result that the origi- nal remote control will no longer work, so the action will always be detected. In addition, data protection of the EEPROM and the program memory is enabled in both the base station and the remote con- trol. This means that the key can never be read out. Furthermore, the key is not known when it is generated because the user sim- ply presses the button, without knowing the value of the key that is generated in this manner. The key is thus stored securely in the microcontroller. However, there is a risk: when the base sta- tion and the remote control are both brand new (not yet programmed), the system is already operational because both EEPROMs are filled with ‘OxFF’, so both microcon- trollers have the same key. A user might think that there is no need to program the key, and a person with malicious inten- 50 Personal Download for I © Elektor 12-2011 elektor HOME & GARDEN tions could use the key ‘FF...FF’ to try to open locks of this sort. To prevent this, the remote control unit (but not the base sta- tion) always increments the key read from the EEPROM, so that the keys are not the same. When the key is programmed the value is decremented, with the ultimate result that the right key is used. PIN code The remote control is equipped with a key- pad for entering a PIN code. The PIN code is disabled by default. If you do not wish to use a PIN code, simply connect a pushbut- ton between RA3 and RBO (this corresponds to the # key on the keypad). The PIN code can be set by fitting jumper 2 and pressing the * key (or entering the current PIN code if it has already been set) and then entering the new PIN code twice in a row. To disable the PIN code, a new PIN code must be set with a value of ####or ****. If a PIN code has been set, it must be entered when the remote control is acti- vated. If the wrong PIN code is entered three times, the remote control is blocked by erasing the key. After this the remote control must be resynchronised with the base station by generating and program- ming a new key. On/off You may have noticed that the remote control does not have a power switch. The ‘problem’ here is that the power consump- tion of the latest PIC microcontrollers is so low that the circuit does not switch off immediately, due to energy storage in the decoupling capacitor. For this reason, we chose a different solution. After five sec- onds, the remote control enters sleep mode, and in this mode it consumes virtu- ally zero current (much less than the self- discharge rate of the batteries). The # key generates an interrupt and is therefore effectively the ‘On’ switch. The software The author converted existing open source C++ code for the AES routines (the source is stated in the code) into assembly lan- guage because the code was not compiled properly by the C compilers for PIC micro- controllers. The program code for the base Figure 4. Both circuits can easily be built on pieces of prototyping board. station and the remote control is located in a single file because many routines are the same for both devices. The correct hex file can be generated by placing ‘#define remote’ or ‘#define homestation’ at the start of the code. Naturally, the code can also be modified. The IR LED and the IR sensor are connected to the serial port (TX/RX). Other devices, such as a GSM modem, could also be con- nected to this port. This would allow a lock (or other device) to be actuated securely anywhere in the world by sending text messages. The user interface Using the devices is simple after the key has been programmed as described above. • Press the # key on the remote control to activate it. If the LEDs blink rapidly, the PIN code must be entered. If an incor- rect PIN code is entered three times, the red LED blinks constantly and the remote control must be resynchronised. • Three different beep/visual results are possible at this point: • High beep tone / green LED - low beep tone / red LED: base station not responding (may be too far away or not switched on) Figure 5. The IR LED and the IR receiver are located next to each other, facing in the same direction. • High beep tone / green LED - low beep tone / green LED: wrong key; lock remains locked (or the remote control may be blocked) • High beep tone / green LED - high beep tone / green LED - high beep tone / green LED: lock opened • If jumper 2 is fitted, only the sequence 'high beep tone / green LED - high beep tone / green LED' occurs in the latter two situations. In this case opening of the lock (or otherwise) is the only indication of whether the right key was used. • The # key can be pressed again within 5 seconds to send another unlock request without requiring new entry of the PIN code. • The remote control switches off auto- matically after 5 seconds without user activity. (110358) Note: If you manage to discover a way to reveal the code of this code lock, please let the editors know: editor@elektor.com elektor 12-2011 Personal Download for I © Elektor 51 Audio DSP Course (6) Part 6: Digital signal generator An audio signal generator for lab use needs to have two basic features. First, it must be able DSP COURSE to generate low-distortion sine waves with an adjustable frequency and amplitude to allow measurement of the frequency response and distortion factors of audio equipment; and second, it must be able to generate low-pass and band-pass noise signals to help characterise electro-acoustic transducers. A DSP makes the ideal basis for such a device. The DSP board we have described in this series of articles is used here as the central component in a lab-grade signal generator, generating high-quality output in both digital and analogue forms. By Alexander Potchinkov (Germany) An audio signal generator is a fundamental item of test equipment in any small audio or electro-acoustics laboratory. For the utmost in flexibility the generator should ideally be able to produce output in ana- logue or digital form and have two out- put channels, allowing test signals to be fed simultaneously to analogue and digi- tal devices. It is useful to be able to carry out measurements both in the lab, such as on one’s homebrew loudspeakers, and on devices when installed at their final place of use, for example to measure the frequency response of a speaker system when installed at a large event. We also want to be able to measure both linear and non-linear distor- tions in equipment. To this end the audio signal generator described in this article provides test sig- nals of sufficiently high quality to ensure that such measurements can be made accu- rately. If the top end of the frequency range required is not unreasonably high (in most cases for audio measurements the audi- ble range from 20 Hz to 20 kHz is plenty) then we can realise the generator using the DSP. The result is an unbeatable combina- tion of low cost and high signal quality: for sine wave signals this means low distor- tion and low noise, and for noise signals it means that the characteristics of the noise filter are tightly controlled. Analogue signal generators (under comparable conditions) cannot match the performance of our dig- ital system. To turn the DSP board into a piece of test equipment we need to add a user interface to allow the entry of various settings and, if wanted, an extra analogue output stage. In this article we will describe the signal processing and the DSP program that implements it, closing with some notes on how a user interface can be constructed. Signal processing in the digital audio generator Figure 1 shows the block diagram of the signal processing involved in one of the two identical channels in the system (which we shall call the ‘left’ and ‘right’ channels), fea- turing two basic signal sources. One is a sine wave generator with adjustable frequency and the other is a white noise generator. Following the noise generator is a bank of 42 spectrum-shaping filters with a switch to select between them. Then there is a signal source selection switch and an attenua- tor. Depending on the switch settings and the selected filter the system can produce either a sine wave or filtered noise at its output. The two channels are independ- ent of one another, allowing the simultane- ous generation of a sine wave and (filtered) noise signals. The signal processing chain shown in Fig- ure 1 requires a total of five parameter val- ues: the phase increment d4>, which sets the frequency of the sine wave, the index F| of the noise filter (regarding this index as a switch setting), the position of signal source selection switch S 1} the attenua- tion factor a and the noise signal amplifica- tion factor ‘Gain’, which can be set in steps of 6 dB (that is, each step corresponding to a doubling in output amplitude). Using the parameters a and Gain in combination allows any desired gain value between the 6 dB steps to be obtained. Because there are two independent channels the DSP code will need two separate areas each storing a set of five parameters. We will now describe the three main blocks in the signal processing chain in turn: the sine wave generator, the noise generator and the digital noise spectrum filter. Sine wave generator There are two main approaches to generat- ing a digital sine wave of the form 52 Personal Download for I © Elektor 12-2011 elektor DSP COURSE x(n) = a sin (2nnf s lf T ), n = 0 , 1 ,... where f T is the sample rate, f s = 2 f s /f T . If the sample rate f T is 48 kHz and we want to generate a sine wave with a frequency f s of 3 kHz, then the increment will be d4> = from memory using the processor’s 48-bit move instructions. The frequency stability of our oscillator is determined by that of the master crystal oscillator on the DSP board and should easily be enough for any audio application. Noise generator For the noise generator there are again sev- eral implementation options. We have gone for the most straightforward, using a shift register with feedback. In this case, how- ever, ‘straightforward’ does not equate to ‘of poor quality’. The shift register approach has been used for a long time in construct- ing analogue noise generators with the help of a couple of digital logic ICs. If you take a elektor 12-2011 Personal Download for I © Elektor 53 DSP COURSE Table 1: Filter selection indices Filter index Filter 0 White noise (no spectrum shaping) 1 Pink noise filter 2 One-third-octave filter, centre frequency f m = 25 Hz ... ... 31 One-third-octave filter, centre frequency f m = 20 kHz 32 One-octave filter, centre frequency f m = 31 .5 Hz ... ... 41 One-octave filter, centre frequency f m = 1 6 kHz Table 2: Cain points of one-third-octave and one-octave filters with centre frequency f m = 1 kHz One-third-octave One octave Gain left right left right -3dB 895 Hz 1117 Hz 718 Hz 1393 Hz -20 dB 790 Hz 1266 Hz 509 Hz 1958 Hz -40 dB 611 Hz 1636 Hz 291 Hz 3385 Hz -60 dB 385 Hz 2581 Hz 145 Hz 6507 Hz Table 3: Program parameters and valid ranges Parameter Range* Data type Word length Alignment SL, SR [0,1] Integer 24 right-aligned Fi L, Fi R [0,1 41] Integer 24 right-aligned Dphi L, Dphi R (0,1) Fractional 48 left-aligned A 1 p h a L , Al p h a R (0,1) Fractional 24 left-aligned Ga i n L , Gai nR [0,1,.. .,6] Integer 24 right-aligned * Square brackets indicate that the range interval is ‘closed’, in other words, that the limiting values are included in tne range. Round brackets indicate an ‘open’ interval, where the limiting values are not included. Table 4: Default parameter values Program parameters (left channel) Program parameters (right channel) Parameter name Default value Parameter name Default value Dphi L 0.041666667 Dphi R 0.041666667 Fi L 18 Fi R 18 SL 0 SR 1 Al p h a L 0.5 Al p h a R 0.5 Ga i n L 0 Gai nR 1 Table 5: Program files for the audio signal generator Audi oGen. asm Main program Ko c z _ S i n Co ef . t a b Sine wave polynomial coefficients El ektorFi 1 ter. tab Digital filter coefficients s r c 4 3 9 2 . tab Byte sequence for configuring the SRC i v t . asm Interrupt vector table entries for the audio interrupts es ai 4 r 2 1 . asm Audio interrupt service routine: four input channels, two output channels mi o e q u . asm Handy names for the DSP I/O addresses look at the DSP code, you will see that the software realisation is very simple indeed. The noise output is actually a periodic signal (or ‘pseudo-noise’): in one period of the sig- nal the shift register passes through every allowable state. Only one state (the register containing all zeros) is not allowable: if the shift register does get into this state it can never leave it. To give a concrete example, if the shift reg- ister consists of four flip-flops then of the sixteen possible states 1 5 =2 4 -1 are allow- able, corresponding to the numbers from 1 to 1 5. We use a shift register comprising 24 flip-flops, giving a total period of around six minutes at a sample rate of 48 kHz. This is long enough for any audio application. The two generators have different feedback combinations which ensures that the two outputs are for practical purposes uncor- related and statistically independent: this is important when making two-channel measurements. Again we put emphasis on the quality of the signal processing in this project. Filters The filters are used to shape the spectrum of the noise. The indices of the digital filters within the bank of 42 are given in Table 1 and the filters themselves are as follows. • A dummy filter for white noise. • A pink noise low-pass filter, which gener- ates pink noise from white noise. Loud- speaker experts among our readers will know that using pink noise is important for protecting sensitive tweeters from overheating, and that when testing loudspeakers using one-third-octave analysis bands a pink noise input should give a uniform output. • Thirty one-third-octave band-pass filters to generate noise within bands one third of an octave wide with nominal centre frequencies at 25 Hz, 31.5 Hz, 40 Hz, 50 Hz, 63 Hz, 80 Hz, 1 00 Hz, 1 25 Hz, 1 60 Hz, 200 Hz, 250 Hz, 31 5 Hz, 400 Hz, 500 Hz, 630 Hz, 800 Hz, 1 000 Hz, 1 250 Hz, 1 600 Hz, 2000 Hz, 2500 Hz, 3150 Hz, 4000 Hz, 5000 Hz, 6300 Hz, 54 Personal Download for I © Elektor 12-2011 elektor DSP COURSE Figure 2. Normalised frequency responses of the one-third- Figure 3. Spectrum of the 1 kHz sine wave oscillator output, octave and one-octave filters, in decibels. 8000 Hz, 1 0000 Hz, 1 2500 Hz, 1 6000 Hz and 20000 Hz: these values are as speci- fied in BS (DIN) EN 61 260. • Ten one-octave band-pass filters to gen- erate noise within octave-wide bands with nominal centre frequencies at 31.5 Hz, 63 Hz, 1 25 Hz, 250 Hz, 500 Hz, 1 000 Hz, 2000 Hz, 4000 Hz, 8000 Hz and 1 6000 Hz, again in accordance with BS (DIN) EN 61 260. By way of an example Figure 2 shows the frequency response of a one-third-octave and a one-octave filter with normalised cen- tre frequency. Table 2 shows various points on the response curve of the two filter types when centred in the middle of the audible range at 1 kHz, giving the frequencies at which certain levels of attenuation occur. The 3 dB points of the filter are highlighted in the table. Since the filters are implemented digi- tally and we are using sample rate of only 48 kHz the centre frequencies of the filters at higher frequencies tend to deviate from their ideal values. The reason for this is that signals at half the sample rate, or 24 kHz, undergo infinite attenuation: we in effect have an additional null in the frequency response at this frequency. The (not nec- essarily disadvantageous) result of this is that the left and right sides of the filter’s response are not symmetric: the response is steepened on the right-hand side. All the filters are implemented as sixth-order ‘recursive’ or ‘MR’ filters. Just as in the ana- logue domain, these can be made by cascad- ing three second-order sections. Our imple- mentation of the sixth-order filter requires eight memory locations to store its state: these memory locations map to capacitors and inductors in the corresponding analogue filter realisation. The filter also requires a total of fifteen coefficients that determine its characteristics. The complete set of filters thus requires a grand total of 41 x 1 5 = 61 5 coefficients, which we store in a table. For simplicity in programming we add a forty- second filter which has no function except to pass the white noise signal through unaf- fected. This filter has index zero. Selecting a filter is simply a matter of load- ing the coefficient pointer so that it points to the correct set of coefficients. The value of this pointer is easy to calculate: if the base address of the filter coefficient table is A b and the filter index is F| then the pointer address is given by A = A B + 1 5 x F,: this is the start of the relevant coefficient block. Here we see one of the big strengths of digital signal processing: imagine how complicated and costly it would be to cre- ate a comparable analogue filter bank! The author has a superannuated octave and third-octave filter bank made by Bruel and Kjaer in his laboratory: it weighs 1 5 kg (33 lbs). We could have arranged to have hundreds of sets of filter coefficients stored in the DSP’s memory selected just by mov- ing a pointer. For the record, the forty band-pass filters meet the specifications of BS (DIN) EN 61 260 class 0. The pink noise filter deviates from the ideal performance by less than 0.1 dB over the frequency range from 10 Hz to 20 kHz. The band-pass filters are capable of attenuating stop-band signals by more than lOOdB: such performance is difficult to realise in an analogue circuit without inordi- nate amounts of design effort. The DSP code The signal processing code itself is embed- ded as a block in the audio loop. Even though in this case we have no need to read the incoming audio signal, we leave the existing audio loop code as it is and load the input samples as normal. This ensures that synchronisation is maintained within the audio loop and means that the frame- work code is identical for all three of our projects. The code has a total often local parameters: Table 3 lists these along with their valid ranges and other characteristics. The default values of the parameters are chosen so that the left channel emits a sine wave with a frequency of 1 kHz and the right channel a noise signal filtered to one third of an octave around a centre fre- quency of 1 kHz. In both cases the attenu- ator halves the output sample values: this corresponds to an attenuation of 6 dB. The noise amplifier stage has its gain set to 0 dB (on both channels). The default values of the parameters are listed in Table 4 and the files that comprise the DSP program are given in Table 5. Subroutines and signals Two subroutines are called before the audio loop is entered. The subroutine I n i t S t a t - elelctor 12-2011 Personal Download for I © Elektor 55 DSP COURSE SineL SineR NoiseL NoiseR NoiseGainL NoiseGainR NoiseShapedL NoiseShapedR GeneratorL GeneratorR OutL OutR Figure 4. Subroutines and signals in the audio loop. Figure 5. Timing of the SPI port. (Source: Wikipedia) e V a r s clears the filter state memories and the two phase accumulators. The shift reg- ister states are set to one of the allowable values. Then the subroutine SetDefault- P a r a ms sets all the parameters to the val- ues given in Table 4. Seven subroutines are called from within the audio loop. Six of these are directly involved with the audio signal processing chain. The seventh, subroutine Filter- S wi t c h , reads the two filter index param- eters F i L and F i R and from these values calculates the start addresses of the corre- sponding filter coefficient blocks, each of which contains fifteen entries. Although this operation is more a translation of parameter values than strictly speaking an audio signal processing operation, it nevertheless must occur within the audio loop as the param- eters can be changed dynamically. The other parameters are used directly and do not require further processing within the audio loop. The subroutine Si neGenerator con- tains the two independent sine wave gen- erators for the left and right channels. The two phase increment parameters Dp h i L and Dp h i R determine the frequency of the oscillators. The calculation of the sine function using an approximating polyno- mial is done within the macro sine. The state variables for the sine generator sub- routine are the two phase accumulators I : PhaseAccuL and I : PhaseAccuR, which contain the current phase values. The six coefficients of the approximating polynomial are stored in Y RAM with base address Si n C o e f . The two sine wave out- puts themselves are stored in memory loca- tions y : Si n e L and y : Si n e R . The subroutine Noi seGenerator contains the code for the two statistically independ- ent (for practical purposes at least) noise signal generators for the left and right chan- nels. Again, a macro is used for the signal generation proper. The macro has two argu- ments: the memory location where the shift register contents are stored and a 24-bit constant representing the feedback pat- tern. The state variables are the two 24-bit shift registers y : Noi s e L and y : Noi s e R , which are also the output signals of the two noise generators. The subroutine Filter implements the two noise shaping filters. Each is a sixth- order recursive, or MR, filter. We take advantage of the library macro i i r 2 ma c provided by Freescale (formerly Motorola). The macro can be used to implement MR fil- ters of any desired order and is a standard building-block. This subroutine requires no parameters, as the base address of the block of fifteen coefficients has already been computed in the subroutine Fil- t e r S wi t c h . Two areas for state memory, each of eight locations, are required. Their base addresses are F s t a t e L and F s t a t e R . The two filtered noise signals are available aty: Noi seGai nL andy: Noi seGai nR. The subroutine Ga i n B I o c k contains the code that applies gain to the filtered noise signals. The gain function is not protected against clipping and should therefore only be used to apply small amounts of gain. More detailed information on this is given elsewhere in this article. The code itself is very straightforward: a gain of 6 dB (a doubling of the signal level) is done using a left shift operation. The DSP features a barrel shifter that can shift by any num- ber of places in constant time: this means that we can apply a gain of any multiple of 6 dB in a single step. The two filtered noise signals, after any gain has been applied, are available iny: Noi seShapedL and y: Noi seShapedR. The subroutine Si gnal Swi tch imple- ments the two signal source switches that 56 Personal Download for I © Elektor 12-2011 elektor One-third-octave filters and noise sianal amplification Our signal generator can produce noise in one-third-octave and one-octave bands by filtering white noise appropriately. If the white noise source covering the full bandwidth from 0 Hz to 24 kHz has a signal level of L R = 0 dB, the signal level of the filtered noise will be lower as only a fraction of the noise power is passed through the fil- ter. Let us look at this phenomenon in more detail. The bandwidth B (the difference between the lower and upper cutoff frequencies) of an ideal filter with centre frequency f m is given by B = (2i/6 - 2-1/6) xf m = 0.231 6 xf m for a one-third-octave filter, and B = ( 2 i/2-2-i/2)xf m = 0.7071 xf m for a one-octave filter. Using these bandwidth values we can calcu- late the resulting noise power in decibels as L 1/3 = Lr+ 10 log ,o(f m ) + 1 o log 10 (0.231 6/24000) - L R + 10log 10 (U- 50.1 547 for the one-third-octave filter, and /-! = i R + 1 0 log 10 (U + 1 0 log 10 (0.7071 /24000) = t R + 1 0 log 10 (/m) - 45.3073 for the one-octave filter. We collect these results in a table below. Amplitude of filtered noise signal Centre One-third-octave filter One-octave filter output frequency output amplitude amplitude fm (Hz) 1,(3 (dB) Li (dB) 25 -36.18 31.5 -35.17 -30.32 40 -34.13 50 -33.17 63 -32.16 -27.31 80 -31.12 100 -30.15 125 -29.19 -24.34 160 -28.11 200 -27.14 250 -26.18 -21.33 315 -25.17 400 -24.13 500 -23.17 -18.32 630 -22.16 800 -21.12 1000 -20.15 -15.31 1250 -19.19 1600 -18.11 2000 -17.14 -12.3 2500 -16.18 3150 -15.17 4000 -14.13 -9.29 5000 -13.17 6300 -12.16 8000 -11.12 -6.28 10000 -10.15 12500 -9.19 16000 -8.11 -3.27 20000 -7.14 Figure A. GainL = 2, GainR = 3, no clipping. ■WMii Figure B. Clipping causing non-linear distortion: GainL = 3, GainR = 5. It is easy to see that the output level rises by 1 dB per one-third of an octave or by 3 dB per octave. If we need higher output ampli- tudes, particularly at lower centre frequencies, we need to amplify the signal. This is done using the parameters Ga i nL andGai nR which operate in 6 dB steps. However, if we apply exactly the gain implied by the above table to the signal, it is possible to cause clipping in the signal generator. This is because the choice of gain must be determined by the peak signal values and not by the av- erage signal power. The values given in the table provide a useful starting-point, however, but it is necessary to check the spectrum of the amplified output. Figures A and B show the effect of clipping one one-third-octave band-pass filtered noise. The signal generator is set up to generate one-third-octave noise on both channels, the left channel with centre frequency f m = 1 kHz and the right channel with centre frequency f m = 80 Hz. Figure A, produced using Wave- Lab, shows the effect of setting the gain on the left channel to 12 dB and that on the right channel to 1 8 dB. Figure B shows the case with the left gain set to 1 8 dB and the right gain to 30 dB. In Figure B it is easy to see the distortion components introduced by signal clipping alongside the band-pass filtered noise. When using a high gain it is important to check the output spectrum to verify that clipping is not occurring. elektor 12-2011 Personal Download for I © Elektor 57 DSP COURSE Available now! The DSP board used for all the experiments in this course, plus its programming adaptor, are now available at a special price. See http://www.elektor.com/noo1-92. select between the sine wave source and the noise source. The subroutine has two parameters, S wL and S wR . The routine does not have any state variables or coef- ficient storage. The two outputs from the switch are available aty: Gener at or L and y : Gener at or R. prefer a device that is rather less long in the tooth. The microcontroller can be pro- grammed in assembler or (more conveni- ently) in a high-level language. The SPI port of the DSP is operated in mas- ter mode, and the microcontroller is set up for operation as an SPI slave. The DSP is con- sented below illustrates from the point of view of the DSP bidirectional SPI communi- cation with polling of the port status flags. It should be possible at least to see from the code the basics of what is required, although some adjustments would be needed in practice. The final subroutine in the audio loop is called Attenuator. This implements the be 1 r #HE N, x: HCSR ; SHI disable, S PI reset two attenuators that appear immediately movep #$00204 8, x: HCKR ; Cpol =0, Cpha = 0 , narrow s p i ke before the audio output. The attenuation filter, factors are given by the two parameters ; f = F 0 s c / 2 / 8 / 10 = 0 . 92 16 MHz A 1 p h a L and A 1 p h a R ; again, there are no movep #$00004 0, x: HCSR ; 8 bits, mast e r mode, FI FO of f state variables or coefficients involved. The bs et #HE N, x: HCSR ; SHI enable attenuated signals are available at y : Ou t L andy: Out R and are passed through to the audio outputs. Parameter settings In order to modify the behaviour of the audio signal generator while it is in opera- tion it is necessary to alter the values in the two sets of five parameters, one set for each channel. As the code stands this involves editing the subroutine Set Def aul t Par- a ms to reflect the desired new values, re- assembling the program and reloading it into the DSP using the debugger. It would be much neater if we could provide user controls and a display to allow the param- eter values to be changed dynamically and sent to the DSP over its SPI port. It would also be possible to connect a key- pad or digital potentiometer, plus an ordi- nary alphanumeric LCD, to the DSP itself. However, processing user input at the same time as generating the audio signals makes the code more tricky: it is simpler to sep- arate the two processes from one another and use a microcontroller to manage the user interface. A wide range of suitable devices is available, and there is no great reason to recommend a particular one. The author’s preference for such applications is the 68HC1 1 , whose architecture is a par- ticularly good fit with our DSP, although readers embarking on a new project might move #Buffer, rO do # N , R W_ M u C jclr #HTDE, x: HCSR, * ; transmit register empty? movep x : ( r 0 ) , x : HTX jclr #HRNE , x: HCSR, * movep x: HRX, y : ( r 0 ) + R W_ M u C figured using the registers HCSR and HCKR: these set the clock frequency, clock polar- ity and phase, as well as the word length, which will normally be eight bits. Figure 5 shows the various timing options. We need to write a parameter-setting subroutine, which can for example be called as the ser- vice routine for an interrupt generated by the microcontroller. On our DSP board the IRQC signal can be used for this purpose. An alternative approach that avoids external interrupts, and which is simpler if less ele- gant, is to have the DSP periodically fetch the parameters from the microcontroller and update its internal variables if anything has changed. For simplicity, the polling interval can be set to an integer multiple of the audio sample period. We used a similar technique in the sine wave generator test program described in the fourth instalment in this series, where the audio sample clock was divided by 1 92. The code segment pre- r ecei ve register full? The code segment writes and reads two buffers of length N, a transmit buffer stored in X RAM and a receive buffer in Y RAM, occupying the same address range. The first four lines of code reset the interface, con- figure it and then enable it. The rest of the code shows how to write to and read from the buffer. We end with a small suggestion for a pro- gramming exercise. The phase increment d(|> = 2f s /f T that is the parameter to the sine wave generator is stored as a left-aligned fractional value. It would be more elegant to store the signal frequency f s as a right- aligned integer value instead and have the DSP carry out the necessary conversion cal- culation. This choice of parameter represen- tation also reduces the complexity of the code in the user interface microcontroller. ( 110006 ) 58 Personal Download for I © Elektor 12-2011 elektor The price of gold just went down at CIRCUIT CELLAR! Purchase Circuit Cellar's USB archive, CC Gold at $25.00 off the regular price and load it up with select add-ons for only $5.00 each Available add-ons: Previous Contest Projects Elektor Back Issues audioXpress Back Issues Archive includes: All Circuit Cellar issues in pdf format that are in print through date of purchase. Also includes associated project code. Free upgrade to 16 gigabyte USB during this promotion Limited time offer. For details and to purchase visit: www.cc-webshop.com Personal Download for I © Elektor HOME & GARDEN Electronic LED Candle You can blow it out! JP I LA Imitation candles using an LED as the illuminating element are available commercially. But here we’re describing a rather different project with a few unusual characteristics after all, candles are meant to be blown out! I J -p Hi 1 rV ■■ i' i 'n!' ' , , • u • unPo □ll Ij n I u m ^ O K 1 1 SP * D +5 0 +5 f > & h *? 1 K2 1 (H By Antoine Deschamps (France) Candlelight is by nature variable, so we’re going to do a bit of animation to simulate the candle flame. There will be a lighting sequence, a blowing-out sequence, and a few animated sequences intended to repro- duce more or less faithfully the flickering of a natural flame. To produce these animations we need a microcontroller. We went for the PIC16F1827 from Microchip which has a 4 Kword program memory, enough for the code to handle the application and the ani- mation sequence definitions. This microcontroller also has easy-to-i imple- ment functions for handling touch keys. So we decided to include a copper area on the back of our PCB to create a touch pad to let us light the candle. To achieve our (rather over the top!) objec- tive of being able to blow out the candle, we have found a new use for a temperature sen- sor in the form of an NTC thermistor. And it works! Puff detector As stated above, we’re using an NTC ther- mistor (R2 in Figure 1 ) as an air movement detector. We’ve chosen a type in a CMS 0603 package with a nominal resistance of 220 Q @ 25 °C, a beta coefficient of 3,540 K, and a maximum dissipation of 180 mW. A high beta coefficient means the resistance varies to a greater extent with variations in temperature. The principle of our circuit is as follows. We may consider that a person’s breath is appreciably similar to the ambient tempera- ture in the room. So at first sight, blowing on a thermistor that is already at ambient temperature isn’t likely to make its resist- ance change! The trick here is to pass enough current through the thermistor to heat it up slightly. Then a pronounced blow will cause its temperature to drop, which we’ll then be able to measure using one of the microcontroller’s analogue inputs. Our circuit includes a potential divider with a pad resistor of 1 00 Q (R1 ). At power up and with an ambient temperature of 25 °C, the current is l 25 = 5/ (100 + 220) = 16 mA. The voltage across the thermistor is V 25 = 220 x l 2 5 = 3.5 V, and the power dis- sipated by the thermistor is P 25 = V 25 x l 2 s = 3.5 x 1 6 mA = 56 mW. We’re a long way from the maximum of 1 80 mW, but this power is enough to cause the device’s temperature to rise, thereby reducing its resistance, increasing the cur- rent, and so on. After a few seconds, the whole thing stabilises, as the oscilloscope trace shows (Figure 2). Our software waits for 20 s so that the temperature is properly stabilized before taking the measurements into account. It’s tricky to show how this graph changes when you blow on it. After a lot of attempts, we managed to define that a positive variation of the order of 25 mV is enough to detect a human breath. 6 o Personal Download for I © Elektor 12-2011 elektor HOME & GARDEN Technical specifications • Realistic flame simulation • Blows out Lights via a touch pad PIC16F1827 programmed in C, source code provided Puff detector based on an NTC thermistor Constructional difficulty: average o o a a > > IC1 RBO RBI RB2 RB3 RB4 7 SIN 2 8 9 CLK 3 10 LATCH 4 11 BLANK 21 PIC16F1827 SSOP20 RA5/MCLR/VPP RA6 RA7 22 RSET 23 R4 0 SIN CLK LATCH BLANK SOUT o a > IC2 CAT4016 TSSOP24 RSET o z o LED1 LED2 LED3 LED4 LED5 LED6 LED7 LED8 LED9 LED10 LED11 LED12 LED13 LED14 LED15 LED16 10 11 12 13 14 15 16 17 18 19 20 GND 110644 - 11 tt Dll tt-D4 tt D13 tl tt tt 44 ,tt .tt tt tt tt tt tt tt D12 D2 D3 D9 D14 D1 D6 D7 D5 D8 D16 DIO tt D15 o o o o o o o • o o Figure 1 . Circuit diagram of the LED candle. The component count has been minimized, so as to fit within the area occupied by the LEDs on the top face of our PCB. The circuit is powered from 5 V, with an electrolytic capacitor (Cl ) to clean and buffer the voltage. The application of the microcontroller IC 1 is reduced to its simplest expression; we shall be using the internal oscillator, since we don’t need great accuracy. From a software point of view, it’s neces- sary to suit the frequency of the analogue acquisitions to the rate at which the meas- ured signals change. We’ve used initial fil- tering to eliminate noise, then averaging over 1 6 successive values, so as to be able to detect when a filtered value deviates from the average of the 1 6 values by more than 25 mV. The result is that you have to blow reasonably close to the candle to blow it out. Nonetheless, the whole thing is still quite sensitive to draughts. You don’t need accuracy here, as all you are doing is comparing the temperature differ- ences to the average of the temperatures recorded. So there was no need to fit a volt- age reference on the board, nor even to use the microcontroller’s internal reference. Hence the analogue measurement range is delimited by the 0 V rail on the one hand, and the supply voltage on the other. Touch pad The touch pad that enables us to light the candle is connected directly to analogue input 0 of the microcontroller IC1 (Fig- ure 1 ). The PIC1 6F1 827 data describes the capacitive sensing module clearly, and pro- gramming it should not present any prob- lem. Except for just one detail, as we don’t immediately have any idea of the frequency of this oscillator that is formed with the touch pad. Remember that it’s the variation of the capacitance of this copper pad when a human finger approaches it that causes a frequency variation, which is what we are going to need to measure or, more accu- rately, compare against a reference. The oscillator output is connected to Timer 0, which counts freely. So as to be able to observe these frequen- cies, we’ve duplicated the MSB of the Timer 0 counter register TMRO to the out- put connected to the test point. This then gives us on the oscilloscope test point a fre- quency of the order of 1 30 Hz, which drops to below 90 Hz when a finger touches the contact pad. This frequency corresponds to a frequency on the eighth bit of the register 256 times higher at the input to Timer 0, i.e. around 32 kHz. As our application is clocked at 1 kHz (see below), all we have to do is examine the contents of the TMRO register at each 1 ms cycle. TMRO has a value of around 32 when the touch pad is free, dropping to around 23 when your finger is touching the pad. Once it has been read, the TMRO register is forced to 0, so as to start counting again. In our application, we’ve set the threshold at 26, which is quite low, and so you really do have to put your finger on the pad for it to be triggered. Increasing this value would make the touch function more sensitive. One remark in passing: when developing a project, it’s important to make provision whenever possible for one or more test points. The oscilloscope too is a helpful pro- gramming tool! The flame This LED application is not intended for lighting, just to be decorative; so we’re going to use low-current LEDs, here with a maximum of about 2 mA. This power range lets us choose SMD LEDs, which will make it possible to fit them onto a relatively small area of PCB. Figure 2 . The temperature of the air movement detector stabilizes after a few seconds. elektor 12-2011 Personal Download for I © Elektor 61 HOME & GARDEN -i» || (•: ■*! Ih lUJi HI luipay |Li3ifiQ IL'UI ange, low current, SMD 0805, e.g. King- bright KPHCM -201 2SECK D1 3 = LED, red, low current, SMD 0805, e.g. Kingbright KPHCM-201 2SURCK Miscellaneous K1 = 6 -pin pinheader, lead pitch 0.1 inch (2.54 mm) l<2 = 4-pin pinheader, lead pitch 0.1 inch (2.54 mm) NO O to O • Figure 3. The double-sided PCB carries only surface mount (SMD) devices, but it can still be built by hand. COMPONENT LIST Resistors (SMD 0603) R1 = 100ft R2 = NTC, 220 ft, Epcos B5731 1 V2221J60 (e.g. Farnell #129- 991 2 or RS Components # 706-2702) R3 = 1 Okft R4 = 27kft Capacitors Cl = 33pF 1 0V aluminum electrolytic, case C, e.g. Panasonic EEE1 AA330SR C2 = 100nF, SMD 0603 Semiconductors IC1 = PIC16F1 827-l/SS (SSOP20), Microchip IC2 = CAT401 6Y-T2 (TSSOP24), ON Semiconductor D4 a D1 1 , D1 5 = LED, yellow, low cur- rent, SMD 0805, e.g. Kingbright KP-2012SYCK D1 , D2, D3, D1 2, D14, D1 6 = LED, or- Driving the total of 1 6 LEDs that are going to make up the flame has been entrusted to a specialized 1C, the CAT401 6 from ON Semiconductor (IC2). This device incor- porates constant current regulation for 1 6 LEDs, with the current value defined by an external resistor (R4). The current pass- ing in each LED channel is 50 times the cur- rent passing through the resistor connected to the R set pin. Given that the voltage on this pin is regulated to 1 .2 V, with R4 = 27 kft we have a current of 44 pA through the resistor, and hence 2.2 mA in the LEDs. This value offers good visibility of the animations while ensuring acceptable luminosity levels over- all. If you use other LEDs you may have to tweak the value of R4. The CAT4016 is driven via a serial connec- tion. Four signals are used, in the direction from the CPU to the CAT401 6: • CLK: clock signal • SIN: serial in data signal • LATCH: store signal • BLANK: signal to blank all 1 6 LEDs simultaneously The device data sheet illustrates the sequencing of the signals for individually driving the 16 LEDs. The data received, clocked by the clock signal, are stored in a shift register whose output is accessible (serial output signal SOUT), which we are not using here, but which would make it possible to connect several devices in series without using up more in/outputs on the microcontroller. The CAT401 6 uses on/off digital drive. To make the animations a bit more fluid, we need to be able to adjust the brightness of the LEDs on an individual basis. The solution is to do this in the software. Our microcontroller is clocked at 1 6 MHz, and as it takes four clock cycles to execute an instruction, we have an actual speed of 4 MHz. Timer 1 has been set to produce an interrupt every millisecond. This source of main timing is often called a “tick system”. At each tick, we refresh the contents of IC2’s shift register. On our prototype, the action of transferring the commands for the 1 6 LEDs takes 1 60 ps, i.e. 1 6 % of the processor time. At this repetition rate, the human eye, or rather the visual perception system, does not perceive the LEDs as flashing on and off. Very far from it, in fact — it would be possible to reduce the refresh frequencies if necessary, for example, to leave more CPU time for the other software routines. So we can create software pulse width modulation (PWM) for each LED. In our case, we’ve con- tented ourselves with a 5-state PWM (0 %, 25 %, 50 %, 75 %, and 1 00 %). This might not seem very much, but the software also has to define the patterns the LEDs are going to make in an attempt to reproduce the flicker- ing of a real flame. Now we’re restricted for space in our microcontroller, so unless we give it external memory and a method for programming this storage space, we need to reduce the number of states so as to be able to define enough patterns to make our animation pleasing. PCB A 17 x 60 mm board was designed (Fig- ure 3), of which the LEDs occupy an area 1 7 x 39 mm. The lower part of the board is reserved for the microcontroller program- ming connector and for the power input points. On the top of the board there are only the LED’s in CMS 0805 packages, i.e. a size of 2 x 1 .25 mm. We also find on this side the temperature sensor, the NTC thermistor in an 0603 package. This is necessary so we can blow on it! On the underside, you can spot at once the “tip” of the board, which forms the touch pad. Note too the test point TP1 , above the microcontroller (referred to above). To fit all the other functions on the other side, it was necessary to resort to fine-pitch packages. Our microcontroller comes in an SSOP20 package with a pitch of 0.65 mm and the LED driver was chosen in a TSSOP24 package, also with a 0.65 mm pitch. These fine pitches should not be seen as an obsta- cle, but rather as an effort to get closer to the industrial techniques that are within the reach of an amateur. An illuminated magni- fier, a fine-tipped, temperature-controlled soldering iron, 0.5 mm (AWG24) diameter solder, and above all flux in a syringe! Bet- ter not to drink too much strong coffee, though, before you start the soldering... The technique is well established — you should put a tiny amount of solder on a land 62 Personal Download for I © Elektor 12-2011 elektor HOME & GARDEN r — — — — — — — — — — — — — — — — — — ~ — — — — — — — — — ! — — — — — . — — ■ — — — — — — “ — — — — — > — — — — — w — — — — — — — — . — — -| Extract of the code for initializing of Timer i for the i kHztimebase: i T1C0N = ObOllOOlOl ; II Timer 1 configuration (Tick Interrupt Source) i 1 II 01 : Timerl source is Fosc = 16 MHz | II 10 : Prescaler = 4 -> Ftimer = 4 MHz | 1 II 0 : Timerl oscillator circuit disabled II 1 : Do not synchronize external clock input i II 0: uni mpl ement ed | II 1: T MR 1 ON = 1 - > Ti mer 1 enabl ed | 1 T1GCON = ObOOOOOOOO ; // Timer 1 gate control 1 II 0 : TMR1GE=0 -> Timer 1 counts regardless of Gate functions TMR1H = OxFO ; II 0 x F 0 5 F is the complement of 0x0FA0 =4 0 0 0 i TMR1L = 0 x 5 F ; II Counter startup value for 1ms interrupt period (1 0 0 0 Hz) PI El = ObOOOOOOOl ; II Interrupt sources i II 1: T MR 1 1 E =1 -> Timerl IT source enabled i r — — — — — — — — ______ — — — ______ — — — ~ — — — — — — ~ — — — — — — — — — — — ______ — — — — — — — — — — — — n Extract of the code for initializing the function to handle the capacitive sensor: OPTI ON_ REG = 0 b 0 1 1 0 1 0 0 0 ; i II 0 : WPUEN#=0 -> Weak pull-ups enabled by individual WPUx ■ II 1 : Interrupt on rising edge of I NT (not used) i II 1 : TMR0CS=1 -> Timer 0 counts on T0CKI i II 0 : TMR0SE=0: Timer 0 counts of rising edge of T0CKI j i II 1 : P S A = 1 : prescaler is not assigned to TimerO 1 / / 0 0 0: Prescaler value, 1:2 1 i II Capacitive sensing configuration | CPSCONO = 0 b 1 0 0 0 0 1 0 1 ; j i / / 1 : Capacitive module is enabled i II 0 0 0 : uni mpl ement ed i II 01 : oscillator in low- range 1 II 0: current direction status (read-only) i II 1: T OX C 5 = 1 -> TimerO input is Capacitive Oscillator output CPSCON1 = ObOOOOOOOO ; II Source is CPS0/RA0 _ _ _ _ _ _ ______ _ ____ _ — _ ____ _ ______ _ ____ _ _ _ _ _ J at one end; then position the device onto its lands and solder the tinned 1C pin. Once you are sure it is correctly positioned, you add some flux and solder the other pins. Sol- der bridges will form, but it’s easy enough to remove them using fine desolder braid. The board has been made double-sided and uses through-hole plating. The power rails have been routed in the form of planes; the +5 V plane is on the top surface, since this rail is the common for our LEDs. Hence the O V rail is on the underside. The in situ programming connector K1 is in fact a row of six through-plated holes. The pin-out follows the order of the signals given by the ICD3 programming interface from Microchip (Table 1 ). There are pads for connecting the power (l<2) — two for the +5 V rail (pins 1 and 3), and two for the 0 V rail (pins 2 and 4). Here Table 1. Pin-out for the ICSP connector. Pin 1 is marked with a square dot. Contact Signal 1 MCLR/Vpp 2 +5 V rail 3 0 V rail 4 ISPDAT 5 ISPCLK 6 Not used (PGM signal) too, pad 1 is marked by a square dot. Doub- ling up the supply pads like this is useful when joining several boards together, to multiply the graphical effect. Software As a guide, the current code written in C occupies 84.5 % of the microcontroller’s Flash memory, i.e. 3,460 words out of the 4,096 available. A good three-quarters of this space is used for defining the patterns and would require a degree of optimization if the space issue had to be tackled. The full source code, along with the HEX file, is available free on the project web page. You’ll also find there the PCB design and you can order the PCB (bare, or built and tested). To your soldering irons and... Merry Christmas! (110644) Software, PCB, products, etc. www.elektor.com / 1 1 0644 elektor 12-2011 Personal Download for I © Elektor 63 TEST & MEASUREMENT Turn your Oscilloscope into a Reflectometer J2 - V D1 1 N4004 -►h Cl lOn C2 2 IC1 220 (7) 16V ^ IC1 = 74AC14 ici.f R1 C3 nr C5 22n C4 H 15k H R2 02 <> — I 150 O | — — <> <► 13 1N4148 IC1.A In — Hl^ SI 7T1 V 2 C7 220p II 47 p JT 1 02 R3 j 220 Q | — IC1.E 11 JT 1 00 R4 ^20q]- IC1.D JTl vL R5 \ 220 1>|- IC1.C JT 1 R6 ^ 220 1>| - IC1.B JT 1 ■\4 R7 ^ 220 Q | — K1 O Q-| — R8 K2 H 220 HE ~o\ R9 H 470 h K3 O Of X ji * BNC 081176- 11 By Christian Tavernier (France) If you’re not familiar with transmission line theory, a reflectometer will probably seem like some sort of magical device to you. But using one, you can find out automatically how far a fault is from one end of a cable, without having to physically access the spot. It is used as shown in the figure. A generator is connected to both the oscil- loscope and the cable under test (CUT), which it drives with very fast rise-time pulses. Now transmission line theory tells us that if the cable is terminated in its char- acteristic impedance, and hence, if it is in good condition, no pulse will be reflected back from the far end of it. And so the oscil- loscope displays only the outgoing pulse. However, if the cable is mismatched, whether by a short-circuit or an open-circuit (cable cut), the transmitted pulse is subject to spurious reflections, and the oscilloscope will then display two pulses: the outgoing one, and the reflected one. We can tell how far the fault is from the near end of the cable simply by measuring the time delay between them. Obviously, such a device is incredibly use- ful to professionals, who can avoid having to change great lengths of cable, since they can very easily find the exact location of the fault. But it can also be useful for amateurs — for example, when installing network cabling, or finding out whereabouts your TV aerial downlead is broken. Sadly, a reflectometer is usually beyond the reach of amateurs because of its high price tag, since, in orderto produce a stand-alone instrument, it usually includes the pulse generator with the oscilloscope, as well as a computer section that takes care of cal- culating the distance to the fault. But as long as you already have an oscilloscope, and you are prepared to do a simple ‘rule- of-three’ calculation with your calculator, you can build the reflectometer we’re sug- gesting here for around £/€ 20. But don’t imagine from the price that this is going to be a cheapskate instrument! It will enable you to make the same measurements as its professional counterparts, as shown for example in the oscilloscope traces illustrat- ing this article. Our reflectometer contains just a single 1C, an AC (Advanced CMOS) hex inverter. ICIa is wired as an astable oscillator with a very short mark/space ratio, thanks to diode D2. In this way, it generates very narrow pulses at a relatively low rate. The width of these pulses can be adjusted to various fixed values via SI . For the shortest cables, you need very short pulses, otherwise the reflected pulse arrives before the outgoing pulse has ended, and the oscilloscope trace is unusable. For longer cables, on the other hand, there isn’t enough energy in those very short pulses for the reflected pulse to be properly visible, and so we need to use wider pulses that contain more energy. In order to be able to drive the cable under the correct conditions and at an imped- ance as close as possible to its characteris- tic impedance, ICI’s other five inverters are wired in parallel; hence the circuit output impedance is determined mainly by R3- R6, to which series resistors (R8 or R9) can be added, depending on whether K1 , K2, or l<3 is fitted. So we have three output imped- ances available: 50 £1 with K1 , 75 £1 with l<2, and 1 00 Cl with K3, so that the circuit can be matched to the commonest cables. 64 Personal Download for I © Elektor 12-2011 elektor TEST & MEASUREMENT The 6 V power rail should be provided by either a bench supply, if you’re in the work- shop, or a set of four 1 .5 V batteries for portable use. Diode D1 protects the circuit against reversed polarity. In order for our reflecto meter to operate in a stable fashion — the only way to guaran- tee accurate measurements — we recom- mend building it on the PCB we’ve designed for it [1 ]. This has the advantage of minimiz- ing wiring, as J1 and SI mount directly onto it. SI is a vertical PCB-mounting type from Lorlin, with the part no. PT6422/BMH. Even though the output uses a BNC socket, the circuit isn’t only designed for coaxial cables, since the output impedance can be adjusted using K1 , K2, and K3. So for other types of cables you’ll need to use a suitable BNC adaptor. The instrument is very easy to use, like this: Fit K1 (50 a), K2 (75 Q), or l<3 (100 Q) according to the impedance of the cable being tested. Connect the circuit up to the input of an oscilloscope and to the cable under test using a suitable T-piece, as indicated in the block diagram. Then turn the circuit on, with SI in position 1 , for example, and adjust the oscilloscope so as to view the outgoing pulse. If the cable is in good condition and cor- rectly terminated, you will see only single pulses, as shown in Trace 1 . If the cable is broken, i.e. open-circuited, you’ll see a reflected pulse of the same polarity as the outgoing pulse, as shown in Trace 2. If the cable is short-circuited, you’ll see a reflected pulse of inverted polarity compared to the outgoing pulse, as shown in Trace 3. In either of the last two situations, all you have to do is measure the time between the rising edges of the two pulses (191 ns in our example) in order to determine how far the fault is from the measuring end of the cable. All you need to know is that sig- nals travel at approx 200 m/ps in a coax- ial cable, and that the pulse has had to make a return trip to the fault and back. So the distance is given by the equation D = (Vx T) I 2, where D is the distance in metres, Vis the speed in the cable in m/ ps, and T is the time between the two ris- ing edges, expressed in ps. In our exam- ple, the time measured was 191 ns, so the fault was at 1 9.1 m from the near end of ki.iinii-Kj 1 V-fllirill 1 ■ V.— _i* 1 ■ l in I'ri'Hirh 1 j J i 4 1' aw 1 00 V. ^ 104n\ ■Thl \ 1 4-1 v' TW: Ha. nnii-Kj I nm.W\ V-mirili' I I : ■ j . I ' 1 U *n +■ d act I D 0 V 0 i\\ nil / ' 1 '5 v the cable. Do note that if the fault is not clear-cut, or for the shortest pulses generated by the circuit, the signals may be quite badly dis- torted, as shown in Trace 4. However, it’s still perfectly possible to measure the time between the two rising edges, as shown by this example, where a fault was located 3.8 m from the end of the cable. Finally, if you want to make accurate meas- urements, you can use the ‘true’ value of 7 W: ICi. nnii-Kj 1 Dlll.S 1 VHMirih. ■ ' 1 /t: 1 0 • ■t. ■ «a . 1 'JU 'n + ■ ■ ■■ ■ ■ — I ' / ! aw i oo v ^ i 4 Oin -nil / ^ '■! v' ~"W: ki. nnii-Kj nni.Wxl I ^.hiiisiIm i i : ■ LS Ui^ aw 2 00 V ^ 14 OiH '■■£■* 4 the signal propagation speed in your cable, in place of the average value given above. All you have to do is look it up in the cable data sheet, where it ought normally to be given. ( 081176 -I) Internet Link [1 ] www.elektor. com/081 1 76 Download 081 176-1 : PCB layout (.pdf), from [1 ] elektor 12-2011 Personal Download for I © Elektor 65 MICROCONTROLLERS USB Data Logger Store serial data conveniently, safely By Thomas Fischl (Germany) This neat design allows you to use a standard USB memory stick to store data in a microcontroller based system. Memory sticks provide a large volume of low cost, portable, non-volatile memory space. For this application the memory stick simply plugs into the data logger system which acts as a host USB controller and has the ability to log or store all serial data sent to it. Both of these tasks are handled with ease by a PIC24FJ64GB002 microcontroller from Microchip. Features • USB 2.0 compatible • Supports data rate up to 12 Mbit/s • Connection to the host: +5 V, GND, pC-Tx • A file stored on the memory stick configures the UART • Open-Source firmware • Power consumption: +5 V, 50 to 80 mA These days even the most basic microcon- troller will have a built-in serial data inter- face (UART). This would typically be used to transfer configuration parameters from a control computer or to send information about the microcontroller’s operational sta- tus. Quite often a microcontroller system may be required to collect data over a long period of time. In this situation it is usually impractical to permanently hook up a PC to continually store the measurement/sensor data; the environment may not be suitable and the relatively high power requirements make this a wasteful solution. The firmware of the existing microcon- troller system could be adapted to perform the data logging function but may require additional memory (both EPROM and RAM) to handle the task. The USB data logger described here is a low- energy, universal solution to the problem. It takes all the serial data sent from an exter- nal microcontroller system and stores it in a file on a USB memory stick which can be analysed later with a PC. Hardware The circuit (Figure 1 ) consists of little more than a PIC 24 FJ 64 GB 002 microcontroller from Microchip. This particular model implements USB 2.0 OTG functionality. OTG indicates ‘On The Go’ referring to the amended USB 2.0 specifi- cation which allows a USB device to assume not only its traditional role as slave but also to act as a master (host) on the bus. More recent amendments to the protocol ena- ble communication between two OTG devices. For this application we just need the USB host functionality and a standard USB A-type connector to plug in the USB memory stick. The microcontroller core runs at 3.3 V which is provided on board by voltage reg- ulator IC 2 . The serial interface is tolerant of input levels up to 5.5 V and is protected by 220 Q resistors connected in series with the inputs. The 5 V input supply voltage is also used as the bus voltage (VBUS) to power the USB stick. A resettable fuse (FI) provides Elektor Products & Services • PCB, order code 110409-1 • PCB artwork file (.pdf): file #110409-1, free download at [1] • Programmed PIC microcontroller: #110409-41 • Firmware: file# 110409-11.zip, free download at [1] 66 Personal Download for I © Elektor 12-2011 elektor MICROCONTROLLERS IC2 LP2950-33LPE3 K2 +3V3 -© +5V [uC-Rx/Logger-Tx] uC-Tx/Logger-Rx I t-H CNJ O O o o o o o o o o GND GND GND GND GND 13 T T I |C7 | C8 ^^OOn^^OOn VUSB VDD IC1 VDD RA0/RP5 RA1/RP6 RA4 RB0/RP0/PGED1 RB2/RP2 RB1/RP1/PGEC1 PIC24FJ64GB002 RB3/RP3 RB5 RB4/RP4 RB7/RP7 RB13/RP13 RB8/RP8 RB14/RP14 RB9/RP9 RB15/RP15 RB10/RP10/D+ VCAP/VDDCORE RB11/RP11/D- DISVREG VSS RA2/OSCI RA3/OSCO VSS 8 C5 22p 9 XI _ 12MHz , 10 C4 X ^22p 2 3 12 14 24 25 26 20 19 27 C6 □ 4u7 35V SI h jpi 110409 - 11 Figure 1 . The USB serial data logger circuit basically consists of a microcontroller functioning as a USB host. some protection if an external USB device draws too much current. LED D1 and push button SI connect directly to microcontroller pins. The LED flashes to indicate data transfer and the push button is used to terminate the data storage process. The 6-way pin header l<3 allows the micro- controllerto be programmed in-circuit and is compatible with standard programming adapter tools such as those used in PICkit 3 and ICD2/ICD3 from Microchip. Jumper JPI is not used in the current version of the firmware but may be employed in the future when newer versions of the firmware become available. The circuit can be built on the PCB (Fig- ure 2) which makes assembly very straight- forward. All components are fitted to the PCB component side and no SMD outlines are used. An 1C socket can be used to fit the microcontroller to the PCB. The fully popu- lated Elektor prototype PCB can be seen in Figure 3. Software The chip manufacturer Microchip already has a useful number of functions available in their ‘Microchip Application Libraries’ to support the interface of USB devices. Included here is support for the device class ‘Mass Storage Device’ which includes USB memory sticks. The FAT file format used by the vast majority of memory sticks is also supported. The firmware was designed using MPLAB, the Microchip development environment with help from the C30 com- piler. All necessary programs and software libraries are available free of charge and the firmware source files can be downloaded at no cost from the Elektor project web site [1 ]. The firmware can be programmed into the data logger microcontroller using a PICkit 3 for example. A pre-programmer microcontroller can also be purchased from the project website [1] which should help speed up construction even more. Data flow between the UART and the file system is performed by implementing two software ping-pong buffers. The charac- ters received via the serial interface are stored sequentially in one of two buffers. When the receive buffer is full the func- tion of the two buffers is flipped or ‘ping- ponged’ so that the entire contents of the full buffer are streamed to the memory stick while the other (empty) buffer is now used to store received characters. When the receiving buffer fills again the process repeats. Streaming ‘chunks’ of data to the memory stick in this way improves software efficiency. System hook up Communication between the USB data log- ger and external microcontroller system occurs over the serial interface (UART). The communication signal level from the exter- nal system must lie in the range of 3.0 V to 5.5 V; in cases where the external system uses standard RS232 port signal levels it will be necessary to use a RS232/TTL signal con- verter chip between the RS232 signals and the data logger. The data logger requires a supply of +5 V which in most cases can be taken from the external microcontroller system. The USB memory stick current consumption varies depending on the manufacturer but usually lies in the range of 50 to 80 mA. Connections between the external micro- controller system and the USB data logger are all made using pin header l<2. The data logger requires just three connections on K2 to the microcontroller system: +5 V (Pin 1 ), pC Tx/Logger Rx (Pin 9) and ground (Pin elektor 12-2011 Personal Download for I © Elektor 67 MICROCONTROLLERS COMPONENT LIST Resistors IC2 = LP2950-33LPE3 R1 = 1 k£l R2,R4,R5,R6 = 220£1 R3 = 5.6kQ Capacitors Cl ,C2,C7,C8,C9 = 1 0OnF C3,C6 = 4.7 jlcF 35V radial C4,C5 = 22pF Semiconductors D1 = LED, low-current, 3 mm IC1 = PIC24FJ64GB002-I/SP (programmed, Elektor# 110409-41) 1 0). Pins 2, 4, 6 and 8 are all tied to ground. The second signal connection shown as (jiC- Rx/Logger-Tx) is brought out to pin 5 but not used by the current firmware version. Microcontroller port pins 16 and 17 are Miscellaneous FI = resettable fuse, 250 mA hold current, 500 mAtrip current (Littlefuse 72R025XPR) XI = 1 2MHz quartz crystal K1 = USB socket, Type A, PCB mount l<2 = 1 0-pin (2x5) pinheader, right angled l<3 = 6 -pin pinheader PCB# 110409-1 connected to pins 3 and 7 of l<2 via 220 Q resistors. These additional connections are intended for future use with modified firm- ware to allow, for example the microcon- troller to retrieve stored data. Configuration The serial communication parameters are placed in the simple text file ‘config.txt’ stored on the memory stick. As soon as the USB stick is recognised (during power- up with the stick already in place or during operation when the stick is plugged in) this file is read and the serial interface config- ured accordingly. Without this configura- tion file the default standard communica- tion parameters are: 9600 Baud, 1 start bit, 1 stop bit, no parity. Operation The data logger will be in recording mode when it is powered up and a memory stick is fitted. Short flashes from the LED indi- cate that data is being received over the serial interface. Received data is stored 1:1 in the ‘logging.txt’ file. Before unplugging the memory stick it is necessary to press the store pushbutton; this ensures that all data held in the receive buffer is stored to the logging file and that the file is closed cleanly. The stored data can then be read on any PC by plugging the memory stick in to a free USB socket and reading the contents of the ‘logging.txt’ file using a simple text editor program. Work in progress Although the data logger design presented here only stores data to a memory stick it is clear that the design can easily be tweaked to make it even more useful. An obvious candidate would be to allow the stored data files to be read back to the external micro- controller system. As a stand-alone logger it could also be programmed to automati- cally sample the analogue and digital inputs at pre-programmed intervals and store the readings to memory stick. Four pins of the 1 0-pin l<2 pinheader are not currently in use but are wired back to the controller I/O pins, these peripheral signals can, for example be used to implement an SPI interface or addi- tional UART. ( 110409 ) Internet Link Figure 2. The PCB does not use any SMDs. [1 ] www.elektor.com/ 1 1 0409 Figure 3. The fully-stuffed Elektor prototype. 68 Personal Download for I © Elektor 12-2011 elektor :::c355‘* '3::a:cc atctcccc ccceecec :ccc:ccf reeccccc i B ^ \r= ;::ccct ‘C8CCCC 3f aoaacc JCfl8C3CC CCCCStSS id 3 C C S C C 3 2Jekt « ■ i 1 * J — „ ps«£s& - ! W + 1& I m 'ektor ~ &4 Confident reading: on paper *W * Contemporan, & innovate readinn - on PC, notebook or fabtet “ 9 Read Elektor with the cut-rate PLUS subscription! Subscribe now or upgrade: www.elektor.com/subs READERS PROJECT LED Cycle Lamp High-tech on the trail By Thomas Finke (Germany) The perfect bicycle lighting system has yet to be invented. They are either not bright enough or badly designed so that they fall off when you go over a bump or have wires that snag or use dynamos that reduce your speed to a dawdle. This design is one step nearer the ideal. It is self contained, powered by Lithium Ion rechargeable cells and has a dazzling 600 Lumen on tap. On full beam the torch will run for around three hours, much longer in ‘dipped’ mode. Although a true homebrew design this lamp has a truly professional feel to it. The alu- minium body is designed to be watertight and requires some machining. The design uses four Li-Ion cells connected in parallel, each with a capacity of 2.2 Ah. A microcon- troller takes care of battery management allowing the lamp to be charged at 5 V from either a mains adapter or car adapter. Lights, cycle, action! Flashing LED cycle lights are fine for the urban commute; they are highly visible and the batteries last a long time. If you how- ever get the urge to explore unlit country lanes or off-road trails then the chances are, when the sun goes down you will quickly discover their limitations. For the sake of safety you need something more powerful to warn you in good time of the road con- ditions up ahead. Equivalent professional cycle lighting systems are available but cost hundreds of pounds. This self-contained lamp operates from a single push button to switch between high beam and dipped beam. Conventional vehicle lamps switch between two filaments to achieve a dipped beam but with this design the main beam is just reduced in brightness to avoid the risk of dazzling oncoming vehicles. If you are planning to take your bike further afield it is worth checking the local cycling regu- lations before you travel. Some countries do not allow lamps that give out too much light. In the UK the regulations only specify that they should emit more than 4 Cande- las. Whatever the regulations this robust, versatile lamp should be more than capa- ble of taking anything that’s thrown at it. Operation The lamp uses just a single push button and operation is quite intuitive. A short press switches the lamp on then further presses toggle the lamp between ‘high beam’ and ‘dimmed’. A long press turns the lamp off. The brightness of the dimmed beam can be set by turning the lamp on with a long press. Now it enters setup mode where fur- ther press of PB1 cause the lamp to cycle through increasing then decreasing levels of brightness until the desired brightness is reached. Before long the torch reverts to normal operational mode. The push button is fitted with an indicator LED which is used here to give a visual indi- cation of the battery’s state of charge. Peri- odically it will issue a series of flashes (four flashes indicating a fully charged battery). When the voltage falls below a threshold the lamp automatically switches to the low- est brightness setting to prolong burn time. The circuit White LEDs have a forward voltage drop of around 3.5 V and the voltage output of a single Li-Ion cell varies from 2.7 to 4.2 V depending on its state of charge. To operate Note. Readers’ Projects are reproduced based on information supplied by the author(s) only. The use ofElektor style schematics and other illustrations in this article does not imply the project having passed Elektor Labs for replication to verify claimed operation. 70 Personal Download for I © Elektor 12-2011 elektor READERS PROJECT + Vbatt +v batt X7 Figure 1 . The circuit includes a microcontroller, two switched mode converters and a battery charge regulator. a single LED from a single cell it would be necessary to use a regulator which provides a voltage initially below the fully charged cell voltage but then above the cell volt- age as it discharges. A SEPIC (single ended primary inductance converter) is capable of this sort of operation. The disadvantage of this type of converter (besides the addi- tional circuitry) is that they are relatively inefficient. With this in mind it was decided to use the four LEDs (CREE XR-E) connected in series mounted on a circular PCB and fit- ted with lens optics made for the CREE LEDs. The regulator required to supply the neces- sary 14 V is a simpler upwards converter (step-up or boost converter). The circuit diagram in Figure 1 shows that a MAXI 6834 (U1 ) is used. The IC’s configura- tion in this circuit is taken from an applica- tion example in the chip’s data sheet, only component values have been changed to make it suitable for this application. Note that with a LED current of 1 A and the bat- tery voltage at its lowest level the coil must be able to cope with an average current of 5.6 A. The maximum LED current is defined by how many 1 Cl resistors are fitted to the PCB for R1 0. With all five resistors in place the combined value of RIO will be 0.2 Cl. This will give a maximum LED current of 1 A. The author fitted just three 1 Cl in the proto- type to give an LED current of 600 mA. This value produces more than adequate light output and limits power dissipation in the LEDs. The PWMDIM pin is an input for the PWM signal to dim the LEDs. This is used to reduce the energy dissipated by the LED. Pin 11 (UVEN) would normally be con- nected to a voltage divider network to sense and shutdown the chip when the sup- ply voltage falls too low. In the circuit here it is connected directly to port pin PB2 of the Atmel microcontroller (3). For circuit operation and to ensure the MOS- FETs fully conduct when they are switched on the MAXI 6834 (U1) requires a supply voltage of at least 5 V. The rechargeable cells alone have insufficient output so an additional voltage converter type LM341 0 (U2) has been used to provide the stabi- lised voltage (+VDRIVE). The LM3410 is essentially a constant current regulator for driving LEDs up to 500 mA. At the start of this design the author’s original intention was to use several LM341 0s to power the LEDs but all that remains is one of these tiny chips configured as a constant voltage boost converter. The Atmel ATtiny44 microcontroller (U3) has the job of controlling all the other com- ponents in the circuit. It generates the PWM drive signal to enable the power LEDs to be dimmed and provides the shutdown sig- nals to U1 and U2 as necessary. The built-in A/D converter measures the battery voltage using the voltage divider network R40 and R41 . To reduce current flow through the voltage divider network when the lamp is switched off the ground end of the divider is connected to port pin PB0. It can now be switched into a high impedance state to cut off current flow through the voltage divider network. The lamp is never turned completely off; the microcontroller, boost converter and LED elektor 12-2011 Personal Download for I © Elektor 71 READERS PROJECT Figure 2. A small circular PCB was designed for this project. Figure 3. The circular double sided PCB takes SMD components. Figure 4. A view of the lamp internals. driver are switched to sleep mode where current consumption drops to around 1 00 jiA. This level is insignificant compared to the battery capacity of 8.8 Ah. Push but- ton PB1 produces an interrupt to the con- troller, bringing the circuit out of sleep mode. Power supply The MAXI 81 1 (U4) takes care of battery management. The chip has been specifi- cally designed to charge Li-Ion cells from a USB port. The chip can handle a charging current of approximately 500 mA so a com- plete charge cycle will take up to 20 hours, it would be problematic to supply a higher current through the type of connector used and from a safety viewpoint it would also then be necessary to monitor the cell tem- perature to ensure that it does not overheat. The lamp is typically in use for only a few hours a day and then partially recharged overnight. The relatively long recharge time has never been a limitation. The battery pack has been made up from four cylindrical Li-Ion cells wired in parallel. These were salvaged from a broken Note- book. If these cells were connected in series the higher voltage would mean that the step-up converter could be dispensed with in the circuit but it would then be necessary to have a higher voltage charger and pro- vide a means to balance the cells. With the LED current limited to 600 mA the prototype operates for almost three and a half hours continuously at maximum brightness. Construction A double sided round PCB has been devel- oped for this project (Figure 2). The popu- lated board can be seen Figure 3. Despite improvements in high power LED efficiency over recent years it is still neces- sary to consider energy losses in the devices and take measures to ensure they do not overheat. The LED module (4 x CREE XR-E fitted to a 34 mm diameter PCB) is mounted on a 5 mm thick aluminium disk which is in good thermal contact with the aluminium body where the heat is dissipated to the sur- rounding air. The rear face of the disk also serves as a heat sink for the power MOSFETs in the circuit. The lamp housing has parts turned from round aluminium stock and a length of 50 mm aluminium tubing. The machined body has been black anodised which turned out to be a surprisingly unproblematic pro- cedure. The website [1] for this project con- tains two sketches detailing the mechani- cal construction of the body. Figure 4 shows the mechanical construction of the lamp: The front end with lens, LED carrier plate, 5 mm aluminium heat sink disk, PCB, mounting spacers, plastic board and the battery cells. The lamp housing must be watertight. The front lens is fixed into position using silicon adhesive. Both front and rear sections slide into the tube body where rubber ‘O’ rings provide a watertight seal. The waterproof push button with integrated LED is glued to the end of the lamp. The charging socket is a recessed SMB connector. This miniature coax connector is gold plated and is not sen- sitive to damp conditions. The socket can be fixed into the lamp body with waterproof adhesive. The lamp construction has undergone strenuous road testing on a daily basis over the last two years. It has proved to be both robust and reliable and on poorly lit lanes, indispensable. ( 100269 ) Internet Reference [i] www.elektor.com/ 1 00269 72 Personal Download for I © Elektor 12-2011 elektor Subscribe now to the leading US-based computer applications magazine specializing in embedded systems and design! Select your personal subscription at www.elektor.com/cc-subs 12 editions per year for just Digital: $38 Print: $63 Digital + Print: $90 CIRCUIT CELLAR THE MAGAZINE FOR COMPUTER APPLICATIONS GERARD’S COLUMNS Speaking Out Loud By Gerard Fonte(USA) There are a number of surveys that show that the fear of pub- lic speaking is greater than the fear of death. And, unfortunately, most people (including engineers) will eventually find themselves all alone in front of a lot of staring people, explaining a new product or process. It’s not really bad as a lot of people fear. Nearly everybody gets nervous before their presentation. But most find that after a minute or two, it gets much easier. A lot find it enjoyable after they get past the initial self-consciousness. It’s like jumping into a swimming pool and finding that the water is really nice. And, like most things, the more you do it, the easier it gets. However, there are some people who can’t get over the early jitters. For them the whole process seems like endless torture. These are the people who have a true phobia about public speaking. Unfor- tunately, these people generally can’t get accustomed to talking in front of others no matter how many times they do it. Usually, coun- seling is the only way to manage this, or any, phobia. It’s Showtime It’s useful to think of public speaking as a performance. As such, you have to know your lines and understand the mechanics of the show. Obviously, being prepared makes a huge difference in any undertak- ing. Conversely, trying to improvise your whole presentation is not likely to produce happy results. Therefore, the first tip is to practice your presentation a number of times before you get upon stage. However, unlike a role in a play, the monolog isn’t fixed. In fact, you shouldn’t memorize your lines at all (or read your presentation). If you do, you can appear wooden and uninteresting, which turns people off. Instead you should have a set of talking points that you want to discuss. And the nice thing is that you can simply put your talking points on slides, so you don’t have to memorize them, either. By putting just a few lines on a slide you also streamline the visuals. This is important. Too many novice speakers try to cram too much information on each slide. The result is that they are not readable from the back of the room and you spend an inordinate amount of time on one slide which causes people’s interest to fade. Conversely, every time you present a new picture, the audience’s interest perks up. That’s just human nature. So, you should only have a visual last for no more than a minute or so. Thus, if you have a 1 5 minute pre- sentation, you should prepare about 1 0 to 20 slides. Like an actor, you need to have a character. By this, I mean that you should be enthusiastic and motivated about your subject. Let’s face it, if you aren’t excited about your show, why should anyone else be? Standing in one place and droning on and on in a monotone is not effective. Smiling, walking around and being (or acting) confident makes a tremendous difference in your credibility. Yes, it is possible to take this too far and start looking like a used-car salesman. But in reality, this is rarely a problem. And, being over-animated at least keeps the listeners attentive. One on One One very effective method of reducing the stress of public speak- ing is to talk to one person. Pick someone in the crowd (preferably in the middle) and pretend that you are discussing your topic only to him or her. This helps you focus. It’s easy to get overwhelmed by a sea of faces. But if you are just chatting with someone it’s a lot easier. If you can, change your indi- vidual from time to time. Addressing one person for too long can make that person uncomfortable. It’s also useful to spread your attention over the while room. Of course, there is no rule that you can’t put a ringer in the crowd. Have a friend be present and address him or her. This can reduce your anxiety significantly. And, it’s certainly possible to get feedback from facial expressions or other indicators. This lets you know how well you are doing. Hav- ing your ally give you a thumbs-up after you just explained a difficult topic is very comforting and reassuring. Speak the Language It can’t be stressed too much that you have to know your audience. You will discuss your material differently for managers, salespeo- ple, customers or engineers. Clearly, technical jargon and esoteric details will be lost on salespeople. And failing to discuss the spe- cialized aspects to a gathering of engineers will not garner much credibility. You should know in advance who is coming to hear you and target that group. Of course, there will be times when there is a mixture of groups. This often happens at a general company meeting to discuss new projects, etc. In this case, there are a couple of things you can do. The first is to talk to the decision makers (most likely top manage- ment) using their vocabulary and discuss the points that concern them. These are the most important people to you and your pre- sentation and are the ones you have to impress. There’s nothing wrong with being pragmatic. The other approach is to recognize the presence of the different groups and acknowledge them during your talk. This is more dif- ficult and time consuming. You essentially have to translate tech- nical terms used for the engineers into simplified concepts for the others (or vice versa). But, if you have the time, this method can be extremely effective. For example, you might say something like this: “The new analyzer uses a 6-pole elliptic filter to eliminate aliasing. What this means is that there is a special circuit that removes signals that could cause problems for the software.” You probably won’t have to translate every sentence like this. But, you have to make sure that both the technical and non-technical groups get enough information to satisfy them. Speaking to a crowd doesn’t have to be a death-defying act. (110680) 74 Personal Download for I © Elektor 12-2011 elektor INFOTAINMENT Hexadoku Puzzle with an electronics touch If you are into puzzle solving, why not join the crowd of Elektor readers who solve the secret of Hexadoku every month, or at least have a crack at it! We’re sure you’ll be thrilled. “Simply” enter the right numbers in the puzzle below. Next, send the ones in the grey boxes to us and you automatically enter the prize draw for one of four Elektor Shop vouchers. Have fun! The instructions for this puzzle are straightforward. Fully geared to electronics fans and programmers, the Hexadoku puzzle employs the hexadecimal range 0 through F. In the diagram composed of 16x16 boxes, enter numbers such that all hexadecimal numbers 0 through F (that’s 0-9 and A-F) occur once only in each row, once Solve Hexadoku and win! Correct solutions received from the entire Elektor readership automati- cally enter a prize draw for one Elektor Shop voucher worth £ 80.00 and three Elektor Shop Vouchers worth £ 40.00 each, which should encourage all Elektor readers to participate. in each column and in each of the 4x4 boxes (marked by the thicker black lines). A number of clues are given in the puzzle and these determine the start situation. Correct entries received enter a draw for a main prize and three lesser prizes. All you need to do is send us the numbers in the grey boxes. Participate! Before January 1, 2012, send your solution (the numbers in the grey boxes) by email, fax or post to Elektor Hexadoku - 1 000, Great West Road - Brentford TW8 9HH United Kingdom. Fax (+44) 208 2614447 Email: hexadoku@elektor.com Prize winners The solution of the October 201 1 Hexadoku is: D0837. The Elektor £80.00 voucher has been awarded to Olavi Parkka (Finland). The Elektor £40.00 vouchers have been awarded to Susanne Muller-Furrer (Switzerland), Robert Amandine (France) and Thierry Notot (France). Congratulations everyone! 1 D 7 C A 9 5 5 B 1 8 D 0 4 9 F c 6 B E A D 4 F 2 7 E 8 B F 0 1 1 9 6 4 5 c 1 2 3 7 B D 3 C 6 4 D 8 7 B 9 1 8 6 5 2 4 F 0 1 7 6 B A 4 5 E 0 3 B 7 A 4 1 9 3 9 4 8 5 E 7 C 0 8 7 0 F 2 [4 1 0 6 3 D C 7 E B 9 D 4 2 A 0 7 B c F 3 9 D 6 4 8 E 1 5 B 8 3 9 A 5 4 D 7 0 E 1 6 2 F c 5 1 c D E 9 0 6 8 F 2 3 7 4 A B 4 6 E F 8 7 1 2 A 5 B C D 0 9 3 c 2 1 8 6 D 3 B 0 7 4 E 9 A 5 F E D F A 7 8 2 5 B 6 3 9 1 c 0 4 0 7 5 3 4 A 9 F c 8 1 2 B 6 D E 9 4 6 B 1 E c 0 D A 5 F 2 3 7 8 1 5 8 c 9 4 6 A E B F 0 3 7 2 D 6 B 2 0 c F D 8 1 3 7 A E 5 4 9 D 3 7 E 2 0 5 1 4 9 c 8 A F B 6 A F 9 4 3 B 7 E 5 2 D 6 C 1 8 0 F 9 B 6 5 1 E c 2 4 A D 0 8 3 7 3 c A 5 D 2 8 7 F E 0 B 4 9 6 1 7 E 4 2 0 6 B 9 3 1 8 5 F D C A 8 0 D 1 F 3 A 4 6 c 9 7 5 B E 2 The competition is not open to employees of Elektor International Media, its business partners and/or associated publishing houses. elektor 12-2011 Personal Download for I © Elektor 75 RETRONICS RCA Cosmac Development System hELLO wORLD from the Embedrock Age 8$ DR FAIL 00 OR FAIL 00 DR FWl 00 OR FOIL & “ r™. WF FOUND >m i wm i u FRIN LST >DIR *1 DRI \JE\ LI PRIH .LST >f DISKID : 2HSNW UERKSOttJF 2 Kokke «n Iterate SSC sea XRF .BKl TESTS ,DSK TESTS JCX DISOT' 21-02-84 lOKSCHIJF 2 Rofcke en UersU sec sea m ext TESTS m TESTS HEX By Jan Buiting (Elektor UK&US Editorial) As far as microprocessors are concerned my roots are in the early 1980s when all sorts of ‘hobby systems’ were around based on competing devices like the Z80, 6502 and 8085. I’ve always hated electronics that gets hot while doing nothing useful so I left these NMOS current hungry micros, fan clubs and BBSs well alone and went for a less popular 8-bit number cruncher called CDP1802 originally designed and produced by RCA, the company behind the famous CD4000 series of logic ICs. The CMOS (hence acutely energy friendly) 1 802 and its family of ‘Cosmac’ peripheral ICs did really well in the USA after a cute DIY system called Cosmac ELF was pub- lished in Popular Electronics way back in 1 976 (it was roughly the time when Jobs & The Woz tinkered with 6502s in their Palo Alto garage). A more sophisticated European variant called ‘Cosmicos’ was developed about four years later and that was to become my personal ‘platform’ (see “CDP1 802 — the first micro in space”, Ele- ktor October 2006). In 1980, as a student, if you could lay your hands on an RCA Cosmac data book, you were King. I managed to permanently borrow one from a kind soul at Vekano, a former RCA distributor in Holland. Prob- ably to fill the book and keep the marketing people happy, the last 40 or so pages of the book showed some of RCA’s software tools, hardware, programmers, compilers (like BASIC and PL/M) and Cos- mac development systems. Although my own DIY Cosmicos system was pretty well equipped (48 KByte RAM and all that), ‘green’ (under 200 mA @ 5 V) and fast too (3.58 MHz), I marvelled and drooled over the specs and (very poor) photograph promoting RCA’s top-line product: the monumental Cosmac System IV Development System CDP1 8S008. No price was given — I guess you had to telephone. Depending on your hobby or interests, it may take just 30 years before you can actually buy what you dreamt of as a youngster or student. Two forces work to your advantage, slowly but surely: (1 ) you make money instead of wasting it and (2) the price of the ‘desideratum/a’ drops to the level of techno junk no one wants. I’ve always cherished my Cosmicos CDP1 802 system and all its cards and peripherals, and a few years ago while browsing the ELF pages at Yahoogroups I could not believe my eyes! A posting from a fel- low countryman politely asking a mostly American audience on the forum if anyone would like a complete Cosmac IV system. All respectfully declined because of the colossal cost of getting the kit shipped to the US, where it had come from in 1 981 . To cut a long story short, I collected the complete system, paid a symbolic price and drove it home. A load of hardware actually developed with the system was also included, as well as documentation in binders and software on 8-inch floppy disks. It was the first time I had to adjust the headlights on my car to prevent dazzling oncoming traffic. I never realized the system I had seen in a book 30 years ago was so bulky and heavy. But Home & Mother, what a find! The bright blue and off-white unit labelled ‘Cosmac IV’ is basically a CRT dumb terminal talking internally to a CDP1 802 system. It weighs only 1 7 kgs (38 lbs). Believe it or not but the ‘terminal’ is itself a CDP1802 video system sitting between a keyboard and a 12-inch CRT. The actual development system is a separate back- plane onto which RCA CDP1 8Sxx ‘micromodules’ are plugged like CPU (CDP1 802), ROM, RAM, I/O, FDISK, etc. The software you want to develop for a custom application is fully written, tested and debugged using the ‘card nest’, until (you think) hex code is ready to safely burn firmware (E)PROMs like the 2708 and 2716. The (E) PROM programmer is accessible under a hinged panel. The panel opens and closes by pressing it. People fund it funny. On the rear of the terminal casing there’s connectors for AC power, disk, printer, CRT EIA, SYS, EIA, MOPS EIA, spare #1 and spare #2. The Cosmac IV terminal unit has a nostalgic bright green CRT display that’s just perfect to read although at 24 lines of 80 characters it’s claustrophobic compared to today’s LCD monitors. Also, the Sperry made 73-key ASCII keyboard is a delight to listen to when typed upon at speed, the keys being of the Hall effect type. Using the full- screen editor (FSE) to write your code (in assembler, of course) you hardly miss the ease and comfort of a mouse, menus, icons or the constant distraction of the Internet! 76 Personal Download for I © Elektor 12-2011 elektor RETRONICS IV (CDP18S008) (ca. 1978) If you thought the Cosmac IV blue & white CRT terminal is “expen- sive & comprehensive” and you can’t wait to start writing code and burn ROMs, wait! There are two more ‘components’ that go into the CDP1 8S008 system. First, there’s a dual disk drive for 8-inch floppy (“flexible”) disks with a gross capacity of 256 KBytes (0.025 GBytes) each. Made by Pertec (Chatsworth & Irvine, CA) and the case cover sprayed ‘RCA blue’ according to a leaflet I found, this monster called Model 371 2 weighs 34 kgs (75 lbs). The same drive units but in a different colour were supplied to Altair for their 8080 based systems, and very likely to other minicomputer manufacturers. The unit produces a horren- dous amount of noise due to a huge extractor fan and the two disk drive motors spinning all the time (probably to keep disk access times within limits). A loud ‘clack’ is heard whenever a floppy disk gets selected or released. The hum of the heads racing across on the disk surface would make a nice ringtone. Inside the case, a control board roughly the size of two iMacs is seen, stuffed with 1 50-odd ICs — mostly plain TTL running at 5 V. Noisy, hot and slow as it may be, the dual diskdrive unit turned out to work reliably after 30 years — all 8-inch disks I got from the previous owner could be read without problems and I am now considering starting an 8-inch-to-USB-sticl< On Demand Conversion Service. The third component of the system is called ‘Micromonitor’ (CDP1 8S030), where ‘micro’ definitely refers to ‘microcontroller’, not size. It’s an aluminium suitcase, again sprayed RCA blue, con- taining not much more than LEDs, switches and ZIF sockets. The idea was to migrate the CPU from the customer application to the Micromonitor (via a length of 40way ribbon cable) and then sort of single-step the firmware to watch what the CPU lines were doing! So, the blue suitcase not unfit for a travelling salesman appearing on The Jetsons was intended to help debug CDP1 802 applications “in-system, in real time, on site”! But just how? I really can’t figure out because you soon need to view hex code and possibly enter it in a comfortable way. A later version (CDP1 8S030A) had a detachable display/keyboard unit that looked like a 1970s pocket calculator. The only mass-produced CDP1 802 application circuits that seem to have survived are a US made traffic lights system occasionally offered on Ebay, and a 1 996 (!) Nokia UHF in-car radiotelephone that got hacked and converted to amateur radio use. Oops, I should not forget a home / game computer called COMX35. Today, a small group of people still enjoy working with the CDP1 802 ‘Cosmac’ CPU; they can be found within the ELF communities on the web. Personally, I am using the Cosmac IV system occasionally to tweak the software of my DIY hothouse climate and irrigation con- trol based on a good old CDP1 802. 1 cheerfully use things like PL/M, CDOS, UT5, MOPS, BASIC1 , and ASM8. The bulky disk drives and the Micromonitor are no longer used, the former being emulated by two SMD static RAMs with battery backup! For sure I can appreciate 30 years of progress and miniaturisation we all achieved in micro- controller systems and components. True, all 70 kgs (1 55 lbs) worth of CDP1 8S008 should easily fit in, say, a single Xilinx ‘Spartan’ FPGA. I know, my Cosmac IV system really belongs in a computer museum. On the Internet, a 1976 price of $70,000 was mentioned some- where for a full blown CDP1 8S008 system like the one described here. I have no way of verifying. All I know is that the previous owner never guite managed to recoup the cost of his system through developing, selling and supporting highly specialized applications commissioned by clients including government institutions. It’s a sobering thought that today microcontroller development systems are available at give-away prices from the manufacturers. If any Retronics reader out there has any original RCA Cosmac CDP- 1 8Sxx disks containing software tools or higher level programming languages, please let me know. The same for a CDP1 8S021 Micro- terminal running UT5. (110528) Retronics is a monthly column covering vintage electronics including legendary Elektor designs. Contributions, suggestions and reguests are welcomed ; please send an email to editor@elektor.com elektor 12-2011 Personal Download for I © Elektor 77 ELEKTOR SHOWCASE To book your showcase space contact Elektor International Media Tel. 0031 (0) A E 4389444 Fax 0031 (0) 46 4370161 BRITISH AMATEUR ELECTRONICS CLUB ARCHIVE http://baec.tripod.com/ The British Amateur Electronics Club Archive Website. Archives from 1 40+ Newsletters from 1966-2002. Currently have interesting and useful selected articles from 21 Newsletters. Also a section about built electronics projects with schematics and photos. Plus useful info., downloads and links. NO ADVERTS! PIC demo kit • Demonstration • Development • Building block Kit price including LCD £20 or assembled £35 + p&p www.cstech.co.uk/picdemo Open source examples in C and Assembler Includes: PIC16F1827, Temperature sensor, RS232, LCD display, Analogue input, 5V regulator £ EASYSYNC LTD. www.easysync-ltd.com/ Supplier of communications and ' / instrumentation products with specialist expertise in serial connectivity solutions based on USB, CAN and RS232/RS422/ RS485 interfaces. • USB to Serial RS232/RS422/RS485 converter cables. • CANbus solutions • Ethernet to Serial Adapters or to USB hubs. • USB based Logic Analysers, Oscilloscopes & Data Loggers. • OEM & ODM design services. ELNEC www.elnec.com Europe’s leading device \ programmers manufacturer: • reliable HW: 3 years warranty for most programmers • support over 58.000 devices • free SW updates • SW release: few times a week • excellent technical support: Algorithms On Request, On Demand SW • all products at stock / fast delivery Technology Transfer Ltd, FIRST TECHNOLOGY TRANSFER LTD. http://www.ftt.co.uk • Training and Consulting First for IT, Embedded and Real Time Systems • Assembler, C, C++ (all levels) • 8, 16 and 32 bit microcontrollers • Microchip, ARM, Renesas,TI, Freescale • CMX, uCOSII, FreeRTOS, Linux operating systems • Ethernet, CAN, USB, TCP/IP, Zigbee, Bluetooth programming HEXWAX LTD www.hexwax.com World leaders in Driver-Free USB ICs: • USB-UART/SPI/I2C bridges • TEAleaf-USB authentication dongles • expandlO-USB I/O USB expander • USB-FileSys flash drive with SPI interface • USB-DAQ data logging flash drive FLEXIPANEL LTD www.flexipanel.com TEAclippers - the smallest PIC programmers in the world, from £20 each: Per-copy firmware sales Firmware programming & archiving In-the-field firmware updates Protection from design theft by subcontractors SCOPES and more Instruments A Rohde &Schwarz Company www.hameg.com Great Value in TEST & MEASUREMENT FUTURE TECHNOLOGY DEVICES INTERNATIONAL LTD. www.ftdichip.com FTDI specialise in USB silicon, hardware and software solutions. • USB WHQL complaint drivers. • USB host and slave solutions. • Free firmware development tools. • USB IC’s, modules, cables and . turnkey custom solutions. ^ • World renowned FOC application support. USB MADE EASY ✓ satisfy your inner geek geek ^ a fresh approach Cool portable electronic projects and kits TO BOOK YOUR SHOWCASE SPACE CONTACT ELEKTOR INTERNATIONAL MEDIA www.mintygeek.com WWW. elektor. Tel. 0031 (0) 46 4389444 Fax 0031 (0) 46 4370161 com 78 Personal Download for I © Elektor 12-2011 elektor products and services directory MaxSonar Ultrasonic Range Finder X L-M a xS ona r-EZ * Beam pattern choice * High acoustic; power * Real-time calibration * 39.&5USD /unit MaxSonar-WRC iP67 * Compact packaging 4 Quality narrow beam • S9.95USD/ unit www .active-ro bot . co. u k www .cool com pon en ts ,co .uk www .ocean control s. co m . au www.maxbotix.com ROBOT ELECTRONICS http://www.robot-electronics.co.uk Advanced Sensors and Electronics for Robotics • Ultrasonic Range Finders • Compass modules • Infra-Red Thermal sensors • Motor Controllers • Vision Systems • Wireless Telemetry Links • Embedded Controllers ROBOTIQ http://www.robotiq.co.uk Build your own Robot! Fun for the whole family! Now, available in time for X-mas • Arduino Starter Kits *NEW!!* • Lego NXT Mindstorms • Affordable Embedded Linux Boards • Vex Robotics (kits and components) • POB Robots (kits and components) email: sales@robotiq.co.uk Tel: 020 8669 0769 TYDER http://www.tyder.com • ONEoverT Digital Filter Design Software (Full version for only £30) • Design FIRs, HRs, NCOs, FFTs for DSPs and FPGAs • VHDL Code Generators • Makes DSP design simple • Download demos from website WWW. elektor. com VIRTINS TECHNOLOGY www.virtins.com PC and Pocket PC based virtual instrument such as sound card real time oscilloscope, spectrum analyzer, signal generator, multimeter, sound meter, distortion analyzer, LCR meter. Free to download and try. TO BOOK YOUR SHOWCASE SPACE CONTACT* ELEKTOR INTERNATIONAL MEDIA Tel. 0031 (0) 46 4389444 Fax 0031 (0)46 4370161 SHOWCASE YOUR COMPANY HERE Elektor Electronics has a feature to help customers promote their business, Showcase - a permanent feature of the magazine where you will be able to showcase your products and services. For just £242 + VAT (£22 per issue for eleven issues) Elektor will publish your company name, website address and a 30- word description For £363 + VAT for the year (£33 per issue for eleven issues) we will publish the above plus run a 3cm deep full colour image - e.g. a product shot, a screen shot from your site, a company logo - your choice Places are limited and spaces will go on a strictly first come, first served basis. So-please fax back your order today! _ I wish to promote my company, please book my space: • Text insertion only for £242 + VAT • Text and photo for £363 + VAT NAME: ORGANISATION: JOB TITLE: ADDRESS: TEL: PLEASE COMPLETE COUPON BELOW AND FAX BACK TO 0031(0)46 4370161 COMPANY NAME WEB ADDRESS 30- WORD DESCRIPTION elektor 12-2011 Personal Download for I © Elektor 79 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES Going Strong A world of electronics from a single shop! Creative solutions for all areas of electronics 311 Circuits 31 1 Circuits is the twelfth volume in Elektor’s renowned 30x series. These Summer Circuits com- pilation books have been bestsellers for many years. This brand new book contains circuits, design ideas, tips and tricks from all areas of electronics: audio & video, computers & microcontrollers, radio, hobby & modelling, home & garden, power supplies & batteries, test & measurement, software, not forgetting a section ‘miscellaneous’ for everything that doesn’t fit in one of the other categories. 31 1 Circuits offers many complete solutions as well as useful starting points for your own projects. Both categories and anything in between represent a veritable fountain of inspiration for cultivating your own ideas and learning about electronics. This book deserves a place notfarfrom the workbench! 420 pages • ISBN 978-1-907920-08-0 • £29.50 • US$47.60 □ lcktor LabWorX 1 LabWorX: Straight from the Lab to your Brain Mastering the l 2 C Bus Mastering the l 2 C Bus is the first book in the LabWorX collection. It takes you on an exploratory journey of the l 2 C Bus and its applications. Besides the Bus protocol plenty of attention is given to the practical applications and designing a solid system. The most common l 2 C compatible chip classes are covered in detail. Two experi- mentation boards are available that allow for rapid prototype development. These are completed by a USB to l 2 C probe and a software framework to control l 2 C devices from your computer. 248 pages • ISBN 978-0-905705-98-9 £29.50 • US$47.60 Linux PC-tHHd Measurement electronics A highly-practkai guide Linux - PC -based Measurement Electronics If you want to learn howto quickly build Linux-based applications able to collect, process and display data on a PC from va- rious analog and digital sensors, howto control circuitry attached to a computer, then even how to pass data via a network or control your embedded system wire- lesslyand more-then this isthe bookfor you! The book covers both hardware and software aspects of designing typical em- bedded systems using schematics, code listings and full descriptions. 264 pages • ISBN 978-1-907920-03-5 £29.50 • US$47.60 8o Prices and item descriptions subject to change. E. & O.E Personal Download for I © Elektor 12-2011 elektor Controller Area Network Free mikroC compiler CD-ROM included Controller Area Network Projects The aim of the book is to teach you the basic principles of CAN networks and in addition the development of microcon- troller based projects using the CAN bus. You will learn howto design microcontrol- ler based CAN bus nodes, build a CAN bus, develop high-level programs, and then exchange data in real-time overthe bus. You will also learn howto build microcon- troller hardware and interface it to LEDs, LCDs, and A/D converters. 260 pages • ISBN 978-1-907920-04-2 £29.50 • US$47.60 Talk with your computer Design your own PC Voice Control System This book guides you through practical speech recognition, speech annunciation and control of really useful peripherals. It details a project which will enable you to instruct your computer using your voice and get it to control electrical devices, tell you the time, checkyour share values, get the weather forecast, etc. and speak it all back to you in a natural human voice. If you are interested in the practical techno- logy of interfacing with machines using voice, then this book is your guide! 216 pages • ISBN 978-1-907920-07-3 £29.50 • US$47.60 Design you* - own Enhanced second edition: 180 new pages Design your own Embedded Linux Control Centre on a PC "\ The main system described in this book re- uses an old PC, a wireless mains outlet with three switches and one controller, and a USB webcam. All this is linked together by Linux. This book will serve up the basics of setting upa Linuxenvironment- including a software development environment -so it can be used as a control centre. The book will also guide you through the necessary setup and configuration of a Webserver, which will be the interface to your very own home control centre. New edition enhance- ments include details of extending the ca- pabilities of your control center with ports for a mobile phone (for SMS messaging) and the Elektor “thermo snake” for low- cost networked real-time thermal moni- toring of your house and outbuildings. Now you can additionally also send all kinds of useful temperature and sensor warnings to a mobile phone. All software needed will be available at the Elektor website. 41 6 pages • ISBN 978-1-907920-02-8 £34.50 • US$55.70 More information on the Elektor Website: www.elektor.com Elektor Regus Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 Email: order@elektor.com Circuits, ideas, tips and tricks from Elektor cd 1001 Circuits This CD-ROM contains more than 1 000 cir- cuits, ideas, tips and tricks from the Sum- mer Circuits issues 2001 -201 0 of Elektor, supplemented with various other small projects, including all circuit diagrams, descriptions, component lists and full- sized layouts. The articles are grouped alphabetically in nine different sections: audio & video, computer & microcontrol- ler, hobby & modelling, home & garden, high frequency, power supply, robotics, test & measurement and of course a sec- tion miscellaneous for everything that didn’t fit in one of the other sections. Texts and component lists may be searched with the search function of Adobe Reader. ISBN 978-1 -907920-06-6 £34.50 • US $55.70 More than 70,000 components cd Elektor’s Components Database 6 This CD-ROM gives you easy access to de- sign data for over 7,800 ICs, more than 35,600 transistors, FETs, thyristors and tri- acs,justunder25,000diodesand 1,800op- tocouplers.The program package consists of eight databanks covering ICs, transistors, diodes and optocouplers. A further eleven applications cover the calculation of, forex- ample, zener diode series resistors, voltage regulators, voltage dividers and AMV’s. A colour band decoder is included for deter- mining resistor and inductorvalues. All da- tabank applications are fully interactive, allowing the user to add, edit and complete component data. ISBN 978-90-5381 -258-7 £24.90 • US $40.20 V J elektor 12-2011 Personal Download for I © Elektor 81 SHOP BOOKS, CD-ROMs, DVDs, KITS & MODULES ATM18 board cd ATM1 8 Collection This CD-ROM contains all articles from the popular ATM18-CC2 series published in Elektor magazine. From RFID Reader and Bluetooth linking right up to a chess com- puter! Project software and PCB layouts in PDF format are included. What’s more, this CD also contains a Bascom AVR program- ming course and helpful supplementary documentation. ISBN 978-0-905705-92-7 £24.50 • US $39.60 Improved Radiation Meter (November 201 1) All that’s required to measure radiation is a simple PIN photodiode and a suitable preamplifier circuit. Elektor presents an optimised preamplifier and a microcon- troller-based counter. The microcontroller takes care of measuring time and pulse rate, displaying the result in counts per minute. This device can be used with diffe- rent sensors to measure gamma and alpha radiation. It is particularly suitablefor long- term measurements and for examining weakly radioactive samples. Kit of parts incl. display and programmed controller All articles in Elektor Volume 201 0 dvd Elektor 2010 This DVD-ROM contains all editorial arti- cles published in Volume 2010 of the English, Spanish, Dutch, French and Ger- man editions of Elektor. Using the supplied Adobe Reader program, articles are pre- sented in the same layout as originally found in the magazine. An extensive search machine is available to locate keywords in any article. With this DVD you can also produce hard copy of PCB layouts at printer resolution, adapt PCB layouts using your favourite graphics program, zoom in / out on selected PCB areas and export circuit diagrams and illustrations to other programs. ISBN 978-90-5381 -267-9 £23.50 • US $37.90 Art.# 11 0538-71 • £35.50 • US$57.30 FT232R USB/ Serial Bridge/BOB (September 201 1) You’ll be surprised first and foremost by the size of this USB/serial converter— no larger than the moulded plug on a USB ca- ble! And you’re also bound to appreciate that fact that it’s practical, quickto imple- ment, reusable, and multi-platform — and yet for all that, not too expensive! Maybe you don’t think much of the vario- us commercially-available FT232R-based modules. Too expensive, too bulky, badly designed, ... That’s why this project got designed in the form of a breakout board (BOB). PCB, assembled and tested Art.# 11 0553-91 • £12.90 • US$20.90 82 Prices and item descriptions subject to change. E. &O.E Personal Download for I © Elektor Audio DSP Course (September 201 1) This DSP board is the platform for the applications described in our Audio DSP Course. It is also intended to enable you to develop your own initial digital audio signal processing applications. The DSP board can be used stand-alone as is, and even though it is an ideal learning plat- form, with its 24-bit signal processing capability for sampling rates up to 1 92 kHz and its high-performance inter- faces, it is also suitable for applications with very stringent quality requirements for both signal to noise ratio and DSP computing power. Populated and tested DSP board Art.# 11 0001 -91 • £115.70 • US$186.70 USB Long-Term Weather Logger (September 201 1) This stand-alone data logger displays pressure, temperature and humidity rea- dings generated by l 2 C bus sensors on an LCD panel, and can run for six to eight weeks on three AA batteries. The stored readings can be read out over USB and plotted on a PC using gnuplot. Digital sensor modules keep the hardware sim- ple and no calibration is required. Kit of parts incl. PCB , controller , humidity sensor and air pressure sensor modules Art.# 100888-73 • £31.10 • US$50.20 y 12-2011 elektor £ US$ December 2011 (No. 420) L + + + Product Shortlist December: See www.elektor.com + + + November 2011 (No. 41 9) Improved Radiation Meter 110538-41 .... Programmed controller ATmega88PA-PU 9.35.... ....15.10 110538-71 .... Kit of parts incl. display and programmed controller ...35.50.... ....57.30 Simple Bat Detector 110550-1 PCB, bare 8.85.... ....14.30 OnCE/JTAG Interface 1 1 0534-91 .... Programmer board, assembled and tested ...35.60..., ....57.30 Here comes the Bus! (9) 110258-1 Experimental Node board 5.30.... 8.60 1 1 0258-1 C3 .. Printed circuit board 3x print Experimental Node .. ...11.50.... ....18.60 1 1 0258-91 .... USB/RS485 Converter, ready made module ...22.20.... ....35.90 Dual Linear PSU for Model Aircraft 081064-1 Printed circuit board ...14.50.... ....23.80 October 2011 (No. 41 8) Versatile Board for AVR Microcontroller Circuits 1 00892-1 Printed circuit board 1 1 .55 1 8.70 Audio DSP Course (4) 110001-91 ....PCB, populated and tested DSP board 115.70 186.70 1 1 0001-92 .... Bundle DSP board (1 1 0001 -92) with Programmer (11 0534-91) 215.00 133.50 Here comes the Bus! (8) 1 1 0258-1 Experimental Node board 5.30 8.60 1 1 0258-1 C3 .. Printed circuit board Experimental Nodes (3 PCBs).... 1 1 .50 1 8.60 1 1 0258-91 .... USB/RS485 Converter, ready made module 22.20 35.90 September 2011 (No. 41 7) eC-Reflow-Mate 100447-91 .... Professional SMT reflow oven 2 170. 00. ..3495. 00 USB Long-Term Weather Logger 100888-1 .Printed circuit board ..16.00 ... ...25.90 100888-41 ... . Programmed controller ATMEGA88-20PU ....8.85 ... ...14.30 100888-71 ... . HH10D humidity sensormodule .... 7.10.... ...11.50 100888-72... . HP03SA air pressure sensor module .... 5.75.... 9.30 100888-73... . Kit of parts incl. PCB, controller, humidity sensor and air pressure sensor modules ..31.10.... ...50.20 I 2 C Sensors 100888-71 ... . HH10D humidity sensormodule .... 7.10.... ...11.50 100888-72... . HP03SA air pressure sensor module .... 5.75.... 9.30 E-Blocks go Twitter EB003 . E-blocks Sensor board ..21.60.... ...34.90 EB005 . E-blocks LCD board ..24.00.... ...38.80 EB006 . E-blocks PIC Multiprogrammer .. 72.00.... .116.20 EB007 . E-blocks Switch board ..14.40.... ...23.30 EB059 . E-blocks Servo board ..14.40.... ...23.30 EB069 . E-blocks Wireless LAN board 132.00.... .212.90 TEDSSI4 . Flowcode4fordsPIC/PIC24 178.80.... .288.40 FT232R USB/Serial Bridge/BOB 110553-91 ... . PCB, assembled and tested ..12.90.... ...20.90 Here Comes the Bus! (7) 110258-1 . Experimental Node board, bare .... 5.30.... 8.60 11 0258-1 C3. . 3 x Experimental Node board, bare ..11.50.... ...18.60 110258-91 ... . USB/RS485 Converter, ready made module ..22.20.... ...35.90 J2B: Universal MMI Module using ARM Cortex-M3 050176-74... . Enclosure Bopla Unimas 1 60 ....8.85.... ...14.30 110274-71 ... . Tested PCB with LPC1 343 microcontroller, crystal, 3V3 voltage regulator, LCD interface & USB interface mounted. LED and headers ..35.00.... ...56.50 110274-72... . LC-display 4x20 characters (HD44780 compatible) ....8.90.... ...14.40 V J Bestsellers ( . C rmtrnllor Ama MohA/nrl/ PrnioH-c i O O CO O C£ I O Q Q U od V/) 1 2 3 4 5 1 2 3 4 Controller Area Network Projects ISBN 978-1 -907920-04-2 .... £29.50 US $47.60 31 1 Circuits ISBN 978-1 -907920-08-0 .... £29.50 US $47.60 Design your own PC Voice Control System ISBN 978-1 -907920-07-3 .... £29.50 US $47.60 Mastering the l 2 C Bus ISBN 978-0-905705-98-9.... £29.50 US $47.60 Linux - PC-based measurement electronics ISBN 978-1 -907920-03-5 .... £29.50 US $47.60 CD 1001 Circuits ISBN 978-1 -907920-06-6.... £34.50 US $55.70 DVD Elektor 1 990 through 1 999 ISBN 978-0-905705-76-7 .... £69.00 ...US $1 1 1 .30 DVD Elektor 2010 ISBN 978-90-5381 -267-9.... £23.50 US $37.90 CD ATM1 8 Collection ISBN 978-0-905705-92-7.... £24.50 US $39.60 o 1 2 3 4 5 lektor’s Components Database 6 ISBN 978-90-5381 -258-7 .... £24.90 US $40.20 FT232R USB/Serial Bridge/BOB Art. # 1 1 0553-91 £1 2.90 US $20.90 USB Long-Term Weather Logger Art. # 1 00888-73 £31.10 US $50.20 Improved Radiation Meter Art. # 1 1 0538-71 £35.50 US $57.30 Audio DSP Board Art. # 1 1 0001 -91 £1 1 5.70 ...US $1 86.70 Pico C Meter Art. # 1 00823-71 £73.40 ...US $1 1 8.4Q/ Order quickly and securely through www.elektor.com/shop or use the Order Form near the end of the magazine! Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH • United Kingdom Tel. +44 20 8261 4509 Fax +44 20 8261 4447 Email: order@elektor.com elektor 12-2011 Personal Download for I © Elektor 83 COMING ATTRACTIONS NEXT MONTH IN ELEKTOR AC Powerline Frequency Meter The frequency of the AC grid voltage is nominally 50 Hz or 60 Hz. The actual value varies a little, depending on energy supply and consumption. With an accurate measurement of the frequency you can determine what’s happening on your local power grid. This handy ‘frequency magnifier’ can detect even the smallest changes due to peak load instants like everyone in the UK plugging in the kettle after EastEnders. Andropod Android devices are ideally suited to use in conjunction with embedded electronics. For little money they offer access to a display, computing, various interfaces and sensors. The big problem however is to pinpoint the connectivity between the Android device and the hardware connected to it. The Elektor Andropod was developed specifically with that in mind: it’s an Android USB interface with host functionality Digital VU Meter In Party of our DSP course, the DSP board gets combined with an LED VU meter. This setup enables the levels of two digital audio signals to be visualised with great accuracy. The VU meter employs special LED driver ICs from Texas Instruments and has a display made from 2x40 LEDs. If you think that’s not enough, you can simply connect multiple boards in series. Article titles and magazine contents subject to change; please check the Magazine tab on www.elektor.com Elektor UK/European January 2012 edition: on sale December 75, 2077. Elektor USA January 2012 edition: published December 7 2, 2077. w.elektor.com www.elektor.com www.elektor.com www.elektor.com www.elektor.com wv Elektor on the web Also on the Elektor website: • Electronics news and Elektor announcements • Readers Forum • PCB, software and e-magazine downloads • Time limited offers • FAQ, Author Guidelines and Contact All magazine articles back to volume 2000 are available individually in pdf format against e-credits. Article summaries and compo- nent lists (if applicable) can be instantly viewed to help you positively identify an article. Article related items and resources are also shown, including software downloads, hyperlinks, circuit boards, programmed ICs and corrections and updates if applicable. In the Elektor Shop you’ll find all other products sold by the publishers, like CD-ROMs, DVDs, kits, modules, equipment, tools and books. A powerful search function allows you to hAl search for items and references across the entire website. EAGLE PCB Software hfo-maKfitof. liiyi-.l E'V- ■ Buy rmi/ij -rmd get your upgrade for E WjZm 1 JEl' L lkh- 1*1 -g*-£ fTMTit i-Mi 1 it *m= 4 i km* 1 L"«M *■ E®flA ■ i l-h ijftifY Lift Mn fc an brew? Li I" J TTLIUrt inCHI Q hlbwH &P i cnlfr i£.j. t* E'feneu -j •‘T-Pi if ritlssr L r*z ti S.h#p-p: i^a rm*J (rimn, nnniifiM r'-t i i r j : tTb i c '■ u [MicaiifeT Pr&grj mmi ig f mb+ddcdl PIT MIe 1 ;!( anil i: li*ri Vt£TE H Jii- m gruSdfl rt-uPpctvrP Pi i^v Her J *-s atamjear i«rw«wi.' NEW POOH 111 Cnulla C*ururn jiu ftf* fhvpnfl H A versatile (vbCfnrm fmr FREE WEBINAR E D! rah*, Tailor S'* StC CionTtfip-is C&BA n f w -efjgg New 3 i, .3. JO] I 84 Personal Download for I © Elektor i2-20iie lektor Description Price each Qty. Total Order Code 311 Circuits £29.50 Design your own PC Voice Control System £29.50 Controller Area Network Projects £29.50 LabWorX - Mastering the PC Bus £29.50 Linux - PC-based Measurement Electronics £29.50 CD 1001 Circuits £34.50 Sub-total P&P Prices and item descriptions subject to change. The publishers reserve the right to change prices without prior notification. Prices and item descriptions Total paid shown here supersede those in previous issues. E. & O.E. Name Address + Post code METHOD OF PAYMENT (see reverse before ticking as appropriate) □ Bank transfer | Cheque (UK-resident customers ONLY) n visa □ EUROCARD MasterCard Expiry date: Verification code: Please send this order form to* (see reverse for conditions) Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www.elektor.com order@elektor.com Tel. Email Date - - Signature ELI 2 *USA and Canada residents should use $ prices, and send the order form to: Elektor US PO Box 1 80 Vernon CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: order@elektor.com Yes, I am taking out an annual subscription to Elektor and receive the E-book Microcontroller Basics totally free!* (Please fill in your emailaddress below) I would like: MlCROCONTROLlIR Basics Standard Subscription (1 1 issues) I I Subscription-Plus (1 1 issues plus the Elektor Volume 201 1 DVD-ROM + exclusive access to www.elektor-plus.com ) * Offer available to Subscribers who have not held a subscription to Elektor during the last 12 months. Offer subject to availability. See reverse for rates and conditions. Name Address + Post code Tel. Email Date Signature ELI 2 Personal Download for I © Elektor METHOD OF PAYMENT (see reverse before ticking as appropriate) □ Bank transfer j Cheque (UK-resident customers ONLY) n visa □ EUROCARD MasterCard Expiry date: Verification code: Please send this order form to Elektor Reg us Brentford 1 000 Great West Road Brentford TW8 9HH United Kingdom Tel.: +44 20 8261 4509 Fax: +44 20 8261 4447 www. e I e kto r. co m service@elektor.com ORDERING INSTRUCTIONS, P&P CHARGES All orders, except for subscriptions (for which see below), must be sent BY POST or FAX to our Brentford address using the Order Form overleaf. Online ordering: www.elektor.com/shop Readers in the USA and Canada should send orders, except for subscriptions (for which see below), to the USA address given on the order form. Please apply to Elektor US for applicable P&P charges. Please allow 4-6 weeks for delivery. Orders placed on our Brentford office must include P&P charges (Priority or Standard) as follows: Europe: £6.00 (Standard) or £7.00 (Priority) Outside Europe: £9.00 (Standard) or £1 1 .00 (Priority) HOW TO PAY All orders must be accompanied by the full payment, including postage and packing charges as stated above or advised by Customer Services staff. Bank transfer into account no. 4027021 1 held by Elektor International Media BV with The Royal Bank of Scotland, London. IBAN: GB96 ABNA 4050 3040 2702 1 1 . BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident customers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. GCredit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in this magazine. If difficulties in the supply of components are envisaged, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not guaran- tee this time scale for all orders. Returns Faulty goods or goods sent in error may be returned for replacement or refund, but not before obtaining our consent. All goods returned should be packed securely in a padded bag or box, enclosing a covering letter stating the dispatch note number. If the goods are returned because of a mistake on our part, we will refund the return postage. Damaged goods Claims for damaged goods must be received at our Brentford office within 10-days (UK); 14-days (Europe) or 21 -days (all other countries). Cancelled orders All cancelled orders will be subject to a 1 0% handling charge with a minimum charge of £5.00. Patents Patent protection may exist in respect of circuits, devices, components, and soon, described in our books and magazines. Elektor does not accept responsi- bility or liability for failing to identify such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, diskettes and software carriers published in our books and magazines (other than in third-party adver- tisements) are copyright and may not be reproduced or transmitted in any form or by any means, including photocopying and recording, in whole or in part, without the prior permission of Elektor in writing. Such written permission must also be obtained before any part of these publications is stored in a retrieval system of any nature. Notwithstanding the above, printed-circuit boards may be produced for private and personal use without prior permission. Limitation of liability Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in connexion with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser any money paid in respect of the goods. Law Any question relating to the supply of goods and services by Elektor shall be determined in all respects by the laws of England. January 201 1 SUBSCRIPTION RATES FOR ANNUAL SUBSCRIPTION United Kingdom & Ireland Standard £52.50 Plus £65.00 Surface Mail Rest of the World £67.00 £79.50 Airmail Rest of the World £84.50 £97.00 USA & Canada | Seewww.elektor.com/usaforspecialoffers | HOW TO PAY Bank transfer into account no. 4027021 1 held by Elektor International Media BV with The Royal Bank of Scotland, London. IBAN: GB96 ABNA 4050 3040 2702 1 1 . BIC: ABNAGB2L. Currency: sterling (UKP). Please ensure your full name and address gets communicated to us. Cheque sent by post, made payable to Elektor Electronics. We can only accept sterling cheques and bank drafts from UK-resident cus- tomers or subscribers. We regret that no cheques can be accepted from customers or subscribers in any other country. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through our website is SSL-protected for your security. SUBSCRIPTION CONDITIONS The standard subscription order period is twelve months. If a permanent change of address during the subscription period means that copies have to be despatched by a more expensive service, no extra charge will be made. Conversely, no refund will be made, nor expiry date extended, if a change of address allows the use of a cheaper service. Student applications, which qualify for a 20% (twenty per cent) reduction in current rates, must be supported by evidence of studentship signed by the head of the college, school or university faculty. A standard Student Subscription costs £42.00, a Student Subscription-Plus costs £54.50 (UK only). Please note that new subscriptions take about four weeks from receipt of order to become effective. Cancelled subscriptions will be subject to a charge of 25% (twenty-five per cent) of the full subscription price or £7.50, whichever is the higher, plus the cost of any issues already dispatched. Subsciptions cannot be cancelled after they have run for six months or more. Personal Download for I © Elektor January 201 1 dsPIC/PIC24-Bundle Advantageous hardware/software solution for rapid project development This solution is perfect for anyone wanting to develop systems based around Microchip’s powerful 16 bit core products. The pack is supplied with a dsPIC30F2011 device, and is fully compatible with the full range of E-block boards and accessories. Datasheets on each individual item are available separately. Contents: • Flowcode 4 for dsPIC/PIC24 (Professional Version) • USB dsPIC/PIC24 Microcontroller Multiprogrammer • LCD Board • LED Board • Switch Board • Plug top power supply • USB cable Bundle Price: Only £299.00 Order now at www.elektor.com/dspic-bundle 15% DISCOUNT to the sum of the individual parts! Index of Advertisers AudioXpress BAEC, Showcase Beta Layout CS Technology, Showcase DesignSpark chipKIT™ Challenge Easysync, Showcase Elnec, Showcase Eurocircuits EzPCB/Beijing Draco Electronics Ltd First Technology Transfer Ltd, Showcase . . . FlexiPanel Ltd, Showcase Future Technology Devices, Showcase Flameg, Showcase FlexWax Ltd, Showcase Jackaltac Labcenter www.cc-webshop.com 47 http://baec. tripod, com/ 78 www.pcb-pool.com 19,78 www.cstech.co.uk/picdemo 78 www.chipkitchallenge.com 15 www. easysync -ltd. com 78 www.elnec.com 78 www.eurocircuits.com 23 www.v-module.com 31 www.ftt.co.uk 78 www.flexipanel.com 78 www. ftdichip. com 78 www.hameg.com 78 www.hexwax.com 78 www.jackaltac.com 11 www.labcenter.com 88 Maxbotix, Showcase Microchip Minty Geek, Showcase MikroElektronika Pico Technology Quasar Electronics Robot Electronics, Showcase. Robotiq, Showcase Schaeffer AG Showcase Tyder, Showcase Virtins Technology, Showcase www.maxbotix.com 79 www.microchip.com 2 www.mintygeek.com 78 www.easypic7.com 3 www.picoscopemso.com/3114 19 www.guasareiectronics.com 13 www.robot-electronics.co.uk 79 www.robotig.co.uk 79 www.schaeffer-ag.de 19 78, 79 www.tyder.com 79 www. virtins. com 79 Advertising space for the issue 17 January 2012 may be reserved not later than 19 December 2011 with Elektor International Media - Allee 1, 6141 AV Limbricht, the Netherlands Telephone 0031 (0) 46 4389444 - Fax 0031 (0) 46 4370161 - e-mail: advertenties@elektor.com to whom all correspondence, copy instructions and artwork should be addressed. elektor 12-2011 Personal Download for I © Elektor 87 WITH PRDTEU5 PCB DESIGN Our completely new manual router makes placing tracks quick and intuitive. During track placement the route will follow the mouse wherever possible and will intelligently move around obstacles while obeying the design rules. All versions of Proteus also include an integrated world class shape based auto-router as standard. PROTEUS DESIGN SUITE Features: ■ Hardware Accelerated Performance. ■ Board Autoplacement & Gateswap Optimiser. ■ Unique Thru-View™ Board Transparency. ■ Direct CADCAM, ODB++, IDF & PDF Output. . Over 35k Schematic & PCB library parts. ■ Integrated 3D Viewer with 3DS and DXF export. ■ Integrated Shape Based Auto-router. ■ Mixed Mode SPICE Simulation Engine. ■ Flexible Design Rule Management. ■ Co-Simulation of PIC, AVR, 8051 and ARM7. . Polygonal and Split Power Plane Support. ■ Direct Technical Support at no additional cost. Prices start from just £150 exc. VAT & delivery Visit our website or phone 01756 753440 for more details Labcenter Electronics Ltd. 53-55 Main Street, Grassington, North Yorks. BD23 5AA. Registered in England 4692454 Tel: +44 (0)1756 753440, Email: info@labcenter.com Personal Download for I © Elektor