Vous êtes sur la page 1sur 88
BM ENT ee =A NUT CoB ]Tefh VAY WE 1 eh see ustuge tata -ssens-NOKo9 ate act! ant 9 Practical, ? quick to implement, reusable & multi-platform pant ry 5 eS: 5 acme mcm using I2C sensors for temperature, atmospheric pressure and humidity 8 ° R 9. till | dl SO 1 eo PERE Cr ei Comprehensive reading: at home and on the road Subscribe now or upgrade: www.elektor.com/subs 8 Pe, Byrne, [i secs 0 semen od OB seroatenre mer and In-Circuit mikroProg= One programmer to rule them all. ‘one prosrammer for S74 devices In-Cireut Debugger Supported All PICs covered Fast mikrolCO™ debugger Picto, pict2, pct, Picts, e Debug your code and monitor code {sP1C30/33, PICZS one PICS2, ‘execution onthe chip itself J rikroico™ tecnalogy beings the ‘we nave it all covered, Youtl ‘ever need ancther programmer! power of haréware deougaing t your favorite mikrot compiler ‘Support in 9 mikro€ compilers Compiler Compatibility rmikroProg™ ie supported with Slog frowar takes are fd Supporting new chipsis easy ™ToC ‘Adding new chips is easy, Duct download the itect mikroProg Suite avalabe using the same hardware ane the same frmrare ince! Gipte ane ricaae (miareblehtronika GET IT NOW DEVELOPMENT TOOLS ECOMPILERS | BOOKS www.mikroprog.com www.mikroe.com Sensitive to sensors Inallhonesty there's often a gross dis crepancy between the numberof pages {devoted totechnology and projects of the lockawhatthiemicrocontrolle-can-do~ lon-a-green-cict-hoard” type and the slight coverage of sensors, those analogue ‘components only a handful of people seer tobe abletounderstand and workwith these days. This month, we ty to redress the balance. [Attach conferences, lots of raed hands Inresponse to "hey guys, aworkaround please to ARM7TCIIP stack oveflo ero" 5126-8229 but no priontized interrupts and keep italia Fash” but dead silence when the same crawd is prompted for Wiking up Kelvin junction oraword or {wo on resistor selection in alow-naise input amplifer, That sotto say the microcontroller and analogue fields are incompatible in any ‘way, or mutually exclusive, t's justthat that one needs the other to culminate in Aaweorking product. Fortunately sensor ‘manufactarers are working hatd to make theirproducts ax micracontroller-sawy at porible, while pizza-powered youngsters ate providing code for thelr microsto get allthe processing done as fast and user filly as possible, With good results, ‘asyou can seefrom the USB Long Term DData Logger on pages6 and the ATH Compass on page 32. The Data Loggers accompanied by a separate articleon aC sensors.on page22 explaining some of the design backgrounds. Sensorswantto bbe promoted, too. When mentioned the se ofa ClMPS03 magnetic field sensorn four ATM:8 Compass, Gerry at Devantech (Robot Hectronics) Knot only setup an exclusive reader offer but aso sent me sample oftherlatest compass sensor ‘module. There areother gems inthis edition and they aren unexpected sections. Like the hardware for our DSP programming course thats attracting quite some attention worldwide, our new FT233/US8 BOB (break ‘ut board or, a returning to the all-analo- {ue level, the Chaos Generator introduced Conthismonth’s Retronics pages. But your sensors may tll you diferent. Enjoy reading this edition, Jan Buiting, Editor 4 16 26 R 36 B 44 a4 rayektor Colophon Who's who a Elektor magazine. News & New Products ‘Amonthily roundup of al the latest in electronics land, ecReflow-Mate ‘This professional grade reflow oven will easily handle allyour SMT soldering jobs. USB Long-Term Weather Logger “This sophisticated project uses °C sensors to capture atmospheric pressure, ‘temperature and humidity. —— PC Sensors, ‘Thisarticle shows the ease of Implementing temperature, huicity _and atmospheric pressure sensorsin microcontroller projects. Milkymist SoC remarkably accessble it of system on chip capable of performing advanced ‘Graphic operations at impressive speeds. ATN&8 Compass ‘One more great project added the ong list of applications forthe Elektor ATMAB microcontroller board. 2B: Universal MMI Module Using ARM Cortex-M3 Arealjack fal trades, ths microcontroller bard can be configured inanincrecible umber of wayswith ‘itches, encoders and iC displays E-Labs Inside: host in the machine ‘What (on earth) happenstoan LED when it's about to break down electrically? E-Labs Inside: Alibaba ‘Agreat website for electronics enthusiasts, — Just waiting to be discovered E-Labs Inside: Perfect pizzas ‘Who said that brand new SMT oven can't be usedto cook lunchtime snacks? gon eektor Vv ~ ~ | = CONTENTS 16 USB Long-Term Weather Logger This stand-alone datalogger displays pressure, temperature and humidity rea dings generated by lC-bus sensors on an LCD panel, and canrun for sito eight ‘weeks on three AA batteries. The stored readings can be read out over USB and plotted on a PCusing gnuplot. Digital sensor modules keep the hardware sim- ple and no calibration is required. 32 ATNh8 Compass Now you can forget all about magnetised needles on their pivots for Finding magnetic North. And it doesn't matter ifyou live inthe Southern or Northern hemisphere ~ all that counts here is that you have both feet firmly on the ‘ground and thislitte device in your hand, 36 J?B: Universal MMI Module using ARM Cortex-M3, This ultra-versatile microcontroller board allows the use of several types fof LCD and a variable number of buttons. And thanks to its up-to-the- minute LPC1343 ARM Cortex-M processor, this board is extra powerful and amazingly easy to use, 58 FT232R USB Serial Bridge / BOB You'll be surprised frst and foremost by the size ofthis USB/seral converter =no larger than the moulded plug on a USB cable! And you're also bound to appreciate that fact thatit' practical, quickto implement, reusable, and mult platform (Windows, Linux, et) —and yet forall that, not too expensive lektor_og20n 45 48 47 50 58 62 67 70 R 6 n Volume 37 September 2011 no. 417 E-Labs Inside: Problems under pressure ‘Adesign problem that forced the Elektor lab staf to put thei thinking caps on. E-Labs Inside: Small pitfalls, ‘Aword about the tombstone’ effect you sure want ta avoid when rflow-soldering SMT pats E-Blocks go Twitter ‘Amazing! A set of E-blocks configured ‘to Twitter weather conditions and social messages to members of sailing club. ‘Automaticaly! ‘Audio DSP Course (3) Now it gets for real withthe description of the DSP board we're using nthe course. Pretty advanced stuff FT232R USB Serial Bridge / BOB Thislittle board willbe invaluable fever you need to examine those elusive signals ‘vavelling up and down a USB link. Here comes the Bus! (7) ‘Thisrmonth we discuss a simple application protocol for “our” bus. USB Audio Adapter This project goes to show thatinterfacing audio and the USE busis not all blackbox. engineering ‘Compact Warning Flasher Give your bicycle arear light that’s very visible to taffc coming from behind. Retronics: The Chaos Machine (1) Regular feature on electronics ‘odd & ancient. Series Editor: an Buting Light Sensor ‘Acheap and simple yet reliable circuit to detect dusk, Hexadoku Elektor’s monthly puzzle with an electronics touch, ‘Coming Attractions ‘Next month in Flektor magazine. ee elektor international media bv Elektor International Media provides a multimedia and interactive platform for everyone interested in electronics. From professionals passionate about their work to enthusiasts with professional aml ions. From beginner to diehard, from student to lecturer. Information, education, inspiration and entertainment. Analogue and digital; practical and theoretical; software and hardware. “=e ‘Smult-platform FT232R USB/Serial _ MICROCONTROLLERS & EMBEDDE! AUDIO « TEST & MEASUREMEN: whim, Mm, Sean SSeS hata len png Ars ah ‘Commons fgebernthounced et Ratesesainsngpopeamaucdacmatxy ——Mapatatsoncadainmatheng cae pest son es apaog (beigrart een stberonr amano ater ‘gn epee sri: de [ote iceman jameatancn ets tomato Wego sont aa es ‘pgm arrnea uae, voetlteran i ae yt iene gaan ted eevee Memon aausetunetsasedseysatl bohm nen ex, 1a rine ‘Sneaks enero “pba onic ears, fe ana aon eaata6rer Stiosptniednnesyeneeasoxsaeayeaugst openers jv eet mata ‘ 920m eektor Elektor Proton Robot => Aversatile platform for leart The Proton Robot from Elektorisa versatile platform that's suitable for students, enthusiasts and professionals alike. The robot can operate with a variety of microcontroller families, and itsupports a broad spectrum of sensors and actuators. What's more, this robot can eas be extended inall sorts of ways! g and experimenting CCharateristies + Urarorc detance sensor + BLEDsinthe mouth + BLEDsinthebody + Prezoclectricspealer + Sinared stance senvors + Motor deve module + Bline detectors + LeDeves 2phetotransstors + 2aervomotors 21 + Redan black buttons + Audio module * Gripper dering Youean orderthe robot ready assembled and tested but alsoasa complete kit for DIY asembly. Completa Body head audio, ripper and PICarAVRcootrl board te choose ‘E1035 USS1745 |¢1249 ‘Ready assembled and testedrobot: Body, hea, aud, ripper and PICOrAVR control board to choose £1475 0582375 | € 1699 Further information, demovideo and ordering at www.elektor com|proton pa bccn co iktarbosreorcom ‘ef ype Pn pace may On eRe Satinhtecorgunanicutciptononkrrom. Hammers ‘uote anyoeas e asbe h rga eo ee ‘avenge st atone. ‘tert dt apr : Soper pen nerd ae TSaoe (ates hc caeane ‘Pl ted tn mgt tr decent nrnet ; ii Alaareg Pee ad a Ma Neda wna ease one Seymour. 2 East Posty Streat, Landon CsA, Engand ‘Gersand ate tots pebed mou" books and ragarres ‘Set st¥m anytime then. ipoalioras en Giectingrey ener sears xsd Isdnanremerb aire caren om andi pecan aos ht 0 ‘lor mamas Stgiefaniey eebensctat peste: dhgeimevonlanosemmenisa a bor Wceng2 Sn Theta ‘muioarte her seuttenporion ane Teepe: aeatoua flrs poe ‘Eeociboocnypatctepkecnsscntcienl — SElamntiataiaae Ren clektor 09-200 7 NEWS & NEW PRODUCTS 12-Watt PAR30 LED spotlights with dimming function oy FZLED recently released a new line of 12-Watt PAR3O LED Spotlights that have lifetimes of more than 35,000 hours. Con- sumers can choose between ‘warm white '3000K CCT ora ‘cool white’ 6000K CCT that provide luminous fluxes (Im) of 550 and 700, respectively. FZLED's commitment ‘to RGD has enabled them to incorporate a ‘creative dimming function into their PAR3O LED Spotlights. The FZLED12-Watt PAR3O energy-effi= cient LED spotlights have an AC input volt- age range of 90-264V and can be placed directly into standard 26/27 sockets, hassle fee. Furthermore, users can choose between 255" or 120° beam angle. FZLED's builtin, dimming feature allows the spot- lights to function at 12%, 25%, 80%, or 100% oflightintensity. The desired level of bright- ness is easly selected by pressing the on/off, power switch multiple times ‘The FZLED 12-Watt PAR3O LED Spotlights are currently available in Taiwan and Singa- pore. FZLED is excited to build relationships with more distribution partnersin order to provide consumers around the world with innovative, energy-saving, and high-perfor mance lighting solutions wataled com.tw (n05824) Micro-inverter reference design board Future Energy Solutions recently released nd demonstrated a microsinvertrreler tence design board. providing a mode for the rapid development of highly efficient brarcable miro -merterend products The reference sesign's stable or mero inverters serving Photovoltae (PV) soar panelaraystted upto 200 wattsané am prising up to72 cells Developedin collaboration wit Future Elec ‘woncs' franchised suppliers Freescale Semi conductor and Fairchild Semiconductor, the design is a two-stage grid-connected micro-inverter providing high efficiency of up to 95% through the implementation of innovative design features including a sophisticated maximum power point tracke ing (MPPT) technique. ‘The system is comprised of two boards: a controller board which features the 16-bit MCS6F8257 digital signal control ler from Freescale, and an inverter board Which includes the DDC boost and DGAC inverter stages and an auxiliary power sup. ply. Customers can use the boards as a development platform to which they can easly dd peripheral features such as dis play screen, user interface and communi cations. They can also source the original design files from Future Electronics and modify them freely. Danny Mller, vie-president of Future Elec tronics’ Future Energy Solutions division, which serves OEMs in the renewable and alternative energy markets, said: “Micro: inverters are a hot segment of the fast growing market for solar inverters, which is expected to grow to $8.5 bn in sales in 2014, This reference board s 2 useful tool for our customers as they work to optimise their micro-inverter designs and adopt re: evantnew technology.” ‘The designhas adopted anon soating topo ogy consisting of a DGDC boost stage fl lowed by a DCAC inverter ts omission of an isolating transformer, normally foundin exis ing micro-inverter designs, helps to reduce losses markedly during power conversion, ‘The topology allows only a small 50 Hz rip ple current to be reflected back from the 230 VAC load othe PV solar panel. The rip ple current and ripple voltage are used to implementa fast MPPT technique called rip ple correlation control, whichis an effective ‘means for capturing the maximum possible ower from the PV solar panel throughout the hours of daylight Improvements over conventional micro: inverter designs have addressed durability issues aswell as efficacy. The micro-nverter ‘was designed from the outset to achieve long-term reliability both through signif cant derating of components, and through avoiding the use oflife-limited aluminium electrolytic capacitors Future Electronics provides the developer with two alternative implementations ‘The demonstration at InterSolar is of an all-analogue implementation, which uses active components from Fairchild, includ: ing FCB2ON6O ultra-fast switch-off MOSFETs and FAN7395 gate drivers. Onits generalrelease, the reference design vill also provide parallel topology in which the boost stage and inverter stage control and MPPT are implemented in software on the MC55F8257 DSC. ‘This software-based version allows the designer to take advantage of the many peripheral features integrated into the 'MCS6F8257, which include multiple high. resolution PWM channels, two 8-channel 12-bit ADCS, and support for an OLED dis play I also provides the ability to imple- ‘meat quickly new and improved MPPT algo- rithms ~ an important consideration given the rapid evolution thatthe PV inverter mar ketis experiencing A standard 160-way Future-Blox interface connects the contral bard tothe inverter stage. afatreletonis.com_ (05821) New evaluation kit for Sensirion’s differential pressure sensor EK-P3, the new evaluation kit from Sen- sirion, represents a straightforward and cost effective option for testing the digital differentia pressure sensors ofthe SDP600 ‘The set consists ofa USB stick that i con rected to the SDP610 sensor by an adapter og20n elektor Wireless sensor networks to measure radiat ‘The creation of Libelium's Radiation Sensor Board has been ‘motivated by the nuclear disaster in Fukushima after the unfortunate earthquake and tsunami struck apan, The company wants to help authorities and security forces to measure the levels of radiation of affected zones without compromising the life ofthe workers. For this reason Libelium have created an autonomous battery powered Geiger Counter capable of reading radiation levels automaticaly and sending the information inteal time using wireless technologies ike ZigBee and GPRS. ‘The design ofthe sensor board is open hardware and the source code s released under GPL. ‘Theideats simple each node acts as.an autonomous and wireless Geiger Counter, measuring the number of counts per minute detected bythe Gelger tube and send this value using ZigBee and {GPRS protocols to the control point. Thesystem is powered with high toad intemal batteries what ensures alifetime of years. Using this technology radiation measurements can be taken in real time without compromising the life ofthe security corps membersas they do not have to be inside the security perimeter {mn order to activate the Gelger counters. The information is extracted automatically and sent wirelessly to the Gateway of the network. The Geiger tube integrated in the Radiation Sensor Board is sensible to Beta and Gamma particles as they can be detected ‘omnidirectionally. Consequently the orientation of the Geiger cable. With the help ofthe software, which Is available online for download, the difer- ential pressure sensor can be tested under realistic conditions by following five sim- ple installation steps. Consequently, there sno need to program a microprocessor 3s. ical manner, theevlutionkt maybecomecteddrecty module toaPc-the included software lows cs: playing messuredvales onthe screen and atonal provides the option of export ing the data toa Excel spreadsheet. This tnablesthedats tobe sed and processed iasimple manner clektor 09-200 ‘The differential pressure sensors of the 'SD600 family, which has recorded miions of sales, have a digital (C) output signal, are extremely long term stable and impress with thelr excellent accuracy and sensitive ity, even at very low differential pressure values. The high performance is reached due tothe thermal ow through principle. Tanks tothe new EK-P3, the customer can learn more about the differential pressure ‘sensor, become convinced ofthe benef It provides and experience these dear advan- tages na highly time efficient and econom- wiv srsiion.com/datashoot py (0582-1) New Xilinx FPGA and FTDI USB high-speed 2.0 DLP Design, nc’s new DLP-HS-FPGA2 is 3 high-speed FPGA module based on silicon {ror Xlinx and FTDI. This new version has 3 lorger FPGA butis otherwise identical tothe DIP-HS-FPCA. The DLP-HS-FPGA2 uses an NEWS & NEW PRODUCTS sensor with respect tothe source of radioactivity is uncritical — ‘only the distance matters. For thisreason iting the nodesin the right places s essential to detecting a possible leakage froma nuclear souree. nswibelum com (e582) XC35400A- 4FT256C from Xilinx, thas the same high- speed USB 2.0 interface based on the FTD! FT2232H, and 32 Mx 8 DDR2 SDRAM from Micron, as the previous version. The mod- Ue also comes with a working reference design, and Is avallable from both Digi-Key and Mouser. ‘The DLP-HS-FPGA2 module isa low-cost, ‘compact prototyping tool that canbe used {or rapid proof of concept or within educa- tonal environments. A 10,000-line refer ‘ence designis provided forthe Spartan™ 3A, FPGA on the DLP-HS-FPGA2 to those who purchase the module. The design was writ ‘en in VHDL and built using the free Xilinx ISE™ WebPACK™ tools, ‘As a bonus feature, the second channel of ‘the dual-channel USB interface is used to load user bit files directly to the SPI lash. No external programmer is required. This NEWS & NEW PRODUCTS represents a savings of more than $200. All that is needed to load bit fles to the FPGA fon the DLP-HS-FPGA2 Is a Windows soft- ware utility (free with purchase), a Win- dows PC, and a USB cable. The new prod- devices, have released programmers type Beekive204aP and BeeProg2AP, which are industrial versions ofthe BeeHive204 and BeeProg2 programmers respectively. The new programmers now available on market "were specially developed for implemen- tation into 3rd party automated program- ‘mers and automatic test equipments ATE). ucts priced at $179.95. ‘weraipsigncom (nos8¥l) Industrial versions of Elnec programmers Elnec, Europe's leading provider of solutions for programming NANO Flash memory, ‘microcontrollers and ather programmable chipKIT: first Arduino™-compatible 32-bit microcontroller development platform ‘Microchip announces the launch ofthe frst 32-bit-micracon- troller-based, open-source development platform that is compat- ible with Arduino" hardware and software. Designed and menu- factuted by Diglent,a Microchip Authorized Design Partner, the chipkiT™ platforms the first and only 32-bit Arduino solution to enable hobbyistsand academicsto easly, andinexpensively,nte- grate electronics into their projects, even if they do not have an electronicengineering background. ‘The chipKIT boards and software provide more features, per- formance and functionality than any other Arduino solution on the market. With boards starting at just $26.95 each, academ- Ics and hobbyists can experience four times the performance of any existing Arduino solution and have projects up and running inminutes. ‘The platform consists of two PIC32-based development boards and open-source software that i fully compatible with the Arduino programming language and development environment The chipkIT hardwareis compatible with existing Arduino shields ‘and applications, and can be developed using the Arduino IDE and existing resources, such as code examples, librarles, references and tutorials. The easy-to-use, low-cost solution supports project development by hobbyists and academics from many dscipines, such as mechanical engineering, computer sclence and even art. ‘The PIC32-based chipkIT boards enable 80 MHz performance, and provide up to 512 KB Flash, with up to 128 KB RAM. They feature connectivity peripherals, including Ethernet, CAN, and USB (FullSpeed Host, Device and OTC), plus peripherals such as multiple timers, a 16-channel 1 MSPS Analogue-to-Digital Con- verter (ADC), two comparators, and multiple FC™, SPI, and UART Interfaces. The chipKIT integrates Microchip's PIC32 microcon- troller which isthe highest performance 32-bit microcontroller init class, featuring the Industry-leading MIPS32® MaKE core from MIPS Technologies, Ine. ‘The software has been engineered to ensure maximum compat- \blty with existing Arduino shields, applications and courseware. The Arduino programming environment has been modified and extended so that it supports the PIC32-based chipKIT boards, as UCU ca CeO TEAC yn 4 OD , wells traditional Arduino boards. The Arduino standard librar- Fes have been also been modified to support chipKIT boards and ‘traditional Arduino boards. Allf this workchas been contributed back to the open-source Arduino community. With the excep- tion of a small numberof shields that require SV operation, the _vast majority of existing Arduino hardware and software appli- ‘ations are fully compatible withthe chipKIT platform, without ‘modification. ‘The chipkIT Uno32™ (part # TDGLOO2) development board, Priced at $26.95. is aclone ofthe Arduino Uno board and fea- tures 128 KBFlash programme memory and 16 KBRAM, withtwo each FC, SPI and UART peripherals. The chipKIT Max32™ (part 8 TDGLO03) development board, priced at $49.50, Isa cone of the Arduino Mega board and features 512 KB Flash programme ‘memory and 128 KB RAM, with USB, CAN and Ethernet commu- nication, 2s wellas five PC, four SPI, and sh UART peripherals Both chipkiT boards and supporting open-source are available today as well as chipkIT Network and /0 Shields. ‘wnumirocip.comjgetjTO02_ (n056X) gon eeltor The new programmers have several enhancements which will be appreciated by electronics manufacturers and program: ‘ming centres. in particular, the dimensions of the programmers were reduced, the cases are more robust. Also, the program- ‘ming modules naw have a different con- struction to ensure greater mechanical stability. For easy and corvenient connec- tionofthe programmers to 3rd party auto- ‘mated machines, a simple Einec remote control applictionwas enhanced. Elnec continues its tradition of manufac: turing high quality products and provides ‘8 worldwide unique 3-year warranty with this new series of programmers dedicated for industial use. Updates to the program- ‘mers software, including new device sup- port, are availabe from the Einec website free of charge. Einec provides very flexible support and releases new software on aver- ‘age every twoworking days! Willing to con- sider requirements of manufacturers, Elnec Isproviding considerable quantity discounts ‘on programming modules. wernneccom (05824) Pack | Charger ~ 2 Cell ‘The U-lon Power Pack Charger -2Cell from, Parallax isan integrated storage cell and charging system ona single 3"x-4 printed circuit Board. it's compatible with most 118550-size Li-ion cell. Parallax offer High- Capacity Li-ion Cells (#28987) n their store that are compatible with this charger. “The new product features PCB-mounted cell holders with on-board charging cir- uitry, multiple power input/output ‘options, on-board output fuse protection, ‘nominal 7.4 VDC output; 8.2 VDC maxi- ‘mum, standard 3° x4" PCB foatprintwhich Integrates well with the Board of Educa tion® (1128150), Propeller™ Proto Board (£32212), or any application needing areli- able power supply with an integrated chara ing system. The charge/discharge switching circuitry is automatic. ‘Thesmall board holds two rechargeable 3.7 volt Lion 18650-siz cells, with multiple LED indicators providing charge readiness Information for each individual cell. A sta- tus ke forthe LED indicators is on printed ‘on the board, Aggressive holders retain the ‘alls in any board orientation and in mod- ‘erate shock environments, such as mobile robotic applications. Cells are not perma- nent, and are easly replace. The dedicated circuitry on the board con- tinuously monitors the charging process to censure safety, efficiency, and to maximize the number of charge discharge cycles of each cell. The new products priced a $49.99. ‘wn.prallc.com sath 28986") (a5) austriamicrosystems: 100% carbon neutral status by 2015 austriamicrosystems revealed ambitious plans toreach carbon neutral status by 2015 ‘and become the first semiconductormanu- facturer worldwide to do so. nits aggres- NEWS & NEW PRODUCTS sive, ongoing efforts to be environmentally responsible, austriamicrosystems has been actively reducing its carbon footprint since 200, achieving a reduction of 0% of CO2 equivalents or 31,000 tons until 2010since Implementing actions. Over the last two ‘years austriamicrosystems has completely ‘mapped the CO2 generation of all company activities including its employees. in 201 1, the company will further reduce CO2 emis- sion equivalents by more than9,000 tons by switching to 100% green electricity based ‘mainly on water generated sources, Sue ned a iat John Heugle, austriamicrosystems’ CEO, stated, “At austriamicrosystems we consist- ently review the impact of our business on the environment and take steps to reduce pollution on the planet. Focused on clean technology to reduce our CO2 impact, we are proud to announce that we are mak- ing significant progress towards the zero carbon footprint goal we have set for the company. Investments into energy sav- ings, sustainable energy projects and CO2 reduction programs nat only help our envi ronment, but also provide significant eco- nomic advantages to us which create ben~ efits to our customers. austriamicrosystems hastaken a leadershiprleinthisimportant effort and hopes other companies in the semiconductorindustry wil follow.” austriamicrosystems continuously invests in the efficient use of energy and natural resources for environmental excellence. Programs in operation or in development Include thermo solar cooling, state-of-the: art cleaning of waste water and exhaust ar creating products for renewable energy 16,94 EURO" Spebs, 108 mm 14 Pero) clektor_ 09-200 NEWS & NEW PRODUCTS applications, and biomass plant construc- tion to enable the use of renewable fuel sources for heating and chilling require ‘ments. The implementation of these pro- ‘grams has already reduced the company’s use of coal and oll generated electricity and will soon free austriamicrosystems from dependency on imported natural gas as a key step towards the carbon neutral target wun ausiamicrosystems.comfemironment (0582) Anritsu redefines broadband VNA market Anritsu Company introduces the ME7838A broadband vector network analyzer (VINA) system that provides single-sweep cover- ‘age from 70 kHz to 110 GHz with opera ton from 40 kHz to 125 GHz, and utllzes an advanced design that eliminates the need for large, heavy millimetre wave (mmvave) madules and coax combin- ers. The ME7838A provides engineers, designers, and researchers with a system that conducts highly accurate and effi- clent broadband device characterization of active and passive microwave] mmWave devices, including those designed into emerging 60 GHz wireless personal area networks (WWPANS), 40 Gbps and higher optical networks, 77 and 94 GHz automo tive radar, dita radio links, 94 GHz imag Ing mmuvave radar, and Ka-Band satellite communications. ‘The ME783BA is also well suited for con: ducting signal integrity measurements on emerging high-speed designs, such as 28 Gbps serializer deserializer(SerDes) trans- ceivers used on servers, routers and other networking, computing and storage prod- ucts. The ME7838A, equipped with the 3743A mmWave module, can accurately ‘measure 28 Gbps SerDes transceivers at the higher frequencies required for proper analysis, ‘Among the many advantages of the 'ME7838Ais improved RF performance, due toanindustry first, reabtime powerleveling ‘control that provides the best power accu- racy and stability to power levels as low as 55 dm. The approach employed in the ME7838A takes les time, Is less tedious, ‘and more accurate than the conventional ‘method of adjusting powerlevel inthe mil- limetre band through the use of electroni- ‘cally controlled mechanical attenuators ‘and power linearity correction tables. The Vectorstar® broadband system provides ‘an accurate and fast real-time method to ‘sweep power for compression measure- ‘ments. Te result i that the ME7838A per- forms the most accurate gain compression ‘measurements on high-frequency active devicesin the industry. ‘With the ME7838A design, mmWave mod- tles can be mounted clase toor directly on the water probe. This advantage, as well as the factthat the ME783BA transtionsat $4 Giz, gives the broadband VNA the widest ‘dynamic range in its class ~107 dB at 110 GHz and 92 dB at 125 GHz. ‘The ME7838A isthe first broadband VNA to provide good raw directivity through- ‘out the entice frequency range, due to its innovative design and elimination of the MUX combinersusedin traditional systems. Bestin-class raw performance allows the ME7838A to offer engineers and designers Improved calibration and consistent meas- urement stability of 01 dB magnitude and (0.5* phase across the entre 70 kHz to 110, (Gz frequency range over 24-hour period. ‘Measurement speeds 55 msfor201 points at TOkHz IF bandwidth, 10 times fasterthan ‘comparable broadband VNA systems. ww.anrsicom (n0582)) DFM Now! revolutionizes PCB CAM software ‘Numerical innovations’ new product OFM Now allows PCB designers and engineers toverty that thelr Gerber and Drills are ready for PCB manufacturing, it aso facil- tates PCB Quotation and has many other high-end CAM features only found in soft- wate costing thousands of dollars. DFM Now! is being offered completely ree sup- Ported by advertising sponsorships (a new ‘concept forthe PCB Software industry). and may be dawnloaded from the DFM website. DFM Nowls arevolutionary product forthe PCB industry 35 toffers PCB designers and engineers powerful CAM DFM features, only found on expensive software, absolutely free because it is advertiser supported. It isa fist ofits kind’ product for PCB design professionals,” states Simon Garrison of Numerical Innovations. DFM Nowt brings desig veiieation into a comprehensive acurate and easy-to-use package for the PCB design professional Having the same power and feature-ich inteligence of N's other products, and being powered by their popular FAB 3000 engine (which has an installed base of ‘ver 1000 unique companies), DFM Now! Provides: + design verification to bridge the gap between design and manufacturing with “True DEM; + greater performance in the areas of speed, usability, and reliability with the mostinteligent CULin the industry. + aeconomic value tts customers, saving {design professionals time and money on thelr tical designs. While most PCB Layout tools are very good at performing DRC (Design Rules Check), they rarely capture many common DFM (Design For Manufacturing) problems that are hidden in the physical artwork (Le. Ger- ber dil ls) tthe artwork whichis ulti- mately used to manufacture the boardsand any hidden problersin artwork will affect the manufacturabilty and yield of boards DFM Now! allows PCB designers & engin- ers to verity that thei Gerber and Dil files are ready for PCH manufacturing using True DFM" technology. "won rumercnnovatons com (0382901) g2on eleltor Spires al |_| poate eee eee ee nO QUASAR “Saco 467 7 99 electronics IC Programmer & Experimenter Board 4-Ch DTMF Telephone Relay Switcher Be EE te Pic Programmer & Cal your phono eu ere Experimenter Soar ith bar using a TK he {oat butions and LED ina shove fom anywhere eee ators to cary ot ede. inthe word ane tonal exponents, sucha moat tum ovo any ‘o Renney the suptied programming examen Bra lays a PURE HUEAEERE | clises 0 16°527 Flash Microcar that S¥0 User Stabe Secuty Password Ai iene ures Cane reprogrammed upte 1000 meste Tamper, Rangs fo Answer, Auto Hang-up and Peat Ty Sxponmoning aval Satwaroo comple, LOCKOUL Inches plastic cae. 120.x 110 x aaa fand pcouram your sour code inched, 3m. Power. 12Vee. KtOndor Gogo Keds0K £90.95 iat Order Code 31404 £79.95 [Assembled Grder Code ViMiT? 259.95 Assomblod Order Codo.AS3140 694.96 hase creer &.ch Seri Pot cate UO Rely Mole SS.” areca erences Kt Order Code: 14GEKT £49.95, Se eel = inputs or monitoring ae era Sensing applcstore. Progemmed va sal ABS EEe = 7A, USB Experiment interface Board par usa sr new Winds ec, tom esti ‘s 5 digtl input chan- WSBee al emuttor x bate Tes), Soi cable can USB FlashOTP PIC Programmer als and cgi ut be upton ng neues psc ease rogram for wie Put chants ps wo *30c100:90m Power TAVSes00mA : foaage at ar ‘Order ove’ 308 “87498 so Sotne Zi Sacks and {wo analogue outs Assembled Oe Code A108 - 29.96 Pel ot KitOrder Cove: KEOSSKT £99.96 Infrared RC 12-Channel Relay Board TEDW. soecode: assiso_eaogs MRM Ore Code VITO 6 95 Son enters wth ‘Assombled with ZI sockat Order Code includes iar remote con- Z Rolling Code 4-Channel UHF Remote rol unit. Toggle of memoir. ASDISOZIF “£84.98 Steinert High soc Heme range 1131 too 000 Programmer ‘Epennes Moneta Suppl: 12Vae105A ATMEL 8x20 Progr Ieiching relay cutput Range Kit onder Code 12K 26495 we eae aes Drom 4LEDS ADI, canes one feb mae sok Salis ZF sot Shepard) «alr LED sR POD ced Sup Tove | $00 S08raaN) calor LED's a PCB Sates orutrones om ‘toner Coe stzm aaa as SC st too ecru, eter, somes Orde Cove ASS -exe0s _{hamaaros aly eed two way nao, tug re SUT etualnme bse Induction to Pe Progeanming a RC: tone gow ue rar oman conaet sopra gaan cet sclas ae Senet ona eekaneenter ConpuerTenewie oa cant Scr a eh ete Cn teins Seal pu cael cs om eye yee page sopoy sopror rt nae ihe aay A ate wen oa Led mes seo Scare ns Hema Mawr ate cr, may Herren Le ssprlecerco trated Sater Sumy 91 Dc Cer coor (etbecen Wins 19° Pogrenring — BS Aaa solar ea ae, PSL ac Sane See scares, Ragtime sean etre ion SUA A, esr, ani muaane PIEEBIApatyoucan to rowan ee PCB et Hats. ‘sono tr Got ASST - 2096 Mihara oie escmoverenpes ee) nejmraes om IEA sn ‘bdr you ‘ola for) Pe paral for REO Coe SST 298 | asymp RB LED Controle th R232 icons Co sos Regs a a A Ss aeenaligh ee ae ‘soni Git Cae ASSO £2498 Scere roe Remote CnirlViaGSM Mobile Phone sruncceale pts Pc Programmer Board Pocorestipe otisgture rot ‘honcer, Standalone op Lo eat PI oa Poison Atanas | Sranante sot er mar ba sppeng forconelet saa ate | {acer meocanoter feng fe Sena Asad PC cenmaresson mt empl cormard se ‘Audio DTMF Decoder and Display ee ee an a em Suttablo for common anodo RGB LED sips, trolers. Requires PC Kt Order Coxe’ MKTOOKT £14.95 LEDS and ineandescont bubs, 56.30 Sl pot Windows om. 12A total max. Supply: 120 interface supple it Onder Code “SISTKT “£27.95 Kit Order Code KBO7KT -€30.95, Assembled Order Code-ASS101-€37.96, PROFESSIONAL SMT REFLOW OVEN eC-Reflow-Mate Anew, professional SMT reflow oven with unique features In the wake of the popular SMT reflow oven introduced by Elektor in late 2008, we now present a new SMT oven, developed in cooperation with EuroCircuits Belgium, that is even more precise, has more room for PCBs, and can even be operated from a PC. In short, it isa truly professional machine that deserves a place in every electronics lab or shop where SMD boards are assembled on a regular basis. eGreflow-mate specifications Supplyvoltage: 230 SO Hzonly Monulanguages: Engh, French, Gorman, Dutch, tala Power 3500W Hungarian Temperaturerange: 25%0300°C Weight approx. 29 kg perabne range 25 to Maximum PCB Sze: 400%285 mm Dimensions: 1620%2452520mm (WxHxD) Heatingmethod: Combined IRradationand hot air Operation: Directly using menu buttonsand ICD on oven Remotely using PC software and USB connection ‘The eC-reflow-mate is deal for assembling prototypes and small production batches of PCBs with SMD components. This SMT oven. hhas a very large heating compartment, which provides plenty of space for several PCB. Two builtin sensors and IR lamps with non= linear profiles, spedaly developed fr this machine, help keep the temperature inside the entire oven compartment very uniform and constant. An addtional sensorcan be connected separately to Temperature sensors: 2 Internal and ¥ external (Inckided) Special feature: + Optimal temperature dstribution thanks to special amps + Drawer opens automaticaly at end of soldering process + Glass front for easy viewing measure the surface temperature of a component or the PCB. The oven is supplied as standard with five preconfiguted heating profiles, which can easily be adapted to your own wishes. The accompanying PCsoftware allows you to monitor the temperature ‘curves ofall sensors precisely during the soldering process, andit, enablesyou to modify existing temperature/time profiles or create new ones. This can be done very easly by using the mouse to move dean artes ——- The eGrelow-plat software forthe eC reflow-mate, whichis compatible wth Windows.xe, Windows Vista and Windows 7, enables fll erate contol ‘ofthe oven over a USB lnk. The screen rovides a simultaneous spay ofthe Selected (configured) temperaturetime profile ane the actual temperaturetim= profile nse the oven. Tho individual temperatures of ll sensors in the aven (2 (03) are displayed constant Tersperaturetime profes can be adjusted by using the mouseto drag one cormore comer points of the curve inthe harzontal or vertical direction to change thetime or temperature, respectively. The screen alsohas buttons for saving new at modded tomperaturetine profiles or opening existing profiles. The oven can even be syitched on or offrom the PC Switching ta diferent user intr language is easy. Five languegesare presently vallable; more languages bbe addedin the future 920m eektor corner points on the screen in order toadjust times and temperatures. A lass front panellets you keep aneye ‘onwhat’s happening inside the oven atall times. ‘The eC-reflow-mate features especially. Poinicoeeten Tears monte on mpi spor TPeanbe opened ether met pe eiactrorcalie The, deawar ape Jotomatcly a the | ane of tha mldera | process A clever a | EE Pe temperature inside ny EE theente compartment. The oven swell insulated tomaintainthe case temperature at 3 safe low level, even with prolonged use. ‘The eGreflow-mateis an uncompromising SMT ovenwith extensive features, and itis a valuable asset fr everyone who regularly needs toassemble PCBs with SMD components. (1004474) elektor 09-200 TEST & MEASUREMENT USB Long-Term Weather Logger Using I2C sensors for atmospheric pressure, temperature and humidity By Wilfried Watzig (Germany) weaetzig@tonline de This stand-alone data logger displays pressure, temperature and humidity readings generated by P°C-bus sensors on an LCD panel, and can run for six to eight weeks on three AA batteries. The stored readings can be read out over USB and plotted on aPC using gnuplot. Digital sensor modules keep the hardware simple and no calibration is required. ‘The author designed this data logger as a power-eficent ATmega88 microcontroller The DOGM162 display (LCD1) [3] isa two- long-term recording system for pressure, — keeps the average current draw ofthe cit lin by sikteen-character unit without back- temperature and humidity data. Samples cult below 2ma. light. The display is driven in fou-bit mode are taken at regular intervals and stored in. The firmwarels written in Cand compiled over PORTB. It was chosen because it can ‘serial EPROM, which means that they re using AVR-GCC. The source codeis available operate rom a3.3V supply. preserved evenwhen powerislost.A serial as. free download, so that itcan be modi- Mod? is a new serial-to-USB converter 0-USB module allows the data tobe read fied toworkwith other types of ®C sensor module (BOB-FT232R) [4], which is also ‘outbya connected PC for processing. The ifnecessary. described elsewhere nthisissue. sensor modules (one fr pressure and tem- perature, one for humidity) with PC inter- Hardware ‘Theother three modules (actually twomod- faces are described more thoroughly else- Since modules are used for some of the _ulesandone|C)are connected to the micro- ‘where inthis issue and are supplied ready- functional blocks, the cicultn Figure Vis _ controller over an fC bus: the Atmel incar- callbrated [1]. which implies construction simple and clear. Atthe heart of the drcult nation ofthis s called a ‘twowie interface" and processing considerably. Thanks toits isthe ATmega88 controller (2) [2],which (TW). This very widely-used bus allows up LCD panel and (rechargeable) battery power is connected to the various modules. Two to 128 busparticipants (‘slaves’) tobe con- supply telogger canbeinstalled anywhere of these are connected inthe usual fashion nected using just two signal wires. inthis for stand-alone operation. The use of a toportpins. Circuit the integrated TWI controller [5] in Elektor Products & Services or eee See ce te Se eee rn0888-4) cee ae) ee ee et ee ee ee 6 og;20n eektor the ATmega8s is configured as the “master ofthe following saves. ‘The HPO3S pressure sensor from Hope Microelectronics (a company TEST & MEASUREMENT + Accurate measurement of atmospheric pressure, temperature and humidity without ‘aliortion + Storeup to sic records (each containing pressure, temperature and humidity readings) perhour + Non-voatie storage for 81g data records + Upto eight weeks’ stand-alone operation from three AA cells + Galrated sensor modules with ital outputs for pressure, temperature andl hurd + Data canbe read out over a USB interface perhaps already known to Elektor reads fers through its radio modules [6]) con- {tains a plezoresistive transducer and inte- grated 15-bit A/D converter (ADC), along with control logic and an 12C interface. ‘The transducer outputs one voltage that ‘depends on pressure and one that depends ‘on temperature. These analogue values are altemately converted by the ADC and the results made available on the PC inter- face. During the manufacturing process eleven sensorspecific calibration values ‘with alength of two bytes ae stored inthe device's EEPROM, and these can also be Fetrieved by the microcontroller. A32 kHz clock with an amplitude of 3 Vis required todrive the ADC: since the 32 kHz oscillator ‘on the ATmega8s has an output amplitude ‘of only about 0.5V, 285170 T1)is used for amplification. The HH 10D humidity sensor is made by the same manufactuter (Hope Microelec- ee523833 § Figure 1. Circuit diagram of the logger: an ATmeqa88 and andl FC EEPROM are accompanied by four modules (USB interface, LCD, and ‘sensors for humidity nd for pressure and temperature) lektor 09-200 i EST & MEASUREMENT COMPONENT LIST Resistors Miscellaneous R1= 22040 $152,53~ 6mm suite, PCB mount R= suka SA single polaswteh B= 1oNen X1= 32,7654tu quarizaystal a= 10ke> 1CD1= DOGANG2W-A Flectronic Assembly) R= 13k Modi = BOR-FT232R-V2.20 (Fektor® 1105331) Capacitors ‘Mod2 huindity sensor H¥100 (Hope BF; Caz eaveadal \tor# 100888-71) a arpr Mod 3= pressure sensor HPO3S (Hope RF G,c46,9,.00- 10008 Fleiaors 10088872) (C5= YyEAT Sed pitch I= Gin (2x3) pinheader (optional for SP = aro interface) 2O-way socket strip SL for LCD Semiconductors 18-43 (239) socket strip for MODT np2~nata2 Sway socket strip lor MOD2 11-8870 IC socket for iC (ay) and C2 (2-29) cl 2anasiz. Ph, Hektor 1008881 1C2= ATMEGASB-200U, programmed, Hektor * voosas.4 10 1929503,3 6 3.0 Figure 2. itis e29y to populate the double-sided printed circuit board. tronics). A humidity-sensitive capacitor is used as the transducer element, deter- mining the frequency of an!CM7555 timer IC. The frequency, inthe range 6 kz to 7 kz is measured by the ATmega88 and then converted into a relative humidity ‘value with the help of two calibration par- meters again stored ina seral EEPROM in the module. The ATmega8 measures the fiequency by counting the output puses of ‘the module over one second period using the 16-bit counter TIMER. The PC serial EEPROM type 24AA512P (ict) [7] has a capacty of 64 Kbyte and stores the measured quantities (elapsed hours, time, humidity, eemperature and pressure) Upto 8191 data records can be stored, Three pushbuttons are provided for the user interface to the device. Sis used to select between (rechargeable) battery and USB power for the unit, and KI allows an AAVRISP or compatible programmer to be ‘connected. Software ‘The firmware forthe microcontrollers wst= ten in Cand compiledusing AVR-CCC4.3.0 (WinavR 20080610). Separate source files are used forthe functions corresponding to each module. ‘The main programin weather_staticn.c casas required routinesin ted driver.c (tocontrol the display), usare_ariver.c (to control the serial interfaces via the USART) and TWz_ariver.o (for HC bus contol). There aré device-specfic functions within each ofthese files, TIMER? is driven by the 32.768 kHz crys- tal and ls configured to generate an inter- rupt once per second. The interrupt service Foutine TIMER2_COMPA_vect increments the current time (expressed in hours, min- ites and seconds) and sets the event varl- able E1agiaec. At the beginning of each minute testis made to see whethera new set of readings isto be stored: this is done 1 preset number of times per hour. If new readings are required the event variable agnstor set. ‘These variables are checked inthe infinite loop in the main program. If eragieecis o9:20n elektor set then the microcontrollers switched at the fifty-ninth second of the minute from SLEEP_MODE_POWER_SAVE to SLEEP_ [MODE_IDLE (which re-enables 1O_CLK), $5 ‘that TIMERT can measure the frequency of the signal from the humidity sensor Ifthe variable ciasnstor is set then a reading is collected from the pressure sensor module, the calibration correction calculations are caried out, and the final ‘esults are witten to the 2C EEPROM. The (CPU then returns to SLEEP_MODE, POWER_, SAVE and wats forthe next intertupt from, TIMER2, Construction The double-sided printed circuit board shown in Figure 2 is, lke the circuit dia- ‘gram, very straightforwardly laid out. Apart from the pressure sensor allthe com- ponents are leaded and are mounted nor ‘mally itis best to start withthe SMD pres- sure sensor, which snot to tricky to solder bbyhand to the underside ofthe board. Also ‘mounted onthe underside ofthe board are the three buttons 51 to 53 and the sock- ‘els for mounting the LCD module. Sockets are soldered on the component side of the board for mounting the humidity module and the serial-to-USB module, Its a good idea to use sockets forthe twoICs. The first version of the board made at the Elektor labs is shown in Figure 3 and Figure 4 (Fig- ure 2 shows the final version), The fuse settings which are to be pro- {grammed into the microcontroller using the ISP connector K1 are given inthe text box. The programming job (and connec. tor 1 itself can be avoided if aready-pro- ‘grammed microcontroller is used: this, ‘along with the sensor modules and the serialto-USB module, is avallable from the Elektor shop, Alter carefully checking your soldering you ‘can switch the logger on forthe frst time. “Make sure 54 isin the correct position to select between external power (3.3 V at 'BT1) and power over USB. The uit requires no calibration, Operation The three buttons (51, 52 and 53) allow the time and other parameters to beset. lektor_og20n TEST & MEASUREMENT Figure 4, The LCD module and the pressure sensor are mounted fon the underside ofthe board. Table 1 gives an overview of the functions of each button Button $1 cycles between various function modes (numbered to and corresponding to the rows ofthe table forS2 and 83. Each pressof51 advancesto the next mode. Each Fow ofthe table indicates what 52 and 53 do in that mode. Figure 5 shows the appear en Function mode selected by S1 Function of 2 Function of SE 0: normal display dloplay pressure reading ‘splay humidity reading Teadjusttime increment hours inerement minutes 2eadjust MandN increment MfromOto6 | resetN 3: UART control continue ext 4: display readings continue exit regs per hour N= cunt ofeadogs 6 TEST & MEASUREMENT CMe ee Command ‘Action Print avalable commands as: ‘h-help/a-show-plp#=printt/me=setmceclearixcext Print count of reacings taken pO prints the readings with abe 123 12:30:00 T= 25.6 dege H=438 &= 987.6 hea I prints just the rw numbers: 2 prits the time value in hours andthe other values without labels, ‘making the output suitable for leading ito gnuplot: Set oumber af readings per hour fom OtoS md naveadings taken m6 _sixreadings perhour e., one every ten minutes)a reset reading count N lose serial connection Seed (CPU frequency Sleep mode Current drawn ‘Me none Sama Tee one Zama Tee IDLE 20mA Te POWER_SAVE 15ma Eon Fuses: [EXT | 0x9 | 8 aiiz internal oscilator (divided by 8, hence CPU clockis MHz) HIGH | OxDF | CKDIVE enabled, Brown-Outcsabled TOW [0x62 | 65 msstartup ance ofthe display in'normal display’ mode (mode), ‘To transfer stored readings to a host PC or laptop first connectit tothe madule using USB cable. Driver installation is covered in the arte on the BOB-FT232R seria-to-USB ‘module elsewhere in thisissue ‘The microcontroller can detect whether the 3.3 V supply is available from the B08. FT232 module using port pin POS. ‘The PC can retrieve data from the unit over a virtual serial port using the interac tive commands described in Table 2, for example with the help of HyperTerminal or Herm. Power supply ‘The weatherlogger operates froma supply voltage of nominally 3.3 V, which, when it is powered over USB, is available at pin 17 (VCC) of the BOB-FT232R serial-to-USB Converter module. Fr stand-alone opera tion the unit can be powered via BT! using a supply voltage between 3.5 V and 30 V and an {D0 regulator (13). Diode D1 pro tects against accidental reverse polarity connection. [tis important to employ various current Feduction measures to maximise battery life in stand-alone operation. The ATmega88 ‘microcontrollers responsible or the major ity ofthe power consumption, and so we concentrate our efforts there. The meas ured current draw of the entire circuit at 3.3 V under various conditions is showa in Table 3. When using abattery pack consist ing of three alkaline or NIMH AA cells (ve. 45 Vor3.6V; nominal capacity ofbetween 2 Ah and 3 Ah) the weather logger can Figure 5. Changes in temperature, humidity and atmospheric pressure canbe shown graphically using a program such as gnuplot. og20n elektor record data or atleast 1000 hours. nstead ofthree AA cell, fel free to employ a sin- le U-1on or LiPo cell supplying 3.6 Vor 3.7, V respectively. (One power-saving measure is to carry out only one measurement per minute rather than one every second. Atone-minute inter- vals we update only the time, the record count and the elapsed hours timer on the display. The device goes into this mode when no button is pressed for a period of 1o0seconds. ‘Measurements show thatthe system draws an extra current of about 2.5:mA for about 120 ms when taking 2 reading: in between these peaks are peaks lasting just 10 ms cor- responding to the 1 Hz interrupt. ‘The device Is switched from POWER_SAVE ‘mode into IDLE mode for the fity-ninth second of the minute. This enables the JO clock in the microcontroller, which is needed in order to be able to count the pulses from the humidity sensor: the final reading is then available in the sixtieth sec- ‘ond. This power-saving trickis only effective ifthe ATmeqa8s is operated with a MHz (CPU clock: the necessary fuse settings are sivenin the textbox. Displaying the results The fre software package gnuplot can be used to help display the results on a PCin Fine lade Fine tude Fine lude Fine tude Fine tude Fine lude Fine lude s font] b> ervems/fb.h» Ftoms_task Init(rtoms_task argument argunont) t int fd: struct fb_fixscreeninfo fb_fix: unsigned shore *pixcls: int x,y: int offset Fd = open("/dew/tb" , O_RDWR) ; ioctl (fd, FBIOSETVIDEOMODE, 2) ; foct1 (Fd, FBIOGET_FSCREENINPO, gfb_f1x) : pixels = (unsigned short *)ib_f1x.smem start; offset ~ 0: For (y-O:y<768:y+4) For (x-0;x<1024; x4) pixels[offsett+] = xtytx >> 8: white(1) } define dof ine define define dof ine define define ‘CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER ‘CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER ‘CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER ‘CONFIGURE_MAXIMUM_DRIVERS 4 ‘CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEN ‘CONFIGURE_EXECUTIVE_RAN SIZE (16*1024*1024) ‘CONFIGURE_LIBI0_MAXIMUN_FILE_DESCRIPTORS. 4 define CONFIGURE MAXIMUM_TASKS 2 def ine CONFIGURE_TICKS_PERTINESLICE 3 4def ine CONFIGURE MICROSECONDS_PER_TICK 10000 def ine CONFIGURE_RTEMS_INIT_TASKS TABLE 4def ine CONFIGURE_INITTASK STACK SIZE (8*1024) 4def ine CONPIGURE_INIT TASK PRIORITY 100 define CONFIGURE_INITTASK_ATTRIBUTES 0 define CONFIGURE_INITTASK_INITIAL MODES \. (RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTES_NO_ASR | \ ‘RTEMS_INTERRUPT_LEVEL (0)) 4def ine CONFIGURE_INIT the first line displayed (atthe top of the screen). The next 1,024 correspond tothe secondline, and soon. General. pbxel with co- ordinates () is found at the memory address 1.024 *y-+xinthe ‘memory ate. elektor 09-200 Compile itand test itas we have seen above. you're using QEMU, remevetthe option “nographic. Thevaluex” y* x>> 5assignedto each pal gives the pattern shown inFigure7, ATMn8 ATM18 Compass “You'll never walk alone” By Grégory Ester (France) Now you can forget all about magnetised needles on their pivots for finding magnetic North. And it doesn’t matter if you live in the Southern or Northern hemisphere — all that counts here Nw isthatyouhave both feet firmly onthe ground and this little device in your hand s ‘The CMPS03 OEM module [2] makes it pos- CMPS03 compass module sible to calculate the angle between the Don't worry. youwon'thave towind metres direction of the Earth’s magnetic north ‘of wire around abit ferite (Mumetal or pole and the direction in which the sensor Permally) thats permeable tothe Earth's 'spointing (Figure 1). magneticfeld. And no point thinking about a fluxgate system either— that's not the Todothis ituses twosensors thataresensi- technique this board uses tiveto the magnetic field of good old Fath. The data ls recovered from these sensors ‘The boardisbased on the use of two Philips and the angle cakulated by way ofa micro- KMZ51 magneto-tesstive sensors. Their Controller incorporated into the board. sensitivity fs such that the Earth’s mag- ‘Abus connection is also employed, and netic feld is detected by these two chips hence itis possible to recover the value of ‘mounted perpencicular tone another. Two this angle directly by communication over sensors are needed, as we need to detect an PC bus, either inthe form of one byte both the North-South and East West varia- (60 255), orin 16 bits (0 to 3,599); inthe tions. They use Permaloy,a materia that's latter case, a simple division by ten lets you extremely sensitive to magnetic fields, directly read the value ofthe angle meas- which means the resistance of the sen- red (Figure 2). : sor changes according to its postion with AIMS [3] will be glen the task of com- respect tothe lines of magnetic flux emit- rmunicating with the CMP503 module. The ‘ed by the Earth. A Wheatstone bridge on two-wire LCD [4] willbe usedtodlsplay the Figure 1. One application that isn't about each sensor (Figure 3) makes t possible to information obtained. tolose sway. accurately determine the value ofthe vai- z 06:20n eektor ATM8 Figure 3. allin the KMZS1 chip. able resistance. The variation in resistance ‘causes a voltage variation whichis amplified {UMIC6032) and measured (ANO and ANT of the PIC) by the CMPSO3 sensor electronics. In this way, the magnetic heading iscalcu- lated and a microcontroller (PIC18F2321) ‘outputs the result on an PC compatible bus; allthat remains for you todo sto make use ofthis. For correct measurement, the module will heed to be positioned horizontally with respectto the ground. Pin 7 on the module makes it possible to correct fluctuations in the signal (jitter) ‘caused by the AC power grid in your home. If this pin's pulled downto ground, the cor rectionis selected for50 HZAC: itis pulled Lup to 5 V (or left floating), the conversion willbe synchronized toa 60 Hz AC supply. The module is supplied factory-calibrated by the manufacturer inthe UK (inclination 657°) you are at a substantially different place on the globe it may be necessary to ‘e-calibrate. This procedure only has to be done once, as the parameters are stored in ‘an EEPROM, The technical documentation for the mod- ‘le available from the manufacturer's web- site [5] explains more about this aspect. nish first when orienteering! Startby wiring the cicuitby referring to Fig- ‘red, then oad the fmvare 1], power up, hold the compass horizontal and look for North. How? By turning round holding the Circuit you are facing exactly Nort, you'll hhearabeep and Cmps03_bearing_byteand ‘Cmps03_bearing_word wil take the value O. These ae the two functions sen in List- ‘ng’, that let you recover the 8- and 16-bit words; they have been written in accord ance with the timing diagram provided by the manufacturer (Figure). esktor 96200 Figure 2. Organized display of the measurement results. Forexample,fyouwant torecoverthe two whose contentshas tobe read (hee, i's 2); image bytes of the angle calculated by the then you senda new statbit followed this ‘CMPSO3 module, the function emps03__time by the module read address (SC). bearing_word starts by sending start bit Then the MSbyte is read and ts reception followed by the module's write address acknowledged (ACK), and tent conclude, (C0) and the value of the register Table 1) the command I2erbyte Lo_byte.Nack lets Listing 1. The registers reveal their contents ion Cmps03_soft_revision() As Byte mes03 addr weste Cnps03_addz_read ompe03_soft_revision , Nack End Function Function Cnpa03_bearing byte() As Byte end Function Function Cnps03_bearing xord() As Hord Local ss pyte As ayte fecal Levayte Ae Byte Teesta Toewbyte Cnps03_addr_write Taewbyte 2 Teewbyte Cnps03_addr_read byte Hi_byte , AGk yyte Lolbyte , Nack 1estap cep203 bearing word ~ 256 * HL byte cnps03_boaring_vord = Cnps03 bearing word + to_byte end Function ATMn8 eon ? Figure 5. Digital communication with the Robot Electronics CMPS03 module you read the value ofthe LSbyte and store and the indications to know where to dis- it in the variable Lo_Byte. Asthisisthe last play them. piece of dataread,itisnot acknowledged. The special characte in Figures 6 and 7 are not in the LCD controller's CGROM mem- Graphical representation ‘ory, So they need tobe created and saved of the compass points in CGRAM (Character Generator RAM). In ‘To help navigation, the 360° are divided this memory, the user-defined character set into eight parts andthe cardinal points are _startsatadress $40 (increments automat cisplayed graphically. Figures 6 and? show cally) and contains eight bytes per charac that we are facing North-north-east and ter. Thus eight custom characters can be South-south-west respectively. stored: these are called for display by send ing the ASCII code from 0 to 7 to the LCD. The liquid crystal display i fitted with an 5 *7 alphanumeric characteris formed HD44780 controller, which looks after by seven lines of five dots. There s also an character generation and driving the LCD. eighthline, whichis normally used for pos From the user's point of view, thisresultsin tioning the cursor: this wll be modified lightercode,asallyouhaveto doissendthe BASCOM-AVR provides a tool called ‘controller the instructions the characters, LCD Designer (Figures 6 & 7) which ‘Table. CMPS03 registers used inthe firmware. Register | Function a ‘Version af firmware in the CMPSO3's PICISF2321 1 “Angle in one byte: 040 255 for afl circle bo “Angle in one word (two bytes} 0 to 3589 ora fullercle Corresponds to : direct reading ofthe angle form to 358.9 degrees u offers help creating cus- ‘tom characters. As this project uses the two-wire LCD, the command line genet ated automatically by this tool, Defled- char [0],31,24,25,27,31.31,31,32, will be entered as a comment, but it does at least enable us to find out the value of the eight bytes corresponding to the character constructed For example, in order to create the charac ter seen in Figure 6, we need to send eight bytes each representing one row of dots. “The three MSBs are ignored. A pixelisvisble ifthe corresponding bitis set to 1. Listing 2 isan extract from the procedure that lets us store the set of freely-defined charactersin CGRAM memory. Listing 3 reveals part ofthe contextual pro- cedure designed to position the cursor atthe place (X_led,¥_fed) where we want to dis- play the special character. The procedure is calledlike this: CallPointing(*NNE*, 14,4). So this natural physical phenomenon, the Earth's magneticfield to which we are all of us constantly subjected, has enabled us to produce this project. Nature can make itself very useful “This very handy sensor canbe incorporated Into amobile robot. However, t willbe nec essary to keep the module well away from any electromagnetic source likely to inter {ere with the proper operation of the unit (e389) 620" elektor ATM8 LUsting 2. Storing custom characters. ‘ADRESSES CG-RAM A PROGRAMMER scHARI + $40 a 547 ScHAR? : S48 a S4P scHARS + 550 A 557 Sub Led_custom_char() Re= 0 Waits 20 Led write byte 440 tadresse de base CORAM Rs = senvoi des données Figure 6. The LCD Designer tool rom Waitms 20 BASCOM.AVR, ~CHARL_NNE, spefledchar (0), 31,24, 25,27,31,31,31,32 Led write byte 31 ssa0 Ted_write byte 24 ssa Led write byte 25 Led write byte 27 Led write byte 31 Led write byte 31 Lod write byte 31 Led write byte 32 . =CHAR2_ENE, Led write byte 31 “548 Led write byte 30 ssa9 Led_write byte 28 cee Figure 7 .for “fine-tuning” your ted write byte 24 characters Led_weite byte 31 ued write byte 31 Internet Links Led write byte 31 Led_write byte 32 . -CHARS_ESE ted write byte 31 “350 [1] wewelektorcom/110389 [2] wwwrobot-electonics. co.uk) [B]_wwnelestorcon/atmnts [4]. wwnelektorcon/o71035 o [5] swweroborelectronics.coukjhtmyemp: itech htm Bnd Sub LUsting 3. Outputting the custom characters. Sab Polntingibyval Direction As string , Byval X_lea As Byte , Byval Y_ied As Byte) led pos X led, ¥ led Select Case Direction Re=2 + envos de données nastms 20 Lea write byte soo case « ENE » Re=1 * envos de données waite 20 Lcd_write_byte sHo1 End Select, End Sub esktor 96200 3 28 J?B: Universal MMI Module using ARM Cortex-M3 Let’s stop reinventing the wheel! By Clemens Valens (Hektor France Editorial) look at circuits using a microcontroller, it can be seen that in 75 % of cases the basic circuit is virtually identical: a microcontroller, an LCD display, and a few push-buttons. This observation is nothing new, and Elektor in particular has already suggested several solutions. This article presents yet another way of going about it, alittle bit more universal, which allows the use of several types of LCD and a variable number of buttons. And thanks to its up-to-the-minute LPC1343 ARM Cortex-M3 processor, this board is extra powerful and amazingly easy to use. The type of displays usually used in amateur Even though I'd originally had the idea for you have to do is copy the software (only projects generally have ether 2 lines of 16. thiscircuit severalyears ago, started actu- works under Windows; using Linux or MAC characters (2*16), or 4lines of 20 charac- ally building it quite recently, when for the 05, you have to use a serial ink ora special ters (420). There arerarely more than four umpteenth time neededto add anMMIto programmer) buttons, but rotary encoders are increas- circuit that didn't have enough !Os free; ingly being seen, For circuits using a216 so | needed an additional port extender. Using a microcontroller lke this as a port LCD, the buttons are often below the dis- Since NXP brought out their 32-bit ARM extender, we get USB, PC, and SPI ports or play; for the 4%20 displays, they are more Cortex-M3 and MO microcontrollers, a UART for communicating withthe appli Tkely to be mounted tothe side. The posi- cheaper than port extension devices, an cation. ifwe note thatin most applications tion ofthe buttons depends on the applis ingenious and inexpensive solution is now managing the display and the keyboard ‘ation and the user; right-handed person possible. Particularly interesting for ama- takes up easily 80% ofthe software, we can tends to position them differently from a teurs, this is the LPC1343, currently the likewise envisage having the whole applica leftchanded person. A universal solution easiest microcontroller to program. No _ tion runby the microcontroller ~ especially must take allthis into account and allow a need fora programmer or an RS-232]/USB__ when we have the computational power free choice of the LCD and the position of adaptor—thismicrocontralleis presented of a 32-bit processor available, So, instead the buttons, ‘quite simply as a USB stick onto which all of adding a port extender to an applica 6 og20n elektor tion, we can add an application to a port extender. Since the microcontrollers only available in ‘an MD package, I decided to use only SMD parts throughout (with the exception of the ‘connectors and keyswitches), Inthe rela- tively confined space, cluttered with con- rectors, this allowed other functions to be ‘added, ike powering by rechargeable bat- texies or primary cells, anda charger for Lipo batteries. This means thatthe boards also suitable for mobile applications. And to round everything off nicely. the board dimensions are sultable fora stand- ard, cheap case, for area, robust fish for your project. Specifications «Suitable for2*16,4«16, and 420 LCD displays using 2 standard 14- or ‘6-pin connector (the latter back- lightisincloded),software-controlled backlight: ‘5x6 matrix keypad fora maximum of. 12 keyswitches or nine rotary encod cers with builtin push-button (equiva- lent to27 pushbuttons!) ora mixed configuration; Buzzer; OneLeD; Power via USB, extemal 5 Vsupplyri- ‘mary cells (0.9-4.5V) orLipo recharge able battery: 5V and3.3V regulators, software on off control possible; LUpo battery charger, plus software ‘measurement of battery level; 32-bit, 48-pin LPC1343 microcontroller with 32 KB Flash memory, 8 KB RAM and ‘numerous peripheralslike USB, PC, SP ‘MUI, UART, and counters; Compatible with the ree LPCxpresso [2, 3,4] and CooCox [7] IDEs: ‘Compatible with the LPC-ink and (CooCox programmers) debuggers; Extension connectors: almost allthe microcontroller pins are available on 3 connector ora pad: + splittablel Certain unused partscan be cutoff; detachable mini 4-key pad ora ‘maximum of 3 rotary encoders, + Dimensions adapted to Type 26160000 case from Bopla; + Open source software and hardware. elektor 09-200 = a 1 OF uo ES uzeTo] vreun . we re ‘SPI ‘UART use vom) [20= ] [ve fig |. ackdagamot te abo Operation opertewihether ofthese es. lsocoeae Thelngelaelson ot and act Let's start with the board's brain, the microcontroller. An oscillators necessary ‘to make it work, and o three options pre- sent themselves: the internal RC oscillator (RC), an external oscillator, or an exter- nal clock (which we are not using here). The microcontroller starts up onits inter- nal oscillator For applications requiring 3 more accurate dock, provision has been made to allow a crystal oscillator to be fitted. The microcontroller’s data sheet advises values of 18 pF or 39 pF for C14 ‘and C15, depending on the crystal used. However, most crystals ought to be able to the microcontroller’ startup mode after a reset. fPIOD. slow, the microcontroller wll first runits bootloader (SP mode), otherwise the user program will be run. The LPC1343 ‘offers two ISP modes: by USB stick (PI00.3. high) and by serial port (P100.3 low). Resi ‘tors R3 and R13 etus select the ISP mode In ‘theory, the function of is aso fulfilled by the USBvoltagedetection circuit, but itll thesamelnorder toavold.any possible inde- ‘terminate situations, iFever the USB cable should notbe connected (corecty). FRR13. instead of R3 if you prefer to program the chip via a serial ink. Figure 2, Circuit ciagram, The construction fle (Eagle files, component ist, software, etc) is avalable on [1]. gon eektor Note that there isa bug in the LPC1343's built-in USB drives, which means you have ‘to walt around 30 s before Windows will dtectthe “stick” the fst time youconnect os HE moni itfora programming session. After thatthe “s tection takes pace normally for asongas IEE. _ FR themicrocontroterremains powered. “Rye Spe The microcontcoller can also be pro- ‘grammed via an SWD (Serial Wire Debug) port, a sort of serial /TAG. Connector K3. has been provided for this purpose, wired in sucha way as tobe compatible with the L®CLink used by the free LPCXpresso pro- ‘gramming environment. The LED (034), connected to PI00.7, is aso LPOXpresso compatible, which means that the lit- tle test program LPCxpresso1343.blinky included in the 1DE ought to work without any modification. Keypad The keypad consists in principle of twelve ‘itches, four tothe left ofthe display our ‘tothe right, and four below (with a2 = 16 splay). The idea isto also be able to use rotary encoders in place of switches; an encoder ofthis type with buitsin push-but- tomis equivalent to three switches. Three encoders take up the same space as four switches. To leaveas much freedom as pos- sible in positioning the switches and encod- e's, I decided to allow up tonine encoders (in point of fact, have an application that needs that many rotary encoders). So nine ‘encoders with builtin buttons correspond 10.27 keys, thus a 5* 6 matricis needed to ‘onnectall the keys using a minimum of | s. The matrix is wted in such a way that if you are only using one ofthe three groups (of four keys (left, right, or bottom), only {our iOsare needed for scanning these four keys. The /0s freed up n this way are vall- able forsome other function. jP1 makes it possible to optimize the position of $5 in thematrix. Ihave used diodes to avoid the problem of phantom keys if several keys ae pressed at ‘once —asituation that can easily arise when you're turning two encoders at the same = ‘ime. The diodes are in S00323 package, allowing them to be replaced by resistors, incase you might want, for example, to fit ‘one of more LEDs in place f certain keys, clektor_ 09:20 8 6 Figure 3. Different vatiations on the 2*16LCD theme. Note thatthe keyswitches can be offset. ‘The main function of resistors R38, R38, 43, and Rais to enable the board to be turned on using one of the buttons $1, 55, $8, or S12. Ione of these keysis fitted with its corresponding bridge (R32. R35, R37, or R42), the resistors provide the volt ‘age needed to turn on TS when the key is pressed. The circuit can be turned on this way if powered by battery, The function of B47 is to avoidawiting Fent. This resistor isn the 1206 format for betterheat dissipation. Its valueis not rt caland depends on the brightness require. Buzzer standard 12-mm diameter piezo buzzer (with leads on a 6.5 mm pitch) offers the possibilty of producing sounds and alarms. an external supply connected to K7, the USB port (Ka), oF IC2. The latter isa vot age booster which accepts an input vot age from 0.9-4.5 V and hence offers the possibility of powering the board from a Fechargeable battery or one of more indi vidual 1.5 V cell (KS). The microcontroller does not use much power (60 mW in nor mal operating mode, clocked at 72 Mi) and a single 1.5 V cel is asymmetry in the matrix; itis nt ‘used for an on/off button. Allthe matrix lines have a current: limiting resistor (R15-R25). Its value is not very important, ust so long as it doesn’t impede the detection of the key presses. Finally, note that two footprint are available on the circuit board for 59-511 and 519-521 Display enough for long hours of opera tion, For information, the micro: controller operates with a supply voltage between? and3.6V, soa 3.3 V regulator isnot indispensa ble, given that a3 Viithium battery or primary cells is amply sufficient. Inthe eventof using a Lipo battery (<4 V)— for example, out of a mobile phone ~ abattery charger (IC4) can be fitted to the board. powered by USB (orK7). The board offers the possibil- ‘The microcontrollers capable of ity of fitting a2 line by 16 char- Figure 4.The maximum: nine rotary encoders andtwo measuring the battery level by way acter ('2*16') display, a4 line by 20 character (4 20) type, and ‘even a rather less common 4 line by 16 character (416) ype — just so long ‘asthe display asa standard connector with ‘single row of 14 oF 16 contacts at the top. left. This configuration is very common, Versions ofthe 4:20 displays aso exist with ‘two of these connectors, allowing them to be fitted either way up. ‘This type of displays normally powered at 5 V, which is not really a problem when the boardis connected to an external SV sup- ply (USB for example), but to allow battery powering, Ive added voltage booster that ‘steps the voltage up to 5 V on the board, TS offers the possibilty of turning off the power to the LCD, which is handy for re- setting the display or for limiting the cir- cuit’ overall power consumption. For this, ‘same reason, the backlight is also driven by 2 transistor (T1), with R1 to limit the cur- 4 buttons —atotalof 29 switches! IRis driven by 2. Resistor R36 avoids spur ‘us squealing when PIO2.8is configured as an input during programming ofthe micro controller. RAT isnatnecessarly usefulfora buzzer, but does allow T2 to be used to drive something else like a relay or an LED. Like Ri, ittao is in a 1206 package. Powering The board's main power ril(V+) is 5 V. This voltage is needed for the display, as the microcontroller itself is powered at 3.3 V and everything is connected to the micro controller. The 3.3 Vis derived from the 5 V ral by way of alow voltage drop regulator 1CB, RAB allows this rallto be disconnected so the power supply can be tested without any riskto the microcontroller. The 5 V can come from three sources: ofresistors R11 and R12. If the board is powered from an external supply only, there's no need to fit all of the power supply. In this event, itjustD32, C3, C4, C5, 1C3, and RAB. Note that this cae, the software-driven noff function will not be available USB and extensions Lets finish our description ofthe circuit by ‘the extension and communication ports 4 is a mini USB connector mounted on the board. tis used above all during the evelopment phase for programming the ‘microcontroller in SP mode via a USB stick For a finished application, this connector is probably not inthe right place, which is why there is connector K7 which makes it possible to remote the USE connector. T4 is driven by the microcontroller to indicate ‘to the computer that a USB peripheral has been connected. og20n elektor PB Figure 5. Plenty of possibilities too with a4%20 characte display. Virtually all the microcontroller JO are directly connected to extension connectors K1,2, and K6, We can also use K8, normally used for connecting the display. A few HOS are available only via a transistor (P1O0.6, P102.8, 102.8, and 102.10), 100.1 isaval- able on JP2 and PIO0.7 on D34. In all cases, ‘each 0 is connected to apad. 1 and K2 carry the signals from the communication ports tke the PC, $l, andUART. Here too are the Os not used by the matrix keypad ‘or the LCD. For those whe have a USB/TTL adaptor cable from FTDI {Elektor ref, 080213 [8}), you will be interested to know that K1 is ‘compatible with this cable, Note that port PIO1.4 has a special function in the microcontroller’s “deep power-down’ made, which iswhyyit has apull-up resistor R10, Note too that two pull-up resis tors (Rd and RS) can be fitted for Different types from other manufacturers might well also be suitable In principe, the buzzer, LED, connector K8, andallthe keyswitches are fitted on the sol der side ofthe board The switches are madulartypes, consisting ‘of a body onto which can be clipped caps of diferent colours, shapes, and sizes. Thus Embedded Artists, and Code Red [2, 3,4] integrated development environments (IDE). Ths free IDEis without restrictions for the LPC1343 andis supplied with numerous ‘examples and several libraries. The IDE is complemented by a number of LPCXpresso boards that include a programmer/debug. ger named LPCLink, which s to a greater or lesser extent detachable, anda var lable microcontroller part. There is ‘also an LPCXpresso board based on ‘the L°C1343 and our boards com patible with ths. Ifyou have an LPCXpresso board, ‘at off the LPCLink part and con: sult the article “Getting Started with your Free LACXpresso Board” published n the 2011 double ssue [5]. In this article, replace all refer ‘ences tothe "1114" by 1343" and ‘connect the LPCLink to K3 on our board. Ifyou have fitted the LED, allyou have to do now is follow the the FC port. Figure 6, CooCox ColDE 7], apowerfulfree IDEfor ARM instructions to make itflash K6 offers access to most of the Cortex-M0 and M3 processors from several manufacturers, _W’you don’t have the LPCXpresso ports used for the keypad. A cer: tain number of these signals are also available on KB and K9, but these two connectors are intended for instances where one might want to split off 2 mini 4-key keypad for mounting elsewhere. Construction None of the SMD devices on the board are too dificult to solder. The microcontroller ‘could prove trickiest, but armed with abit, ‘of desolder braid, it's easy enough to getrid of any surplus solder. We find more difficulty withthe inductors, asthey’re not ahvays easy to source. Hence opted for mixed sizes, more orless suited to the types from Colleraft (try their excel- lent sample service! [8], from Coiltranics {Gistributed by Farell, for example) and through-hole types on a 3.5 mm pitch lektor_og20 ‘each constructor can use keyswitches sult ‘able for their application and their taste Depending on the configuration of the key ‘switches and display adopted, the boardean be splitsoas to make itmore compact. Pre t eM oe Tis ibrarys useful in that takes iteaseforyout incorpo rate the bridge vithin your vm projects. t's easy to use: 1. stallation «create the sub-300.@ 1002) 5 a uses) Semiconductors I= FT232kg I (7X)= LED, green (0603) 1D2(Rx)= LED, re (0503) Miscellaneous = USt mini comector 18 pin 249) pinhead, ght angled Pineader Ez) Ere gest aesga 200 res Even an experienced electronics technician with good eyesight and equipped with sult- able tools (in particular, a hot-air soldering iron) vil aso need tohave confirmed maso- chistic tendencies to set about —andabove all pull off—the construction oftheir own, prototype. Andthose with trembling hands had bettersteer wel cleart ‘Thetaskis sotricky infact thatwe're offer: ing (and recommending) the circuit pre= assembled, ready to use, with the various extension connectors as a bonus. See the product page for further detals 4). (0553) Internet links 1] usp-o17 serial cable, une 2008, and associated cables in 5.0 Vand 3.3V ver Sons (let ref 080213-71 & 0802137 vnw.lektor.com/ 080213. Q Usa <> R5-232 cable, July/August 2008, (Elekto re. 080470) nwy.lektorcom/080470 USG/TTL serial coble extension & sup ‘plement, uy/August 2010 (Elektr ref 1100007): wae elektorcomn/ 100007 [4] 808-F7232R: wwr.elektor com 10553, [5], Web page forFr232RIc: ‘vm ftichipscomProdetsICs) Fraszkhtm Bi gon eeltor Subscribe now to the leading US-based computer applications magazine specializing in UEC CRSA ESOS Ce Select your personal subscription at rc 12 editions per year for just CIRCUIT Digital: Print: $63 CELL AR Digital + Print: $90 MICROCONTROLLERS Here Comes the Bus! (7) Asimple application protocol Aftet a brief pause for the Summer holidays our bus resuimes its normal timetable. In this article we describe a sIttple protocol that alléws up to fous et-points and correspondingiist nianieous values to be transmitted simultaneously. The results ideal not Use for home automation applications, Dut more gencially for ‘measurement and control. Also, for the first time, we look at programming.in C with AVR Studio. Byler Nike lektor Gerry Edtria) are inte tated in turm by a schedules! et thresholds wouldfallint this category, Y Between atte are the so-aled "ig fan example of such a sensor belng a water In previowNgstaimenjifa this series we bus phases dingwhich nodes ae alowed? level detector presintesa fe protocal which to speak without Specially being Sk, allowed a payl sent froma trans- Collisions can occur during thi'period and Sub-nodes rmitter to an addressable receiver device. so ‘non-scheduled messages’ (in other Hybrid mode is particulary useful when a ‘Take a look at Figure 1 to remind yourself words, messages transmitted during the node both has to be interrogated regularly of the detalls. A message in the Elektor free bus phase) must be acknowledged by and needs to send event-riggered mes- Message Protocol essentially consists of theirrecipient. Tiss éone by sending an Sages during the free bus phase. Think for sixteen bytes, wherebyte 0 abvayshas the ‘acknomledgemessage'backto the sender, example of temperature sensor that regu- Value AApec(170 decal) for synchronsa- larly reports the current temperature read- tion purposes. if both bits 7 and 6 of the Non-scheduled messages are particularly ing but which also monitors these read~ following mode byte arezero, bytes 2to 5 required when a node needs to commu- ings againsta threshold. This possibility areused foraddressing, Since bytes EandF _nicate something asa result of an exter- was not explicitly covered in the previous are reserved forthe optional checksum, it nal event but could otherwise perfectly instalment: in the demonstration software ispossibleto.use up to eight bytes for the _wellremain silent. inthe interests of eff- presented there drew a stict distinction p2yload. clency Its better not to poll such anode between ‘polled nodes (perhaps better Previously we also looked ata simple way regularly. Anexample ofsuchanodein the described as scheduled nodes’) and ‘ree toregulate the trafic onthe bus (hybrid _area ofhome automation might be alight bus nodes [1]. Anon-the-ballreader mme- mode’). Nodes that have 2 message to switch. Equally. sensorthat only needsto diately suggested to me that itwas possible send on a reqular basis (such as sensors) report when value has gone outside pre- _ foranode tohave both behaviourssimalta- Elektor Products & Services enn eters oftware) See ee eee pened eee ee ees Ceo ere eee] Seer ene eT & o9;20n eektor ‘neously. Francis Stevenson also put forward the suggestion that such a sensor node should always first report the fact that a threshold value has been crossed, whether during a regular interrogation or during the free bus phase. This Is a good idea, espe- dlally for particularly urgent messages. Francis and | also discussed the possibi- ity of being able to have more than one jevice’on the same physical node. Anode board would then respond to more than fone address, and hardware costs could bbe reduced. The firmware running in the ‘mierocontraller must make sure that mes- sages are correctly routed to the sub-units within the node. The same basi principle \was used inthe demonstration software in the ast instalment [1]. where the PC simul- taneously took on the roles of scheduler (address 0) and master (address 10). More channels However, if we only have a couple of sim- ple sensors andlor actuators on a single ‘nade, the splitting into devices each with their own addressis not necessary.Indeed, it would be inefficient if each sensor had to send a separate message from its own transmitter address to the master to com- ‘municate stone value. A better approach in such cases is to use ‘channels’ (hello DMX) Since we have eight payload bytes ‘avaliable ina message, we can easlly send four temperature values (each consisting ‘of two bytes) at the same time without cextra overhead. That fits very neatly with ur experimental node hardware, which has four ADCinputs available on header ka, Which bytes inthe payload correspond to which channel (and hence to which sen- sor) Isthen simply a function of thelr post- tion: the value for channel 0is sent st, fol- lowed by that for channel 1, and soon (see Figure 2). Using the same idea we can also control four actuators using a single mes sage, always assuming, of course, that each contral value can be expressed intwo bytes. Inthe demonstration software in the previ ousinstalment we used tivo bytes to com- ‘municate one of the ten-bit values read fromthe microcontroller’s ADC. We packed the lower seven bits ofthe result into one payload byte and the upper three bits into elektor 09-200 ar Be T6 543210 0 fote1ore 1 DooddoOO 2 3 AOnaeSSRECENER i li 5 nonaess seamen 5 : a 5 ; DATA B c 6 E F Figure 1. The Elektor Message Protocol defines only where the payloads located ‘within the frame [6]. the next payload byte, This has the advan- tage that the value AA can be prevented from ever occurring 38 2 payload byte, hich would otherwise confuse our simple synchronisation system, We can use the ‘same trick for each of our chanel values: ‘and already we are half-way into defining ‘our application protocol! ‘The Elektor Application Protocol Sowe need an application protocol mutu- ally understood by the nodes on the bus (both sensors and actuators) and which wil allow easy expansion to accommodate new hardware. So thatwe do not have to relavent the protocol every few months, wwe have kept the Elektor Application Pro tocol relatively simple and yet also exible, {ulfiling the following requirements as 3 minimum, « TTansmission of ten-bit values plus sign, cithera reading froma sensor or, in the ‘other direction, a contro value to an actuator. + The option to use twenty-bit values plus sign, for which we need a four-byte-per- channel mode. at [WODEDD Bre pes ast oor rore 1 DOOD OOF thy 2 3 —soonessneceweR o 5 nouns senoer § anes : td 5 : A x 5 x c D : E F Figure 2. Our application protocol vides the eight payload bytes into four consecutive byte pairs Values are transmitted in one of four channels (for sensors and actuators attached toa nede) «Setting of units and scaling factors for smart sensor nodes. + Setting of measurement interval for sen- sor nodes. + Setting of multiple thresholds, + Notification of above-or below-thresh- ‘ld alarms, + Configuration and caling-up of default presets (lor actuators), «Distinguishing between an acknow- ledge message, which contains the received values sent back to the trans- miter for checking, and the original message. (We have already imple ‘mented ths feature inthe software pre- sented In the previous instalment.) The protocol should also not be limited ther to use with hybrid mode or tohhome automation applications. it should, for ‘example, be perfectly suitable for remote interrogation of ameter or other poin-to- point applications (in which collisions can be completely voided). Control with ten bits To make this article more than justa bald datasheet we will look at the functions % MICROCONTROLLERS: Using AVR Studio and BASCOM With the double summe etion of Elektor put to bed I set to work ‘on utiting my promise that we would presenting some C code forthe system. The newest version (5.0) ofthe AVR Studio develop ‘ment environment includes an integrated C compiler (AVRGCC)be- hindits powerful and user‘iencly interface; ts fee to downlcad (efter registiation from the Atmel website [3]. The istproblemwasto getthe AVR Studio enironment to talktot -AVRISP ml prograromer.Athoughthad already installed the neces: sary diner wen nsaling the development ervronmert ise at fist things ca not work propel. The problem was that the programmer was bound tothe bub diver which had installed for usewith BAS. COW nistaingthe ibs driver solved the problem. and wasabie toprogram devices om AVR Studiowithout further iii simply Lyplugging the programmerinto aS port. Thesereenshat shows how thing appear inthe Windows 7 Device Manager when cotecty Setup, course, wanted tose BASCOM atthe sometime, and this Canalsobe made to work the lbusbdrver hast belnstalled35250- Calle iter drver. Theresa discussion ofhowtodothisat i] When setting up anew projectin AVR Studio its necessary to spec iy the target processor. Fortunately there isnot alot ese fo config: ture tap of F (r Bul Solution’ in the menus) creates hex fle from the soure ede and ay referenced ibraries. The programmer Isthusinsuated fromthe difiuly of writing a makefile to contre the bul proces listed above step by step. \We start with the communication of ten- bit values which, as we mentioned above, are divided between the two bytes form- Jing channel 0. We call the two pats OH (for ToMash the target device clickon the button withthe ightning icon. nthe programmer window that opens fist clickon the Ap ply button towards the top (withthe settings Tool-AVRISP mk, Devico=Armega8s, Interfaco-IS). The Progrant button i located under’ Memories. The path tothe hax Me should fist entered Into the combo bax above, “high ) and OL (for‘low’).As Figure 3 shows, [ bits 4.7 and OL7 (the most significant bits t ofthe two payload bytes) are ahways ero, so thatthe byte value Aap, cannot occu This uses up 50 % ofthe possible values for each byte, but we can always use the remaining possible values for special func- tions later if we wish. ‘As an example, consider a Venetian blind 0-1 Which a home automation master control- ler wants to set to 2 30 % closed position. (For this example ten bits of precision are ‘more than enough!) We reserve bitOH.3 forthe signof the value: 1 representing negative, 0 positive. The data bits D9 down to DO are then packed as described above. Three bits are left over, which we use a follows. Bit OF.6 determines whether two bytes or four bytes are being used for the channel. The four-byte mode willbe used later to send more precise data values and for cer- tain special functions. Bit OH.5 says whether the data value is 2 set-point or an instantaneous reading (indicating set-point, dan instantaneous reading). Bit OF 4, when set, indicates that thisis an acknowledge message. bytes: 6 or TA MG Sa Re Gi [0 [oe bee = [ow [ow [or | 006] 05/405 || || Figure 3. The two bytes forming one channel in more detail. We can transmitvalues with ‘upto ten bits of precision, plus sign bit. 0000-0 0001-11-10 (00011110i~304n) Theblind controller replies with an acknowl- ledge message, having the acknowiedge bit set: “The master and the blind controller must have agreed beforehand on how the 30% closed position is represented numerically: wwe will look at sealing factors in a later instalment. Let us suppose that we encode the percentage directly as an integer, and ‘that we can communicate with the bling controler on channel 0. the Elektor Message Protocol packet the ‘master will hen send the following two 01-4-1-0000 000-1-1-1-41-0 AAn intelligent blind controller could of course determine the instantaneous post tion ofthe blind and report this value. It ‘would in any case be wise to have itreport an instantaneous value of 30 % when the process of moving the blind has completed: bytes 6and7 of 01-00-0000 0.0.0-1-1-1-1-0 o9;20n elektor MICROCONTROLLERS [Meas eS ‘ound thetntemet a greatally ny frst experiments in embedded C programming. The pons ashnorum was to get some LEDs flashing; then! moved to to reading values from the ADC and outputting afew bytes ‘onto the bus using the miocontroler's LUART, which read back nto the Cand dis- payed using the Terminal exe terminal pro: gram. Itisimportant to be vary when copy- and-pastng programs from the internet as you canfind code fo a range of ferent [AVR micracontrallers which cannat always bboused directly on the ATmega8 without checking ist against ts datasheet [5]. For example, the naming of registers can vary between diferent mirocontraler types: UDR (the register that accepts bytes tobe transmitted ad holds ecelved bytes) Is called UDRO on the ATmegaB A particularly nasty traps the naming of the interrupt vectorwhich s used to specily the routine tobe called when a characteris received by the UART. Many Interat cade examples give the incan {ation Ise(USART_RXC_veet [J theuse of which has the unfor- tunate effect of hanging the microcontroller After a good hou of hneae-sratching | discovered that re corect form for the ATTne- (9988s 1SR(USART_RX vect) ‘Anyone coming from the world of BASCOM or BASIC mote gonera- Iyshould be particularly aware othe folowing types of error which {He compiler will not aways complain about One schoolboy storis toconfuse adoubled equals sign (used to indicate an equaltycom- parison) witha single equals sign (used to incate an assignment). The language is also absolutely strict when Itcomesto case sens- LUvity, bot invariable names andi keywords suchas WA pair of bracketsis essential after function name to indicate acl to that function (2.4, ToggleL£D()), and armisplaced semi-colon can lead ‘wall sorts of surprising error messages Itis a good idea to check, lover the program syntax carefully before setting the compiler loose ‘onyour code. The ext exercise wast translate the BASCOM demonstration soft: ware into. The result canbe found onthe projact web pages [2]. ‘To make comparson as easy as posible, have tried to adhere to the structure ofthe original code 2: far ax possible. There are of ‘course many opportunities for optimisation and old hands at Care ‘encouraged to send inimproved versions! ‘tis apparent froma sie by-sde comparison that programming nC requies getting closer tothe hardware. BASCOM hides alot of the nitty-gritty behind commands Ihe Start ADC;, "Enable Ure” and Printbi. However, having to learn what the microcontrollers registers dois not necessary disadvantage, and the extra pro- ‘gramming effort canbe more than outweighed bythe advantage cofhaving set of reusable, made-to-measure routines. AS we de og20n velop the firmware further these subroutines willbe packaged into small brary. ‘ATutther important pointfor beginners in Cis that ports and other registers (for example forthe ADC and UART) must always bead= dressed as complete bytes. only ane bit to beset caremust be talento preserve the athers. Ths can be dane sing logical OR ‘operation: PORT = PORT | Bi mask: ‘or moreconcisly PORT |= Bitaask: To dear abit, use logical AND operation ith an verted bit mas: PORT &- ~Bitnask; {have used directives suchas 4ofine TextLED 200010000 to create bit masks and port names corresponding to the LEDS, but tons and port pins. This allows a statement ofthe form TootLED; ‘tobe used tolight the test LED. Much code found on the Internet ses slightly different approach, writing Alefine TestLEDbitpasition 4 PORT |= (1 [ela]ols o|m|= alo /n)>le clolel=la[s[al> »l>l=|e/5/=|>|= alalalo|~[ola/= ®=|>/2)=)"]=]=|8/>[9 =/9)=)§]= olelalale|=lolola|~|a/o[a|>lol= >[©/@|=|~|>|s|m]o|@la|alola|=|a |>[o/e/a/@/olelo[>|yle|=|mlals =[olalalelo|s|n[mlol[>[a[alolale @|>[>|=le[s|=|=]*|elo/o[m|a/a[o o|m/=|=|cle|m|alajale/w|>lo/s/o elelole[a[s|olalelelol>[=[=|-[< =[=/=[>|=|@|/a/o|>|~|m/ale|=|>|5 ole elele@|=|>lals|alo ms lalol= >| [ola[>lolo|S]als[a[=[ele[m[o mlolalela|>|= ass [olelelo @lel=[>|=[o[m ©/o|~felelal= nle@im|>[=|o|> ‘Trecanpton spe tees ek West Mec sass prendre AN og20n

Vous aimerez peut-être aussi