October 2012 AUS$ 14.90 - NZ$17.90 - SAR 105.95 " NOK102 £4.90 www.elektor.com + USB Isolator Avoid interference and earth loops + Vocal Annunciator How about making your next project speak? + Intelligent PC Fan Controller Control, monitor & configure a maximum of six PWM fans Radiation, Meter Reloaded More sensors, more readout options 770268 451 73 1 0 9 THE ORIGINAL SINCE 1994 PCB-PnOL' PCB Prototypes and small series % FREE Stencil with every PCB Prototype order Discount Evaluate 5 orders and get 10% off Free Phone UK: 0800 389 8560 sales^pcb-pool.com www.pcb-pool.com - Bela LAYOUT create : electronics eSTnRE HI Beta LAYOUT Develop, assemble, solder Reflow-Controller UHF RFID Starterkit Basic Arduino Mega (ATMega 1280-I6AU) compatible www.beta-eSTORE.com LAYOUT create : electronics $ 41 90 $2goo $2ioo SOCKET boards JTliHfO BUS PwM Just place the Click " board you need into the innovative new mikroBUS" socket and it's ready to work right away. Adding new functionality to your device was never so easy. Opto chfck LJB r? rci < j . id ?s nni 30 vn V03W0 i * MikroElektronika DEVELOPMENTTOOLS I COMPILERS I BOOKS WWW.NbStOCk.COITI GET IT NOW www.mikroe.com NOTE: Two 2x8 male headers are included in the package with each click board. By the time you read this, we might already have released more than 30 Click boards. Check out our website for more information. Looking forward to being inundated (again) Here at Elektor we get the numbers all wrong occasionally. Although we’re perfectly able to calculate, say, bit time offsets to less than a microsecond using C, or Johnson noise levels in an NE553 opamp, we were horribly wrong with our guess- timate of the interest in our Embedded Linux article series. But happy to be wide off the mark! Let me explain. On Friday August 17, while working from my home on a new book called LabworX 2: Mastering Surface Mount Technology, I wanted to correct a small bit of text somewhere on the elektor.com website using my administrator rights. Now I have a pretty slow PC at home, but this time the backoffice login procedure seemed to take so long I decided to do a small inspec- tion round of my garden. On returning to my desk, I was greeted by error message -392a on the screen basically saying some- thing was overloaded. Then the telephone rang (it hardly ever does that) and our editorial secretary told me to sort-of- instantly write and email a short message telling customers that our Webserver had been on 404 due to a flood of requests for an archive file that belongs with our recent Embedded Linux series. The problem was fixed almost instantly by moving the archive file to another area with capacity to spare. Apologies to all of you Linux fans and all other Elektor readers seeing 404s and having to wait a while for the file to become available. We have adapted the kernel (read all about it in this edition!), and fitted a pressure release valve on our Webserver. Happy reading, Jan Buiting, Managing Editor 6 Colophon Who’s who at Elektor. 8 News & New Products A monthly roundup of all the latest in electronics land. 14 USB Isolator This little circuit provides electrical isolation of data lines and supply lines between the PC and the USB device. 18 Embedded Linux made Easy (4) This month we delve deep into the various commands and options offered by the kernel. 28 Thou Shalt Communicate! Here’s a Platino and Arduino compatible shield that packs Wi-Fi, Bluetooth and USB on a single board. 34 AVR Software Defined Radio (6) In this instalment we discuss the time encoding format applied on the BBC Droitwich transmitter on 198 kHz. 40 Picoammeter This little instrument was designed to cover those infinitesimally small currents between 0.1 pico-ampere toi micro- ampere. 43 E-Labs Inside: - Shifting RS485 Grounds - AVR reset-out-of-the-blue issue - E-pollution! - Your all-time favourite component 46 Energy Harvesting with the LTC3108 & LTC3588-1 Raymond’s pick of the month in terms of components 4 10-2012 elektor CONTENTS Volume 38 October 2012 no. 430 14 USB Isolator If your USB device ever suffers from noise caused by an earth loop or if you want to protect your PC against external voltages then you need a USB isolator. The circuit described here offers an optimal electrical isolation of the data lines as well as the supply lines between the PC and the USB device. 28 Thou Shalt Communicate! You may have a Facebook account, but what about your oscilloscope? Does your multimeter tweet enough? Is your soldering iron linked in? You may be a non-communicative nerd but your bench power supply may be craving for social interaction. With the add-on board described in this article you can hook up anything to everything, with or without wires. 54 Radiation Meter Reloaded Elektor’s Simple Radiation Meter is currently being used by many readers, mainly in making long-term measurements and in investigating weakly radio- active samples. There are several ways in which we can modify and improve the design, and we look here at a few examples. 48 Arduino on Course (2) No matter where your sensors are on the globe, you will be able to read them using Arduino functionality extended with GSM / GPRS. 54 Radiation Meter Reloaded Elektor’s simple radiation meter keeps evolving, both at the front end (the sensors) and the user end (enter the PC!) 60 Electronics for Starters (8) This series has met with great popularity with young & old. This month we tackle the basics of audio amplification. 64 Vocal Annunciator Wouldn’t it be great to have a measurement system read outvalues aloud? Here’s how. 68 Intelligent PC Fan Controller This circuit allows six (PC) fans to be controlled, configured and monitored with a good deal of intelligence. 76 Retronics: Marconi Instruments TF801D/1 AM RF Signal Generator. An RF signal generator built like rock and still working great after 50 years. Series Editor: Jan Buiting 68 Intelligent PC Fan Controller With the help of the circuit described here you can actively control up to six fans, while the temperature can be measured in various places inside the PC case using a number of sensors. A PC program is used to configure and monitor the fans, which communicates with the fan control board via a USB link. 78 Hexadoku Elektor’s monthly puzzle with an electronics touch. 84 Coming Attractions Next month in Elektor magazine. elektor 10-2012 5 ELEKTOR The Team Managing Editor: International Editorial Staff: Design staff: Membership Manager: Graphic Design & Prepress: Online Manager: Managing Director: Jan Buiting (editor@elektor.com) Harry Baggen, Thijs Beckers, Eduardo Corral, Wisse Hettinga, Denis Meyer, Jens Nickel, Clemens Valens Thijs Beckers, Ton Giesberts, Luc Lemmens, Raymond Vermeulen, Jan Visser Raoul Morreau Giel Dols, Mart Schroijen Danielle Mertens Don Akkermans The Network Tech the Future explores the solutions for a sustainable future provided by technology, creativity and science. CIRCUIT CELLAR i hi f ouk' -• ! '-'v-! -:.i : ; l : ihonics l isSit.l i ki»C m "fwation VOICED COIL Our international teams United Kingdom Wisse Hettinga +31(0)464389428 w.hettinga@elektor.com Spain Eduardo Corral +34 91101 9395 e.corral@elektor.es India Sunil D. Malekar +9 1 9833168815 ts@elektor.in USA Hugo Vanhaecke +1 860-875-2199 h.vanhaecke@elektor.com Italy Mauriziodel Corso +39 2.66504755 m.delcorso@inware.it Russia Nataliya Melnikova + 7 ( 965)3953336 Elektor.Russia@gmail.com Germany Ferdinand te Walvaart +31 46 4389417 f.tewalvaart@elektor.de Sweden Wisse Hettinga +31 46 4389428 w.hettinga@elektor.com Turkey Zeynep Koksal +90532 2774826 zkoksal@beti.com.tr U France Denis Meyer +31 46 4389435 d.meyer@elektor.fr Brazil Joao Martins +551141950363 joao.martins@editorialbolina.com South Africa Johan Dijk +27 78 2330 694 / +31 6 109 31 926 j.dijk@elektor.com Netherlands Harry Baggen +31 46 4389429 h.baggen@elektor.nl Portugal Joao Martins +351 21413-1600 joao.martins@editorialbolina.com China Cees Baay +86 21 6445 2811 CeesBaay@gmail.com Volume 38, Number 430, October 2012 ISSN 1757-0875 Publishers: Elektor International Media, 78 York Street, London WiH iDP, United Kingdom. Tel. +44 (0)20 7692 8344 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. Subscriptions: Elektor International Media, 78 York Street, London W1H1DP, United Kingdom. Tel. +44 (0)20 7692 8344 , fax: +31 (0)46 43 70 161 Internet: www.elektor.com/subs Email: subscriptions@elektor.com Rates and terms are given on the Subscription Order Form. Head Office: Elektor International Media b.v. P.O.Box 11 NL-6114-ZC Susteren The Netherlands. Telephone: +31 (0)46 4389444, Fax: (+31) 46 4370161 Distribution: Seymour, 2 East Poultry Street, London ECiA, England. Telephone:+44 (0)20 7429 4073 UK Advertising: Elektor International Media b.v. P.O.Box 11 NL-6114-ZC Susteren The Netherlands. 6 10-2012 elektor ELEKTOR Membership Counter We now have members in countries. Not a member yet? Sign up atwww.elektor.com/member Supporting Companies Jatfaiaaci AudioXpress www. audioamateur, com Beta Layout www.pcb-pool.com . . . 59 2 CES www.cesweb.org Eurocircuits www. elektorpcbservice. com EzPCB www.siliconray.com 27 Jackaltac www.jackaltac.com 9 7! TFamrmj pram 47 W7 NATIONAL ^INSTRUMENTS pied 42 T * 27 fS reichelt ' ui iik Labcenter www. labcenter. com MikroElektronika www.mikroe.com. . 88 National Instruments www.ni.com/daq 13 Pico Technology www.picotech. com /CM 124 41 Reichelt www. reichelt. co.uk 11 Not a supporting company yet? Contact Johan Dijk (j.dijk@elektor.com, +31 6 1 09 31 926) to reserve your own space for the next edition of our members' magazine Telephone: +31 (0)46 43 89 444, Fax: +31 (0)46 43 70 161 Email: j.dijk@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 and 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 Publishers 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. 2012 Printed in the Netherlands elektor 10-2012 7 NEWS & NEW PRODUCTS New digital advanced bus converter lowers power consumption Ericsson has unveiled the first model in its second generation of digital Advanced Bus Con- verter (ABC) products. Based upon the FRIDA II platform, which was announced earlier this year, the Ericsson BMR456 3E Advanced Bus Converter delivers unprecedented performance to system architects who are developing equipment for ICT (Information and Communica- tion Technology) applications that require fast response time, tightly regulated intermedi- ate bus voltages and high efficiency at any point of operation to reduce power consumption. This new generation of fully regulated digital DC/DC converters is based on a 32-bit ARM microcontroller that embeds the family’s most advanced firmware to date. The FRIDA II firmware has been developed by Ericsson to guarantee the highest possible performance at any point of operation from low load to high load, and to handle line transients, such as those occurring in ATCA (Advanced Telecommunications Computing Architecture) applica- tions when, for example, switching from Feed A to Feed B. Designed to power telecom and datacom applications, the BRM456 is available in two input voltages ranges: 36 V to 75 V, delivering output power of 420 W; and 40 V to 60 V, deliver- ing output power up to 468 W. Output voltage can be adjusted across a range from 4.0 V to 13.2 V via PMBus commands, making the BMR456 suitable for Dynamic Bus Voltage opera- tion resulting in the reduction of energy consumption when com- munication data traffic is low. In addition, taking full advantage of a highly optimized layout and firmware-optimized parameter switching to reduce power losses, the BMR456 delivers a typical efficiency of 96.5% and exhibits flat curve behavior from 1 4% to 1 00% load, positioning the product as the most efficient Advanced Bus Converter in its category. Designed for flexibility and high-power applications, when connected in parallel, the Droop Load Sharing (DLS) ver- sion of the BMR456 telecom (36-75 V) and datacom (40-60 V) versions can deliver 756 W and 842 W, respectively. The BMR456 implements the FRIDA II firmware, called the ‘Ericsson DC/DC Energy Opti- mizer’, which combines advanced Ericsson Intellectual Property (IP) together with a series of industry-first functionalities to continually optimize switching parameters and reduce energy consumption to an absolute minimum. The firmware is not just limited to energy management, but includes an enviable number of features including the ability to han- dle input voltage transients with slew-rates of up to 0.5 V/ps, while keeping the output voltage within ±1 0% and ensuring that the output voltage does not trigger over-voltage protection. It also offers the highly efficient management of pre-bias start-up operation and a fully controlled shutdown process, avoiding voltage spikes that could cause an avalanche condition in the secondary-side synchronous rectification MOSFET, thereby contributing to improved reliability. The BMR456 meets the insulation requirements of EN60950, sustains an I/O isolation volt- age of 2250 VDC, and also offers an extensive set of capabilities and features such as: remote sensing; PMBus-configurable protection (over-temperature, over-current and over-voltage); configurable start/stop; precision delay ramp-up; voltage margining; configurable fault response; power good; and extensive power management programmability. The BRM456 is fully backward compatible with Ericsson’s previous generation of Advanced Bus Converters. The device’s I/O connector has been designed to guarantee full alignment and co-planarity using different soldering processes for both through-hole and surface- mount assembly. In addition to the mechanical benefits, the Ericsson Advanced Bus Con- verter footprint offers the necessary flexibility for further board design evolution and the addition of new features currently under evaluation within the ICT industry. www.ericsson.com/powermodules - (120487-IX) JTAG development system using WiFi The Debug Store is proud to announce the availability of the Macraigor Systems WiFiDemon in Europe. Priced at just £1 475, the WiFiDemon is in stock and ready to ship. The WiFiDemon is Macraigor’s fastest and most versatile OCD interface device for use in the design, debugging and programming of microprocessor and microcontroller based embedded systems. The WiFiDemon can be connected to the host PC via a 10/100 BaseT Ethernet or WiFi connection allowing the developer to con- trol the debugging operation some distance from his desk — in fact he can be located across the globe! The WiFiDemon supports configurable JTAG/BDM clock rates from 4.5 kHz to 24 MHz, allowing very fast code download and responsive debugging. The WiFiDemon is fitted with a 40 GB hard drive, two USB ports (to connect a mouse and keyboard) and a VGA port to connect a monitor. The development tools pre-loaded onto the hard drive can be run on the system allowing development work to be carried out locally —this makes it ideal for use in the field. www.thedebugstore.com - (120487-XI) RFID SMT antenna with comprehensive protection for automotive applications PREMO launches a new family of its TP0702 standard, universally adopted by the indus- try. This format provides up to 50 mV/ App / m (for 7.2 mH) sensitivity which gives it the best sensitivity in this transponder size. The new TP0702U and TP0702UCAP is an SMD antenna for low frequency 20 kHz- 1 50 kHz receiver applications. TP0702UCAP provide an upper and lateral side protection with co-polyamide polyhexamethylene pol- ymer walls, gamma radiated with high ther- mal stability (supports up to 290 g C) and 8 10-2012 elektor NEWS & NEW PRODUCTS mechanical resistance (exceeds 1 50 Mpa of mechanical strength). This antenna features a NiZn ferrite core with high surface resistivity (>1 0 MO/mm) that provides a highly stable behavior (bet- ter than ±3%) over a wide temperature range (-40 9 C to 1 25 g C). The new TP0702UCAP is particularly suita- ble for applications such as TPMS (Tire Pres- sure Monitoring Systems) which requires an excellent performance under extreme con- ditions, according to AEC-Q200 and addi- tional requirements as EU regulations. PREMO offers four standard values, 2.38 mH, 4.91 mH, 7.2 mH and 9 mH at 1 25 kHz. Other inductance values and frequencies, from 340 pH to 1 8.5mH, are available upon request. A surface mount (SMT) device, the new antenna allows easy use in the automated process of mounting circuit boards, thus eliminating any manual handling. www.grupopremo.com - (120487-IV) Rotary position sensor ensures accurate measurement at very high rotation speeds ams, a leading worldwide designer and man- ufacturer of high performance analog ICs for consumer & communications, industry & medical and auto-motive applications, today launched the AS5132, a magnetic rotary position sensor 1C offering accurate angu- lar measurement even at very high rotation speeds, ams is the new name of austriami- crosystems, following the 201 1 acquisition of optical sensor company TAOS Inc. The AS5132 is a system-on-chip, combin- ing integrated Hall elements, an analog front end and digital signal processing in a single device. It is particularly well suited to industrial and automotive brushless DC (BLDC) motors, where it offers designers a small, robust and easily assembled posi- tion sensing solution. It is highly resistant to interference from stray magnetic fields. The new device improves on previous gen- erations of magnetic encoder by dynami- cally compensating for angle errors attrib- utable to propagation delay, which are most noticeable at high speeds. Error compensation is achieved through integrated pre-commutation functions. These are very easy to configure in the AS5132, and do not require external soft- ware routines to be executed, therefore unburdening host microcontrollers or elec- tronic control units (ECUs). The configu- ration can be changed while the device is operating, in response to changes in oper- ating conditions such as variations in rota- tion speed. In addition, the advanced signal-processing circuitry in the AS51 32 gives it an excellent propagation delay figure of <22 ps, which means that even before pre-commutation is implemented the angle error is small. In combination, the small propagation delay and advanced pre-commutation deliver extremely accurate angle measurement even in motors rotating at speeds up to 80,000 rpm: angle measurements are accu- rate to within ±3° (maximum). This enables BLDC motor manufacturers to achieve high and constant levels of torque even in high- speed applications over the whole dynamic range. Other improvements introduced in the AS5132 include: • increased sensitivity to allow opera- tion in a magnetic field input as weak as 20 mT. This enables the sensor to be paired with a cheap ferrite magnet. • simplification of the interface for easier integration. • inclusion of an external clock mode, synchronizing sensor and controller systems. • implementation of a 3 V interface mode (in addition to a 5 V mode) eliminating the need for a level shifter. When paired with a simple two-pole mag- net, the AS5132 provides absolute angle measurement at a resolution of 8.5 bits, or 360 positions per revolution. This measure- ment is available as a serial output and as a pulse width modulated (PWM) signal. An additional U,V,W output can be used for block commutation in a BLDC motor; alter- natively an incremental signal (ABI) is avail- able. In addition to the angle information, the strength of the magnetic field is repre- sented as a 5-bit value. The zero position can be set by software on the production line. This simplifies assem- bly, as the magnet does not need to be pre- cisely aligned with a fixed starting position. The AS5132 is suitable for contactless rotary position sensing, rotary switches (human machine interface), AC/DC motor position control and BLDC motor position control in automotive applications such as pump BLDC motors (stop-start system) and steering column BLDC motors. The AS51 32 is also particularly well suited to position sensing in double-clutch BLDC motors. A demonstration board for the AS5132 rotary position sensor is available. Contact ams for the price. For further information on the AS51 32 or to request samples, please visit www.ams.com/eng/Products/ Magnetic-Encoders/Rotary-Encoders/ AS5132 www.ams.com - (120487-X) Advertisement PCBs Muuuuch Cheape No-frills policy 17.22 EURO 5 pcbs, 1 00 mm x 1 00 mm ♦per piece, incl. UflT (23%) + shipping costs e. g. Germang 1 0.89 EURO * JacKaltac ujLULU.jackaltac.com elektor 10-2012 9 NEWS & NEW PRODUCTS SPI real-time clock/calendars in smaller, 10-pin packages Microchip recently announced the expansion of its stand-alone Real-Time Clock/Calendar (RTCC) portfolio with the new 10-pin, SPI MCP795XX fam- ily. These new devices offer many of the same features as the larger 1 4-pin MCP795WXX family, including supe- riortimekeeping performance. Reducing overall component count in the system and eliminating the user programming costs for a serial ID make the MCP795XX RTCC family an ideal choice for the handheld, wireless and consumer markets. By including 64 bytes of SRAM, 2 Kbits of EEPROM and a 1 28-bit Unique ID, which can be ordered blank or preprogrammed with a MAC address, extra memory devices may not be needed. Utility power meters, manufacturing equipment, radios, GPS and hospital instrumenta- tion applications that need accurate time over a broad temperature range will also benefit from the very wide digital trim- ming range, which can compensate up to 22 seconds per day for crystal frequency drift. Digital trimming improves the timekeeping accuracy of RTCCs, and a wide digital trim- ming range provides customers with high accuracy over a large temperature range. Accurate timekeeping is also supported at a decreased power-consumption level, because digital trimming is maintained when the MCP795XX is operating from backup power on the VBAT input. Additionally, these devices join the industry’s only portfolio to distinctively offer a battery-backed RTCC with both power-fail and power-restore timestamps plus three types of non-volatile memory: EEPROM, SRAM and a Unique ID. When the time and duration of power failures need to be logged, the MCP795XX fam- ily can accomplish this without adding any circuitry by using the on-chip power-fail timestamp feature, which is not offered by any other SPI RTCC on the market. With long battery life at a premium, applications such as wireless, portable communications, security and automotive can benefit from the 5 MHz SPI bus and millisecond alarm. This high-resolution alarm output provides a greater degree of control over the duty cycle needed to support longer MCU sleep and power-down modes. http://www.micr0chip.com/get/0CX3 - (120532-I) Lossless Extended Range Synchronized (LXRS™) Wireless Sensor Networks MicroStrain’s new “lossless” wireless com- munication protocol (patent pending) sup- ports scalable networks of high speed sen- sor nodes without data loss due to tempo- rary radio frequency (RF) fading, multipath, or interference. MicroStrain’s users have previously enjoyed a typical RF packet success rate of 99% — not bad. But now, with MicroStrain’s new LXRS “lossless” protocol, wireless sen- sor networks can deliver 100% reliable data throughput under most operating conditions. The new LXRS™ Wireless Sensing Sys- tem (microstrain.com/what-is-LXRS?) includes: Lossless wireless communication protocol providing 100% packet success rate under most operating conditions Extended Range radio link to 2 kilometers Scalable wireless sensor networks support- ing continuous, burst, and hybrid sampling modes Time Synchronized to ±32 microseconds The LXRS™ Wireless Sensing System works by leveraging an advanced bi-directional radio communication protocol. When data are received without errors by the WSDA base station, the WSDA sends an acknowledgement that these packets were received. Data that are not acknowledged remain within each LXRS sensor node’s non- volatile memory for scheduled re-transmis- sion without reducing the overall system bandwidth. Each wireless node in the network has its own precision timekeeper and maintains time synchronization to within ±32 micro- seconds. Data are time-stamped by each node at the time of analog-to-digital (A/D) conversion. Therefore, even when re-trans- mitted, all data are accurately time stamped and aggregated into a masterfile using time as a unifying variable. This enables highly reliable data collection from scalable networks of wireless strain, acceleration, torque, force, temperature, etc. to be collected without loss of informa- tion. This is particularly useful when work- ing in harsh operating environments, when the system may be subject to periodic RF interference, and when the experiment or test is very difficult to set-up or very expen- sive to replicate. Synchronized data collection, combined with robust and reliable LXRS data acquisi- tion, allows users to select lower sampling rates and reduced RF power levels. This leads to longer battery lifetimes and also enables energy harvesters to be used in place of primary batteries. www.microstrain.com - (120532-II) 10 10-2012 elektor * reichelt i .co.uk '- an* elektronik '«* *• J^5? ^ /K more than 40 years experience more than 40000 products in stock no minimum order charge ■y fast 24 hour shipment r +49 ( 0)4422 955-333 ■j ’ ^+49 ( 0)4422 955-360 Components Made in Germany! DIAMEX PR0G-S 50 (~ £16,90) 21 , Multi-talented ISP programmer for three programming modes Programs the popular AVR, STM32, NXP and LPC microcontroller Functions: • FLASH • EEPROM • Fuse bits • Write lock bits • read • Read OSCCAL registry • Chip erase USB-ISP-Programmer DIAMEX USB ISP 19 95 ~ £15,68) Extremely economical ISP Programmer for ATMEL processors that can be programmed using the simple SPI interface. Noteworthy is the designated on-board processor with specifically developed firmware that enable extremely fast programming cycles. AVR STK 500, AT Mega, AT Tiny, AT 90 DIAMEX ALL AVR 9Q 50 £23,19) DIAMEX ALL-AVR is a USB programming adapter that can be used for programming the popular AVR- Controllers by ATMEL. AT 90, AT Mega, AT Tiny, ATX Mega Workshop supplies Measurement technology Power supply UTD 2052 CEL UNI - 1 oqqoo £235,01) 2-channel storage oscilloscope Storage oscilloscope with excellent performance data, extra large back-lit colour display and USB interface for the export of the measuring results to the PC/notebook. • Bandwidth: 50 MHz • Rise time: <7 ns • Sample Range: 1 GS/s UNI-T Digital multimeter 22000-Count-Display Measuring device with high accuracy, analogue bar graph and Low-Bat-Display. UT 61 E 79 95 J (- £62,84) RMS measurement Diode test Through buzzer Data-Hold *MIN/MAX REL function Peak value function USB interface Safety: Cat II 600 V, CAT III 300 V La* aS INI I lllll I INI I INI I HIM I INI I INI I HIM I INI I INI I lllll I INI I INI 1 1 INI I INI I INI 1 1 INI I INI I INI 1 1 INI I INI I III AC voltage tester 90-1000 VAC • Safety: EN 61010-1, CAT • acoustic/visual signal 1000 V • integr. torch • incl. batteries PEAKTECH 1030 Professional quality discount prices! Network & PC Technology Plug connector Sat and TV Technology CONNECTING THE WORLD Neutrik Speaker • For professional stage / loudspeaker technology • Easily lockable through Quick-Lock System • Touch-proof contacts Cable connector with screw connection NEUTRIK NL-2FC 3,15 (~ £2,48) 2 -pole NEUTRIK NL-4FC 5,40 (~ £4,24) 4 -pole Chassis socket • For 2 and 4 pole cable connectors • Faston connection 4.8 mm NEUTRIK NL-4MP 1,80 (~£i,4i) All HF connectors under: http://rch.lt/4W for example UG 88U-C59 0,28 (~ £0,22) RG 59 All pin connectors http://rch.lt/4X for example PFL10 0,08 (~ £ 0 , 06 ) io All D-Sub connectors under: http://rch.lt/4Y for example D-SUB BU 09 D-SUB BU 25 0,12 (~ £0,09) 0,26 (~ £0,20) All D-Sub solid metal hoods http://rch.lt/4Z for example KAPPE EMV 09 1,90 (~ £1,49) KAPPE EMV 25 1,95 (~ £1,53) For consumers: The statutory right of withdrawal for consumers shall apply. All stated prices in € include the legal value added tax, ex works Sande, plus forwarding charges for the entire shopping cart. Our general terms and conditions shall apply exclusively (under www.reichelt.de/agb in the catalogue or on request). Subject to prior sale. All product names and logos are property of the respective manufacturers. Images can be similar. Subject to misprint, errors and changes in prices. reichelt elektronik GmbH & Co. KG, Elektronikring 1 , 26452 Sande (HRA 200654 Oldenburg) Daily rates! - Price level: 15.8.2012 international payment via PayPal NEWS & NEW PRODUCTS Low-pressure-drop digital flow meter Swiss sensor manufacturer Sensirion is launching the new digital SFM3000 mass flow meter for high-volume applications in medical devices, process automation and burner control. The flow channel is designed to achieve a very low pressure drop of less than 3mbar through the sensor element. The flow meter bi-directionally measures the flow of air and other non-aggressive gases at rates up to 200 slm with high accu- racy and very high speed. It outputs a 1 4-bit digital signal at a 2 kHz update rate. The sig- nal is internally linearized and temperature compensated. Furthermore, the new mass flow meter operates from a 5 Vdc supply voltage and features a digital 2-wire inter- face, making it easy to connect directly to a microcontroller. The outstanding performance of the SFM3000 gas flow sensor is based on Sen- sirion’s patented CMOSens® Technology, which combines the sensor element, signal processing and digital calibration on a tiny microchip. Gas flow is measured by a ther- mal sensor element to provide an extended dynamic range and enhanced long-term stability compared to other flow measuring technologies. Thanks to the proven CMOS- ens® technology, the flow meter is suited for high-quality mass production and is the ideal choice for demanding and cost-sensi- tive OEM applications in medical ventilation and anesthesia, as well as process automa- tion and burner control. www.sensiri0n.c0m/en/sfm3000 - (120532-V) The Electronics Maze Solved In addition to the annual Jumbo edition of Hexadoku, Elektor’s July & August 2012 edition also featured a rather different type of puzzle: the Maze of the Lost Electronics Technician. Our readers were faced with a maze consisting of passive components: diodes, zener diodes, resistors, coils, capacitors and the odd pushbutton. The challenge was to find the input to which 20 volts had to be applied to make a current flow at the output. Hundreds of readers entered the maze and managed to find the way out successfully. The correct solution was: input 2. The winner of the Electronic Workstation - Desktop worth £800 and a Protostation Advanced Breadboard worth £125, both kindly sponsored by Matrix Multimedia, is: Evan Wasserman of Lakewood, New Jersey, USA. Evan’s estimate of the total number of correct solutions received was closest to the actual figure. Congratulations, your prizes are on the way to you. (120537) 0lektor www.elektor.com 12 10-2012 elektor \ Whatever you're measuring. V we have the solution. From simple to complex applications, nothing can handle your measurements more effectively than the National Instruments data acquisition platform. Whatever your budget, channel count, or performance requirements, its unparalleled high-performance I/O and ability to increase productivity through software measures up to the challenge. This combination can help you balance performance and investment to deliver precision accuracy that is scalable and always trustworthy. Designed for Performance. 01635 517300 » Download The Complete Guide to Building a Measurement System at ni.com/daq uk.ni.com info.uk@ni.com Learn more about Nl LabVIEW or improve your existing skills at 9 locations: uk.ni.com/devdays JOIN THE CONVERSATION: Follow us on Search niukie V NATIONAL ^INSTRUMENTS ©2012 National Instruments. All rights reserved. CompactRIO, LabVIEW, National Instruments, Nl, and ni.com are trademarks of National Instruments. Other product and company names listed are trademarks or trade names of their respective companies. 1684 COMPUTERS USB Isolator Avoid interference and earth loops By Raymond Vermeulen (Elektor Labs) If your USB device ever suffers from noise caused by an earth loop or if you want to protect your PC against external voltages then you need a USB isolator. The circuit described here offers an optimal electrical isolation of both the data lines as well as the supply lines between the PC and the USB device. The project itself is a spin-off from an ear- lier design for a portable oscilloscope for Android. During the development of that project we also encountered the problems of earth loop noise when a charger or PC was connected. But what was the best point where to introduce isolation, the digital USB connection or the analogue section? After some serious analysis we came to the con- clusion that it was better to isolate the USB bus rather than the analogue part. A popular chip from Analog Devices, the ADuM31 60, was chosen to provide the iso- lation of the data lines. It supports both Low and Full speed USB connections. A flyback converter with a LT3575 as controller was used to isolate the power supply. Special 1C The ADuM3160 [1] used in this project, and its bigger brother the ADuM41 60, are, as far as we know, the only dedicated USB isola- tors currently available in the marketplace. These chips can also be found inside most commercially available USB isolators. The chips support Low-speed (1.5 Mbit/s) and Full-speed (12 Mbit/s) USB. According to Specifications • Electrically isolated data and power supply lines • Configurable data rate ofi .5 Mbit/s ori 2 Mbit/s • Power for the device side can be taken from an extra USB host connection or an external AC power adapter (5 V/min. 0.5 A) • Transformer isolation = 1500 V AC for 1 min • ADUM 3160 isolation = 565 V peak for 50 years • Maximum output current l out = 500 mA @ 5 V Figure 1. Internal block diagram ofthe ADuM31 60. A number of monolithic transformers provide the electrical isolation between the two sides ofthe device. M 10-2012 elektor USB ISOLATOR Figure 2. The circuit diagram for the USB isolator. At its heart is a special 1C from Analog Devices (IC2), which provides electrical isolation of the USB signals. Analog Devices the reason why High-speed (480 Mbit/s) USB is not supported is due to the fact that there are currently no digital isolators available that can operate reliably at these high data rates. There are currently no plans to introduce a new 1C for this. In Figure 1 you can see the internal block diagram for the 1C. The combination of high-speed CMOS technology with air core transformers (the iCoupler technology from AD) results in an outstanding isolation between the primary and secondary sides. To detect the direction of the data flow over the USB lines (in order to turn on the appropriate output buffers) the 1C deter- mines the direction based on the contents of received data packets. The propagation delay (the time taken for the received sig- nal to appear at the output) is fairly small despite the stringent isolation require- ments, and is comparable to that found in a standard USB hub. Circuit diagram and power supply You may wonder why the power supply is specifically mentioned in the heading for elektor 10-2012 15 COMPUTERS COMPONENT LIST Resistors (1% 0.1W, SMD 0603, unless otherwise shown) R1 = 1kft1%0.5W (SMD 1206) R2 = 33l<^ R3 = 80.6k£l R4 = 6.04k£l R5 = 200kn R 6 = 90.9l<£2 R7,R8 = 28.7kn R9,R10,R11,R12 = 24£1 R13,R14 = 4.7kn Capacitors Cl ,C2 = 1 0nF 1 6V X7R (SMD 0603) C3 = 220nF 50V X5R (SMD 0603) C4,C5,C6 = 1 20|iF 6.3V (Nichicon RFS- 0J1 21 MCN1 GS, type C) C7,C8,C9,C1 0,C1 1 ,C1 2 = 1 0OnF 25V X7R (SMD 0603) Cl 3, Cl 4, Cl 5, Cl 6 = 1 OjllF 6.3V X5R (SMD 0805) Inductors LI ,L2,L3,L4,L5,L6,L7,L8 = ferrite inductor 33£1@1 00MHz (SMD 0603) e.g. Murata BLM1 8PG330SN1 D L9,L1 0 = 1 jiH 1 .2A (SMD 1 007) e.g. Taiyo Yuden CB2518T1R0M Semiconductors D1 = PMEG3050BEP (NXP) (SOD-128) D2 = PMEG601 0CEH (NXP) (SOD-1 23f) D3,D4 = 5.6V 3W zener diode IC1 = LT3575EFE#PBF (LT) (TTSOP-1 6) IC2 = ADUM31 60BRWZ (AD) (SOICW-1 6) IC3 = NCP380HSN10AAT1G (On Semiconduc- tor) (TSOP-5) IC4JC5JC6 = NCP380HSN05AAT1G (On Semi- conductor) (TSOP-5) IC7JC8 = TPD2EUSB30ADRTR (Tl) (SOT-3) Miscellaneous SI ,S2 = slide switch with changeover contact (e.g. C&K Components PCM1 2SMTR) K1 ,l<2 = USB mini-B-connector, PCB mount (e.g. On-Shore USB-M26FTR) l<3 = DC adapter connector, 1 .35 mm (e.g. CUI PJ-014DH-SMT) l<4 = USB-A connector, PCB mount (e.g. FCI 87583-201 0BLF) TR1 = transformer 3:1 , 25 pH (e.g. Wurth 750310471) Case, Hammond type 1 593KBK 2 self tapping screws, cross head, 4x6.4mm, DIN7981 PCB #120291-1 or assembled and tested board and case, # 120291-91 Figure 3. The dimensions of the board were chosen to fit in a type 1 593KBK case from Hammond. this section. It’s because it plays such a sig- nificant role in this design. The ADuM31 60 can only provide isolation forthe data lines and not for the supply line. You could pro- vide each side of the 1C with its own, sepa- rate power supply. In this case (see Figure 2) we decided to add an isolated switching power supply to the board. This not only provides power for the other half of the 1C, but also provides the maximum permitted current for the USB device connected to it (which is also completely isolated from the input!). To obtain the required 500 mA at 5 V from the output we have chosen a LT3575 fly- back converter from Linear Technology [2]. Remarkably this 1C doesn’t require an opto- coupler for a feedback signal. The converter operates in a so-called boundary mode, where the information regarding the out- put voltage of the secondary inductor is fed back to the primary inductor. This works as follows: When the power switch in the converter turns off, the voltage rises to a level that is equal to: Wlbk = (^OUT + y F + ^SEC X ESR) X N ps where • V F = voltage across diode D1; • / SEC = current through the secondary winding; • ESR = total impedance of the secondary side; 16 10-2012 elektor USB ISOLATOR ^ektor L J in in rsi lo DEVICE SIDE HOST SIDE OQ LO 3 i/> LO in fM r i < Q + cL CO LO < Q + cL CO LO 3 gure 4. Print this out and stick it to the top of the • A/ PS = turns ratio of the primary and secondary windings of the transformer. In conjunction with the tempera- ture compensation this provides enough information to regulate the output voltage. One consequence of this method is that the switch has to be turned off for a certain minimum amount of time during each cycle, to give the 1C sufficient time to process the feedback information. An off the shelf transformer from Wurth was chosen, which is a small potted type for SMD mounting. The data lines are protected from high input voltages by IC7 and IC8. These are two-channel ESD protection ICs (TPD2EUSB30A) from Tl (this part would also be suitable for USB3 data lines). The dimensions of this 1C are so small (1 x 1 mm!) that it can easily be put between the data lines on the PCB. All power supply connections are pro- tected against overloading with the help of high-side power distribution switches (NCP380) from ON Semiconductor. These ICs include a detection and control circuit with a P-channel MOSFET that limits the output current when it exceeds a preset value. Two different types of the NCP380 have been used in this circuit: IC4, 5 and 6 limit the current to 0.5 A, IC3 to 1 A. These provide optimum protection to al inputs and outputs (both USB and supply) against (almost) all possible types of overload. In this way, the USB ports are limited to 500 mA and the 5 V DC connection is limited to 1 000 mA. A connected USB device always has 500 mA available to it, which doesn’t quite conform to the official USB standards. Initially, the limit should really be 1 00 mA. It should be increased to 500 mA only after the device has announced itself to the host and requested the current increase. How- ever, in practice it seems that you can nor- mally get 500 mA from a USB port on your PC without the need for any requests. In orderto keep ripple to a minimum at the primary and secondary side of the switch- ing power supply, we’ve added LC filters to both sides (L9/C4 and LI 0/C1 3). The ripple currents through capacitors C4 and C5 are very large, which you have to keep in mind when you select the types for these. It is best to use capacitors with the lowest pos- sible ESR. To keep the turn-off spike at the primary side of the supply within manage- able levels, an RCD snubber network has been added, consisting of R1 , C3 and D2. Construction For a circuit that has so many special ICs (all SMD) it is a ‘must’ to have a thought- fully designed board layout. In Figure 3 you can see the board that was designed in the Elektor Labs. It is of course possible to obtain this board separately and pop- ulate it yourself. However, since several components are very tricky to solder due to their size, and some are also not easily obtainable, Elektor has made a fully popu- lated board available, including the case. All you need to do is to add a few holes for the connectors and slide switches in the two side panels of the case. To be on the safe side, the two tags of l<4 that come through the board should be soldered using an ordinary soldering iron. The board can then be fixed inside the case using the two screws provided. The drawing in Figure 4 can be copied and stuck to the top of the case. The original design for the drawing can also be down- loaded from the Elektor website [3] accompanying this project. Usage It is very easy to use the USB isola- tor. First, set the required speed with switches SI and S2. Both of these should always be set to the same speed! Normally a USB device can let the host know at which speed it operates via a pull-up resistor on one of its data lines. This isn’t possible with this iso- lator and the speed has to be set man- ually via switches (this is also the case for most commercially available USB isolators). Connect the ‘host’ (in most cases this is your PC) to K1 (HOST SIDE: USB / PWR+DATA) and the isolated USB device to K4 (DEVICE SIDE: USB/PWR+DATA). If the device needs more than 300 mA we sug- gest that you connect an extra USB cable to l<2 (USB/PWR) or connect a regulated 5 V power adapter (min. 500 mA) to power sup- ply connector l<3 (5 V DC ). We recommend that you don’t use this project in situations where there may be voltage differences between the host and device side that are greater than the AC line voltage. You should also not subject the device to high voltage differences between the host and device side for extended peri- ods of time, because the isolation can deteriorate over time if the components are continuously exposed to high voltage differentials. (120291) Internet Links [1] www.analog.com/static/imported-files/ data_sheets/ADuM31 60.pdf [2] http://cds.linear.com/docs/ Datasheet/3575f.pdf [3] www.elektor.com/ 1 20291 elektor 10-2012 17 MICROCONTROLLERS Embedded Linux Made Easy (4) A look at the kernel By BenediktSauter [i] GNU/Linux provides interfaces and applications for devices that we are used to seeing on desktop computers and servers. Much of this transfers to the embedded domain, where Linux relieves the programmer of a lot of work by handling networking, USB, Bluetooth and more without the need to write complex dedicated C programs. And as we shall see, using a modern operating system brings many other benefits too. In the previous instalments in the series we have looked at how the toolchain, the kernel and bootloader, and a standard file system can be got up and running. One aim of the series is to show developers what is happening ‘under the bonnet’, for example in how devices and processes are implemented. In this instalment we will first look at what advantages there are in using an operating system when compared to driving hardware at the ‘bare metal’ level. What is the essence of an operating system? At its heart it consists of a collection of all the software needed to run specially-written applications in parallel with others. The distinction between ‘nor- mal’ firmware and operating-system-based firmware is, however, somewhat blurred. It is common enough for normal firmware to include a clean interface to the hardware layer to provide com- monly-wanted functions, for example in memory management; and often there will be a small scheduler to divide the processor’s attention between different programs. Together these already form the beginnings of what might be called an ‘operating system’. Atypical operating system There are of course many books on the subject of operating sys- tems [2]. Here we shall only take a broad overview of the main components: • Device management • Process management • Memory management • File management • User and permissions management In the embedded world device management is usually a particularly important aspect. The operating system must present peripherals and hardware to applications in such a way as to simplify their use as far as possible. This is done using device drivers. The operating system is also responsible for handling all the details behind allow- ing several programs to run simultaneously, all wanting access to SD cards, network interfaces and so on. In the simplest programming model, an application running under an operating system is a single, independently executable process. A process has its own virtual address space, ensuring that it cannot disturb other processes. Processes are centrally managed via the process table, and each has its own ‘process control block’ [3] which typically includes space for temporary storage of processor register contents and other important variables: • Program counter • CPU registers • Stack pointer • Status of open files • Process state • Other status information When we launch our ‘hello world’ program the kernel loads the application and creates a new process. A new process is always cre- ated on the basis of the current one, and inherits the user permis- sions associated with it. The command ps -ejH will display the current set of processes in the system in a tree struc- ture. At the root of the tree is the first process launched by the ker- 18 10-2012 elektor EMBEDDED LINUX MADE EASY nel, invariably called ‘/sbin/init’. Starting this process is one of the first things the kernel does when booted. As developers we are particularly interested in the following fea- tures of an operating system: • The interface for device drivers • The file system for programs and data • Launching and executing programs • Shared use of libraries by different programs • Access to input and output ports • Transferring working memory to non-volatile memory • Memory management for applications and processes • Process management Let us start with device management. Configuring the kernel Which interfaces and peripheral blocks of the embedded processor we need will depend on the application. The Linux kernel is designed in a modular fashion, which results in the developer having very fine control over its settings and in particular over what drivers and mechanisms will be included in the kernel. It is also subsequently possible to load other components dynamically. The best way to see how this is done is to look directly in the kernel source code. So, switch to the kernel source code tree: cd ElektorLinuxBoardDownload_20120509 cd linux-2 . 6 . 33-lpc3131x and invoke the kernel configuration menu: make menuconfig The main menu (Figure 1 ) should immediately appear. If it fails to appear, one possible cause is that the libraries for displaying con- sole-style menus are missing. They can be installed on our Ubuntu system by typing: sudo apt-get install libncurses5-dev From the main kernel configuration menu it is possible to enable or disable any of its features and device drivers at will. For the beginner it will not always be immediately obvious where within the menu structure a particular option might be hiding, but with a bit of prac- tice it soon becomes familiar. An alternative to using the menu is to go straight to the config- uration file ‘.config’ in the kernel source directory (linux-2. 6. 33- Ipc3 1 31 x) and edit it by hand. (The full stop at the start of ‘.config’ indicates that it is normally a ‘hidden file’.) However, it is usually more convenient to use the interactive menu. Before changing the configuration it is a good idea to make a backup copy of the current configuration file. r tsm kcfi Mviipt’C the ne^u. Writer* hIhIi suIpc’Mji •*. tttplill^hted letters *re hotkeys, Frtijing eY* Include*. exclude*. *sdularizes features Press *Eio*Eso to east. for tteLp. th* for Starch. Legend ? E*E built ■■ in- j j wtfule * * wrtot^cajMBle ■antral satgp T*| [nab!* IwUhtf ndult support ■■■» j-i nablt the block layer ■■■> Type ruj support erret PeaTurer. ■■■» ■out options *“> : ;Pp PfMf Ksnageoent ■ ■ ■ > Yq.itung poinc nulatton ■■■> -irr-tfoco binary EonatS cnrfr a.ir.ayeeerri opucns >■'> i-| EJ tBorkyng topport ■> OUlfO IJrivar* ■■■* lit *yste« ■■■> onset hacking ■ ■■> oeurity options ■— > rypiogra*"htE *Pt ■■■» Library routlftos ■-'> Load ail Alternate tonfjyu rallpn Pile lue an ftHfrmATt CttSiflflU r*f iQ* Pile * Help > Figure 1 . Main kernel configuration menu. cp .config conf igbackup Newcomers to Linux often ask where good documentation can be found. The best documentation for the kernel is in the kernel source itself. It is also possible to click on ‘help’ at any time in the menu to find information on a particular item, or you can browse through the ‘Documentation’ directory (at the top level of the kernel source tree) to look for information on a particular topic. As Figure 1 shows, the menu items are sorted into groups. At the top are the general kernel settings, and then follow settings for the device drivers and file systems, and finally items relating to cryp- tography and security. General setup The menu item ‘General setup’ covers the basic characteristics of the kernel, including, for example, whether there is any swap space, how memory is managed and how internal communications are car- ried out. There are also settings relating to the kernel image itself, optimisations for small systems, statistics, tools and much more besides. The more you find out about the Linux kernel, the more handy features you discover: there are only a few people who can lay claim to understanding it completely! Enable loadable module support Another good feature of Linux is that the kernel can be extended, while it is running, by simply adding extra modules. The kernel configuration menu lets you decide whether a particular feature or driver should be permanently built into the kernel code or com- piled as a module: an ‘M’ before a menu item means that the feature will be compiled as a module, whereas an asterisk before an item means that it will be built in permanently. If you want to be able elektor 10-2012 19 MICROCONTROLLERS New version of the Elektor Linux board to support a wide range of different devices, building all the driv- ers into the kernel can make it unwieldy: it is better to compile the drivers as modules and load them manually or let the kernel load them automatically. Enable the block layer The kernel distinguishes between two types of device: character devices and block devices. A character device sends and receives messages and other data one character at a time; a block device always does so in complete blocks. Typical character devices include consoles and UART interfaces; block devices include hard disks and memory cards such as MMC and SD cards. If no block devices are needed (as is possible for some embedded systems) some memory space can be saved by disabling the ‘block layer’. System type Some kernel features depend on the type of processor being used. For example, it may be desirable to enable or disable caches or memory management units. This menu item lets you specify (as far as is possible) the processor type: if your particular processor is not listed, you will need to find a patch or suitable ‘board support package’ (or write it yourself). Bus support Here it is possible to enable support for typical PC-type buses. In our case only the PCMCIA option is available. Kernel features This item is very kernel-specific: you can specify what binary inter- face convention is to be presented to programs and other miscella- neous features, such as displaying processor load via the blink fre- quency of an attached LED. Boot options How the kernel is started up depends in the case of the Elektor Linux board chiefly on the bootloader. The main interface between the bootloader and the kernel is the so-called ‘kernel command line’. This command allows the bootloader to pass various parameters to the kernel that can subsequently be examined by it or by other pro- grams. The menu item allows you to specify that a given different command line should be used instead. Alternatively, it is possible to compile the kernel so that it can be run directly from flash storage. CPU Power Management These days processors offer an ever wider range of features to sup- port efficient power management. The kernel has to be properly configured to allow applications to take full advantage of these features. Floating point emulation This kernel configuration menu option allows you to configure it so that it takes responsibility for floating-point calculations or so that hardware support is used. At least one of these alternatives must be selected to allow programs to be run. Demand for the Elektor Linux board has been truly overwhelming! Because of the large number of orders we have received the next production batch has had to be made rather sooner than expected. Unfortunately the DRAM chip in the BGA package has a lead time of some 20 weeks, and so we decided to change the layout to ac- cept a TSOP54 device. The new memory has the same capacity as the old one but requires a supply voltage of 3.3 V instead of 1 .8 V. The upper picture shows the original version of the board with the BGA memory chip, while the version in the middle picture has the TSOP54 device fitted. Since the beginning of July we have been de- livering version ‘1 .1 blue’ of the board, in which the now redundant 1 .8 V voltage regulator circuitry is removed. You can easily identify the most recent version of the Elektor Linux board by its blue colour. The corresponding circuit diagram is shown here. 20 10-2012 elektor GPIOO EMBEDDED LINUX MADE EASY +1V2 /" © +5V +3V3 © Tr12 LPC_VBUS L2 ^LPC_DM N2 ^LPC_DP P2 ^USBJD Ml J5 if £]i% K4 L3 N1 I2C_SDA CIO DIO E12 I2C_SCL E13 +3V3 9 | R1 TP3 O — *■ SPI SCK G14 F14_ F13_ M10 N10_ P11_ A7 A8 ^ SPLMISO C8 TP4 B8 splmosT B7 TP1 TP2 O LPC RXD A I LPC TXD M13 M12 Ml 1_ N14 F12_ E14_ G10 P12 N12 TP50- TP60 N13 P14 PWM DATA B9 +3V3 USBJ/BUS USBJ5M USBJ5P USBJD USBJTREF USB_VSSA_REF USB_VSSA_TERM USB_GNDA I2C_SDA0 I2C_SCL0 I2C_SDA1 I2C SCL1 I2SRX_DATA1 I2SRX_BCK1 I2SRXJVS1 I2SRX_DATA0 I2SRX_BCK0 I2SRXJ/VS0 IC6.A JTAGSEL RSTIN_N TRST_N TDI TMS TCK ARM_TDO SCAN_TDO BUF_TRST_N BUF_TCK BUFJTMS CLK_256FS_0 CLOCK„OUT SYSCLKJD Nil H14 RESET P13 TRST_N K9 TDI P10 TMS M14 TCK Ell TDO LPC313XFET180 SPLCS_OUTO SPLSCK SPLMISO SPLCSJN SPLMOSI MI2STX_DATA0 MI2STX_BCK0 MI2STXJ/VS0 MI2STX_CLK0 I2STX_DATA1 I2STX_BCK1 I2STX_WS1 UART_RXD UART_TXD MUART_CTS_N MUART_RTS_N PWM_DATA cn < GPIOO GPIOI GPI02 GPI03 GPI04 MGPI05 MGPI06 MGPI07 MGPI08 MGPI09 MGPIOIO GPIO1 1 GPI012 GPIOI 3 GPI014 GPIOI 5 GPIOI 6 GPIOI 7 GPIOI 8 GPI019 GPIO20 ADC10B-GPA0 ADC10B-GPA1 ADC10B-GPA2 °, ADC10B-GPA3 CO < R26 GPIOI 5 A 1 N C30 22p < Q2 Hh 12MHz e R13 DNP F10 F11 D13 _D14 H12 J4 G13 +3V3 © Tr2 \ \ \ \ \ K10 J10 SYSCLK_0 "N GPIOO A L14 GPI02 B11 LED1 C11 B6 LPC MCI CLK N N A6 LPC_MCI_CMD N rs A5 LPC_MCI_DATO B5 LPC_MCI_DAT1 C5 LPC MCI DAT2 \ \ A4 LPC MCI DAT3^ \ H13 GPIO1 1 H10 - J12 J14 "N GPI014 J13 GPIOI 5 J11 K12 K14 \ GPIOI 8 H11 GPI019 K13 B14 A14 B13 C14 \ A GPAO GPAI^ — \ GPA3 +3V3 © Tr17 C29 22p S3 i N RESET RESET / C11 y ^^ 00n LPC_D0 G2 ^LPC_D1 F2 ^LPC_D2 FI ^LPC_D3 El f LPC_D4 E2 ^LPC D5 D1 ^LPC_D6 D2 ^LPC_D7 Cl f LPC_D8 B1 ^LPC_D9 A3 ^LPC_D10 A1 ^LPC_D11 C2 ^LPC D12 G3 ^LPC D13 D3 ^LPC D14 E3 ^LPC D15 F3 / LPC DQM0 HI / LPC WE J2 J1_ J 3_ K1_ K2_ E6_ E7_ LPC MCI CD B4 D4 EBI_D_0 EBI D 1 EBI_D_2 EBI D 3 EBI_D_4 EBI_D_5 EBI D 6 EBI_D_7 EBI_D_8 EBI_D_9 EBI D IO EBI D 1 1 EBI D 12 EBI D 13 EBI D 14 EBI D 1 5 IC6.B MLCD_DB_0 MLCDJJBJ MLCD_DB_2 MLCD_DB_3 MLCD_DB_4 MLCD_DB_5 MLCD_DB_6 MLCD_DB_7 MLCD_DBJ5 MLCD_DB_9 MLCD_DB_10 MLCDJ3BJ1 MLCDJ3BJ2 MLCDJ)Bjl3 MLCD_DB_14 MLCD_DB_15 LPC313XFET180 EBI_DQM_0_NOE EBI A 0 ALE EBI_A_1_CLE EBLNWE EBI_NCAS_BLOUT_0 NAND_NCS_0 EBI NRAS BLOUT 1 NAND NCS 1 NANDJMCSJ NAND_NCS_3 MNANDJTYBNO MNANDJTYBN1 MNANDJTYBN2 MNAND RYBN3 MLCDJTS MLCD_RW_WR MLCD_E„RD MLCD_CSB N8 LPC_CLK P9 N6 LPC A2 P6 LPC_A3 N7 LPC A4 P7 LPC_A5 K6 LPC_A6 P5 LPC_A7 N5 LPC A8 L5 LPC A9 K7 LPC_A10 N4 LPC_A1 1 K5 LPC A12 P4 LPC A13 P3 LPC A14 N3 LPC A15 B3 LPC A0 A2 LPC_A1 G1 LPC_CAS H2 LPC_RAS P8 LPC_CS N9 LPC_DQM1 L8 LPC_CKE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ K8 \ \ \ \ \ \ LPC AO ~7~ R15 T +3V3 1 cm’ O Q_ O SV1 o a R16 +3V3 © X7 X4 +3V3 © 3.3V GND U1 DM3D-SF DAT2 DAT3 CMD V+ CLK GND DATO DAT1 SW_A SW_B @ © © © 1 GPA1 / 2 GPIOI V 3 GPIQ14 / 4 GPIQ15/ 1 R20 1 , CNJ 0 CO Ctl 1 R23 1 iJ SD-CardSocket LPC MCI DAT2 / LPC MCI DAT3 / LPC MCI CMD / LPC MCI CLK / LPC MCI DATO / LPC_MCI_DAT1 A LPC_MCI_CD +3V3 © 23 S. LPC A1 24 V LPC_A2 25 S. LPC A3 26 \ LPC A4 29 V LPC_A5 30 S. LPC A6 31 V LPC_A7 32 V LPC A8 33 \ LPC A9 34 V LPC_A10 22 S.LPC_A11 35 \ LPC A12 36 V LPC A14 20 \ LPC A13 21 LPC_DQM0 15 V LPC_DQM1 39 S. LPC_CLK 38 V LPC_CKE 37 Q □ > AO A1 A2 A3 A4 A5 A6 A7 A8 A9 A10/AP All NC BSO BS1 LDQM UDQM CLK CKE a a q g Q Q S S a a > > o a a a a a > > IC5 DRAM A43E26161 a a a a CO CO CO CO CO CO CO CO CO CO CO CO CO CO > > > > > > > DQO DQ1 DQ2 DQ3 DQ4 DQ5 DQ6 DQ7 DQ8 DQ9 DQ10 DQ11 DQ12 DQ13 DQ14 DQ15 CAS RAS1 WE CS 2 LPC DO / 4 LPC A1 / 5 LPC D2 / 7 LPC D3 / 8 LPC D4 / 10 LPC D5 / 11 LPC D6 / 13 LPC D7 / 42 LPC D8 / 44 LPC D9 / 45 LPC DIO / 47 LPC Dll / 48 LPC D12 / 50 LPC_D13 / 51 LPC_D14 y 53 LPC D15 / 17 LPC CAS / 18 LPC_RAS / 16 LPC WE / 19 LPC CS / +5V ©■ J3 R9 1 , m l__j L__ ik i K1 VCC O- D- a D+ O- GND O' USB RIO Tr14 I LPC VBUS / LPC DM / ^C33 ^C3l" 1 ^0n ^C26 ^c: 1 ^0 ^C22 1 ^0 +3V3 ©-• R19 C12 i C6 A9 C9 E10 B2 E5 F5 G5 H5 L4 M5 M7 M9 C13 D5 I D7 I E8 i G12 i L10 A13 VDDI VSSI VDDI VSSI VDDI VSSI VDDI VSSI VDDI VSSI VSSI VPP_A VPP_B IC6.C VDDA12 VSSA12 VDDA12 LPC313XFET180 VDDEJOA VSSEJOA VDDEJOA VSSEJOA VDDEJOA VSSEJOA VDDEJOA VSSEJOA VDDEJOA VSSEJOA VSSEJOA VDDEJOB VDDEJOB VSSEJOB VDDEJOB VSSEJOB VDDEJOB VSSEJOB VSSEJOB VDDEJOC VDDEJOC VSSEJOC VDDEJOC VSSEJOC VDDEJOC VSSEJOC VDDEJOC VSSEJOC VDDEJOC VSSEJOC VSSEJOC VDDE_ESD VSSEJOC ADC10B VDDA33 ADC10B GNDA All C7 D12 G4 L6 L11 E9 C3 C4 E4 F4 H4 K3 M3 M4 M6 M8 B12 D6 D8 D9 G11 L9 LI 3 A12 < LPC DP y - \USB ID CIO lOOn 120181 - 13 MC78M05ABDT +5Vext h-@ DC 7 -12V elektor 10-2012 21 MICROCONTROLLERS User space binary formats Programs and applications are compiled using the toolchain (see the previous instalment in this series). Normally, for a Linux system, the toolchain will produce either a .elf file (‘executable and linka- ble format’, corresponding roughly to a .exe under Windows) or an ‘a. out file’. The kernel reads these formats and launches the com- piled application appropriately. A handy Linux command is file which lets you see what format a given file has. Switch to the appropriate directory using cd and then type file followed by the name of the file of interest. For example, in the Linux directory there is a file called ‘vmlinux’. Typing file vmlinux produces the answer vmlinux: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped The file is an executable file for ARM processors that is statically linked. Power management options It is not just the processor that offers power management features: many peripherals and other devices have the ability to go into a sleep mode. The operating system can take a copy of important data and send the peripheral to sleep. When the time comes to wake the peripheral up again, the data are copied back from mem- ory and its state is restored. The exact behaviour of the kernel in these situations can be configured here. Networking support Finally we come to one of the most interesting points for develop- ers. Under ‘networking support’ we can enable, disable and config- ure all the software stacks (protocol libraries) for the various com- munication interfaces, including Ethernet, TCP/IP, CAN, infra-red, amateur radio, Bluetooth and wireless. Device Drivers We are also especially interested in device drivers. This menu item includes everything you might wish for, from the simplest I/O port to the most up-to-the-minute high speed server bus. The kernel source code (see download at [4]) includes drivers for a wide range of USB, l 2 C and SPI devices which we now have at our disposal. File systems File systems are important to us for two reasons. First, the operat- ing system itself must reside in a file system (on the SD card), so that the kernel can read the files it needs from it. And second, the operating system has to use a file system to allow application files and directories to be stored on a hard disk. Kernel hacking This menu item is chiefly aimed at kernel developers. Security options Linux includes a range of different security features. The most famil- iar of these is the system of user and group permissions and the existence of a ‘root’ user. Applications can be further protected using techniques such as trusted platform modules and internal security models. Cryptographic API This menu item covers cryptographic functions in the kernel. Library routines This menu item includes functions for calculating checksums along- side many other things. If you want to save your new kernel configuration, use the last menu item ‘Save an alternate configuration file’. After entering a name for the new kernel configuration it will be stored locally in the kernel source tree. We described in the previous instalment in this series [4] howto go about compiling the kernel (make zlmage) and copying it to an SD card. If new modules are to be included in the kernel, they have to be separately compiled and installed. Compile the modules by typing: make modules and to copy them to the SD card, either give the path to the des- tination SD card directly in the following command, or install the modules into */ tmp’ and then copy the new directory that is created there to the SD card, either as user ‘root’ or using the ‘sudo’ com- mand. (It is not that root privileges are required for the copy opera- tion itself, but rather that we must ensure that the files are copied to the file system on the SD card in such a way that the kernel can subsequently use them as the root user.) make INSTALL_MOD_PATH=/tmp modulesinstall Now we switch the the ‘/tmp’ directory and copy the directory lib to the SD card: cd /tmp sudo cp -R lib / media/86b3be7-00f3-45e0-832e- If48c2c3065e with the appropriate change to the long hex string. Interfaces Linux has its roots in the PC world. There we are faced with inter- faces such as IDE, SATA, PCI, AGP and the like. In the embedded world the focus is more on the traditional microcontroller interfaces and, of course, USB. 22 10-2012 elektor EMBEDDED LINUX MADE EASY Table 1 . Device files typically found in the /dev directory Device type File in /dev Character or block device IDE hard disk / dev/hda, / dev/hdb, ... Block SCSI hard disk /dev/sda, /dev/sdb, ... Block RS-232 interface /dev/ttySO, /dev/ttySI , ... Character Printer /dev/lpO, /dev/lpl Character Camera /dev/videoO, /dev/videol Block Mouse /dev/input/mice Character RAM /dev/ram Block To summarise, our board has the following interfaces: • USB (as host and device) • UART (in its current form as the system console, but can also be used as an interface to external devices) • l 2 C (as master) • SPI (as master) Also, the processor has other hardware functions such as: • GPIO • A/D converter • PWM output As we proceed we will look more closely at these interfaces. Device files In order to allow applications to talk to devices, we need an inter- face to the device driver. The way that drivers are accessed varies greatly from one operating system to another. Linux is based on a UNIX file system, and under UNIX things are particularly simple: each device is treated as a file. The idea is that no special tools are required to drive a device; instead, we can just use small, simple programs (from the console), operating on devices exactly as if they were files. We showed an example of how this works in the case of GPIO pins in the second instalment of this series [5], where we dem- onstrated how to flash an LED. There are two important commands with which surprisingly much can be achieved: cat and echo. The command cat displays the con- tents of a file; echo, conversely, lets us write any desired text to a file. To put it more precisely, the output of echo can be redirected to any desired file. So, for example, if we want to write some data directly to a hard disk (that is, not via a file system) or send data to a serial port, we can use echo in commands of the form echo “Data for the hard disk" > /dev/sda or echo "Hello there, world" > /dev/ttySQ But be careful: if you wish to experiment with writing data directly to a hard disk or memory card, make sure you use one without any important information stored on it! Some device files correspond to block devices and some to char- acter devices. A hard disk, for example, is always treated as a block device, whereas an RS-232 interface is treated as a character device like a normal terminal, receiving and processing characters one at a time. Table 1 gives a list of example device files that might be found in a typical UNIX or Linux system. Readers may be wondering exactly what mechanism is hiding behind the commands echo and cat. How exactly does a driver send or receive data? Now, since everything is a file, we can access the device by simply reading from or writing to it as we would a file. This means that each driver simply has to provide three functions: Read, Write and Ioctl (which allows the device’s settings to be changed). Read and Write are the standard functions for reading and writing files, the process in the case of a device being exactly analogous to that for a normal file. The first step is to open the device or file and obtain a ‘handle’ (a number which identifies the opened device or file). The handle is then passed to subsequent Read or Write opera- tions on the device or file. Kernel space and user space Classical operating systems (in which category we include Linux) are generally constructed with a clear separation between the mem- ory area that is used by the kernel and the memory area available for applications. An application is not permitted to access the ker- nel’s memory. This is another important fact for developers work- ing close to the system level to bear in mind. In Linux, the memory areas are called ‘kernel space’ and ‘user space’. Usually in the case of a device driver, all the software will be in kernel space. So how does a user application program get its hands on the data received over an interface? The answer lies in the kernel functions such as copytouser [6], which copies a block of data from kernel space into user space. So, when an application reads a device file the driver must use this func- tion to make the information available to the application. Integrating a device driver We now know the basic principles of operation of a kernel device driver. The question remains, however, of how the kernel knows to associate elektor 10-2012 23 MICROCONTROLLERS root@gnublin:~# cat /p roc/devices Character devices: 1 mm 4 /dev/ve/0 4 tty 4 ttyS 5 /dev/tty 5 /dev/console 5 /dev/ptms 7 vcs 10 misc 13 input 21 sg 09 i2c 126 ptn 136 pts 153 spi iso usb ISO usbdevice 252 ustwon 253 lpt313X_pvri 254 lpc313x_adc Block devices: 1 randisk 259 blkext 7 loop 8 sd as sd 66 Sd 67 Sd 66 sd 69 Sd n sd 71 $d 123 sd 129 sd 130 sd 131 sd 132 sd 133 sd 134 sd 135 sd 179 mine Figure 2. List of available drivers. a file such as /dev/ttySO with the correct driver for the serial port. To this end so-called ‘major’ and ‘minor’ device numbers are used. These are unique identifying numbers that are defined in the kernel documentation. The numbers are also present inside the drivers for each type of device. The following command can be used to display which drivers with which major numbers are currently available, cat /proc/devices The result is a list of device drivers, sorted into character devices and block devices (Figure 2). Now we can look in the ‘/dev’ directory using Is -l to display its contents (Figure 3). There will be a large number of files in the direc- tory representing our various devices. Let us look at the information provided alongside each device. At the beginning is the letter ‘c’ or ‘b’ which indicates whether this is a character device or a block device. Then there are the permissions as usual: we will look at these in more detail in a later article in this series. Then the user who is the ‘owner’ of the file. Shortly after that there are two numbers separated by a comma, and these are the major and minor device numbers. In this example the major numbers are 1 , 4, 5, 8, 89, 253 and 254; the minor numbers are 0, 1 , 2, 3, 9, 1 2, 24 and 64. If we access one of these device files from user space, the operating system will be able to determine from these numbers and from the entries in ‘/proc/devices’ exactly which driver is needed. It is easy to create device files using the tool ‘mknod’ [7]. We will see an example of this below. Integrating a USB-to-serial converter It’s now time to turn theory into practice. Let us drive a simple USB- to-serial converter from our Linux board (from the USB end!): see Figure 4. The basic steps in the process are as follows. • Enable the driver in the kernel. • Compile the kernel. • Copy the new kernel to the SD card. • Check the driver is available in the new kernel. • Create a device file. rpot@gnubUn:/ cd /dev root@griublin: total l /dev# Is crw--~--“ i root root prW’ - 1 root root srv*rw‘irrt‘ i root root e*v-r— r— i root root crw*r-*r- - l root root Irwxrwxrwx 1 root root trw-iT'-r— i root root erw-r-'f” 1 root root trw-rw-rtf* l root root cfrwxr-icr’X 2 root root erw-r^r— 1 root root brv-r—r- - 1 root root brw-r— r- * 1 root root Crw-rw-rW' 1 root root -rw-r--r“ 1 root root 1 root root erw-r—r— 1 root root I 5, i Sep 27 66:02 6 sep 27 06:02 6 sep 27 66:02 254, 0 Sep 26 03:57 253 , 6 sep 26 64:21 12 Jan 1 1970 !p 3 Dec 22 2611 1 Sep 26 03:06 5 r 2 Jan 1 1970 0 Jan 1 1970 l. 9 sep 26 04:28 8p 0 Sep 27 05:52 Sp l sep 27 05:52 5p 6 Jan 1 1970 24 Jan 1 1970 4, 64 Sep 27 06:03 h 9 Sep 26 64:30 console initctl log lpc3Ux_adc Ipc3l3x~pwm mtab -> /proc/mounts null pCa9555 ptmx pts random $da sdai tty ttys ttySQ u random Figure 3. These files represent our devices. Figure 4. A CP21 02-based USB-to-serial converter connected to the Elektor Linux board. 24 10-2012 elektor EMBEDDED LINUX MADE EASY • Test the device. Enable the driver in the kernel First switch to the Linux source tree: cd ElektorLinuxBoardDownload_2012O509/ cd linux-2 . 6 . 33-lpc313x/ . ./set.h make menuconfig In the first step (Figure 5) select the menu item ‘Device drivers’. Then select ‘USB support’ (Figure 6). With the default configuration there will be an ‘M’ here instead of the **’ shown in the screenshot. Use the space bar to cycle through the three options ‘M’ (compile as module), **’ (compile into kernel), or neither. We select **’ to avoid the complexity of having to hunt down the module later. The next menu item is ‘USB serial converter support’ and here also we must turn the ‘M’ into a ‘* ’ (see Figure 7 and Figure 8). Pressing the Enter key brings up a submenu to select the right driver (Figure 9). Most readers will probably want to use the FTDI devices or the Silicon LabsCP210x controllers, and so we set both of these drivers to **’. To apply these changes, go repeatedly to ‘Exit’ and then, on the last page, confirm that you want to save a new configuration file. Compiling the kernel We can now set off the kernel compilation process. make zlmage Typical resulting output is shown in Figure 10. Copy the kernel to the SD card Put the SD card from the board into an SD card reader and then connect the reader to the PC. Now copy the kernel to the SD card as follows sudo cp arch/arm/boot/zlmage / media/386b3be7-00f3-45eO-832e- If48c2c3065e/ with, as before, the appropriate change to the long hex string. When the copy operation is complete unmount the file system manually in order to ensure that all the blocks are safely written to the SD card [4]: umount /media/386b3be7-00f3-45e0-832e-lf48c2c3065e Check that the driver is available Now we can boot up the Elektor Linux board as usual. It is impor- tant to check that J PI is fitted, so that we force the USB interface to start up in host mode. We must also make sure that the device is provided with power over the USB connector from the Linux board. This is done by fitting J3 in position 3-2. to be built in to the kernel. Figure 5. The 'Device drivers' menu item. Figure 6. The 'USB support' menu item. Figure 7. Selecting 'USB serial converter support' elektor 10-2012 25 MICROCONTROLLERS Figure 8. Selecting 'USB serial converter support' to be built as a dynamically-loadable module. Figure 9. Flere we select the USB-to-serial adapter(s) that will be supported. We can see the first differences during the boot process itself. The two new drivers make their appearance as follows. USB’. We create a device file with this major number as follows, mknod /dev/ttyllSBO c 188 0 Testing the device If we now plug the USB-to-serial adaptor into the board we get the following output. usb 1-1: New USB device found, idVendor=10c4, idProduct=ea60 usb 1-1: New USB device strings: Mfr=l, Product=2, SerialNumber=3 usb 1-1: Product: CP2102 USB to UART Bridge Cont roller usb 1-1: Manufacturer: Silicon Labs usb 1-1: SerialNumber : 0001 cp210x 1-1:1. 0: cp210x converter detected usb 1-1: reset full speed USB device using Ipc-ehci and address 2 usb 1-1: cp210x converter now attached to ttyUSBO The last line shows that the device file has been correctly created, and that the kernel has associated the newly-recognised device with the right device file. Our Linux operating system includes a small terminal emulator pro- gram called ‘microcom’. By adding a jumper to bridge the RXD and TXD lines of the serial port on the USB-to-serial adaptor we can use this to test the driver. Start up the terminal program using the fol- lowing parameters. cp210x: v0 . 09 : Silicon Labs CP210X RS232 serial adaptor driver USB Serial support registered for FTDI USB Serial Device Creating a device file The command cat /proc/devices reveals a new entry ‘188 tty- microcom -s 9600 /dev/ttyUSBO If you now type characters at the keyboard they will be sent to the adaptor and then returned to the board. If the driver is working properly these characters should then be echoed to the screen. Break the connection between RXD and TXD on the USB-to-serial adaptor and the characters should no longer be echoed, demon- strating that the device driver is working. Press control-X to close Internet Links [1] sauter@embedded-projects.net [2] http://en.wikipedia.org/wiki/ Operating_Systems:_Design_and_lmplementation [3] http://en.wikipedia.org/wiki/Process_controLblock [4] www.elektor.com/ 1 201 80 [5] www.elektor.com/ 1 20146 [6] www.gnugeneration.com/mirrors/kernel-api/r4299.html [7] http://wiki.linuxquestions.org/wiki/Mknod 26 10-2012 elektor EMBEDDED LINUX MADE EASY CC arch/ a nm/bsct / comp re s secf/roi ec . o Irt file included from a rth/arm/boot/ comp reused/ . ,/.,/.,/. ,/lib/deCOiipres$_iriflate.C: 10:0 , f rom a rc h/a rii/bcot/ coup roEsed/nisc . c : 24® ; arch/am/boot /compressed/, ,/. ,/, ,/Ub/ilib_inf late/in flats. C: In function ' llib_f ix«!tables ' : arch/a m/boot /compressed/, ./../../. ./Ub/zUb_inflate/inflate,cs 160 : 1 : warning: the frame size of 2176 bytes is larger than 1624 bytes SHIPPED arch/arm/bcot/Cdmpre$sed/\iblfuncs .3 AS arcfi/anu/boot/compreEsed/Ublfuncs .o LD a rc h/a rm/boot/conip re&sed/ vnlifiux OBJ COPY arch/a rim/ boot/ zlmage Kernels a rc h/arm/ boot/ z Image is ready Figure 1 0 . Output when compiling the (newly extended) kernel. microcom. (120181) In the same way we can modify the kernel to use USB adaptors for LAN and WLAN, USB sound cards and many other USB devices. In the next instalment in this series we will look at more devices and interfaces and test them out with a few simple experiments. Advertisement Elektor RF & Microwave Toolbox i=> for Android The RF & Microwave Toolbox contains 34 calculation and conversion tools for RF, microwave and electronics in general. Whether you are an RF professional, radio-amateur, astronomer or hobbyist, this app puts some of the most impor- tant tools right at your fingertips. Literally! Highlights: • Amplifier cascade (NF, Gain, PI db, 0IP2.0IP3) • Field intensity and power density converter (W/m2, V/m, A/m, Tesla, Gauss, dBm, W) • PCB Trace calculator (impedance/dimensions) • PI and T attenuator • Antenna temperature (Kelvin) • EMC (EIRP, ERP, dBjuV/m) • Filter Design (Butterworth, Chebyshev, prototype) • And much more Further information at www.elektor.com/. rf-app AhQflOiD APF OH ^ Google pfay Mini multimeter DT-830B Free, Portable, Multifunction SEN1060 GPS Module With Antenna Small, Low Cost, Easy To Develope USB AMR JTAG Simulation J-Link v8 “Must have” tool for ARM developers 6P3P 7.5Wx2 Tube Amp Kit CNC enclosure, hifi sound quality, easy to build $136 Simplify your electronics projects by visiting http://www.siliconray.com filieofiRciy Online Electronics Store Boards * Kits * Modules • Components * Tools * Instruments FOR * Companies * Professionals * Students * DIYers * Amateurs elektor 10-2012 27 MICROCONTROLLERS Thou Shalt Communicate! Wi-Fi/Bluetooth/USB shield for Platino and Arduino Today all & sundry, devices included, have to be “connected”, 24/7, all year round. You may have a Facebook account, but what about your oscilloscope? Does your multimeter tweet enough? Is your soldering iron linked in? You may be a non- communicative nerd but your bench power supply may be craving for social interaction. With the add-on board described in this article you can hook up anything to everything, with or without wires. Okay, I can’t deny it; I have a reputation for exagger- ating. Connecting anything to, errm, everything is probably a bit over the top. On the other hand, the board I’m about to pre- sent in this article is quite versatile. It can be equipped with a Wi-Fi module allowing you to connect an electronic device to the Internet; or with a serial Bluetooth module it offers wireless connectivity to other serial Bluetooth capable devices, and a serial-to- USB bridge enables old-skool wired serial connectivity. The board can be used as an add-on board for microcontroller systems with Arduino- style extension connectors (Figure 1), like Elektor’s own Platino [1 ] (Figure 2), but it can also be used stand-alone as a wire- less connectivity module for a PC. Note that you can’t have both Wi-Fi and Bluetooth modules mounted on the same board. About the Wi-Fi module Wi-Fi modules have been inexpensive, plen- tiful and easy to find these past few years. The problem with many of them however is their manufacturer who refuses to tell you how to use the module unless you agree to transfer a substantial amount of money to the manufacturer’s bank account in exchange for a few thousand modules or a customised software library for your host hardware. Luckily the Korean embed- ded Internet liberators from WIZnet have decided to be less secretive about their products, and sell Wi-Fi modules you can actually use. I managed to get my hands on two of their WizFi220 modules, and this article is the result. By Clemens Valens (Elektor UK/INT Editorial) 28 10-2012 elektor WI-FI/BLUETOOTH/USB SHIELD FOR PLATINO AND ARDUINO Figure 1 . Fully built up Wi-Fi shield on top of an Arduino Uno. Note the absence of R8 and R1 0. The WizFi2xO modules (there is also a WizFi21 0 module) operates with standard 802.1 1 b/g/n access points at speeds up to 1 1 Mbit/s (802.1 1 b), and they support WEP, WPA, WPA2-PSK and Enterprise secu- rity standards (802.1 1 i). The modules have some really cool possibilities. One of them is the Wi-Fi serial port that’s remarkably easy to use. Another nice feature is its lim- ited access point (AP) capability that allows direct connection to smartphones and tab- lets like Android-based devices and Apple gadgets. The WizFi220 module measures 32 x 23.5 x 3 mm, has an on-board chip antenna and a Hirose U.FL connector for an external antenna. The module’s compatible little brother, the WizFi21 0, consumes less power, but cannot provide as much out- put power and hence has “less range”. 49 connection pads provide enough soldering points to fix the module on a PCB in such a way that it will not easily come off. Most of these pads are probably not useful for unas- suming users like us, being pitched at high- volume customers. For the others a simple two-wire serial connection is available to transmit and receive data and to configure the module. As is often the case with such wireless mod- ules, the WizFi2xO can be controlled over a serial link using AT modem commands (or Hayes commands). Such commands con- sist of human-readable strings a few charac- ters long and starting with ‘AT’. The module powers on in Command mode so you can configure it. Once the setup is complete the module can be switched into Data mode with the O(nline) command (“ATO”). To get it out of Data mode back to Command mode three consecutive *+’ characters have to be send (“+++”). Design considerations Some of the configuration commands, like setting the baud rate of its serial port, are more or less one-time only, and the mod- ule remembers these settings. Since the AT commands are human-readable it may therefore be practical for the initial setup, but also for experimenting, to be able to communicate with the module using a PC and a serial terminal program. That’s why I decided to throw in a serial-to-USB con- verter. Since many Elektor readers may already have a so-called FTDI serial USB cable [2], I wanted to be able to use it with this module. On the other hand, hav- ing such a converter directly on the board would also be useful, especially if the host system does not have a USB serial port, like Platino. In the September 201 1 edition we presented BOB [3], a very convenient USB/serial bridge module, and I thought it was a good idea to add it to my design too. Now if I could add some clever wiring it should be possible to connect the USB converter to either the Wi-Fi module, the Figure 2. Fully built-up Wi-Fi shield on top of Platino, also equipped with a 20x4 alphanumerical LCD. elektor 10-2012 29 MICROCONTROLLERS IC1 MCP1 825S-3302E/AB +3V3 (+) +3V3 x | R12 | R13 3_ JP4 w 3 37 2 25 1 46 8 10_ H_ 12_ 13_ 14_ 15_ 16_ 17_ 19 _ 20 ( i — • — < i 9 32 33 34 VBAT VIN_3V3 VIN_1V8 VDDIO EXTANT MODI GPI028 JTAG_TCK JTAG_TDO JTAG_TDI JTAG_TMS JTAG_NTRST ALARM1 UART1 RTS/GPI027 GPIO30 GPI031 UART0_CTS/GPIO24 UARTO_RX/GPIOO UART0_RTS/GPIO25 UARTO TX/GPIOI GPI021/CLK_1 1 MHZ UART1_TX/GPI02 GPI029 UART1_RX/GPI03 RTC_OUT1 UART1_CTS/GPI026 DC_DC_CNTL ALARM2 ADC1 ADC2 MSPLMIS0/GPI06 MSPI M0SI/GPI07 WizFi220 EXT_RESET SSPLMOSI SSPLCS SSPLCLK SSPLMISO I2C_DATA/GPI08 MSPLCLKI/GPI05 GPIO20/CLK_22MHZ VOUT_1V8 GPI019/CLK_44MHZ MSPI_CS0/GPIO4 PWMO/GPIOIO MSPLCS1/GPI013 I2C_CLK/GPI09 GND GND GND GND 1 18 31 *x 48 47 45 44 43 42 41 40 39 38 _ 36 35 30 29 28 27 26 24 23 22 21 +3V3 © AD POWER A5 A4 A3 A2 A1 AO VIN GND 5V 3V3 RST IOREF K2 * Di ^ ■7? LINK * D3 Hbr * D2 RXD ! ?????? ! ^ '6 '5 '4 '3 '2 'l '8 0 0 0 0 0 [ R11 | R9 R8 +5V ©- K1 ? H JP5 * +3V3 +o of -© RIO RX V 5 6 7 8 9 11 ASSOCIATED 12 _ 13 TX RADIO 14_ 15_ 36_ 35_ 27 RX RADIO 26 +3V3 © 23 R2 | R 1 T2 JP1 +3V3 I 17 PVCC PIOO PI01 PI02 PI03 PI04 PI05 PI06 PI07 PI08 PI09 PIOIO PI011 UART_TX UART_RX PCM IN M0D2 vcc RFJO AIOO AI01 USB_DP USB_DN SPLMOSI SPI.CSB SPI_CLK SPLMISO PCM_SYNC PCM_CLK RESET UART_RTS UART_CTS PCM OUT BTM-222 GND GND GND GND GND GND 10 18 19 ANT BT 37 _3 4 20 21 31 32 33 34 22 25 16 28 _30 24 38 29 0 0 0 JP3 T1 TX_MCU 2x BC547B +3V3 © |~R 4~ T4 T3 LH5n €), L ® R5 RX MCU 2x BC547B o X DC O 1 DC — O O to I — X X O I — Q DC I- > O O • • f • • C5 220n % 0 0 ©■ +3V3 X 3 '2 TX FTDI RX FTDI K5 1 OOP JP2 ICSP VCI0 +5V CBUS4 — +3V3 CBUS3 - CBUS2 - TXD M0D3 cbusi - RXD CBUSO - BOB-FT232R CTS RESET - m DCD - RTS DSR - GND DTR — 120306 - 11 K3 |0 0 o 1 1 3 1 4 1 5 1 6 1 7 1 8 | 1 | 2 i 3 i 4 i 5 i 6 i 7 i 8 i 9 ■ 1 0 O O O O O Q| |OOOOOOOOQO| K4 2 #3 4 #5 #6 7 I0L 8 #9 #10 #11 12 13 I0H Q LU < _| Z UJ Q O O DC to CO < Figure 3. Complete circuit diagram of the Wi-Fi/Bluetooth/USB shield. Refer to the text to find out which parts you need for each configuration. host system or even disconnect it. Flexibil- ity started creeping into the design. The Wi-Fi module has to be powered from a 3.3 V rail and it is not 5 V tolerant. The main objective is to connect the Wi-Fi module’s serial port to a microcontroller. Such a sys- tem may run from 3.3 V, but if it is Arduino or Platino, then the microcontroller runs from 5 V. Level converters on the serial port would therefore be necessary. The FTDI serial USB cable comes in two flavours, 5 V and 3.3 V, and with level converters both types would be usable. The BOB was not an issue because it can handle both levels. Although the host system may have a 3.3 V rail, like Arduino, I thought it wise to add a voltage regulator to the system because the WizFi220 can consume up to 250 mA in active mode. As an example, the LP2985-33 voltage regulator on an Arduino Uno board is specified for 1 50 mA, which is clearly not enough. Platino does not have a 3.3 V rail so this shield could provide it too. A jumper should allow connection of the 3.3 V as pro- duced by the shield to the host system. In this section you can replace all instances of “Wi-Fi” by “Bluetooth” without having to change anything else and still have a coher- ent text. Indeed, many Bluetooth modules are very similar to the WizFi module: they can be controlled with AT commands over a serial link; they run from 3.3 V; they have similar dimensions and similar require- ments. It is therefore not very difficult to add Bluetooth capabilities to the system, all you have to do is wire a usable Bluetooth module in parallel with the Wi-Fi module and that is what I did. I chose the Rayson BTM220 module because I am at ease with it [4] and it is very cheap. We have used it several times in Elektortoo. [5][6] This completes the reasoning that deter- mined my design. Let’s now have a closer look at the circuit diagram (Figure 3). If you 30 10-2012 elektor WI-FI/BLUETOOTH/USB SHIELD FOR PLATINO AND ARDUINO COMPONENT LIST Resistors R1-R11 =^ka 5% 0.25W R12,R13 = 47kft 5%0.25W Capacitors C2, C3 = 1 0OnF 50V, 5mm pitch C5 = 220nF 50V, 5mm pitch Cl , C4 = 1 0pF 35V, 2.5mm pitch Semiconductors D1 ,D2,D3 = LED, green, 3mm diam. T1 -T4 = BC547C, TO-92 case IC1 = MCP1825S-3302E/AB, 3.3 V volt- age regulator, TO-220 case Miscellaneous AREF 6ND 13 12 #11 #10 #9 8 P • R9 =r • j u • ti I0REF RST 3U3 5U GND UIN JP1 = 6 -pin pinheader, 0.1 ” pitch, straight JP3,JP4 = 3-pin pinheader, 0.1 ” pitch, straight, w. 2 jumpers JP2 = 4-pin pinheader, 0.1 ” pitch, straight K1 ,l<3, l<4 = 8 -pin stackable header, 0.1 ” pitch, vertical l <2 = 6 -pin stackable header, 0.1 ” pitch, vertical l<5 = 6 -pin (2x3) stackable header, 0.1 ” pitch, vertical SI = pushbutton, SPNO, through-hole, 6 x 6 mm Mod3 = BOB-FT232R USB-to-Serial Bridge, Elektor Shop # 1 1 0553-91 , or USB-to-Serial cable, Elektor Shop # 080213-71 (5 V) or#080213-71 (3.3 V) Mod2 = Rayson BTM22x Bluetooth module Modi = WIZnet WizFi2xO Wi-Fi module PCB# 120306-1 [1] have grasped my prose up to here, then the schematic will have only a few surprises. Putting it all together On the left side of figure 3 we have the Wi-Fi module; on the right side we see the Blue- tooth module. As you can see they share the serial RX and TX lines, meaning that you should not mount both. It is either Wi-Fi or Bluetooth, never both. The mod- ules also share two LEDs (D1 and D2); D3 is only used by the Wi-Fi module. A surprise here may be R8 and R1 0. Maybe I could have drawn a better schematic, but I didn’t, so I have to explain this in writing. It is actu- ally very simple. The Wi-Fi module sinks the current for the LEDs whereas the Bluetooth sources the current. As a result the LEDs have to be mounted the other way around as drawn if you use the Bluetooth module. In that case you should mount R8 and R1 0 and not mount R7 and R9 (mounting R1 1 and D3 is useless unless you connect the LED to a free I/O pin on one of the connec- tors). For the Wi-Fi module the position of the LEDs is drawn correctly and you should not mount R8 and R1 0 (although nothing breaks or blows if you do), only R7 and R9 are needed now. The WizFi module has some pins with spe- cial functions that you may want to use. Since I didn’t use them I wired them to a separate connector JP4. To enable you all to stack many shields on top of each other I decided not to wire these signals to the Arduino extension connectors K1 to l<4. If you need them you can wire them your- self. Pin 25 (GPIO 21 ) allows you to restore the module’s factory defaults. Pulsing it Low twice will restore the module to Lim- ited Access Point mode, three pulses will restore it to Ad-hoc mode. Pin 46 (GPIO 29) provides a hardware way of switching between Command (High) and Data mode (Low). Pin 37 (GPIO 27) is needed when you want to upgrade the firmware of the module (probably never). To do so you have to pull it High. Finally, a low level on pin 7 (Alarml ) will wake up the module from deep sleep mode. The level converters (R1-3, T1-2 and R4-6, T3-4) are straightforward and have been used before in Elektor. Transistors TI and T4 do the level conversion, but invert the sig- nal at the same time. T2 and T3 correct this. The resistor values are not critical. I chose to use as many 1 k£l resistors as possible. The RX and TX lines connect to JP1 andJP2. These 3-pin jumpers may be a bit difficult to understand at first sight, but when you follow the lines you should be able to fig- ure them out. With a jumper on JP1 ’s pins 1 and 2 the USB serial converter TX pin is connected to the Wi-Fi (or Bluetooth) module’s RX input. A jumper on JP2’s pins 2 and 3 connects the USB serial converter RX pin to the Wi-Fi (or Bluetooth) module’s TX output. This is the Configure-Module- With-PC mode. In these positions the USB serial converter cannot talk to the host MCU system and it may be better to disconnect Elektor Projects & Products • Platino, a versatile board for AVR microcontroller circuits (October 2011 ); PCB # 100892-1 from Elektor Shop • BOB-FT 232 R USB-to-Serial Bridge (September 2011 ); module, Elektor Shop # 110553-91 • USB-to-TTL Serial Cable (June 2008 ); cable, Elektor Shop # 080213-71 (5 V) or # 080213-71 ( 3.3 V) elektor 10-2012 31 MICROCONTROLLERS Listing 1. Example of setting up the WizFi2xO module as a serial server using AT commands. The commands are in boldface, the module’s responses are in italic. Comments appear in brackets (). See the WizFi2xO user manual for more commands. AT (wake up) [OK] AT+NSTAT=? (what is your status?) MAC=00 : 08 : dc: 18: 97: 76 WSTATE=NOT CONNECTED M0DE=N0NE BSSID=00:00:00:00:00:00 SSID='"' CHANNEL=NONE SECURITY=NONE RSSI=0 IP addr=0 . 0 . 0 . 0 SubNet=0 . 0 . 0 . 0 Gateway=0 . 0 . 0 . 0 DNS1=0 . 0 . 0 . 0 DNS2=0 . 0 . 0 . 0 RxCount=0 TxCount=0 [OK] AT+WPAPSK=germaine f "Philippe Noirette" (set SSID & pass phrase) Computing PSK from SSID and PassPhrase . . . [OK] AT+NDHCP=1 (request IP number from DHCP server) [OK] AT+WAUT0=0 f germaine (automatically connect to germaine) [OK] AT+NAUT0=l f 1 , , 8011 (setup for auto connect: server, TCP, port 8011) [OK] ATA (start auto connect) IP SubNet Gateway 192.168.2.7 ; 255.255.255.0: 192.168.2.1 [OK] (now you can connect (telnet) to the module over Wi-Fi) the board from the host system. The board will be powered from the USB port. If you put a jumper on JP1 ’s pins 2 and 3 and on JP2’s pins 1 and 2 the USB serial con- verter can be used to talk to the host sys- tem. In this case you should not mount the wireless module (or the level converters) as this kind of communication may disturb it. This is the USB-Shield mode. Not installing any jumpers will put the board in Wireless mode and the USB serial converter has no use. However, you could leave it on and wire it to other pins on the extension connectors. This is for instance useful in an Arduino-with-software-UART configuration or in a host system with more than one UART. Finally some remarks on details. The Reset button is mainly intended for Platino which doesn’t have one. It is also useful when the Arduino reset button becomes inaccessible because of the shield mounted on top of it. This depends on the Arduino board and its revision. I<5 is not connected. I only put it on the board to provide access to its signals if the host is Arduino. Turning practical To turn a circuit diagram into a real shield or extension board a printed circuit board (PCB) is needed. I designed one and you can download the Eagle CAD files from the web page that accompanies this article [7]. The PCB is the size of an Arduino Uno except that it is a rectangle without the funny-shaped short side of an Arduino Uno. All the compo- nents are through-hole types; only the Wi-Fi and Bluetooth modules have surface mount footprints. JP5 and the Bluetooth module are located on the solder side of the board; the other components should go on the compo- nent side. Note that if you use non-stackable connectors for K1 to l<4 you should mount them on the solder side if you want to stick the board on an Arduino or Platino. JP1 andJP2are positioned in such a way that the jumpers should always be in the same position, i.e. both to the left, both to the right or both absent. Actually, you could leave a jumper on JP2 in case you wanted to listen in on the MCU wireless module com- munications. This can be useful for debug- ging purposes. JP3 has a few contacts in common with the BOB serial-to-USB bridge, the idea being that you use either a BOB or an FTDI cable, not both. For full 3.3 V systems the level converters and voltage regulator can be left off. In this case you have to place two bypasses (wire bridges) from R3-JP1 to R2-T2 and from R6-MOD1 to R5-T3. Resistors R3 & R2 and R5 & R6 are positioned in such a way that the wire bridges are very easy to install and 32 10-2012 elektor WI-FI/BLUETOOTH/USB SHIELD FOR PLATINO AND ARDUINO Figure 4. The three main configurations next to each other. The Bluetooth module is not visible (middle board) because it is mounted on the other side of the PCB. Note that this is an early revision of the PCB that has the same shape as an Arduino Uno board. The final PCB is rectangular. span only minimum distance. You will also have to short JP5 on the solder side of the board. As mentioned before, the orientation of the LEDs depends on the wireless module. The component print on the PCB corresponds to the Wi-Fi module. If you mount a Blue- tooth module you should mount the LEDs D1 and D2 ‘the wrong way around’. Also, only mount R7 or R 8 and R9 or R1 0. The 3.3 V voltage regulator can be installed lying on his back or standing up. Three main configurations are possible (Fig- ure 4), but you may have a need for other variants: • Wi-Fi shield — no need for the BOB if you own an FTDI cable, although you can always install one. JP3 is available for connecting the FTDI cable. Mount all LEDs as indicated on the PCB and do not mount R 8 nor R1 0. Level converters will be needed and the 3.3 V voltage regu- lator probably too, depending on your host system. • Bluetooth shield — similar as the Wi-Fi shield except for the LEDs. D3 has no function and you should not mount R7 and R9 but mount R 8 and R1 0 instead. As an antenna you can use a piece of (insulated) wire of 31 mm long. • Serial-to-USB bridge shield — just the BOB without level converters. Do not forget to put a drop of solder on JP1 of the BOB to configure it for 5 V or 3.3 V operation. Add 3.3 V voltage regula- tor and reset push button to taste. The LEDs can be useful too, but you will have to wire them to a connector pin. You should short pins 2 and 3 of JP1 and pins 1 and 2 of JP2 with a jumper or a wire bridge. Testing In case of the Wi-Fi or Bluetooth configura- tions connect the board to a USB port on the PC using an FTDI serial converter cable or the BOB serial-to-USB bridge. Figure out which COM port was created by the operating sys- tem (OS) of your PC (make sure you have the appropriate drivers for your OS installed. If you haven’t you can get them, including the necessary documentation, at www.ftdi- chip.com) and start a serial terminal pro- gram. The WizFi220 module has a default baud rate of 1 1 5 200 bits/s, for the BTM220 module this value is 1 9 200. Both modules use 8 bits, no parity and no hardware flow control. In the terminal type ‘AT’ followed by the Enter key. If you set up everything the right way the module should respond with ‘[OK]’ or ‘OK’. If this test succeeds you’re in business. Refer to Listing 1 fora working Wi-Fi example (don’t forget to adapt the SSID and pass phrase to your network). For a BOB serial-to-USB bridge configura- tion the steps are more or less the same except that there is no point in punching in AT commands in the terminal unless your host system responds to these. It is up to you to provide a host that can communicate over a serial link. Thanks go out to Joachim Wulbeck ofWIZnet Europe GmbH (www.wiznet.eu) for providing the WizFi220 modules and the Wi-Fi antennas. ( 120306 -I) Internet Links and References [1 ] Platino: www.elektor.com/ 100892 [2] USB-to-TTL serial cable: www.elektor.com/080213 [3] BOB serial-to-USB bridge: www.elektor.com/ 1 1 0553 [4] Experiments with Rayson Bluetooth modules: http://elektorembedded.blogspot. com/201 0/08/rayson-btm222-btm1 1 2- bluetooth-modules.html [5] Bluetooth with the ATM 18: www.elektor.com/080948 [ 6 ] Bluetooth for OBD-2: www.elektor.com/09091 8 [7] Wi-Fi shield: www.elektor.com/ 1 20306 [ 8 ] Wi-Fi shield on Elektor Projects: http://www.elektor-projects.com/pro- ject/wi-fi-bluetooth-usb-shield-for-ardui- no-platino.1 2252.html elektor 10-2012 33 RADIO AVR Software Defined Radio (6) Decoding options for BBC 198 kHz data signals By Martin Ossmann (Germany) This series has demonstrated that the ever- popular AVR controllers are also useful for signal processing. In this final instalment we take a closer look at a few more decoding methods. As usual we like to back up the theory with some practice: This instalment shows how to extract time-of-day information from BBC AM broadcasts. In the last instalment of this series [5] we demonstrated the decod- ing of time-signal transmissions. Using the described digital MR and matched CIC filter it is possible to receive and decode time signals sent by the German DCF77, the UK MSF and French TDF1 62 stations. In this instalment we go on to decode the digital information trans- mitted by the BBC on long wave at 1 98 KHz (Droitwich) and also the recently discontinued medium wave 648 KHz service. To this aim we look at alternative decoding strategies and demonstrate how they can be implemented. Bit-clock synchronisation In the world of communications technology there are many meth- ods by which synchronous data can be sent through the ether. Here a digital data stream runs continuously through the communication system at a defined clock rate. At the receiver the signal often first undergoes demodulation. The resultant signal is then a seguence Figure 1 . Frequency spectrum of the 31 .25 Hz data signal. of data bits which contain the transmitted information. For this experiment to achieve bit-clock synchronisation with the receive data it will be necessary to use a simple radio front-end (or the receiver board available from the Elektor shop), the receiver software ‘EXP-RX-FM-1 25l= ClockPeriod ) { Clkl6=0 ; } } void doSignalSample( ) { intl6_t Signal ; ATOMICBLOCK(ATOMICFORCEON) { Signal=FRQcicout ; } ClockPLL16(Signal) ; doBitSample(Signal) ; advanceCLK16( ) ; [7]. Data is sent by modulating the 198 KHz carrier phase by ±22.5°. The data rate achieved is 25 bit/s using Manchester coding (also known as bi-phase coding) with filtering. Using this type of modula- tion ensures that the average phase deviation always sums to zero If 47, SO % A: l2om-V 2.4 1 V A: 40.4itis li* ' i J , +$ in s 24 Okt 2009 16:31-31 Figure 4. Eye diagram of the BBC1 98 signal. elektor 10-2012 35 RADIO Figure 5. The complete receiver for reception of BBC1 98. Listing 2 : Early-Late Synchroniser void earlyLateSynchronizer(intl6_t Signal){ if ( Clkl6==3 ) { earlyValue=abs (Signal) ; } if ( Clkl6==12 ) { lateValue=abs (Signal) ; } if ( Clkl6==8 ) { earlyLateDelta += lateValue-ea rlyValue; ClkCnt++ ; ClockPeriod=16 ; if (ClkCnt==10) { ClockPeriod += earlyLateDelta/16 ; earlyLateDelta=0 ; ClkCnt=0 ; } } } so (as before the modulation was introduced) the carrier can still be used as a highly stable frequency reference. The A/D converter uses a clock equal to 20 MHz/ 2,500 = 8 kHz. At this sampling rate the 1 98 kHz carrier is mixed down to 1 98 kHz - (25 x 8 kHz) = -2kHz. The ‘intermediate frequency’ is therefore -2 kHz and is sampled at four samples per period in the same way as in the IQ sampling mixer earlier. The negative sign indicates that the mirrored sideband is used. After separation into the / and Q components both are first passed through second-order CIC filters and downsampled with an M d factor = 1 6. Next in line is another low-pass CIC but this time without downsampling. Instantaneous values of amplitude and phase values are now produced from these filtered / and Q signals processed using the CORDIC process. One possibility for signal demodulation is to use a PLLto recover the carrier and then decode the NRZ (Non Return to Zero) signal. Here it refers to the original data signal which has been used to phase modulate a carrier and which will be recovered in the receiver. For decoding however the use of a PLL control loop which interprets a phase modulation as a frequency modulation is not necessary. The conversion is shown in Figure 7. The theoretical NRZ-phase response is represented as a signal response p(t). To reduce the signal bandwidth phase changes occur only slowly. The actual phase response is more like the signal q(t). The sampling rate forthe demodulated signal is 400 Hz so each bit is sampled 1 6 times. Now according to communication theory fre- quency is the rate of change of phase. The frequency response f(t) is given by the derivative of q(t) with time. When the phase increases linearly with time there is a constant positive frequency. When the phase decreases linearly with time there will be a constant nega- tive frequency. Using additional low pass filtering the signal g(t) is recovered from f(t) and can now be readily evaluated. The data stream is sampled mid-bit to determine its value. When the value is positive it is inter- preted as a ‘1 ’ and when negative as a ‘O’. Application of the CORDIC algorithm produces phase samples to give the instantaneous fre- quency. These are again low-pass filtered with a CIC filter to produce the signal g(t). This signal in turn supplies the bit-clock recovery. This results in the waveform shown in Figure 8 in the second instal- ment of this series [2]. With more processing the blocks of data are identified and decoded. How this functions will be explained later on. For now Listing 3 shows a data sample received from the BBC 1 98 kHz signal. Block Synchronisation Once the data bit stream has been recovered from the receive signal the final task is to identify the beginning and end of the data packet. This process is known as block synchronisation. The majority of radio traffic systems use blocks of data of fixed 36 10-2012 elektor AVR SOFTWARE DEFINED RADIO length. When the receiver is first switched on it is necessary to determine where the beginning of each block occurs in the data stream. There are several commonly used techniques to identify data start; one method is to use a unique sequence of bits to form a preamble. This sequence is never allowed to occur in the data field. RFID tags of the type EM41 02 use this method. This preamble occu- pies space in the data stream and therefore, to some extent reduces the available channel data bandwidth. Many communication sys- tems use the information contained in the data for error correction field as the block boundary marker. Error detection Many data communication systems use a checksum added to the end of each block of data which allows the receiver to detect data corruption and also to correct the error. It can be shown that this additional information can also be used to perform block synchro- nisation. First we will describe how the checksum is calculated using the 1 25 KHz test transmitter together the ‘EXP-TX-FM-1 25kHz- RDSlike-VOI .c’ program. The calculation software is given in List- ing 4 and the CRC hardware generator block diagram is shown in Figure 8. Ten CRC check bits are calculated using a shift register with XOR gated feedback taps. The 1 6 data bits are clocked through a shift register and control the new bits which end up in the syndrome shift register. The CRC checksum is produced after 1 6 clock periods cor- responding to the 1 6 data bits. A hex value of 1 98H is added to the checksum using the XOR function which simplifies the synchroni- sation process at the receiver site. The 1 0 check bits are sent after the 1 6 data bits. This technique is very similar to the standard RDS system described in [8]. When the receiver knows where a new block starts it computes the syndrome (in exactly the same way as the transmitter) of the fol- lowing 1 6 data bits and compares it with the 1 0 CRC bits follow- ing the data. In order to find the start of the block it is necessary to check each time a new bit is received whether the previous 26 bits produced an error-free combination of 16 data bits and 10 checksum bits. This test produces an ‘OK’ at a spacing of 26 bits while receiving a continuous data stream. Occasionally an ‘OK’ will occur in an incorrect position. The block synchronisation algorithm looks for a pattern with three ‘OK’ signals spaced by 26 bits. When this is detected it assumes that the block start has been correctly identified. Figure 9 shows schematically how the check bits are continuously calculated. The syndrome calculator can be looked on as a type of filtering. The feedback shift register is configured in the same way as the one used in the transmitter path. The continuous stream of bits are processed and as each bit emerges from the 1 0+16 bit shift register it is taken into account in the syndrome shift register. The software need only check if the syndrome shift register contains the value 1 98H which was the value added during encoding at the transmitter end. When this value is found the software responds with an ‘OK’. A counter called ‘localTime’ is incremented from zero to 25. A value of zero indicates that a complete block together with the check bits have been processed. Listing 3: BBC ig8 kHz signal: receive Data +E EB11 0391 +0 AAAA AAAA +E E8F1 0391 +E EB09 0391 +E EB49 0391 +0 AAAA AAAA +E EB31 0391 +E EB41 0391 +0 5475 2980 time= 18:38 week=07 day=02 tuesday +E EB29 0391 Listing 4: Transmitter CRC calculation SendBits (w, 16) ; Syndrom=0 ; for ( j =0 ; j <16 ; j++) { Syndrom=Syndrom«l ; // outgoing bit is at mask 0x0400 if (w & 0x8000) { Syndrom 0x0400 ; // xor into outgoing bit } w=w«l ; if ( Syndrom & 0x0400 ) { Syndrom 0xlB9 ; } } ; Syndrom=(Syndrom /v ofs)«6 ; SendBits (Syndrom, 10) ; elektor 10-2012 37 RADIO Data (16 bits) O 0x01 B9 = ObOOOl 10111 001 = 9876543210 g(x) = x A 1 0 + x A 8 + x A 7 + x A 5 + x A 4 + x A 3 + x A 0 Figure 8. CRC1. To demonstrate this behaviour, a variant of the receiver was pro- grammed so that the actual time (localTime) is output as a saw- tooth waveform from the PWM-DAC output. The second PWM DAC output will be high when the synchronisation circuit detects an ‘OK’. The repetitive waveform can be seen in Figure 1 0. Also vis- ible is a position where a false ‘OK’ is detected. It is may be neces- sary to wait a little before this random event happens. After synchronisation when the ‘OK’ occurs at the time interval zero it indicates that error-free block has been received and the data can be output. With this the data reception process is complete. This description of synchronisation applies for the BBC long wave transmission on 1 98 kHz. The data sent by the BBC does not how- ever contain RDS parameters but uses blocks of data containing 47 data bits with a 1 3-bit checksum. The data is described in detail in the documentation [7] and is relatively easy to extract. In particu- lar, for simplicity the time-of-day information is simply coded in one complete block. BBC648 AMSS reception and decoding This last exercise was intended to demonstrate data reception from the European World Service signal which the BBC transmits on 648 KHz. In the mean time due to budget cuts transmission on this frequency has sadly been discontinued. It is however instruc- tional to demonstrate how the AMSS data is decoded in this case. Up until recently the BBC sent low frequency AMSS data as part of its 648 kHz AM transmission (see the associated literature [10]). The front end of our receiver samples at 20 MHz / 1,875 = 10,666... kHz. This results in an intermediate frequency of: 648 kHz - 61 x 1 0,666... kHz = -2,666... kHz = 0.25 x 1 0,666... kHz. Bi-phase signalling is used with a phase modulation of ±20°. With regard to the modulation and bit-coding method used by the data traffic it is (almost) identical to 1 98 KHz system described ear- lier. The difference here is that each block consists of 36 message bits and 1 1 CRC check bits. Two blocks form a group and a defined number of groups form a DRM-SDC block. A complete description of all the features is available in the DRM specification. Our simple receiver only extracts and displays the name of the transmitter sta- tion but is, never the less, a fully functioning data receiver. Listing 5 shows the receive data. The output ‘2/7+’ indicates that the second group from seven has been received with no detected errors. The data is decoded when all seven groups have been received. And finally... This now brings to a close the six-part series on signal processing and ‘Software Defined Radio’ using AVR microcontrollers. It has powerfully demonstrated just what can be achieved with even rel- atively modest microcontrollers. Commercial SDR receivers employ Listing 5: BBC 648 kHz signal: AMSS SDC data [6 1] BBC WS [C B] [6 B] 0/7+ 1/7+ 2/7+ 3/7+ 4/7+ 5/7+ 6/7+ 7/7+ ! 0007 [6 1] BBC VIS [C B] [6 B] 0/7+ 1/7+ 2/7+ 3/7+ 4/7+ 5/7+ 6/7+ 7/7+ ! 0007 [6 1] BBC VIS [C B] [6 B] 0/7+ 1/7+ 2/7+ 3/7+ 4/7+ 5/7+ 6/7+ 7/7+ ! 0007 [6 1] BBC VIS [C B] [6 B] 0/7+ 1/7+ 2/7+ 3/7+ 4/7+ 5/7+ 6/7+ 7/7+ ! 0007 [6 1] BBC VIS [C B] [6 B] 0/7+ 1/7+ 2/7+ 3/7+ 4/7+ 5/7+ 6/7+ 7/7+ ! 0007 38 10-2012 elektor AVR SOFTWARE DEFINED RADIO Figure 9. CRC2. exactly the same techniques as detailed here; the only difference is that they use more powerful DSPs and radio front-ends which of course also makes them correspondingly more expensive! ( 120392 ) Internet Links [1] www.elektor.com/100180 [2] www.elektor.com/100181 [ 3 ] www.elektor.com/100182 [ 4 ] www.elektor.com/ 1 20088 [ 5 ] www.elektor.com/ 1 20089 [6] www.elektor.com/ 1 20392 [ 7 ] http://downloads.bbc.co.uk/rd/pubs/reports/1984-19.pdf [8] ftp://ftp.rds.org.uk/pub/acrobat/rbds1998.pdf [9] www.drm.org/ Figure 10. The OK signal. [10] www.ebu.ch/fr/technical/trev/trev_305-murphy.pdf www.broadcastpapers.com/whitepa- pers/ABUBBCamss2006.pdf?CFID=1 6508900&CFTOKEN=dac28b1 a87e5 4d77-47F9A337-9A30-F5E3-667FAB2A9EA27223 Elektor products and support Signal generator (Kit with PCB and all components, #100180-71) Universal receiver (Kit with PCB and all components, #100181-71) Active ferrite antenna (Kit with PCB and all components, # 100182-71) Combi-kit with all three components plus USB/TTL converter BOB FT232: #100182-72 • USB/TTL converter BOB FT232, fully populated and tested, # 110553-91 • Free software downloads (hex files and source code) All of these products and downloads are available through the web page: www.elektor.com / 1 20392 elektor 10-2012 39 TEST & MEASUREMENT Picoammeter By Burkhard Kainka (Germany) It is often necessary to deal with tiny currents in the picoamp to microamp range when making measurements in ionisation chambers and other radiation sensors, as well as when testing insulation. R1 0...+40V R1 6 0,1pA...1uA O I -| 1M |- C1 lOOn T1 r©n BF245 IC1.A 0...+40V -® + 9V 100...600mV -o Ml © 120322 - 12 The instrument described here can be used to measure currents from around 0.1 pAto 1 pA, without the need to change range. One approach is to exploit the logarithmic characteristic curve of a silicon diode, with the diode voltage buffered by a type TLC272 CMOS opamp. For the first experiment we used a 1 N4148 silicon diode (see l/h circuit). However, the lowest current measurable using this arrangement was over 1 0 pA, as below that value the diode’s characteristics deviate from the logarithmic curve. A particularly good diode with a very low reverse current is the gate-source diode inside a BF245 JFET (see lower circuit). Using this we can measure currents of less than 1 pA. To calibrate the circuit we use known currents at the input and measure the output voltage: 1 jlxA 580 mV 100 nA 510 mV 10 nA 440 mV 1 nA 370 mV lOOpA 300 mV The above values closely follow a logarithmic curve: each increase in current by a factor of ten gives an output voltage increment of 70 mV. We have already covered four decades: the graph shows how the curve can be extended to even lower currents. Experiments show that it is even possible to get useful results with currents of less than 1 pA. In this case, however, it is essential to carefully screen the whole circuit, including the item under test, against the effects of external fields. For the prototype a metal tin was used with feed-throughs. Some results obtained with the prototype: • ionisation chamber with a sample of pitchblende: about 1 pA; • BPW34 photodiode used as a radiation detector (in complete darkness): about 10 pA; • burnt-out filament lamp: about 1 00 pA; • burnt-out halogen lamp: about 0.1 pA. From these last two results we can see that quartz glass is a considerably better insulator than ordinary glass. ( 120322 ) 0 100 200 300 y 400 500 [mV] 600 700 120322 - 13 40 10-2012 elektor ■i. IMS 2 the world needs innovative electronics, they are on display here. electron ica 2012 inside tomorrow 25th International Trade Fair for Electronic Components, Systems and Applications Messe Munchen November 13-1 6, 2012 www.electronica.de 4 * V 5 v Technology ® PicoScope 4-CHANNEL PC Oscilloscope ENTER ONLINE AT www.picotech.com/CM124 CLOSING DATE 30.11.2012 PicoScope 3406B 200 MHz bandwidth 128 MS deep memory 1 GS/s real-time sampling Advanced digital triggering 200 MHz spectrum analyzer Function generator and AWG Spectrum analyzer. Serial decoding Full SDK and advanced triggers (CAN, FlexRay, LIN, SPl, l 2 c, UART) Mask limit testing. Colour persistence modes, measurements and math channels all as standard and free updates ALL MODELS INCLUDE PROBES, FULL SOFTWARE AND 5 YEAR WARRANTY. Easy-access online pooling services cut your board costs • No tooling charges • No minimum order charge - order from 1 PCB • Instant online ordering without pre-payment New added-value PCB services get your designs into production faster • PCB Visualizer immediate online data check • Online advice and tips on design for manufacture PCB proto - dedicated engineering prototype service , fast and low-cost • 1 or 2 PCBs in 2, 3, 5 or 7 working days • DRC-checked and fully finished with 2 soldermasks and 1 legend, 150pm technology • 1 x 100 x 80mm in 7WD - 2 layer 47,03 € - 4 layer 95,52 € • 2 x 100 x 80mm in 7WD - 2 layer 36,89 € each - 4 layer 74,76 € each Prices quoted include 2 1 % Belgian VAT but exclude transport costs STANDARD pool - the widest range of pooling options in Europe • 1-8 layers 150nm technology PCBs • from 2 working days TECH pool - all the benefits of pooling for high-density PCBs • 2-8 layers 100pm technology PCBs • from 4 working days IMS pool - aluminium-backed PCBs for high heat-dissipation (LED) applications • Single layer Insulated Metal Substrate PCBs • from 3 working days On demand - multi-option non-pooling service for specialist needs • 1-16 layers down to 90|jm technology • from 2 working days www.elektorPCBservice.com By Jens Nickel (Elektor Germany Editor) Good news for all automation enthusiasts in general and Elek- torBus friends in particular: more bus hardware is in the pipeline, including a larger Xmega board with display and web server module that you can use as a control centre. The C firmware library is on the way. More at www.elektor-projects.com! Meanwhile, here’s a small E-Labs Inside instalment, hopefully with yet more educational value. When we designed our RS485 relay Board [1] an extra access point was provided to the RS485 driver’s signal ground (SIG_GND = signal ground). The idea was to pass on the RS485-driver ground via an additional line run from node to node, in parallel with the ElektorBus ground for the supply of each node (GND). This was explained in the article: “ When loads are switched it is pos- sible that there will be local inter- ference generated on the bus ground; and if the ground poten- tials at the drivers differ too widely this can result in spurious bits being detected on the bus. One solution might be to connect signal ground directly to bus ground at only one point on the bus, while in the other bus nodes the two signals are linked via (for example) a 100 Cl resistor. ...We have not yet tested this possibility... ” We received an email on this subject from Elektor reader Andreas Schoenberg, who has been professionally engaged with RS485 bus systems (among others) for about 25 years. Our desire to have a “reference ground” that’s always at the same level for all the bus drivers, appeared reasonable. However with the LT1 785 the common-mode voltage at A/B is allowed to be in the range of -7 to +12 V (w.r.t. ground). Even when the ground potentials of two bus nodes differ by 7 V, all bus levels would still be interpreted correctly. Andreas Schoenberg con- tinued, “Statically this cannot occur in the circuit. If 7 V appears to drop on the GND line to some high-current bus node, then an equal amount applies to the supply line, meaning a total of 1 4 V would be lost.” Surely that’s not possible, because the bus supply voltage is only 1 2 V. He continued: “Dynamically, it cer- tainly looks different — if a relay is energized in a module, this can cause a short voltage dip. If so, this should be counteracted with local capacitances at the supply pins of IC3. Provided suffi- cient local buffering is available, I believe that ground shift prob- lems cannot occur in your system or in the transceivers used, to the extent of disrupting the communication.” However, if you actually have a bus node that draws so much power and/or is connected using long, thin wires, that GND is at 3 V above SIG_GND due to a voltage drop, other problems can be expected. The LT1785 at its V cc pin invariably ‘sees’ a voltage that’s 5 V above the local GND potential — hence in this case it is powered at 8 V. However the DE pin is pulled to GND via R3, and DE cannot be pulled lower by the CPU because that too is referred to this ground potential only. For the transceiver however, that’s still 3 V above its own ground connection (SIG_GND), i.e. always High. The Driver Enable pin is then out of control by the software! So much for theory. It would be interesting now to know how you got along with the wiring of the ElektorBus hardware and if you ran in to any problems. Here at Elektor we already estab- lished that the communication is very robust, even with long, el-cheapo cables and four lines [2]. Which cables did you use? Tell us on editor@elektor.com (120501) [1] www.elektor.com/ 1 10727 [2] www.elektor.com/ 1 201 98 elektor 10-2012 43 E-LABS INSIDE E-LABs INSIDE AVR reset-out-of-the-blue issue ;u Sit Li : J- 3 G 4 +, $4 4 h« -CPHl I f l f k+fc- ♦**»*,, S*ii±«l4*±r: ! MtsiLi. -i. A itiu»i HI i-i; iCirtii iitfituMSiL.- ESI .ii Kat.il, ;in St-:** tt±*± > ljj, i- ii;nLEV*lfl.. r ! i >i- | *a .iii ! n .: 4 .- ■r^-i £i ±Tf ■ * E± * bd lft] j Jt if- . Ss I U i« . j 1 £6. t . CtftVl Id .M’-.ii t dl i J 3 Htrrz * m ft*™*™ iia fri. p,: |fi '*-■.-■11 t't an he* lac. »l [ 1 idM By Koen Beckers (Elektor Labs) Perhaps you’re familiar with this next problem: during com- munication between your PC and an AVR microcontroller in your new circuit the microcontroller resets itself abruptly for no particular reason. This happened to me while I was testing my design for a WiFi LED strip. Having tried several configurations and done a number of tests, I determined that it happened when I tried to have the micro- controller receive a large packet of data via its UART port. Some- times it seemed to work, but most of the time the microcon- troller was resetting itself and occasionally it crashed instantly after the transmission started. Very occasionally it kept reset- ting itself and the only thing to resolve this was to shut off the power supply. ‘Consulting’ Dr. Internet, I learned this was a very common issue with AVR microcontrollers. Luckily a simple solution is available: The UART connection needs to be fitted with a series resistor of 1 0 k£l and a bypass capacitor of 1 00 pF essentially creating a low pass filter at about 1 59 kHz. My issues were with the reception of data, so I inserted a series resistor in the RX line and added a capacitor from RX to GND. A few lines of test code looping back the data received on RX to my PC (see the screenshot) confirmed the correct functioning of my circuit. All data got received correctly without the micro- controller crashing. Just to make sure it wasn’t my freshly written chunk of test code that fixed the problem, I removed the RC filter. Running my test code again resulted in an immediate crash of the micro- controller. After reinserting the RC filter all worked flawlessly again. I guess it’s safe to say this simple RC filter solved my issue. Perhaps it can solve yours too! (120386) E-Pollution! By Thijs Beckers (Elektor Editorial & Labs) As always testing and measuring is part of the daily lab activities and very rarely problems pop up of the really unexpected type. When fellow lab worker Ton Giesberts was testing a DCF77 (European time signal) receiver for our popular AVR-SDR article series (series started in March 2012 edition [1]), he ran into some serious issues. It proved plain impossible to receive the radio signal inside the lab. He even tried different locations inside our castle but to no avail. Admittedly, the castle walls are quite bulky (approx. 80 cm, 2.5 feet) and may prevent the signal from entering, but even when the antenna was mounted on a 2 m ( 7 ft) long scrap 44 10-2012 elektor batten held out through a window so the antenna was well outside the castle walls, there was still zero signal. Suspecting the WiFi routers, PCs, laptops, fluorescent lighting, switching wall warts and DECT telephones could be interfering with the signal, Ton brought an old portable AM radio with long wave band reception from home and started walking around in the building, trying to receive the old faithful BBC4, the purpose of this being to find the most ‘silent’ place in the castle. This radio station transmits on long wave at 198 kHz. But nowhere in the castle did he find a sign of the signal. It was all dirt and noise — e-smog (Hey, didn’t we have a handily e-smog tester shortly? Yes, we had. It’s the TAPIR. Go check it out [2]!). Only after taking the radio more than 5 m (15 ft) outside of the castle walls, a weak signal of the station could be heard. When entering the building again — with the radio switched on — Ton noticed quite some interference signals when he held it next to the fluorescent lighting. Turns out they generate quite some noise exactly in the 198 kHz range. So one (very) early Monday morning, when there were very few staff present and all the lights were still off, he tested again. But still there was far too much noise coming from PCs, WiFi-routers, DECT telephones, printers and other electronics that never goes silent. So much for testing sensitive equipment inside the castle. A proper worst case scenario test though; when a circuit passes testing inside our labs, it sure is interference-proof... Fellow lab worker Luc Lemmens experienced the same problems with a design soon to be released. He decided to take his testing matters elsewhere: home. As soon as he powered up his prototype (also with a DCF77 receiver) everything came to life and functioned as it should — right out of the box! Ton ended up sending the prototype to an esteemed external author for testing. And it worked instantly when he tested it. So the lesson to be learned is: Do you want to test a prototype with radio receiving capabilities? Don’t be too disappointed when it doesn’t work when testing it in your lab environment. Chances are your circuit works a treat, but e-smog from your electrical devices is interfering with the reception of the signal. (120504) Internet Links [1 ] www.elektor.com/ 1 001 80 [2] www.elektor.com/ 1 20354 Your all-time favourite component By Thijs Beckers (Elektor Editorial & Labs) As an electronics engineer you often get to deal with electronic as well as electrical components. Some are new and just hit the market, others are old and have been here for ages. Like with so many things, you probably have your own preferred voltage regulator, Schottky diode, microcontroller, capacitor type or even vacuum tube. But with vast numbers of Elektor readers out there, there are bound to be differences. So here’s a call to explain to us why this Gunn Diode you always refer to is your favourite. Tell us your experiences with that BRY39 and elaborate on your favourite 1C. Does the LM729 hold any secrets for you? And why do you still use that 6502 for almost every job? We look forward to a flood of emails in our inbox (myfa- voritepart@elektor.com) and hope to be surprised by strik- ing stories and notable narrations on your preferred electronic component. (120503) elektor 10-2012 45 COMPONENT TIPS Energy Harvesting with the LTC3108 & LTC3588-1 By Raymond Vermeulen (Elektor Labs) Imagine you have a sensor, which only has to report its results very infrequently and is located far away. A direct power supply is not practical be- cause of the distance, a battery does not last forever and will eventually have to be replaced. Now what? Energy harvesting! Modern sensors can be very frugal and just like small microcontrollers they often have a power-saving mode of operation. If the average energy requirement in this power-saving mode is very small, then it would be possible to charge a capacitor during this long interval. This capacitor can then power the sen- sor for a brief moment, after which it returns to a sleep state. During this sleep state the capacitor is charged once again. Below I describe two ICs capable of deriving energy from various ambient sources. The LTC31 08 is specifically intended to operate in combination with a Peltier element. The LTC3588-1 is more suited for piezo elements. A circuit idea could be to power the ams lightning detector from last month, together with a mi- crocontroller and RF module, using energy harvesting. LTC3108 The LTC3108 can obtain energy from voltage sources that supply very small voltages, starting from about 20 mV(!). This enables the use of a small Peltier element with only a very small tempera- ture differential. The manufacturer’s datasheet lists a number of other potential sources. The operation is the same as that of a boost/step-up converter with an adjustable output voltage. An LDO with an output of 2.2 V is also present. There is an ad- ditional Vout output that can be switched on and off and can be used, for example, to power a small circuit that needs to be turned on only very briefly and does not have to be placed in some kind of power-down mode. An alternative to this chip is pos- sibly the bq25504. LTC3108 Datasheet http://cds.linear.com/docs/Datasheet/3108fb.pdf Figure 1 . LTC31 08 block diagram. IHlTdUOttEClNC GFHFFU10R WinV TO SQOfW — r ilGlI&B C? Vfluli r SJJ PCD vi nn VS? VSl "wjr: Uj mux AND 5Y nO IF raooD 7.5V Ittff 3ZJV 3tr uP SEW50RS Fir .INK :ipr Figure 2. Application example using a Peltier element. LTC3588-1 The LTC3588-a can obtain energy from a piezo element, but also, for example, from two metal plates positioned close to a fluores- cent light tube. The datasheet offers additional options. A piezo element can generate a relatively high voltage, this is internally limited by the 1C to 20 V. This voltage is then reduced to an ad- justable voltage by a buck/step-down converter. The prescribed piezo-element in the datasheet is very expensive, but perhaps the 1C will also work in combination with a piezo buzzer? If so, is it possible to obtain sufficient energy? This is an invitation for some experimenting! LTC3588-1 Datasheet http://cds.linear.com/docs/Datasheet/35881fa.pdf Figure 3. LTC3588-1 block diagram. x 1()F 8 Y T X X *F|lF &v \u\ waDtvm m P U sw i n if»as-E Vgyr cap PfflMD GiJ.D' GND ! Dili I rr -VliF tv , OUTPUT VOLTAGE SELECT Figure 4. Application example using a piezo element. 46 10-2012 elektor 2013 International PRODUCED BY THE GLOBAL STAGE FOR INNOVATION Genius attracts Feel the pull. L Mpr 1 j 1 ' r.W m ]j ,/F REGISTER NOW MICROPROCESSORS Arduino on Course (2) Part 2: read (awfully) remote using GSM / GPRS sensors This month we’ll explore the your projects. We will link concepts like the possibilities offered by GSM and GPRS communication for [1 ] last year where they envisioned that by 2020 there would be 50 billion connected devices. That would mean that most of our home appliances are connected to the Internet: fridges and microwaves, alarm clocks and TVs, the elevator and the stove. But also all the other devices that surround us like cars, streetlights, or shopping carts (the push- able type, not the icon or applet). M2M (machine-to-machine) is concerned with the connectivity between devices using wireless, wired or hybrid communication. In a sense, M2M makes loT (Internet-of-things) possible as it offers the infrastructure for devices to gather data and transmit it through a network to a remote location. For some people M2M is a synonym of telemetry in whatever form, but in recent years the concept has mutated to refer mostly to wireless communication and to be more specific it is mostly referring to the use of cellular (mobile) commu- nication for remotely controlling devices. Internet of Things (loT) or the Machine To Machine (M2M) business in order to understand what you can achieve all by yourself in a short time. By David Cuartielles (Spain) Shopping list In terms of hardware, here’s what you need to be able to replicate the experiment discussed in this instalment: • Arduino Uno board; • Arduino GSM shield (made in collaboration with Telefonica l+D); • a SIM card for the GSM/GPRS network; • a cellphone (‘mobile’) with its own SIM card; • TinkerKit shield; • TinkerKit LED module (x3); • TinkerKit Slider module. The last three items in the list can be substituted by a breadboard and a combination of various components. However, to keep the focus on the operation of the GSM library for Arduino, I have opted to use pre-assembled parts. Now, before you read on, I strongly recommend you download all the code used this month. Due to the length of the example pro- grams, only excerpts are printed here. Introduction to M2M and loT Putting it in easy terms, loT is a computing paradigm that is being explored lately by many research laboratories and universities around the world. It tries to bring to life the idea that everything can be connected to the Internet: your microwave and your car, passing by your door lock and your bike at the gym. All those objects should be able of talking to each other in some way and exchange data to offer people better ways to handle different situations. Ericsson, the Swedish communication giant, presented a memo For the sake of simplicity, when talking about the loT I mean the connection of devices to the Internet, while M2M will be a way to make this possible through the cellular telephony network. You will find many articles and videos on the Internet that follow the same approach, the reason being that the most extended net- work right now is the one called GSM (global system for mobile communications). I assume that you are reading this article because you plan on mak- ing a connected device. Imagine that you create an object that’s going to connect to the Internet and send data back to you from anywhere in the world — what, do you think, is the best way to do so? The answer is obvious: cellular telephony. GSM is a great alter- native as it allows you contact your device almost anywhere in the world knowing that it will work, basically like at home. The Arduino - GSM/GPRS Shield From Arduino we want to simplify as much as possible the way you build prototypes and learn about technology. Therefore we have spent quite some time thinking about how to help you get- 48 10-2012 elektor ARDUINO ON COURSE ting hooked to this trend of loT in many ways. One of them is through M2M and for that we teamed up with Telefonica’s Physi- cal Internet Laboratory. We have been collaborating in making an official Arduino shield that easily handles GSM/GPRS (also known as 1 G and 2G) communication. We also wrote a library that simplifies the process of texting (SMS transmission), setting up calls or publishing some data on a website. The design is open source and the software can easily be ported to support other shields (with potentially other series of AT-Com- mands; more about this later). Finally, the shield comes with a SIM card, courtesy of Telefonica, that will offer you the possibility to hook up to send/receive text (SMS), set/get voice calls, and con- nect to the Internet through the GPRS network. Note: This shield is not locked to the accompanying SIM; you could use any other GSM/GPRS SIM card available in your country. The SIM is optimised for data communication; if you wanted to make something controlled over Text (SMS), you should consider a SIM card operating on your preferred network. If you were about to use the card coming with the board, you should follow the online acti- vation instructions that come with it. Controlling a modem - AT commands Modems are the devices behind the expansion of the Internet. In order to automate the way they would operate, a company called Hayes [2] invented in 1 981 what would later be called the AT-Com- mand Set. The idea behind it all is for modems to change between Command and Data operation modes. The Command mode would allow performing operations on the modem itself like calling a cer- tain number, changing the baud rate (the speed at which the data would be transferred), etc. The Hayes Command Set became a de-facto standard for the way devices should communicate over a serial port. That standard is still operating inside many devices. When in Command mode, devices start the communication sending the string “AT” which stands for “attention”. That would be followed by other strings that would translate in different operations to be performed at the other side. On the other hand, when in Data mode, the data will just be proxied to/from the Internet through the modem. The GSM/GPRS shield has a radio modem manufactured by Quec- tel [3] that can be operated using a series of AT commands. Most of those commands are specific to the modem on the board, but the library that controls the shield has been written in a way that makes very easy to port it for other modems made by any manufacturer. Also, the library hides all the complexity behind this mode of opera- tion. Therefore, we are not going to refer to them in the rest of the article. However, if you happened to use the GSM library in debug mode, you would be prompted with many of those commands. Installing the GSM Library for Arduino At the time of writing this article the Arduino IDE had reached revi- sion 1 .0.1 and did not include the GSM library we’re about to dis- cuss. Thus, when checking the menu ‘Sketch / Import Library’ if you don’t see the library named ‘GSM3’ in the list, you will have to down- load it from the official Arduino website hosting this project [4] and install it as explained under the ‘Library’ link. Essentially, adding a new library to the IDE is done by creating a folder called ‘libraries’ inside your sketchbook and uncompressing the file you got from the website [4] directly there. After that, you should restart the Arduino IDE and the library will then show up in the above mentioned menu. With the library you will be installing not only the code to execute different commands on the modem, but also a series of examples that will allow you to: • test whether the modem is working properly; • text, i.e. send/receive SMS; • place/get phonecalls (voice); • open a TCP/IP connection and exchange data over the Internet, using GPRS; • post/collect sensor information to/from Cosm (an online data service); • collect and show twitter messages. The way to access the examples is simple: just use the menu to navi- gate through “File / Examples / GS/V73”. Checking your status Likely, the first thing you want to do is checking whether your board is working properly and whether your SIM card can be used by the shield for you to experiment with. To do so, open the example under // libraries #include // modem verification object GSM3ShieldV1 ModemVerif ication modemTest ; // IMEI variable String IMEI = // serial monitor result messages String oktext = “OK”; String errortext = “ERROR”; void setup() { // initialize serial communications Serial . begin (9600) ; // start modem test (reset and check response) Serial . print(“Starting modem test...”); modemTest . begin() ; Serial . print In (oktext) ; } elektor 10-2012 49 MICROPROCESSORS * k t dev tty, uis srogdemUdli £ fnvur 5ia'iiiPf >Ei>t I*. irs -"'Ll »•: '*v**>' ■* ?■•■? " HtiLtaiHJll] •intlri+i 1 1 Ti LC^lL ■ v v^ 1 , jmirnla .i.ilcrridl i ci N .tvva nw S' n.i.jJm void loop() { // get modem IMEI Serial . print(“Checking IMEI. . IMEI = modemTest . getIMEI () ; // check IMEI responsed if (IMEI ! = NULL) { Serial . println(oktext) ; // show IMEI in serial monitor Serial . println(“Moderrr s IMEI: “ + IMEI); // reset modem for check booting Serial . pr in t( “Reset ing modem. . . ”) ; modemTest . begin () ; // get and check IMEI one more time if (modemTest . getIMEI () != NULL) { Serial . println(oktext) ; Serial . println(“TEST COMPLETE ! ”) ; } else { Serial . println(errortext) ; } } else { Serial . println(errortext) ; } while(true) ; the menu: “F//e / Examples / GSM 3 / Tools / TestModem”. This code example allows you to check whether Arduino can detect your radio modem. It also opens a connection to the radio modem on your GSM shield and attempts to read the IMEI (International Mobile Equipment Identity) from it — that’s a unique number for every device capable of connecting to the GSM/GPRS/3G/4G net- work. For example, your cell phone identifies itself via the IMEI. Every device on the GSM network has a unique ID. If everything goes fine, after uploading the example on your Arduino Uno, and opening the Serial Port Monitor, you should see something like in Figure 1 . If your modem was working correctly, the next thing is to check whether you can connect to the GPRS network. To do so, we will open the example: File / Examples / GSM 3 / Tools / TestGPRS. I will not show the code here, as it is very similar to the previous one. This example is used for testing that your SIM card allows connecting to the GPRS network (the one provided with the shield does), but also to test your settings. Note: this shield is using GSM/GPRS technology and not 3G. 3G and GSM SIM cards look the same, but remember that some of the mod- ern operators do not offer 2G (the way we call GPRS) services. Connecting to the GPRS network calls for a tad more configuring than just texting (sending an SMS) or placing a call. There are four parameters that need to be configured: • APN: acronym for Access Point Name or the name of the domain the shield will connect through to reach the Internet. Figure 1 . Positive answer from the TestModem example using the Serial Monitor. Figure 2. Configure your GPRS connection using the Serial Monitor. It is specific for the operator providing you with connectivity through the shield; • login: some operators require a login; • password: some operators require a password; • proxy: this is the address to a server that will channel all your communication inside the operator’s network. Most likely it won’t be used. The way this example works is by asking you for the information the shield needs to connect to the network. Tip: remember activating the option ‘Newline’ in the dropdown menu at the bottom of your Serial Port monitor. In this way, when clicking on ‘Send’ on the monitor, the system will add an end-of-line (EOL) character that is needed for the modem to know the informa- tion package came to an end. I everything goes fine, you will see a window like in Figure 2. Those messages mean that your shield can connect to the Internet using your SIM. Please note that even if you couldn’t connect to the Inter- net, it may still be possible for you to text-out, get text (send/ receive SMS) and set up calls. Texting (sending an SMS) Texting or receiving text (sending or receiving SMS) with the GSM 50 10-2012 elektor t> TUB) O -f jl «i 0:26 Arduino GSM/GPRS Shield 0:25, Arduino GSM/GPRS hola caracola a Figure 3. Screenshot of my phone after I was texted. // send the message sms . beginSMS( “0755442200”) ; sms . print(“hola caracola”); sms . endSMSQ ; shield couldn’t be any easier. The following lines of code could be part of a program sending a string to a certain number. Note that I am using a fictitious cell phone number! And the result on the screen of my phone would be like shown in Figure 3. The library comes with examples covering both sending and receiv- ing. For example, the code at File / Examples / GSM3 / Tools / SendSMS will be sending an SMS (texting out) from the board to a phone via interaction through the Serial Port Monitor. It will first ask you for the phone number to text to (SMS) and then for the string to send. Try it out! Remotely controlling a device via Text (SMS) Controlling a device remotely implies receiving messages, parsing the data, and operating actuators depending on the different com- mands. In this case we are going to build a quick prototype includ- ing three LEDs: one red, one green and one blue. You can imag- ine that instead of using LEDs we could be attaching relays, and we could be controlling any kind of device on distance. The program is going to read the first character sent in the SMS and turn on the corresponding light: R for red, G for Green and B for blue. This pro- gram is, as you can see, very simple. It doesn’t execute huge parsing operations; it simply reads the first character in the text message (SMS) and decides what to do. After that, the text message (SMS) will be erased from the memory using the command sms. flushQ. // If there are any SMSs available() if (sms. available()) { Serial . println(“Message received from:”); // Get remote number sms. remoteNumber (remoteNumber , 20) ; Serial . println(remoteNumber) ; // This is just an example of message disposal // Messages starting with # should be discarded if (sms . peek()“’#’ ) { Serial . print In (“Discarded SMS”) ; sms. flush() ; } // Read message bytes and print them int count = 0; while(c=sms. read()) { if ( ! count) { digitalWrite(pinR, LOW); digitalWrite(pinG, LOW); digitalWrite(pinB, LOW); switch(c) { case ‘ R* : digitalWrite(pinR, HIGH); break; case ‘G’ : digitalWrite(pinG, HIGH); break; case ‘ B’ : digitalWrite(pinB, HIGH); break; } } count++; } Serial. println(“\nEND OF MESSAGE”); // delete message from modem memory sms. flush() ; Serial. println(“MESSAGE DELETED”); elektor 10-2012 5i MICROPROCESSORS Figure 4. All in hand: Arduino Uno + GSM/CPRS shield + TinkerKit shield + TinkerKit LED. fs Anti.AH GPRS MfulilV" II 124 Figure 5. Information being displayed on a browser as sent from the GSM shield. The following is a part of the example DecodeSMS you can find at the download link [5] for this article. The actual circuit boards are shown in Figure 4. Device working over GPRS Let’s now see how to use an analogue sensor (a slider in this case) and send data from it to a website. On the server side I am using Apache and a very simple PHP script that will be taking the data sent by the board and will update a part of the script containing plain HTML. This is what I like to call a simple ‘online memory cell’. It is a PHP script that can take the data and display it. It will be possible to access that same page using a browser to see the data changing over time. You will need to use the same APN/login/pass combination you used in void loop() { client . connect(server, 80); Serial . pr in tin (“sending data ...”); client . print(“GET “); client . print(path) ; client . print (query) ; client . print(analogRead(A0)) ; // take the value // on A0 and send it client . println(“ HTTP/1. 1”); client . print(“HOST: “); client . pr in tin (server) ; client . println() ; client . stop() ; delay(1 0000) ; } the previous GPRS example for this code to work properly. Here’s how to send an analogue value to a server every 1 0 seconds: You need to have a server to run the php code that will be reading from your Arduino board. The server needs to be publicly accessible as you want your Arduino board to post information to it and to read that data using a browser, a phone or any other web-enabled device. Important: keep in mind that this code is just a proof of concept, it is not safe in any way and you should probably disable the PHP script once you are done trying out the example. The only thing left to do is uncompress the code of the PHP mem- ory cell in the given file [5] at the root folder, to your http server. Make sure the file has read-write-execute permissions to allow it to rewrite itself. You can then type the URL to your server (for example: http://server.com/path/index.php) in a browser to see the informa- tion update every 1 0 seconds. Like in Figure 5. Closing words I hope you found this brief introduction to the use of GSM/GPRS technology in your projects both educational and fun. I want to highlight how relevant it is that we, as makers, can benefit from the existence of an omnipresent wireless network. If you don’t need very data-hungry devices, you could start controlling lots of things over the cellphone network. As long as there is a way to power up your board, you can gather and process data from almost anywhere. (120506) Internet Links [1 ] Ericsson's memo on 50 billion connected devices: www.ericsson.com/res/docs/whitepapers/wp-50-billions.pdf [2] on the AT-Command set: http://en.wikipedia.org/wiki/Hayes_command_set [3] Quectel AT-Command description: http://datasphere.eu/en?t=/documentManager/sfdoc.file. supply&filelD=1 285079825955 [4] Arduino website hosting information about the GSM shield: http://labs.arduino.cc/GPRS/lndex [5] Compressed file with all the examples and images: www.elektor.com/ 1 20506 Acknowledgements My sincere thanks are due to the whole Physical Internet Laboratory team at Telefonica Research and Development, for their support in making this new Arduino shield possible. Special thanks go out to F. J. Zorzano for being there debugging code until late many nights. 52 10-2012 elektor ELEKTOR Preferred Suppliers • Coast Electronics • CS Technology • Easysync • Elnec • FTDI Chip • Robot Electronics • Surf to www.elektor.com 365 days per year preferred suppliers online with up to date and relevant information. To become a preferred supplier contact Johan Dijk byj.dijk@elektor.com FIRST TECHNOLOGY TRANSFER LTD. 1 $ First Technology Transfer Ltd. http://www.ftt.co.uk • Training and Consulting 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 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 THE NEXT GENERATION OF MAXSONAR The HRLV - MaxSonar Sensors •Amazing One-Millimeter Resolution •Simultaneous Multiple Sensor Operation •Superior Noise Rejection •Target Size Compensation for Accuracy •Temperature Compensation ($4.95) •Outputs now include TTL Serial $3495 (msrp) f www.MaxBotix.com 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 SCOPES and more Instruments A Rohde & Schwarz Company www.hameg.com Great Value in TEST & MEASUREMENT www. elektor. com www. elektor. com www. elektor. com www. elektor. com www. elektor. com www. elektor com elektor 10-2012 53 TEST & MEASUREMENT Radiation Meter Reloaded Simple modifications open up new possibilities By Burkhard Kainka (Germany) The radiation meter published in the November 2011 edition of Elektor is currently being used by many readers, mainly in making long-term measurements and in investigating weakly radioactive samples. There are several ways in which we can modify and improve the design, and we look here at a few examples. The ‘Improved Radiation Meter’ was pub- lished in Elektor in November 201 1 [3], The device is available as a kit of parts [2], the ATmega88 microcontroller being equipped with a bootloader that makes it easy to pro- gram your own code into it. Some applica- tions will require just a small change to the code in the basic program, and below we will look at a couple of examples of this. Other applications will require firing up the soldering iron to make more permanent changes: we will look at some of the pos- sible hardware modifications first. Calibration The following question often crops up in our readers’ forum: can the radiation meter be calibrated in standard units such as micro- sievert per hour (pSv/h)? This turns out not to be so easy, as several variables enter into the equation. The most significant of these is the screening used. Experience with the radiation meter shows that it is not easy to screen the sensor com- pletely from light without simultaneously also blocking the radiation we are inter- ested in to a significant extent. Two options are open to us: we could put the sensor and the sample being studied together in a metal can connected to ground, or we could wrap the whole sensor board in aluminium foil, which again must be grounded. Some readers have experienced problems with the latter approach arising from a microph- ony effect: the sensor forms a kind of con- denser microphone with the foil shield. The effect can be mitigated by gluing the foil directly to the sensor. Self-adhesive copper foil, 0.035 mm thick, has also been found to work well in practice: it also has the advan- tage that it is easier to solder the ground connection to it. We tried an experiment using a BPW34 sensor with a copper foil shield. The radi- ation source was a thorium gas lantern mantle in its paper envelope. Because this source has a large area the radiation level at close quarters is approximately uniform, which means that the readings obtained are largely independent of the distance between source and sensor. The Elektor radiation meter gave approximately 40 pulses per minute at a distance of 1 cm. For comparison we used a professional Gei- ger counter with a tube sensitive to beta and gamma radiation, again at a distance of 1 cm. This gave a reading of 800 pulses per minute, corresponding to 20 pSv/h. This gives us our first unofficial calibration result: 1 pulse/min = 0.5 pSv/h In principle the unit is capable of measuring the level of background radiation if readings are taken over a sufficiently long period. Over very long periods it is possible to see a clear change in readings with variations in solar activity. The somewhat longer meas- urement period required than with a Geiger counter does of course make some applica- tions less practical: for example, if you try to measure the radiation from a salad you may well be lucky enough to discover that it is safe to eat, but by the time you know that your rocket will probably have wilted! The device is better suited to investigat- ing small, weakly radioactive, samples than to analysing the background radia- tion. Here the small sensor sizes gives the device an advantage over the Geiger coun- ter, as it makes it easier to discriminate between radiation from the sample and the background. AC coupling There is a further technique we can use to reduce the sensitivity to ambient light: we 54 10-2012 elektor RADIATION METER RELOADED +5V Figure 2. Setting the triggerthreshold. +9V © 71 tA *71 3x BPW34 Figure 3. Three BPW34s in parallel. can add AC coupling between the sensor board and the counter. A 1 00 nF capacitor and a 1 0 k£l resistor will do the job (Fig- ure 1 ). The circuit operates as a high-pass filter with a corner frequency of 1 60 Hz. It now does much less harm if light should fall on the sensor and shift its operating point. Flickering from artificial incandescent light- ing at a frequency of 1 00 Hz is also some- what attenuated. However, it does little to reduce the effect of fluorescent lights as these produce sharper flashes of light. Nev- ertheless, the filter modification does make the circuit more stable generally and con- siderably less sensitive to light. If desired, a potentiometer can be added to the circuit to allow adjustment of the coun- ter trigger threshold (Figure 2). Although this facility was already available in the PC software accompanying the design, some readers use the unit to make measure- ments ‘in the field’ without a PC attached: Figure 4. Calibration measurement using three BPW34s in parallel. if you are taking readings while scrambling around in a quarry, you will probably pre- fer not to risk lugging an expensive laptop about as well. The suggested circuit shifts the average threshold by up to 50 mV. By default the software sets the trigger threshold to 10, which corresponds to approximately 50 mV. At start-up the micro- controller measures the average voltage at its input and adds this value to the thresh- old: any pulse with amplitude exceeding this value will be counted. With the new AC coupling circuit the microcontroller will measure the average noise level on the input, obtaining, for example, a value of 5. The trigger threshold will then be 1 5. With the addition of the potentiometer the qui- escent level can be increased to as much as 50 mV. At start-up the potentiometer should be set to its lowest point. Then the threshold can be adjusted carefully towards the noise floor to determine the point where sensitivity is greatest. A press of the ‘Zero’ button will then start a fresh series of readings with the new threshold setting. Sensors and results In its standard configuration the device uses a single type BPW34 PIN diode as its sen- sor. However, it is possible to wire several BPW34s in parallel (see Figure 3). The effect of this is to produce meaningful readings in a shorter time. It is possible either simply to count the pulses orto use the more sophis- ticated program that analyses the energy spectrum. Before carrying out a measurement it is a good idea to do a calibration measure- ment to estimate the background radia- tion level. Figure 4 shows such a calibra- tion measurement with three BPW34s wired in parallel. The trigger threshold used was 5. Forty pulses of varying ener- gies were detected over the course of one hour. These results can be subtracted from the subsequent measurement to improve accuracy when using weakly radioactive samples. Potassium chloride (or more accurately the potassium-40 in it) exhibits weak beta activ- ity. Perhaps easier to obtain is potassium carbonate (or ‘carbonate of potash’), which is sometimes used in baking. A sample of this substance was placed in a small plastic bag next to the sensor. Figure 5 shows the results, taken over one hour. A total of 251 pulses were counted, some six times the background level. Figure 5. Radiation from potassium carbonate. elektor 10-2012 55 TEST & MEASUREMENT Figure 6. A combination of different sensors. Alkaline batteries do not normally leak; however, when they do, the concentrated potassium hydroxide in them reacts with the C0 2 in the atmosphere to form potas- sium carbonate. This is seen as a white resi- due where the leak has occurred. This res- idue should be a weak radioactive source, and indeed this can be confirmed using the radiation meter. With the sensor set up for maximum sensi- tivity, including for low-energy pulses, we can use the radiation meter with samples of even lower activity. This can be seen in an experiment with charcoal ash from the barbecue, which contains potassium car- bonate. We measured a radiation level of approximately 1 50 pulses per hour from a sample. We can even find radioactiv- Figure 7. Using a power transistor as an alpha particle sensor. ity in cigarette ash: in one experiment we obtained 80 pulses per hour, double the background level. Again, the main source of the radiation is probably potassium, although polonium, a product of uranium decay, may also play a part as it is accumu- lated in tobacco plants. Alpha decay Using an exposed BPX61 photodiode lets us also detect alpha particles. In fact, we can use both types of diode together: a BPW34 to detect beta and gamma radiation, and a BPX61 for alpha particles (see Figure 6). To test this combination we first measure the weak radiation from a sample of potash or potassium carbonate and set the trig- ger threshold appropriately. Once this has +5V Figure 9. RS-232 level shifter. been done successfully, we can move on to making the more difficult measurements, including on various building materials whose level of activity may be of interest. Alpha particles are distinguished by their higher energy: we can often find noticeable levels of radiation in plasterboard, because the gypsum used in its manufacture is made by the desulphurisation of flue gases from coal-fired power stations and, in turn, the coal contains a small amount of uranium and its various decay products. The 2N3055 as an alpha particle detector When alpha particles hit a silicon junction a relatively strong signal is produced. That is true not just for photodiodes, but for any type of diode or transistor. Under normal circumstances alpha particles do not get as far as the junction as they are absorbed by the devices package or shielding. However, we can get around this in the case of certain power transistors in a TO-3 package: if we remove the metal cap the silicon chip itself is revealed, with its relatively large surface are exposed to the elements. This is usually the case for the famous 2N3055; for other devices there is some- times an additional protective layer, and so sometimes a little luck is needed to find one that is suitable. A fairly recently-pro- duced transistor from ST was found to work well (see Figure 7). The chip is completely exposed and makes an excellent alpha par- ticle sensor. Beta and gamma radiation, however, go completely undetected. Fig- ure 8 shows the result with a sample of pitchblende (uranite). When tested with an americium-241 source from a smoke detector more pulses were produced than the counter could cope with. Serial interface The counter board includes a three-pin con- nector which gives access to the serial port on the microcontroller, the RXD and TXD signals being atTTL levels. The connector is compatible with the Elektor breakout board (‘BOB’) [1], based on the FT232R, and so allows connection to a PC over USB using a virtual serial port. A very simple extension allows the device to be connected to a standard RS-232 inter- 56 10-2012 elektor RADIATION METER RELOADED face. Two NPN transistors do the job of shift- ing the voltage levels and inverting the sig- nals (see Figure 9). With this circuit you can connect the radiation meter to a PC with an ordinary serial port or to a USB-to-RS-232 adaptor. The PC-based program can be installed to provide the ability to plot energy spectra and to adjust the trigger threshold. It also provides the additional useful function of uploading program updates (or even com- pletely new programs) into the microcon- troller over the serial port. Program upload Suppose we would like to make a change to the way the counter works. The boot- loader facility in the microcontroller makes this easy, and it even works with the ‘Demo’ version of BASCOM (Figure 10). First open the BASIC source code and then, after mak- ing any changes to it, compile it. Select the programmer to be used in BAS- COM. In this case it is ‘MCS Bootloader’. The COM port and baud rate (19200) also have to be set correctly (see Figure 11). Now start the programmer, for example by using the small green circuit board icon. The MCS Bootloader will now try to establish a connection with the microcontroller. The connection can only be established shortly after the microcontroller is powered Listing i: Changes in Counter_i ‘Print “Counter” Locate 1 , 1 ‘Led “Counter” ‘Waitms 500 Readeeprom L , 1 If L = 255 Then L = 5 U = 0 For N = 1 To 1000 D = Getadc(0) U = U + D Next N U = U / 1000 Um = U ‘Um = 0 U0 = Um + L N = 0 up or reset. So, switch the device off and then on again, and programming should commence (Figure 12). When all the code has been uploaded the microcontroller immediately starts to exe- cute the new program. Software variants In-depth BASIC programming skills are not needed to make small changes to the program and to upload the new code to the microcontroller. Here are a couple of examples. 1 . Constant trigger threshold (Listing 1 ). Suppose we always wanted to have the trig- ger threshold equal to 5. All that’s required is to add the line ‘L = 5’ at the right point in the program. We can also get rid of the ‘Counter’ message at start-up by simply commenting out the relevant lines by add- ing a single quotation mark at the begin- ning. A further change is also shown in List- ing 1 , but commented out for now so it has no effect: the line ‘Um = 0’ sets the aver- age level to zero, which is better suited to use with the AC coupling circuit shown in Figure 1. 2. Measuring the energy distribution (Listing 2) Our second example shows how to count Listing 2 : Changes in Counter _2 Do D = Getadc(0) If D > Maxi Then Maxi = D Loop Until D < U0 Maxi = Maxi - Um If Maxi > 255 Then Maxi = 255 N = N + 1 If Maxi > 40 Then N2 = N2 + 1 If Maxi > 80 Then N3 = N3 + 1 Locate 1 , 1 Led N Led “ Locate 1 , 8 Led N2 Locate 1 , 14 Led N3 Figure 8. Measurement using an old faithful called 2N3055. Figure 1 0. The BASCOM development environment. Figure 1 1 . Selecting the programmer. Figure 1 2. Programming is successful! elektor 10-2012 57 TEST & MEASUREMENT pulses separately according to their energy. We will have three counters, one for all results (N), one for pulses with a level exceeding 40 (N2), and one for the highest- amplitude pulses, with a level exceeding 80 (N3). All three counts will be displayed on the top line of the display. The values give a broad indication of the energy distribu- tion without the need to connect a PC to plot a graph. The fact that we can discrimi- nate energy levels in this way is a significant advantage of the semiconductor sensor over a conventional Geiger counter. Other substances to examine The question often arises of what sub- stances can be used to test the operation of the device. In the original article we sug- gested using a sample of uranite, a lumi- nous watch, and potassium chloride. Below we give a few more ideas. Uranium glass is still made. It is used in dec- orative fluorescent glass beads. Type WT20 tungsten inert gas (TIG) weld- ing electrodes are made of tungsten with the addition of a 2% thorium oxide compo- nent. The electrodes are weak alpha, beta and gamma sources. Tungsten with added thorium is also used in the directly-heated cathodes of large radio transmitter valves, although admittedly such devices are not exactly found on every street corner. However, the same material is used in the magnetron in a domestic micro- wave oven: a salvaged magnetron cathode makes an effective test source. Thorium salts were used in the mantles for gas and paraffin lamps in the past, although modern mantles use different substances. If you can manage to get hold of an old man- tle, you will find it makes a particularly pow- erful test source, including of high-energy gamma rays. Ionisation smoke detectors use a strong (perhaps 33 l1 Tesla, depending on lamination material). Enter- ing these values into the equation gives: N = 1 0 / (4.44 x 50 x 0.2 x 0.00032) N = 704 turns (US: N = 586 turns) We’re rounding this of to 700 turns. We know we need a turns ratio of 200 to 1, so we would need to use a 3.5 turn pri- mary (US: 2.93). This is not practical, so we increase secondary turns to 800 (US: 600) (giving a lower flux density and greater accuracy) and use a 4 turn primary (US: 3 turns). Now we have the theory sorted. On to the practicalities of winding. Winding the core The secondary is to carry 50 mA. It is nor- mal to work at 3 A/mm 2 with copper wire. Working backwards this gives a 0.15 mm diameter wire (approx.), i.e. 0.16 mm (#34 AWG) including its enamel coating. The transformer bobbin winding area is 20 mm wide and 6 mm deep. This will allow 1 25 turns per layer and 6.4 layers (rounded to 7); or a winding depth of 1 .2 mm, leav- ing a space of 4.8 mm for the primary. See Figure 1. Note that the primary is made from one core of 1 0 A rated mains cable, either flex- ible or solid core, see Figure 2. The primary insulation is provided by the insulation on this wire. Four turns are added on top of the secondary and the windings are held in place with an insulating tape (polyester transformer tape is best suited for this). The transformer is then laminated with alter- nate ‘E’ & T laminations, so that there is virtually no air gap, see Figure 3. The unit can now be tested using the cir- cuit shown in Figure 4. Note that the load resistor (R L ) must always be connected, or the windings can go short-circuit, as current transformers develop very high voltages when run into an open circuit. A DVM in its AC current range can be used to measure the secondary voltage. Its internal imped- ance relative to the load determines the deviation: the lower the internal imped- ance, the better. Example #2 A more practical use of a CT is to drive a moving coil meter through a rectifier, like in the circuit shown in Figure 5. A moving coil meter typically has a full-scale deflec- tion of 1 mA; if this is used in parallel with the load (carrying 50 mA), it will make lit- tle difference to the accuracy of the system. As can be seen from the circuit, the trans- former develops a maximum of 10 volts across the load resistor when 1 0 A are flow- ing in the primary. If this voltage is fed into a bridge rectifier, we can read a DC voltage across the output of the bridge. When the 1 mA meter is connected across this DC output, it can be calibrated to read AC amps when a series resistor (R c ) is used. Ohms law tells us that the resistor should have a value of 10 k£l minus the internal resistance of the meter (typically 1 00 Q or less). If the 1 0 l resistor is made variable, the meter can be accurately calibrated. Any vibration of the meter pointer can be dampened with a small capacitor across the bridge output. 0.1 pF should be sufficient. Higher values will cause the meter to ‘peak read’ and have a longer response time. If the meter is accurately calibrated, it will be found to be non-linear near the bottom of the scale. To some extent this is due to the forward voltage loss of the bridge recti- fier diodes. The use of Schottky or Ge (ger- manium) diodes here will reduce this effect. The design can also be extended to switch mode and audio circuits to measure cur- rent; the use of a ferrite transformer is rec- ommended where the frequency is above about 1 kHz to reduce losses. With a ferrite the flux density should be reduced to about 25 mT to maintain accuracy. (110323) Advertisement PCBs Muuuuch Cheape No-frills policy 17.22 EURO 5 pcbs, 1 00 mm x 1 00 mm ♦per piece, incl. UflT (23%) + shipping costs e. g. Germang 1 0.89 EURO * Ja&altac ujLULU.jackaltac.com elektor 10-2012 75 fUetxaniaA Marconi Instruments TF801D/1 AM RF Signal Generator “They don’t make ‘m like that anymore” By Stephan Germann (Switzerland) Manufactured by UK-based Marconi Instruments, the type TF801 D/1 is an RF generator covering frequencies from 1 0 MHz to 470 MHz. Built at around 1 960, the instrument is likely to have been pretty expensive if only for its highly complicated mechanical assembly. I got this generator ‘thrown in’ when I bought a second- spectrum analyser about 1 5 years ago. Since then, it has provided steady service in my workshop set up for the construction or repair of amateur radio transceivers. The electrical data are also very good by today’s standards, the only weak point being the frequency sta- bility, which of course cannot compete with a DDS Generator. With some patience and skills though, even an SSB receiver for the 2 m band can be checked. I am using this equipment for adjusting and checking amateur radio equipment, as well as for troubleshooting, not forgetting tuning checks on homemade antennas, filters and matching networks. Thanks to the continuous frequency range, amateur bands from 30 m to 70 cms are catered for, as well as all the regu- lar intermediate frequencies (IFs). The very large output voltage range from 1 00 nV to 1 V enables both sensitive receivers to be checked, and driver stages of transmitters or passive impedance measuring bridges to be driven. Thanks to vacuum tube tech- nology, the equipment is electrically very robust. The precision of the output voltage and the total absence of RF leakage never cease to amaze me. The operation too is very convenient when compared with today’s devices. In fact, it beats many of today’s menu-driven controls, or jog-style rotary controls with multiple functions, mainly because each function has its own button, and superfluous functions are absent. Barring one defective electrolytic capacitor, no repairs were nec- essary, clearly pointing to the use of superb quality components. The pots for example are wound from resistance wire and sealed tightly. The modulation depth and RF output voltage each have their own moving coil meter on the front panel. The controls are spa- ciously arranged over the front panel, and all controls and knobs are of ‘comfortable’ size. The frequency scale is so large and accurate that tuning to less than 1 00 kHz error is possible up in the UHF fre- quency range without additional measuring equipment. The drive assembly is accurate, and fine-tuning is also provided. The construction of the TF801D is marked by extreme stability, which becomes manifest if you lift all 30 kgs (66 lbs) of it. UK-made, the unit has imperial screws and bolts only. The internal structure consists of a sturdy chassis, on which the modulator, the control circuit and the power supply are constructed. Attached to it is the RF section in a RF sealed double casing made of silver plated copper sheet. The external RF housing only contains the tuning mechanism as well as the RF filters for passing the control voltage. The RF cir- cuitry itself is located in an internal RF-proof housing that’s divided into two parts for the oscillator and the final stage. Thanks to this method of construction RF voltage appears at the output jack only; in other places it is simply not detectable, which is a feat when con- 76 10-2012 elektor ?Refrtanic& sidering both the oscillator and the RF power amplifier have an RF power capability of the order of 1 00 mW. The circuit itself consists of ten tubes, a couple of semiconductor diodes and a single Germanium transistor (OC71 ), and is not terribly exciting from today’s perspective. Sections of the circuit diagram are reproduced here, due to their size they cannot be printed in full. The power supply consists of a transformer, a 5R4GY full-wave recti- fiertube and a voltage stabiliser comprising a 5651 reference tube, an EF95 (6AK5W) control amp and a KT66 audio output tube as the regulating element. The filament voltage for the oscillator tube is stabilised with a transductor (current-controlled inductance). The RF signal is generated ‘straight off, i.e. the oscillator oscillates at the desired frequency (= sig gen output frequency) and its output signal is buffered by an RF tetrode. The oscillator employs a TD03- 1 00 UHF triode with five switchable coils around it for the frequency ranges. It is tuned with a variable capacitor. Unusually a heat sink is found attached to the anode terminal of the triode. The oscillator signal directly drives the symmetrical push-pull out- put stage built around a QQV02-6 UHF dual tetrode. The tube oper- ates in class A, resulting in maximum gain and low distortion (hence, low harmonics). The DC level at the control grids allows the gain to be controlled, or amplitude modulated if required. Thanks to the gain control, the output voltage is independent of load as well as frequency, making the measuring and matching of filters very con- venient indeed. The anode circuit of the amplifier also comprises five switchable coils. Together with a second variable capacitor, the coils act as tuneable resonant circuits tuned in synchronism with the oscillator. To prevent tracking errors, the variable capacitor of the output cir- cuit can be slightly detuned with respect to the oscillator — mechan- ically, a not so simple design. The linear amplification afforded by the push-pull output stage keeps harmonics generation down to a minimum. The output signal is inductively coupled out through the attenuator having a single calibrated range of 1 35 dB, and providing a resistor network for a frequency-independent, rock steady output impedance of 50 ohms. The 5-position frequency range selection switch is also worth men- tioning. Remarkably, the switch does not work as expected from one marker to the next (to get to the next frequency range), but requires an additional full turn. The switch itself is contactless, the connection with the coils being capacitive. This has the advantage of avoiding contact problems, which is highly relevant in view of the tuned circuits’ Q (quality) factors. Besides the everyday use of the instrument, the manual describes maintenance and common repair steps in great detail, both mechanical (like Bowden cable replacement) and electrical. I espe- cially liked one tip for faultfinding: “Initially, look for burnt resistors to locate a faulty circuit section”. (120169) Retronics is a monthly section in Elektor magazine covering vintage electronics including legendary Elektor projects. Contributions, suggestions and reguests are welcomed; please send an email to Jan Buiting (editor@elektor.com). elektor 10-2012 77 INFOTAINMENT Hexadoku Puzzle with an electronics touch Past page 75 or thereabouts and fed up with all that designing, programming and soldering? Then take a break deservedly and give this puzzle a go. Enter the right numbers or letters A-F in the open boxes, find the solution in the grey boxes, send it to us and you automatically enter the prize draw for one of four Elektor Shop vouchers. 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 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 encour- age all Elektor readers to participate. h6Xadol/w >>? hi be* 1 1 wl’f LabWorX 2 Mnstertng Surface Mount Technology lift DISCOUNT FOR ELECTOR -JIEM3ERS titlir-rtMr tT-jffl re* ? 84 io-20i2e lektor ORDERING INSTRUCTIONS, P&P CHARGES Non-online orders, except for memberships (for which see below), must be sent BY POST or FAX to Elektor International Media, 78 York Street, London W1 H 1 DP, United Kingdom. Online ordering: www.elektor.com/store Orders placed on our London 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 members. We regret that no cheques can be accepted from customers or members 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. COMPONENTS If difficulties are envisaged in the supply of components for Elektor projects, a source will normally be advised in the article. Note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Delivery Although every effort will be made to dispatch your order within 2-3 weeks from receipt of your instructions, we can not guarantee this time scale for all orders. Returns Faulty goods or goods sent in error may be returned for replacement or refund, but not before obtaining our consent. All goods returned should be packed securely in a padded bag or box, enclosing a covering letter stating the dispatch note number. If the goods are returned because of a mistake on our part, we will refund the return postage. Damaged goods Claims for damaged goods must be received at our London office within 1 0 days (UK); 1 4 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 so on, described in our books and magazines. Elektor does not accept responsibility or liability for failing to identify such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, diskettes and software carriers published in our books and magazines (other than in third-party adverti-sements) 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. August 201 2 MEMBERSHIP RATES FOR ANNUAL MEMBERSHIP Standard Plus United Kingdom & Ireland £54.00 £66.50 Surface Mail Rest of the World £68.50 £81.00 Airmail Rest of the World £86.00 £98.50 USA & Canada See www.elektor.com/usa for special offers HOW TO PAY Bank transfer into account no. 4027021 1 held by Elektor International Media BVwith 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 members. We regret that no cheques can be accepted from customers or members in any other country. Credit card VISA and MasterCard can be processed by mail, email, web, fax and telephone. Online ordering through www.elektor.com/store is SSL- protected for your security. MEMBERSHIP CONDITIONS The standard membership order period is twelve months. If a permanent change of address during the membership 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 Membership costs £43.20, a Student Plus Membership costs £55.70 (UK only). Please note that new memberships take about four weeks from receipt of order to become effective. Cancelled memberships will be subject to a charge of 25% (twenty-five per cent) of the full membership price or £7.50, whichever is the higher, plus the cost of any issues already dispatched. Memberships cannot be cancelled after they have run for six months or more. elektor 10-2012 85 Last update 19/07 I PIC32 Sound Pad Last update 13/07 | 4 membe views Monitoring d aeromodeles ANDROID Utihser un telephone Android e pour... Last update 11/07 | 1 m<3 Elektor RS485 Bus- Fiillstandsniessung / r Messung des Fiillstandes mittels... Last update 09/07 Hang Tux Presentation : Thi« Last update 0 (ALPR)^ l,CenSe P ' ate rec °^'t'on Automatic license plate recognition (ALPR) a simple Last update 05/07 Speed Projecting Display for Simple circuit that will project the speed... Horloge du bureau a tubes - Bfi classiques Connaissez-vous les "Num.trons ? Ces J- H incandescents a 7 segments sont utilise une horloge de bureau avec un... 1 Numitron desktop clock - Using only c >V I 4| DO YOU know “Numitrons"? Those incar u. iiKc are used here to make a 6 igi s rapide pour circuits analogiques tester rapidement des circuits a base hnmplq (filtres, oscillateurs Le I carte de prototypage I lineaires | Cette carte permet de Hf d'amplificateurs opera circuit imprime... 8 J efficient solenoid valve We have in our house a r ■ filtering the tap-water up fills a little reservoir of... ■sam -ZT Displayless WLAN Speaker with We ’ ‘ WLAN Speaker for everywhere usage shelf. Configure it with a Web-Browser or a Smartphon. Radio Station, the... Vote for your Favorite Proposal Sharing Electronics Projects ektor PROJECTS Elektor Projects is an online community for people passionate about electronics. Here you can share your projects and participate in those created by others. It's a place where you can discuss project development and electronics. Elektor's team of editors and engineers assist you to bring your projects to a good end. They can help you write an article to be published in Elektor maga zine or even develop a complete product that you can sell in the Elektor Shop! JOIN MOW! Get elektorized too! Check www.elektor-proiects.com Jk □ ..Il- r :■ CiipiiuihrYii 'TiJUL-M Personal Amp An O for Low-Power Applications Mesh Networking v/ah (lie SNAP OS An ExfiminiiliPii of Parslid CepaciSsra Slgma-tMlJi ModrtVon. Explained ANALOG TE Artftiog Signnil Man.-i fi Sound Tone Dcta? MCU-Bawd Auditor Navitjalion System Engineer ;m Alkm.Ji to Joystick Control Electronics Design - Pnxtssorfi, Pw/y#/, & Interfacing A LmA Insickt an C lo n -zn1= 2 -r DelfrqlcrR Diode OR Un intern. MOSFET Resistan PROGRAMMABLE I MCU-Bescd Slccp^t^^c Analysis DIY Smart Eleciiroiiic Load Design Embedded Linux Syslpm PIAHarm* I'-ilurferflnev lmiFi|jnity tor Electronic Designs Joystick ConlrOf w.lh Bluetooth Connectivity MCU-Based Automatic Blood Pressure Cuff 101 Gw .urrency Id E'iiO*d( 3 o'-i 5 ‘ f ilrnn iV Gem™*! Com urronev PiMi ' PrirndnlLn^ Pnqrdy Inwoman h Y.in.iLpinij ifegulrtttttnb ■i And Mere SAVE 50% SPECIAL: SAVE 50% Celebrate Circuit Cellar’s 25 th Anniversary PROJECT Huw «, Bind At, AC T«I»| IHTE nV.F* Ih&JUfftf CunU'-.Jl frgirt «K.4| HIV Kimd-ELH»4i , Tifl»Pi«tlB. -lj UXATON UitotfSWM kOCATO'i Ctttfl LOCATION'* Spain FACE 14 V FACE' !4 faijE m EMBEDDED ELECTRONICS ENGINEERING ENFOI ICATIONS Smart Swil & Control i Radio Fre< $25 Print or Digital :: $50 Combo Celebrate Circuit Cellar’s 25th year of bringing readers insightful analysis of embedded electronics technology. Visit www.circuitcellar.com/el912 to take advantage of these great deals. >IMUS OFFER! BONUS OFFER! BONUS OFFER! BOIS^^^ Sign up today and you’ll also receive the Special 25 th Anniversary Edition with your subscription! CIRCUIT CELLAR YEARS OF EMBEDDED INSIGHT ROUTE WITH PROTEUS 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 Electronics Labcenter Electronics Ltd. 53-55 Main Street, Grassington, North Yorks. BD23 5AA. Registered in England 4692454 Tel: +44 (0)1756 753440, Email: info@labcenter.com Visit our website or phone 01756 753440 for more details