Home
EmbEddEd dEvELOpmENT
Contents
1. a la jn la jo fe e fr T gt fz la J Jo w la lt e lo Jo la e lt h Ia IR la h a Io le m Jo IN wm August 2012 Issue 265 gt O RIORITY INTERRUPT by Steve Ciarcia Founder and Editorial Director What Were They Thinking 9 ve mentioned this before but the original BMW iDrive on my 2002 745iL was a prime example of overzealous design Back then somebody had the bright idea of condensing nearly all the switches and knobs formerly found on typical car dashboards down to a large knob called iDrive on the center console Combined with a fancy graphics LCD the joystick provided the driver with 3 D motion control for selecting specific subsystems and individual functions within that subsys tem The bad news was that zooming into and backing out of various control functions was so complicated it was a real driving hazard I m guessing the iDrive designers got caught up in the process of creating a slick design and completely forgot about the basic reason you re in the car in the first place to drive not to run a computer Let s face it when you re driving it s more expedient to reach for a single function control you can locate out of the corner of your eye The world was not ready to deal with a 3 D joystick a complex decision tree on an LCD and a dozen hand motions to tell a com puter t
2. A N August 2012 Issue 265 Ht CONSUMMATE ENGINEER sy ceorse Novacek canada Project Development Part 2 Development Process Milestones and Design Reviews A competent electronics engineer must conceptualize and then follow a proper project development plan To do so the engineer must understand the essential topics of development milestones design reviews and configuration control n the first part of this article series I detailed the project development process This was graphically shown in Figure 1 which I once again include here for your convenience Now I ll talk about the milestones shown in green and design reviews attached to them The first milestone the project kickoff isn t much more than just a green light to start work Usually it s a telephone call or e mail triggering a small celebration A formal contract often follows at a later date In a perfect world before starting you should have received a signed contract with a specification and a customer approved state ment of compliance i e compliance matrix submitted by you in response to the customer s specification during negotiations The compliance Start up development matrix is one of the most important contractual documents An excerpt from one is shown in Table 1 COMPLIANCE The compliance matrix addresses every single paragraph of the specification statement of work or other contractual documents It also des
3. HOW TO Handle Embedded Design Issues PROJECT DEVELOPMENT Compliance amp Reviews LOCATION United States LOCATION Canada PAGE 44 PAGE 48 INSIGHT Charging with Photovoltaic Cells LOCATION United States PAGE 68 THE WORLD S SOURCE FOR EMBEDDED ELECTROMOS mar INFORMATION btfse T59 buffa AUGUST 2012 done STATUS Ji ole ISSUE 265_ l EMBEDDED DEVEL LOPMI NT J i ta i a St ri bn py i La Pa Build an MCU Based Light al o Timing amp Control Syster eae i rth Electronic Compass Tilt ite PERE Compensation amp Calibration cal Tes Me l TF i m ui Mec k Eaa EST RA a I O Port Examination te M9 bure eT ri Ta ay Joto eee ni i System Level RF Desigiy ly a 2b The Mind of a Roboticist II Innovative Robotics Projects II Inside the Design Lab II Intelligent Use of MCUs amp Sensors 10 00CAN 08 gt 5 0 549 744707 WWW CIircuites ae ee fe 190 O00 100 SB7OLC Board The complete hardware and software solution The SB70ic Development Kit The NetBurner SB70 LC Development Kit is available to customize any aspect of operation including web pages data filtering or custom network applications The kit includes platform hardware ANSI C C compiler TCP IP stack web server e mail protocols RTOS flash file system Eclipse IDE debugger and cables The kit enables you to a 6 9900 communicate with
4. High End Performance 3 EAN with Embedded Ruggedness SOOMHZ ARMO Unbrickable Low power 4W S5V 2279 design 128MB DDR RAM MY TON 512MB high speed 269 17MB sec onboard Flash qty 1 12K LUT customizable FPGA Internal PCI Bus PC 104 connector 2 host USB 2 0 480 Mbps ia Gigabit ethernet a 250 sockets 3x faster Ory Cat 10 serial ports 110 GPIO and backward a e e SAGE sean compatible with TS 72xx Ne ee ahini a Sleep mode uses 200 micrazmps Boots Linux 2 6 in 0 7 seconds Linux 2 6 and Debian by default TS SOCKET Macrocontrollers Jump Start Your Embedded System Design TS SOCKET Macrocontrollers are CPU core modules that securely connect to a baseboard usirg the TS SOCKET connector standard COTS baseboards are available or design a baseboard for a custom solution with drastically reduced design time and complexity Start your embedded system around a TS SOCKET Macrocontroller to reduce your overall praject risk and accelerate time to market Current TS SOCKET procucts include ua uy ey TS5 4200 At nel ARM9 with super low power TS 4300 600OMHz ARMS and 25K LUT FPGA TS 4500 Cavium ARMS at very low cost TS 4700 800MHz Marvell ARM with vides TS 4800 800MHz Freescale IMA515 with video Several COTS baseboards for evaluation amp development Dual 100 pin connectors Secure connection w mounting holes Common pin out interface Low profile w 6mm spacing R Over 25 years in business J
5. Inc 4 Park Street Vernon CT 06066 Phone 860 875 2199 Copyright Notice Entire contents copyright 2012 by Circuit Cellar Inc All rights reserved Circuit Cellar is a registered trademark of Circuit Cellar Inc Reproduction of this publication in whole or in part without written consent from Circuit Cellar Inc is prohibited Disclaimer Circuit Cellar makes no warranties and assumes no responsibility or liability of any kind for errors in these programs or schematics or for the consequences of any such errors Furthermore because of possible variation in the quality and condition of materials and workmanship of reader assembled projects Circuit Cellar disclaims any responsibility for the safe and proper function of reader assembled projects based upon or from plans descriptions or information published by Circuit Cellar The information provided by Circuit Cellar is for educational purposes Circuit Cellar makes no claims or warrants that readers have a right to build things based upon these ideas under patent or other relevant intellectual property law in their jurisdiction or that readers have a right to construct or operate any of the devices described herein under the relevant patent or other intellectual property law of the reader s jurisdiction The reader assumes any risk of infringement liability for constructing or operating such devices Circuit Cellar 2012 Printed in the United States Embedded Systems
6. one and Q4 starts to conduct too At this point the output starts rising faster You can see that Q2 is there to make the zero to one transition faster when a pin is being used as an output Q3 is there for a reason If nothing is connected to a pin when the pin s output should be a logical one it is Q4 is there to maintain a relatively low resistance path to V p when the pin s output should be a logical one and nothing is pulling the pin low There is no connection between the pin and 0 V I O pins without internal pull up resistors are essen tially just NMOS transistors whose sources are tied to ground In such pins when the gate of the transistor is driven high the transistor provides a path to ground and when the gate is driven low the transistor discon nects the pin from ground but does not connect it to anything else In the 8051 the pins of port 3 have inter nal pull up resistors and the pins of port 0 are of the min imalist variety they are Open drain pins I will now describe a sim ple way to see the effect of each of Q2 Q3 and Q4 THE EXPERIMENT In order to see the effects of the three transistors I tied an I O pin with an internal pull up resistor pin 1 of port 3 henceforth P3 1 to an I O pin without an internal pull up resistor pin 0 of port 0 henceforth P0 0 Figure 3 is a tran sistor and gate level schematic of this configuration Q1i Q4 and their associated gates and connections are pin
7. robot without using expensive RC cars parts that are not easy to assemble I was inspired by the award winning Flexi Flyer articulated robot More pictures are available at my Lino website www guiott com Lino Sito Lino html Right now I m in a very early stage I want to reuse the already acquired knowledge for the low level subsystem batteries sensors and motor control because the problems are very similar to the indoor experience After everything works on this part Anderson docet I ll start experimenting with something new for me gyros accelerometers magne tometers and GPS In short inertial measurement unit IMU I don t know when it will be ready but it will be ready Stay tuned NAN What do you consider to be the next big thing in the embedded design industry Is there a particular technology that you ve used or seen that will change the way engineers design in the coming months and years GUIDO As often happens the big www circuitcellarcom CIRCUIT CELLAR A mockup of the Lino made with corrugated paper to test the validity of the project thing is one of the smallest ones Many manufacturers are working on micro nano pico watt devices I ve done a little but not very extreme experimenting with my Pendulum project Using the sleeping features of a simple PIC1OF22P with some care I ve maintained the pendulum s oscil lation bob for a year with a couple of
8. ss r t Power Line Communication Street Lighting ve ow a System se i WiFi Street Y fe Lighting Cera ae System PE aa mPower Line Communication Modules Spyder and McLaren E Arduino with WiFi Diamondback Redback E Arduino Shields Cupperhead and Juniper WiFi PLC GPRS MIDI Touch gameduino mLong Range UHF Gen2 RFID m JPEG Serial Cameras m4TV mRobotics www linksprite com www linkspritedirect com CIRCUIT CELLAR www circuitcellar com O NKC electronics 7 EVERYTHING ARDUS ii ifi fi AE electron hos aA oi NKC electronics OWON OSCILLOSCOPES NK Celectronics waona 5057 102V Iei hy fered 1 Gar epee Bes a TIE Pec ord Leah OR Bete TET Geiger eo do LAR eT ed M iy Perel SD MEE Serra Pee Fare Bh Bore ie TTT Cry 28 bir Fhe fe ee iiiam E G4 TFT rpi DA Baba ie a microEngineering Labs Inc www melabs com 888 316 1753 Programmers for Microchip PIC Microcontrollers PC Tethered USB Model shown Standalone software Command line operation melas mE U2 Programmer miraknagineaiag Labs Mac aia i abs Oot pesca Hide GUI for automated use Override configuration with drop downs Stand Alone Field Programmer Power from target device or adapter Program file stored on SD CARD Programming options stored in file Starting at 79 95 Single button oper
9. the test conditions than anything else In any event such a low resistance wouldn t work well with the current levels I have in mind a 1 A current produces only 50 mV which may be too small for reliable sensing Now that I can measure my MOSFETs however I can proceed with further experiments CONTACT RELEASE The tester hardware applies only positive voltages limiting it to n channel enhancement MOSFETs Some adroit switching could adapt the circuitry to test the p channel MOSFETs often used for high side switches but I ll leave that as another exer cise for the interested reader All the test results shown here maintained the transistor at 30 C with the Peltier module In my next article I ll describe that www circuitcellar com CIRCUIT CELLAR IRF 244 fe Drain Current ID amp VGS gt 2 0 Drain Resistance ADS mrm 0 60 0 80 1 00 1 20 140 1 60 Drain Source Voltage YOS W IRF 244 o Drain Current ID A Drain Resistance ADS mohm 0 10 0 15 Drain Source Voltage VDS W Photo 7a The logic level threshold of an IRFZ44 MOSFET produces drain current above 2 A for gate voltages above 3 V The vertical purple line near Vps 0 50 V is a spurious value at V 2 0 V b Any gate voltage above 5 V produces a nearly flat drain resistance curve for this IRFZ44 MOSFET Unfortunately the resulting resistance may be too low for my purposes circuitry and the firmware tha
10. you ground the pin Because Q2 is normally cut off no current flows through Q2 the large transistor and this saves us a lot of current Once the output is pulled low Q4 is cut off as well Only Q3 the smallest transistor is still conducting In this way very little current is wasted by the circuit when a zero is being entered What purpose does Q3 serve Suppose that after enter ing a zero you want to enter a one After grounding the pin to enter a zero you unground the pin and Q3 acts to pull the voltage on the pin up and to charge any capacitances at the output After a little while the voltage on the output rises enough that the inverter at Q4 s gate sees a logical www circuitcellar com CIRCUIT CELLAR I O pins without internal pull up resistors are essentially just NMOS transistors whose sources are tied to ground In such pins when the gate of the transistor is driven high the transistor provides a path to ground and when the gate is driven low the transistor disconnects the pin from ground but does not connect it to anything else In the 8051 the pins of port 3 have internal pull up resis tors and the pins of port 0 are of the minimalist variety they are open drain pins Figure 3 A pin with an internal pull up resistor is connected to one without a pull up resistor The pin without a pull up resistor is represented by Q5 The rest of the assembly is the pin with a pull up resistor
11. 000 m ISOTHERMALPROCESS AT 0 two words COMPARATOR A device that compares two voltages or currents and switches its output to indicate which is larger NSPE Organization formed in 1934 by bridge engineer David Steinman EMl Common cause of electronic data corruption and subject of Novacek s 257 2011 Circuit Cellar article acronym two words PIEZOELECTRICITY Occurs when crystals acquire a charge after being compressed twisted or distorted e g quartz WIDLAR American electrical engineer 1937 1991 and _ IC pioneer LEDDRIVER Circuitry that regulates or provides powers to a light source two words JOULE Symbolized by 10 letter of the alphabet RTOS Unscramble the following IETEORGSEPSMNYMRLTIAEAT as 5 Bo gt Fhe haf 74 Hit Liig OULDN 50 WE NEW DS2000 Digital Oscilloscopes Our latest Best in Class Scope offers an unmatched feature value package ip _ re Tie i Sy at COMPARE amp SAVE 839 vs Tektronix TDS2000C lom a a w lE la lo lo I z lo l lh lv Ja lz l gt o gt w la lz m la lz Jo h m lt gt Ja zio gt l gt l Jz o Ja
12. 1 of port 3 Q5 and its input describe P0 0 I had my 8051 family microcontroller in this case the Analog Devices ADuC841 check to see whether 0 V or Vp was being input to a third I O pin to pin 2 of port 3 P3 2 If V was being input to P3 2 I had the microcontroller open the switch of P0 0 and toggle the switch of P3 1 If 0 V was being input I had the microcontroller open the switch of P3 1 and toggle that of P0 0 Looking at the sim plified models in Figures 1a and 1b you would think that August 2012 Issue 265 A 1 August 2012 Issue 265 OES Agilent Technologies a or a a m ea Alal ea E E a eal 7 a s Photo 1 The 0 to 5 V transition when the I O pin with the pull up resistor is being toggled The transition takes about 10 ns both methods would lead to a square wave at the now joint output of P0 0 and P3 1 You would be right but you would not be 100 right Interesting things happen during the 0 to 5 V transition First let s consider the case that V was being input to P3 2 In this case Q5 is always cut off and it plays a very little role in the operation of the circuit Each time Q the input at the far left of Figure 3 is set to zero the joint output of the circuit is 0 V When Q is set to one then for two clock cycles in our case about 200 ns the large transistor Q2 conducts and the output should transition quickly from 0 V to V which was 5 V in
13. CT and additional offices One year 12 issues subscription rate USA ae eee ae Address Changes Problems circuitcellar pcspublink com Internet www circuitcellar com and possessions 50 Canada 65 Foreign ROW 75 All subscription orders payable in U S funds only via Visa MasterCard international postal money o order or check drawn on U S bank Postmaster Send address changes to Circuit Cellar P O Box 462256 Escondido CA 92046 New Products New Products Circuit Cellar 4 Park Street Vernon CT Cover photography by Chris Rakoczy www rakoczyphoto com 06066 E mail newproducts circuitcellar com Advertising rates and terms available on request We now have 2012 International CES 05 All Electronics Corp 0 00 e eae AP Circuits ouaaa ded a hee oe ok ARM terete KA GS Aa hs She Oe A 3l Atria Technologies Inc 0005 Beta Layout Ltd 00a BusBoard Prototype Systems Sign up at www circuitcellar com members in countries Not a member yet Newark elementl4 0 19 Newhaven Display International NKC Electronics 0 cece 79 Pico Technology Ltd si ocewiae ne eace eu 62 PODU CO oa rens tans rena en aa 4 ae 47 Reach Technology Inc 00000 78 Rigol Technologies 0000 0 79 Comfile Technology 0005 55 Cleverscope iain eo waa ve eee ewe 15 Custom Computer Services
14. Custom configurations and designs w J Open Source Vision excellent pricing and turn around time m Never discontinued a product j Most products stocked and available A Engineers on Tech Support for next day shipping Design your solution with one of our engineers 480 837 5200 New Products Touch Panel Computers 800MHz with Video Acceleration Resistive touchscreen LED backlit display Gasketed construction a Tough powder coated finiss Fanless operation from 20 C to 70 C BODMHZ ARM CPU 256M6 RAM 256MB SLO XPMAND Drive kk iii Ties MicroSD slot Fully enclosed TPC Pa E r starts at SK LUT programmable FPGA available O3 if E oo A LARA 5415 a Dual Ethernet USB ports Gp em n a q _ TP qty 100 CAN RS 232 ports RS 485 E pn 479 Mono speaker on PCB stereo audio jack ty SPI DIC Industrial Controllers Powerful Rugged Affordable 250MHz ARM9 or BOOMHz ARMS or Cortex A8 CPU Fast startup under 3 seconds ctartt al Fanless operation from 20 C to 70 C S 1 99 User programmable openco e FPGA 100 TY Program in Ladder Logic or S 229 Debian Linux qty 1 Modbus support PoE capable 10 100 Ethernet USB 2 0 Host Ports picture of T5 6420 BOX Industrial screw down connectors Opto lsolated DIO Digital Ccunters Quadrature Technologic Systems now offers three powerful AE AAE computers targeting industrial process control PEG SG DIO WIN PWM Implement an int
15. Even powering up the unit takes two to three firm panel button presses but only one click on the remote My HDTV is similar There s a manual but ton to change the input selection and it always takes two to three presses before it actually starts to switch inputs On the IR remote it is instant Grrrr The point is when designing a new piece of equipment don t get caught up demonstrating as much technology as possible to the exclusion of all other considerations How hard can it be to design a piece of equipment to respond equally to a few hardwired buttons as well as the IR Similarly just because you have the computing power and software expert ise sometimes it s counterproductive to put all functional control only in the remote control or to put every function into one multi option multitasking joystick As a designer you have a responsibility to reduce hardware costs by eliminating excess Manual controls but you should always take the time to put yourself in the place of the end user who has to deal with your choices More importantly think about what happens after the dog eats the remote steve ciarcia circuitcellar com CIRCUIT CELLAR www circuitcellar com www ftdichip com OOOO O O A A ENHANCED USB PERFORMANCE Streamlined USB Bridge Solutions X CHIP EXtensive Interfaces UART FIFO SPI IC FT1248 Extended Features Battery charger detection gi Low active power 8 mA typic
16. Jeff Bachiochi Software amp Design File Organization by George Martin Hardware Accelerated Encryption by Patrick Schaumont Project Configuration Control by George Novacek Tickets amp Registration www electronica de en 2012 life needs good solutions i are on display here intelligent embedded solutions a electronica 2012 inside tomorrow 25th International Trade Fair for Electronic Components Systems and Applications Messe Munchen November 13 16 2012 www electronica de August 2012 e Embedded Development 1 eCompass Build and Calibrate a Tilt Compensating Electronic Compass Mark Pedley _3 2 MCU Based Light Control Longer Serial Communication on Differential Wires Scott Weber lt O Examining an I O Port The Internal Structure of an I O Pin with a Pull Up Resistor Shlomo Engelberg Concurrency in Embedded Systems Part 2 Atomicity and TOCTTOU Bob Japenga r Embedded neil Aboni lt 43 THE CONSUMMATE ENGINEER C J Abate Project EEEn Part 2 Development Process Milestones and Design Reviews George Novacek MEMBER PROFILE AR fr ABOVE TI 3SROUND PLANE MOSFET Channel Resistance Tester Hardware IUESTIONS amp ANSWERS 2 lt 4 Ed Nisley The Man Behind the dsNavCon EDA An Interview with Guido Ottaviani Nan Price Systema sev l RF Design Robert Lacoste CROSSWORD 7 6 Esr p E m m i D KE R JE P E E bm k D 3 iD Bon rR
17. Most importantly I described a very sim ple experiment that enables us to see the effect of each of the PMOS transistors that together comprise the pull up resistor Finally we see how important it is to understand the internal workings of your microcontroller if you want to make sure that it performs optimally li AID AP CIRCUITS PCB Fabrication Since 1984 As low as 9 95 each Two Boards Two Layers Two Masks One Legend Unmasked boards ship next day www apcircuits com www circuitcellar com CIRCUIT CELLAR Shlomo Engelberg shlomoe jct ac il is former editor in chief of the IEEE Instrumentation and Measurement maga zine He received bachelor s and master s degrees in Engi neering from The Cooper Union and a PhD in Mathematics from New York University s Courant Institute He is an associ ate professor in the Electronics department at the Jerusalem College of Technology He is the author of many articles and several books including Digital Signal Processing An Experi mental Approach Springer 2008 and ADuC841 Microcon troller Design Manual From Microcontroller Theory to Design Projects Circuit Cellar 2011 Shlomo s technical interests include applied mathematics instrumentation and measure ment signal processing control theory and 8051 microcon trollers REFERENCE 1 Intel Corp MCS 51 Microcontroller Family User s Manual 1994 www industrologic com MCS51Fam
18. NiMH Fast charge management ICs Texas Instruments Inc www ti com NEED TO KNOW INFO Knowledge is power In the computer applications industry informed engineers and programmers don t just survive they thrive and excel For more need to know information about some of the topics covered in this article the Circuit Cellar editorial staff recommends the following content Solar Powering the Circuit Cellar Part 1 Preparing the Site by Steve Ciarcia Circuit Cellar 209 2007 Have you considered installing a photovoltaic PV system This series of articles describes the entire process from site preparation to completion Topics Photovoltaic Solar Solar Powering the Circuit Cellar Part 2 From the Ground Up by Steve Ciarcia Circuit Cellar 210 2008 This article covers the massive task of preparing two 11 schedule 80 poles 8 in diameter to support two of the three solar arrays Topics Photovoltaic Solar Arrays Solar Powering the Circuit Cellar Part 3 Wiring amp Electronics by Steve Ciarcia Circuit Cellar 211 2008 Installing a major renewable energy source like a home photovoltaic system is no small feat This article describes wiring and electronics Topics PV Renewable Energy Go to Circuit Cellar s webshop to find these articles and more www cc webshop com CIRCUIT CELLAR www circuitcellar com so00ccC Neg cit ssogggas gecccccs E7 man Cnn Elektor Pri Confident
19. Rich Single Board Computer VS _ stat 159 100s j C programmable computer 16 bit HCS12 processor clocked at 40 MHz 8 PWM 8 counter timer and 8 digital 1 O Dual RS232 485 ports SPI and IC ports 512K on chip Flash 512K RAM with Flash backup e Plug in I O expansion including Ethernet Wi Fi GPS 24 bit data acquisition UART USB Compact Flash card relays and more J J e 16 10 bit A D inputs J J pr Mosaic Industries Inc CERE tel 510 790 1255 fax 510 790 0925 eit www mosaic industries com BusBoard Prototype Systems a 2 7 P Jt oar io DoOoOoooooo no oOnonMoOnDoooonoo egee e Many Ratterns EE E E E i tte o o D EDOL EOE Jesse els slee eee ele EEE Docoooooontod0o BRRRBRBAEStripBoar a a a a a ajsa Veleleleleletelele SEER JAMECO ELEGCTROAWIEG S amazoncom amazon co uk Running out of time Let our team finish your custom project Engineers with over 20 years of software embedded experience Specializing in embedded designs include PCB design and prototype assemblies Staffed Software and Electrical engineers full testing lab and technicians Quick code conversions and code comple tion services Fixed Price Quotes amp Contracts www ccsinfo com custom sales ccsinfo com ar ae 2 262 522 6500 ext 35 Wi U e Street Lighting System Power Line Communication Long Range RFID Reader Arduino e
20. RrCCWUIrT RD C CO DAR TLIC DEAISLI DDTOHODTITTV TAITEDD I IDT C gt Ff amp dD oS n E DIV gt i N 4 x E a JFE Y N 1 FE ead CdC tI I E RRAV PIi BIE NI ERAN I dni E l AN CI XJ Charging with PV Cells What Were They Thinking Jeff Bachiochi Steve Ciarcia A August 2012 Issue 265 CIRCUIT CELLAR www circuitcellar com D mouser com Distributing semiconductors and electronic components for design engineers Authorized Distributor Mouser com Tne widest selection of the newest products The Newest Products for Your Newest Designs a tti company Mouser and Mouser Electronics are registered trademarks of Mouser Electronics Inc Other products logos and company names mentioned herein may be trademarks of their respective owners Steve Ciarcia Hugo Van haecke C J Abate shannon Barraclough Nan Price KC Prescott Jeff Bachiochi Bob Japenga Jeff Yanco Robert Lacoste George Martin Debbie Lavoie Ed Nisley George Novacek Amanda Anderson Patrick Schaumont Richard Wotiz Nordian Davis Ken Davidson David Tweed Kim Hopkins CIRCUIT CELLAR THE WORLD S SOURCE FOR EMBEDDED ELECTRONICS ENGINEERING INFORMATION Tech the Future explores the solutions for a aTa sustainable future provided by technology 7 T VOICE COIL creativity and science United Kingdom Wisse Hettinga 31 0 46 4389428 w hettinga elektor com USA Hugo Van haecke 1 860 875 2199 h
21. The majority of these projects perform a particular function In this book however the programming of these controllers is the foremost concern Using lots of practical examples we show how using BASCOM you can quickly get your own design ideas up and running in silicon The companion CD ROM with this book provides sample programs and software including BCAVRDMO AVR STUDIO LCDTOOLS and TERMINAL EXE 224 pages ISBN 978 1 907920 11 0 56 40 Prices and item descriptions subject to change E amp O E lok ta e Associated 60 piece Starter Kit available Fun with LEDs This booklet presents more than twenty exciting projects covering LEDs aimed at young amp old From an Air Writer a Party Light Running Lights a LED Fader right up to a Christmas Tree Use this book to replicate various projects and then put them into practice To give you a head start each project is supported by a brief explanation sche matics and photos A couple of projects employ the popular Arduino microcontroller board that s graced by a galaxy of open source applications The optional 60 piece Starter Kit available with this book is a great way to get circuits built up and tested ona breadboard i e without soldering 96 pages ISBN 978 1 907920 05 9 38 00 ae A comprehensive and practical how to guide Design your own PC Visual Pro cessing and Recognition System in c This book is aimed at Engineers Scientists and enth
22. adequate for tilt compensation purposes It is important to check the accelerometer datasheet for the O g offset accuracy which is the output when the accelerometer is in 0 g freefall Since this value is a constant additive error on each accelerometer channel it adds a bias in the calculated tilt angles so look for accelerometers where this parameter does not exceed 50 mg The magnitude of the earth s geomag netic field is typically about 50 uT with a horizontal component that varies over the earth s surface from a maximum of about 40 uT down to 0 at the geomagnetic poles If an eCompass is required to operate in horizontal geomagnetic fields down to 10 uT in arctic Canada for example with a noise jitter of 3 then a back of the envelope calculation indi cates that a magnetometer with a maxi mum noise level of 0 5 uT is needed Most of my projects have used Freescale s MMA8451Q Xtrinsic three axis 14 bit accelerometer and MAG3110 three axis magnetometer The MMA8451Q is supplied in a 3 mm x 3 mm x 1 mm 16 pin QFN package and provides a 14 bit data output with 30 mg 0 g off set accuracy The MAG3110 magnetome ter is supplied in a 2 mm x 2 mm x 0 85 mm 10 pin DFN package and pro vides a measurement range of 1 000 uT with 0 1 uT resolution and a noise level down to 0 25 uT Both parts operate with a supply voltage between 1 95 V and 3 6 V Similar sensors are supplied by Asahi Kasei AKM Kionix ST
23. and a thermistor assembly occupy the aluminum block mounted atop a Peltier module on the black CPU heatsink to the right iio men z T ii 0 0 209 0409 QED 68 LOD 1270 Le 165 Drain Soupa Voltage Woo W Photo 2 Testing a BUZ71A MOSFET shows the expected behavior as Vs ranges from 2 0 V to 10 0 V in 1 0 V steps The tester s 2 A maximum I and 1 6 V maximum V s restrict the data points to the lower left corner of the graphs seen in MOSFET datasheets CIRCUIT CELLAR www circuitcellarcom LED1 Amber y X MAX4544EUT T GNDA Gain Set Drain current 10VV 05AV GND R4 R5 PWM3 3 1k CB short Use 32 kHz PWM 10u Rg 4 20k Qi ay IRLZ14 Logic level MOSFET MOSFET Power BR 20W Heatsink 100n 4 C4 gt GNDA 10k 1 10p 510 R10 1 0 Kelvin connections Choose feedback VDRAIN 10k 1 SJS DRAIN Default IDrain R18 VDRAIN y Gain 2 gt VGS FET under test D X2 2 0 OX2 3 G GND1 Single point connection IC1B 7 R11 10W 6 Yk Sji LM324N D2 R15 R16 Dit bi vee SJ2 GNDA 13 R21 12 4 7K Gain 3 gt 3 VDS Max VDS 5 Gain X2 1 S X1 2 Gommon FET VDD Power FET OX1 1 Supply FET VDD 5V 3A Diff Amp V Gain 2 gt 2 V A R7 R8 short 20k 1 7 168 C Drain Current N77 BATS54S GNDA short 20k 1 R19 10k 1 LM324N 14 R20 1k IC1D Te Drain Voltage D3 gt gt O VCC lt 7 BAT54S Figure 1 An LM324
24. designed better Scott Weber had that experi ence and then acted on his impulse to build a more effective system He created an MCU based light controller p 32 If you want to ensure a microcontroller works efficiently within one of your systems you should get to know it inside and out Shlomo Engelberg examines the internal structure of an I O pin with a pull up resistor p 40 Bob Japenga continues his series Concurrency in Embedded Systems on page 44 He covers atomicity and time of check to time of use TOCTTOU On page 48 George Novacek presents the second part of his series on project development He covers project mile stones and design reviews Ed Nisley s June 2012 article introduced the topic of MOS FET channel resistance On page 52 he covers MOSFET tester circuitry and provides test results If you read Robert Lacoste s June 2012 article you now understand the basics of frequency mixers This month he presents high level design methods and tools p 58 Jeff Bachiochi wraps up the issue with an examination of a popular topic energy harvesting p 68 He covers PV cell technology maximum power point tracking MPPT and charge management control O cj circuitcellar com N August 2012 Issue 265 THE WORLD S SOURCE FOR EMBEDDED ELECTRONICS ENGINEERING INFORMATION THEME Embedded Applications Wireless Communications Robotics Embedded Programming Measurement amp Sensors Communicatio
25. experiences GUIDO Let me talk about my first day of work exactly 31 years ago Being a radio amateur and electronics fan I went often to the surplus stores to find some useful components and devices or just to touch the wonderful receivers or instruments Bird wattmeters Collins or Racal receivers BC 312 BC 603 or BC 1000 military receivers and everything else on the shelves The first day of work in the laboratory they told to me Start learning that instrument It was a Hewlett Packard spectrum analyzer maybe an HP85 something that cost more than 10 times my annual gross salary at that time I still remember the excitement of being able to touch it for that day and the follow ing days Working in a company full of these kinds of instru ments the building even had a repair and calibration laborato ry with HP employees with more than a thousand engineers who knew everything from DC to microwaves to learn from was like living in Eden The salary was a secondary issue at that time I worked on audio and RF circuits in the HF to UHF bands active antennas radiogoniometers first tests on frequency hopping and spread spectrum and a first sample of a Motorola 68000 based GPS as big as a microwave oven Each instrument had an HPIB or GPIB or IEEE488 interface to the computer So I started approaching this new for me world of programming an HP9845 computer with a cost equiv alent to 5 years of my salary then to buil
26. includes sample source code and libraries for data logging calorie calculation pedome ter function and device drivers to interface with the host processor Driver firmware for each sensor is provided along with Sample programs for data logging pedometer and activity monitoring with activity detection i e walking running and riding The SDK also includes software development tools and the uEASE emulator an on chip debug emulator for software debugging that uses the microcontroller s debugging function to run stop programs ML610Q792 samples cost 3 73 The SDK costs 869 57 LAPIS Semiconductor Co Ltd www lapis semi com en www circuitcellarcom CIRCUIT CELLAR m August 2012 Issue 265 1 August 2012 Issue 265 DETECTION amp CONFIGURATION IC The TS3A225E is an audio headset detection and config uration switch integrated circuit IC that enables universal headset support for audio applications in a single chip The IC is designed to elimi nate detection leak age and click pop problems caused by using discrete com ponents in end equipment e g Smartphones tablets laptops audio docks and home audio applications The TS3A225E supports three prong without micro phone and four prong with microphone audio headsets from all manufacturers The IC detects the configuration of the microphone and ground pins on a four prong headset and appropriately routes them via a 2 x 2 crosspoint swit
27. other logic Listing 1 shows that the firmware averages three analog sam ples to further reduce the noise Photo 4 shows the results from a 1 Q resistor connected between the tester s drain and source terminals the gate terminal is not used in this test which closely match the expected values The firmware forces the computed resistance to 0 Q when the measured current is exactly zero ensuring that the first point doesn t produce a divide by zero error Photo 5 shows a 0 1 9 1 resistor that presents a more realistic load appears to be slightly too high at 110 mQ How ever when I manually measured the voltage across the resistor due to a 1 00 A DC current the connecting wires added about 6 mV and account for nearly the entire error Below 50 mV you can see the effects of the Arduino s 5 mV ADC resolution and the firmware s 50 mA drain current increments So it s fair to say the tester produces reasonably accurate results for drain currents below 2 A and drain voltages between 50 mV and 1 6 V the entire range my MOSFETs will use MOSFET MEASUREMENTS Photo 6a shows the results for an IRF630 MOSFET with a 400 mQ2 maximum drain resistance Photo 6b shows a closer Resistor 0 1 chm F Drain Current iD Crain Resistance ADS mohim a 0 05 0 10 0 15 0 20 O 25 Drain Source Voltage VOS W Photo 5 The tester reports a 0 1 Q 1 resistor as 108 mQ but the resistor s conne
28. reading on paper et fe 7 Comprehensive reading at home and on the road Join now or upgrade www elektor com member Down 2 Software used to create other software usually including a text editor a compiler a linker and a debugger A unit of inductance abbreviation H An amount of oscillation ranging from 3 kHz to 300 GHz two words 7 Miguel Sanchez s article Image Processing Development Circuit Cellar 263 2012 used one of these along with an MCU and bipolar stepper motors to accomplish some computer vision related tasks two words 9 In 1978 this company released one of its first products a simple MOS Technology 6502 microprocessor based single board computer two words 10 According to Jeff Bachiochi s article in this issue a single one of these is a transl t sandwich of P d T a ai See Soo ea z a PP TT ei k m UI amp m N junction that can be exposed to a light S d te eee EE a E 13 Used as a volume control in audio amplifiers two words Py p fy fod 14 SI unit of electric current Across 1 The frequency at which a filter s output has fallen by 3 dB from the maximum level two words Israeli cryptographer and one of the inventors of the RSA algorithm V n k two words Columnist Robert Lacoste s article Noise Filters 101 Circuit Cellar 249 2012 discussed how to determine and measure it in a radio freque
29. s CMX7163 CMX7164 CMX910 CMX981 and CMX7861 The CMX973 is available in an RF optimized 32 lead VQFN package that measures only 5mm x 5 mm x 1 mm Contact CML Microsystems for pricing CML Microsystems www cmimicro com NEW PRODUCT News CIRCUIT CELLAR www circuitcellar com TRANSFORM AN iPAD INTO A PORTABLE LOGIC ANALYZER LogiScope is a logic analyzer with an oscilloscope s real time data analysis capabilities It is ultra portable and specifically designed for the iOS family of products i e iPhone iPad and iPod Touch The analyzer transforms an iPad into a 100 MHz 16 channel logic analyzer Traditionally a logic analyzer records a buffer that needs to be downloaded and searched LogiScope s triggering enables decoded data to be viewed live This eliminates the need to capture pause and then view The touchscreen based iOS platform features a simple and intuitive display For example to change the timescale simply zoom into a smartphone picture and adjust the delay The logic analyzer s intuitive interface also provides immediate feedback for sig nals that are too fast for the timescale by changing the waveform to red There is no need to wait for a complete reading Logiscope version 1 0 12 is available for free down load from Apple Inc The LogiScope app is made for iPod Touch 3 and 4 generation iPhone 4S iPhone 4 iPhone 3GS iPad 3 iPad 2 and iPad LogiScope hard wa
30. solution fails because of TOCTTOU issues If we wrongly apply this solution to Case Study 1 the condition that could occur is shown in Figure 2 In this case even with the busy bit because of TOCTTOU the SPI gets incoherent data Ox2FF instead of either Ox1FF or 0x200 The SPI reads the busy bit time of check and takes action on the busy bit time of use and the SPI has some bytes from the first sample and some from the second When both threads of a system or two independent systems perform non atomic reads and writes a simple busy bit won t work WHAT ARE SOME SOLUTIONS TO TOCTTOU A simple solution to this would be to use a more complicated busy indicator which is really an 8 bit counter where the low order bit indicates busy The writing device would do the following flag 0x01 WriteData flag t Listing 2 Results of the reading device flagl ReadTheFlag if flagl amp 0x01 0 ReadData if flagl ReadTheFlag Use the data Wait and try later Wait and try again later CIRCUIT CELLAR www circuitcellar com Note OR a 1 into the flag instead of using f1ag to guaran tee synchronization The reading device results are shown in Listing 2 Now we would be protected from incoherent data regardless of the overlaps of reading and writing the shared resource PROBLEMS HAPPEN Concurrency issues can create nightmarish problems for embedded systems designers The design
31. surprisingly low prices The market for sensors in con Sumer products is a recent example It all started with an accelerometer used to select between portrait and landscape display orientations and then with the addition of a magnetometer evolved into the electronic compass eCompass used to align street maps to the smartphone s geographic heading or to enable aug mented reality overlays As a result high volume pricing for smartphone accelerometer and magnetometer sen sors is now less than 1 each A magnetometer sensor alone cannot provide an accurate compass heading for two reasons First the magnetic field measured at the magnetometer varies Significantly with tilt angle Second the magnetometer requires calibrating not only for its own offset but also against spurious magnetic fields resulting from any nearby ferromagnetic components on the circuit board This article describes how the accelerometer is used 0 to compensate the magnetometer for tilt and includes a simple technique for cali brating the magnetometer SENSOR SELECTION The accelerometer should be three axis and capable of operating in the 2 g range with a minimum of 10 bits of resolution The output of a 10 bit accelerometer operating in the 2 g range will change by 512 counts as the accelerometer is rotated 180 from point ing downward to upward giving an aver age sensitivity of one count per 0 35 change in tilt This is more than
32. ulated amplitude for each of them You definitively have to check the mixer image frequency 214 4 45 MHz and the second and third harmonics of the output frequencies 2 x 169 4 MHz and 3 x 169 4 MHz VSS TO THE RESCUE I want to present a more efficient solution using system level RF simulator software There are very few tools like it on the market but my company is fortunate enough to have a license for one AWR s Visual System Simulator VSS soft ware Caution this is a costly tool VSS has a zillion features e g time domain modulation simulations however in this article I will just demonstrate its most basic feature which is system level RF chain simu lation This is exactly what we need Basically VSS enables you to design an RF chain to link system blocks such as mixers filters or amplifiers You can define the characteris tics of each block either at a behavioral model i e this is an amplifier with a given gain P1dB and IP3 through data tables from the manufacturer i e this is a filter with these gains and phases through frequency or even through circuit diagrams or electromagnetic models if you buy the other modules in AWR s Microwave Office tool suite You can start with a high level model simulate it refine some blocks down to an electromagnetic simulation of a microstrip PCB and check the performance of the entire system You can even link a VSS model with actual hardware through off th
33. vanhaecke elektor com Germany Ferdinand te Walvaart 49 0 241 88 909 0 f tewalvaart elektor de France Denis Meyer 31 0 46 4389435 d meyer elektor fr Netherlands Harry Baggen 31 0 46 4389429 h baggen elektor nl Spain Eduardo Corral 34 91 101 93 85 e corral elektor es Italy Maurizio del Corso 39 2 66504755 m delcorso inware it Sweden Wisse Hettinga 31 0 46 4389428 w hettinga elektor com Brazil Joao Martins 351214131600 joao martins editorialbolina com Portugal Joao Martins 351214131600 joao martins editorialbolina com Turkey C Zeynep K ksal India ca Sunil D Malekar 91 9833168815 ts elektorin Russia Nataliya Melnikova 8 10 7 965 395 33 36 nataliya m larionova yandex ru 90 532 277 48 26 zkoksal beti com tr South Africa Johan Dijk 27 78 2330 694 31 6 109 31 926 J Dijk elektor com China Cees Baay 86 0 21 6445 2811 CeesBaay gmail com Issue 265 August 2012 ISSN 1528 0608 Subscriptions US Advertising l l E Circuit Cellar P O Box 462256 Escondido CA 92046 Strategic Media Marketing Inc CIRCUIT CELLAR ISSN 1528 0608 is published monthly by Circuit Cellar E mail circuitcellar pespublink com 2 Main Street Gloucester MA 01930 USA ncomporaio 4 at Street o CT 06066 Periodical rares paid al Phone 800 269 6301 Internet www circuitcellar com Phone 978 281 7708 Fax 978 281 7706 E mail peter smmarketing us Vernon
34. you realize that the headlight is only controlled by the ignition key the light stays on until you turn the key to the off position On a normal bike you would do this anyway in order to pocket the key before walking away But with the KIPASS fob you don t need the key and lots of bikers simply stop the engine and walk away leaving the headlight on and killing the battery Here s where it gets fun With a dead battery you can t start the bike except by jumping it using another vehicle The Allen wrench you need to open the panel you have to remove to get at the battery is in the tool kit under the seat which is locked by the ignition key In a real Catch 22 the ignition key is still captured by KIPASS even without power and you can t remove it to unlock the seat The only solution is to find a friend or a tow truck with both jumper cables and the cor rect Allen wrench Home theater equipment is another irritation Forgiving for now that most functions can be accessed only from the remote control you d think the few buttons they do have would work correctly For some reason I m finding the built in buttons are a lot less responsive than the remote I suspect the interrupt handling software for the IR receiver has a much higher priority than the hardwired switches My Blu ray player in particular virtually never responds to the physical change disc button on the front and I almost always have to use the button on the remote
35. 0 mV across two 100 9 resistors in parallel means about 4 mA flowing across the resistors i e 200 mV 50 Q is needed To bias these wires so they have a nominal difference of 200 mV when the sys tem is powered with 5 V place bias resistors R3 and R4 on the line see Figure 1b Next determine that if 4 mA flow ing from top to bottom is required gt R 5 V 4 mA so the total resistance in circuit B needs to be about 1 250 2 Since we know the terminators combine to form 50 Q the two remain ing resistors need to add up to 1 200 Q or about 600 Q each OFF THE PAPER INTO THE ATTIC I bring my telephone Internet alarm contacts and anything else into the wiring closet so this RS 485 network should not be an exception Because the network needs to run continuous ly with terminations on each end I started simply with two runs Each run has its termination at its far ends and is connect ed to a barrier strip in the wiring closet This also provides a point where I can insert the bias voltage I also added some transient voltage suppressors between the power lines and ground that protect the power bus from spikes The barrier strip that connects to the power supply is shown in the lower portion of Photo 2 One side of the bus starts at a loca tion in the garage and then visits the light switch location that handles the accent lights outside my garage doors From there it visits a wall box near my desktop PC so I can attach my PC t
36. 2 each in 5 000 unit quantities Pricing for the MCP6V31 starts at 0 81 each eT l Microchip Technology Inc LF a www microchip com Low Power zero Drift Op Amps Io Silicon H OR Companies Professionals Students DlYers Amateurs 5 Gourds Kits Modules Components Tools Inatruments ony Linas Kermal 2 4 installed T6MB FLASH 3248 RAM 200 Mhz Arn GPL 169 00 129 00 Oty 100 Proboaded with DOS amp Flash File bere cama 33MHz 186 Compatible Processor S1ZK Flash 512K DRAM 32 Pin DIP Socket 44 Digital WO Linas 2 Serial Ports Console Debug Port Watchdog amp 2 16 bit Timers T V DC of SV Power 66 00 Oty 700 What s your flavor Dane esters Si __ inux or DOS _ JE R Inc 530 297 6073 www jkmicro com sales jkmicro com August 2012 Issue 265 www circuitcellancom CIRCUIT CELLAR 3 August 2012 Issue 265 MEMBER PROFILE Mark Csele Member Name Mark Csele Location Welland Ontario Canada in the Niagara region about 30 minutes away from Niagara Falls Education BS Physics honors BEng Computers and PEng in Ontario Occupation Full time professor at Niagara College Canada Member Status Mark has subscribed since 1994 but he said he read the Circuit Cellar column regularly when it appeared in Byte magazine It was his favorite column Technical Inte
37. 214 MHz and IF frequency of 45 MHz As explained in my June 263 article you must also take care to select a mixer with a LO power level high enough as compared to the input signal power Here the input is 0 dBm so as a first guess let s be opti mistic and state that a mixer with a 10 dB higher LO power is a strict minimum so we will select a 10 dBm class mixer There are plenty of mixer manufac turers but for this article I used Mini Circuits s ADE 1LH frequency mixer as an example Table 1 shows its key specifications The mixer is adequate for signals from 0 5 MHz to 500 MHz and has a reasonable 5 dB conversion loss The specification also provides isolation figures which means the level IP3 at center band _ dBm Mid band LO RF om LO RF Isolation dB LO IF Isolation dB f E U Typ Min in Min Typ Typ DC 500 0 5 500 65 50 26 52 15 1 dB COMP 5 dBm typ L low range f to 10 f m mid band 10 f to f 2 U upper range f 2 tof m mid band 2 f to f 2 Table 1 An excerpt from the Mini Circuits ADE 1LH frequency mixer Understanding each of these figures is the key to success Source Mini Circuits www circuitcellar com CIRCUIT CELLAR August 2012 Issue 265 Ul O August 2012 Issue 265 word s smalst MsO deh scope nedes a Measures oni
38. 4 of 0x00000100 0x0000000100 1s later our system reads byte 1 0x0000000100 Our system reads byte 2 0x0000000100 Our system reads byte 3 0x0000000100 Our system reads byte 4 0x0000000100 Table 1 Our 4 byte read and the 8051 s 4 byte read At times both reads were nonatomic resulting in incoherent data www circuitcellar com CIRCUIT CELLAR August 2012 Issue 265 A Ul August 2012 Issue 265 Listing 1 Time thread code if KYZ_1 l KYZ_1_last_value KYZ_counter_l KYZ_1_last_value KYZ_1 CASE STUDY 3 READING A 16 BIT COUNTER ON AN 8 BIT PROCESSOR I first ran into this problem while working with a 16 bit count er in a single threaded program running on an 8 bit processor As we Saw in Part 1 of this article series sometimes the concur rency occurs in hardware as we will see in this case The design had a 16 bit counter used to count bottles going down a conveyor The counter was read by an 8 bit processor in two operations The counter updated in nanoseconds and the processor read the counter in two 8 bit reads about 1 us apart Hopefully you see the scenario coming The counter is sitting at Ox1FF when the processor reads the low order byte OxFF By the time the processor has read the high order byte the counter has incremented to 0x0200 Thus the processor sees 0x02 and sets its internal variable to Ox2FF rather than either of the tw
39. 5 uW required current Using a 2 65 W solar cell is a few thousand times overkill If that assumption is changed to using precharged batteries things take a big turn Fast charging current is no longer needed What do manufacturers say about trickle charging for extend ed periods Recommended rates suggest not applying more than 1 40 C C is the 1 h rating of the particular cell This means a 2 Ah cell should have a trickle charge of no more than 50 mA i e 50 mA x 2 5 V 128 mW Wait that s still a few NS N hundred times the operating current The shelf life of NiMH batteries wasn t even a year when they were first intro duced Improvements over the last few years have brought them up to acceptable levels Today these cells lose only about 20 capacity just lying around So if a set of batteries loses 20 of its 2 Ah capacity in a year that s 400 mAh year or roughly 1 mAh of capacity day So for a device that uses 5 5 mAh day you can expect to lose an additional 1 mAh day from self discharge We experience an average of about 12 h of sunlight each day Assuming you mount our solar cell facing south in the northern hemisphere at an azimuth of your site s lat itude is at noon on the equinox your solar panel will be perpendicular to the sun You can expect to gather the maximum amount of energy Cells are rated assuming that 1 000 W m of illumination is falling on them Figure 6 shows the typ
40. 7 Mars rover Topics Electronic Compassing Robot Heading Navigation Digital Compassing Build a Tilt Compensated Digital Magnetic Compass by Vadym Grygorenko Circuit Cellar 188 2006 Vadym built a PSoC based digital compass with a three axis magneto resistive sensor featuring tilt com pensation The system stores calibration data in the PSoC s internal EEPROM Topics Tilt Compensation Compass Calibration Find a New Direction A Low Power Digital Compass by Jess Marroquin Circuit Cellar 253 2011 You can use a low power microcontroller to build a digital compass This article details the planning design and programming processes Topic Digital Compass Magnetic Sensor Low Power Consumption Launching the Roboat Navigation by GPS and Digital Compass by Riccardo Rocca Circuit Cellar 115 2000 Riccardo wanted to test the feasibility of driving an object using a GPS and a digital compass In this case the object is the Roboat model boat that can sail autonomously along a course planned in advance Topic Digital Compass GPS Navigation Proportional Servo Go to Circuit Cellar s webshop to find these articles and more www cc webshop com August 2012 Issue 265 N W August 2012 Issue 265 QUESTIONS amp ANSWERS NAN Where do you live GUIDO I live in wonderful Rome Italy the eternal city Very chaotic but very stimulating according to many points of view NAN How did you become i
41. 78 Plectronia 2012 oare cae Seuaek sand ees d EOK a ea E seats 42 66 67 BIQMOl EREEREER ETES TETEE TTET 75 EMAC ING cutuwdeeagoeuadae ane awn 70 ESC Boston a DESIGN East Summit 39 EXPOS SPOE 245 046 4b maweade sw aba i 71 Flexipanel Ltd s sacs lt e 008avaaoa TI e ES SEEE EEEE EEEE C3 Grid Connect INC nuanua aaa 43 HannoWare cave iiaa assa niae 63 Holtek Semiconductor Inc 51 muUMenCera Gs se sue ss oho o Re cee ee as 65 Imagineering INC naana aaa C4 Ironwood Electronics 00005 78 Jeffrey Kerr LLC 6 cat ek eo be eS 63 JK microsystems Inc 00 0 13 77 Labcenter Electronics 00005 29 LINKS ioe eRe eae se Ree ee ewe eo 78 MaxBOUX WNC a i iiia hb oe geek Ge As 79 MCC Micro Computer Control i Microengineering Labs 05 79 Mosaic Industries 00 0 eae 78 Mouser Electronics Inc 0005 5 NGOB UCN sa 0 eena Slee een ne ate C2 Renesas RL78 Green Energy Challenge 21 SGC COs NG 4 9 o sw teaenne eee oe esida 60 Sealevel Systems 00 0 eae 27 SMOR aha G dots ws GR Ok OOS 13 Technologic Systems 005 8 9 TOA ING has oo eas cee oe eS 71 Triangle Research International Inc 78 Ute a ee ee a E ee 63 Not a supporting company yet Contact Peter Wostrel peter smmarketing us Phone 978 281 7708 Fax 978 281 7706 to reserve your own space for the next issue of our member s magazine Circuit Cellar
42. AAA batteries and it is still oscillating behind me right now Because of this kind of MCU we can Start seriously thinking about energy har An aluminum sheet that has been cut and folded for the final version of Lino vesting We can get energy from light heat any kind of RF movement or what ever to have a self powered autonomous device Thanks to smartphones PDAs tablets and other portable devices the MEMS sensors have become smaller and less expensive In my opinion all this technology together with supercapacitors solid state batteries or similar will spread many small devices everywhere to monitor everything il mbed mbed NXP LPC11U24 Microcontroller ee ao a ae Rapid prototyping for USB Devices Battery Powered designs a 32 bit ARM Cortex M0 applications http mbed org A M August 2012 Issue 265 bd n August 2012 Issue 265 Lk A pues by Scott Weber USA MCU Based Light Control Longer Serial Communication on Differential Wires You don t have to purchase expensive off the shelf home control equipment For instance you can use a microcontroller and a few other components to build a custom system to control lights on a predetermined schedule This design is intended to replace a wall switch he phrase I could do that better seems like the driving force behind most projects undertaken by engineers In my case the project was replacin
43. APRS World expect to get 0 707 of the maximum on average So over 10 h that s approximately 3 300 Wh m i e 10 h x 475 Wh m x 0 707 of illumination for the day If you use Parallax s 2 65 W cell you might see 3 3 h of capacity i e 3 300 Wh m 1 000 W m or 8 7 Wh i e 2 65 W x 3 3 h of energy over a one day period And that s under a clear sky So where does this get us At my local electronics store I found a small 1 5 by 0 75 solar cell that is rated at 300 mA at 0 55 V That has a potential of 165 mW i e 0 3 mA x 0 55 V On clear days I might expect to gather 544 mW i e 165 mW x 3 3 h of energy which would be approxi mately 10 times the energy required for my remote device Even with poor efficiency once my load capacitor superca pacitor was charged up to 5 V I could draw off current to trickle charge the batteries with a simple resistor With a potential of 5 V and load of 2 5 V battery voltage a 250 2 resistor would supply 10 mA for as long as I could keep the Supercapacitor charged Even an hour of sunlight a day could produce twice the daily requirements NATURE Obviously a good look at your locality s solar data is a must in order to be able to predict how insulation levels will affect the current generating potential for a specific installation While batteries may be sized to last a year you may wish to extend their effectiveness by adding some support to keep them charged to extend t
44. Ha os wWww picservo com JEFFREY KERR LLC Propeller Debugger ViewPort brings powerful tools to the Parallax Propeller Step line by line breakpoint Performance profiler 80 MSps analysis of IO pins Realtime graphs Change values with custom interfaces Rewind time and zoom in out Win OSX Linux C BASIC SPIN IDE l hannoware com viewport Hello USB Developers The New Flipper Connector Works Either Way amp Costs Less 2 Product of USA Now coming to USA Millions soldalready in use in Asia Try Flipper Sample Demo Pack only 25 Regular 40 including 1x 4GB Flash Drive 2x Adapters 10x Flipper male A connectors amp FREE Shipping within the Continental USA www flipperUSB com ai info flipperUSB com t 310 408 9711 FLIPPER USE ee S Paka aia wes Peg er Patented in US Canada Japan Tawan Chira Reps Wa nted _ Cost less than regular USB from major disinbulors August 2012 Issue 265 0 UJ August 2012 Issue 265 Photo 4 Click run and VSS shows the simulated output spectrum of the circuit The top left plot is the output of the mixer the bottom left is the out put of the filter and output of the amplifier is on the right The main output Signal is as expected at 169 4 MHz with a power close to 18 dBm Plenty of spurious signals are also expected to be generated and VSS provides a sim
45. Integrated Industrial Controllers _ August 2012 Issue 265 a single PCB and cut them apart giving me more units per dollar HARDWARE Figure 2 is a schematic of my light controller When I ordered three circuit boards from ExpressPCB I actu ally combined the layout with another device so I could simply cut them in half getting six boards for the price of three The schematic and double sided boards were created using the ExpressPCB software suite Photo 3 shows views of both sides of an extra board unpopu lated This was one of my first attempts at using sur face mount device SMD components Using a fine point soldering iron small tweezers and a magnifier I m thankful I m not a coffee drinker I used a Microchip Technology PIC16F688 microcon troller which receives both power and data from the four wire RS 485 bus connected to J1 The power is fuse protected and bypassed to protect the bus The differential data lines A and B are protected with back to back Zener diodes to protect from over voltage damaging the differential transceiver A termination resistor is also included However only one of the units represents the end of the network line That unit used the termination resistor while it was left off the other units The differential signal is fed to the differential trans ceiver U1 aDS1487 RS 485 transceiver which is a tristate driv er enabling a device to insert or remove itself from the bus The driv
46. Listing 1 The background thread would send the KYZ_counter to the host display them on the screen or log them to a log file The problem was that occasionally the KYZ_counter data would be wrong when sent to the host on the display or in the log How could this happen This happens because increment ing the KYZ_counter_1 as well as counters 2 4 was not an atomic operation even though it was a single C instruction Underneath this one C instruction would be a half dozen 8051 instructions any of which could be interrupted As we previ ously saw the problem will occur any time one of the 8 bit por tions of the 32 bit number rolls over from OxFF to 0x00 after it has interrupted a nonatomic read of the data If the same code was ported to a 32 bit ARM9 processor which has atomic 32 bit operations there would be no problem Memory Location Contents g 0x00000000FE 8051 writes byte 2 of 0x000000FF _ 0x00000000FE 8051 writes byte 3 of 0x000000FF 0x00000000FE 8051 writes byte 4 of 0x000000FF 0x00000000FF 1 s later the 8051 writes byte 1 of 0x00000100 8051 writes byte 2 of Ox00000100 _ Ox00000000FF OxO00000000FF 8051 writes byte 3 of 0x00000100 0x00000001FF _ Our system reads byte 1 0x00000001FF Our system reads byte 2 0x00000001FF _ Our system reads byte 0x00000001FF Our system reads byte 4 0x00000001FF 8051 writes byte
47. Ltd FTDI www ftdichip com CIRCUIT CELLAR www circuitcellar com ZERO DRIFT OP AMPS FOR SIGNAL CONDITIONING INSTRUMENTATION amp PORTABLE SENSOR APPLICATIONS The MCP6V11 and the MCP6V31 zero drift op amps operate with a single supply voltage as low as 1 6 V and a quies cent current as low as 7 5 HA The op amps enable the development of portable medical products integrated with higher effi ciency and signal conditioning hardware and software Industrial applications such as portable sensor conditioning and instru mentation requiring low power small form factors and temperature considerations can benefit from the op amps optimized performance low quiescent current and low operating voltage The devices utilize Microchip s CMOS technology which requires less current to operate the amplifier while delivering longer battery life and minimal thermal related challenges The MCP6V11 31 family s self correcting architecture provides a maximum input offset voltage of 8 uV for ultra low off set and low offset drift enabling maximum accuracy across time and temperature The MCP6V11 offers 80 kHz of gain bandwidth product with a low typical quiescent current of only 7 5 uA The MCP6V31 provides 300 kHz of gain bandwidth product combined with a low typical quiescent current of 23 pA The MCP6V11 and MCP6V31 op amps are both available in small five pin SOT 23 and five pin SC 70 packages Pricing for the MCP6V11 starts at 0 8
48. M contains all editorial articles published in Volume 2011 of the Eng lish American Spanish Dutch French and German editions of Elektor Using the supplied Adobe Reader program articles are presented in the same layout as originally found in the magazine An extensive search machine is available to locate keywords in any article With this DVD you can also produce hard copy of PCB layouts at printer resolution adapt PCB layouts using your favourite graphics program zoom in out on selected PCB areas and export circuit diagrams and illustrations to other programs ISBN 978 90 5381 276 1 37 90 Embedded Linux Made Easy Today Linux can be found running on all sorts of devices even coffee machines Many electronics enthusiasts will be keen to use Linux as the basis of anew microcontroller project but the appa rent complexity of the operating system and the high price of development boards has been a hurdle Here Elektor solves both these problems with a beginners course accompanied by a compact and inexpensive populated and tested circuit board This board includes everything ne cessary for a modern embedded project a USB interface an SD card connection and various other expansion options It is also easy to hook the board up to an Ethernet network Populated and tested Elektor Linux Board Art 120026 91 93 30 Elektor is more than just your favorite electronics magazine It s your one stop shop fo
49. MX973 is an integrated quadrature IF RF demodulator and quadrature modulator This addition to CML s RF building block range is well suited for wireless data terminals HF VHF and UHF mobile radio avionics radio systems telemetry modems high performance professional radios satellite terminals and software designed radio SDR The CMX973 combines a flexible IF RF quadrature modulator and quadrature demodulator into a single chip that forms the basis of a high performance RF transceiver system A wide signal bandwidth at RF 0 dBm output low noise and serial bus control help the demodulator modulator deliver maximum flexi bility and high performance at a low operating power The demodulator modulator is designed for super heterodyne architectures with 20 to 300 MHz IF fre quencies It can be used in low IF systems or those converting down to baseband The demodulator modulator converts directly from baseband to the desired 20 MHz to 1 GHz transmit frequency and features quadrature phase correction to minimize unwanted spectral components The CMX973 demodulator modulator s additional features include low power operation 3 to 3 6 V less than 1 I Q phase matching less than 0 5 dB I Q gain matching and 0 dBm modulator output level The CMX973 s quadrature architecture supports a range of modulation formats and standards The differential inputs are ideal for direct connection to standard modems and interface ICs such as CML
50. Microelectronics and other manufacturers Your best strat egy is to go to the manufacturers web sites and make a list of those that provide samples in single units or low volume CIRCUIT CELLAR www circuitcellarcom Listing 1 C source code for the tilt compensated eCompass common ferromagnetic materi als are iron steel ferrite nick multiplicative conversion constants define DegloRad 0 01 7453292F define RadloDeg 5 7 295 9F global variables float Psi The Phi float Vx Vy Vz yaw pitch roll angles in deg hard iron calibration coefficients NED tilt compensated e Compass function void eCompass float Bx float By float Bz float Gx float Gy float Gz float sinAngle cosAngle sine and cosine float fBfx fBfy fBfz calibrated mag data in ul after tilt correction subtract off the hard iron interference computed using equation 9 Bx VX DY Vy Bz Vz calculate roll angle Phi Phi atan2 Gy Gz RadToDeg sinAngle sin Phi DegToRad cosAngle cos Phi DegToRad de rotate by roll angle Phi Bfy By cosAngle Bz sinAngle Bz By sinAngle Bz cosAngle Gz Gy sinAngle Gz cosAngle 180deg 180deg and sin cos Equation 2 fe SUPA y COSiPH1 Equation 5 y component Bz By Vy sin Phi Bz Vz cos Phi Gz Gy sin Phi Gz cos Phi calculate pitch an
51. OSFET over the range of currents and voltages relevant to my application by applying known inputs and measuring the outputs to produce a table of data points In this article I ll describe the MOSFET tester cir cuitry and show some of the results MOSFET TESTER OVERVIEW The MOSFET tester characterizes a transistor s behavior by computing the drain resistance at each combination of measured voltage and current Photo 2 which resembles the graphs found in MOSFET datasheets suggests how the tester must operate The data emerged from a BUZ71A n channel MOSFET from my parts heap The blue traces plot MOSFET drain current i against drain voltage v with each trace at a con stant gate voltage Vs Producing those traces required setting the gate voltage then either vary ing the drain voltage and recording the current or varying the drain current and recording the voltage Because I m interested in the MOSFET s linear region of operation where the device presents a low drain resistance that would draw a large current from the power supply for small drain voltages I applied a limited drain current and measured the resulting Photo 1 The MOSFET tester PCB completely hides the Arduino that runs the control program and communicates through the USB cable on the left edge The large finned aluminum heatsink in the foreground dissipates heat from Q1 the drain current source during high current parts of the test The MOSFET under test
52. Pino and Nino But they were too simple Just making something a little bit more sophisticated required too much electronics at that time After a big gap in my electronics activity I discovered a newly published robotic magazine with an electronic parts supple ment This enabled me to build a programmable robot based on a Microchip PIC16F84 A new adventure started I felt much younger Suddenly all the electronics specialized neurons inside my brain after being asleep for many years woke up and start ed running again Thanks to the Internet not yet available when I left professional electronics design I discovered a lot of new things MCUs free IDEs running even on a simple comput er free compilers very cheap programming devices and lots of documentation freely available I threw away the last Texas Instruments databook I still had on my bookshelf and started studying again There were a lot of new things to know but with a good background it was a pleasant if frantic study I ve also bought some books but they became old before I finished reading them Within a few months jumping among all the hardware and software versions Microchip released at an astonishing rate I found Johann Borenstein et al s book Where Am I Systems and Methods for Mobile Robot Positioning University of Michi gan 1996 This report and Borenstein s website taught me a lot about autonomous navigation techniques David P Ander son s My Ro
53. UIDO I already had a sound board based on classic op amp ICs I discov ered the PSoC devices in a robotic meeting At that moment there was a special offer for the PSoC1 programmer and incidentally it was close to my birthday What a perfect gift from my relatives This was another excuse to study a completely different programmable device and add something new to my background The learning curve was not as easy as the Arduino one It is really different because it does a very differ ent job The new PSoC based audio board was smaller simpler and with many more features than the previous one The original project was designed to detect a fixed 4 kHz tone but now it is easy to change the central frequency the band and the behavior of the board This confirms once more if needed that nowadays this kind of professional design is also available to hobbyists www circuitcellarcom CIRCUIT CELLAR SEA LEVEL Computing HM Serial RISC computing power A wealth of I O features The R9 family is an application ready platform for your next oroduct design R9 products deliver RISC computing power using the latest Windows Embedded CE 6 0 software environment and Unmatched O features that extend capabilities beyond traditional RISC applications Choose from single board computers rugged embedded systems and panel mount flat panel touchscreen computers All R9 solutions offer small size wide ope
54. X Era EP4CGX50CF23C8N S ih dt He EP4CGX75CF23C8N EP4CGX110CF23C8N EP4CGX150CF23C7N Credit card size 86 x 54 mm RoHS compliant Cyclone IV GX F484 FPGA board ACM 108 series EP4CGX50CF23C8N EP4CGX110CF23C8N EP4CGX150CF23C8N Compact size 43 x 54 mm RoHS compliant XILINX FPGA Board Virtex 5 LXT FFG665 FPGA board XCM 017 series XC5VLX30T 1FFG665C XC5VLX50T 1FFG665C Credit card size 86 x 54 mm RoHS compliant Virtex 5 SDRAM CHETA J srao Spartan 6 LXT FPGA board XCM 1 11 series RocketlO XC6SLX45T 2FGG484C SERE XC6SLX75T 2FGG484C XC6SLX100T 2FGG484C XC6SLX150T 2FGG484C Compact size 43 x 54 mm RoHS compliant PLCC68 series XP68 23 opara 6 PLCC68 FPGA Module XC6SLX45 2CSG324C 16Mbit Configuration Device Two User LEDs One User Switch S lide RoHS compliant acer _ ee III PLCC68 FPGA Module EP3C25U256C8N 16Mbit Configuration Device Two User LEDs One User Switch S lide RoHS compliant Gos 6 gt E mail PLO e CO j p Fax 81 72 620 2003 August 2012 Issue 265 0 Ul BOARDS BOOKS DVDs AND MORE AT WWW ELEKTOR COM SHO Elektor Shop The world of electronics at your fingertips Free Software CD ROM included Elementary Course BASCOM AVR The Atmel AVR family of microcontrollers are extremely versatile and widely used Elektor amp magazine already produced a wealth of special applications and circuit boards based on ATmega and ATtiny controllers
55. a light source such as the sun Pho tons with energy greater than the band gap of the semiconductor create electron hole pairs in the intrinsic region of the diode Instead of recombining immedi ing improvements to both weight and increased energy density Source Wikipedia org ately the electrons and holes are CIRCUIT CELLAR www circuitcellar com Figure 2 Optimum sunlight does not always fall on a solar cell This chart shows the I versus V output for various amounts of light falling on a solar cell due to physical orientation or atmospheric conditions Source Wikipedia org Swept to opposite sides of the intrinsic region by its inherent electric field This extra charge can be drawn off by an exter nal circuit creating a current flow A PV cell s diode junction has two properties associated with it It has an open circuit voltage which is the maximum potential it can produce when no current is flowing approximately 0 5 V Once current is flowing across the junction this potential is reduced As expected the more current flowing across the junction the lower the potential becomes The cell can produce the most current when the potential is 0 V short circuit This can be better visualized by graphing I versus V see Figure 2 This graph shows a number of curves for varying levels of sunlight The more intense the light the higher the current and voltages become Note the maximum voltage potentials a
56. a awa 7 We know the roll and pitch 8 angles from the accelerometer so all that remains to compute the compass heading angle w from Equation 7 is to find a simple way to calculate the com ponents of the interfering hard iron magnetic field V But if you subtract V from both sides of Equation 4 and then calcu late the resulting magnitude squared you obtain Equation 8 The left hand side is expanded using Pythagoras s theorem and the right hand side is simplified by observing that the geomagnetic field magnitude remains B irrespective of the rotations applied P cos B Vy IRx 0 Ry 8 R y B i B V sind 8 By Va By V B V B Equation 8 simply states that under arbitrary rotations in roll CIRCUIT CELLAR www circuitcellar com pitch and yaw the magnetometer readings lie on the surface of a sphere with radius B centered at the hard ron interference Vz Vy and V Figure 4 shows actual magnetometer measure ments taken at random orientations together with a sphere fit ted to the measurements with radius 57 1 uT and centered at V 216 4 uT V 183 6 uT and V 44 0 uT To obtain your own hard iron calibration simply record and plot the magne tometer readings under random orientations and estimate your own hard iron correction V V V from the center of the result ing sphere A simple but effective technique is to rotate the eCompass in a figure of eight t
57. a delay of two clock cycles CIRCUIT CELLAR www circuitcellarcom from Figure 1a and three PMOS transistors Q2 Q3 and Q4 Together they constitute the pull up resistor Q2 is a large transistor capable of handling a lot of current Q3 is a small transistor Q4 is a medium size transistor When the microcontroller is to output 0 V it sets Q in Figure 1 to log ical zero and the voltage associated with Q is Vp This causes Q1 to conduct and all the other transistors to be cut off The output voltage will be 0 V When Q goes from a logical zero to a logical one the voltage associated with Q goes from V to 0 V A close look at Figure 2 shows that Q1 will clearly be cutoff and Q3 will conduct Additional ly for two clock cycles the very large transistor Q2 will conduct as well Once the output voltage rises suffi ciently Q4 conducts too Q2 sources a large amount of current for a short time This current is used to charge small capac itive loads quickly Q2 makes it possible for the 0 V to V transition to happen quickly You now under stand how the I O pin can be used as an output How can it be used as an input I O pins have to be able to accept inputs of 0 V or V p When used for input Q is set to a logical one and Q1 is cut off As the PMOS transistors make the voltage on the pin V p you do not input V to the pin you let the pin float and V is input automatically To input a zero
58. age both of which use Atmel s ATmegai168 328 Timer2 hardware Chang ing the PWM frequency requires selecting a different clock source for Timer2 by chang ing the contents of a single register TCCR2B 0x01 That value produces a 32 kHz PWM frequency from the standard 16 MHz clock crystal That s 64 times the default 488 Hz high enough that the 16 Hz RC filters in Figure 1 can easily convert PWM to DC A single pole filter attenuates the Signal amplitude by 6 dB octave above the filter s 3 dB frequency which works August 2012 Issue 265 Ul 3 August 2012 Issue 265 out to 66 dB over the 11 octaves separat ing 15 Hz and 32 kHz The PWM output s 5 V peak to peak signal will be about 2 5 mV after filtering Homework Compute the ripple for the default 488 Hz Arduino PWM frequency for that filter I routed the filtered DC signals through Maxim Integrated Products MAX4544 SPDT analog switches with their other input grounded to inhibit unintended outputs When the Arduino emerges from a hardware reset all the output pins enter their high impedance state The pull up resistors on the multiplexer con trol inputs then select the grounded input which ensures the MOSFET s gate voltage and drain current remain turned off until the firmware starts running and properly initializes the hardware The 10 ms analog filter time con stant implies that each output volt age change requires about 50 ms five tim
59. ain I wanted to find a standalone part I could hand solder and use to charge all battery chemistries I came close with a few parts but they couldn t be hand sol dered handled only one battery type or required a microcontroller for control So I limited my search to only NiCd and NiMH as that was my initial goal A Texas Instruments BQ2002 controller seemed to fit the requirement BQ2002 The BQ2002 is a charge management controller that adjusts an external device used to supply charging current When designed to supply maximum current the BQ2002 modulates the external FET using PWM which regulates the charging current applied to batteries While a sup ply of energy exists the SPV1040 is col lecting energy the BQ2002 adjusts its duty cycle to one of three rates fast charge top off or minimum charge The TM input enables the designer to select one of three preconfigured charging schemes designated to tailor the maxi mum fast charging time and subsequent duty cycle ratios for top off and trickle charging periods A charging cycle begins upon applica tion of V greater than 4 V or if already operational the voltage at BAT is less than 2 V This begins with a fast charge until one of the following termination con ditions peak voltage detection negative delta voltage maximum voltage maxi mum temperature or maximum time Peak voltage detection and negative delta voltage detection have to do with a spe cia
60. al zi Internal MTP memory i Expandable clocking clock generation Y and system clock out EXceptional Drivers Windows MacOS Android and Linux ret CTD ieem ponensiAcsembiy Lofe ized the Online Quoting Process RE Byolti Targkey atoting Revolutiof Happening Now
61. alf of Figure 1 limit the drain current into the MOSFET under test IC1B converts the differential voltage across R10 the 1 Q drain current sense resistor into a ground referenced voltage The differen tial amplifier has a gain of 2 producing an overall gain of 2 V A a 2 A current produces 4 V A fault condition or perhaps a firmware error could produce more than Although the Arduino has six analog outputs those pins don t produce true ana log voltages a peculiarity that often trips up new users Instead each one pro duces a digital PWM signal that requires a low pass fil ter to extract its DC value the 2 5 A that would apply 5 V to the ADC input Dual diode D2 clamps the ADC input voltage between ground and 5 V to protect the Arduino input The three solder jumpers below IC1C select its feedback connection SJ1 turns IC1C into a voltage follower SJ2 tracks the drain voltage and SJ3 tracks the drain current The firmware for this col umn assumes current feedback through SJ3 and obviously you should bridge only one jumper at any time IC1C drives the gate voltage on Q1 to make the feedback voltage match the DC voltage filtered from the Arduino s PWM3 output Because IC1B has a gain of 2 V A the overall gain more correctly the tran Simpedance from the microcontroller analog output is 0 5 A V Although I included a voltage divider to adjust the voltage applied to IC1C the circuit compo
62. als and current sense resistor in the lower right corner have one plane the Peltier module driver in the upper right has another and the analog circuitry between the Arduino header pins lives on a third A fourth plane connected directly to the Arduino ground pins surrounds the analog plane The upper trace in Photo 3 shows that noise on the drain cur rent sense voltage at the Arduino analog input pin amounts to about 20 mV or 4 counts the lower trace is a scope sync out put from a test firmware routine The scope probe ground clips were attached to the analog plane that connects to the Arduino Crain Current ID A r G E Mg iS Hi 3 7 a ia a 0 50 1 00 1 30 Drain Source Voltage YDS W Photo 4 A 1 2 1 resistor between the tester s drain and source terminals produces the expected result The firmware forces the calculated resistance to 0 0 Q when I s 0 to avoid overflow Ul 0 Listing 1 Averaging three analog samples to produce a single result reduces uncorrelated input noise define NUM_T_SAMPLES 3 float ReadAI byte PinNum word RawAverage RawAverage analogRead PinNum for int i 2 i lt NUM_T_SAMPLES i RawAverage word analogRead PinNum RawAverage NUM_T_SAMPLES return float RawAverage ground pin nearest the analog reference pin Unfortunately the Arduino PCB layout simply joins that pin to the same digital ground with all the
63. ange with Power Levels Ranging up to 500 mW Part 1 Technical Characteris tics and Test Methods 2012 www etsi org deliver etsi_en 300200_300299 30022001 02 04 01_40 en_30022001v0204010 pdf EN 300 220 2 Candidate Harmonized European Standard Telecom munications Series www etsi org deliver etsi_en 300200_300299 30022002 02 01 02_60 en_30022002v020102p pdf Le Leivre com Mixer Spur Search http leleivre com rf_mixerspur html R Lacoste CE Marking A Process to Ensure Product Conformity Circuit Cellar 257 2011 Noise Figures 101 Circuit Cellar 249 2011 Radio Frequency Mixers Circuit Cellar 263 2012 SOURCES AppCad simulator for Windows Agilent Technologies Inc www agilent com Visual System Simulator VSS and Microwave Office RF microwave design software AWR Corp http web awrcorp com ADE 1LH frequency mixer GALI 84 MMIC amplifier and SXBP 169 band pass filter Mini Circuits www minicircuits com www circuitcellar com CIRCUIT CELLAR UMANDATA FPGA CPLD Boards from JAPAN Basic and simple features single power supply operation Same board size and connector layout ACM XCM All stocked items are ready to be shipped immediately Over 100 varieties of FPGA CPLD boards are available Free download technical documents before purchasing ALTERA FPGA Board CycloneIV GX F484 FPGA board ACM 024 series Cyclone IV G
64. ardware Go to Circuit Cellar s webshop to find these articles and more www cc webshop com CIRCUIT CELLAR www circuitcellar com Ultra Low Power Consumption Highly Functionally Integrated Flash MCU Solutions The Holtek Flash MCU range of devices encompass an extensive range of peripheral functions making them suitable for use in a diverse application area such as health care products instrumentation products household appliances industrial control consumer products automotive peripheral products to name but a few With one range types also including Holtek s unique TinyPower technology the ability is provided to meet the demands of today s environmentally conscious products HT68Fxx Internal Multi function Timer Modules Internal oscillators with four frequency selections Multi function O pins with re mapping function 4 LCD SCOM outputs for direct driving of LCD panels Multiple Communication Interfaces HT66Fxx Includes all the HT68Fxx functions with an additional 12 bit ADC and internal reference voltage source HT67Fxx Includes all the HT66Fxx functions but also uses Holtek s TinyPower ultra low power technology and also includes an internal R type C type LCD driver Also includes dual SPI or IC interfaces which can be used simultaneously as well as internal Data EEPROM a E ee q d _ STD Flash MCU H166 67 68Fxx Series x es Wide Operating Voltage Range 2 2V 5 5V Multiple Low pow
65. at comprise the pull up resistor icrocontrollers in general and Intel s 8051 micro controller and its descendants in particular have input output I O pins 8051 based microcontrollers have two types of I O pins pins with and pins without internal pull up resistors The pins are controlled by specific bits in the microcontroller s special function registers SFRs The internal structure of the pins with internal pull up resistors is interesting In this article I ll explain how a simple experi ment enables us to see that structure quite clearly Figure 1 depicts simplified descriptions of I O pins with and without pull up resistors respectively Pins with internal pull up resistors can be used to output 0 V or V To output b 0 V close the internal switch To output Vp open the switch and make cer tain not to load the output To use a pin with an inter nal pull up resistor as a digital input its internal switch must be opened To input V p do not apply any voltage to the pin let the pull up resistor take care of that To input O V force the voltage on the pin to 0 V The microcontroller has circuitry that enables it to examine the voltage at a pin s output A specific bit Output fof Figure 1a This is a simplified model of an I O pin with a pull up resistor b This is a simplified model of an I O pin without a pull up resistor In both cases when a one is written to the bit associate
66. ation Program in circuit or use adapters for unmounted chips Zero Insertion Force Adapters available for DIP SOIC SSOP TQFP and more PIC is a registered trademark of Microchip Technology Inc in the USA and other countries CROSSWORD ANSWERS from Issue 264 Across 3 4 IONIZATION Occurs when an atom or molecule gains either and positive or negative charge ANDROIDPHONE Matt Oppenheim s article Audio Enhanced Touch Sensors Circuit Cellar May 2012 said one of the stumbling blocks of using this for data collection is that it will try to recharge itself whenever you connect it to a USB port two words FOLTZER Circuit Cellar interviewee who participated in Motorola s IEEE 802 MAC subcommittee on token passing access control methods two words COORDINATEDUNIVERSALTIME A method of keeping the world in sync three words CICCHINELLI Circuit Cellar published his book about a commonly used computer programming language in 2010 HACKSPACE A synonym for circuit cellar CHIP Si plate VOLTAGEREFERENCE National Semiconductor s LM385 series is an example of an adjustable one three words www circuitcellar com CIRCUIT CELLAR Down DOPPLEREFFECT A phenomenon that occurs when a vehicle sounding a siren approaches passes and recedes from an observer two words WAVEFORMGENERATOR A device that produces electronic signals two words ANGSTROM Equals 1 10 000 000
67. bilities leaves 253 other addresses which is more than enough for a home design Taking a page from the class addresses originally used by the Internet I decided to reserve blocks of addresses for various types of devices Table 1 shows how these were assigned Next came the actual message pay load The messages being sent to assort ed devices on the network will vary depending on the device Each message begins with a command consisting of a single uppercase ASCII letter If values are needed in its payload they are encoded in ways that will prevent them from conflicting with the start and end marker bytes Before defining commu nication to specialized devices there is a collection of messages to define that can be used by all devices see Table 2 For example if I wanted to tell a unit that it needs to set the time to 9 55 45 A M on a device I would send the com mand T095545 More specialized commands will be explained in detail in the section describing those devices AN4 RCO AN5 RC1 AN6 RC2 AN7 RC3 TX RC4 RAS amp T1CkI RX RC amp VSS Other types of data include simple inte gers and Booleans true false flags Small value integers are values less than 200 I chose this threshold because I can just add a value of 0x20 to the integers without worrying about converting an ASCII string back to a numeric value What s more they still won t overlap with the start and stop bytes Wherever a Boolean value
68. bots webpage www geology smu edu dpa www myrobots html inspired all my robots completed or forthcoming I ve never wanted to make a remote controlled car so my robots must navigate autonomously in an unknown environ ment reacting to the external stimuli NAN On your website you include information and pic tures from several robotics events and competitions Do you enter competitions or are you involved in organizing the events GUIDO I ve participated in some of the competitions but that is not my main goal The first challenge is always with me I set my target and do my work until it is achieved The first target was the SR04 robot from Anderson It included most of the con cepts you must know to make an autonomous robot I first tried to build a robot for the Explorer category com petitions You can see some slide shows on my website This was very popular among the events organized by technical August 2012 Issue 265 N Ul August 2012 Issue 265 Massiomo Banzi left and Guido Ottaviani at the Romecup 2011 schools both in the junior no programming and the senior version programmable robots But that didn t fit my target it requires more speed than precision I tried together with some friends to involve more people in organizing an indoor precision competition We also defined the name the logo and the rules It was RTC which stood for Robo Tolomeo Cup with the name of the big gre
69. by block diagrams and pseudo code are reviewed Preliminary reliability analysis FMECA FTA weight electrical load and other analyses are critiqued by peers to ensure the design goals will be met There are established entry criteria to define what is presented and what exit criteria needs to be approved When approved detail design can start It is important to maintain minutes and assign responsibility for action items during design reviews and meetings Before the meeting is adjourned all are signed by the participating parties Minutes and action items issued at later dates are always subject to differing interpretations and arguments The culmination of the detail design phase is critical design review CDR At this point the design is essentially finished Reliability and maintainability analyses have been done the software has been documented and module tested the hardware has passed rudimentary environmental and EMC testing the bill of material BoM has been issued to pur chasing component obsolescence has been addressed orders have been placed packaging and PCBs have been ordered prototypes have been built and laboratory integra tion becomes the major activity to ensure everything works as required Upon completing integration the design freeze follows while prototypes are shipped to the customer for the system inte gration It should come as no surprise that many times the frozen design doesn t work as intend
70. calculation is simple but you can also find free tools that will do this calculation for you and calculate other key characteristics amplitude But let s continue Following the mixer we will need a band pass filter to isolate the desired 169 4 MHz from the other spurious fre quencies generated by the mixer We could design this filter with capacitors and inductors but as I still had my Mini Circuits catalog in hand I found the SXBP 169 bandpass filter It has a passband of 164 MHz to 174 MHz witha 2 dB loss at 169 MHz and rejection bet ter than 40 dB below 122 MHz or higher than 240 MHz Lastly we need to amplify the signal to the required output power As an exam ple I used a Mini Circuits GALI 84 MMIC amplifier This chip provides a 25 6 dB typical gain at 169 MHz Its maximum output power is specified by its so called P1dB of 21 9 dBm P1dB is the 1 dB com pression point meaning the output power at which its gain is 1 dB lower than the small signal gain as a result of compres sion As this figure is significantly higher than the required 15 dBm output power we can assume it will be enough Here we are We have a preliminary design Figure 3 shows the overall archi tecture of the RF subcircuit we have drafted CHAIN CALCULATION Now we need to check if the performanc es of this chain match the requirements Photo 2 Online tools like a mixer spur chart calculator www leleivre com help you quick
71. ch In addition the IC provides control over system operation and debugging by reporting headset information over an I C interface The TS3A225E is offered in 16 pin QFN and WCSP pack ages and costs 0 32 in 1 000 unit quantities Texas Instruments Inc www ti com MODULE FOR RUGGED APPLICATIONS The Ampro by ADLINK Express IBR is a COM Express Type 6 module that supports the quad core and dual core third generation Intel Core i7 processors and Mobile Intel QM77 Express chipset The modular power efficient solution is designed for applications running in space constrained extremely rugged environments The Express IBR is powered by a quad or dual core third generation Intel Core processor and provides support for USB Super Speed 3 0 PCI Express PCIe Gen 3 and up to three inde pendent dis plays The Express IBR with dual core processor is validated for reliable performance in extended tempera tures ranging from 40 to 85 C and features a 50 thick er PCB for high vibration tolerance Contact ADLINK for pricing ADLINK Technology Inc www adlink com CONNECTIVITY SOLUTIONS FOR RASPBERRY Pi MINI COMPUTER The TTL 232R RPi is a USB to TTL serial UART debug cabling solution that incorporates FTDI s FT232RQ high performance interface IC It is complemented by the RPi USB Hub Module which is designed to connect to a Raspberry Pi RPi unit and expand the number of interfaces that can be accessed downstream
72. chip with a 4 byte read of a shared memory region over SPI An 8051 core inside the energy chip writes to this 4 byte region Since both our 4 byte read and the 8051 s 4 byte write were interruptible nonatomic at times we could get incoher ent data An example is shown in Table 1 The end result is that in a sequence of reads we would 8051 Maxim Operation 8051 writes byte 1 of 0x000000FF Our SPI Read obtain energy readings of 255 51l 256 The error is greater if the collision occurs on the rollover of the second third or fourth byte Of course those occur far less frequently than my example This doesn t happen often but with more than 2 5 million seconds in a month and more than 100 000 meters in the field it only has to happen once in 250 billion reads to happen once a month CASE STUDY 2 INCREMENTING A COUNTER Many years ago we ported some code from a customer s energy monitoring system to a new platform we were develop ing The system consisted of a single loop with one timer inter rupt routine Thus there were two concurrent threads The most critical piece of information was the total energy read from each of four separate channels In the timer thread four KYZ pulses indicative of energy were polled and incremented in a 32 bit word each time a low to high transition was made The software was written in C The processor was an 8051 derivative The timer thread would have code like what is shown in
73. ck who stat ed You re probably within seven or eight feet of spider no matter where you are The only place on earth that has no spiders at all as far as we know is Antarctica It didn t take long for me to start thinking about embedded systems and my proximity to them Is the average person always within several feet of embedded systems Probably not But what about 50 or 60 of the time E mail me your thoughts Embedded systems are becoming ubiquitous They re in vehicles mobile electronics toys industrial applications home appliances and more If you re indoors the tempera ture is likely monitored and controlled by an embedded system When you re engaged in outdoor activities e g hiking golfing biking or boating you probably have a few MCU controlled devices nearby such as cell phones rangefinders pedometers and navigation systems This month we present articles about how embedded systems work and our authors also provide valuable insight about topics ranging from concurrency to project development Mark Pedley kicks off the issue with a revealing article about a tilt compensating electronic compass p 16 Now you can add an e compass to your next MCU based project Turn to page 24 for an in depth interview with Italy based engineer Guido Ottaviani His fascination with electronics engineering and robotics in particular will inspire you Have you ever come across a product that you know you could have
74. com CIRCUIT CELLAR gt 7 August 2012 Issue 265 Serial Commands Touch Events Your Microcontroller Our Display Module Add a Touch Screen to Your Embedded Product Development Kits include serial LCD controller board display touch screen cables 2 2 fan Q I sample images code power supply technical support a 100 Satisfaction Guarantee C DEVIGE et Package Converiers Eog i SUCKU ustom solunons Ironwood 1 800 404 0204 ELECTRONICS www ironwoodelectronics com Electronic and Electro mechanical Devices Parts and Supplies Wall Transformers Alarms Fuses Relays Opto Electronics Knobs Video Accessories Sirens Solder Accessories Motors Heat Sinks Terminal Strips L E D S Displays Fans Solar Cells Buzzers Batteries Magnets Cameras Panel Meters Switches Speakers Peltier Devices and much more www allelectronics com Free 96 page catalog 1 800 826 5432 NI 0 e Low cost 2 5 x4 LISTEN TO YOUR MACHINES Ethernet PLCs for OEMs FMD88 10 and FMD1616 10 Integrated Features ETHERNET Modbus TCP IP 16 or 32 digital I Os 10 analog Os RS232 and RS485 LCD Display Port O Expansion Port Ladder BASIC Programming 229 and 295 before OEM Qty Discount tel 1877 TRI PLCS web www tri plc com cci htm TRIANGLE TR RESEARCH INTERNATIONAL PDQ Board A Fast I O
75. components of the hard iron offset have values of approximately 215 uT and 185 uT A simple method to determine all three hard iron components is described later CALCULATION OF THE ROLL amp PITCH ANGLES In the absence of linear acceleration the accelerometer reading g after arbitrary rotation in yaw w then pitch 8 and finally roll 0 from the smartphone starting position flat upright and pointing to magnetic north is simply the earth s gravitational field vector 1 g downward in the positive z direction after application of roll yaw and pitch rotation N Figure 3 The upright a and inverted b magnetometer measurements matrices R R 8 and R 4 The resulting accelerom eter reading is Gx 0 G Rx o Ry 8 R y o 1 G 10 0 cos 0 sin f coso A 1 0 1 0 sind cosd sin0 0 cos cosy siny 0 0 sin siny cosy 0 0 cos sino 0 0 1 l cos coso It s worth emphasizing the point that the mathematics of the tilt compensated eCompass assume that the accelerom eter reading is entirely the rotated gravitational field without any linear acceleration This is a perfectly reasonable assumption for the smartphone market where users will nat urally hold the phone steady to see the compass display but readers should be aware that they will get erroneous com pass headings from an eCompass located in a radio con trolled airplane pulling high g aerobatics or even when
76. cribes how compliance will be achieved With out careful review and response to compliance matrix documents you may be unwittingly preparing grounds for future disputes and costly resolutions This is not because the customer has some malicious intent Many documents are pre pared from templates or by cut and paste Con sequently some requirements may not apply or Detail design Preliminary concept propoasal bid concept design design Ba design A Prototype A Labimegraton integration Industrial Initial ization production System integration T Formal testing Production Figure 1 Project flow diagram from bidding to production A 0 CIRCUIT CELLAR www circuitcellar com Requirement Heading Note DC Power Two primary supplies needed for 1 s power outage Partial or total power failure Compliance by test Ripple amplitude and voltage transients generated by the equipment Compliance by test Ground separation within the equipment Distinct grounds except shielding case ground have a single connection point internal to the equipment Electrical connections COTS D type connectors will be used Electronic equipment Table 1 An excerpt from a compliance statement may even conflict with others By clearly stating your non compliance you are forcing the issue to be addressed and resolved without delay at the component level Once the proj ect begi
77. ction wires add 6 mQ The 5 mV ADC resolution become obvious at this graph scale CIRCUIT CELLAR www circuitcellarcom IRFG30 Drain Current ID Drain Resistance ADS mohm E OO d E 0 00 0 20 0 40 060 080 1 00 120 1 40 1 60 Drain Source Voltage VDS W 2 ee ee ee ee he as i a o WOS gt 5 0 V Drain Current 1D Drain Resistance ROS mohm 0 40 Drain Source Voltage VOS W 0 10 0 20 0 30 Photo 6a This IRF630 MOSFET has a drain resistance well below the datasheet s specification of 400 mQ maximum at V 10 V The gate voltage steps by 250 mV for each trace b The IRF630 drain resistance remains nearly constant for currents above 100 mA with V above 6 V Between 5 V and 6 V the resistance increases slightly with drain current look at the linear region near the origin where r stabilizes near 220 mQ for V 10 V The IRF630 datasheet specifies the drain resistance at 4 5 A but it seems reasonable to assume that this particular transistor falls at the lower end of the man ufacturing tolerance The IRFZ44 MOSFET in Photo 7a has a logic level gate threshold so the drain current reaches 1 5 A for V 2 75 V Photo 7b is a zoomed in view showing that the drain resistance hits 50 MQ with V 10 V The specifications call for 28 mQ at 31 A but the connecting wires once again add several millionms the 20 mQ difference probably has more to do with
78. d cen tral processors for his robot Also Massimo Banzi participating in these events evangeliz ing Arduino and creating the Officine Arduino is a very good promoter of robotics The parallel reality is the most virtual There are a lot of forums groups and mailing lists about these projects with many participants each with his own lab and many ideas to share The circuit cellar is a dream for every one of us but we have not yet reached the critical mass in any town to organize one NAN Robotics is a focal theme in many of the articles you have contributed to Circuit Cellar One of your arti cle series Robot Navigation and Control 224 225 2009 was about a navigation control subsystem you built for an autonomous differential steering explorer robot The first part focused on the robotic platform that drives motors and controls an H bridge You then described the software development phase of the proj ect Is the project still in use Have you made any updates to it GUIDO After I wrote that article series that project evolved until the beginning of this year There is a new switched power supply a new audio sensor the latest version of dsNav dsPIC33 based board became commercially available online some mechanical changing improvements on telemetry con sole a lot of modifications in the firmware and the UMBmark calibration performed successfully The goal is reached That robot was a lab to experimen
79. d up automatic test sets for the circuits I developed I was very satisfied when I was able to obtain a 10 Hz frequency hopping by a Takeda Riken fre quency synthesizer It was not easy with such a slow computer BASIC language and a bus with long latencies I had to buffer each string of commands in an array and use some special pre caching features of the HPIB interface I found in the manual Every circuit even if it was analog was interfaced with digi tal ports The boards were full of SN74xx or SN54xx ICs just to make some simple functions as switching multiplexing or similar Here again my lack of knowledge was filled with the long history experience on Bugbook series Well audio RF programming communications interfacing www circuitcellar com CIRCUIT CELLAR digital circuits What was I still missing to have a good back ground for the next coming hobby of robotics Ah Embedded programming But I ve already mentioned this experience After all these design jobs because my knowledge started spreading on many different projects it was natural to start working as a system engineer taking care of all the aspects of a complex system including project management NAN You have a long time interest in robotics and autonomous robot design When did you first become interested in robots and why GUIDO I ve loved the very simple robots in the toy store windows since I was young the same I have on my website
80. d with the I O pin the switch is opened In Figure 1a when the switch is open as long as no voltage is being applied to the output pin the voltage will be V When a zero is written to either pin its output voltage becomes 0 V and no voltage may be applied to the pin a Vbo R Output A is set in order to open the internal switch The same bit is cleared to close the switch A good designer faces a dilemma when designing a circuit similar to Figure 1a How big should the pull up resistor be On one hand it should be as small as possible so that when the output transitions from 0 V to Vp the pin can quickly supply the current necessary to charge any parasitic capacitors On the other hand when a zero is input by forcing the voltage at the output to 0 V any current that flows through the pull up resis tor is being wasted so the resistor should be as large as pos sible To address these and other issues the microcontroller s designers chose to implement the pull up resistor by using sev eral transistors The pull up resistor is not a resistor at all AN I O PIN S INTERNAL STRUCTURE Figure 2 shows part of the internal structure of an I O pin There is one NMOS transistor Q1 which acts as the switch Figure 2 The internal structure of an I O pin with a pull up resistor The pull up resistor is not actually a single resistor It is composed of the three PMOS transistors Here z indicates
81. devices attached just the termination resistors b This shows the lines with the bias resistors so the bus has a constant mark on it when it s not in use Photo 2 The barrier strip top that terminates the RS 485 lines in the wiring closet All the power lines black and red connect to the right end More difficult to see are the red shrink wrapped bias resistors to the left of the MOVs The bottom barrier strip is the 5 V power which comes from a surplus Power One module and B is greater than 200 mV The condition is a valid space or mark depending on the polarity Keep in mind that with any AC signal running down a pair of conductors the ends need to be properly terminated In this case about 100 2 is adequate Also both ends need to be termi nated because the bus doesn t real ly have a source and destination point like normal transmission lines Figure 1a is a simple representation of the RS 485 line So far so good However because all the nodes are essen tially disconnected from the bus when they are not talking the bus becomes a pair of floating wires unconnected to any signal This makes the bus one really big antenna and wild ly susceptible to noise The solution is to make sure there is a mark or Logic 1 asserted on the bus when no one is talk ing In other words keep the A line slightly more positive than the B line In order to accomplish this use Ohm s law Keeping a desired differential of 20
82. e Semiconductor Xtrinsic eCompass Software www freescale com ecompass Application Note AN4247 Layout Recommendations for PCBs Using a Magnetometer Sensor 2012 www freescale com files sensors doc app_note AN4247 pdf Application Note AN4246 Calibrating an eCom pass in the Presence of Hard and Soft Iron Interference 2012 http cache freescale com files sensors doc app_ note AN4246 pdf Application Note AN4248 Implementing a Tilt Compensated eCompass using Accelerometer and Mag netometer Sensors 2012 http cache freescale com files sensors doc app_note AN4248 pdf www circuitcellar com CIRCUIT CELLAR Kionix Inc www kionix com ST Microelectronics www st com SOURCES MMA8451Q Xtrinsic accelerometer and MAG3110 magnetometer Freescale Inc www freescale com NEED TO KNOW INFO Knowledge is power In the computer applications industry informed engineers and programmers don t just survive they thrive and excel For more need to know information about some of the topics covered in this article the Circuit Cellar editorial staff recommends the following content Mini Rover 7 Electronic Compassing for Mobile Robotics by Joseph Miller Circuit Cellar 165 2004 Electronic compassing is an excellent way to provide absolute heading information for a mobile robot Joseph details how it factors in his Mini Rover 7 robot design which he modeled after the NASA JPL Rocky
83. e band pass filter and the gain of the output amplifier at the frequency of each spur What are the possible new spurious signals generated by these components This is mandatory in order to end up with a calculation of the output spectrum of the circuit and to be able to compare it with the EN300220 specifications Unfortunately these cal culations are long and boring so you will probably end up with a headache even if a spreadsheet helps Imagine for exam ple that there are two mixers on the chain which is typical The number of potential spurious frequencies will be Squared That s why these calculations are usually done only for the couple of key spurious frequencies with the risk to be unlucky with the first prototype if some other spur happens to be critical Frequency mixers are strange devices that somehow translate a signal up or down in frequency thanks to the nonlinear effects of their internal diodes More precisely a mixer has two inputs one signal input and one so called local oscillator input and one output It generates the sum and difference of the frequencies F1 and F2 applied to its two inputs On the nastier side they also generate plenty of spurious signals in the form of n x F1 m x F2 www circuitcellar com CIRCUIT CELLAR PIC SERVO MOTION CONTROL MOTION CONTROLLERS FOR BRUSH BRUSHLESS ANDI STEPPER MOTORS d controller chips controller boards i a
84. e constants to settle within 0 5 The firmware imposes a delay after each analog output change to enable settling which turns out to be the single most time consuming part of the entire measurement cycle Pop Quiz Compute the settling time for an RC filter that would provide 66 dB attenuation at 488 Hz Because the maximum gate voltage required for most MOSFETs will exceed the Arduino s 5 V output IC1A amplifies the filtered DC voltage by a factor of 2 The classic LM324 op amp I used can drive its output within 1 5 V of the posi tive supply which works out to 10 5 V for the 12 V supplies I used You ll need a higher supply voltage more voltage gain and perhaps a better op amp to extend the V range beyond 10 V Arduino analog inputs have 10 bit res olution over their 0 to 5 V range which works out to 4 9 mV per LSB Because the drain voltages will be well below 1 V for typical power MOSFETs IC1D ampli fies the drain voltage by a factor of 3 Unfortunately that gain means drain voltages above 1 6 V apply more than the 5 V allowed at the Arduino s ADC input Although the firmware limits the voltage during the test the op amp will see the full MOSFET supply voltage when the MOSFET is completely turned off Dual Ul A diode D1 two Schottky diodes in a single SMD package protect the ADC input from that excessive voltage as well as any transients below 0 V CURRENT CONTROL The two op amps in the upper h
85. e power of any unwanted emission in the spurious domain shall not exceed the values given in the table below Table Spurious domain emission limits 47 MHz to 74 MHz Ta Operating 250 nW Standby 4 nW 54 dBm 47 MHz 74MHz 87 5 MHz 118 MHz 174MHz 230 MHz 87 5 MHz to 118 MHz 174 MHz to 230 MHz 470 MHz to 862 MHz Other frequencies below 1 000 MHz Frequencies above 1 000 MHz 1 uW 20 nW a 7 7 7 470 MHz 862 MHz 1 GHz Figure 2 This is an excerpt from the EN 300 220 European standard applicable to nonspecific RF transmitters below 1 GHz The table shows the maximum level of acceptable spurious signals depend ing on the frequency More precisely and to keep my example as simple as possible consider that someone else has already designed a great signal generation and modulation circuit He provides you the signal to be transmitted as a narrow band 45 MHz intermediate frequency modulated sig nal with a 1 mW power Your job is to design an up converter and amplifier Subcircuit taking this 45 MHz signal as an input moving it up to a 169 4 MHz carrier and amplifying it to at least a 15 dBm power as shown in Figure 1 By the way remember that a dBm is a power related to 1 mW and expressed in a deci bel logarithmic form so 15 dBm corre sponds to 31 6 mW i e 1 mW x 101549 A last word on the requirements Your Frequency MHz Conversion Loss dB product must be compliant with all the app
86. e shelf test equipment or pass a virtual sample of an actual signal e g a CDMA frame through the chain and check its impact on the modulation of bit error rate Let s stay with the basics and focus on our example circuit Photo 3 shows the design drafted under VSS Of course you will need some training to efficiently use such a tool but magical things happen when you click on the Simulate button see Photo 4 VSS does exactly what I ve explained above but automatically and in a couple of seconds Look at the results The frequency output is as planned at 169 4 MHz with a power of 17 42 dBm This is 1 dB lower than we had previously calculated This difference is due to the spurious frequencies as a part of the available power is spread through these spurious signals However VSS also provides all the simulated spurs with their respective levels Remember the EN30220 limits shown in Figure 2 The transmitter must not generate any spurs higher than 36 or 54 dBm depending on the frequency 0 A band Here unfortunately several spurs are higher than these levels The highest is at 338 8 MHz with a calculated power of up to 18 dBm VSS could show you where this frequency comes from with a mouse click but here it is obvious 338 8 is two times 169 4 MHz This is the second harmonic of the carrier frequency A tool like VSS is also useful to understand what s going on Refer to the bottom left plot in Photo 4 This Sp
87. e switch is opened the induc tor can release its magnetic energy as current which adds to the PV module s current and is directed through the diode and into the load Clearly to have any control over the current the switch must be repeatedly opened and closed The relationship of the induc tor s charge time switch on to its discharge time switch off is the controlling factor here This duty cycle determines the PV module s current and ultimately the voltage A box labelled MPPT is located at the bottom of Figure 3 This box has I and Vy as inputs and a PWM signal as an output The PWM signal controls the switch closures and its duty cycle is controlled by some magic algorithm MPP based on the I and V inputs There are a number of approaches to determining maximum power point tracking MPPT The algorithm most often used is the perturb and observe method Take a voltage and current measurement to calculate the power Next increase the PWM perturb and make another calculation observe If the power has increased increase the PWM If the power has decreased decrease the PWM The PWM is continually adjusted to obtain the perfect sweet spot or MPP see Figure 4 SPV1040 I used a couple of leaded parts from STMicroelectronics an SPV1020 boost converter and an SPV1040 solar battery charg er AS you might suspect from the package the SPV1020 is capable of higher power up to 40 V and 320 W while the smaller SPV1040
88. eable The only thing I ve described so far is this unit and my ability to send it instructions from my PC By reviewing the U 0 described protocol you can see that I plan to take advantage of this for other things The first thing it needs to be told is the correct time I could have built in a small user interface to set the time but instead I decided to add a central time server that will broadcast the time across the network so everyone can take advantage of it In a future article I will describe how I built a time server using data from a surplus GPS module POSSIBILITIES Although I designed this to replace an inferior timer that operates a light on an AC line the dry relay contact the unit contains could be used for anything that needs to be turned on and off throughout the day The nonvolatile memory that stores the on or off events provides me with a nice feature so I don t have to reprogram the on and off times when the unit comes up from a power outage Also the flexibility of the RS 485 network and the protocol I designed to enable devices to communicate opens the door for the construction of other units Something that comes to mind is a daylight sensor to tell the lights to activate when it gets dark regardless of the actual time Or maybe a Wiznet module that enables my PC to communicate on the network from any networked machine or even my iPhone Those are nice however I have already built other compo
89. eased or decreased as needed to continually try to maximize the power Source STMicroelectronics SPV1040 High Efficiency Solar Battery Charger with Embedded MPPT 18080 2011 below a voltage that cannot add any charge to the battery Wouldn t it be nice if you could take advantage of any avail able output Using a boost circuit i e step up regulators can solve two problems with one solution Boost circuits can control the voltage supplied to a load which means that as long as the load is well behaved i e resistive or only mildly nonlinear they can indirectly control the current as well You ve already seen that a PV cell s current output has a direct Ultra Small Panel PG ARM9 400Mhz Fanless Processor Upto 1 GB Flash amp 256 MB RAM 4 3 WQVGA 480 x 272 TFT LCD Analog Resistive Touchscreen 10 100 Base T Ethernet 3 RS232 amp 1 RS232 422 485 Port 1 USB 2 0 High Speed Host port 1 USB 2 0 High Speed OTG port J2 WTO ES AES Bel SOL CaS SP1 amp 12C 4 ADC Audio Beeper Battery Backed Real Time Clock E Operating Voltage 5V DC or 8 to 35V DC 3 Optional Power Over Ethernet POE r ie Optional Audio with Line in out TT Pricing starts at 375 for Qty 1 Windows cE 2 6 KERNEL The PPC E4 is an ultra compact Panel PC that comes ready to run with the Operating System installed on Flash Disk The dimensions of the PPC E4 are 4 8 by 3 0 about the same as that of popular to
90. ed Thus the seeming ly straightforward activity shown in Figure 1 in reality looks more like many fuzzy loops At some point however all bugs Preliminary design review PDR is the mile stone when the system architecture and parti tioning of functions between hardware and software shown by block diagrams and pseudo code are reviewed Preliminary reliability analysis FMECA FTA weight electrical load and other analyses are critiqued by peers to ensure the design goals will be met There are established entry criteria to define what is pre sented and what exit criteria to be approved When approved detail design can start August 2012 Issue 265 A 9 August 2012 Issue 265 Design Ni JDP Concept design en Formal testin design l 30 Prototype A C Integration i 901 501 Integration 701 Initial itial production 101 ing 1 n Oo 49 Q gt 12 49 5 D o 49 gt 5 O Project management activities Configuration management activities Figure 2 Development phases for aircraft equipment are ironed out and the test readiness review confirms the product is ready for formal testing and approval DEVELOPMENT ENGINEERING With the formal tests passed industrialization takes place and the product is handed off to manufacturing The first product made by the factory without engineering i
91. ee if we got a message and determine what to do based on the message rx_ message btfss machine_stat RX_MSG_BIT return movlw 20 Subwf msg_buffer W btfsc STATUS Z goto process_command movfw dev_addr subwf msg_buffer W btfsc STATUS Z goto process_command done banksel machine_stat bcf machine_stat RX_MSG_BIT return 9 A new message gt no bail Test it for universal address Test the message for 20 Test the message for our addr default is to reset the RX flag clear the RX flag At this point we have a message with the SOM Byte 1 is dst addr byte 2 is src addr byte 3 is cmd process_command moviw L Subwf msg_buffer 2 W btfsc STATUS Z goto fliplight movilw T Subwf msg_buffer btfsc STATUS Z goto settime movilw S Subwf msg_buffer btfsc STATUS Z goto sendstat movlw R Subwf msg_buffer btfsc STATUS Z goto readevent movlw E subwf msg_buffer btfsc STATUS Z goto saveevent movlw Z subwf msg_buffer btfsc STATUS Z goto sendresets movlw Y subwf msg_buffer btfsc STATUS Z goto clearResets goto done sees an SOH byte it resets the counters and begins collecting subsequent bytes into the receive buffer counting the arriv ing bytes as they appear If the count exceeds the size of the receive buffer it www circuitcellar com CIRCUIT CELLAR gt Test the message for x L the message for our addre
92. ek cartographer to prove that this challenge could be a simpler precursor for the better known more complicated outdoor Robo Magellan from Seat tle Robotics But this was not so spectacular and we were not able to involve enough people I won my personal competition when I was able to complete a full UMBmark the video is on my website with a centimeter precision Then that project was over and I had a new target the Anderson s jBot always him Right now I m designing the foundation of an outdoor robot Lino But I usually participate at least as an observer in every competition in Italy I am able to It is always stimulating and I always learn a lot over there Furthermore I ve had the oppor tunity to meet again the many people I ve known in the past years often thanks to the popularity Circuit Cellar gave to me We are a bunch of robotics fans spread all over Italy and in touch every day via the Net Those are the only moments we can meet personally Each meeting after a lot of robotics always ends up in a celebration around some food This is one of the other disciplines typically involved in robot ics friendship NAN Speaking of robotics events in Italy can you tell us about the electronics scene in Italy For instance in the U S hackspaces and circuit cellars are cropping up everywhere from New York to small towns in the southern states to Silicon Valley These small groups comprise enthu
93. elligent automation system at pto lsolation available for FS 232 R5 485 and CAN low cost with a minimal number of components DIN mount option 3A Technologic Systems We use our stuff Visit our TS 7800 powe ed website at www embeddedARM com 1 August 2012 Issue 265 TRANSDUCERS FOR RMS VOLTAGE amp CURRENT MEASUREMENT The MVTR and MCTR are single phase RoHS compliant transducers designed to measure voltage and current in applica tions that need a true RMS calculation of the transducer input The MVTR units measure true RMS voltage The MCTR mod els measure true RMS current All MVTR and MCTR models produce a fully isolated 4 to 20 mA output proportional to the related input voltage and current respectively for the sinusoidal and non sinusoidal inputs commonly found among vari able frequency applications Instrument power is supplied via a control industry Standard 4 to 20 mA loop power The MVTR supports three full scale voltage range inputs 150 300 and 600 VAC It has a 200 ms response time in 150 V and 300 V models and a 500 ms response time in the 600 V model The MCTR supports four input ranges 0 Ato 0 1 A OAto1A 0 Ato 5A and 0 333 V Both transducers feature a 50 to 400 Hz frequency range and a 20 to 60 C operating temperature range Contact Ohio Semitronics for pricing Ohio Semitronics Inc www ohiosemitronics com RF BUILDING BLOCK QUADRATURE MODULATOR DEMODULATOR The C
94. er s Flexible Design Rule Management a a Polygonal and Split Power Plane Support Board Autoplacement amp Gateswap Optimiser Direct CADCAM ODB IDF amp PDF Output Integrated 3D Viewer with 3D5 and DXF export Mixed Mode SPICE Simulation Engine Co Simulation of PIC AVR 8051 and ARM Direct Technical Support at no additional cost Electronics Labcenter Electronics Ltd 411 Queen St Suite 201 Newmarket Ontario Canada Toll Free 666 499 6184 www labcenter com or Email info labcenter electronics com www labcenter com August 2012 Issue 265 NAN Do you have any advice for Circuit Cellar readers who are considering building their own autonomous robots GUIDO I love robotics because it involves so many disciplines Each one of us can find their own specializa tion but we must also know something about other fields I receive a lot of odd questions in the forums coming from people who knowing just high level pro gramming believe they should immediately be able to build an autonomous robot Allow me to use the words of one of my gurus David P Anderson Speaking about a robot competition he said that you must accomplish in advance the very first test make the robot run forward and backward for some minutes Seasoned robot builders will tell you that getting to this stage is most of the battle To successfully run this first simple exercise the robot builder must have some sort of funct
95. er Design Manual From Microcontroller Theory to Design Projects ADuC8 amp 41 Microcontroller Design Manual Buy it today August 2012 Issue 265 PICO Technology GET MORE WITH THE CFSE N 7ND NiCRONG REO GO as PicoScope 6000 Series MIO Ne 4 3 5 ES e 5 MORE FEATURES AS STANDARD pling rate and deepest _ of any scope for this budge ae ICCC a eon ame am oe teal tomy a a sm St All models include and 5 C case full so re anc warranty measurements full SDK advanced persiste ce seri 0 N 2144 ia 244 IF Greten Preqaeny 45 D bor Side LO 1 BY Ben tn Range apure j r Pe ae dmat 1 A i a a N E 2 rer i 3 672 to T0000 53 33950 Sle L950 fiz 550 iz 67s 236 0975 344 0074 pE 40500 1657 3950 1697 4030 59 4055 ATS 7980 173 8030 Boe a030 2 eh S6 eh Pe 234 8025 44 2075 6 48833 157 5317 157 9350 4 1 4 8987S 64 851275 i 2 353 7950 345 8056 The first step is probably to evalu ate if the output power is in line with the target You could easily do it by hand just adding the gains or sub tracting the losses of each stage in decibels Let s try 0 dBm input power 5 2 dB mixer losses 2 dB filter losses 25 6 dB amplifier gain 18 4 dBm So we are slightly above the tar get of 15 dBm which is good This
96. er Operating Modes Fast Wake up Function Industrial Specifications 40 C 65 C Multiple External Communication Interfaces Internal Accurate High Low Speed Oscillators E D O DE E gt DE High Noise Immunity and Excellent ESD protection Touch Flash MEU S10 Aash MCU STD a051 Flash MU USB STO Flash MEU 32bit MCU En hanced OTP MEU ecr ee o e a S eS ee aM TinyPower MEU Power Management j UART uu Phone MCU EEPROM WLED Backlight ul i ine HOLTEK SEMICOMDUCTOR IMC 46729 Fremont avd Fromont CA 94538 Tel 510 252 9880 Fax 510 252 9885 E mail sales holtek com htipsiwww haltek com August 2012 Issue 265 Ul N FA BOVE THE GROUND PLANE MOSFET Channel Resistance Tester Hardware by Ed Nisley USA Measuring MOSFET characteristics helps verify that the datasheet values will apply in an actual circuit This Arduino based tester applies known currents and voltages and it sends the results to a PC for data logging and analysis This article details the hardware design and verifies the overall calibration though the ideal MOSFET equations and Spice models presented in my June arti cle MOSFET Channel Resistance Theory and Practice Circuit Cellar 263 2012 provide enough guidance to rough out a transistor circuit there s no substitute for measuring real devices to see how they perform The Arduino based hardware shown in Photo 1 automatically characterizes a M
97. er is switched between Transmit and Receive mode by I O pin RC3 The receiver translates the differential signal to TTL level serial signals and the TX and RX lines are connected to the microcontroller UART on Pins 6 and 5 respectively By connect ing the receive enable RE and output enable OE together the driver disables the receiver when it is transmitting prevent ing the half duplex echo where the information transmitted is echoed back to the microcontroller on the receive line I used a DPST latching relay so it doesn t consume any power when it is idle One pole is used to feed information back to the microcontroller so it can confirm that the relay is on or off The other contact is used to switch the AC line for the exterior light The NPN transistors Q1 and Q2 are common emitter configura tions that provide the necessary current to energize the relay coils The relay coils have Zener diodes across them to keep the spikes out of the power supply lines I used the Panasonic Elec tric Works DSP1 L2 5 V relay with 5 A contacts which is more than adequate to switch a 60 W bulb or the more trendy equiv alent 15 W CF The microcontroller needs some way of maintaining a real time clock RTC so it can function as a timer I used a 32 768 Hz quartz watch crystal attached to Timer 1 inputs They say it s easier to ask forgiveness than to seek permis sion but clearly this was not meant to apply to circuit boards Originally I
98. er of the software in the energy chip did not carefully think through the implications of hav ing three devices all reading and writing to a common shared memory when the interface was created We were using the inter face and didn t know that it was a shared memory interface The problems of nonatomic operations and TOCTTOU issues on shared resources can create problems that are like hurricanes in Hartford England they hardly ever happen but when they do kl Bob Japenga has been designing embedded systems since 1973 In 1988 along with his best friend he started MicroTools which specializes in creating a variety of real time embedded systems With a combined embedded systems experience base of more than 200 years they love to tackle impossible problems together Bob has been awarded 11 patents in many areas of embedded systems and motion control You can reach him at rjapenga microtoolsinc com RESOURCE B Japenga Concurrency in Embedded Systems Part 1 An Introduction to Concurrency and Common Pitfalls Circuit Cellar 263 2012 SOURCE 71M6533 Teridian energy metering IC Maxim Integrated Products www maxim ic com NEED TO KNOW INFO Knowledge is power In the computer applications industry informed engineers and programmers don t just survive they thrive and excel For more need to know information about some of the topics covered in this article the Circuit Cellar editorial staff recommends the following c
99. estroying it before the powerful transmitter started Flow charts on paper a Motorola devel oping system with the program saved on an 8 floppy disk a very primitive char acter based editor the program burned on an external EPROM and erased with a UV lamp That was the environment When 20 years later I started again with embedded programming for my hobby using Microchip Technology s MPLAB IDE maybe still version 6 xx and a Microchip Technology PIC16F84 it looked like par adise to me even if I had to relearn almost everything CIRCUIT CELLAR www circuitcellarcom But what I ve learned about code optimization both for speed and size is still useful even when I program the many resources on the dsPIC33F series NAN What is your current occupation GUIDO After a good period of electronic designing in that elec tronics company a colleague of mine and I decided to face up to a challenge There was the need to build up the technical department for a newspaper company from scratch Since then I ve learned a lot about editorial systems picture editing page layout computer to plate paper ink web presses and every technical issue needed to produce and print newspapers and magazines Now I m managing a company that takes care of all the technologies for the entire editorial group NAN You worked in the field of analog and digital devel opment for several years Tell us a bit about your back ground and
100. eter readings are a few tens of mg away from the required reading since all you re doing here is correcting for gross rotations of the sensor pack ages and the sensor daughterboard in multiples of 90 Any needed correction will be unique for your board layout and mounting orientation but will be no more complicated than swap the x and y accelerometer channels and negate the z channel reading Code this accelerometer axis mapping into your software and don t touch it again Figure 2 may help explain this visually The accelerometer sensor measures both gravity and linear acceleration and in the absence of any linear acceleration as is the case when sitting on a desk the magnitude of the accelerometer reading will always equal 1 g and therefore lie on the surface of a 1 g sphere irrespective of the orientation The six measurements lie on the vertices of an octahedron inscribed within the 1 g sphere and the axis mapping simply rotates and reflects the octahedron as needed until the accelerometer channels are cor rectly aligned The magnetometer axis alignment is similar to that of the accelerometer but makes use of the geomagnetic field vector Place the eCompass flat upright and pointing northward and then rotate in yaw angle by 270 to the east south and finally west The x channel magnetometer reading should be a maxi mum when the eCompass is pointed north and a minimum when pointed south The y channel magnetometer readi
101. from a host RPi is a simple ultra low cost compact computer board that runs the Linux operating system The board utilizes a 700 MHz ARM based processor and has 256 MB SDRAM memory When using a laptop or desktop PC you can use FTDI s debug cable to N interface with the RPi board and perform in depth analysis on developing software applications The 1 m long cable connects directly to the RPi s serial port which outputs kernel debug messages for the PC to acquire The FT232RQ USB to Serial UART interface IC within the TTL 232R RPi cable provides a USB to asynchronous serial data transfer path that sup ports data rates from 300 bps to 3 Mbps at 3 3 V TTL levels The chip handles all the USB signaling and protocol requirements The RPi USB Hub Module utilizes a USB to UART MPSSE IC along with a GL850G USB hub controller IC It provides engineers with up to four down stream USB 2 0 high speed 480 Mbps ports and supports asynchronous serial data transfer rates from 300 bps to 12 Mbps at 3 3 V TTL levels Synchronous serial data rates of up to 30 Mbps can be handled on JTAG SPI and I C interfaces The module s dimensions are 33 45 mm x 65 mm An operational temperature range covering 40 C to 85 C is supported by both the cable and the hub module which are both RoHS compliant TTL 232R RPi debug cables cost approximately 15 each RPi Hub Modules cost approximately 34 each Future Technology Devices International
102. g a wall switch with a simple little timer that could be scheduled to turn exterior lights on or off The units gave me no end of frustration since the day I installed two of them Without naming the manufacturing culprit I disassembled the unit to deter mine the problem It turns out the unit was a collection of small plastic gears driven by a small motor These gears turn a cam that presses a lever switch that opens or closes the AC line In a perfect world that might be okay but variations in temperature and humidity caused changes in friction that couldn t be over come by the little underpowered motor Actually there were two lever switches The second one provided feedback to the microcontroller telling it when to stop As the gears failed to turn the unit dis played an error condition and caused an associated rise in my blood pressure Of course all this functioned even less reli ably in a more hostile garage environ ment instead of in the comfort of the house And I would not like to see the plastic gears reliability after a few years of wear on the plastic shafts I decided that it was time to build a better mousetrap by designing a new QJ N microcontroller based controller to replace the timer see Photo 1 Had this been a simple little timer there wouldn t be much of a story However I decided this initial event would enable me to start Photo 1 Take a look at the final assembly The board is m
103. g options automatic portrait and land scape detection etc but dis able all these since you simply want the raw accelerometer and magnetometer data Con figure the accelerometer into a 2 g range and check that you can read the x y and z accelerometer and magnetometer data in units of bit counts from the sensors internal registers at a sampling rate of between 10 Hz and 50 Hz Smartphones commonly use IDH3 to minimize power consumption while anything above 50 Hz is overkill Check the accelerometer datasheet for the conversion factor between counts and g 4 096 counts per g for the MMA8451Q in 2 g mode and use this to scale the x y z accelerometer readings into units of g Do the same for the x y Z magnetometer data again tak ing the conversion factor from the mag netometer datasheet 10 counts per uT for the MAG3110 August 2012 Issue 265 foo August 2012 Issue 265 1 95V 3 6V 1 6V 3 6V Interface Voltage VDDIO O Figure 1 Schematics for a MMA8451Q and b MAG3110 sensors COORDINATE SYSTEM The equations and C software in Listing 1 use the aero space or x North y East z Down coordinate system depict ed in Photo 1 This defines the initial eCompass orientation to be where the x axis points north the y axis points east and the z axis points downwards The three orientation angles roll pitch 8 and compass heading or yaw w are defined as clockwise rota
104. gle Theta 90deg 90deg and sin cos The atan Gx Gz RadToDeg sinAngle sin The DegToRad cosAngle cos The DegToRad de rotate by pitch angle Theta Bfx Bx cosAngle Bz sinAngle Bfz Bx sinAngle Bz cosAngle Equation 2 sin Theta cos Theta Equation 5 X component Equation 5 z component calculate yaw ecompass angle psi 180deg 180deg Psi atan2 Bfy Bfx RadToDeg return packs of up to five devices With a bit of luck you may be able to get both the accelerometer and magnetometer sen sors for free Add a handful of decou pling capacitors and pull up resistors and you should be well within the 5 component cost Each reader has a preferred microcon troller to read the raw data from the two sensors and implement the eCompass This article assumes the microcontroller provides an I C bus to interface to the sensors supports floating point opera tions whether natively or through soft ware emulation libraries and has a few spare bytes of program and data memory to add the 15 executable lines of eCom pass code in Listing 1 www circuitcellar com CIRCUIT CELLAR Equation 7 LAYOUT amp BOARD BRING UP Once you ve selected your sensors the next step is to design the accelerometer and magnetometer daughterboard with I C bus connection to the microcontroller Reference schematics for the MMA8451Q and MAG3110 are
105. handles up to 5 5 V and a few watts As you can see in Figure 5 I used the SPV1040 because I was inter ested only in 3 to 5 V which was enough for a few NiCd or NiMH cells or a single LiPo cell Many manufacturers include a good description of the MPP process and boost circuitry in their parts datasheets Formulas for determining parts values are usually included as well as typ ical circuits that can be used many times without having to do any calculations I ve discussed the major advantage of using a device with an MPP algorithm as a front end to energy collection using a solar cell s but this only gets us halfway to our goal of keeping batteries charged The next step is to make good use of the collected energy without destroying the batteries you wish to keep in tip top shape If your energy supply is connected to the batteries they may overcharge without any active control If you CIRCUIT CELLAR www circuitcellar com use a simple and safe trickle charge you may not be able to bring a depleted set of batteries back up to snuff if there is a string of overcast days A bit of smarts must be employed to take full advantage of any available energy Part of my goal was to come up with a design that didn t require a separate microcontroller to handle the task While the individual devices may employ inter nal controllers to perform their intended functions I wanted this initial circuitry to be void of programming Ag
106. he specifications Another solution would be to try to reduce the power at the mixer s input This will also significantly reduce the spu rious level but you will then need to add an extra gain stage to recover the required output power so it may be out of Specification with respect to harmonics but these are quite Serji i vit i 3 T J i a iT anit EH i E f ta rE ae a oe pi b 1 a Le Sia a e r Lal T ERE ie Lm i ki i l i 4 Photo 5 This simulation was done with another filter right after the last amplifier This solution is costly but greatly improves the output spectrum at the expense of 2 dB of extra losses Compare it with Photo 4 CIRCUIT CELLAR www circuitcellar com high in frequency and easily filtered with a low cost passive low pass filter Lastly you could select better parts i e a mixer and an amplifier with higher IP3 and reiterate the design WRAPPING UP My goal was not to provide you with a fully functional design It was to pres ent the key development steps you could use Designing an RF system without calculating their key perform ances implies a risk of redesign close to 100 You can either accept it and reduce the redesign cost by using eval uation boards or similar or minimize the risks by calculating or simulating the design as early as possible System simulation tools like VSS or its equiva
107. heck to see if the debounce timer is already running If it isn t check to see if there is a mismatch between the stored state of the push button and the button itself Next if the button was pressed take action Last start the debounce timer so this won t hap pen again until the timer expires only interested in button pushes the code ignores any change where the button is released The process is shown in Figure 3 The debounce timer is simply an 8 bit counter that wraps around back to zero after 255 counts The debounce time could be shortened by seeding it with a predefined value instead of starting from one In order to lengthen it it must be expand ed to a counter greater than 8 bits One common feature in all the devices I built for this project was that during program start up the reason for the reset was examined and a value for that reason was incremented in EEP ROM Those locations are EEPROM bytes 1 4 for power up MCLR reset brownout and watchdog reset respectively For diagnostic purposes the device will send these counts to anoth er device by request enabling examination of the unit to see the different reasons for restarting I am proud to say there haven t been any watchdog based resets which tells me the program is relatively solid NOW WHAT I now have the control module installed and connected to the RS 485 network see Photo 1 When covered with a signal gang blank panel the unit is completely unnotic
108. heir maximum lifetime STMicroelectronics offers a couple of evaluation boards you can use to get started with a design refer to Photo 1 Energy harvesting from not just solar but wind water thermal and other methods is being researched today Nature provides a plethora of possibilities As stewards of our natural resources we need to use them wisely lest we tip the natural balance too far There are some things we just can t live without l Jeff Bachiochi pronounced BAH key AH key has been writing for Circuit Cellar since 1988 His background includes product design and manufacturing You can reach him at jeff bachiochi imaginethatnow com or at www imaginethatnow com NS A RESOURCES APRS World Solar Insolation Light Intensity www aprsworld com sensors solarInsolation STMicroelectronics SPV1040 High Efficiency Solar Bat tery Charger with Embedded MPPT 2011 www st com internet com TECHNICAL_RESOURCES TECHNICAL _ LITERATURE DATASHEET CD00287506 pdf Tung Y Hu A and Nair N Evaluation of Microcon troller Based Maximum Power Point Tracking Methods Using dSPACE Platform Australian University Power Engineering Conference 2006 http itee uq edu au aupec aupec06 htdocs content pdf 165 pdf SOURCES 750 00042 2 65 W Solar cell Parallax Inc www parallax com SPV1020 Boost converter and SPV1040 Solar battery charger STMicroelectronics www st com BQ2002 NiCd
109. hich adds a serial TTL port and an RS485 port to the picture changes this situation Andropod module with RS485 Extension Art 110405 91 74 00 a DOIN August 2012 Issue 265 Q 0 ROM THE BENCH by Jeff Bachiochi USA Charging with PV Cells Energy harvesting is becoming more and more ubiquitous but batteries including rechargeable batteries still play an important role in our day to day lives This article discusses using photovoltaic PV cells which are electrical devices that convert light s energy into electricity as a means of keeping batteries charged atteries were precious to me as a child I was fortunate to grow up with the release of the first transistor radio Prior to this radios and other equipment like the first computers used vac uum tubes Portable radios required very large bat teries to power tube filament plate and grid volt ages Not only was the transistor tiny compared to the vacuum tube but so was its battery require ment which meant much lighter and smaller radios This boom heralded the age of the con sumer toy Batteries were required to operate just about everything Batteries not included was the common phrase of the day Alkaline batteries remain a popular consumable even today although we now have rechargeable bat teries We ve seen a progression from lead acid to NiCd to NiMH to Lithium based cells see Figure 1 Battery tech
110. ical solar inso lation levels expected on a clear day in Winona MN At this location the solar cell received about half the rated illumination 475 W m72 So even under perfect conditions the cell will only output half of its rated output Also since the sun is only perpendicular at noon most of its potential for gathering energy is less in the morning and after noon The sine shape of the graph suggests that you might Photo 1 A great way to investigate MPPT for your design is to use an STMicro electronics evaluation board such as this STEVAL ISVO06V2 shown in the top of the photo The smaller cell in the center is rated at 165 mW 0 55 V output at 0 3 A measuring 1 5 x 0 75 At the bottom is a Parallax commercial quality solar cell that is rated at 2 65 W 0 534 V output at 5 34 A measuring 125 mm CIRCUIT CELLAR www circuitcellar com PRODUCED BY as CEA Be the first to seg what tomorrow will be talking about TUESDAY JANUARY 8 FRIDAY JANUARY 11 2013 LAS VEGAS NEVADA REGISTER AT CESWEB ORG REGISTER NOW August 2012 Issue 265 Light Intensity at Uraa Pe GGG 3 iiiiiii Figure 6 Solar insolation is the measurement of the sun s light intensity falling upon the earth As expected this is less than the 1 000W m used to specify the potential output of a solar cell panel It will vary by latitude as well as by time of year This takes weather conditions into account Source
111. ifferential amplifier with a gain of 2 then any analog voltage transmitted by one end will be reproduced at the other end Answer 1b No A hybrid is just a bridge circuit with one arm of the bridge replaced by the line and the termination at the far end The transmit signal is applied to two oppo site corners of the bridge and the receive signal is taken from the other two comers In order to provide the Tx Rx isolation the bridge must be balanced which in the example above means the lower resistor on each side must match the impedance of the line far end combination For DC and short lines a simple resistor suffices At audio fre quencies and with the long unshielded twisted pairs used in telephony a more complex matching impedance is required What s your EQ The answers are posted at www circuitcellar com eq You may contact the quizmasters at eq circuitcellar com THE ORIGINAL SINCE Pnn Beta LAYOUT FREE Stencil with every prototype order j EAGLE mane button pcb pool com download button on your first order uN PCB POOL is a wili trademark of www pcb pool com 7 e ar LAYOUT www circuitcellar com CIRCUIT CELLAR as A pi dye f lee ae Edited by David Tweed ANSWERS for Issue 264 Transformers are used only because it s the easiest way and the only passive way to get a balanced drive and or receive signal the transmit driver and receiver cannot share a gr
112. ily UsersGuide pdf RESOURCE Rickey s World 8051 Ebooks and Tutorials ebooks and tutorials for 8051 2010 www 8051projects net download d215 intel mcs 51 8051 user manual html SOURCE ADuC841 MicroConverter Analog Devices Inc www analog com Gigabit Tech DOs ARM based System ona Chip Gigabit Ethernet Small Cheap Fast Both OFP and BGA Packages Standard Development Tools 10 Year Life Guarantee Royalty Free RTOS TEP IP Va 6 ery Ai gt 9 10 each gt Z Qty 100 The gridARM System on a Chip SOC is a high performance low cost low power highly integrated single chip with 10 100 1000 Mbps Ethernet USB CAN Serial SRAM Memory SPI 12C RTC and internal peripherals designed to provide a complete solution for embedded applications THE NETWORKING EXPERTS Leaders in the embedded and networking marketplace providing network hardware high quality software and services ft Qridconnect 800 975 4743 USA 1630 245 1445 gridconnect com sridarm html August 2012 Issue 265 A 3 August 2012 Issue 265 A A MBEDDED IN THIN SLICES by Bob Japenga USA Concurrency in Embedded Systems Part 2 Atomicity and TOCTTOU The first part of this article series introduced the topic of concurrency in embedded systems This article discusses two common problems associated with embedded system designs containing concurrenc
113. in PDF format 2010 2071 Two years of audioApress Magazine Issues in PDF format 2010 2011 Free Gift Circuit Cellar 25th anniversary hat Save 25 00 for a limited time Order today at www cc webshop com Design Challenge add ons ATMEL AVR Design Contest 2006 WiZnet Ethernet Design Contest 2007 Microchip 16 Bit Embedded Contral Contest 2007 Texas Instruments Design Stellaris Contest 2010 WiZnet iMCU Design Contest 2010 August 2012 Issue 265 Lied alae dedi LYAL 21 25 oe Photo 3 The drain current sense voltage noise has a strong 32 kHz component from the PWM outputs Overall the noise contributes 4 counts to the measurement The lower trace is a scope sync output from the test firmware supplies to eliminate coupling at the source a triple output 12 5 5 V supply for the main circuitry a 5 V supply for the MOSFET under test drain current and another 5 V supply for the Peltier module We tend to think of power supplies as ideal voltage sources but real world supplies generally aren t ideal at all Separating the supplies prevents high current loads from inducing voltage transients in the measurement circuitry a prob lem that s extremely hard to find and fix on a completed board The PCB layout uses four separate ground planes with single point connections to eliminate voltage gradients caused by high ground current passing through the sensitive analog circuit components The MOSFET termin
114. ioning robot platform with wheels and motors and batteries attached all mechanically and electrically sound some sort of H bridge or other means of controlling the motors from a microcontroller a microcontroller with the necessary I O all wired up and working a software development environment set up and working with the ability to connect to the robot and download code and a robust enough implementa tion that it can run for 10 or 15 minutes without crash ing resetting coming apart or having motor EMF spikes brown out the CPU You have only a few ways to do that One work in a team with distributed specializations two buy a kit with most of those jobs already done or three study practice study practice study and study again That s all As you can see from my lab picture I ve chosen the third way I excluded the first way because this is a hobby performed just in my spare time that I am not able to schedule I can only share experiences some times and or remotely with my friends I excluded the second way because I want to build everything by myself but this is only a preference of mine There are a lot of kits that enable you to have a working robot with little or no mechanics effort LEGO MINDSTORMS and VEX supply building blocks Parallax and Pololu have already done robotics platforms of many sizes just to talk about the most famous ones It must be clear that this one is not the cheapest path and you mus
115. is needed those values are sent as ASCII 0 or 1 i e things that need to report as on off or open close values Finally in cases where commands are sent to a device and a response is need ed the ASCII command letter is translat ed to lowercase in the reply message indicating that this is a reply not an instruction LET THERE BE LIGHT I wanted my replacement light timer design to be solid state I also didn t want it to consume excess power when the unit was just idling so using a good latching relay seemed in order I also wanted it to be small so it could be inserted into a single gang wall box without taking up too much space This also meant when ordering circuit boards I could place multiple copies on O RLY1 AC Load Figure 2 The light control board The differential signal is translated to 5 V levels by U1 and sent to the PIC MCU U2 The ter mination resistor R1 is optional and only used when the unit is at the end of a run CIRCUIT CELLAR www circuitcellar com b CUVMINS2O0 Windows CE 6 0 Touch Controller CLWIN The CUWIN Is a series of Windows CE touch controllers that are more cost effective than a PC but with more features than an HMI touch screen Create sophisticated applications with C or any Net language 533MHz ARM CPU 128M8 SDRAM A Flagh SD Card Support Ethernet RS 232 485 USB Audio Qut Windows Embedded CE 6 0 The CUPC is a series of ind
116. itic capacitances at the output After a couple of microseconds the output rises sufficiently to turn on Q4 At this point the voltage rises faster In total the rise time for the 0 to 5 V transition is about 3 us several hundred times longer than when P3 1 is being toggled Keep in touch and interact with the Circuit Cellar editorial department Pitch ideas for articles tech volts ADC analog DSP WiFi robotics programming RFID code schematic logic HPWM electronics debugfbit MCU RTOS Hohm byte sensor engineering PCB signal processor H RAM servo CPLD encoder twitter Follow us on Twitter Pe ee or oe 5 i i et ci I Ae oe j p ifek ry yj a i pirt ug Ev T gD P A N Stay informed with valuable product announcements Learn about upcoming industry events conferences and more zi Ei rng QE dya Mie CIRCUIT CELLAR www circuitcellar com Photo 2 The 0 to 5 V transition when the I O pin without the pull up resistor is being toggled Initially the voltage rises linearly and slowly In this initial stage only Q3 the very small transistor is conducting After a bit more than 2 us Q4 turns on too and the voltage rises faster The total transition time is on the order of 3 us WHAT S INSIDE MATTERS We ve seen a fair amount about the internal structure of an I O pin with a pull up resistor which is not really a resistor of course
117. l characteristic of this battery chem istry where as the batteries reach opti mum charge their voltage actually goes down a bit Maximum voltage is at the BAT input whose level is set by a voltage divider across the cells being charged www circuitcellarcom CIRCUIT CELLAR Maximum temperature is an optional volt age input where the voltage sensed is a resistor divider consisting of a pull up resistor and thermister negative temper ature coefficient resistor in contact with the batteries Maximum time is an inter nal timer that limits the duration of the fast charge period If the maximum voltage is reached prior to the maximum time charging can con tinue at the optional top off reduced cur rent rate for the remaining time period At this point the charging is further reduced to the minimum trickle charge rate until V is removed Or in our case the energy supply is exhausted The open drain output CC remains a high impedance to request charging cur rent and is pulled to ground to inhibit charging I wanted to use a simple LM317 to control the charging current but it device requires a minimum of 4 V over head V to V to operate so I had to use a less elegant solution with a minimum drop A MOSFET switch controls current flow A series resistor is used to limit the expresspcb com August 2012 Issue 265 N j August 2012 Issue 265 1N5817 Figure 5a The SPV1040 circuitr
118. late the block from the Surrounding air A Peltier module between the block and the black CPU heatsink can vary the MOSFET temperature between 00 C and 50 C during the test cycle with a fan holding the heatsink near room tempera ture The Arduino firmware stabilizes the temperature using a proportional integral PI control loop with feedback from the thermistor and power from the hardware in the right rear corner of the PCB I ll describe how that works in my next arti cle along with examples of how the MOSFET properties vary with temperature The heavy lines in Figure 1 mark the 2 A current flow through the test MOSFET On the PCB that current must coexist with op amp circuitry handling analog Signals with a resolution around 10 mV Reducing that conflict required more than usual attention to PCB layout I used three separate wall wart power CIRCUIT CELLAR www circuitcellar com DEL SPECIAL EDITION Circuit Cellar Archive on USB Celebrate 25 years of Engineering Excellence with this Special Edition Circuit Cellar Archive packed with all these incredible features and a free gift Special Anniversary USB drive or our i traditional CC GOLD USB drive Your choice A USB memory upgrade from 16GB to a whopping 32GB All Circuit Cellar magazine issues in print through date of purchase Article Code All the details from our previous Design Challenges Two years of ELEKTOR Magazine Issues
119. left off a connection for a manual switch went back to the board and added a two pin header for a small momentary push button That meant drilling holes in a populated board and using a jumper wire to connect Command Payload 4 bytes _ 1 byte light Tell the unit to turn the light on or off immediately 1 or 0 UJ 0 1 byte event Photo 3 These are the two sides of the circuit board There is more blank space than there is actual circuit The large traces on the far right are where the AC lines attach to connect to the relay the header to the microcontroller The debouncing is accom plished in software SOFTWARE The microcontroller s code was written in PIC Assembler using Microchip s MPLAB integrated development environment IDE The project contains six source code modules to encap Sulate the functionality making it easier to maintain However like all Assembler programs should be many instructions are commented This helps remind me what it is doing because the code was written more than three years ago By keeping the program as lean as possible it only uses 739 instructions or 16 of the microcontroller memory Now I ll describe the func tion of each source module Upon reset the program starts in the source files main asm Here it sets the state of the microcontroller enables the watch dog timer WDT and records the reason for the reset into EEP ROM It then sets the I O ports o
120. lent from other companies such as Agi lent are invaluable They enable early simulations even before the first schematic Of course there are risks associated with such complex tools You may find wrong results due to a mistake in the model of a given part or due to the misuse of the tool itself So good designers must always check if the results make sense prior to presenting them to their managers but I m sure all regular Circuit Cellar readers already know that al Robert Lacoste lives near Paris France He has 22 years of experience working on embedded systems analog designs and wireless telecommunications He has won prizes in more than 15 international design contests In 2003 Robert started a con sulting company ALCIOM to share his passion for innovative mixed signal designs You can reach him at rlacoste alciom com Don t forget to write Darker Side in the subject line to bypass his spam filters RESOURCES European Communications Office ECO European Community Frequency Management Regulatory Affairs and Spectrum Engineering Working Groups ERC recommendation 70 03 Relating to the Use of Short Range Devices SRD 2011 www erodocdb dk docs doc98 official pdf rec7003e pdf European Telecommunications Standards Institute ETSI EN 300 220 1 Elec tromagnetic Compatibility and Radio Spectrum Matters ERM Short Range Devices SRD Radio Equipment to be Used in the 25 to 1 000 MHz Frequency R
121. licable regulations You ve already taken care to select a good frequency band but CE approval or FCC in the U S implies other constraints as explained in my article CE Marking A Process to Ensure Product Conformity Circuit Cellar 257 2011 In particular such a transmitter must be designed to comply with the EN300220 standard Let s just focus on one of its aspects Spurious transmissions The EN300220 states that a transmitter must not radi ate any unwanted signals higher than 250 nW equivalent to 36 dBm up to 1 GHz and not higher than 4 nW yes 4 nW or 54 dBm in some protected frequency bands like FM audio broadcast Figure 2 summarizes this requirement You must take this constraint into consid eration for your mixing and amplifying stage HIGH LEVEL DESIGN Let s start the design now You will of course use a frequency mixer to move the frequency up from 45 to 169 4 MHz You can use a local oscillator of 214 4 MHz i e 169 4 45 or 124 4 MHz i e 169 4 45 In this case it is nearly equivalent so just select the former The mixer will then receive 45 MHz on its IF input and 214 4 MHz on its LO input and will generate the sum and difference of the two frequencies Specifically 259 4 MHz i e 214 4 45 and 169 4 MHz i e 214 4 45 You will then need to browse catalogs of mixer suppliers to find a good match meaning a mixer able to work with RF and LO frequencies of 169 MHz to
122. ly determine the possible spurious frequencies received or generated by a frequency mixer However they cannot evaluate the frequencies of the chain One of my favorites is the NoiseCalc module built into Agilent s AppCad software which is available for free from its web site Just launch it enter the key characteristics of each stage and you will get the results as shown in Photo 1 As planned the output power is calculated as 18 4 dBm but this tool also provides you a calculated overall noise figure for the chain here 11 4 dB Refer to my previous article Noise Fig ures 101 Circuit Cellar 249 2011 This tool also calculates the overall IP3 of the chain enabling it to evaluate the maximum input signal power before nonlinear effects Lastly it provides the calculated power between each stage You can then check if these powers stay significantly below the P1 dB compres sion point of each device which is the case in that example WHAT ABOUT SPURS This quick chain gain calculation shows that the design seems in line with our goals at least for the desired 169 4 MHz signal but we have just done a small part of the job The devil is hidden in the Spurs You need to calculate what would be the other signals generated by the cir cuit and check if they are safely below the regulatory limits The main spur genera tor is the mixer so you need to start with this one First you need to calculate the frequency
123. multiple reads If the writing of the data is slower than the rate you are reading it you can perform multiple reads looking for coherent data This is the least deterministic of the solutions It would work well in Case Study 3 TOCTTOU The final concurrency issue we will look at this month sounds more like a South American bird TOCTTOU pronounced tock too vulnerability occurs when the data changes after it is read Perhaps the simplest commonplace example of how this can A 0 The data is 0x000001FF SPI reads busy bit and it is not set 8051 sets the busy bit SPI reads byte 1 as OxFF Time of Use 8051 writes byte 1 as 0x00 8051 writes byte 2 as 0x20 SPI reads byte 2 as 0x20 Time of check 8051 writes byte 3 as 0x00 8051 writes byte 4 as 0x00 SPI reads byte 3 as 0x00 8051 clears the busy bit SPI reads byte 4 0x00 SPI reads busy bit and it is not set Figure 2 A potential condition that could occur when the solution that involves building an indication of the concurrency of the data is applied to Case Study 1 happen in everyday use is in an airline reservation The user looks at which flights are available at 7 00 00 time of check but then attempts to book the once available flight at 7 01 00 time of use and is rejected because the flight has already been booked Let s take an in depth look at the third solution above busy bit and show how a faulty implementation of the busy bit
124. n A and C to enable Timer 1 to run and to enable control of the latching relay Next the UART and Timer 1 are enabled and set to cause an interrupt when something happens Finally the program enters an infi nite loop waiting to see if a message arrives from the network if the push button was pressed or if the time now matches an event that needs to turn the relay on or off The entry point to the interrupt service routine ISR is located in a separate mod ule called interrupt asm All it does is determine the cause of the interrupt and dispatch the execution to either timerasm or comm asm depending on the type of interrupt The comm asm module handles all incoming characters from the RS 485 line It checks to ensure the arriving bytes can be placed into the receiver buffer which wouldn t be permitted if the main loop is still processing the last message received When it Purpose Return the contents of the event in EEPROM Set event with HH MM and on or off Table 3 Here are additional communication messages understood by the light controller These are used to read write events to the EEPROM and enable it to set a number of actions throughout the day or night CIRCUIT CELLAR www circuitcellarcom Listing 1 This is the Assembler code that examines the incoming messages from other devices The msg_buffer is defined as the area where the ISR has already placed the incoming data from the UART 5 f Test to s
125. n ADE 1LH It is then filtered and finally amplified by a GALI 84 amplifier both from Mini Circuits of unwanted signal leakage between the mixer ports For example its typi cal LO to RF isolation at 169 MHz is specified at 55 dB meaning that the 214 4 MHz 10 dBm LO signal will be present on the RF output at a level of 45 dBm i e 10 dBm 55 dB The last important parameter is the nonlinearity figure of the mixer expressed here as IP3 which means third order intercept point I m afraid I would need another article for that topic but that IP3 is closely linked to the nonlin ear behavior of the mixer The closer the input power is to the IP3 the higher the Spurious signals will be on its output Here the IP3 is 15 dBm which is just a little more than one order of magnitude higher than the 0 dBm input power so we may anticipate some linearity problems Stage 1 io E ADET 32 Se Stage Stage Giage 4 Stage 5 Staga 6 Siaga 7 CH H HHH Boo i i oid O00 15 40 124 am ato Of TIT Photo 1 The AppCad software from Agilent is a quick way to calculate key characteristics of an RF chain by entering the key specifications of each stage e g gain IP3 etc Here with an input power of 0 dBm 1 mW the calculated output power is 18 4 dBm 70 mW which is significantly above target CIRCUIT CELLAR www circuitcellarcom CIRCUIT CELLAR ADUCEA Microcontroll
126. ncy filter two words 11 ECMAScript approved language that supports a lot of C structured programming syntax 12 Lightening or a tripped circuit wire two words 15 Name of the radio show co hosted by two recent Circuit Cellar Q amp A interviewees three words 16 When a software thread relinquishes control of the processor to the operating system 17 American physicist 1923 2005 who worked with Robert Noyce to create the first integrated circuit 18 The interval between one musical pitch and another with half or double its frequency 19 A capacitive sensor that changes its polarization in response to a change in temperature two words 20 In a mechanical electrical meter a pulse that changes state every half rotation of the meter s disk and represents a quanta of energy two words Se eaves The answers will be available in the next issue August 2012 Issue 265 CIRCUIT CELLAR www circuitcellar com NI DE THE DIRECTORY OF ROX PRODUCTS AND SERVICES AD FORMAT Advertisers must furnish digital files that meet our specifications www circuitcellar com advertise ALL TEXT AND OTHER ELEMENTS MUST FIT WITHIN A 2 x 3 FORMAT E mail adcopy circuitcellar com with your file or send it to IDEA BOX Circuit Cellar 4 Park Street Vernon CT 06066 For current rates deadlines and more information contact Peter Wostrel at 978 281 7708 or peter smmarketing us The Vendor Directory at www circuitcellar com vendo
127. nd can be used with up to 500 mW of RF power This is enough for several tens of kilometers of coverage even in dense urban environments Of course all characters appearing in this column are fictitious any resemblance to real projects liv ing or dead is purely coincidental even if my com pany has been working on such 169 MHz meter reading projects for years Meter reading transmitters are almost always designed around low cost high performance inte grated transceiver chips from companies such as Analog Devices or Texas Instruments to name a few but let s assume that this time you need to design a custom handmade transmitter chain August 2012 Issue 265 IF signal from previous stage will not talk about classical PF OUPUNG AMENNA electrical simulators like the ale cae ae MHz Central frequency 169 4 MHz Ari i BANUWIONM z e Signal power gt 30 mW ubiquitous SPICE but I will IsTpicaisignatpower 1 mW oe ee eho present you some high level system design tools Just fol low me through this intro Figure 1 The goal is to design a frequency translation and amplification subcircuit for a VHF transmitter The input is a 45 MHz intermediate frequency signal with a 1 mW duction on RF system level typical power which must be transformed into a 30 mW 169 4 MHz signal in compli simulation ance with the applicable standards Ul 00 CIRCUIT CELLAR www circuitcellar com 7 8 3 Limits Th
128. nents I will describe in subsequent articles It is instructive to note that using multiple source code mod ules and grouping functionality into those modules a project becomes much easier to maintain and enhance It is also worth noting that developing and debugging this project convinced me more than ever to use a C compiler for any further devel opment So for my next device I ll describe how I did the pro gramming in C and the issues I experienced with the compiler I used ki Scott Weber scotty42 csweber com is a PC developer who is currently working slowly toward finishing a BS in Electrical Engi neering at the University of Texas at Arlington His primary goal is to get the sheepskin that justifies the knowledge he already has from 30 years of electronic tinkering He currently works as a PC developer and is rapidly tiring of the direction the PC soft ware world is taking He lives with his wife and her beautiful garden in Texas PROJECT FILES To download the code go to ftp ftp circuitcellar com pub Circuit_Cellar 2012 265 SOURCES ExpressPCB software suite ExpressPCB www expresspcb com PIC16F688 Microcontroller and MPLAB IDE Microchip Technology Inc www microchip com DS1487 Transceiver National Semiconductor Corp www national com Panasonic DSP1 L2 5 V relay Panasonic Electric Works Corp http pewa panasonic com CIRCUIT CELLAR www circuitcellar com Oesc a designeast summit ESC B
129. nents shown simply pass the filtered PWM output directly to the multiplexer and then to the non inverting input of IC1C If you choose voltage feed back select R5 and R13 to center the R9 trimpot voltage range around the nomi nal setpoint Because the negative feedback loop around IC1C closes through two op amps MOSFET Q1 and R10 I added C7 to roll off the high frequency response and prevent oscillation LM324 op amps have a relatively low 1 MHz gain band width product but contemporary op amps with higher GBW will require more aggressive compensation GROUND CONTROL The PCB in Photo 1 completely con ceals the Arduino Duemilanove plugged in below it The Arduino controls all the measurements and sends logging data through the USB cable extending beyond the left edge of the photo The conspicu ous finned aluminum heatsink in the front dissipates heat from Q1 the drain current limiter and the smaller heatsinks cool a voltage regulator and the Peltier PWM cur rent driver Everything mounts on a transparent acrylic sheet The MOSFET to be tested more formally known as the device under test DUT sits on the aluminum block to the right of the PCB beside the thermistor assembly that reports its temperature A more accurate measurement would embed a thermocouple bead in the MOSFET pack age but this simple method is good enough for my purposes The white foam gasket plus a foam top hat that s not in the picture insu
130. ng should be a minimum when the eCompass is pointed east and a maximum when pointed west The z channel reading should be approximately constant since the vertical component of the geomagnetic field is constant irrespective of rotation in yaw Then invert the eCompass on the desk and repeat the process As before the magnetometer x axis reading should be a maximum when the eCompass is pointed north and a mini mum when pointed south But now because of the inverted position the magnetometer y axis should be a maximum when the eCompass is pointed east and a minimum when pointed west The magnetometer z axis reading should still be constant but in the northern hemisphere lower than the previous upright readings since the magnetometer z axis is now aligned against the downward component of the geomagnetic field vector Figure 3 shows upright and inverted magnetometer meas urements taken in the northern hemisphere with a 270 com pass rotation The maximum and minimum of the x and y axis magnetometer measurements occur at the expected angles and the z axis measurement is less when inverted than when upright These magnetometer axes are therefore CIRCUIT CELLAR www circuitcellar com COMPLETE 222210 somer recommen NI G Ni E P l NI G E a SOLUTIONS NA elementu Start here Get direct one on one technical support from real engineers with no go between and no waiting Access industry manufacturer and legislative experts on o
131. ng to be wired I could also supply power as needed Fortunately CIRCUIT CELLAR www circuitcellar com my house has a little room I use as a wiring closet I have an unused four conductor run from the wiring closet to various locations including close to the point where I needed to replace one of the light timers Wired communication across dis tances is normally done through some kind of serial connection so the next decision was what to use Some options for two wire serial communi cations were I C TTL serial or RS 232 These all suffer from distance limitation due to the voltages that can drop across long runs of wire AS an example RS 232 is limited to 50 despite its full swing specification of 12 V Clearly running a distance of 50 or more feet will require a nice differential solution Such a differential solution is available in RS 422 and its sis ter specification RS 485 Both of these use a simple two wire differential signal that is more immune to noise and voltage drops incurred by long distances In fact the design enables distances of up to 4 000 which is almost a mile The main dif ference between RS 422 and RS 485 is RS 422 supports full duplex communication over four wires while RS 485 supports half duplex communication over two wires When using just two wires RS 422 is essentially a broadcast topology whereby a single node can send information to up to 10 receiving nodes The receivers canno
132. nology is high on the industry s priority Lithium polymer Prismatic Nickel cadmium Cylindrical E 49 D 2 x lt a 5 ta gt Cylindrical Prismatic 200 250 300 Watt hours Liter Figure 1 This chart shows the historical progression of the rechargeable battery includ Lithium phosphate Prismatic Lead acid Nickel metal hydride list as electric and hybrid vehicles are becoming commonplace However there is not much dif ference between having to replace alkaline bat teries or having to change rechargeable ones When the device is out of reach as some remote sensing devices can be this can be a bother or next to impossible Maybe that s why energy harvesting is growing in popularity It would be great if we could pluck energy right out of the air as needed Today we can get enough energy from things like sun wind and water Unfortunately it is only available sporadically and not 24 7 We must rely on a storage device to gather the harvested energy when its avail able to be used as needed Assuming you can harvest aS much as you use you only need to store enough harvested energy to get you through the next energy drought Let s take a look at using photovoltaic PV cells as a source for keeping bat teries charged PV CELLS DEFINED A single PV cell is a translucent panne Sandwich of P type and N type Sune caire material forming a huge diode junction that can be exposed to
133. novacek nexicom net is a professional engineer with a degree in Cybernetics and Closed Loop Control Now retired he was most recently president of a multinational manufacturer for embedded control systems for aerospace applications George wrote 26 feature articles for Circuit Cellar between 1999 and 2004 REFERENCE G Novacek Project Development Part 1 Plans Schedules and Task Management Circuit Cellar 264 2012 NEED TO KNOW INFO Knowledge is power In the computer applications industry informed engineers and programmers don t just survive they thrive and excel For more need to know information about some of the topics cov ered in this article the Circuit Cellar editorial staff recommends the following content Smart Project Management by George Novacek Circuit Cellar 254 2011 Professional level system specifications are imperative to any design project Having project specifications in place before development saves time cost and effort Here you learn why leaving things to be determined can lead to disaster Topics Project Planning Specifications The Project Ready Designer A Refresher on Project Essential Concepts by George Martin Circuit Cellar 248 2011 Project management should involve frequently reviewing design essential topics reconsidering all tool options and staying informed about new technology and design tech niques Topics Project Management Design H
134. ns Internet amp Connectivity Embedded Development Data Acquisition Signal Processing Analog Techniques Programmable Logic ISSUE 258 January 259 February 260 March 261 April 262 May 263 June 264 July 265 August 266 September 267 October 268 November 269 December Analog Techniques Projects and components dealing with analog signal acquisition and generation e g EMI RF reduction high speed signal integrity signal conditioning A D and D A converters and analog programmable logic Communications Projects that deal with computer networking human to human interaction human to computer interaction and electronic information sharing e g speech recognition data transmission Ethernet USB 17C and SPI Data Acquisition Projects technologies and algorithms for real world data gathering and monitoring e g peripheral interfaces sensors sensor net works signal conditioning A D and D A converters data analysis and post processing Embedded Applications Projects that feature embedded controllers and MCU based system design e g automotive applications test equipment simulators consumer electronics real time control and low power techniques Embedded Development Tools and techniques used to develop new hard ware or software e g prototyping and simulation emulators development tools programming languages HDL RTOSes debugging tools and useful tips and tricks Embedded Programming The
135. ns you will have one point of contact most likely a bureaucrat The bureaucrat will hesitate questioning his own departments because the contractual documents have been signed and their job is to ensure compliance REQUIREMENTS REPORTS amp REVIEWS Take for example a common requirement copied and pasted for ages that connectors exhibit a minimum of 2 MQ resistance between pins when 500 VDC is applied This is to be confirmed by testing during the acceptance test procedure ATP prior to shipping It can rarely be done Even if the cir cuit boards were disconnected there are electromagnetic interference EMI filters electrostatic discharge ESD and lightning suppression devices directly attached to the connec tors These are sometimes integral parts of the connectors often with 50 VDC maximum rating There are ways to address this dilemma but if you don t do it in the compliance matrix you will eventually be begging a bureaucrat who will think this noncompliance should result in your price reduc tion for a waiver Although a part of your bid your compliance response should also contain a list of documentation testers and pro totypes i e deliverables confirming exactly what the cus tomer will receive For example a failure mode and criticality analysis FMECA report can be prepared on a block diagram or a component level basis There is more than an order of mag nitude difference in the amount of work t
136. nterested in electronics GUIDO I was 13 at junior high school A substitute teacher went out of the stan dard program technical drawing and started explaining the Crystal Set radio to us I was so fascinated by that new world that four years later I got a radio ama teur license after a period of SWL activi ty and the construction of some tube devices as audio amplifiers and long wave band receivers I knew all my youth friends on air all electronics addicts like me We spent most of our time in experimenting some thing A little anecdote just to understand who we were one afternoon after school there were four of us in the laboratory trying to make an HF transmitter func tion It was built by installing some tubes on an upside down aluminum baking pan used as the base Eventually the trans mitter started outputting some power to the load an incandescent lamp used instead of the antenna While we were still celebrating our success looking at the lamp glowing to the rhythm of the N A modulating voice our friend s mother came into the room and asked Why are you so happy All this stuff just to light up a lamp That episode didn t decrease our pas sion and this passion wasn t an obstacle in my regular life my wife is the sister of one of those fellows NAN What was the first MCU you worked with Where were you at the time Tell us about the project and what you learned Guido s
137. nvolvement undergoes the so called first article inspection FAI If approved by the customer or the management in case of an internal customer production may commence Figure 2 shows development engineering activity in more detail It s important to remember that each phase repre sents a lot of activity with one exit when the criteria are sat isfied The entire process should be supervised by quality assurance QA to prevent cutting corners and to maintain configuration control Configuration control is a critical activity Companies have different approaches to it Engineers should maintain log books with numbered pages instead of using loose paper for sketches and notes All documents and drawings must have numbers assigned to them during the early stages of the program I ll explain the process in my next article Preliminary versions of those documents and draw ings should not be signed but identified as preliminary Although customers often insist on receiving signed docu ments you should not sign them until signed specification and the compliance matrix approval have been received from the customer My system assigned breadboards produced in the lab and initial software series 901 version numbers These would be bumped up to 903 905 907 and so forth to reflect even the smallest changes The first prototype on a PCB would start version series 701 and once again higher numbers would reflect modifications 501 series was g
138. o Banzi at the Romecup 2011 Everything I ve read was confirmed by those hours I spent talk ing with him He is very friendly and he is an explosion of ideas In that meeting he fascinated many teachers who started using Arduino too in their lab courses I ve included several pictures of some of my Arduino based projects NAN What are your go to microcontrollers and embed ded platforms these days Do you have favorites or do you use a variety of different chips GUIDO I was brought up in terms of robotics with Microchip devices I ve used at least one device for almost each PIC family PIC1OF PIC12F PIC16F PIC18F dsPIC30F and dsPIC33F I have an ICD3 and I m very happy now that the new MPLABX also runs natively on Mac OS X The flexibil ity of those devices is very high and you can also develop very sophisticated systems In one of my latest projects modifying a parking sensor to obtain a quad sonar I con firmed once more if needed the power of the peripherals also with a simple PIC18F2620 Almost the entire project is realized just configuring and connecting peripherals The software is just simple glue that further connects the periph erals The exact control you can have on every single bit or execution cycle gives you the opportunity to obtain whatever you want I use them for all my critical projects when I need to squeeze the maximum performance by applying all the optimization concepts I know On the contra
139. o accomplish the same thing With the original iDrive you either left the same Sirius station on forever with the hot air blowing in your face or learned to use the voice response system to at least jump over some of the slick func tionality and get directly to the heater or radio LCD screens It took until I got my 2010 X5 for them to get it right My three BMWs in between had iterative improvements The solution They put most of the buttons back Yeah like most other cars these days it still has a joystick knob and an LCD that controls individual settings but a real button takes you directly to the right subsystem Circuit Cellar Project Editor Dave Tweed related another example to me while I was talking to him about this edi torial idea He told me about the Kawasaki intelligent proximity activation start system KIPASS which is an ignition system for some of Kawasaki s high end motorcycles that s based on a proximity fob RFID If the physical key is in the ignition and you bring the fob within a few feet of the bike you can start it by turning and pushing the key Sounds nice right You can leave the key in the ignition all the time When you walk away with the fob in your pocket the key is cap tured by an electric latch so it can t be stolen All s well and good But it seems that most riders are in the habit of stop ping the engine by using the kill switch instead of turning off the key That s fine until
140. o correct results 0x200 or Ox1FF You just processed 255 extra bottles WHAT ARE SOME SOLUTIONS There are four basic solutions to avoid these kinds of pitfalls Don t share memory unless absolutely necessary Remember concurrency problems only manifest when we share resources Make all operations on shared resources atomic noninter ruptible by using some kind of locking mechanism For exam ple in Case Study 2 you would want to lock out any reads while the data was being read or written perhaps by disabling interrupts Or in our simple single loop system you could cre ate a snapshot of the data at the top of the loop with interrupts disabled and then freely use this coherent snapshot of the data throughout the loop In Case Studies 1 and 3 that was impossible because the 8051 code was written by a vendor Build an indication of the coherency of the data into the struc ture Using the hardware model we could provide a busy bit on the data structures indicating that the data structure is being changed Before changing the data set the busy bit After writ ing the data clear the busy bit It is also a good practice to define the maximum amount of time the busy bit can remain set Again we didn t control the 8051 in Case Study 1 As noted in the next section we will see how this too must be care fully used In Case Study 2 we could create a data structure with a header the KYZ counter and a footer sequence number Use
141. o prepare a compo nent level FMECA If left undefined the customer will likely demand the component level analysis Similarly testers pro totypes or engineering support on site if ambiguous can quickly destroy the entire development budget Unfortunately with concurrent engineering the specifica tion is rarely signed early by the customer This exposes you the developer to ever increasing risk It is somewhat mitigat ed during the concept design through the joint definition phase JDP Here the system integrator and his subsystem Suppliers work together to in theory nail down and finalize their respective specifications Concept design review should then be the end of the JDP with the subsystem developer Starting work in earnest The success of the JDP rests main ly on the integrator s leadership and the discipline of the attending engineers I lived through several JDPs in their early days Imagine a hall filled with more than 200 engi neers no clearly defined goals and no leadership The one week planned activity stretched to three months and the results were dismal Fortunately we have come a long way www circuitcellarcom CIRCUIT CELLAR No mechanical keying of the boards is needed since they are inter changeable no parts list will be provided at PDR since then Preliminary design review PDR is the milestone when the system architecture and partitioning of functions between hardware and software shown
142. o run any testing Then it ter minates on the barrier strip shown in Photo 2 From there it leaves again and makes a straight run to the wall switch by my front door which con trols the exterior porch light Devices should be attached to the bus as close August 2012 Issue 265 UJ UJ August 2012 Issue 265 Addr Range x20 x21 x25 x26 x2f Usage _ Broadcast Control panels Lights Reserved Doors _ Time server X30 x37 X38 x3f x50 Table 1 This is how reserved blocks of addresses for various types of devices are assigned as possible avoiding drops that have long feeders or a star layout If I need to add any new devices I insert them into the bus with a line that runs out and back again This completes the setup needed for the RS 485 connections Now to create a protocol COMMAND amp CONTROL To determine how these devices would talk to each other I had to define the limits of my needs and then create an accommodating protocol So I decided on these parameters and limitations with the goal of keeping things as simple as possible I wanted the message structure to be short simple and a variable length so I used the ASCII value SOH 0x01 as a start marker and EOT 0x04 as an end marker Knowing the beginning and end I can stick a variable amount of data in between those two values provided I don t use the values SOH and EOT again Otherwise anyone lis
143. oduction to embedded technology in the 1980s from UV EPROM technology to flash incorporation of both RAM and ROM on chips and the addition of a large number of peripherals including ADCs right on these chips Mark noted that recent offerings even include a DMA controller a boon when moving huge amounts of data He can now do on a single chip what would have taken a board full of chips only two decades ago With MCUs embedded into almost everything Mark hopes that software technolo gy will keep up Concerns like software safety still dominate many applications Mark said kl CIRCUIT CELLAR www circuitcellar com CIRCUIT GELLAR Transmit Transmit Answer la Why not Hybrids work just driver driver as well at DC as they do for audio you just need a receiver with balanced inputs like Receiver Receiver an RS 422 buffer as shown in the figure to the right All resistors are the same value e g 4 700 Q and the transmit driver needs to be a voltage source low impedance If the transmitter switches between say 0 and 5 V the opposite receiver will see a voltage differential of 0 and 2 5 V respectively while the local receiver will just see 0 V For long lines you ll probably want to use lower resistances and you ll want to limit the slew rate of the transmitter so that the receiver doesn t produce glitches on the tran sitions of the local transmitter If the RS 422 receiver is replaced with an op amp d
144. of each spur that may fall in the transmitter pass band Once again you could do it by hand or use one of the mixer spur calculators available online I used the mixer spur chart calculator at CIRCUIT CELLAR www circuitcellarcom Photo 3 This is a system level design of our subcircuit designed with AWR s Visual System Simulator VSS It is very similar to the block diagram shown on Figure 3 except here each component is asso ciated with its system specifications www leleivre com The result is shown in Photo 2 Basically this tool calculates all possible combinations of both input fre quencies and sorts them by frequency You must also add to this list of possible spurs the leakage of the input signals IF to RF and LO to RF leakage and their harmonics You need to calculate the respective amplitude of each spur This will be a bor ing step as you will have to look through the detailed specifications of the mixers and extrapolate them for your applica tion This will not be easy as these ampli tudes are linked to the input signal power and frequency so an alternative method could be to buy an evaluation kit of the selected mixer and simply measure them with a spectrum analyzer With either method you will know the mixer s most significant spurs You will then need to simulate how they will be transformed by passing through the remaining parts of the chain What is the attenuation of th
145. ontent Concurrent Small C for PIC18 MCUs by Andy Yuen Circuit Cellar 188 2006 You can write concurrent programs for a PIC MCU with the Concurrent Small C CSC programming language This article covers the language s main features and then describes a complete multitasking CSC demonstra tion program Topics CSC RTOS Concurrency Go to Circuit Cellar s webshop to find this article and more www cc webshop com www circuitcellar com CIRCUIT CELLAR Motor Drivers biPololu Robotics amp Electronics www pololu com item 2502 Dual VNH5019 Motor Driver Shield for Arduino Reverse volioge protectio n LOH ie Coie for wi j Easy to use with on uve without an Arduino ff ail Arduino 71416 shown Programmable Controllers ltem 1336 Wixel Programmable USB Wireless Module Ti OC 51 1F32 microcontroller with inlegraled 2 4 GHz radia and tull toead USB iL Ay Hobby RC Servo Controllers Micro and Mini Maestros 1354 Mini Moestro 18 Channel USE Servo Controller with native USB interface ond internal scripting contra Finding the right parts for your robot can be difficult but you also don t want to spend all your time reinventing the wheel or motor controller That s where we come in Pololu has the unique products from actuators to wireless modules that can help you take your robot from idea to reality August 2012 Issue 265
146. ood enough to be installed on an aircraft for the system integration The ver sion to undergo formal testing begins series 301 until passed and handed over to industrialization for initial produc tion as series 101 Finally following approved FAI normal production series 01 commenced Why the odd numbers only In some industries i e aero Space there are nearly identical systems but one destined for the left and one for the right side Even numbers are reserved for the right side only while odd numbers are for the left as well as default in case the right side configuration doesn t exist Ul Verification 01 In my experience the process depicted in Figures 1 and 2 while it is required by software and hard ware development standards is somewhat of a wishful thought The drive to meet the ever shorter deadlines and lower costs makes the sequential process impossible The customer may be late delivering a specification detail but will not accept it as your excuse for sliding the schedule What you thought was a brilliant design idea may not work This is where a competent engineer shines By understanding the processes the certification requirements and the technical issues the engi neer manipulates the schedule runs some process es in parallel or ahead of time and in the end delivers on time Next month TIl continue with a look at other project development activities l George Novacek qg
147. orm is well suited to DSPs that have multiply accumulate units The two constants can be expressed as 62943 65536 and 26072 65536 respectively Contributed by David Tweed clever plug amp play instruments The Power of 2 CS328A XS Mixed Signal Oscilloscope iLa Mi PUTNE S JA En A n aAA Ae ome Protocol decoding Dual 14 bit ADC Spectrum analysis 8 Digital inputs e Symbolic maths e Live Matlab and Scilab link e Live Excel export 8MSamples channel e 100 MSPS capture e 1 5 MSPS streaming e 0 10 MHz signal generator e Copy and Paste Yisaelig WUW Cleve rScope com Two mixed signal triggers e USB or Isolated Ethernet August 2012 Issue 265 Ul August 2012 Issue 265 4E A pues eCompass by Mark Pedley USA Build and Calibrate a Tilt Compensating Electronic Compass A modern smartphone contains a built in electronic compass eCompass How does the tilt compensation work and how is the eCompass calibrated for the magnetic interference from the circuit board This article describes how you can use the high performance consumer accelerometers and magnetometers developed for the smartphone market to add a tilt compensated eCompass to your own microcontroller project for less than 5 henever a new high volume consumer electronics mar ket develops the semiconductor compa nies are never far behind providing excellent components at
148. oston returns this fall bigger and better than ever with four days of non stop technical training education and product evaluation across 5 summits all in one location September 17 20 2012 Hynes Convention Center Boston MA east ubmdesign com DESIGN East is comprised ct esc android designimed LEDS sensors DESIGN East is your one stop shop and the most efficient way to update your skills amp knowledge and discover the newest technologies amp products and it s your best opportunity to learn better amp faster design techniques SO you Can Create new solutions for your biggest challenges on the job Sharpen the skills you need now e 5 Summits with 120 educational amp training sessions conference tracks e Android Certificate Program e Visionary Keynotes e 150 Exhibitors showcasing the newest products amp technologies e 30 Sponsored Training Sessions amp DESIGN East Theater e Happy Hours Product Teardowns Giveaways and more Learn more at east ubmdesign com August 2012 Issue 265 Lk A pues by Shlomo Engelberg Israel Examining an I O Port The Internal Structure of an I O Pin with a Pull Up Resistor Understanding the internal workings of your microcontroller is essential This article details how a simple experiment enables you to clearly see the structure of pins with internal pull up resistors The experiment also enables you to see the effect of each of the PMOS transistors th
149. ound In order to mass produce phones that were dirt cheap yet simple and reliable the phone company figured out how to use a multi winding transformer to pro vide the both the isolation and the balanced unbalanced conversion in both directions usually with a single resistor and capacitor to provide the line matching As noted mod ern electronic phones use active electronics to achieve the same things As always the theory is simple but the practical implementations can get complicated Answer 2a If we restrict the discussion to unit vectors at various angles A the x com ponent is cos A and the y component is sin A and the correct magnitude is 1 Furthermore let s concentrate on angles between 0 and 45 then we know that both cos A and sin A are positive and that cos A gt sin A The absolute value and com pare operations provide the symmetry that covers the rest of the unit circle The approximation then gives the result Magnitude cos A sin A 3 Graphing this shows that this is most negative 0 943 at 45 and most positive 1 054 at approximately 18 4 The actual angle is given by atan 1 3 Can you show why The peak error is therefore 5 7 5 4 Answer 2b Yes One more multiplication operation gives a result with less than 4 error Magnitude 0 960433 x max x y 0 397826 x min x y This function is most negative at 0 and 45 and most positive at 22 5 The error is 3 96 This f
150. ounted on the side and two wires are pigtailed from the relay to wire nuts that control the AC power to the light The four conductor harness in red is the RS 485 line and 5 V power This installation certainly won t endear me to any building code inspectors but it works reliably putting networked devices all over the house This is the journey of creating some novel devices choosing a way to interconnect them and writing some pro grams in a variety of languages Although the initial goal was to come up with a reli able controller this became the opportu nity to create other devices to accomplish tasks as needed Along the journey I wrote a small PC Windows program that enabled me to send messages to the devices and moni tor their replies This was a big help with debugging devices and the code within them The Windows program still has some useful functionality but I am slow ly moving away from it and adding those functions to other devices All the code including the PC program is available on Circuit Cellars FTP site TALKING ON TWO WIRES The first question was how to commu nicate with a collection of little microcon trollers located around the house Wire less or wired Serial or parallel I chose wired as I didn t want to deal with using batteries or wall warts to power the remote units Also Wi Fi s complexity was a learning curve I didn t feel like undertaking at this stage And if the method was goi
151. our CIRCUIT CELLAR EeStror F editor cc microcontroller circuittembedded FPGA electricity EEPROM microcontroller Photo 1 shows the measured output of the cir cuit and you can see that the transition is indeed quite fast Now let s consider the case that 0 V was being input to P3 2 Here Q5 is used to ground the common output For half of each cycle it grounds the common output and for half the cycle it is cut off and enables the common output to float When Q5 is conducting the output of the circuit is approximately 0 V What happens when Q5 stops conducting At this point the output is low and it will remain low for a little while because of parasitic capacitances In this experiment an oscilloscope was used to measure the output voltage The oscilloscope itself has a small capacitance associated with it As long as the output is reasonably low only Q3 the smallest of the transistors conducts This will charge the parasitic capaci tances but it will take a while When the voltage at the out put rises enough that the inverter at the gate of Q4 sees a one the input to Q4 s gate will go to 0 V and Q4 will start conducting At this point the joint output will start increas ing faster Photo 2 shows the measured output of the circuit at a 0 to 5 V transition when P0 0 is being toggled Initially the output voltage rises linearly It seems that Q3 is saturated and provides a constant current to the paras
152. peripherals that use SD MMC Flash Card including SDHC SPI C or the general purpose digital I O interface The SB70LC Development Kit NetBurner security suite option includes SSH v1 v2 and SSL support PEE 4 S e 9N EWHAVEN DISPLAY iN h en ya gt Capacitive Touch TFTs 3 5 4 3 and 5 0 Capacitive Touch TFTs Built in controller with C interface 6H hardness gt million touches 5 simultaneous touches including lift zoom amp touch gestures 6mA at 3 3V supply 0 03mA sleep mode 60HZ refresh rate gt 100dpi resolution Newhaven Display International Inc now offers projective mutual capacitive touch TFTs with a built in C interface controller This allows for quick time to market while keeping your development costs low The design of the capacitive touch TFTs will be available in 3 5 4 3 and 5 0 size displays The capacitive touch panel is the ideal tool for enhancing the user interface experience with any TFT application These touch TFTs have multi touch ability and are extremely durable in most environments including withstanding water contact dust and grease Capacitive touch TFTs activate with either a bare finger or a capacitive stylus and have an excellent dragging performance For more information visit ci Contact us at 84 _omoplian MANAGER Embedded Systems Abound recently read on CNN com the transcript of an interview May 9 2002 with arachnologist Norman Platni
153. provided in the sensor datasheets and reproduced in Figure 1 Don t waste any time rotating the accelerometer or magnetometer pack ages to align their x y and z sensing directions to each other since this will be fixed later in software But do ensure the sensor board will not be mounted in the immediate vicinity of any ferromag netic materials since these will produce a constant additive magnetic field termed the hard iron field The most el and cobalt Non ferromag netic materials are all safe to use e g aluminum copper brass tin silver and gold The calibration process described later enables the esti mation and software subtrac tion of any hard iron field but it s good practice to minimize hard iron interference at the design stage Remember a cur rent trace will create a cylindri cal magnetic field that falls off relatively slowly with the inverse of distance so place the magnetometer as far away from high current traces as pos sible A 0 1 A current trace at 10 mm distance will produce a 2 uT magnetic field four times our 0 5 uT error budget only reducing to 0 5 uT at a 40 mm distance More detailed layout guidance is provided in Freescale Semiconductor s application note AN4247 Lay out Recommendations for PCBs Using a Magnetometer Sensor You ll be surprised at the number of features implemented in the latest consumer sensors i e freefall detection high and low pass filterin
154. put It generates the sum and difference of the frequen cies F1 and F2 applied to its two inputs On the nastier side they also generate plenty of spurious Signals in the form of n x F1 m x F2 For exam ple mixing a 10 MHz signal and a 100 MHz local oscillator will generate mainly a 110 MHz signal 100 10 110 and a 90 MHz one 100 10 90 but also stranger frequencies such as 280 MHz 3 x 100 2 x 10 or 130 MHz 1 x 100 3 x 10 and so forth Therefore a bandpass filter is usually used to select the output frequency required by the designer If you re not familiar with mixers you may want to go back and read my last article as this is kind of a follow up I ll use the example of a frequency mixer and amplifier circuit to intro duce some high level design methods and tools that could be more than use ful if you re working on RF designs Don t be confused I REQUIREMENTS Every project starts or should start with clear requirements Let s assume you re working on a long range wireless meter reading project for a European customer You have read the correspon ding regulatory documents like the REC ERC 70 03 European recommendation which provides frequen cy bands that can be used for short range license free applications on this side of the world So you discovered that the 169 4 to 169 475 MHz VHF band could be a great candidate This VHF band is dedicated to meter reading and asset tracking appli cations a
155. quad op amp provides the analog functions needed for the MOSFET tester Q1 limits the MOSFET s drain current to the value set by the Arduino PWM3 output through IC1C The 1 Q 10 W resistor near the center senses the actual drain current as a differential voltage that IC1B converts to a ground referenced value for the Arduino AO analog input and the IC1C current limiter drain voltage That means the standard graphs have current the independent variable along the Y axis Your math teachers told you to put the independent variable on the X axis but we re not going to flip our transistor graphs just for them The actual current will be the lower of the current limiter s setpoint and the MOSFET s i for that V and Vps because the current limiter cannot force more cur rent through the MOSFET than the tran sistor can conduct nor can the MOSFET draw more current than the limiter pro vides Each trace in Photo 2 starts at the Origin with the drain current limiter at 0 0 A and proceeds upward for succes sively higher current settings until the measured drain current exceeds the tester s 2 A limit or the drain voltage exceeds about 1 6 V Commercial transistor curve tracers have much larger current and voltage limits of course because they must test a wide variety of devices You can extend the limits of my circuit with more com plex hardware which I ll leave as a proj ect for the interested reader Hint there s www circui
156. r is your guide to a variety of engineering products and services Revolutionary new expandlO USB chip i USB Status A D l O SPI 12C Ideal for adding USB to sensors amp peripherals No drivers needed for Windows Mac Linux No microcontroller programming required Also check out our USB 232 USB to UART www hexwax com Buy fram Mouser amp Farnell Amazing Raa PIC programmer s i IE Most devices supported JT Tl ICSP SOTP amp copy limits 4 At at Digikey Wavy 1 amp Mouser TTT E www flexipanel com e USB 1 1 and USB2 0 compatible e Data transfer rate to 8 MB sec with D2xx driver o 2 1 x1 3 100 Low Cost Controllers with ADC DAC UARTs 300 I Os solenoid relays CompactFlash LCD Ethernet USB motion control Custom board design Save time and money TERN 1950 Sth Street Davis CA 95616 USA e gee INC Tel 530 758 0180 Fax 530 758 0181 ww tern com com sales tern com Disk On Chip ibaa cea KITS Ready for Delivery Protocol Analyzers Host _ Adapters Paun Multiplexers a am i ow wy f Battery Tea a Applications l LEARN fF F e Software From 16MB to 128MB M Available C Call 530 297 6073 Sales jkmicro com EXP LO RE Pe U OO BASIC ON BOARD Micro Computer Control K microsystems Inc ATRIA Technologies Inc International Orders Welcome www AtriaTechnologies com www mecc us com August 2012 Issue 265 www circuitcellar
157. r Elektor Books CDs DVDs Kits amp Modules and much more www elektor com shop SJektor Elektor USA 4 Park Street Vernon CT 06066 USA Phone 860 875 2199 Fax 860 871 0411 E mail order elektor com AVR Software Defined Radio This package consists of the three boards as sociated with the AVR Software Defined Ra dio articles series in Elektor which is built around practical experiments The first board which includes an ATtiny2313 a 20 MHz oscillator and an R 2R DAC will be used to make a signal generator The second board will fish signals out of the ether It con tains all the hardware needed to make a digi tal software defined radio SDR with an RS 232 interface an LCD panel anda 20 MHz VCXO voltage controlled crystal oscillator which can be locked to a reference signal The third board provides an active ferrite antenna This bundle also includes the assembled and tested FT232R USB Serial Bridge BOB PCB Signal Generator Universal Receiver Active Antenna PCBs and all components USB FT232R breakout board Art 100182 72 133 00 x 0 0 OF AndroPod With their high resolution touchscreens ample computing power WLAN support and telephone functions Android smartphones and tablets are ideal for use as control centres in your own projects However up to now it has been rather difficult to connect them to external circuitry Our AndroPod inter face board w
158. r module To measure the module s voltage you might employ a voltage divider across its output to measure a fraction of the output using an analog to digital converter ADC Module current can be measured by inserting a low resistance in series with the module s output The voltage drop across this current sensing resistor is proportional to the current Two analog digital chan nels can be used to obtain conversion values for I and V and cal culate a P value This tells you where you are One of the disadvantages of the inexpensive approach is that when the module s output is not optimum it may be Algorithm Switching signal Figure 3 This simple diagram shows how the PWM output of a circuit can control the active component switch in a boost circuit It effectively changes the load on the PV array and its operating point The controlling algorithm adjusts the PWM duty cycle based on the calculated power output from the measured V and I of the PV array Source Tung Y Hu A and Nair N Evaluation of Microcontroller Based Maximum Power Point Tracking Methods Using dSPACE Platform 2006 August 2012 Issue 265 Q 9 August 2012 Issue 265 Z D z 6 a Voltage V Figure 4 This power curve for a PV cell panel shows how the perturb and observe algorithm compares calculated power for a particular PWM duty cycle with the calculated power after the duty cycle has been changed The duty cycle is incr
159. r off The micro controller checks the events in the EEP ROM against the current time every minute If there is a match it determines if the event is needed It does this by examining the condition of the relay and will change it if needed If the relay is already in the position requested it won t take any action The code that handles all the reads and writes to EEPROM is in the module save_ee asm The main loop also performs the poll for the push button and does some debouncing which I performed back ward For decades electronics people have been taught that to debounce a contact you to watch for an action then wait a while and see if it s still valid Essentially it s a low pass filter Howev er I took a front loaded approach which makes the button slightly more responsive In the byte that monitors the state of the module a flag reflects the state of the button bit high or low The software responds to any change and then starts a debounce timer The timer simply prevents the module from reacting to any change for a determined amount of time Furthermore since I am August 2012 Issue 265 UJ 7 August 2012 Issue 265 Enter debounce routine Is the debounce counter zero Does the button state match the stored state Yes Return Is the button pressed Yes Toggle the relay Store the button state Increment the debounce counter Figure 3 The debounce flowchart First c
160. rating temperature range and flexible I O connectivity RO Features e Atmel AT91SAM92635 ARM Processor l b Powered by On board Serial Digital and By Windows Ap Analog O E Embedded e Compatible with Windows Embedded CE 6 0 and Linux Rugged Mechanical Construction Compact Designs as Small as Ame E 40 Ce a Operon Temperature Range Custom RISC solutions available contact us for more information sealevelcom gt sales sealevelcom gt 864 843 4343 wD Learn more about RISC computing solutions at sealevel com cir risec or scan this QR code with your smart phone 1986 2011 Sealevel Systems Inc All rights reserved August 2012 Issue 265 N N August 2012 Issue 265 NAN The Arduino Project originated in Ivrea Italy Have you used it If so what do you think GUIDO Yes I ve used it and I use it often I became an Arduino fan after the aforementioned sensor board project Before then I was very skeptical I love all the openness philos ophy and the community behind Arduino It is an idea out of the ordinary an international collaboration and I m proud it is an Italian idea It is not so powerful in hardware but you can eas ily solve most of your electronics issues with it I ve read a lot about Arduino on many sites and magazines such as Wired Italia it was on the first published number I ve also personally met Massim
161. re costs 389 99 Oscium www oscium com ULTRA LOW POWER ULTRA COMPACT SENSOR HUB MCU FOR SMARTPHONES The ML610Q792 Sensor Hub is a small ultra low power microcontroller designed for the integrated low power control of multiple sensors in smartphones The microcontroller enables the deployment of new cloud based features and services in smartphones that would otherwise be restrictive due to increased power consumption It logs user environment data and detects user activity without disturbing the host processor The ML610Q792 s low power consumption prolongs battery life and enables support for wireless communication in compact products e g pedometers and smartphone accessories The ML610Q792 microcontroller is equipped with LAPIS Semicon ductor s high performance 8 bit RISC core and 16 bit coprocessor for arithmetic calculations Dual interfaces enable both sensor connection and connecting to the main chipset The ML610Q792 microcontroller s additional features include an ultra compact 48 pin wafer level chip scale package WL CSP form factor 3 1 mm x 3 mm package for small designs comprehensive software support including sensor driv ers and key algorithms the ability to control multiple sensors installed on smartphones low power consumption 0 6 WA or less in HALT mode and built in 64 KB flash ROM A development board containing multiple sensors and drivers is pro vided with a software development kit SDK that
162. re within the normal range for a PN junction Also note the relationship is highly nonlinear A quick power calcu lation of the two points just discussed results in zero for each Maximum voltage x zero current zero power Maximum cur rent x zero voltage zero power Makes sense right This means that all power output falls somewhere between these two points The power output can be calculated at every point on each curve in Figure 2 On any particular curve max imum power occurs on the knee of the curve as the fairly con stant I value begins to decrease Since the voltage goes up as the current goes down and vice versa the point for maximum power is a happy medium where the two values are both less than maximum Note the almost vertical line drawn through the knees of each curve This is each curve s maximum power point The relationship between I V and maximum power point MPP varies with the amount of light falling on a particular cell In past articles I ve discussed how the orientation of the panel to the light source sun will greatly affect the panel s output Maximum output can only be obtained when the cell is perpen dicular to the irradiance source Any deviance off axis will degrade the effective maximum conversion which for most of today s cells is still less than 20 This discussion does not include cell positioning but merely how to make the best use of www circuitcellarcom CIRCUIT CELLAR whate
163. rests At Niagara College Mark has taught embedded systems courses employing both normal PIC processors as well as DSPs He said he also moonlighted as a professional engineer building embedded power control systems primarily three phase and controlling loads of up to 30 000 hp Mark s current full time teaching load consists entirely of courses on laser engineering His book Fundamentals of Light Sources and Lasers was published in 2003 Wiley Interscience Mark said he has two older solid state pinball machines circa 1980 and 1991 that he keeps running He also has a small collection of classic mini and micro computers including PDP 8s PDP 11s and several Ohio Scientific 6502 based machines Most Recent Embedded Tech Related Purchase Oddly enough a fluorescent desk lamp with a powerful magnifier With chip packages shrinking prototyping has become more challenging often requiring a chips to be mounted on an adapter even for basic prototyping Mark said Mark s most recent actual hardware acquisition was an ICD 3 debugger j A which has proven quite fast for debugging when viewing large blocks of registers Although he has a decently equipped work shop Mark has homebuilt equipment including his logic analyzer which is actually based on a 1995 design presented in Circuit Cellar Mark s has been updated several times and now sports a 50 msps rate and a native USB inter face which u
164. ry if you need to quickly build something very simple is not so easy with standard Microchip tools You have A homemade shield for an Arduino mega used to create a subsystem that con trols batteries and power supply status for Guido s forthcoming robot N 0 Using a WiFly shield to connect an Arduino to the Net no reliable already done libraries to configure the peripherals that often differ enough among devices You spend most of your time just searching for that register s bit that will solve your problem There is a huge amount of very good documentation but you have to spend a lot of time In my opinion this is one of the reasons for the Arduino suc cess Sometimes we are lazy or we need short time to market even for a hobbyist being able to obtain something quick but not dirty even if not extra optimized So in some more relaxed projects I ve used some of the many xx ino boards At some point when I ve substituted any of my old friends SN74xx or NE555 with an MCU of whichever type I wanted to do the same also for my even older analog friends op amps When I need some analog circuit amplifiers filters and similar it is easier to use a PSOC in place of a bunch of transistors op amps capacitors resistors and so forth The modification of a diagram or some line of codes on an IDE is much more friend ly than soldering I ve started studying the amazing world of GPS in many of its details I
165. s Gy tan od G 2 tan 0 ow 3 Gy o cosd The range of the roll angle is 180 to 180 so the C atan2 function is used in Listing 1 to calculate 8 The pitch angle 8 only varies between 90 and 90 so the standard C atan function is used in Listing 1 to calculate 8 Don t try to simplify the algebra by noting that G sin 8 in Equation 1 and computing 8 sin G Even without linear acceleration sensor noise will make G occasionally go outside the range of 1 g to 1 g making the arcsine calculation nonsensical The arctangent calculations in Listing 1 are stable in comparison since the atan and atan2 functions can take any argument from o0 to The next step is to program up Equations 2 and 3 remem bering that most programming languages return angles in radi ans requiring a multiplication by 180 z or approximately 57 3 to convert to degrees Place the eCompass flat on the table and check that the calculated roll and pitch angles are approxi mately 0 Rotate the eCompass upward and check that the computed pitch angle is positive reaches 90 when pointing vertically upward and then decreases to 0 when the eCom pass is inverted Repeat with the eCompass pointed slightly downward and check that the computed pitch is negative Then apply a positive roll rotation by raising the left side of the eCompass and check that the computed roll angle is positive passes through 90 when the eCompass is on its righ
166. ses a Microchip Technology PIC18F4550 That analyzer has proven invalu able when prototyping and debugging MCU based projects he said Current and Recent Projects Mark is work ing on a TEA laser controller featuring a Microchip PIC18F452 MCU for the laser lab at the college Programmed in Microchip C this device runs as a state machine and controls the safe ty aspects of the laser e g interlocks as well as the voltage on the main capacitor bank in the laser which can charge to 40 kV and can store up to 200 J of energy Mark s most recently completed project see the nearby photo is a digital oscilloscope This project was designed for students to complete in a college workshop course in which they manufacture the board and case mount components including many SMT packages and test debug the completed proj ect The hardware was designed by a colleague while Mark produced the firmware Written in MPASM and running on a Microchip dsPIC33FJ MCU the scope features two channels and can sample at 1 msps Mark said the design is very simple Aside from the MCU with on chip ADC it uses only a graphical LCD and several op amps for signal conditioning Thoughts on the Future of Embedded Technology Like most engineers Mark s wish list for an embed ded device includes more memory more MIPS and more peripherals Manufacturers have delivered over the past few decades Mark said He has seen many changes since his intr
167. shak ing the eCompass It should be no surprise that Equation 1 has no dependence on the yaw or compass heading angle w All accelerometers are unaffected by rotations about a vertical axis Of course if accelerometers could measure rotation about the vertical grav itational field we would not need a magnetometer to compute the compass heading Equation 1 can easily be solved for the roll angle and pitch angle 8 from the x y and z accelerometer channel readings G CIRCUIT CELLAR www circuitcellar com The RL78 Green Energy Save energy improve Challenge ends efficiency and make the world a greener place Develop an innovative low power design solution using Renesas RL78 MCU and you could win 8 000 plus a trip to Renesas DevCon Don t delay The RL78 Green Energy Challenge ends soon amp pe n For complete details visit BBR BGH HRE www circuitcellar com RenesasRL78Challenge SEEFES EEEFES EERTE a a T T T EE E o ef 2 ae b u a ee hen ee ae amp 4 i ee ee ee ee bs ee 2 2 oo 1 Pent am ci Tide es EN Sann N NNN i Sh TELL prp 4 i IET J eE h og n Sar In association with Elektor and Circuit Cellar f F An ey RenesasAmerica www facebook com renesasamerica August 2012 Issue 265 Keir Figure 4 Distribution of magnetometer measurements under arbitrary rotation G and G Simple algebra give
168. siastic electronics designers of all ages and backgrounds GUIDO The scene is very confused right now The interest in robotics much more than just electronics is growing very quickly and a lot of different facts pop up every day One com mon element is actually the schools A lot of teachers are involving more and more students on these projects They understand the potential of robotics The appeal it has for young people is very useful to stimulate them in a lot of differ ent disciplines It s easier to explain math physics science N 0 and a lot of other things by immediately using that theory in a real practical robot Some university students are showing the teachers how they can teach to the younger students Those projects are new for most of the current teaching staff and they are putting in a lot of personal effort to be up to date I ve talked with many teachers one uses his own garage to receive the students in the afternoon and build their robots for an upcoming competition The school structures have no money to let the laboratories open after hours Some association started organizing Mondo Digitale is a group of people who are trying to define the way schools can proceed The Romecup 2012 was crowded with a lot of stu dents of all ages most of them very enthusiastic about robots It was amazing to listen to a very young boy who precisely explained to me everything about sensors actuators an
169. software used in embedded applications e g programming languages RTOSes file systems protocols embedded Linux and algorithms Internet amp Connectivity Applications that deal with connectivity and Internet enabled systems e g networking chips protocol stacks device servers and physical layer interfaces Measurement amp Sensors Projects and technologies that deal with sensors interfaces and actuators e g one wire sensors MEMS sensors and sensor interface techniques Programmable Logic Projects that utilize FPGAs PLDs and other program mable logic chips e g dynamic reconfiguration memory and HDLs Robotics Projects about robot systems devices capable of repeating motion sequences and MCU based motor control designs e g mobile robots motor drives proximity sensing power control navigation and accelerometers Signal Processing Projects and technology related to the real time processing of signals e g DSP chips signal conditioning ADCs DACs filters and compar isons of RISC DSP VLIW etc Wireless Communications Technology and methods for going wireless e g radio modems Wi Fi IEEE 802 11x Bluetooth ZigBee IEEE 802 15 4 cellular infrared IrDA and MCU based wireless security applications FEATURES Miniature Accelerometers by Mark Csele FAT Cache for Fast SD Card Access by Kerry Imming MCU Based Environmental Data Logger by Brian Beard COLUMNS Flowcharting Made Simple by
170. source Using nonatomic operations on shared resources can lead to the generation and use of noncoherent data in your systems CASE STUDY 1 SHARED MEMORY After a brief amount of preplanning for this arti cle I was called into a meeting to discuss a problem CIRCUIT CELLAR www circuitcellar com Maxim 71M6533 Our system Compute engine Figure 1 Our system used a SPI bus to talk to a Maxim Integrated Products 71M6533 Teridian energy metering IC Both systems access this shared memory interface at a 1 Hz rate we were having during the alpha testing of a new product The problem manifested itself in one of our embedded systems by reporting bad data to its host The system was measuring ener gy usage in kilowatt hours and reporting this data to a remote host Our interface contained a Maxim Integrated Products 71M6533 Teridian energy metering IC that we talked to over a SPI bus This is a powerful energy monitoring chip that can be used to measure power in three phase electrical systems This chip was programmed by another vendor to provide a memory interface we accessed over SPI Both subsystems access this shared memory interface at a 1 Hz rate see Figure 1 After some analysis we concluded that the problem could be caused by a classic nonatomic concurrent operation Let me explain by oversimplifying the details while maintaining the essence of the problem We read cumulative energy usage created by the Maxim energy
171. ss gt Test the message for T Test the Message Test the message Test the message Test the message Test the message discards the remaining bytes When it sees an EOM byte appear it sets a flag to indicate a new message has arrived This flag is detected and acted upon by the main program loop The other interrupt is handled by timerasm which simply increments the seconds and the minute and hour if needed every time the timer expires Because the counter is 16 bits and the oscillator is 32 768 Hz the timer would normally fire every 2 s By adding 32 768 Hz to the timer the timer inter rupts are accelerated to every second This is accomplished by simply setting the high bit of the Timer 1 counter Meanwhile back in the main loop the code tests to see if the time has changed or if a message has arrived If a mes Sage does arrive it is processed by the module commands asm In here it com pares the address of the message to its own address or to the universal address and discards the message if they don t match up It then compares the com mand byte to the commands it under stands The basic commands were previ ously discussed Table 3 shows the spe cialized commands the unit understands Listing 1 shows how the commands are processed The program stores events in EEPROM which is simply an entry of the time something needs to occur i e whether to turn the relay on o
172. t controls the MOSFET s tempera ture then show how MOSFETs behave in a 0 to 50 C range l Ed Nisley is an EE and author in Poughkeepsie NY Contact him at ed nisley ieee org with Circuit Cellar in the subject to avoid spam filters PROJECT FILES To download the schematic and PCB files go to ftp ftp circuitcellar com pub Circuit_Cellar 2012 265 RESOURCES Gnuplot www gnuplot info E Nisley MOSFET Channel Resistance Theory and Practice Circuit Cellar 263 2012 SOURCES Arduino Duemilanove Arduino http arduino cc CadSoft Eagle PCB Software www cadsoftusa com MAX4544 SPDT analog switches Maxim Integrated Products www maxim ic com August 2012 Issue 265 Ul 7 HE DARKER SIDE by Robert Lacoste France System Level RF Design Designing a radio frequency system even using precharacterized modules or components can be a daunting task without the proper methodology and tools This article illustrates how system level simulation tools can ease the process elcome back to the Darker Side In my last article Radio Frequency Mixers Circuit Cellar 263 2012 I discussed the basics of frequency mixers In a nutshell these strange devices somehow translate a signal up or down in frequency thanks to the nonlinear effects of their internal diodes More precisely a mixer has two inputs one signal input and one so called local oscillator input and one out
173. t edge and finally reaches 180 when the eCompass is flat but inverted Repeat the roll test by lowering the left side of the eCompass and check that the compute roll angle is negative If you find N N the angles are swapped or negated from what is expected you ll need to return to the accelerometer axis alignment procedure CALCULATING THE COMPASS HEADING ANGLE In a similar manner as Equation 1 the magnetometer read ing B can be modeled as the sum of the rotated geomagnetic field plus the hard iron interfering field vector V to give B cos B By Rx 0 Ry 8 R y B JO V 4 B sind If you subtract off the hard iron interference V from both sides of Equation 4 and premultiply by the inverse roll and then inverse pitch rotation matrices you obtain cos6 D V R w B 0 B siny cos R 6 R o B V sind sind B V Bx Vx cos By Vy sin sino B V sin cos By Vy cos B Vz sing Bx Vx sind By Vy cos sind B V cos cos gt lt lt 5 The x and y components of Equation 5 are shown below in Equation 6 B cosy cosd Bx Vx cos By Vy sin sind B v2 6 sin cosh B siny cos By Vy cosd B Vz sind Taking the ratio of the y and x components in Equation 6 gives the tilt compensated compass heading angle w as B V cos B V sind n Ha a
174. t know something about electronics anyway On my workbench you can see at least three disci plines from left to right mechanics electronics and programming But they are not enough You require physics math and more The third way is not the eas iest one but it s the one with the most satisfaction NAN Are you currently working on or planning any robotics related projects Can you tell us about them UJ A glimpse at Gudio s workbench reveals at least three disciplines from left to right mechanics electronics and programming uS Signals U Light left gy Y TE 3 ieee A Light right ig ig driver driver 9 E 9 Lu m Front left He G Front right lt T g High level n supervisor Sonar Back left Back right A block diagram of the boards that will be inside Guido s outdoor robot CIRCUIT CELLAR www circuitcellarncom The design phase of Guido s Lino robot a 3 D model created with Google Sketchup GUIDO Yes I am Once I wrote in a forum I ll never build a robot that cannot fit in a shoe box This was because my lab is in an apartment and I have limited mechani cal capabilities Luckily the human mind can change an idea during its lifetime After my indoor studies were over I started thinking about an outdoor robot This must be simple cheap enough and realizable by anyone who is patient enough to follow my explanations To make a full suspended four wheel drive
175. t sen sors solutions and technologies Now I m ready for a further step outdoors NAN You wrote another robotics related article in 2010 titled A Sensor System for Robotics Applications Circuit Cellar 236 Here you describe adding senses sight hear ing and touch to a robotics design Tell us about the design which is built around an Arduino Diecimila board How does the board factor into the design GUIDO That was the first time I used an Arduino I ve always used PICs and I wanted to test this well known board In that case I needed to interface many I C analog sensors and an CIRCUIT CELLAR www circuitcellarcom An interface between PIR sensors and an Isadora program I C I O expander I didn t want to waste time configuring peripherals All the sen sors had 5 V I O The computing time constraints were not so strict Arduino fits perfectly into all of these prerequisites The learning curve was very fast There was already a library of every device I ve used There was no need for a voltage level translation between 3 3 and 5 V Everything was easy fast and cheap Why not use it for these kinds of projects NAN You designed an audio sensor for a Rino robotic platform Sound Tone Detection with a PSoC Part 1 and Part 2 Circuit Cellar 256 257 2011 Why did you design the sys tem Did you design it for use at work or home Give us some exam ples of how you ve used the sensor G
176. t talk back to the broadcaster because the broadcaster is always asserting its signal on the transmission line Implementing a true bidirectional communication requires implementing return paths which would mean adding two new wires for each path This quickly complicates the communica tion wiring An enhancement to the one way topology of RS 422 is the specification of RS 485 RS 485 uses the same differential sig nal RS 422 uses however it enables multiple devices to connect to the same pair of wires with no one unit asserting a signal on the line until it has something to say In order to do this each node uses a tristate line driver and they all keep their output in high impedance mode until they re ready to talk WHICH WAY IS UP The two wires that make up the bus used to carry the differential signal are called for lack of anything more interesting A and B While idle the microcontroller keeps the serial output level at a mark condition which is a logic high state and transitions to a Space condition or a logic low to indi cate the start bit The datasheet for National Semiconductor s DS1487 RS 485 transceiver indicates that when the input logic is high the output A becomes high and B becomes low Of course the opposite applies when the input logic is low The RS 485 require ment is that the differential between A www circuitcellar com CIRCUIT CELLAR Figure La Here is the basic RS 485 line with no
177. tcellar com CIRCUIT CELLAR a reason why curve tracers have big fan cooled heatsinks The purple traces in Photo 2 plot the MOSFET drain resistance computed from Vp I at each measurement point The traces for the lowest resistances around 100 mQ for the BUZ71A correspond to the steepest blue traces You can match their endpoints with a vertical ruler I computed the resistance in the tester s firmware but many plotting programs can produce that quotient from the raw voltage and current samples The schematic in Figure 1 shows the key parts of the MOSFET tester s circuitry An Arduino microcontroller provides all the control signals as well as the analog outputs and inputs through its normal header pins Although the Arduino inter face doesn t appear here you can down load the complete CadSoft Eagle schematic and PCB layout files from the Circuit Cellar FTP site ARDUINO ANALOG I O Although the Arduino has six analog outputs those pins don t produce true analog voltages a peculiarity that often trips up new users Instead each one produces a digital PWM signal that requires a low pass filter to extract its DC value Unfortunately the default Arduino startup code sets a fairly low PWM fre quency that requires inordinately large capacitors to produce low ripple from the usual single pole low pass RC filter The tester uses the PWM3 output to set the drain current limit and PWM11 for the gate volt
178. tening to the data will become confused trying to find a message s start or end I needed an alternate way to represent integer values when sending payload data across the line Following the SOH byte is the device address I wanted to talk to and the device address of the message it came from This is so that any time one unit 32 768kHz C5 X1 27p m C3 0 1L C6 J 5 DS1487 1 optional D1 ZN 1N4747 ui D2 M 1N4747 O C2 16u 5V O 8 Low RX High TX NZ W A 12 RAO ANO E RA1 AN1 7 RA2 AN2 RA3 MCLR Command Payload Purpose S none Used to request the device to report its status The status returned will have different meanings depending on the device being interrogated Request a report of the reasons for MCU reset stored in the EEPROM This is helpful to determine if a device is undergoing excessive watchdog resets or brownouts none hours minutes seconds Request the device clear all EEPROM counts of reset reasons _ defined above Request the device to set its time to this value in 24 hour format Devices that do not have internal clocks can ignore this command Table 2 The commands used to define what communication can be used by all devices wanted to talk to another the target unit could easily build a return message by just swapping the two bytes Each of these addresses only needs to be 1 byte Removing the two marker bytes as address possi
179. tions about the positive x y and z axes respec tively Photo 1 also shows the earth s gravitational vector which points downward with magnitude of 1 g or 9 81 ms and the earth s geomagnetic field vector which points downward from horizontal in the northern hemisphere by the inclination angle to give a horizontal component B coso and a downward component B sind Based on how your eCompass housing will be held you should be able to assign the compass pointing direction or x axis the downward or z axis and the y axis which should point to the right to complete a right handed coor dinate system g 3 8ims Photo 1 The aerospace north east down coordinate system j 0 AXIS ALIGNMENT amp MAGNETIC CALIBRATION You now need to align the sensor data to the aerospace coor dinate system As with all work with magnetometers this should be performed on a wooden table well away from any lab oratory power supplies or steel furniture Place the eCompass flat and upright so the z axis points downward and is aligned with gravity Check that the accelerometer z axis reads approx imately 1 g and the x and y axes are near 0 Invert the eCom pass so its z axis points upward and check that the z axis now reads approximately 1 g Repeat with the x and y axes point ing downward and then upward and check that the x and y axis accelerometer readings are near 1 g and 1 g respec tively It s not important if the accelerom
180. u 1 x LB inches in sizet XPROTOLAB 49 y IPHONE SCOPE SMHZ Mixed signal Se scope adapter for the IPhone Pad and Pod Touch The FREE IMSO 104 app is avaiable for COW nIOad from the Ape App Store IMSO 104 297 99 25MHZ SCOPE Remarkable low Ta color TFT LCD and FREE carry casel sps6062 359 1OOMH2 SCOPE _ 1GSa s benchscope f FFY with Ise memory a s amiU Bport mREE a EET _ECOpE Carn case New super low price DS1102E 399 ch iooMsa s analyzer USB 2 0 amd dM samples storage per channel with advanced triggering matn Functions cs328A 1359 HANDHELD 20MHZ Fast accurate nangneid 100 M S Sarmnple rate 3 5 In color TFT LCD Mour battery ire FREE rugged impact resistant case HDSIOZIM Q Mixer ADE 1LH LO RF 0 5 to 500 MHz IF DC to 500 MHz At 169 MHz and with LO 10 dBm Conversion loss 5 2 dB 10 dBm IP3 19 54 dBm IF Input oo VCO JTOS 400 200 to 380 MHz set to 214 4 MHz Pu 11 dBm Harmonics 25 dBc Band pass filter SXBP 169 Passband 164 to 174 MHz Loss at 169 4 MHz 2 dB Rejection at 214 MHz 40 dB RF Amplifier GALI 84P at 169 MHz Gain 25 6 dB P1 dB 21 9 dBm IP3 37 6 dBm RF Output Figure 3 This block diagram shows the proposed architecture for the sub circuit specified in Figure 1 The IF signal is first translated from 45 MHz to 169 4 MHz thanks to a
181. uch cell phones The PPC E4 is small enough to fit in a 2U rack enclosure Apply power and watch either the Linux X Windows or the Windows CE User Interface appear ona vivid 4 3 color LCD Interact with the PPC E4 using the responsive integrated touch screen Everything works out of the box allowing you to concentrate on your application rather than building and configuring device drivers Just Write It and Run lt www emacinc com panel_pc ppc_e4 htm Phone 618 ia i i M O a Web www emacinc com NI relationship to its output voltage If you can control the I you can control the V So let s take a closer look at boost circuitry ENERGY BOOST Boost converters use the magnetics of an inductor to store energy that can be released into a load Figure 3 shows an inductor L in series with a diode D between the PV module and a load R Assuming the PV module is in sunlight in this steady state the load is setting the PV module s current I and the voltage V If a switch is introduced between the inductor and the diode the inductor can be placed directly across the PV module by turning on the switch Current flows through the inductor and it looks like a heavy load Energy is stored in the inductor in the form of magnetic energy During this time the diode is reverse bias so current can t flow out of the load including a large capacitor C momentarily supplying the load s requirement When th
182. ur community And find thousands of technical documents videos amp tools all in one source Engineering expertise starts at Newark element1 4 ETAT EENET HOW MAY WE HELP YOU TODAY TECHNICAL SUPPORT 1 877 736 4835 COMMUNITY element14 com WEBSITE newark com LEARN MORE newark com together August 2012 Issue 265 Figure 2 Accelerometer axis alignment points correctly aligned but as with the accelerometer correction Swap and negate the measurements from your three magne tometer channels as needed until correctly aligned and then lock down this part of your code A lot can be learned by closely looking at the measure ments in Figure 3 The x and y magnetometer measure ments lie on a circle with radius of approximately 25 uT enabling us to deduce that the horizontal geomagnetic field is approximately 25 uT But the measurements are offset from zero by the magnetic hard iron interfering field which results from both permanently magnetized ferromagnetic materials on the circuit board and from a zero field offset in the magnetometer sensor itself Consumer sensor manufac turers long ago realized it was pointless to accurately cali brate their magnetometers when their target market is Smartphones each with a different hard iron interfering field The magnetometer sensor offset is therefore calibrated together with the circuit board hard iron magnetic field For now simply note that the x and y
183. ur is not significantly present at the output of the mixer so it must be generated by the final GALI 84 amplifier itself We are probably too close to its compression point Other significant spurs are visible at 214 4 and 259 4 MHz The former is the leakage of the local oscillator which is not attenuated enough by the filter as it is quite close to its pass band The latter is the second mixing term 214 4 45 259 4 which is also not attenuated enough IMPROVEMENTS What should you do now The first action is to check for actual problems In fact the regulatory limits are based on the level of radiated spurs by the product so the antenna is part of the system As the antenna will be tuned for the desired 169 4 MHz frequency its efficiency will be lower at the other spurious frequencies reducing their actual impact However in that case I m afraid this will not be enough as the gap is significant You will then have to iterate the design to optimize it The easy way would be to add a second band pass filter at the output of the amplifier to filter out anything unwant ed This solution is usually too costly but if you are not cost constrained this will drastically reduce the spur levels with a limited design effort Checking the effects of such a design change is where using a simulation tool shines I did itin 10 s on VSS The result is shown in Photo 5 As you can see the output spectrum is now very clean and fully within t
184. usiasts with developed programming skills or with a strong interest in image processing technology ona PC Written using Microsoft C and utilizing object oriented practices this book is acomprehensive and practical how to guide The key focus is on modern image processing techniques with useful and practical application examples to produce high quality image proces sing software All code examples used are availa ble free of charge from the Elektor website 307 pages ISBN 978 1 907920 09 7 57 30 Circuits ideas tips and tricks from Elektor cD 1001 Circuits This CD ROM contains more than 1000 circuits ideas tips and tricks from the Summer Circuits issues 2001 2010 of Elektor supplemented with various other small projects including all circuit diagrams descriptions componentlists and full sized layouts The articles are grouped alpha betically in nine different sections audio amp video computer amp microcontroller hobby amp model ling home amp garden high frequency power supply robotics test amp measurement and of course a section miscellaneous for every thing that didn t fit in one of the other sections Texts and componentlists may be searched with the search function of Adobe Reader ISBN 978 1 907920 06 6 55 70 Awhole year of Elektor magazine onto a single disk DVD Elektor 2011 The year volume DVD CD ROMs are among the most popular items in Elektor s product range This DVD RO
185. ustrial touch panels with all the features of a moder PC for the most feature rich user expenence ATOM N270 1 6GHz CPU 2GB RAM 32068 HDD SD Card Support Color Display 1024 x 768 PS 232 Ethernet USB Audio Out Windows XPe xP Pro C Programmable Modular Industrial Controller fe BASIC with LADDER LOGIC CONTROLLER Integrated CUBLOC Controller and I O Board CEB c The CB210 is an inexpensive integrated CUBLOC controller and VO board programmable in both BASIC and Ladder Logic VO Ports x20 10 bit A D x6 PW x3 RS 232 xl BOK Program Memory 3K Data Memory Industrial Touch Panel PC with ATOM Processor COMPILE TECHNOLOGY 1175 Chess Dr Suite F FOSTER CITY CA 94404 call 1 888 9CUBLOC toll free 1 888 926 2562 email sales camfletach com gF l j ni _ Tt lt T i aa ee e Se etl a m ino a _ b i Fi e ae oe i MOACCIN The MOACON is a modular C programmable ARM based automation controller designed for industrial environments Choose from a diverse feature rich selection of modules including Digital 1 0 Analog 10 RS 292 085 Motor Conia Ethernet High speed Counter amp PWH The CUSB is 3 Series of compact CUBLOC integrated industrial T O boards programmable in both BASIC and Ladder Logic RORE Program Memory JKE Data Memory DC 24 Inputs lt 9 16 A D Inputs x2 6 Relay Outputs 6 16 PWM xi amp High speed Counters 0 2 RS 232 485 xi 2 CUSE
186. ve found some free libraries to do all the not so simple calculi for distance bearing and so on but I needed a processor more powerful than a dsPIC to execute in real time all that trigonometric math An mbed gave me the power of an ARM with the easiness of an Arduino once again with free IDE and compiler In conclusion I always prefer my first love PICs but there are so many other devices that I can find the one that best fits any project on my mind Furthermore because this is a hobby for me and I ve got a lot of knowledge from many contributors on magazines web sites and other papers I like to share back what I ve learned Using different solutions give me the opportunity to do this on the same media paper website or forums All of my projects are publicly available Thanks again Internet CIRCUIT CELLAR www circuitcellarncom ROUTE FASTER E s WITH PROTEUS PCB DESIGN Our completely new manual router makes placing tracks quick and intuitive During track placement the route will follow the mouse wherever possible and will intelligently move around obstacles while obeying the design rules All versions of Proteus also include an integrated world class shape based auto router as standard pecan rin DESIGN SUITE Features Hardware Accelerated Performance Unique Thru View Board Transparency a Over 35k Schematic amp PCB library parts Integrated Shape Based Auto rout
187. ver irradiance is available to the cell Other factors beside irradiance can also affect each cell s MPP the manufacturing process control and the temperature under use While the manufacturing can affect the overall effi ciencies even cell to cell the working temperature has the most impact For a given irradiance as the temperature increas es the I increases and the V decreases With the MPP constant ly varying due to all these factors how can you ensure you re operating at the MPP at any time SIMPLE OBSERVATIONS A cell output voltage around 0 5 V is not very useful so PV cells are often strung together into modules by adding cells in series to create higher voltages and in parallel to create higher currents The least expensive way to trickle charge a battery may be grouping a number of cells together such that their out put is larger than the battery voltage that needs to charge A series resistor could be sized to limit the maximum trickle cur rent Depending on the number of cells in the module this would only charge the battery when the module s output was greater than the battery voltage This is not efficient by any means but there is essentially zero cost beyond the price of the cells However because the cells costs are relatively high using them efficiently might actually be less expensive in the long run Knowing where you are is always a good place to start You must be able to measure the I and V of the sola
188. wisting motions for a few sec onds record the minimum and maximum magnetometer read ings and compute the hard iron calibration from their average using Equation 9 max Bx min B v min By 9 max B min Bz max B Equation 9 completes the information needed in Equation 7 to compute the compass heading w Readers interested in a more sophisticated algorithm for least squares fit to the hard iron calibration should refer to Freescale Semiconductor s Application Note AN4246 Calibrating an eCompass in the Presence of Hard and Soft Iron Interference and visit Freescale s eCompass website for additional C source code and details The entire eCompass with tilt compensation is provided as C code with just 15 executable lines in Listing 1 Readers wishing to add a digital low pass filter to reduce jitter on the computed angles should take care to use modulo 360 arithmetic to avoid averaging angles jittering between 179 and 179 pointing south to 0 pointing north Freescale s Application Note AN4248 Implementing a Tilt Compensated eCompass Using Accelerometer and Magnetometer Sensors contains further details and C source code for those interested al Mark Pedley mark pedley freescale com has a Physics degree from Oxford University and now works on sensor fusion algorithms for Freescale Semiconductor in Tempe Arizona RESOURCES Asahi Kasei Corp www asahi kasei co jp asahi en Freescal
189. workstation The Man Behind the dsNavCon Design An Interview with Guido Ottaviani Guido Ottaviani worked as an analog and digital developer for several years for an Italian communications company Today he is a technical manager for a large Italian editorial group In his spare time Guido designs autonomous robots shares his experiences with other self professed electronics addicts and evangelizes robot design In June Guido and I discussed his fascination with robotics his favorite microcontrollers and some of his innovative projects such as the dsNavCon system Nan Price Associate Editor GUIDO The very first one was not tech nically an MCU that was too early It was in the mid 1980s I worked on an 8085 CPU based board with a lot of peripher als clocked at 470 kHz less than half a megahertz used for a radio set control panel I was an analog circuits designer in a big electronics company and I had started studying digital electronics on my own on a Bugbook series of self instruc tion books which were very expensive at that time When the company needed an assembly programmer to work on this board I said Don t worry I know the 8085 CPU very well Of course this was not true but they never complained because that job was done well and with in the scheduled time I learned a lot about how to optimize CPU cycles on a slow processor The pro gram had very little time to switch off the receiver to avoid d
190. y using nonatomic operation in concurrent threads and time of check to time of use TOCTTOU n the first part of this article series Concur rency in Embedded Systems Part 1 An Intro duction to Concurrency and Common Pitfalls Circuit Cellar 263 2012 we defined concurrency as a com mon feature found in embedded systems We saw that concurrency takes place any time two or more activities can happen in the same time segment We saw that these concurrent operations only cause prob lems when they interact with each other We looked at some common pitfalls that happen with such systems and discussed in thin slices how priority inversion can happen and what you can do to prevent it As I sat down to write this article I thought about the other common pitfalls I mentioned last time and asked myself Which one do I want to talk about this month I decided to discuss how nonatomic operations wreak havoc in our embedded systems and how to prevent the chaotic situation I ll also discuss a somewhat related issue time of check to time of use TOCTTOU DEFINITIONS Let s start with some definitions An atomic oper ation is any operation that cannot be interrupted by another operation In a microprocessor most sin gle assembly instructions cannot be interrupted until they complete their operation If you design embedded systems you should know which oper ations are atomic whenever you are operating on a shared re
191. y is used to gather energy from the solar cell using the MPP algo rithm b This circuitry was implemented to provide fast charging capabilities for depleted batteries using a large solar cell This was later determined unnecessary A much smaller solar cell can be used if this requirement is relaxed meaning precharged batteries would be needed short circuit current Limiting short circuit current to 1 A meant I needed to use an approximately 5 Q 5 W resistor I decided to limit this to 0 5 A This also meant that the charging current would reduce to approximately 250 mA as the cells capacity is reached Note that there is an inverter in the logic between the CC output and the external FET I used an NPN transistor biased on to ensure that the FET is on while the BQ2002 is high impedance not inhibit ing charging current OVERKILL Up to this point I assumed the remote device was populated with dead batteries I think this was a bit pessimistic Having to initially charge batteries in any reasonable amount of time say approximately 2 h requires a rather large solar cell similar to Parallax s 750 00042 2 65 W solar cell See Photo 1 This is really overkill if you look at the true requirement For these bat teries to last more than a year some quick calculations can be made to show the per hour usage is extremely small 2A Battery capacity year 2A 5 5 mA 365 days day S5mA 230uA 24 hours hour 230 uA x 2 5 V 57
Download Pdf Manuals
Related Search
Related Contents
Weider WEMC1026 User's Manual Guia do usuário Fisher-Price 76921 Motorized Toy Car User Manual 3. MR Cube Software Manual 業務用冷蔵庫・冷凍庫基準 - 社団法人・日本厨房工業会 エアフィルターKIT取扱説明書 Shell Tankstellen Stations-service Shell Stazioni di servizio Shell Instructions UK,FR,IT,DE Instruction Manual タイムラプスアダプター 取扱説明書 (191KB) Copyright © All rights reserved.
Failed to retrieve file