www.elektor-magazine.com magazine September 2014 JCU“*' 61 £ (c) Elektor 130231-1 vi.ll tf£i uu W* 07 ***** T-Boards 8/14/28 16-Bit Data Logger Microcontroller BootCamp (5) Isolated Oscilloscope Probe Three-way CH Boiler Valve Monitor Efficient Water Solenoid Valve DesignSpark Tips & Tricks Weird Components: Peltier Modules ELPP: Elektor Labs Preferred Parts NI VirtualBench Review Inexpensive MyDAQ Connectivity US$9.00 - Canada $10.00 09 Strain Gage with PSoC Retronics: BK560 Programmable IC Tester 25274 24965 Connect with us! www.facebook.com/elektorim VJ www.twitter.com/elektor Become a GREEN Member Now! Your GREEN Membership Comprises: •10 Editions of Elektor magazine in digital format (pdf) • Direct access to Elektor.LABS; our virtual, online laboratory • Direct access to Elektor.MAGAZINE; our online archive for members • A minimum of 1 0% discount on all products in Elektor.STORE • Elektor.POST newsletter sent to your email account each week • 25 Extra Elektor projects per year (through Elektor.POST) • Exclusive GREEN Membership card con- taining a state-of-the-art Mifare Ultralight RFID/NFC chip usable with NFC-compatible smartphones ektor EXCLUSIVE OFFER FREE E-BOOK on AVR/Software Defined Radio with an Elektor GREEN Membership!* Order Today at Available through www.elektor-magazine.com after you have received your magazine download login details. FT31 ID-based Android User Interface Builder • user Interface Bujkfer I ^Tachometer Seis.™ Detector I Men™*** **£=*<> [ XXL LED fit av PC ™ ihMie M I Hack*Tfaur-0*rt RtXiw Over I ,^ts I The MAS6510 3 -D Print Your Own Jnk A Jumbo PCS • fickiee CompytefSCL** (19S6) Join The Elektor Community THE GLOBAL STAGE FOR INNOVATION SWEB.ORG : j er * — J 8t T ^ ^ iir i ? I- Br* 1 Ir fT *7 J . £ V 1 Contents Projects 8 Professional Lab Power Supply Broadly speaking, low cost and high quality (low noise and good regulation) are mutually contradic- tory requirements. Specifically for power supplies, the logical solu- tion to this dilemma is to combine linear and switching technologies in order to reap the benefits of both, which calls for a more complicated design. 20 T-Boards 8/14/28 As your projects become more ambitious, at some point you may need to make the move away from the Arduino platform. More complex projects, particularly those that need a specific physical form, are often best implemented with custom PCB designs that directly incorporate the microcontrollers. Enter Elektor's T-Boards-8, -14 and -28. 30 Microcontroller BootCamp (5) One of the longest chapters in the ATmega328 data sheet is the one that describes its three timers. The timers can be used in so many different ways that we only have space in the article to look at a small fraction of the possibilities. The main application areas are in measuring time intervals and fre- quencies, and in generating various signals including PWM output. 40 16-bit Data Logger To make accurate voltage measure- ments you need an A/D converter (ADC) chip which has good res- olution. The folks at Elektor Labs have developed a board containing a four-channel 16-bit ADC. It's no coincidence the board uses a Gnublin/EEC connector which makes it compatible with Elektor's Linux board, the Xmega Webserver and the latest Extension shield for Arduino. 46 Isolated Oscilloscope Probe An oscilloscope with electrical- ly isolated inputs is out of the financial reach of many. Even differential probes, which (within certain limits) enable voltages to be measured without reference to ground, often cost the private user more than a complete scope does. So what can you do when either safety considerations or the nature of the task in hand require the use of isolated connections to your oscilloscope? You build the Elektor Isolated Oscilloscope Probe. 68 Three-way CH Boiler Valve Monitor How a 5-dollar circuit can help to prevent costly repairs on central heating boilers. 70 Efficient Water Solenoid Valve An intelligent low-power control circuit for a reverse osmosis water filter. 4 | September 2014 | www.elektor-magazine.com Volume 40 September 2014 - No. 453 Review 62 VirtualBench: Multi-function Measurement Instrument VirtualBench uses the functionality of a PC or tablet for its display and operation, meaning that it doesn't need a built-in screen or controls. This idea is certainly not new, but it has never been taken as far as in this device. • Industry 74 Taking the Strain A novel approach to performing strain gage measurements using PSoC technology and a clever algorithm. 78 News & New Products A selection of news items received from the electronics industry, labs and organizations. • DesignSpark 54 DesignSpark Tips & Tricks Day #13: Component placement. This month we look at the choices available to users to place compo- nents on PCBs: automatically or manually. 56 Peltier modules Weird Components— the series. Labs 58 ELPP: Elektor Labs Preferred Parts Clemens Valens discusses the advan- tages of purposely limiting the choice of parts that are "nothing special", like electrolytics and .25W resistors. 60 Inexpensive MyDAQ Connectivity A clever solution for a hard to find connector with .15-inch pin spacing. • Regulars 84 Hexadoku The Original Elektorized Sudoku. 80 Retronics BK Precision BK560 Programmable IC Tester A glimpse back to the glory days of TTL (74xx) and CMOS (40xx) ICs, when testing and replacing individ- ual devices was serious business if not craftsmanship. Series Editor: Jan Buiting. 85 Gerard's Columns: Engineering Success A column or two from our colum- nist Gerard Fonte. 90 Next Month in Elektor A sneak preview of articles on the Elektor publication schedule. www.elektor-magazine.com | September | 5 •Community Volume 40, No. 453 September 2014 ISSN 1947-3753 (USA /Canada distribution) ISSN 1757-0875 (UK / ROW distribution) www.elektor.com Elektor Magazine is published 10 times a year including double issues in January/February and July/August, concurrently by Elektor International Media 111 Founders Plaza, Suite 300 East Hartford, CT 06108, USA Phone: 1.860.289.0800 Fax: 1.860.461.0450 and Elektor International Media 78 York Street London W1H 1DP, UK Phone: (+44) (0)20 7692 8344 Head Office: Elektor International Media b.v. PO Box 11 NL-6114-ZG Susteren The Netherlands Phone: (+31) 46 4389444 Fax: (+31) 46 4370161 USA / Canada Memberships: Elektor USA P.O. Box 462228 Escondido, CA 92046 Phone: 800-269-6301 E-mail: elektor@pcspublink.com Internet: www.elektor.com/members UK / ROW Memberships: Please use London address E-mail: service@elektor.com Internet: www.elektor.com/member USA / Canada Advertising: Peter Wostrel Phone: 1.978.281.7708 E-mail: peter@smmarketing.us UK / ROW Advertising: Johan Dijk Phone: +31 6 15894245 E-mail: j.dijk@elektor.com www.elektor.com/advertising Advertising rates and terms available on request. Copyright Notice The circuits described in this magazine are for domestic and edu- cational use only. All drawings, photographs, printed circuit board layouts, programmed integrated circuits, disks, CD-ROMs, DVDs, software carriers, and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopy- ing, scanning and recording, in whole or in part without prior written permission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may exist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for fail- ing to identify such patent(s) or other protection. The Publisher disclaims any responsibility for the safe and proper function of reader-assembled projects based upon or from schematics, descriptions or information published in or in relation with Elek- tor magazine. © Elektor International Media b.v. 2014 Printed in the USA Printed in the Netherlands Announcements from the Publishers 1. Newsstand/ Bookstore Sales Discontinued The Publishers announce their decision to withdraw Elektor magazine from bookstores, electronics stores, kiosks and newsstands in the UK, the US, Europe and the rest of the world, effectively from the October 2014 edition. They regret that it is no longer eco- nomical for copies of Elektor magazine to be printed, stocked, transported, and returned within a worldwide distribution plan serving a decreasing number of retail points. The Publishers also regret the global trend of specialist journals being pushed off the shelves in bookstores by glossies and other popular publications. We thank all readers across the world having bought individual copies of Elektor maga- zine from a bookstore or newsstand since its first appearance in 1975 and advise every- one to take out a membership. Individual copies of Elektor magazine however continue to be available directly from the Publishers using the 'Magazines' section at www. elektor. com. Elektor magazine remains available as hard copy for sending to you by (air)mail, or a personalized pdf file for instant downloading to your computer. Our thanks also go out to UK and overseas distributor Seymour, US distributor Source Interlink, as well as newsagents, retail agents and storekeepers in remote locations having reserved copies of Elektor magazine for their clients. To mark the start of a new era of cost effective magazine distribution, the October 2014 edition of Elektor will be available at a one-off reduced price, please watch www. elektor. com/magazines/single-issues-print, or your Elektor.POST newsletter for announcements. The above does not affect the way the magazine is supplied to readers holding an Elek- tor membership. 2. We're Hiring To support its English language magazine and books operations Elektor International Media are looking for Technical translators, French to English, Dutch to English. Candidates should be native speakers of English with a solid knowledge of electronics preferably including microcontroller programming and technology. Above average skills are required in terms of localization to English language markets, writing, and author copy editing. Appointments will be on a free-lance basis. Please email the Editor (edi- tor@elektor.com) with your resume and samples of your work. On behalf of the Publishers, Jan Buiting, Editor-in-Chief Elektor International Media The Team Editor-in-Chief: Publisher / President: Membership Managers: Jan Buiting Don Akkermans Shannon Barraclough (USA / Canada), Raoul Morreau (UK / ROW) International Editorial Staff: Harry Baggen, Jaime Gonzalez Arintero, Denis Meyer, Jens Nickel Laboratory Staff: Thijs Beckers, Ton Giesberts, Wisse Hettinga, Luc Lemmens, Mart Schroijen, Clemens Valens, Jan Visser, Patrick Wielders Graphic Design & Prepress: Giel Dols Online Manager: Danielle Mertens Managing Director: Don Akkermans 6 September 2014 www.elektor-magazine.com •V r Our Network USA Don Akkermans + 1 860 - 289-0800 d.akkermans@elektor.com United Kingdom Don Akkermans +44 20 7692 8344 d.akkermans@elektor.com Germany Ferdinand te Walvaart +49 241 88 909-17 f.tewalvaart@elektor.de France Denis Meyer +31 46 4389435 d.meyer@elektor.fr Netherlands Ferdinand te Walvaart +31 46 43 89 444 f.tewalvaart@elektor.nl Spain Jaime Gonzalez-Arintero +34 6 16 99 74 86 j.glez.arintero@elektor.es Italy Maurizio del Corso +39 2.66504755 m.delcorso@inware.it Sweden Carlo van Nistelrooy +31 46 43 89 418 c.vannistelrooy@elektor.com Brazil Joao Martins +31 46 4389444 j.martins@elektor.com Portugal Joao Martins +31 46 4389444 j.martins@elektor.com India Sunil D. Malekar +91 9833168815 ts@elektor.in Russia Nataliya Melnikova +7 ( 965 ) 395 33 36 Elektor. Russia@gmail.com Turkey Zeynep Koksal +90 532 277 48 26 zkoksal@beti.com.tr South Africa Johan Dijk +31 6 1589 4245 j.dijk@elektor.com China Cees Baay +86 21 6445 2811 CeesBaay@gmail.com VOICE tal COIL circuit cellar Connects You To Supporting Companies lAT^onix ctavar Batronix www.batronix.com/go/38 79 CES International 2015 www. cesweb. org 3 Cleverscope www.cleverscope.com 61 DLP Design Ctesfar. www.dlpdesign.com 39 Eurocircuits www.eiektorpcbservice.com 52 egress pc ft pi CO npoiolu Express PCB www.expresspcb.com . . . Pico www. pi cotech. com/ps360 Pololu www.pololu.com Saelig www.saelig.com SoC Conference www. SoCconference. com 78 92 69 39 57 Not a supporting company yet? Contact Peter Wostrel (peter@smmarketing.us, Phone 1 978 281 7708, to reserve your own space in Elektor Magazine, Elektor«POST or Elektor.com www.elektor-magazine.com September 7 •Projects Professional Lab Power Supply Quality has its price By Arne Hinz and Martin Christoph Ordinary power supplies are as common as sand on the beach, and even lab power supplies come in all sorts and sizes. These are adequate for many purposes, but if you want high quality, high sta- bility and precise regulation, you have to put out a lot of money— and that for a power supply with only modest output power. Another option is to build one yourself. If you regularly put together electronics proj- ects, a small power supply with an output cur- rent rating of around 1 A and an output voltage adjustment range of at least 1 V to 12 V or so can certainly come in handy. That should be enough for most of the small circuits you build yourself. Small adjustable power supplies of this sort with regulated output voltage and an enclosure are available from electronics mail-order companies at low prices, and most of them have displays 8 September 2014 www.elektor-magazine.com Lab Power Supply that show the output current and voltage at the same time. However, for the rest of your projects you need something more. This is especially true for ambi- tious hobbyists who tackle relatively complex electronics projects, as well as professional devel- opment labs where good lab power supplies are an essential part of the basic test equipment and a lot of money is spent on professional equipment. The question of which power supply features are generally important or relevant is, as in so many cases, not so easy to answer because the require- ments depend on the application. However, it's certainly worth having a close look at the vast numbers of laboratory supplies that offer a lot of power at relatively low cost. For less than 100 dollars you can buy power supplies made in Asia with an adjustable voltage range from 0 V (or close to that) to 30 V and adjustable current limiting from (nearly) 0 A to around 3 A, and which also have digital displays, remote control and other features. For 50 dollars more, you can even get a switching power supply with nearly 600 watts of output power. However, the adage "cheaper is better" is far from true here. You don't have to be a genius to realize that at these prices, it's not possible to combine good basic specs with other important features such as good efficiency, good voltage regulation or durability. For power supplies, quality means complexity and complexity means cost. Although the power supply described in this article won't beat units in the four-figure price range, it has very good specs. Basic design Good laboratory power supplies have two com- mon characteristics: they stay relatively cool and they deliver a stable output voltage. The first of these requires switching technology, since high power dissipation (heat inside the power supply) reduces the lifetime and degrades the output voltage drift. The second means that the out- put voltage remains virtually constant over the entire load range and temperature range (static stability). With regard to dynamic stability, a fast and clean control response is important to keep overshoots and undershoots due to load changes or other causes as small as possible. Low ripple voltage and essentially zero output noise are also basic requirements. However, keeping high-fre- quency output noise under control is not espe- cially easy with switching regulators. Finally, we Features • Efficient lab power supply with switching preregulator • Operates from the 12 V output of a PC power supply • Efficiency up to 70% • Full electrical isolation with multiple modules • Output voltage 0-30 V, adjustable in 10 mV steps • Output current 0-1 A, adjustable in 10 mA steps • Voltage and current shown on LED displays • Good load regulation • Low drift • Fast shutdown button can also mention a factor that is more related to practical use than to quality: if a power sup- ply can provide more than one output voltage, the outputs should be galvanically isolated so they can be connected together in any desired arrangement without asking for trouble. From all this, we can conclude that low cost and high quality (low noise and good regulation) are mutually contradictory requirements. The logi- cal solution to this dilemma is to combine linear and switching technologies in order to reap the benefits of both, which calls for a more compli- cated design. This takes the form of a conventional linear reg- ulator in the output stage, which allows the volt- age or current to be adjusted quickly and pre- cisely and ensures low noise. Ahead of this linear stage there is a switching regulator that provides the input voltage for the output stage, which is always a bit higher than the output voltage but does not have the same high quality. The power dissipation of the linear output stage is low, even with low output voltages and high output cur- Figure 1. As you can see from the block diagram, this is not a simple circuit. www.elektor-magazine.com September 9 •Projects rents, because the voltage drop over this stage is low. This requires more components than a sim- ple design, so it is more complicated and more costly. Ready-made lab power supplies with this configuration are therefore distinctly expensive. The authors took this into consideration and gave careful thought to the design. Development started at the Institute for Rectifier Technology and Electrical Drives (ISEA) of the Aachen Uni- versity of Applied Sciences (RWTH Aachen, Ger- many), and the design was subsequently refined by Arne Hinz in the electronics lab as a project for the practical part of his studies. The block diagram in Figure 1 shows the result. To make things easier for DIY construction, the switching regulator input stage is not designed for Figure 2. The schematic of the lab power supply is fairly extensive, even without the display & control section. +12V PSMN015-60PS PSMN015-60PS 2x PMEG6030EP C16 C20 C21 C23 C24 □ r 100u C25 □ [ lOOu C26 □ l lOOu C27 C28 □ lOOu T5 m © \ I x N I x D9 D12 K4i 0 TR1_W1 TR1_W2 C30 □ lOOu C32 R44 R45 R46 R< m p gj j~gj +VL "© C45 C47 C48 +12V (+) +5V (+) +5V2 +15V2 (+) (+) RS8 R59 -15V2 +12V © VCC VB IC13 HIN HO LIN LO IR2183 VS COM X +12V 0 VCC VB IC14 HIN HO LIN LO IR2183 VS COM ± 1° K1 2 l°_ RESET 4 / 1 1ST 37 A 1ST 36 / 35_ 34 SW 33 ^DGBSW 32 4)GBA 31 ^DGBB 30 / 40 41_ LDAC 42 ^DACI 43 AeLAIS 44 ^ MOSI 1 ^ MISO 2 ^ SCK 3 PAO(ADCO) PAI(ADCI) PA2(ADC2) PA3(ADC3) PA4(ADC4) PA5(ADC5) PA6(ADC6 PA7(ADC7) IC9 PCO(SCL) PCI(SDA) PC2(TCK) PC3(TMS) PC4(TDO) PC5(TDI) PC6(TOSC1) PC7(TOSC2) ATMEGA32-A PB0(T0/XCK) PDO(RXD) PB1(T1) PDI(TXD) PB2(AIN0/INT2) PD2(INT0) PB3(AIN1/OCO) PD3(INT1) PB4(SS) PD4(OC1B) PB5(MOSI) PD5(OC1A) PB6(MISO) PD6(ICP) PB7(SCK) PD7(OC2) AGND GND GND XTAL1 XTAL2 GND 19 • s. PCO 20 PCI ^ 21 PC2^ 22 PC3^ 23 DGBA2 ^ 24 DGBB2^ 25 DISP A 26 DGBSW2^ 9 \ RX 10 TX\ 11 REGLERSTATUS^ 12 POWER_GOOD_MC^ 13 PD4^ 14 PD5^ 15 PD6^ 16 PD7^ 39 s 18p XI ilk 18p /“ -O -15V2 VOUTMESS2 3 iA j\ i VJST2 2 A VL MESS 5 / VL_IST 6 A Y DGBSW 14 / 12 DGBSW2 10 ^ DISP 8 / 6 PD7 4 o o o o o o o o o o o o 15 DGBA 13 DGBB^ 11 \ 9 DGBB2 7 DGBA2^ 5 \ 3 SCK 1 MOSI ^ A DISPLAY LED2 10 September 2014 www.elektor-magazine.com Lab Power Supply direct off-line operation from AC power. Instead, it is designed for low-voltage operation with an input voltage of 12 V DC. This can be provided with sufficient quality and power at low cost by a simple PC power supply, and PC power supplies with capacities from less than 200 W to 1 kW are readily available. Strictly speaking, this means we have a three-stage power supply design. In the top row of the block diagram, from left to right, the first stage is a standard ATX power supply. It feeds the switching regulator in the middle, which acts as a sort of preregulator for the linear out- put stage to the right. At the bottom middle you see the block for the secondary voltages (±15 V and +5 V on-board supply voltages), and at the bottom right the display & control module with +15V2 K8 RX_IN 1 2 GNDJN / 3 ■o a 4 5_ -o a 6 \VIN+ yVIN- 5 +15V2 -© V+ VIN+ IC4 INA196 0UT VIN- DBV2 GND R26 I 2k4 INAJDUT ■\ +5V2 f V DAC1 3 V SCK 4 ^MOSI 5 VLDAC 8 9 VDD SHDN CS VOUTA IC16 VREFA SCK VREFB SDI VOUTB MCP4922 ^C41 ^00n 14 V_SOLL / 13 —~L AREF/ 10 LSOLL / C46 lOOn A £ +5V2 © IC11 ^C61 1 1 0On 5 ^ ^TX 2 i R r L I TX_OUT / A" KB817-B +5V2 POWEFLGOOD © t I R53 Tr52 +5V © Tr40 D8 OKI 2 >y. BAS40 V_IST2 / OK2 KB817-B POWER_GOOD_MC/ 3KC 3 A +5V2 © Tr56 OK3 KB817-B +5V © IC10 +12V ©- 78L05SMD <> ♦ C60 lOOu ■ 2 +5V_VCC ©GDDM+) SJ1 IC12 +15V2 ©- 78L05SMD 0 * l +5V2 -© ^^IQn ^^ 6 C71 □ 56u DC1 +12V © L2 4 3 WE-DD_7332_47U ±< 1 100 | C63 +VIN +VOUT DC/DC CONVERTER COM 12V/15V 1W -VIN -VOUT DC2 +VIN +VOUT DC/DC CONVERTER COM 12V/15V 2W -VIN -VOUT C64 DC3 +VIN +VOUT DC/DC CONVERTER COM 12V/15V 1W -VIN -VOUT 1 1 00n |C67 JToo 4 3 WE-DD_7332_47U +15V2 "© C72 □ lOOu C73 ~^C68 ■JToo 4 3 WE-DD_7332_47U lOOu -G -15V2 I — 1 — l ± ± 130234 - 11 74AHC1G04DBV www.elektor-magazine.com September 11 •Projects the controls, indicators and displays for voltage and current. The advantage of this three-stage modular design is that you can obtain several galvanically isolated supply voltages by connect- ing several regulator modules (with combined switching and linear regulators) to a single ATX power supply in the same enclosure. Galvanic isolation is provided by the power transformer in the switching regulator stage in the middle. As a result, all output voltages can be connected together in any desired arrangement. Detailed circuit description First a recap: the high-performance lab power sup- ply module consists of a switching regulator input stage with galvanic isolation and a linear regulator output stage. This arrangement is fed by a high- power 12-V source, such as a low-cost ATX power supply. The two regulators and the microcontroller that controls everything are assembled on a single PCB, with the display & control components on a second PCB. The result is a compact module, and several of these modules can be packaged in a conventional 19" rack-mount enclosure and powered collectively by a PC power supply. But first let's look at the requirements, since quality is not simply a matter of using a 19-inch package or delivering a lot of output power. The regulation characteristics are what really mat- ter. To keep the cost of this circuit design within reasonable bounds despite the relatively high complexity, the output power is dimensioned to be sufficient for many common lab applications: maximum output voltage 30 V, maximum output current 1 A. With a maximum output power of 30 W, a relatively small transformer can be used in the switching regulator stage. What's more, we have designed a transformer that is very easy to make yourself— more about that later. 12 V input The schematic diagram in Figure 2 is a bit daunt- ing at first glance. However, it's not as bad as it looks, even if there isn't much white space on the drawing. Connector K3 at the bottom left is a standard ATX 2.2 power supply connector, as found on every PC motherboard. The main power connector of an ATX power supply can therefore be plugged in directly. K3 is wired so that the PC power supply delivers output power when it is plugged in to K3 and switched on (AC power present). This means that the AC power switch of the PC power supply is the AC power switch for the entire lab power supply. The lab power sup- ply is supplied from this 12-V rail. The two blade connectors K1 and K2 can be used to daisy-chain the 12 V rail to other lab power supply modules. Secondary voltages The circuitry for this block in Figure 1 is located in the bottom right corner of the schematic diagram in Figure 2. Here the DC/DC voltage converters DC1, DC2 and DC3 generate the ±15 V supply voltages for the opamps and other components. DC1 and DC2 are wired in parallel for the +15V2 (15.2 V) supply rail; DC3 handles the -15V2 supply rail on its own. The converter modules also provide galvanic isolation. These are switch- ing converters, so their noise is suppressed by choke L2 at the input and chokes L3 and L4 at the output. Otherwise the high-frequency noise would penetrate to the output voltage of the power supply. For proper understanding of the schematic diagram, it is essential to know that two different ground symbols are used here. The usual ground symbol relates to the 12 V input side, while the symbol with the "A" superscript relates to the galvanically isolated output side. To avoid noise problems, high-voltage capacitor C40 provides high-frequency coupling between the two ground levels. There are two on-board 5 V supplies. Most of the digital circuitry, including the microcontroller (IC9) and the display & control section (in Figure 3), is powered from +5V2, which is derived from +15V2 by a small linear regulator (IC12). A separate +5 V supply voltage referenced to the input ground is also necessary on the input side. It can be taken directly from the 5 V output of the PC power supply or derived from its 12 V output by another voltage regulator (IC10). Since some PC power supplies have poor 5 V regulation when the 5 V output is lightly loaded and the load on the 12 V output is variable, it is preferable to connect pins 2 and 3 through the solder bridge SJ1. Switching regulator The circuitry for this block in Figure 1 is spread out over the schematic diagram in Figure 2. First let's look at the voltage conversion circuitry. The 12 V input section, with a massive array of decou- pling capacitors, is located at the top left of the diagram. The bank of five relatively small electro- lytic capacitors (C24-C26, C28 and C30) and six multilayer capacitors wired in parallel drastically reduces the high-frequency input impedance, pro- 12 September 2014 www.elektor-magazine.com Lab Power Supply viding very good decoupling of the current spikes conning from the PC power supply. The same strategy is used on the secondary side, since parallel arrangements of this sort have better dynamic characteristics than a single capacitor with the same total capacitance. The four power MOSFETs form a bridge circuit driven by the switching regulator IC LTC6992 (IC17). A pair of IRF2183 MOSFET drivers (IC13 and IC14) are located between the voltage-con- trolled PWM output of the regulator IC and the gates of the MOSFETs. They provide sufficient drive current and have built-in dead time to ensure that both MOSFETS of a half-bridge sec- tion cannot conduct at the same time. Each driver IC has a bootstrap circuit consisting of a Schottky diode (D6 or D7) and storage capacitors (C3 1/ C33 or C34/C35) to provide sufficient drive volt- age for the gates of the high-side MOSFETs. IC17 only has a single 300 khlz PWM output, so a clock signal with opposite phase is generated by inverter IC5. The two D-type flip-flops (IC6) supply control signals at 150 khlz with an offset depending on the duty cycle. Now comes the question of how the switching regulator adjusts its output voltage so that it is always slightly higher than the output voltage of the linear regulator. For this purpose, the control signal MOD (which comes from the optocoupler OKI) is generated for IC17. The emitter LED of the optocoupler is simply driven by the current through series resistor R41 resulting from the difference between the output voltage of the switching regu- lator and the output voltage of the linear regulator. The MOD signal controls the output voltage of the switching regulator to maintain a voltage difference of approximately 1.5 to 2 V. The VL_MESS signal from the switching regulator output is taken from voltage divider R42/R43, while the VOUTMESS2 signal from the linear regulator output is taken from voltage divider R32/R33. The two signals are buffered by opamps IC8a and IC8b and applied to optocoupler OKI as VL_IST and V_IST2. Linear regulator The output stage of the linear regulator is built around the PNP power transistor T4, which is wired in common-emitter configuration and LD1...LD4, LD6...LD8 = SC39-11SRWA Figure 3. Schematic of the display & control section with LED displays, LEDs and rotary encoders is significantly simpler. www.elektor-magazine.com September 13 •Projects driven by transistor T3. The emitter current of T3, which is the same as the base current of T4, is determined by the voltage and current regu- lators. It flows through PI, which is adjusted so thatT4 can only become slightly saturated. This improves the regulation characteristics. The two diodes D2 and D3 in combination with resistors R21 and R22 form an override circuit for current regulation. This works as follows: As long as the output current is below the set limit, the voltage regulator (ICla and IC3a) controls the base cur- rent of T4 and thereby the output voltage, since the voltage at the output of the current regulator (IClb and IC3b) is "logic low" and D3 is reverse biased. However, if the output current becomes too high due to a low-resistance load, the output of the current regulator overrides the output of the voltage regulator, raising the voltage of the drive signal. As a result, the output voltage drops to the level necessary to keep the current at the limit value. Current regulation takes precedence because R22 has a lower resistance than R21. In the voltage regulator, ICla acts as a differ- ential amplifier. Its inputs are the VOUTMESS signal from the output voltage (via R29, R30 and R31) and the setpoint value V_SOLL, which Component List: Supply Resistors (default: 0.1W, 1%, SMD 0603) R1,R18,R48,R49,R56,R57 = lkft R2 = 56ft 5%, 0.33W, SMD 0805 R3,R50,R58 = 3.3kft R4,R14,R17,R33,R43,R52,R53 = lOkft R5,R6,R7,R9,R11,R12 = 27kft 0.1% R8,R10 = 2.7kft, 0.1% R13,R15,R54,R59,R60 = 5.6kft R16,R23 = 100ft R19 = 560kft R20 = lMft R21 = 330ft R22,R41 = 270ft R25 = 12kft R26 = 2.4kft R27 = 3.9kft R28 = lOOkft R29,R30 = 560ft, 1.5W, SMD 2512 R31 = 82ft, 0.25 W, SMD 1206 R32,R42 = 22kft R34 = 15kft R35 = Oft (wire link) R36 = not fitted R37 = 56kft R38 = 39kft R39 = 160kft R40 = 6.8kft R44-R47 = 1.8kft 1W, 5%, leaded R51 = 0.33ft 2W, SMD 2512 R55 = 4.7kft PI = 2kft, multiturn trimpot, tall (9353755) Capacitors (default: 50V, X7R, SMD0603) C1-C6,C11,C13,C14,C15,C19,C22,C31,C34, C37,C38,C41,C46,C51,C52,C54-C59,C61- C70,C74 = lOOnF C7 = 680pF, NPO C8 = 82pF, NPO C9 = 4.7nF C10,C71 = 56pF 63V, 3.5mm pitch, 8mm diam. C12,C24,C25,C26,C28,C30,C42,C43,C44,C6 0,C72,C73 = lOOpF 63V, low ESR, 3.5mm pitch, 8mm diam. C17,C18,C33,C35,C36 = lpF, X5R C16,C20,C21,C23,C27,C32,C45,C47,C48 = lOOnF, SMD 1206 C29 = InF C39,C49 = 2.2pF 50V, X5R, SMD 0805 C40 = lpF 100V, PET, 7.5mm pitch C50,C53 = 18pF C66 = lOOnF 630V, SMD 1812 Inductor L2,L3,L4 = 47pF 0.9A, dual choke (1869658) L5 = lOpF, SMD 0805 (Reichelt # JCI 2012 lOp) Semiconductors D1,D2,D3,D11 = BAS40W, SMD SOT323 (8734380) D4,D5 = B560C, Schottky, SMD SMC (1858602) D6,D7 = PMEG4010ET, Schottky (2311223) D9,D10,D12,D13 = PMEG6030EP, Schottky, SMD SOD128 (1829207) D8 = BZV55-C2V4, zener diode, SMD Mini- MELF (1097193) LED1, LED2, LED4-LED8 = LED, orange, SMD 0603 OKl,OK2,OK3 = KB817-B, DMD4, optocoupler T1,T2,T3 = BC817, SMD SOT23 T4 = TTA1943, PNP, TO-3P (1901958); alter- native: 2SA1943 T5-T8 = PSMN015-60PS, n-channel-MOSFET, TO220 (1845643) IC1,IC3 = TL5580, SMD SOIC8 (1755396) IC2 = LM311D, SMD SOIC8 (2293183) IC4 = INA196AIDBVT, SMD SOT23-5 (1564942) IC5,IC11 = 74HC1G04GW, SMD SOT353 (1085251) IC6 = 74HCT74D, SMD SOIC14 (1085304) IC7 = 74HCT4538D, SMD SOIC16 (1631658) IC8 = TL074, SMD SOIC14 (1459705) IC9 = ATmega32-A, SMD 44TQPF, pro- grammed, Elektor Store # 130234-41 IC10,IC12 = 78L05, SMD SOIC8 IC13,IC14 = IR2183SPBF, SMD SOIC8 (1023247) IC15 = LT1461CCS8-4, 4,096 V, SMD SOIC8 (1663430) IC16 = MCP4922-E/SL, SMD SOIC14 (1332114) IC17 = LTC6992CS6-2, SMD TSOT23-6 (1848046) DC1,DC3 = TMA 1215S, 12V/15V, 1W, Traco (1007521) DC2 = TMH 1215S, 12V/15V, 2W, Traco (1007560) Miscellaneous XI = 16MHz quartz crystal, SMD HC49 Heatsink for T4, Fischer SK 08, 3.2K/W (Re- ichelt V 4511D) Heatsink for T5-T8, Fischer SK 125 84, 5.8 K/W (4621335) K5 = 10-pin boxheader K6 = 16-pin boxheader K4,K7,K8 = 6-pin boxheader K3 = 24-pin ATX-2.2 plug, PCB mount (2113352) K1,K2,K9,K10 = Spade terminal, PCB mount, 4.8 x 0.5mm (4215552) RE = relay, 12V, 2 x c/o (Reichelt FIN 40.52.9 12 V) 2 pcs ferrite core E32/6/20-3F4 (3056107) Cable ties for securing cores Washer, ceramic, TO-3P, forT4 (RS Compo- nents 283-3830) Washer, ceramic, TO220, forT5-T8 (RS Com- ponents 177-7767) Screws and nuts for heatsinks and T4-T8 19-inch case, 3 rack units (3U) with: Module carrier 3U, e.g. Hammond 84TE 235mm Typ F 2 pcs support rail, length 220mm PCB #130234-1 and 130234-3 7-digit numbers in round brackets are Newark/Farnell order codes 14 September 2014 www.elektor-magazine.com Lab Power Supply Figure 4. Component layout of the regulator board for the circuit shown in Figure 2. The power transistors are mounted on the rear. comes from the dual DAC IC16. In the same way, IC19 provides the current setpoint value I_SOLL to IClb, where it is compared with the signal INA_OUT. The latter signal represents the output current and is obtained by converting the voltage drop over the low-resistance sense resistor R51 into a ground-referenced voltage. This is handled by the INA196 (IC4), which is specifically designed for this purpose. Of course, the DAC has to get data from some- Figure 5. Rear side of the regulator board. Flere you can see how the heatsinks and board are screwed together and where the power transistors are located. www.elektor-magazine.com September 15 •Projects Figure 6. The secondary winding PCB for the planar transformer. Like the regulator board, it has four layers. where so it can provide the setpoint values. This is where the microcontroller (IC9) comes into play. It receives voltage and current signals which are buffered by opamps IC8c and IC8d and applied to two internal inputs as V_IST and I_IST. IC9 measures the voltage levels of these signals and outputs the measured values to the display. The microcontroller also outputs the setpoint data cor- responding to the user settings to the DAC IC16. Above K3 you can see IC15 (LT1461), which is a precision voltage regulator that supplies a ref- erence voltage of 4.096 V with a tolerance of 0.08% and a drift of only 12 ppm/°C (with the specified version). It is not essential to use this high-grade version of the IC, since the overall accuracy depends more on the precision of the resistances of the voltage dividers used to mea- sure the voltage (R30/R31 and R32/R33) and the current (R26/R27 and R51). Display & control The circuit diagram of the display & control sec- tion in Figure 3 includes the displays, drivers, LEDs and controls. Connector K1 is connected to K6 of the main circuit board (Figure 2). The MAX7221 driver IC receives data from the micro- controller in Figure 2 over a serial link. It controls a four-digit seven-segment LED display for the voltage and a three-digit display for the current, using multiplexed signals. For both voltage and current the decimal point is hard-wired with two decimal places. Since this means that the driver does not have to handle any decimal points, the corresponding outputs are used to drive the four LEDs (LED1-LED4) and the LEDs integrated into SI. The red LEDs on the right side are lit alterna- tively when the voltage regulator is active (LED2) or the current regulator is active (LED4). The green LEDs on the left side light up when a new current or voltage is setting is initiated by press- ing S3 or S2. Button SI lights up when the output voltage is present. Miscellaneous A relay is necessary to allow the output voltage to be switched on and off quickly with SI (Fig- ure 3). In Figure 2 it is driven by Tl, which in turn is driven by a digital output of the microcontroller via Rl. LEDs LED4-LED8 indicate the presence of the input voltage and the secondary voltages. Diodes D4 and D5 protect the circuitry against reverse currents due to incorrect connection of the output terminals, which can easily happen in lab situations (e.g. when working with batteries). The response times of the regulators are tuned by the RC networks R20/C8 (voltage) and R19/ C7 (current). The comparator circuit built around IC2 checks whether voltage regulation or current Figure 7. Photo of the fully assembled regulator board. This gives you an impression of the planar transformer. 16 September 2014 www.elektor-magazine.com Lab Power Supply regulation is active and informs the microcontrol- ler via T2. LED1 is lit when current regulation is active. A switch-on delay is implemented using the monostable IC7a and the reset pin of IC6, so that the switching regulator does not start up until all of the supply voltages have stabilized. Connectors K7 and K8 can be used for serial data communication with the USART of the micro- controller. Among other things, this could be used to link several power supply modules in order to generate balanced supply voltages. The input through K8 is galvanically isolated by OK3, enabling serial linking without galvanic connec- tion of the modules. However, this interface is not presently integrated into the firmware, so if you want to use it you will have to do a bit of programming. Several I/O pins of the microcon- troller are brought out to K5. They can be used for any desired purpose by extending the firmware. The microcontroller can be programmed over K4 with the usual in-system programming devices. Transformer TR1 is a planar transformer. Its con- struction is described below. The turns ratio of TR1 is 2:3. Construction There are individual PCBs for the circuits in Fig- ure 2 and Figure 3. The massive use of SMD com- ponents in 0603 format is a sure sign that you will need a lot of soldering experience, among other things. A project of this complexity is definitely not a good choice for beginners, and even then you should not tackle it without assistance. For experienced builders, it's surely unnecessary to say that you should fit the low-profile components first and then the higher components. With the regulator board shown in Figure 4, there are three things that require special attention. The first two are apparent when you look at the rear of the board (Figure 5): transistors T4 and T5-T8 are mounted on the rear side. It is also necessary to fit insulating spacers on the screws connecting the heat sink for T4 to the PCB, to pre- vent it from causing short circuits on the board. Things are easier with the heat sink for the MOS- FETs because it can be fastened directly to the PCB with short M3 screws. The MOSFETs can be mounted with screws or with suitable mounting clips, which is easier. All five transistors must be insulated from their heat sinks by thermal pads. The most unusual thing about this project is unquestionably the planar transformer. It is built with a pair of ferrite pot cores, and the clever part is that you don't have to wind anything because the primary winding is integrated in the PCB. There is a separate small PCB for the second- ary winding (Figure 6), which is connected to the main board by thick copper wires and glued fllHlIII cn£* I L * Ml' ot m Eli 0 ' - "■ >7 07 t? ■" ft p a n »■ - i Cl 6 C23 C21 r-ssfifr n m Elektor 139234^1 v 4,ll (m jc«5 □13 G47 Figure 8. Close-up view of the planar transformer. Here you can see how the small PCB with the secondary winding is fitted. www.elektor-magazine.com September 17 •Projects onto the main board with a layer of Kapton tape. The tape must be kept out of the mating areas of the pot cores. Although this "printed" trans- former does not utilize the full winding volume of the cores, it saves a lot of manual labor. To ensure that this works properly, both PCBs are built with four layers. Making your own PCBs for this project is therefore not recommended. The four layers provide four parallel windings, which reduces the negative impact of the skin effect at high frequencies. After fitting the small PCB with the secondary winding, position the two pot core sections so they pass through the holes in the regulator board and secure this assembly with a cable tie. The picture of the prototype in Fig- ure 7 and the close-up photo in Figure 8 show what it should look like. The PCB for the display & control section (Fig- ure 9) has a significantly simpler layout and is built as a conventional two-layer board. There are only a few special aspects here. One is that K1 is mounted on the rear of the PCB, and another is the reason for the two round holes in the board. Maybe you guessed already: they are cutouts for 4-mm jacks mounted on the front panel of the enclosure. These jacks should be connected to K9 and K10 on the regulator board by lengths of stranded wire with insulating sleeves. Figure 10 shows the finished combination of regulator board and display & control board. A 19-inch rack-mount enclosure with 3-unit height is a good choice for housing a decent lab power supply. It provides enough space for the PC power supply as well as several lab power supply mod- ules. The PCBs have been specifically designed for this. Adjustment and operation After the boards are assembled, checked and connected by a ribbon cable, all that's missing is the microcontroller firmware. It was written in C with AVR Studio and can be downloaded from the Elektor web page for this article, along with the layout files for the PCBs. The microcontroller can be programmed using an ISP device, such as the Atmel AVRISP Mkll or similar. Of course, the microcontroller must be powered up before it can be programmed, which means that the board must be connected to a 12 V supply. After the microcontroller has been programmed, you should see something reasonable on the dis- Figure 9. Component layout of the display & control PCB. The board is a conventional two- layer design. Component List: Display Resistors R1 = lOkft 0.1W, 1%, SMD 0603 Capacitors Cl, = lOOnF 50 V, X7R, SMD 0603 Semiconductors LD1-LD4,LD6,LD7,LD8 = SC39-11GWA, LED-Dis- play, red , common cathode (2314233) LED1,LED3 = LED, green, rectangular, leaded (1142607) LED2,LED4 = LED, red, rectangular, leaded (1581150) IC1 = MAX7221CWG+, SMD SOIC (9725725) Miscellaneous SI = pushbutton with LED, Multicomp MC- SPHN3-YCA043T (2146950) S2,S3 = rotary encoder with switch, (Mouser 652-PEC12R-4220F-S24) Knobs for rotary encoder Caps for knobs K1 = 16-pin boxheader 2 pcs 16-way IDC socket for flatcable 16-way flatcable PCB # 130234-2 7-digit numbers in round brackets are Newark/Farnell order codes 18 September 2014 www.elektor-magazine.com Lab Power Supply Figure 10. The finished prototype, consisting of the regulator board and the display & control board. play. When you press rotary encoder S3 or S2, the corresponding green LED lights up to indicate that you can set the voltage or current by turning the encoder knob. Each encoder increment corre- sponds to 10 mV or 10 mA. If you turn encoder S3 while it is pressed, the voltage increment is 1 V, and when S2 is turned while pressed the current increment is 100 mA. Pressing S3 or S2 again exits setting mode; the setting is accepted and the green LED goes dark. After this the actual voltage and current values are displayed again. To access the calibration mode, press SI and turn 52 at the same time. Now you have to apply a load to the output of the power supply by con- necting an ammeter, which effectively short-cir- cuits the output. A meter with a measuring range of 2 A is ideal. In this mode the output voltage is set to 1 V and the current limit is set to max- imum. The display shows the measured current and a correction factor instead of the voltage. LED1 indicates the sign of the correction factor. First turn PI about one to two turns past the point where the current stops rising. Then you can use 53 to change the compensation factor in steps of 0.1 percent. Adjust the compensation factor so the displayed current matches the current read from the external ammeter. Exit this mode by again pressing SI and turning S2. Current mea- surement is affected by component tolerances and the minimum load current through R29-R33. Figure 11 gives an impression of the regulation characteristics of the lab power supply for a load change from 90% to 10% at a voltage of 15 V. ( 130234 - 1 ) Web Link www.elektor-magazine.com/130234 Figure 11. As you can see from this oscilloscope screenshot, the output voltage (15 V) remains perfectly stable when the load is suddenly reduced from 90% to 10%. www.elektor-magazine.com September 19 •Projects T-Boards 8/14/28 Three sizes for cheap & fast AVR prototyping The Arduino platform is a perfect way to get into the world of microcontrollers and embed- ded systems, particularly for those of us without a formal Electrical Engineering background. At some stage, though, you'll probably start hitting constraints and want make the leap to working with 'raw' microcontrollers. The T-Board makes that jump just a little less daunting. By Andrew Retallack (South Africa) One wouldn't want to belittle the design of the Arduino boards— without the Arduino the Maker movement would be a fraction of its size and far less people particularly youngsters would be comfortable using microcontrollers. However, as your projects become more ambitious, at some point you may need to make the move away from the Arduino platform. More complex proj- ects, particularly those that need a specific phys- ical form, are often best implemented with cus- tom PCB designs that directly incorporate the microcontrollers. Some projects need to meet specific constraints, which require flexibility the Arduino can't provide— for example, more pow- er-efficient designs by operating at lower volt- ages or at slower clock speeds. For less complex projects a smaller Atmel AVR microcontroller is better suited to the task and more cost effective than a full Arduino. Whatever the reason, the first step most of us would take in a prototyping process would be to set the microcontroller up on a breadboard. Microcontrollers on breadboards: a challenge On the face of it, it doesn't take much to build your own microcontroller project on a bread- board— there are plenty of online resources avail- able [1], and the supporting components are inexpensive. However, once you actually start 20 September 2014 | www.elektor-magazine.com T-Boards 8/14/28 working on a project, it becomes clear that there are a number of challenges. For starters, a basic microcontroller setup already has a number of jumper wires, capacitors, resistors and connectors infringing on your limited breadboard work- space. This not only limits the num- ber of available connections, but makes it harder to trace your connections and carry out any troubleshooting. Secondly, all the pins on the microcontroller are acces- sible (which is something you don't always want) and are unlabeled. Consequently extra care and a lot of pin-counting to connect components up correctly and to keep the white smoke from escaping from inside your MCU! Finally, and importantly, is the programming— whether you use an FTDI or ISP programmer, you're add- ing even more to the breadboard just to get the microcontroller working. The result is a rat's nest of wires and components with temperamental connections and an experience that isn't as fun and rewarding as you'd like! Making prototyping simpler: the T-Board It was from the author's experiences and frus- trations with breadboard prototyping that the T-Board design emerged: a breakout board that would speed up microcontroller prototyp- ing by reducing the complexity whilst retain- ing flexibility. Three versions of the board were designed, to accommodate Atmel's more popular AVR microcontrollers: the 28-pin ATmega range (ATmega8/48/88/168/328), the 14-pin ATtiny range (ATtiny20/24/44/84/441/841) and 8-pin ATtiny range (ATtiny 13/25/45/85). All three ver- sions are breadboard-friendly, can be self-pow- ered at 3.3 V or 5 V, and contain ICSP headers for easy programming. The electrical design T-Boards come in three flavors: '8', '14' and '28'; you select the one that best suits your require- ments. Because there are three boards, there are also three schematics: Figures 1 (T-Board 8), 2 (T-Board 14), and 3 (T-Board 28). Apart from the obvious differences due to the microcontrollers used, the schematics are largely identical. Power is supplied through a standard 2.1-mm center-positive jack Kl, with diode pro- tection (Dl), a PTC resettable fuse with a 1-A trip rating (FI), and filtering capacitor (Cl). The two voltage regulators IC1 and IC2 are low dropout regulators with fixed 5-V (NCP1117DT50G) and 3.3-V (LD1117S33TR) outputs, with maximum input voltage of 20 V and rated output in excess of 1 A. The jumper JP1 selects the output volt- age. The T-Board 28 with its AVR '328 can also be powered from the FTDI board, assuming a 5 V supply. The microcontrollers are mounted in DIL sockets, to allow them to be exchanged— there are a num- ber of MCUs with compatible pin configurations. A 0.1-pF decoupling capacitor (C4) is placed close to the microcontroller's VCC and GND pins. The ICSP header connection is a standard 6-pin one, and powers the board during programming. Be Figure 1. T-Board 8 schematic. Tiny indeed— that '45 with just 8 pins. www.elektor-magazine.com September 21 •Projects Figure 2. T-Board 14 schematic. The mid-size option, based on the ATmega48 micro. aware that the voltage will be determined by the ISP programmer. A reset button, SI, that pulls the Reset pin low completes the design elements common across all three boards. The real boards The physical design of the T-Boards is relatively straightforward, as can be seen from the photo- graphs in Figures 4, 5, and 6. Shaping was the key challenge, and the author went through vari- ous iterations in an attempt to achieve a balance between flexibility, simplicity, footprint size and future-proofing. The T-shape of the board was arrived at to keep as much as possible off the breadboard in order to free up working area— the power management and FTDI header (in the case of the T-Board-28) all sit off the breadboard. The footprint could have been made reduced fur- ther (currently two rows of the breadboard are occluded on each side of the center channel), but that would have been trade-offs. Flexibility could have been sacrificed by using a smaller surface-mount MCU, losing the ability to inter- change different PDIP controllers. Alternatively, the smaller footprint would have been at the cost of simplicity, by moving the microcontroller off Choosing your IDE Choosing an IDE is a very personal decision, and to recommend one outright is guaranteed to upset users loyal to Windows vs Mac vs Linux, or open a bouncy debate about the merits of open source vs commercial software, and bloated vs lightweight GUIs. In the end, most of the options available will be fine for those starting out with MCU development. It's when you get into serious embedded systems that require high levels of speed/memory/ power optimization that more in-depth investigation is needed. To get you started, here are a few options: Arduino IDE Yes, you can use the Arduino IDE [3] to work directly with the raw MCU. You will be limited to those MCUs that the Arduino IDE supports, but you can find online resources to support a number of additional MCUs such as the ATtiny range. The pros: working in a familiar environment; good library support; simple to configure; open source; Windows/MacOS/Linux support. The cons: limited flexibility; limited MCU support; lack of advanced features; no debugging. Eclipse with AVR Plugin Eclipse [4] is a very popular open source IDE, supports many programming languages and runs on Windows, MacOS and Linux. The flexibility and wide range of applications comes at a cost - it requires a little time to get installed and configured, and some understanding of the toolchain (compiler, 22 September 2014 | www.elektor-magazine.com T-Boards 8/14/28 the board (either as a vertical plug-in module, or a move to a 4-layer board). In the end, for what the author was looking to achieve, we believe the design is a good balance. In selecting components, a combination of through-hole and larger 1206 SMD components were chosen to allow for easy hand soldering. Certain readers may want to assemble their own though without needing to get their hands on reflow ovens. T-Boards are available ready-assembled from the Elektor Store at prices that should defy home assembly from parts. For completeness' sake, in good Elektor tradition, and to serve all e-die- hards insisting on home-construction-all-the-way the three component overlays and associated parts lists are printed jointly in Figure 7. Also, the PCB artwork can be downloaded from the Elektor Magazine website [10]. Want to build it yourself? Go ahead. The T-Board 28 The T-Board 28 with its ATMega328 micro has two features not present on the T-Boards 8 and '14 which are ATtiny boards. In contrast to the ATtiny microcontrollers, the compatible ATmega Figure 3. T-Board 28 schematic. The largest board with the most powerful processor type ATMega328. linker, assembler). The pros: powerful and configurable IDE; open source; Windows/MacOS/Linux support, no code-size limitations; a strong community. The cons: requires a plug-in to support Atmel MCUs; not a straightforward installation; does not support debugging natively. Atmel Studio This is Atmel's own offering [5], based on the Visual Studio platform. It of course supports all Atmel's MCUs including their ARM processors, so if you are focusing on Atmel only it's a good place to start. The pros: support for all Atmel MCUs; advanced features including debugging and simulation; easy to install and get going; no code-size limitations. The cons: Windows only; some may not like the Visual Studio interface; documentation could be stronger. IAR Embedded Workbench [6] An IDE targeted at the professional market, with a code-size limited version that can be used for free. In addition to supporting Atmel's AVR MCUs, it also supports microcontrollers from other major manufacturers which make it a good option if you want to work on multiple MCUs in a single tool. The pros: support for all Atmel AVR MCUs, advanced features including debugging and simulation, a single professional tool for multiple manufacturers' MCUs. The cons: free version restricted to 4 KB; expensive to buy; Windows only. +5V © K1 IC1 A 9V DC D1 FI XT 1N4007 ' 500mA K3 FTDi DTR O- RXI o- +5V txd O- CTS o GND o K5 PDO O- PD1 o- PD2 o- PD3 O- PD4 o- VCC o- GND O- PD5 a PD6 o- PD7 o- PBO o- K6 VCC Cl □ lOOu 50V JP1 -fo" o o- +3V3 © 5V 3V3 IC2 NCP1117 A 5V i4 NCP1117 A 3V3 t V w X C2 □ lOu 50V C3 lOOn VCC ■© R2 LED1 ** T R1 C7 II lOOn RX TX 1 I: £ RESET 11 12 13 14 VCC -© 21 20 VCC AREF AVCC PCO(ADCO) PCI(ADCI) PC2(ADC2) PC3(ADC3) PC4(ADC4/SDA) PC5(ADC5/SCL) PC6(RESET) PDO(RXD) PDI(TXD) PD2(INT0) PD3(INT1) PD4(XCK/T0) IC3 ATMEGA328P PBI(OCIA) PD5(T1) PB2(SS/OC1B) PD6(AIN0) PB3(MOSI/OC2) PD7(AIN1) PB4(MISO) PBO(ICP) PB5(SCK) XTAL2 GND GN D X 8 C5 AL1 XI H t AI- 10 22 C6 22p 22p I 1 22 ^x^ 23 1 24 2 25 3 26 4 27 5 28 6 15 1 16 2 17 MOSI 3 18 MISO 4 19 SCK ’ 5 K4 ■O O O PC0 PCI PC2 PC3 PC4 PC5 K7 ■O O 130581 - 13 www.elektor-magazine.com September 23 •Projects Figure 4. T-Board 8 prototype. Small differences may exist with the final version supplied through the Elektor Store. Figure 5. T-Board 14 prototype. Small differences may exist with the final version supplied through the Elektor Store. Figure 6. T-Board 28 prototype. Small differences may exist with the final version supplied through the Elektor Store. MCUs have a hardware UART and dedicated Tx/ Rx pins. As a result, an FTDI header has been included for the 28-pin T-Board 28 only. This enables the board to communicate serially; con- nect a serial-to-USB convertor such as the Elektor FT232R USB/Serial Bridge [2] and you're able to communicate with a terminal program on your computer or program the microcontroller (assuming it has a bootloader). Serial commu- nications can of course be implemented on the ATtiny in software, but with a lack of dedicated pins it was decided to exclude an FTDI header. The T-Board 28 additionally has a 2-way socket to accept an optional external quartz crystal. In line with Atmel's recommendations, 22-pF load capac- itors are present. The decision was taken not to include these sockets for the smaller T-Boards, due to the limited number of I/O pins as well as the likelihood that the more common applications of these would not require the additional accu- racy that an external crystal offers. The 1-2-3 of T-Boards As in the world of the Arduino, there are three steps to 'building' a T-Board project. However, now that we've moved onto working with a "raw" microcontroller, there is added complexity (and flexibility). 1. The first step, designing the physical project, is actually easier than with the Arduino. Snap the T-Board onto your breadboard, hook up your positive and negative power rails, and you can start placing components onto the breadboard without the need for additional jumper wires. 2. The second step, writing the code to control the MCU, can be as simple or complex as you like. You can either stick with the Arduino integrated development environment, or you can increase your flexibility by moving to a more fully-fea- tured IDE such as Atmel Studio, Eclipse or IAR Workbench (refer sidebar: Choosing your IDE). 3. The third step is of course getting the compiled code onto the MCU. For an Arduino, this is taken care of by an on-board USB connector. However, there are limitations with this— for example using ATtiny MCU's. The T-Board provides the greatest degree of flexibility by including ICSP headers. This is the easiest way to flash your program onto the MCU (see inset: Choosing your Programmer). You could use the FTDI header on the T-Board 28, but the ISP programmer is easier, simpler and faster. A kickoff project A blinking LED is the "Hello World" of the embed- ded world, and for our purposes a good place to start to illustrate the workings of the T-Board. For this project I'll be using Atmel Studio, as it is the simplest to get up and running (a quick download and install from the Atmel website). The same principles covered here would apply to your preferred IDE. We'll follow the three-step process discussed above. 24 September 2014 | www.elektor-magazine.com T-Boards 8/14/28 1 LCil J i. ilr+Lli liL'. .iin- Seen the show— got the T-shirt Elektor.POST Editor Jaime wrought t-shirt artwork he believes will outfox Arduino folks and win them over to T-Boards. A T-Boards t-shirt is supplied free of charge if you order all three T-Boards from the Elektor Store; see www.elektor.com and watch announcements in the Elektor.POST newsletter. Step 1: set up the breadboard • Snap the T-Board onto the breadboard; • Move the voltage selection jumper to the 5 V position; • Connect a jumper wire between the GND pin and the breadboard's negative supply rail; • Connect a resistor between an empty row on the breadboard and (depending on the T-Board being used): - PBO on the T-Board 28 - PA5 on the T-Board 14 - PB4 on the T-Board 8 • Connect the anode of the LED to the resistor and the cathode to the negative supply rail. Step 2: Write the Program Create a new project in Atmel Studio, ensur- ing that you choose a 'GCC C Executable Proj- ect'. Select the correct device, depending on the T-Board being used: • T-Board 28: ATmega328 • T-Board 14: ATtiny 84 • T-Board 8: ATtiny 85 Physical Layout and Function example: T-Board 28 A. FTDI Connector: Connect an FTDI breakout board for Serial communication over USB (T-Board 28 only) B. Reset switch C. Power LED D. Power Connector: A standard 2.1-mm center-positive jack (DC, max. 9 V) E. Voltage Selection Jumper: Allows the microcontroller to operate at either 5 V or 3.3 V F. Crystal header pins: Gives you the option of connecting an external crystal (T-Board 28 only) G. ICSP Connector: Connect an ISP programmer to program the microcontroller www.elektor-magazine.com September 25 •Projects Component List T-Board 8 Ref. no. 130581-92 (ATtiny45). Available ready-assembled from the Elektor Store Resistors R1 = lOkft 250mW 1% R2 = 330ft 250mW 5% Capacitors Cl = lOOpF 50V radial C2 = lOpF 50V radial C3,C4 = lOOnF 50V 10% X7R Semiconductors D1 = 1N4007 LED1 = SMD, green, 20mA IC1 = NCP1117DT50G, 5V 1A regulator IC2 = NCP1117ST33T3G, 3.3V 1A regulator IC3 = ATTINY45-20PU, 8-bit MCU Miscellaneous K1 = DC barrel jack 2.1mm pin K2 = 6-pin 2-row pinheader (2x3) K3,K4 = 4-pin pinheader SI = switch, tactile, 24V 50mA, 6x6mm FI = 500mA PTC resettable fuse JP1 = 3-pin pinheader 8-way DIL IC socket jumper, 2-way, 0.1" (2.54mm) PCB # 130581- Component List T-Board 14 Ref. no. 130581-91 (ATtiny84). Available ready-assembled from the Elektor Store Resistors R1 = lOkft 250mW 1% R2 = 330ft 250mW 5% Capacitors Cl = lOOpF 50V radial C2 = lOpF 50V radial C3,C4 = lOOnF 50V 10% X7R Semiconductors D1 = 1N4007 LED1 = SMD LED green 20mA IC1 = NCP1117DT50G, 5V 1A regulator IC2 = NCP1117ST33T3G, 3.3V 1A regulator IC3 = ATTINY84-20PU 8-bit MCU Miscellaneous K1 = DC barrel jack 2.1mm pin K2 = 6-pin 2-row pinheader (2x3) K3,K4 = 7-pin pinheader, 1x7 pins SI = switch, tactile, 24V, 50mA, 6x6 mm FI = 500mA PTC resettable fuse JP1 = 3-pin pinheader 14-way DIL IC socket jumper, 2-way, 0.1" (2.54mm) PCB # 130581-1 Component List T-Board 28 Ref. no. 130581-93 (ATMega328). Available ready-assembled from the Elektor Store Resistors R1 = lOkft 250mW 1% R2 = 330ft 250mW 5% Capacitors Cl = lOOpF 50V radial C2 = lOpF 50V radial C3,C4,C7 = lOOnF 50V 10% X7R C5,C6 = 22pF, 50V, 1206 Semiconductors D1 = 1N4007 LED1 = SMD, green, 20mA IC1 = NCP1117DT50G 5V 1A regulator IC2 = NCP1117ST33T3G 3.3V 1A regulator IC3 = ATMEGA328P-PU 8-bit MCU Miscellaneous K1 = DC barrel jack, 2.1mm pin K2 = 6-pin 2-row pinheader (2x3) K3 = 6-pin pinheader, right angled K4 = 6-pin pinheader K5 = 7-pin pinheader K6 = 4-pin pinheader K7 = 5-pin pinheader XI = 2-way socket SI = switch, tactile, 24V, 50mA, 6x6mm FI = 500mA PTC resettable fuse JP1 = 3-pin pinheader 28-way 300mil width DIL IC socket Jumper, 2-way, 0.1" (2.54mm) PCB # 130581-3 Figure 7. Component overlays of T-Board 8, T-Board 14, and T-Board 28. Note that all T-Boards are available ready-assembled from the Elektor Store www.elektor.com. 26 September 2014 | www.elektor-magazine.com T-Boards 8/14/28 Then enter the code from Listing 1 into Atmel Studio. This code is far from optimized, but in retaining simplicity it achieves what we need for our purposes here. If you come from an Arduino background, you probably won't recognize some of the code— if so, the Microcontroller BootCamp series of articles starting in the April 2014 edi- tion of Elektor magazine is compulsory reading! If you are not using the T-Board 28 then change the above code to refer to the LED pin, as sum- marized in Table 1. Once the code is entered, it needs to be com- piled. Ensure that the Configuration Manager is set is set to "release", then press F7 to build. Step 3: Flash the program to the T-Board Connect the ISP programmer you'll be using to the T-Board and PC Select the ISP Programmer that you will be using, by select the Project menu, then ...properties Table 1. Changes to T-Board 28 program code to suit T-Board 8, T-Board 14. Existing T-Board 14 T-Board 8 DDRB DDRA DDRB DDBO DDA5 DDB4 PORTB PORTA PORTB PORTBO PORTA 5 P0RTB4 On the Tool tab, select the debugger/program- mer you're using. Upload the program to the T-Board: Click on Debug menu, then Start without Debugging The LED should start blinking. If you like you can now disconnect the T-Board from the ISP programmer, and connect it to a 9-V battery to operate in stand-alone mode. Hopefully you'll agree that this was a great deal simpler than laying a full microcontroller bread- board out. Listing 1. T-Boards LED Blinker. /* * T_Board_Bli nk. c * * Created: 24/05/2014 11:54:26 * Author: Andrew Retallack, Crash-Bang Prototyping * */ #define F_CPU 16000000UL //We are running at 16MHz. Used to time the delay #include #include int main (void) { //Configure the LED port DDRB |= (1<o ( Attei microcontrollers, where they have a wide range of uses: here we look at a few. One of the longest chapters in the ATmega328 data sheet is the one that describes its three tinners. The timers can be used in so many dif- ferent ways that we only have space here to look at a small fraction of the possibilities. The main application areas are in measuring time inter- vals and frequencies, and in generating various signals including PWM output. Measure those microseconds The need to measure time intervals often crops up in electronics. For example, we might want to know how long it takes to output some data to an LCD module: is it milliseconds or microseconds? Without some inside knowledge, the only way is to measure it. The ATmega328 has a suitable module already on board in the form of Timerl, which has a resolution of 16 bits. Now, all the timer module does is simply act as a counter of regular events. In this case, with a 16-bit counter, the maximum count is 65535, after which the counter returns to zero: this is called 'overflow'. If things are arranged so that the counter incre- ments once a microsecond we can measure time intervals of up to 65535 ps. Between the crys- tal oscillator and the clock input of the counter there is a programmable prescaler (similar to the arrangement for the A/D converter) that divides down the clock frequency. If a 16 MHz crystal is used then the required division ratio to obtain a 1 MHz clock for the timer is 16. So our first attempt reads Config Timerl = Timer , Prescale = 16 30 September 2014 www.elektor-magazine.com Microcontroller Bootcamp but unfortunately this does not work. The error message we get is 'Prescale value must be 1, 8, 64, 256 or 1024', and the data sheet of the ATmega328 confirms the problem. So, we shall set the prescaler ratio to 8 and obtain an input clock to the timer of 2 MHz and a maximum interval measurement of 32767.5 ps. At any time the 16-bit register that holds Timerl's value can be read or a new value can be written to it. This makes our example very straightforward. Before outputting the data to the LCD module we set the counter to zero ('Timerl = O'). After outputting the data we read the counter value ('D = Timerl') and we have the result of the measurement in units of 0.5 ps. To convert to microseconds we simply divide the result by 2. Listing 1 shows the complete program. As in all the programs we shall look at here, the result is displayed on the Arduino shield LCD module we described in the previous installment in this series, and simultaneously the result is output to the terminal using a 'Print' command. The program will work even if the display is not connected: Bascom does not check whether the display has actually received the data it sends to it. The first result we see is 'Timer 1 = 0 us': this happens because at this point, before the first measurement, the variable D has not been set. The second result looks rather more interesting, giving the time taken to output the first result to the LCD: 'Timer 1 = 17105 us'. Now in this case four additional digits have had to be sent to the display, and so we would expect the process to take a little longer. And indeed it does, the third result being 21933 ps. The results now stabilize, with variations between successive readings of at most one microsecond. So now we know exactly how long a complex process like writing a string to the LCD takes. The precision and repeatability we have seen would be unimaginable on a Windows or Linux machine, since these complex operating systems do not handle real-time functions well: there is always some process running in the background that makes it impossible to predict exactly how long some action will take. Under Bascom things are different: the processor executes exactly the code you tell it to execute and nothing more. Moreover, being so close to the hardware, some commands such as setting an output bit execute in less than a microsecond. Outputting to the LCD takes around a millisecond per character because Bascom allows plenty of time for the controller in the module to accept the data. If you take a look at the E signal on the LCD (port pin PD3, Arduino pin 3) using an oscilloscope you will see the 1 ms delays. Measuring the period of a signal A small modification to our program (see List- ing 2) allows it to measure the length or period of a pulse. We use input PCO (Arduino AO: see Figure 2), and we will measure the time between two rising edges of the input signal. We need two sampling loops to detect an edge reliably: first we wait until the input reads as a zero, and then we wait until it reads as a one. This will detect Listing 1. Measuring the time taken to output to the LCD. 'UNO Timerl. BAS Timerl 0.5 us Dim D As Word Config Timerl = Timer , Prescale = 8 'Clock 2 MHz Do Print "Timerl = Print D; Print " us" Timerl = 0 Locate 1 , 1 Led "Timerl =" Locate 2 , 1 Led D Led " us" D = Timerl D = D / 2 Waitms 1000 Loop Figure 1. Time measurement using Timerl. www.elektor-magazine.com September 31 •Projects Figure 2. Measuring the period of a signal. the first rising edge, and we set the timer reg- ister to zero. We now wait for the second edge, and read the result from the timer. If a finger is touched on the input pin, the micro- controller will receive a signal picked up from the mains supply, which will be at 60 Hz in the USA and 50 Hz in most other countries. We would expect a result of around 16667 ps or 20000 ps respectively. In a real experiment (carried out in Europe) a reading of 20030 ps was obtained, a little on the slow side. Since the mains supply in most of mainland Europe is phase-synchro- nous, we can only conclude that perhaps too many power stations had been turned off or the sun was not shining brightly enough or the wind not blowing strongly enough. Perhaps it might be worth turning a couple of lights off and try- ing again... In order that we have a reliable signal to mea- sure, the program includes its own clock source, taking advantage of the PWM outputs. However, there is a potential problem. PWM1A and PWM1B cannot be used because we have already commit- ted Timerl for making the measurement itself. That leaves us with TimerO and Timer2, each of which can also drive two PWM outputs. However, these extra outputs mostly appear on Port D and would therefore interfere with the LCD interface. An exception is PWM2A which is on port pin PB3 (Arduino pin 11), and so this is the one we use to output our test signal. Timer2 has only an 8-bit counter but if we set its prescaler ratio to 256, we can obtain an output frequency of 16 MHz / 256 / 255 / 2 = 122.549 Hz and hence an output period of 8.16 ms. Connecting PB3 to PC0 lets us measure this signal, and the reading we get is 8160 ps. Result! Square wave generator, 125 Hz to 4 MHz A variable-frequency signal generator is often a Listing 2. Measuring the period of a signal in microseconds. ? ' UNO_Ti mer2 . BAS Timerl, 0.5 us ? Dim D As Word Config Timerl = Timer , Prescale = 8 'Clock 2 MHz Config Timer2 = Pwm , Prescale = 256 , Compare A Pwm = Clear Up Ddrb = 255 Pwm2a = 128 Do Do Loop Until Pinc.O = 0 Do Loop Until Pinc.0 = 1 Timerl = 0 Do Loop Until Pinc.0 = 0 Do Loop Until Pinc.0 = 1 D = Timerl D = D / 2 Locate 1 , 1 Led "Timerl =" Locate 2 , 1 Led D Led " us " Print "Timerl = "; Print D; Print " us" Waitms 1000 Loop 32 September 2014 www.elektor-magazine.com Microcontroller Bootcamp Listing 3. Timerl used as a square wave generator. i If SI = 0 Then ' UN0_Timer3 . BAS Bl Fout 250 Hz... 4 MHz i— i + o ii o i If D > 100 Then D = D + 1 • • • If D > 1000 Then D = D + 100 If D > 10000 Then D = D + 1000 Dim D As Long If D > 64000 Then D = 64000 Dim F As Long End If Dim N As Byte If S2 = 0 Then If D > 2 Then D = D - 1 Config Timerl = Pwm , Prescale = 1 , Pwm = 10 , If D > 100 Then D = D - 10 Compare A Pwm = Clear Up If D > 1000 Then D = D - 100 If D > 10000 Then D = D - 1000 Tccrla = &B10000010 ' Phase-cor rect PWM, Top=ICRl If D > 64000 Then D = 64000 Tccrlb = &B00010001 ' Prescaler=l End If Locate 1 , 1 D = 8000 F = 16000000 / D Do F = F / 2 N = Ischarwai ti ng( ) Led F If N = 1 Then Led " Hz " Input F Icrl = D D = 8000000 / F Ocrla = D / 2 If D > 64000 Then D = 64000 Waitms 50 If D < 2 Then D = 2 Loop End If useful tool to have. At 1 MHz it might be used to test a frequency counter, or at 440 Hz it might be used to tune a violin. The program shown in Listing 3 covers the whole range from 125 Hz to 4 MHz. Timerl is used as a frequency divider and the signal is output on the PWM1A pin (Bl, Arduino pin 9: see Figure 3). This is an exam- ple of an application where we are going a little beyond the standard uses of Bascom, and in par- ticular its built-in initialization functions are not suitable for our purposes: we have to program a few registers directly. I borrowed some ideas from Roger Leifert's DCF simulator [1], and he in turn borrowed from the code in Martin Ossman's SDR course [2], which is written in C. We use a variant of PWM output mode where we adjust the frequency while trying to maintain a duty cycle of approximately 50%. Register LCR1 is loaded with the desired division ratio. If, for example, this value is 100, then the output frequency will be 16 MHz / 100 / 2 = 80 kHz. To ensure that the output is a symmetric square wave we need to load register OCR1A with the value 50. The program can be controlled (simultaneously) in two different ways: over the serial port using a terminal emulator program or using buttons. When pressed, the buttons increase or decrease the division ratio, and the program calculates the resulting frequency and displays it. A brief press of a button changes the ratio in small steps, while a longer press causes the ratio to change Figure 3. Adjustable square wave generator. www.elektor-magazine.com September 33 •Projects 16 MHz 1 kHz |>C^ /64 250 kHz TimerO, /250 oC> Interrupt the frequency range. This means that many fre- quencies will only be approximated rather than generated exactly. The output frequency is dis- played in Hertz and the numbers involved are such that the calculations must be done not using word variables but with 'long' (32-bit) quanti- ties: this applies both to the frequency F and to the division ratio D. Figure 4. Producing 1 kHz from 16 MHz. (almost) continuously. Since it would be rather tedious to step through all the possible ratios in this way (there are more than 65000 of them), the amount of increment changes depending on Listing 4. Counting seconds exactly using an interrupt. i ' UNO_Ti mer4 . BAS ' Ti merO-Inter rupt , Seconds i Dim Ticks As Word Dim Seconds As Word Dim Seconds_old As Word Config TimerO = Timer , Prescale = 64 On OvfO Tim0_isr Enable TimerO Enable Interrupts Do If Seconds <> Seconds_old Then Print Seconds Seconds_old = Seconds Locate 1 , 1 Led Seconds End If Loop Ti m0_i sr : ' 1000 ps TimerO = 6 Ticks = Ticks + 1 If Ticks = 1000 Then Ticks = 0 Seconds = Seconds + 1 End If Retu rn End It is perhaps not completely obvious how the program manages to respond both to button presses and to input on the serial port. If we write simply 'Input F' then the program will wait at this point until a value is entered, and will not respond to the buttons. We therefore have to check first whether there is a character available on the serial interface: the function IsCharWait- ing() returns a value of 1 if there is at least one character available and zero otherwise. In our case, if one character arrives on the serial inter- face then we know that there are more to come, and we can safely read in a new value for F. From F we can calculate the required division ratio, in many cases obtaining an exact result. At 440 Hz there is only negligible error, although at 549 kHz, for example, only a rough approxima- tion is available: the program chooses a division ratio of 14, which results in an output frequency of 571428 Hz. The smallest division ratios give rise to the highest frequencies, namely 4 MHz, 2.666666 MHz, 2 MHz, 1.6 MHz, 1.333333 MHz and 1 MHz. If these are useful to you, then you could build the design as a self-contained unit. The steep edges on the signal on output PB1 mean that it contains harmonics well into the VHF range. This means it is all too easy for the signal generator to become a source of radio interference. For example, if you connect the oscilloscope probe to the output but forget to connect the ground clip close by then a large and rather effective VHF loop antenna can be cre- ated via the ground connection to the USB port and then through the PC's power supply and the mains. Unsurprisingly this can disrupt reception on nearby FM radios and hence relations with your neighbors! To keep on the right side of the EMC regulations (and your neighbors) it is neces- sary to use either a screened cable, or a resistor close to the signal generator's output to reduce the amplitude of the higher harmonics. A resistor of 1 kft in conjunction with a cable capacitance of 30 pF forms a low-pass filter with a cutoff frequency of 5 MHz. The edges of the signal are 34 September 2014 www.elektor-magazine.com Microcontroller Bootcamp smoothed considerably, and VHF interference is reduced by around 20 dB. Timer interrupts In the previous installment of this series we looked at an example program that generates a one-second clock. The timing used a simple 'Waitms 1000' command. Now this approach does not give an exact result, as the other parts of the program such as the infinite loop and the code that generates the output all take time. The problem can be avoided using a timer interrupt: that is, allowing a certain part of the code to execute exclusively under control of a timer. It works as follows. A hardware timer counts away, completely independent of other activity in the microcontroller. When it reaches its maximum count and resets to zero ('overflow') the program executing in the foreground is interrupted and a special piece of code called an 'interrupt ser- vice routine', or ISR, is called. Within this piece of code we can carry out any actions that need to happen at exactly-specified time intervals. It makes no difference how long the ISR itself takes to execute as the hardware timer is continuing to count: the only thing that matters is that the routine completes before the next time the timer overflows and triggers the interrupt again. For the job of generating a precise one-second clock Timerl is overkill: the eight-bit resolution of TimerO is plenty for this application. We will arrange for the timer to overflow and hence gen- erate an interrupt every 1000 ps. The interrupt service routine, which, as it is triggered from TimerO, we have called 'TimOJsr:', will thus be called every millisecond. The colon means that 'TimOJsr:' will be interpreted as a label, marking a point in the code which can be jumped to. The command 'On OvfO TimOJsr' tells the micro- controller to jump to this label whenever there is an overflow ('Ovf') on TimerO. The interrupt service routine must finish with a 'Return' com- mand: after that point the interrupt routine can be called again. The example program shown in Listing 4 ini- tializes TimerO with a prescale ratio of 64, which means it increments at 250 kHz (see Figure 4). If we did not take any further steps the timer would overflow on every 256th clock, as the counter is eight bits wide. To arrange for an overflow every 250 clocks, the first thing the interrupt service routine does is load the counter with the value 6. The result is that the routine is called exactly every millisecond. The word variable 'Ticks' is incremented by one on each timer overflow. When it reaches 1000 the variable 'Seconds' is incremented. The variables 'Seconds' and 'Ticks' can be read from the main program code. In this example the program outputs the number of seconds since it was started, both to the LCD and to the terminal. To ensure that the interrupt service routine is actually called, the corresponding interrupt (the TimerO overflow interrupt) must be enabled. This is done with the line 'Enable TimerO'. Interrupts must also be globally enabled, using the com- mand 'Enable Interrupts'. The complementary command 'Disable Interrupts' prevents all inter- rupts from occurring. Averaging analog readings Analog readings often have mains hum, at 50 Hz or 60 Hz depending on the local frequency, super- imposed on them. One way to try to remove this is to take the average of a number of consecutive samples: see Listing 5. If readings are aver- aged over an integer number of mains cycles (that is, over a multiple of 20 ms or 16.667 ms respectively), the effect is to create a null at that frequency. In other words, the hum will be sig- nificantly attenuated. Again in this example we use a timer interrupt to ensure accurate timings. We will take the aver- age of 500 consecutive readings from ADC0 (see Figure 5), which a total of 400 ms. Now this is Figure 5. AC and DC voltage measurement. www.elektor-magazine.com September 35 •Projects Listing 5. Averaging within a timer interrupt. ? ' UN0_Timer5 . BAS Timerl-Interrupt , ADC0 average i Dim Ticks As Word Dim Ad As Word Dim Ad0 As Long Dim Ad0_mean As Long Config Adc = Single , Prescaler = 32 , Reference = Internal Config Portb.2 = Output Config Timer2 = Timer , Prescale = 64 On 0vf2 Tim2_isr Enable Timer2 Enable Interrupts Do Disable Interrupts AdO_mean = AdO_mean * 2443 'AC 'Ad0_mean = Ad0_mean * 1100 'DC Ad0_mean = Ad0_mean / 1023 AdO_mean = Ad0_mean / 500 Print Ad0_mean Locate 1 , 1 Led Ad0_mean Led " mV " Enable Interrupts Waitms 1000 Loop Ti m2_i sr : ' 800 ps Timer 2 = 56 Portb.2 = 1 Ticks = Ticks + 1 Ad = Getadc(O) AdO = Ad0 + Ad If Ticks >= 500 Then Ticks = 0 Ad0_mean = AdO AdO = 0 End If Portb.2 = 0 Return End exactly 20 periods at 50 Hz and 24 periods at 60 Hz and so in either case we are averaging over an integer number of mains cycles. The period between conversions is 800 ps, and to generate this timing we use Timer2, again with a pres- cale ratio of 64. Each time Timer2 overflows it is reloaded with the value 56, and so the next overflow occurs exactly 200 clocks later. Eight hundred microseconds is long enough to carry out one conversion (or even several) and accumulate the results. The calls to the inter- rupt routine and hence the individual readings are counted in the variable 'Ticks', and after 500 readings have been accumulated the sum in vari- able 'ADO' is copied to the variable 'AD0_mean'. The foreground code can read this variable and send the result to the terminal. It is sound practice to use an oscilloscope to check that the interrupt routine is running as expected. Is it really being executed every 800 ps, that is, at 1.25 kHz? How long does it take to service the interrupt? A simple trick helps to see what is going on: at the start of the interrupt service routine set a port pin high, and at the end take it low again. In this example we use port PB2, which is connected to LED 2. The oscilloscope does indeed show a pulse every 800 ps lasting about 60 ps, and so there is nothing to worry about. In other cases, however, it can happen that so much is packed into the interrupt service routine that the main program never gets executed, and it is not always obvious what is happening. Fur- thermore, when interrupts are used, the timing of the main program is no longer so easily pre- dictable; a good rule of thumb is to ensure that no more the 50 % of the microcontroller's time is spent in interrupt service routines. The averaging process is so good at removing the mains hum component of the signal that it can be used to measure AC voltages using half- wave rectification. The A/D converter already performs half-wave rectification, in that it only measures positive voltages and all negative volt- ages read as zero. If an AC voltage is applied to the A/D converter input via a 10 kft series pro- tection resistor then the converter will only see the positive half-cycles. The program will then average these readings, with the result that, in the case of a square wave input, the average of these half cycles is half the DC voltage with the same effective (RMS) value as the input. In the case of a sinusoidal input there is a further factor of pi/2 = 1.571: in other words, the calculated 36 September 2014 www.elektor-magazine.com Microcontroller Bootcamp Figure 6. Frequency meter with test output. average is 90.03 % of the true RMS value. These factors can be taken into account in calculating the displayed reading in millivolts. For pure DC measurements the fact that the reference voltage is 1100 mV means the correction factor is 1100. For AC voltage measurements the factor should be 2443, and readings will be correct up to a peak input voltage of 1.1 V. The procedure also works at other frequencies, and in fact voltages at any frequency from 50 Hz to 50 kHz can be measured, meaning that the set-up can be used as a wide-bandwidth millivoltmeter in audio and other applications. Frequency measurement In the examples we have looked at so far the timer has received its clock pulses from within the processor, either directly from the proces- sor's clock or via a divider. However, it is possi- ble to clock the timer using an external signal, in which case the timer behaves as a pulse counter. Timerl in an ATmega328 clocked at 16 MHz can reliably count external pulses at a frequency of up to 4 MHz. Unfortunately, the input lies on port pin PD5 (see Figure 6) and so we cannot use the LCD module as well. We could alternatively use an external LCD module controlled over a serial interface, but for now we will simply send our results to a terminal emulator running on a PC. To use Timerl as part of a frequency counter (see Listing 6) we also need to measure the Listing 6. Frequency measurement up to 4 MHz. ? ' UNO_Ti mer6 . BAS Frequency 0...4 MHz ? Dim Lowword As Word Dim Highword As Word Dim Ticks As Word Dim Freq As Long Config Timer© = Timer , Prescale = 64 On OvfO Tim0_isr Enable Timer© Config Timerl = Counter , Edge = Falling , Prescale = 1 On Ovfl Timl_isr Enable Timerl Config Timer2 = Pwm , Prescale = 1 , Compare A Pwm = Clear Up Pwm2a = 128 1 B3 : 31373 Hz Enable Interrupts Do Pri nt Freq ; Print " Hz Pri nt Chr (13) ; Waitms 1000 Loop Ti m0_i sr : ' 1000 ps Timer© = 6 Ticks = Ticks + 1 If Ticks = 1 Then Timerl = 0 Highword = 0 End If If Ticks = 1001 Then Lowword = Timerl Freq = Highword * 65536 Freq = Freq + Lowword Ticks = 0 End If Retu rn Ti ml_i sr : Highword = Highword + 1 Return End www.elektor-magazine.com September 37 •Projects Listing 7. Text output on the LCD. » Do ' UNO_Di splay . BAS COM input BO 'Input Textl i Input #2 , Textl Locate 1 , 1 Led Text2 Dim Textl As String * 16 Text2 = Textl + Dim Text2 As String * 16 Locate 2 , 1 Led Text2 Open "comb . 0 : 9600 , 8 , n , 1" For Input As Loop #2 'Software COM input at BO End Figure 7. The frequency displayed using the terminal emulator. Figure 8. The LCD terminal. gate time accurately. To do this we use a second timer and two interrupts. So that we can mea- sure frequencies above 65535 Hz, the interrupt service routine Timljsr is called whenever it overflows to increment the variable 'Highword'. TimerO is responsible for providing a gate time of exactly one second. When the variable 'Ticks' is equal to one Timerl is reset and counting starts. Exactly 1000 ms later the current counter value in Timerl is read into the variable 'Lowword' and then the frequency is calculated from this and the value in 'Highword'. The foreground code can now output the result as a frequency in Hertz. If we configure Timerl as an ordinary timer with a 16 MHz clock (using the command 'Config Timerl = Timer , Prescale = 1') then we should see a reported frequency of exactly 16000000 Hz. With the timer configured as a counter, however, the maximum increment rate is limited to a quarter of the processor clock, because the state of the input pin is only sampled at a limited rate. If we try an input frequency of 6 MHz we find that approximately every other pulse is lost, giving a reading of around 3 MHz. At frequencies up to a little over 4 MHz, however, the counter is very accurate. Observe one special aspect of the 'Print' com- mands. Normally Bascom terminates each print command by emitting Chr(13) and Chr(10), which makes it easy to send the output of one Bascom program to the input of another. However, in the receive direction only the character Chr(13) is expected, which means that we can suppress the line feed character (the Chr(10)) and send just the carriage return (the Chr(13)). To display the results we can use Bascom's own terminal emulator: the effect is that each new reading 38 September 2014 www.elektor-magazine.com Microcontroller Bootcamp overwrites the old on the same line rather than beginning a new line for each: see Figure 7. External display A simple solution to the problem of not being able to use the display directly is to use another Arduino. One, with an Elektor shield fitted, func- tions as the display module, while the other acts as the frequency counter, sending its results over a serial interface to the first. Listing 7 shows the code for a simple display with scrolling output. The last two lines are always shown. The program offers two possibilities for receiving serial data. The command 'Input Textl' (com- mented out) uses the normal serial RX input on DO. This input is connected to the USB interface on the Uno board via a 1 kft series resistor. This signal can be overridden using a low-impedance drive, as for example happens when the RX pin on the display unit is connected directly to the TX pin of the transmitting Uno (the one carrying out the frequency measurement). The disadvantage is that communication during the next program upload using the bootloader will be disturbed. It is easy to forget this, which can lead to a lot of head-scratching when you next make a change to the program! The second possibility takes advantage of Bas- com's ability to implement a serial port in soft- ware using any desired port pin. Here we have chosen PBO (Arduino pin 9: see Figure 8) and use the command 'Input #2, Textl'. The text is received just as reliably, and there is no inter- ference with program upload. Web Links [1] Roger Leifert, 'DCF Tester', Elektor June 2014, www. elektor-magazine. com/1 30571 [2] Martin Ossmann, 'AVR Software Defined Ra- dio', Elektor April 2014, www. elektor-magazine. com/100 181 ( \ ■ ■ ^ |5 Add USB to your next project. w O D It's easier than you might think! DLP-USB1232H: USB 2.0 UART/FIFO HIGH-SPEED 480Mb/s • Multipurpose: 7 interfaces • Royalty-free, robust USB drivers • No in-depth knowledge of USB required • Standard 18-pin DIP interface; 0.6x1 .26-inch footprint DLP-I08-G 8-Channel Data Acquisition Only $29.95/ • 8 I/Os: Digital I/O Analog In Temperature • USB Port Powered • Single-Byte Commands DLP-IOR4 4-Channel Relay Cable DLP-THIb Temp/Humidity Cable DLP-RFID1 HF RFID Reader/Writer DLP-FPGA USB-to-Xilinx FPGA Module www.dlpdesign.com Advertisement SSPORT-SIZ6 PC SCOPES oc fnr field use with laptops. to” 200MHz oandwidtn with ttsa/s .W* °tL„ streaming to iMSa/s. bu.lt in 1Hz SCOPE kabie 30MHz, 2-cb asajsjsamp'e scilloscope. 8-in color TFT-LCD and cale function, includes FRK carry 3 yr warranty! -SDS 5032 E $ 28 " Hr SCOPE eu,ng 60 MHz 2-cn scope with 500Msa/s nuge lOMSa ;s free carry case! - SDS 6062 "owa $3 AINO ADDR AIN1 ALERT/RDY AIN2 SDA AIN3 SCL □ o 10 ADS1115 IDGST ALERT/RDY POWER +3V3 O RIO C4 2N7002 © ; ic 2 lOOn (5) JP4 l 2 C Address 2 1 j~\ r\. (l 3 J~\ A. (. 5 u~\ r\. 1% R6,R7 = 2.2kQ 1% R8 = lkft 5% R9,R10 = 560ft 1% Capacitors (0603) Cl = 47pF 5%, 50V, COG/NPO C2 = 10pF 20%, 6.3V, X5R C3 = 470nF 10%, 10V, X5R C4,C5 = lOOnF, 10% 16V, X7R Semiconductors D1 = LED, yellow, 0805 D2 = LED, green, 0805 T1 = 2N7002 (SMD SOT23) IC1 = ADS1115IDGST IC2 = OPA377AIDBVT IC3 = REF2912AIDBZT Miscellaneous K1,K2 = 3-way PCB screw termi- nal block, 0.2" pitch K3 = 14-pin (2x7) pinheader, 0.1" pitch JP1 = 3-pin pinheader, 0.1" pitch, with jumper JP2,JP3 = 2- pin pinheader, 0.1" pitch, with jumper JP4 = 8-pin (2x4) pinheader, 0.1" pitch, with jumper PCB 130485-1 Our Arduino sketch performs the same software function as Kurt Diedrich's original project: An endless loop repeatedly tells the ADC chip to measure and digitize the voltage at input AINO in single-ended and single-shot mode. The measure- ment range extends from -2.048 V to 2.048 V, while in Single-ended mode only 0 to 2048 mV can be measured and with only 15-bit resolu- tion. The decimal output values (0 to 32767) after conversion are sent out as ASCII characters over the serial interface, followed by a and character. For testing we used an Arduino Uno fitted with the Elektor extension shield described in the last issue [7] connected to the ADC board via a 14-way ribbon cable. The I2C address of the ADC board is configured as 'ground' i.e. the jumper is placed in the first position of JP4 nearest the Gnublin/EEC connector. Initially we will not use any offset correction (JP1 jumper fitted nearest the terminal blocks). Now to generate the voltage to measure we con- nect a flying lead from the Arduino pin A3 (you can connect it at the shield box header connec- tor as shown in Figure 4) to the AINO input of the ADC board. The voltage on A3 can now be adjusted by twiddling the pot on the shield; this gives us a rudimentary test set-up to check operation of the ADC board. The voltage at A3 can be turned up to 5 V but it's important that the input voltage level does not exceed 3.6 V so before connection ensure that the pot is turned all the way down so that the voltage is at 0 V then slowly increase it. It is probably easiest to upload the sketch using the Arduino bootloader, that way you only need a USB cable between the Arduino and PC. Once the firmware has been flashed the measured val- ues can be seen on the serial monitor display in the Arduino development environment or via a simple terminal emulator program (data rate set to 115,200 Baud and the corresponding COM port selected). To achieve the highest measurement accuracy it is better to power the Arduino from a bench power supply rather than from a USB port. It will provide much better common-mode noise performance. Some spooky signals If you like you can now try out the recorder soft- ware that Kurt Diedrich developed for a his ELF reception experiments. Now when you turn the pot the values are recorded over time in soft- ware. You can also switch in the 1022 mV offset and see how the measured values change. Volt- age levels in the range of approximately -1 V to + 1 V can be measured with 15-bit resolution, this set up can be put to good use investigating the presence of ELF signals in your location. If this sounds interesting have a look at the 'ELF Receiver' project described in this issue you may be in for some surprises! ( 130485 ) www.elektor-magazine.com September 45 •Projects Isolated Oscilloscope Petite and practical Isolating transformers A widely used and fairly low-cost maneuver is to connect the oscilloscope to the AC power line by means of an isolating transformer. In this way the protective ground wire is overridden, eliminating any danger of live circuit elements becoming grounded when the probe is attached. Any risk of a short circuit and possible destruc- tion of the circuitry is thus averted. Conversely a clear hazard remains, in that the probe leads might become energized at high potential (AC Probe By Erik Lins (Germany); erik.lins@chip45.com However much you might wish for an oscilloscope with electrically isolated inputs, it's hard to justify the cost for personal projects. Even differential probes, which (within certain limits) enable voltages to be measured without reference to ground, often cost the pri- vate user more than a complete scope does. So what can you do when either safety considerations or the nature of the task in hand require the use of iso- lated connections to your oscilloscope? line voltage for instance), putting parts of the oscilloscope equally at risk. In particular the BNC connectors of channels not in use at the time could be rendered live (and these are not pro- tected against accidental touch). When multiple probes are connected, these too could become live, so ideally they need to be placed where there is no risk of accidental contact with them. In the worst case these probes might be connected to other part of the circuitry under Features • Electrical separation of 1 analog signal and 2 digital signals • Max. input voltage ±250 mV (or ±2.5 V/±25 V, determined by jumper) • Amplification factor between input and output: 8 x (without voltage divider on input) • Signal bandwidth, analog input: 60 kHz • Signal bandwidth, digital inputs: 1 Mbps • Power supply via separate AC adapter or Mini USB connector • Power requirements: 5 V; 110 mA 46 September 2014 | www.elektor-magazine.com Isolated Scope Probe examination and cause the isolating transformer to become short-circuited. For these reasons the isolating transformer method is reliable only for making electrically isolated mea- surements on one single channel, at low voltages. When two channels are involved, with most scopes you can, in principle, make differential measure- ments (e.g. channel 1 minus channel 2), but the input wiring of the channels imposes limitations on matters such as common mode rejection range. Accordingly the isolating transformer method should not be first choice for an experimenter taking measurements on high voltages. Differential probes Moving on, differential probes are the next more expensive method for making measurements without reference to ground. The illustration in Figure 1 shows the schematic circuit of a differ- ential probe. The input wiring consists of a voltage divider (high-value series resistance) on each of the Positive and Negative inputs, together with a comparatively low-value resistor in parallel with the input of the opamp. The high-impedance con- nection to the inputs ensures that even at high offset voltages only a small current flows through the series resistors. Since the offset is generally the same for both inputs (e.g. high-side shunt measurements), the differential voltage does not upset the opamp. The limiting factor here is the common-mode suppression of the opamp, since at larger off- set voltages the common mode rejection range is exceeded sooner or later. In every case the limit is the supply voltage of the opamp. In prac- tice these are often provided with a voltage of ±4.5 V supplied from a 9-V 6F22 (PP3-size) bat- tery. Accordingly, with a voltage divider of 10:1, the maximum voltage you should connect to the inputs of a probe is ±45 V. If you raise the divi- sion factor to 100:1, theoretically you could go up to ±450 V and in this way use a shunt to take measurements across a 230 VAC or 115 VAC cir- cuit. That said, you must operate only in voltage ranges for which the components used in the input circuitry are rated for adequate dielectric strength. In other words, not every differential probe is suitable. In addition, the greater the division factor for the input voltage, the more you correspondingly reduce the signal being mea- sured. This (if you are using shunts) is already tiny, since shunts are configured with as low resistance as possible to prevent power dissipa- tion. For example, a useful signal of ±250 mV with an offset of +40 V produces, for a division ratio of 10:1, a signal of ±25 mV with 4 V off- set. If we set the oscilloscope for 1 V/Div, to center the 4 V at the middle of the display, the wanted signal amounts to just 1/40 Div. Even if you set the scope to show 0.1 V/Div, the signal we are trying to display amounts to just 1/4 Div, which corresponds to a resolution of only 3 bits (assuming 8-bit vertical resolution). On top of this, to see the entire signal on the display you would need to displace the vertical position of the oscilloscope by -40 V, which is barely feasi- ble even on expensive scopes. Figure 1. Block diagram of a differential probe. The input circuitry consists of the voltage divider (high impedance series resistor) and comparatively low resistance resistor in parallel at each input. Hopeless task? Given that the restricted common mode rejec- tion range and the undesired reduction of the wanted signal produce contrary demands on the input circuit design, there is always a compromise when using differential probes. Flowever, the use of electrically isolated probes offers an elegant solution here. This approach allows unrestricted connection to high voltages, without any high offset voltage arising on the inputs of the internal opamps. Moreover, an electrically isolated probe has advantages even when high offset voltages are not involved, such as when ground loops must be avoided. Selecting suitable components The Internet is brimming with homebrew circuits for isolated probes and discussions about the hookups employed. Nevertheless it soon becomes apparent that most of these solutions rely on using differential probes that do not provide gen- uine electrical isolation. To keep our circuit simple, we too settled against a true differential probe and opted for a circuit using a simple isolation www.elektor-magazine.com September 47 •Projects Figure 2. The AMC1200 is a "fully differential isolation amplifier" capable of handling input voltages up to ±250 mV. 250 mV VINP VINN VDD1 — O — ■o GND1 VDD2 VOUTP O VOUTN GND2 2 V 2 V 130297 - 13 Figure 3. Block diagram of the AduM5242, a two-channel isolator with integrated DC/ DC converter. amplifier for a single probe, as this seemed to represent the commonest need in semi-profes- sional circles. For its functioning an electrically isolated opamp requires two separate supply voltages that are each isolated electrically from one another. The supply for the output side can share the same ground potential as the oscilloscope, whereas the input side must not share any ground refer- ence with the scope. The simplest solution is to use a pair of 9 V 'block' batteries to produce the ±4.5 V supply voltage (one for the input side of the opamp and one for the output). The phys- ical size of two 9 V batteries (each H: 48.5, L: 26.5, W: 17.5 mm) plus the constant need to have two fresh batteries on hand are admittedly distinct disadvantages. An electrically isolated DC/DC converter is another possibility for powering the input of the opamp, making one additional single supply voltage nec- essary for the output side. The typically low cur- rent demand of an opamp permits the use of a small DC/DC converter, requiring few external components. The secondary voltage must natu- rally go well with the electrically isolated opamp employed. The search for an appropriate opamp didn't take long and we rapidly opted for the well-known ISO series from Burr Brown (now Texas Instruments), specifically the IS0124 [1]. Its isolation rating is 1500 V with an amplification factor of 1 (unity gain) and a supply range from ±4.5 V up to ±18 V. The signal bandwidth for the IS0124 is typically 50 kHz. This is of course rather small, even when considered against the 10 to 100 MHz bandwidth of a low-cost oscilloscope. Nevertheless the ana- log voltages encountered in the semi-professional range would typically not exceed this bandwidth. However, to keep costs down we opted for the AMC1200 [2] from the same manufacturer. Once again we're talking about an electrically isolated opamp (Figure 2), which is configured primar- ily for taking high-side shunt measurements. It operates from a simple supply voltage of 5 V on each side and has an input voltage range of ±250 mV plus a fixed gain factor of 8. So with ±250 mV at the input we have ±2 V on the out- put. The signal bandwidth is 60 kHz, which in our opinion is satisfactory for this application. Current consumption is agreeably low at typically 5 mA, enabling a small DC/DC converter from the iCoupler range made by Analog Devices to be used along with a straightforward 5 V supply. What we have here is an electrically isolated cou- pler predominantly for digital signals, e.g. such as SPI or I2C interfaces. Some of the compo- nents in this range, however, have in addition to the couplers for the digital signals a low-power 5 V/5 V DC/DC converter on board, providing what AD calls "isoPower". Primarily this is for serving the coupler's own supply needs but it has a small power reserve that is adequate for our AMC1200. The ADuM5242 [3] we selected comes in SOIC-8 package format and is therefore easy to solder by hand. In addition to the DC/DC converter there are also two digital couplers on 48 September 2014 | www.elektor-magazine.com Isolated Scope Probe board (Figure 3), enabling our circuit not only to measure the electrically isolated analog voltage but also to handle two digital signals, again in electrical isolation. Two pin-compatible variants exist also, the ADuM5240 and 5241, offering two independent isolation channels in a variety of channel config- urations. Configured appropriately, these can be used for electrically isolated control of digital sig- nals in the measurement circuitry. One disadvan- tage of the iCoupler chip and its integrated DC/ DC converter is the rather restrained efficiency factor of the converter, which is less than 20 %. We now have an all-5 V solution; 5 V supplies are widely available and should be easy to find virtually everywhere. If nothing else, many mod- ern oscilloscopes possess a connector for USB memory sticks, through which our circuit could also be powered. For sake of completeness it should also be men- tioned that significantly more powerful isolation amplifiers are also available, such as the AD216 from Analog Devices [4]. This offers double the bandwidth (120 kHz) and even contains an inte- grated DC/DC converter for the electrically iso- lated supply for the input side. It does, however, require a bipolar power supply of ±15 V and costs six times the price of the combination of ADuM5242 and AMC1200. The circuit The circuit in Figure 4 is comparatively sim- ple and consists essentially of the components already described. The ADuM5242 (Ul) generates the electrically isolated voltages 5 V (VCCiso) and 0 V (GNDiso) for the input side. The two electrically isolated digital channels are taken to a simple three-pin connector strip CON5. The supply for the AMC1200 (U2) is fed via a small choke, which smoothes the output voltage of the ADuM5242 a little more. The negative opamp input is connected to VCCiso/2 via a 1:1 voltage divider (R5/R6), so that the voltage on the positive input at this point can swing ±250 mV at full range. To extend the measurement range to ±2.5 V or alternatively ±25 V we employ the voltage dividers R2/R3 and R2/R4, activated using jumpers J1 and J2 respectively. The jumper settings are as follows: Jl: closed J2: open Jl: open J2: 1-2 Jl: open J2: 2-3 As the voltage dividers have very high resistance (in order to load or degrade the signal source as little as possible) as opposed to the AMC1200, which with 28 kQ. has relatively low differential input resistance, we employ the simple opamp U3 in the signal path as an impedance converter. The oscilloscope probe is connected via CON6 ji CON6 Center Shield 1/1 R2 9M Analoglnput CON5 1 3 Digitallnputs J2 1/100 1/10 31 SI OPA333AIDBV VCCiso O C3 HH lOOn DIGIiso DIG2iso GNDiso T R5 0 R6 0 Ul LI VDDiso VDD1 VI_A VO A VLB VO_B GNDiso GND1 C4 HH 100n ANAisoP 10pH ADuM5242 U2 ANAisoN VDD1 VDD2 VINp VOUTp VINn VOUTn GND1 GND2 AMC1200 GNDiso R1 vcc o HH 100n Cl C2 HH 100n ANAP 6 ANAN 5 CON3 DIG1 GND DIFF GND GND I GND _2_ \ _3_ _4 5 / 6 7 mini USB CON4 Powerlnput CON2 DIG2 DigitalOutputs CONI thread Center thread AnalogOutput 130297- 12 Figure 4. The circuit is relatively simple and consists essentially of an ADuM5242 (Ul) and an AMC1200. www.elektor-magazine.com September 49 •Projects Component List Resistors (SMD 1206) R1 = 10ft R2 = 9Mft R3 = lMft R4 = 100 kft R5,R6 = lkft Capacitors C1-C4 = lOOnF (SMD 1206) Inductors LI = 10|jH (SMD 1206) Semiconductors U1 = AduM5242 (SOIC-8) U2 = AMC1200 (SOP-8) U3 = OPA333AIDBV (SOT-23) Miscellaneous CONI = BNC plug, panel mount CON2,CON5 = 3-pin pinheader, 0.1" pitch CON3 = mini-USB receptacle CON4 = 2-pin pinheader, 0.1" pitch CON6 = BNC socket, panel mount PCB # 130297-1 [5] Figure 5. to the input of the voltage divider and the neg- The circuitry goes ative input of the AMC1200. At this point the together rapidly on this shield terminal of the probe certainly is not at small printed circuit GNDiso potential but this is not problematic, for board ' one thing because the circuit is "suspended in mid-air" and entirely potential-free thanks to the electrical isolation. The other reason is to enable the input voltage to then swing versus the ground connection according to the setting of the voltage divider by respectively ±250 mV, ±2.5 V or ±25 V. Problems arise only when the digital channels are in use and for this GNDiso (pin 3 of CON5) needs to be linked to the ground of the measure- ment circuit. Doing this also takes the negative input of the AMC1200 down to ground, with the measurement range becoming then only a uni- polar +250 mV (+2.5 V/+25 V), relative to the shield terminal of the probe. Nevertheless this is no more than only a minor limitation, since the circuit is designed primarily for making analog measurements and the two digital channels are purely a bonus gift from the ADuM5242. Incidentally, instead of using the voltage divider specified, our circuit can also operate with a 10 : 1 or 100:1 probe to increase the measurement range (Jl: closed, J2: open). The connections to the power supply and probe input from the oscilloscope CONI are located on the output side of the circuit. The best pos- sible performance is achieved when the circuit is powered, via CON4, from an electrically iso- lated lab power supply unit. The supply voltage is then fully isolated from the oscilloscope and the scope input can be hooked up to the differ- ential outputs of the AMC1200 (jumper J3: 1-2). The signal then swings (at full range) by ±2 V either side of oscilloscope ground. The gain of 8 in the AMC1200 produces a differential aggregate transfer factor, from input to output, of 1:8, 10:8 and 100:8, which correspondingly needs to be taken into consideration when taking readings of the oscilloscope voltage. If your scope provides fine adjustment of the vertical graduation, you can alter this to, say, 125 mV/Div and then take readings with the circuit set to 1:8, as if you had set the scope to 1 V/Div. The circuit also includes a 5-pole Mini USB-B con- nector for obtaining power from, say, the USB memory stick connector on an oscilloscope. In this situation the ground connection of the probe input CONI will be at GND potential at the oscilloscope end and jumper J3 must then be set at position 2-3. If this was not done, negative AMC1200 output would be short-circuited to GND. In this configuration the output signal on the oscillo- scope has a fixed offset of around VCC/2 (2.55 V, see AMC1200 data sheet) and the centre point amounts to only half of this, since we are using only one out of the two differential output signals currently. In this situation the transfer factors mentioned above are halved correspondingly. Taking the power supply from a USB connection is really an emergency expedient, as the purity of the voltage on a USB bus is not adequate for supplying analog circuitry and will be affected every now and again by interference arising from the inner digital regions of the scope. Construction The circuit uses only a few components and since these are predominantly large SMD devices, the PCB in Figure 5 can be assembled rapidly. The PCB layout can be downloaded free from the project page [5]. The ADuM5242 comes in a SOIC-8 package and the AMC1200 in an even larger SOP-8 package, corresponding in essence to a DIP-8 package 50 September 2014 www.elektor-magazine.com Isolated Scope Probe equipped with angled pins for SMD mounting. All resistors and capacitors have the 1206 form factor, enabling them to be soldered without dif- ficulty. The impedance converter U3 differs in having a small SOT-23 package and for this rea- son should be soldered into place with care as the first component to be fitted, followed by the ADuM5242 and the AMC1200. After this come the SMD resistors and capacitors and the wound components. Since BNC plugs for 90° mounting on printed circuit boards are extremely uncom- mon, we have provided the PCB with a suitable cut-out to enable a normal panel-mounting BNC connector to be fitted. To solder it in place you will need a soldering iron with adequate wattage to bring the metal thread of the connector rap- idly to the melting point of the solder, without degrading the plastic insulation inside. The unit is remarkably compact and can be inserted con- veniently between the oscilloscope and probe. Commissioning As a result of the low efficiency factor of the ADuM's DC/DC converter (less than 20 %), the current consumption of the complete circuit is around 110 mA. This figure should be checked after constructing the circuit and connecting it to a 5 V power supply. If you have one, it's advantageous to use a laboratory power supply with presettable current limiting. From prefer- ence, commissioning should not be carried out taking the supply from a USB connector. If the current drawn is significantly greater than the value quoted, checks should be made for possi- ble soldering errors, short circuits or components inserted back to front. After this you should mea- sure the supply voltage VCCiso on the secondary side, which is typically 5.2 V. If both of these values are correct, the circuit can be connected between oscilloscope and probe; you can then check out its correct functioning with a signal source and oscilloscope. Verdict Using modern, low-cost components it's easy to construct a simple isolation amplifier for oscillo- scope probes. The restricted analog bandwidth does admittedly restrict the potential applications, meaning that it's not feasible to measure, for example, the signal quality of differential high- speed signals (such as LVDS, USB or Ethernet). On the other hand, the true electrical isolation provided can occasionally be advantageous for connecting expensive differential probes, if the signal/offset relationship is of importance or when avoiding ground loops is a priority. The modest cost means you can also make several units of this circuit and equip every channel of your scope with electrical isolation. This isolation is provided not merely for the device under test, as could also be achieved with an isolating transformer; doing it this way, every channel is isolated from each other. Consequently you can take poten- tial-free measurements at different points in a circuit with just one single oscilloscope. ( 130297 ) Figure 6. The circuit put into practical use. The PCB of the prototype seen in this photo differs from the board shown in Figure 5. Web Links [1] www.ti.com/product/isol24 [2] www.ti.com/product/amcl200 [3] www.analog.com/en/interface-isolation/digital-isolators/adum5242/products/product.html [4] www.analog.com/en/specialty-amplifiers/isolation-amplifiers/ad215/products/product.html [5] www. elektor-magazine. com/1 30297 www.elektor-magazine.com September 51 Professional Quality Trusted Service Secure Ordering pee i - . Elektor PCB Service at a glance: O 4 Targeted pooling services and 1 non-pooling service o Free online PCB data verification service o Online price calculator available O No minimum order value o No film charges or start-up charges !“ - V i mCHtME, "••-' S'.'! Ji-W ‘ I *« "t f 4< M KWH * i Delivery from 2 workina days /ww. facebook.com/elektorim — - ; - 7 : y- -: v - \ . onnect with us! www.twitter.com/elektor Register for our FREE Elektor.POST newsletter to receive our weekly Summer Deals www.elektor.com/newsletter, || *lf you already receive Elektor.POST you don’t have to act. You’ll automatically receive our Summer Deals. V DESIGNSPARK PCB DesignSpark Tips & Tricks Day #13: Component placement By Neil Gruending (Canada) Figure 1. Autoplace window. Today let's look at DesignSpark's component placement tools. In the previous installments of this series we've spent quite a bit of time looking DesignSpark's schematic features. Now, let's look at some of DesignSpark's PCB features, starting with auto- matic component placement. Then we'll look at some manual placement techniques. Automatically placing PCB components Let's try out DesignSpark's automatic compo- nent placement tool on the LED driver board we designed in an earlier installment. Go into the Tools -> Auto Place Components -> All Compo- nents and you will see the Autoplace Components window shown in Figure 1. This is where you configure the Autoplace tool before running it. I set the minimum component spacing to 0.25 mm and the placement grid to 0.25 mm and got the result in Figure 2. As you can see, all of the com- ponents are spaced properly and DesignSpark did its best to organize the parts on the board. But what if you didn't want all of the compo- nents automatically placed on the PCB? If you select "All Unplaced" from the "Auto Place Com- ponents" menu DesignSpark will take any parts that aren't on the board and put them on the board for you. You can also select one or more components and choose "Selected Components" to place just those components. Both of these commands use the settings that were last used for the "All Components" command. Autoplace Components View Component Placement: 0 Alow Components to be Rotated: □ Alow SMD Components to Swap Side: 0 Don't Place Fixed Components: 0 Fix Components After Place: □ Mrwrajm Space Allowed Between Components: 0.0000 Placement Grid: 0.2000 OK Close Cancel Sometimes you might want to place almost all the components in a design but leave some fixed in their current location. For example, you could have some mounting hole components on the board that you want to keep put while placing all the other components on the bard. One solution is to lock or fix the mounting hole components by right clicking on them and choosing "Fix Item" and the make sure that "Don't place fixed com- ponents" is checked in the placement settings. DesignSpark will also check and skip any com- ponents that have any traces connected to their pads while placing components. That way you can be sure that no components will be discon- nected from their nets. However, DesignSpark will not check if the location where it wants to place a component is free of traces so sometimes it can short out nets like in Figure 3 where Q2 is accidentally connected to the trace between Q1 and Q4. For a larger design I would use the design rule check (DRC) and these kinds of errors would show up as track to pad clearance errors. Manually placing components Want to manually place the components instead? Clicking and moving parts around in DesignSpark PCB is pretty straightforward but it's difficult to know how far apart the components are from each other. The automatic placement tool can do this measurement itself but when you do the placement by hand you're responsible for the component clearances yourself. The most straightforward way to do this is to use a place- ment grid like 0.25 mm and then make sure that there's enough full grid spaces between each component for your desired spacing. For exam- ple you would place two components as close as possible without overlapping them and then move one of them enough grid space horizon- tally or vertically as needed to get the required space. This works well for small boards like out LED driver example but quickly gets tedious if different component spacing is needed or the board has a large number of components. The other option is to use placement courtyards or placement areas in your library components. A 54 | September 2014 | www.elektor-magazine.com sponsored content Tips & Tricks placement courtyard is just a square box drawn on a mechanical layer that includes the compo- nent outline and any component tolerances. Tech- nically they aren't supposed to include manufac- turing and assembly requirements but I usually add a bit of room to make sure my components are at least 0.25 mm from each other. When you place the components on the board, you can space them out however you want as long as you don't overlap the placement courtyards. Let's see how to do this in DesignSpark. When you use the footprint wizard when making a new component, it will ask you if you want a placement outline as the last step which is the same thing as a placement courtyard. You just have to tell it how far you want it from your pads and then it will be automatically added to the footprint. I usually use the top assembly layer for the courtyard so that it's easy to use it as the component outline in an assembly drawing later. You can also manually add the placement court- yard to an existing component like in Figure 4. But before you update the footprint in the PCB you need to add the assembly layers first. Open the "Design Technology" window in the Settings menu and click on the "Layer Types" tab. Click on the Add button and give it a name, I used Assembly. The usage should be Non-Electrical and don't include anything by unchecking all of the checkboxes in the include area. In the Set- tings area, check the Placement Shapes box and finally the Ok button. Now you can add the top and bottom assembly layers to the PCB by clicking on the Layers tab. Click the Add button and name the layer Top Assembly. Then change the type to Assembly and choose a color. Click on the Ok button and repeat the steps to add a bottom assembly layer, but don't forget to change the side to Bottom. Once that's all done our example looks like Fig- ure 5 with a little bit of rearranging. All of the placement courtyards make it easy to see when the components are spaced correctly when none of the courtyards are overlapping or touching. Conclusion Today (or is it this month ©) we looked at various ways to place components on your PCB. I prefer the placement courtyard method but the automatic placement tool is great for quickly evaluating a board to see how well the component fit. Next time we'll look at DesignSpark's routing features. ( 140046 ) HD DesignSparV PCB by Allied Electronics - [PCB Symbol: C:\Users\Neil Gruending\Perforce... C3 Eto Ed* Yww fidd Jettngi look Window Heb 9 X q^udi i*Liir *> Figure 2. Automatic placement example. Figure 3. Placement error. Figure 4. SOT23 placement courtyard. Figure 5. Board with placement courtyards. sponsored content www.elektor-magazine.com | September | 55 DESIGNSPARK PCB Peltier Modules Weird Component #7 Have you ever wondered how one of those small, portable coolers keep things cold without any moving parts? Well wonder no more— they use small, solid state cool- ing systems based on Peltier modules. Let's take a look at how the modules work. By Neil Gruending (Canada) Figure 1. Peltier module construction, (creator: "michbich" under Creative Commons license) Figure 2. Peltier performance curve, (source: heatsinkguide.com) A junction of dissimilar metals creates a thermo- couple which will generate a small voltage that varies with temperature. However, if you apply a voltage to a thermocouple it will create a tem- perature differential— the phenomenon is known as the Peltier effect. When you combine many thermocouple connections in the form of heavily doped P and N silicon together you actually cre- ate a heat pump commonly known as a Peltier or Thermoelectric module. Figure 1 shows how these devices are constructed. Peltier modules aren't 100% efficient so they require power in order to transfer heat from one side of the device to the other. This means that when the hot-to-cold temperature differential is zero, the Peltier module only needs to dissi- pate the heat from its own operation. But as the temperature differential increases the module Hot side Electrical connection A Cold side Interconnect becomes thermally limited, which decreases the amount of heat it can transfer. In practice the typical upper limit is about 70°C. Figure 2 shows what the transfer function looks like. The main advantage of Peltier modules is their reliability due to being all solid state hence not requiring any moving parts like other mechan- ical cooling methods. They are also available in a wide variety of sizes, and are easily controlled by varying their input voltage/current. It's also possible to switch between heating and cooling operation by reversing the current flow through the device. The downside is that Peltier mod- ules are only about 25% as efficient as mechan- ical cooling which limits their practical cooling or heating capacity. Another issue is their limited heat transfer ability, especially over wide tem- perature ranges. Peltier modules have another unique feature where they can be used as thermoelectric gen- erators, converting heat into electricity. They aren't terribly efficient but they can generate a reasonable amount of power depending on the configuration. The big challenge is dealing with their high output impedance and their limited thermal conductivity. Peltier cooling modules are used in a wide variety of products. Besides portable coolers you can find Peltier modules in climate controlled car seats, scientific equipment, spacecraft and even high- end digital cameras. Peltier generators are used in the oil industry, backup power generation and to reclaim wasted heat as electricity. One really neat example is the small fire powered generator that's even being used as an emergency backup power source to charge portable devices. Peltier modules are easy to find commercially, especially in the surplus market, if you want to try experimenting with them. Why not track some down and give them a try? ( 140045 ) 56 | September 2014 | www.elektor-magazine.com sponsored content 12 th International System-on-Chip (SoC) Conference, Exhibit & Workshops October 22 & 23, 2014 University of California, Irvine - Calit2 www.SoCconference.com Call for Speakers and Sponsors. . . Don't Miss Out! This Year's Theme: "Innovative SoCs Empowering the Communications Market." International S vs n m - on- t !hi Conference • FinFET Technology & Design • Analog & Mixed-Signal Designs • Sub 14nm Designs & Beyond • 3-D ICs Designs • IC Security & Challenges • Multicore Software Development • SoC Design & Verification • Innovative EDA Tools • Complex IP Subsystems • Low-Power Techniques • Memory Trends & Technologies • Table-Top Exhibit (Free Passes) Platinum Sponsors Microsemi UCI lWiny i di Ipww o UCInvine I Extension Calit2 • Complex Mixed-Signal SoCs • SOI vs. CMOS • RF Design • FPGAs -Trends & Designs • High-Speed I/Os • Smarter Mobile Devices • Multicore SoC Platforms • Network-on-Chips (NoCs) • Informative Panels • IEEE Student Design Contest • Networking Opportunities • And Much More. . . Promote Your Technology, Products & Services at The Most Informative, Targeted & Educational IC & IP Design Conference, Exhibit & Workshops of the Year! Keynote Speakers Microsemi Skyworks Solutions Jim Aralis, Chief Technology Dr. Peter L. Gammel, Officer (CTO), and Vice Chief Technology Officer President of R&D. (CTO). The SoC Conference brings together a very targeted and sophisticated audience from leading-edge technology companies as well as key universities for two exciting days devoted to groundbreaking products, technologies, and business disclosures, focused exclusively on designing complex System-on-Chip and the related technologies driving the SoC/ASIC/ASSP/FPGA/Foundry industry. For More Information or Questions, Please Contact the SoC Conference Organizing Committee at: SoC@SoCconference.com or (949) 851-1714 www.SavantCompany.com & www.SoCconference.com •Labs ELPP: Elektor Labs Preferred Parts By Clemens Valens If you are old enough to remember Elektor's TUP and TUN 'one-size-fits-all' (Elektor.Labs) trannies then you can probably guess what this article will be about. If you don't, find out. e?ektor@?abs 0 « ill a f !]■ 0 1 111 Given that TUP stands for 'Transistor, Universal, PIMP' you should be able to figure out TUN eas- ily. Back in the 1970s and early 80s it was Elek- tor's solution for specifying transistors in circuits where the exact type of transistor did not matter much. As long as you substituted a not-too-bad NPN-type small signal transistor for a TUN (typi- cally, BC547), and a PNP-type for a TUP (BC557), the circuit would work as expected. Things have moved on since. Although my transistor guide from that era lists thousands of transistors, there are even more today. The same for many other electronic components. Today's circuit designer stands knee-deep in a lake of operational ampli- fiers, diodes, capacitors, microcontrollers and other (integrated) components. He/she is like a whale sifting through electronic plankton trying to filter out the parts to use in his/her circuit. No wonder then that circuits published over the last decade seem to use different components over and over again; components you may not have in stock. At Elektor Labs we struggle with this problem on a daily basis. We receive circuit designs from all over the world using all kinds of parts. From main- stream to exotic, from Japanese to obsolete Soviet parts, we have to check them all to see if we can replace them by something that is easier to get in as many countries as possible where Elektor projects are built. What's odd to a German reader is dead common to an Australian. And every time we must ask ourselves: was this part used because of its special properties or because it happened to be in the designer's junk box? And if we replace a part, what do we replace it with? Every Elektor Labs worker has his/her favorites and personal junk box too. So, after many years of shoving little boxes and small bags of parts that we did not know where to put (but that might come in handy sometime, you never know— do you?), we decided to go for it and compiled a list of standard parts to be used whenever possible in Elektor projects. The advantages of such a list are manifold: • Simplify and speed up the design process by not checking hundreds of alternative parts and by not creating new CAD library parts; • Reduce the number of lines on the Bill of Materials (BOM), simplifying stock management; • Allow buying in volume to reduce costs. Many distributors only let you buy parts in multiples of 10 or 50 anyway, so why not go for the whole bag instead of just the one you need? • Always have (most of) the parts you need on stock, speeding up prototyping and building; • Trusted footprints avoid respinning PCBs; • Know in advance where your parts can be obtained and under what reference number; • Know the exact specifications of each part so that a replacement can be chosen carefully instead of being guesstimated. 58 September 2014 www.elektor-magazine.com ELPP Of course this is not a revolutionary concept and very likely it's in place many private labs, but to implement it in such a way that it can satisfy the needs of most of our members is another thing. The hardest task is to keep the list concise. Every designer wants his/her pet parts on the list, but we only want 'universal' components. Then there is the availability requirement. We want the pre- ferred parts to be readily available around the globe. Another daunting task is creating a CAD library with proven footprints. Arguably it took some time to compile the ELPP list and library and check it for errors, but here it is, the— Tadaal — Elektor Labs Preferred Parts (ELPP) list. To be honest, the list is not exhaustive because we have not included SMT parts. ELPP version 1.0 only contains through-hole (TH) parts, SMT parts will be added in v2.0. In the list you will find components suitable for most Elektor projects: from low voltage DC to AC line connected. Most discrete parts like diodes and transistors come in three power grades: low, medium and high (where high does not exceed 100 W). Integrated circuits are not on the list except for opamps and voltage regulators. Capac- itors are all at least 50 V types. Resistors cover the complete E12 range, but capacitors do not. There is only one inductor on the list and it is only there to support a switched-mode voltage regulator. Microcontrollers are not on the list, but supporting parts like quartz crystals and sockets are. The vast majority of parts has a Newark/ Farnell as well as an RS Components order code. Every part is included in our Eagle ELPP CAD library that can be downloaded from our web- site [1]. A DesignSpark PCB library will follow soon. All the footprints have been verified and have been designed with hand soldering and home assembly in mind. This means extra-large islands and standardized metric hole diameters. RS Components and Newark/Farnell order codes are included, greatly simplifying the creation of your shopping list. Furthermore, because every component value is in the library, you can skip the Add Component Value step during schematic capture, saving time (unless you want to draw a really pretty schematic). No more forgotten val- ues, but also no more incomplete BOMs because sockets, fuses, jumpers and other BOM items can be found in the library too. No more funny component references, because the library fol- lows the standards adopted by Elektor Labs for naming components. To profit the most from the Elektor Labs Preferred Part or ELPP library you may have to change the way you're accustomed to design a little. Instead of plunking a random part on your sheet, first look through the ELPP library to see if you can't use something from it instead. Maybe that 5.6- pF capacitor you calculated can be replaced by a 4.7-pF or a 10-pF type. Often it can. Okay, that 1000-V diode may seem overrated in your 3.3-V circuit, but does it do any harm? It's a 1-amp type, readily available, and it's the same size as a 100-V type. Think standard parts and simplify your life. Of course the ELPP list does not limit the designer in any way. If a component is needed that is not on the list, feel free to use it anyway. Also, the ELPP list is not written in stone. This is the first version and we may have overlooked some- thing or made a mistake. Sometimes components become obsolete or enhanced ones are discov- ered forcing the ELPP list to evolve. Come what may Elektor Labs will use ELPP parts whenever possible in their projects. ( 140233 ) [1] ELPP Eagle library, Excel file, datasheets: www.elektor-magazine.com/pub/Elektor%20 Labs/elektor_labs_preferred_parts_elpp/ www.elektor-magazine.com September 59 •Labs Inexpensive MyDAQ Connectivity By Thijs Beckers Our July & August 2014 double edition featured a (Elektor.Labs) circuit for an Optical Theremin based on National Instruments' MyDAQ data acquisition unit and LabVIEW software. The circuit we published sug- gests the use of a terminal block header with a 3.81-mm lead pitch that was queried by a num- ber of readers, mostly German. Unsurprisingly it's the .15-inch lead pitch of the internal myDAQ connector. Due to the poor availability of this 20-pin con- nector and the deadline looming for the Summer Edition, we slapped up a homebrew version of the header using two 10-pin 'Pluggable terminal blocks' from Phoenix Contact (part # 1862658). The illustrations in the July & August article show this header. These connectors tend to be quite expensive, at around € 7 (US$ 10) each. And you need two of them— not exactly an economical solution. Plus you need to file off a little from the sides of the plastic casing in the middle to make them fit close enough to each other (see small photo). Isn't there an alternative solution? Sure. In good labs fashion the idea came to us after the deadline for the Summer Edition article had passed. But we didn't want to keep it from you, so here it is. As you can see in the photograph, we also built up a prototype using the original MyDAQ connec- tor (the big black one in the photo) that comes enclosed with each MyDAQ. So it's free— sort of. However, that connector is a screw terminal block hence not suitable for soldering onto a PCB. So how can it be connected to a board? Here's your answer: The clever use of a right-angle pinheader enables the MyDAQ connector to be screwed to the side of the PCB. Happily the pins are just long enough to be inserted and held by the ter- minal block. Simply cut single pins from a right-angle .1-inch (2.54 mm) pitch pinheader and solder them onto the PCB where you need them. Our Optical Ther- emin add-on board only uses six connections to myDAQ, so that's how many we installed. You can use more if you want to ensure a stronger hold of the connector, but that's not really necessary. ( 140047 ) 60 September 2014 www.elektor-magazine.com Retronics 80 tales of electronics bygones This book is a compilation of about 80 Retronics installments published in Elektor magazine between 2004 and 201 2. The stories cover vintage test equipment, prehistoric computers, long forgotten components, and Elektor blockbuster projects, all aiming to make engineers smile, sit up, object, drool, or experience a whiff of nostalgia. LCR + Stability Use the Cleverscope FRA panel to easily auto plot Gain/Phase, Impedance, Capacitance or Inductance vs Frequency. Display the Gain and Phase Margin. Check for instability. Easy As, with Cleverscope. Measurement See our FRA tutorial video to show you how to verify your operating power supply or amplifier design. Check the impedance of your DC buses. Verify magnetics you have wound. 80 dB dynamic range! 0 - 65 MHz isolated Sig Gen. — - :mn»i [ii» |> ll I jljll hB *1 f'n 'ino:-: : -c :: : :+■. :■ :: : •» Ai-J SA.^1 kiai ini' tS&fc T - UttlM ■i, - i n i i* IOOuH toroid Streaming 100 G samples to disk ♦ ♦ Protocol Analysis • Symbolic Math • Matlab Interface • 80 dB dynamic range *100 MHz Bandwidth • Tracking Zoom • 0-65MHz isolated sig gen • Video Tutorials CS328A-FRA 1 4 Bit MSO www.cleverscope.com The latest on electronics and information technology Videos, hints, tips, offers and more Exclusive bi-weekly project for GREEN and GOLD members only Elektor behind the scenes In your email inbox each Friday Tf * e ot 3 tezuiiu friendship MR eieKtori^post *0*^5 US Silicon based life forms of the World. uniie! v» EJeto-.WST trnnjrj ™ iVr * 'avib bMA WOrtin 1 mn h « i * netM hm w, mvmuwM POS 1 (Ktdon ■ ! wsp oJ |f, 4 . ; .... BUI MP Hh iB!e- ' ^ FC V : * 'f-l! FifiKTCv- PO IT i.. , _ 1 « ■ t 3 r-,| o IFpjKh, JTTyj piuiJm W 1 an « w* hope -ftKj to uryp ^ '• * rt, W 'll EtA: SKt’jf.f Jrw . Hflrw *3» ■ iWTWiMi &f*a W Elektor. TV goes Linux Ud ". .'ig W^TCH IT ON ELEKTOft.TV^ St @ektor Register today at www.elektor.com/newsletter. i n ■ ■■ •Review VirtualBench All standard measurement functions in one compact unit By Harry Baggen (Elektor Dutch) and Luc Lemmens (Elektor Labs) Figure 1. The small enclosure of the VirtualBench has a multitude of connectors. With its VirtualBench, National Instruments introduces a completel^jnew type of measurement instrument, which combines five instruments in a compact enclo- sure. The operation happens completely via a computer or tablet. Elektor recently had the chance to try out one of the first available units. W7 NATIONAL ^INSTRUMENTS ♦ A VirtualBench DIGITAL I/O * .3.3V 01 + 23 + 45 + 67 + MIXED SIGNAL OSCILLOSCOPE 7+8 15 + CIKO 31 L CIK1 IGS • LOOK' ANALYZE* CH 1 CH 2 I © © 0 © DC POWER SUPPLY .6 V + .25V ^ -25V DIGITAL MULTIMETER ® # # # vn-w- arn! hi LO mA Every electronics engineer will have a number of standard instruments on the workbench, which are constantly required. These usually include a multimeter, a power supply and an oscillo- scope. Manufacturers of measurement instru- ments have capitalized on this in the last few years by bringing multi-functional instruments onto the market, such as oscilloscopes that can also function as a logic analyzer, function gen- erator and multimeter. In all cases these have been self-contained devices, complete with a display and operating buttons. National Instruments is the big name behind Lab- VIEW and a wide range of professional (industrial) measurement devices and modules. It doesn't immediately come to mind as a manufacturer of 'mainstream' measurement instruments, but this is the direction it's taking with its new Virtual- Bench measurement instrument. NI has applied a very different philosophy to the design, com- pared with the products that other manufacturers of measurement instruments have available right now. VirtualBench uses the functionality of a PC or tablet for its display and operation, meaning that it doesn't need a built-in screen or controls. This idea is certainly not new, but it has never been taken as far as in this device. NI has put a dual channel oscilloscope, a 32-bit logic ana- lyzer, a power supply with three independently adjustable outputs, a function generator and a 5V2-digit multimeter into a single unit, which can all be operated via one common interface. When National Instruments asked us if we wanted to test one of the first VirtualBench units avail- able in Europe, they didn't need to ask twice! On paper, the VirtualBench appears to be a fantastic combination of instruments, but how well will it perform during normal use in our labs? This was something we wanted to find out for ourselves, of course. Enclosure: small and strong Although the dimensions of the VirtualBench are specified on National Instruments' web- site, it still came as a surprise how small it was when we saw it for the first time. It seemed not much bigger than a lunchbox. When you con- sider how many standard devices the Virtual- Bench replaces, you'll realize that it saves a lot of space on the workbench. 62 September 2014 www.elektor-magazine.com NI VirtualBench The instrument comes complete with all the nec- essary cables: two scope probes, two multimeter probes, a 40-way connector with probes for the logic analyzer, a power cable, a USB cable (with thumbscrew fixing) and a screwdriver. The enclosure is quite strong, with aluminum top, bottom and front panels; the rest of the case is made out of sturdy plastic. At the front are all the signal connectors, as well as the on/ off switch (Figure 1). The connections for the digital I/O and the power supply are made with screw terminals, which makes it easy to connect wires. At the back you'll find the power input, a USB socket and a WiFi antenna. The device has a small fan for cooling, which fortunately is hardly audible. We've already mentioned that the VirtualBench should be used in combination with a (Windows) computer or a tablet (at the time of writing, only the iPad is supported). The connection to the PC or laptop is made via a USB cable, the built-in WiFi host or via an existing WiFi network. The communication with tables is wirelessly wihout exception. The software: everything in one window In practice, there is no need to install any soft- ware on the PC or laptop. When the VirtualBench is switched on and connected to the computer via the USB cable, the computer detects the USB device and automatically runs the program that The VirtualBench can also be used in combination with an iPad. it finds in the flash memory of the VirtualBench. Several USB and HID drivers are installed when it is connected for the first time. You may also have to give permission to the Windows firewall to let the program access the computer. Subsequent connections will be a lot quicker. The computer needs about 15 to 20 seconds to load the pro- gram. Things are quicker on an iPad; once the program has been installed via the iTunes Store, the iPad only needs to log in on the network of the VirtualBench. In Figure 2 you can see a screendump of the Windows version of the VirtualBench program. All of the instruments are shown here in one Specifications 2-channel oscilloscope Digital multimeter • Input bandwidth: 100 MHz • Display: 5V2 digits • Sample rate: 1 Gsample/s • Basic accuracy: 0.015% (V DC ) (500 Msample/s for 2 channels) • Measurement functions: V DC , V AC , I DC , I AC , • Buffer size: 1 Msample/channel resistance, diode, continuity • Max. voltage/current: 300 V/10 A Logic analyzer • Number of channels: 34 Adjustable power supply • Max. input frequency: 100 MHz • Number of outputs: 3 • Input voltage: 0 to 5 V • Channel 1: 0 to 6 V/l A max. • Channel 2: 0 to +25 V/0.5 A max. Function generator • Max frequency: 20 MHz (sine wave), • Channel 3: 0 to -25 V/0.5 A max. 5 MHz (square wave) Digital I/O • Waveforms: sine, square, triangle, DC • Number of channels: 8 • Configurable as inputs or outputs • Outputs 3.3 V, inputs 3.3 V/5 V compatible www.elektor-magazine.com September 2014 63 •Review Figure 2. Screendump of the VirtualBench program (Windows version). window. The scope/analyzer section along with its controls and display take up the most space, making the measured signals clearly visible. The other instruments have been arranged around the scope. To the right is the function generator with a slide control for setting the DC offset and the amplitude of the signal. Below this is the multi- meter. To the left are three boxes for the power units, and the digital I/O section is at the far left. The operation is very simple and hardly needs any explanation. The operation is almost entirely via the mouse. Values for the frequency, ampli- tude or voltage can be input in several ways, such as directly via the keyboard or by scrolling the mouse. When a value is outside the permit- ted range of a particular instrument you'll get a warning and the value will be ignored. If you click on the top-right corner of most sections, you'll get a sub-menu with some other settings and extra information. The main toolbar has menus for settings and help, as well as a useful screen- shot function. There is also a button that saves the measured data as a CSV file. The iPad version has almost the same function- ality, but is obviously operated via the touch- screen. In some instances this is easier than using a mouse, but in others it won't be. In the lab When we used the VirtualBench in the Elektor lab we tried controlling it via an iPad, but we found that the app didn't come across as very 'grown up'. Our preference was therefore to operate it via the PC. This is obviously a personal preference, but we found it very useful to be able to see the control window with all the settings and measure- ments on a large monitor while we were working on a circuit. The following comments therefore apply to the Windows version of the software. It won't take long to get used to the VirtualBench. The connections on the device are self-explan- atory and are identical to those that you would find on the individual measurement instruments. Some of the connectors are somewhat close together. We thought that there should have been more room between the individual BNC connec- 64 September 2014 www.elektor-magazine.com NI VirtualBench tors, as well as between the BNC connector and that for the logic analyzer. Then again, it may be that it takes some time to get used to it. At first the screw terminals used on the power supply section seem like a good idea, but after a while you start to miss those practical banana plugs that are found on most lab power supplies (per- haps we could design an adapter board for this). You can obtain spare connectors for the power supply and digital I/O from NI, which could be useful if you use them constantly. Initially, you may have to look around to find all of the functions and settings in the software, but most of them have been laid out logically and are where you would expect them to be. We hardly had to look at the manual (we're experts, after all!). Oscilloscope/analyzer The scope section takes up the most space on the screen. This is to be expected, since you want to see the measured waveforms clearly. If that isn't enough, you can make the scope window fill all of the space on the screen. An auto- setup button ensures that you can quickly get a good display of the measured signal. The scope section offers just about all of the settings and trigger functions that are found on an ordinary scope. Along the top is a representation of the measurement buffer. Using the mouse, you can select any section of this buffer and display it. There are two bars below the scope screen from where you can control cursors on the screen and carry out various measurements (there are over 20 different ones) on the signal. You can also carry out mathematical operations on the signal using the Math button (at the moment this is limited to addition, subtraction, multiplication and a standard FFT function with relatively few settings). The Digital button is used to select the digital channels and the corresponding trigger action. When we were using the scope it appeared to react very slowly to changes in the signal. We found out that this was due to the default setting of '32 Averaged' for the signal acquisition. This seemed to be too much of a good thing, and we set it down to '2 Averaged' and eventually to 'Sample', which finally gave the feeling that you were watching a real-time signal. You should save the new configuration, otherwise the instrument will always start with the same default settings. One thing we missed on the scope display was the value for the vertical and horizontal scale. At the moment you have to look at the (fairly small) values written next to the controls. And there is enough room left on the screen... When it's used as an analyzer it's easy to see several signals, but with 32 channels the screen gets too crowded and you wish you had a real analyzer with advances analysis functions. But this is a problem you get with all combined scope/analyzer devices. Incidentally, it's quite tricky to make sure that all of the measurement cables (delivered without terminals, unfortunately) from this 40- way connector are connected properly to the circuit under test. Function generator The function generator (14-bit, 125 MS/s) works as expected and outputs all the standard waveforms with a frequency range that's more than enough for most applications. An unusual feature is to have a DC voltage at the output (max. ±6 V into 50 ft, or 12 V into 10 kft), which is not found in many instruments. The output voltage can be set over a wide range. The slide control was found to be very useful for this, as you can use the mouse to quickly set the offset and signal amplitude. In principle, you should be able to program your own waveforms (AWG) with the signal generator, but this function is not (yet?) available in the software. Users can write a LabVIEW VI though for generating custom waveforms. www.elektor-magazine.com September 2014 65 •Review Multimeter The multimeter is also very good, with a decent accuracy. It has all the features found on a standard multimeter. However, we miss the facility to increase the size of the multimeter section on the screen. After all, when you're taking measurements with the multimeter it is often useful to display it on the screen in a larger format. This comment really applies to all of the instruments on the screen: Power supply The lab power supply uses a limited area in the window, but still compares well with a standalone supply. Perhaps not as far as the output current is concerned, although the output power is sufficient for most small circuits. The outputs can be set very accurately. For each of the three channels you can set the output voltage and the maximum output Digital I/O We couldn't immediately think of an application for this VirtualBench in combination with your own LabVIEW function, although we're sure they exist. When you use program it should prove very useful. current. On the screen you can see the measured values of the output voltages and currents. This is a great feature, which is sadly lacking in many other lab power supplies! The output connector wasn't that brilliant in daily use, as we mentioned in the description of the hardware. Everything has a fixed position and this cannot be changed. The scope is obviously the most important and uses most of the space on the display. The other sections of the screen can't be moved, nor can they be increased in size. This is a pity, and hopefully this is something that will be rectified in a future release of the software. Conclusions There are still many functions and features that we haven't covered, but this article is certainly enough to give a good first impression of the instrument. When reading this article you may feel that we were finding a lot of faults with the VirtualBench, but the opposite is true: We were blown over by it and many of our editors and engineers at Elektor would love to have such a device for their workbench, and ideally one for use at home as well. It is an ideal combination of instruments with specifications that are more than sufficient for most applications. Most of our remarks were about the operation of the software. It should be noted that these are things that could easily be rectified in future releases of the software. We should also remind ourselves that this is a new product, with new software. We are there- fore very curious to see what new features will be found in the software in a year's time! NI is a company that has always listened to the remarks and wishes of its customers. We have certainly been convinced by the product and the concept. It is perfect for standard lab use, but also for schools and even hobbyists, although the price could be an obstacle for the latter group. But we think that VirtualBench is worth every cent of its $1999/ €1690 cost! If NI wants their instrument back, they will have to come and get it. ( 140252 ) Web Link www.ni.com/virtualbench/ 66 September 2014 www.elektor-magazine.com CELLAR NTR lfcLLA ? CiHCJII Cflirik ihini*i uttwtjwn — Z OflLJIIEHS i ?. jw .1 1 ht^ ■ ~a '■'H 1 -" ■„ I CIRCUIT CELLAR IIT CELLAR re, lflR ciRCUn CELLAR D0 MffiK o m CRC CELL ■ r, vi ii-iki iiirFia niyiL L _. This pocket-sized vault comes fully loaded with every issue of Circuit Cellar magazine and serves as an unparalleled resource for embedded hardware and software design tips, schematics, and source code. | From green energy design to ’Net-enabled devices, maximizing power to minimizing footprint, CC Vault* contains all the trade secrets you need to become a better, more educated electronics engineer. BONUS! Build your archive by downloading your latest-issue PDFs straight to the drive! Personalize your CC Vault by adding Elektor or audioXpress issue archives, available as an add-on during time of purchase, or your very own project files. *CC Vault is a 16-GB USB drive. Order yours today! cc-webshop.com •Projects Three-way CH Boiler Valve Monitor In the author's homeland natural gas powered combination boilers are the standard source of cen- tral heating (CH) in pri- vate homes. These highly effi- cient apparatus not only provide heating via the radiators, but also take care of the hot water for the kitchen and the bathroom. When a hot water tap is turned on, a three-way valve diverts the hot water from the normal central heating circuit to the heat exchanger/tank for the hot water. This valve can sometimes leak during the normal heating cycle, with the result that water with a lower temperature is fed to the hot water tank, which therefore cools down the hot water. This increases the number of hot water heating cycles, which leads to a higher gas usage than necessary. When the hot water tank is being warmed up, the temperature of the feed pipe to the tank should be higher than that of the return pipe. During Figure 1. When the three-way valve functions properly, the temperature of the Feed will always be above that of the Return. Feed ■Return rfMfNl(NOJfMfMfN(NfN(N(NfMfMfN(MfN(NfNfNfM(M Figure 2. When there is a defect the temperature of the Feed can drop below that of the Return. normal operation, the temperature of both pipes should drop at the same time. With a leaking valve, the feed pipe can be at a substantially lower temperature than the return pipe. This can be clearly seen from the graphs that show the Based on an idea by Sybe Sijbesma (The Netherlands) Figure 3. This circuit compares the two measured temperatures and sounds a buzzer when the temperature of R5 drops too much below that of R3. ici 68 September 2014 | www.elektor-magazine.com CD E CD U) CD > “O < Component List Resistors R1,R2 = lkQ R3,R5 = NTC lOkQ R4 = 1MQ PI = lOkft trimpot, vertical Capacitors Cl = 4.7pF 25V radial C2 = lOpF 25V radial C3,C4 = lOOnF Semiconductors T1 = BC547B IC1 = 78L05ACZ IC2 = TLC271CP Miscellaneous BZ1 = actieve buzzer (i.e. internal oscillator), e.g. Kingstate KPEG-200A K1 = adaptpr socket, PCB mount, e.g. DCJ0202 PCB # 130140-1, artwork download at [1] measured temperatures for a good three-way valve (Fig- ure 1) and a leaking valve (Figure 2). When NTCs are mounted onto the feed and return pipes for the hot water tank, it is possible to detect faults in the three-way valve at an early stage. The circuit shown here (Figure 3) stands out by its simplicity, and consists of little more than an opamp (TLC271), which is configured as a comparator to compare the temperature of the two NTCs. The threshold value is set with the help of preset PI. When the temperature of NTC R3 drops too far below the temperature of NTC R5, the comparator changes state and the buzzer is turned on via the transistor, to indicate that something is wrong. A 5-V regulator was added to the circuit so that it can be powered by any mains adapter with any output between 8 V and 15 V DC. The current consumption is less than 10 mA, even with the buzzer on. A small PCB has been designed for the circuit (Figure 4), but it can just as easily be built on a piece of experiment- er's board. The NTCs should be mounted close to the hot water tank on the feed pipe (R3) and return pipe (R5), using cable ties. (130140) Web Link www. elektor-magazine. com/130140 npoioiu Robotics & Electronics Addressable RGB 30-LED Strip, 5 V, 1 m (WS2812B) ITEM #2546 s 16 95 Waterproof, individually addressable LED strip that runs on 5 V. Can be chained to form longer strips or cut for shorter sections. Other lengths and LED densities available. 37D mm Metal Gearmotors $ 24^5 Other sizes available • Several gear ratios stocked • Versions with integrated encoders also available Step-Up/Step-Down Voltage Regulator S18V20ALV ITEM #2572 • 3 V to 30 V input • Adjustable 4-1 2 V output can be above or below input voltage • 2 A typical max output current A-Star 32U4 Mini • ATmega32U4 carriers with switching regulators in three voltage ranges: • ULV: 0.5-5.5 V • LV: 2.7-1 1.8 V • SV: 5-36 V 1 1 1 I I ■ ■ :*? 2 ■ t: j ■ A* \ ' t » r - * Ftalolu fl ‘ I Mini Maestro 12-Channel USB Servo Controller • USB, serial, and internal scripting control • 6-, 1 8-, and 24-channel versions also available Sub-Micro Servo 3.7 g Specs at 6 V • 6oz-in ITEM #1053 $495 • 0.07 sec/60° Zumo Robot for Arduino, vl .2 (Assembled with 75:1 HP Motors) Arduino-controllable tracked robot small enough for mini-sumo (less than 1 0 cm x 1 0 cm) and flexible enough for you to make it your own. Individual parts and kit version also available — build your own configuration! Finding the right parts for your design 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 design from idea to reality. Find out more at: www.pololu.com •Projects Efficient Water Solenoid Valve for a reverse-osmosis water filter By Maarten Vandekeybus (Belgium) The manual operation of the tap for a water filter is something that seems a suitable candidate for automation. This can avoid the unnecessary waste of a large amount of water. The circuit has been configured such that it uses very little power. The author has a reverse osmosis water filter in his home, for the purification of tap water. A small tank of about 25 liters (6.6 US gallons) is con- nected to the filter. You always have to manually open a tap to top up the tank. However, since it can take up to four hours to fill the tank, the tap is often forgotten about and left open much too long, with the result that a lot of water is wasted. To stop this happening, the author decided to design a small circuit that would automate this process. The circuit opens a solenoid valve until a float sensor detects that the tank is full. The author ordered a 12 V DC solenoid valve from eBay ($16). It functioned perfectly well, but it used a lot of power (nearly 18 W), which isn't very Figure 1. The electronics in the economical water solenoid valve circuit consist of little more than a PIC12F683. 70 September 2014 | www.elektor-magazine.com Water Solenoid Valve energy conscious. He remembered having seen an article in Elektor on reducing relay power con- sumption, based on the fact that a relay requires only a fraction of the nominal power once it has been actuated. After some experimentation the result was a small microcontroller circuit that used a power MOSFET to drive the solenoid. This ensures that the full supply voltage is applied to the solenoid initially, after which it is lowered to a value that still keeps the valve open, but reduces the power consumption considerably. There is also a switch delay of about one minute built in to avoid the valve from opening and closing repeatedly when there is some turbulence in the water level. The circuit has been provided with three colored LEDs that show what the current operating mode of the circuit is. Schematic diagram In Figure 1 you can see the circuit diagram of the author after it has been checked over by Elektor labs. A PIC12F683 has been used for the microcontroller. Output GP2 drives the power MOSFET (Tl), which operates the solenoid. Once the solenoid has been actuated, the reduction of the solenoid voltage is achieved using pulse width modulation. It uses a frequency of about 488 Hz, and the mark-space ratio is 30:256. The experi- ments of the author showed that the total power consumption of the solenoid could be reduced to just 0.4 watts once the valve was actuated. This is a huge difference compared to the nom- inal 18 watts consumed when it is switched on! Three LEDs are used to show the current state of the circuit. The white LED (D2) indicates that the circuit is in automatic mode. The blue LED (D3) shows that the valve is open and the red LED (Dl) is on when the circuit is in the 'delay state'; in this case the state of the float sensor has changed, but the valve has not yet reacted to it. The LEDs are also driven via PWM in order to save power. Advertisement EAGLE V6 Getting Started Guide Learning to fly with Eagle BEST- SELLER V This book is intended for anyone who wants an introduction to the capabilities of the CadSoft’s EAGLE PCB design software package. After reading this book while practicing some of the examples, and completing the projects, you should feel confident about taking on more challenging endeavors. The book will quickly allow you to: • obtain an overview of the main modules of EAGLE: the schematic editor; layout editor and autorouter in one single interface; • learn to use some of the basic commands in the schematic and layout editor modules of EAGLE; • apply your knowledge of EAGLE commands to a small project; • learn more about some of the advanced concepts of EAGLE and its capabilities; • understand how EAGLE relates to the stages of PCB manufacture; • create a complete project (a proven design from the engineering team at Elektor), from design through to PCB fabrication. wmm 'Oz OFF for Nan! r &0Ll> Members Further Information and Ordering at www.elektor.com/eaale. L 208 pages • ISBN 978-1-907920-20-2 In cl. CD-ROM containing EAGLE 6.4.0 for MS Windows, Linux and Mac £30.95 • € 34.50 • US $47.00 www.elektor-magazine.com September 71 •Projects Figure 2. There is plenty of space on the board, which makes it suitable for less experienced constructors. Component list Resistors R1,R2,R3 = 330ft R4,R5 = lOkft Capacitors C1,C2,C3 = lOOnF C4 = 470pF 16V radial C5 = lOOpF 25V radial o + K2 u o • • Elektor (C) 130258-1 • VER 1 . 0 ^ ^ Semiconductors D1 = LED, red, 3 mm D2 = LED, white, 3 mm D3 = LED, blue, 3mm D4,D5 = 1N4007 T1 = IRL540 IC1 = PIC12F683, programmed, Elektor Store #130258-41 IC2 = 7805 SOLENOID VALVE UJ s*0 FLOAT SENSOR to Miscellaneous K1,K2,K3 = 2-way PCB screw terminal block, 5mm pitch Sl= pushbutton PCB # 130258-1, see [1] Switch SI is used to switch the circuit to one of three operational modes: Manual, automatic and off: • Off mode: In this state the circuit is inactive and none of the LEDs is on. • Manual mode: The valve is turned on contin- uously. In this state both the white and blue LEDs will be on. • Automatic mode: The valve is turned on and off depending on the state of the float sensor. The float sensor used here is nor- mally open and closes once the water rises above the float level. Ripples on the water could cause the float sensor to change state rapidly, and hence turn the valve on and off repeatedly. To avoid this, the valve only changes state after a one-minute delay fol- lowing a change in the state of the float sen- sor. The red LED will be on while this delay is taking place. When the power supply is turned off (either delib- erately or due to a power failure) the current state of the circuit will be stored in the internal EEPROM. Once the power is restored the circuit will resume in the same state. It's best to use a power adapter with a 12 V DC output (at about 1.5 A) for the supply. Diode D5 is for reverse polarity protection. IC2 turns the 12 V into a stabilized 5 V DC for the PIC. A simple board The printed circuit board shown in Figure 2 has plenty of space and contains only standard com- ponents. The construction should not give you any problems. Make sure that you've programmed the PIC before you solder it onto the board. You can freely download the source code and hex files from the Elektor Magazine website [1]. Alterna- tively, order a ready-programmed PIC from the Elektor Store (130258-41). Figure 3. The solenoid valve and float sensor used by the author. It's recommended that the whole circuit is mounted in a splash-proof enclosure, such as the one shown at the start of the article. Such enclosures should be available from most DIY stores. ( 130258 ) Web Link [1] www.elektor-magazine.com/130258 72 September 2014 | www.elektor-magazine.com Electric Guitar Sound Secrets and technology Further Information and Ord What would today’s rock and pop music be without electric lead and bass guitars? These instruments have been setting the tone for more than sixty years. Their underlying sound is determined largely by their electrical components. But, how do they actually work? This book answers many questions simply, in an easily-understandable manner. For the interested musician (and others), this book unveils, in a simple and well-grounded way, what have, until now, been regarded as manufac- turer secrets. The examination explores deep within the guitar, including pickups and electrical environment, so that guitar electronics are no longer considered highly secret. With a few deft interventions, many instruments can be rendered more versatile and made to sound a lot better - in the most cost-effective manner. 287 pages • ISBN 978-1-907920-13-4 £30.95 ‘€34.50 •US$47.00 ring at www.elektor.com/electricquitar ii powered by Eurocircuits Elektor PCBs Benefit now: Elektor PCB Service offers a 90-day launch discount on new Elektor PCBs! Check www.elektor.com/ocb.for an overview of all Elektor PCBs •Industry Taking the Strain Integrating precision strain gage measurements into a programmable SoC By Kendal Castor-Perry and Nidhin MS (Cypress Semiconductor) Many pressure and force sensors rely on resistive sensing elements connected in some variant of the so-called bridge configuration. In the electrical context, a 'bridge' is a common topology in which four two-terminal devices are connected in a loop. Think of the ubiquitous 'bridge rectifier' — if you are reading this article, chances are that you have used one of those in a power supply design. When the two-terminal devices are impedances whose val- ues can be changed by some external influence, you get an incredibly versatile sub-circuit. If you mix impedances with difference frequency behaviors, you can create interesting fil- ter and oscillator circuits— you've probably heard of the Wien Bridge oscillator [1], which relies on the frequency-dependent transfer properties of Figure 1. Moreover, bridges turn up in other passive filter networks too, except that they are often drawn differently, with the connections 'twisted' around, and then called lattices instead. In Figure 2 (also from Wikipedia), treating the left hand nodes as inputs and the right hand nodes as outputs, and make the Z branches capacitors and the Z' branches resistors, you get a first-order all-pass filter. Real-world issues The bridge devices we want to focus on here are typically made of resistors whose values change under the influence of some physical parameter. This could be temperature (sensed intentionally, or happening as a side effect), a magnetic field, incident light, humidity or— a huge industrial sensor applica- tion-physical strain in a mechanical system. You may remember from mechanics that strain is what happens to a physical object when you apply stress to it— a dimensional change of the object. It might be change in length, cross-sec- tional area or both. This affects the structural properties of the material that the object is made of, and this can affect the passage of an electrical current through that material— it changes the resistance, in other words. A bridge of resistances of which one or more are attached to an object in a way that their resistance is affected by mechan- ical changes to the object is usually called a strain gage— or gauge, in some parts of the world with plentiful supplies of the letter u. Often the resistors are in the form of thin metal traces on a polymer substrate that is bonded to the struc- ture of interest. If you're an instrumentation engineer— or just a hard-pressed electronic engineer who's been asked to interface to one of the things— you'll be interested in how to extract interesting information from the voltage changes that result when such a strain gage actually gages some strain. If this was trivial, there would be no need for how-to articles like this, and no need for semiconductor companies to make products that help you out. Nevertheless, as is so often the case in the world of analog measurements, there are pitfalls Figure 1. The Wien Bridge (reproduced from [1]). Figure 2. A bridge redrawn as a lattice. 74 | September 2014 | www.elektor-magazine.com sponsored content Strain Gages for the unwary. That's because the strain in such a gage has to be kept quite small, otherwise the material will deform permanently. The small strain implies a small relative resis- tance change, and so the bridge is only slightly imbalanced as a result. News views from the bridge So, how do we interface to a bridge of resistors, and what might we find? Measuring the small voltage across the sense terminals of a driven bridge is a classic application for an instru- mentation amplifier. The job of such an amplifier is to deliver an amplified representation of a small voltage that appears between two nodes that might both be moving around on top of a larger, unknown common mode voltage. The output of that instrumentation amplifier will be converted to digital with an ADC— practically no industrial measurement system is analog all the way through these days. Old-school instrumentation amplifiers often employ sophisti- cated techniques to deliver very low levels of input offset and drift, and can command a premium price. In systems where a digital result is required, high performance delta-sigma ADCs with 20 to 24 bits of resolution can be directly deployed, with- out additional Preamplification, to achieve microvolt levels of precision. As sensors of all forms become ubiquitous, a tri- fecta of design pressures— cost, size and power— are driv- ing designers to look at solutions that are more economical. However, the lower performance analog components usually available in modern mixed-signal microcontrollers fall short in terms of basic signal path quality. There is one technique, though, that can take you most, and usually all, of the way towards successfully implementing complete single-chip sen- sor systems for low-output bridge-based sensors, and that is Correlated Double Sampling. Now, the analog performance of the latest programmable system-on-chip devices is certainly a step up from common analog-equipped microcontrollers. Factory-trimmed amplifier offset voltages of better than a millivolt are now available in economical devices such as Cypress Semiconductor's latest PSoC 4200 family. For many applications, such devices can be considered for simple, familiar configurations, and can significantly shorten the design cycle for many smart sensor and process monitoring applications. However, when signal level changes fall below millivolts towards microvolts, even devices at the state of the commercial art need a little help from smart system design. Fortunately, such programmable SoC devices include flexible analog routing structures, and this enables the use of a great precision-en- hancing technique: correlated double sampling (CDS). CDS is an umbrella term for a range of techniques in which several measurements are combined in a way that mitigates some sort of error that is correlated (hence the term) across those measurements. Figure 3. A circuit using CDS for both differential bridge and single- ended ratio measurements. This simple technique— measuring a floating voltage twice, using a differential input connection that is flipped in polarity between measurements, and then subtracting the two con- version results— can eliminate the majority of errors that an analog front end can introduce. Inherent static input offset voltage is cancelled out, as is any very low frequency input noise that appears, whatever its cause (supply influences, thermal effects and LF noise from amplifier input devices) over the time period of the two measurements, as a static input voltage error. Finite common mode rejection effects (whether linear or non-linear with respect to the common mode voltage) are also eliminated at least to first order, because the primary impact of sensitivity to the common mode component at the two monitored nodes is to slightly change the apparent offset voltage of the input channel. For more advanced applications where some of the error sig- nals vary more rapidly in the time domain, an extension of the technique can be used to eliminate the consequences of sampling the normal and reverse input connections at different points in time. You can read about that 'Filter Wizard' technique at, for instance, [2]. The electrical circuitry is the same; it's just the digital post-processing that gets more sophisticated. Onto a PSoC As a practical example of this technique, consider the sche- matic in Figure 3. This was implemented on the recently intro- duced PSoC 4200 mixed-signal system-on-chip from Cypress. Such devices are differentiated from conventional mixed-sig- nal microcontrollers through their more comprehensive sig- nal routing and switching capabilities, and these have been taken advantage of in this example. Let's focus first on the block of circuitry that processes the output from the bridge transducer. Analog multiplexers select several different sets of signals for conversion. A pair of opamps are configured as a differential amplifier whose gain can be switched between unity (for diagnostic purposes) and a high value set by exter- sponsored content www.elektor-magazine.com | September | 75 •Industry nal precision resistors. The performance of these amplifiers is good, but not sufficient to achieve the microvolt-level result stability that we'd like for such a transducer. Therefore, the CDS process is carried out using signal switching right at the amplifier inputs, meaning that residual offset, drift and low frequency noise is cancelled out from the final calculated mea- surement, as already described. All set to calculate To calculate the strain in the bridge, we need to have two pieces of information. First, we need the high-quality mea- surement of that small voltage between the two output nodes of the bridge. In addition, we need to know what voltage is being applied to the excitation nodes of the bridge. Here, that voltage is applied by GPIO pins on the SoC (so that the transducers can be disabled to lower power consumption). A Kelvin (four-wire; force & sense) connection routes the drive node voltage into the analog multiplexing so that the ADC can capture these voltages too. They can be very close to the supply rails, so the (rail-to-rail capable) ADC is configured to use the power supply rail as its reference. This does not affect the accuracy of the strain calculation because the reference value is a constant that cancels straight out. Note that to calculate the overall strain, we do not need to know how many resistors in the bridge change their value when stress is applied to the structure that the sensor is fixed to. If we want to calculate the actual stress in the sample that caused it, though, we need to know more about the construction of the bridge. That's because for the highest accuracy, a small linearity correction is applied when the calculation is made, and this correction method depends on how many resistors are strained and how many are static reference elements. High performance is available from this configuration. The internal ADC of the PSoC used in this example has an intrin- sic resolution of 12 bits, but here we can take advantage of the high maximum sample rate (up to 1 Msps is possible) and use the built-in hardware averaging (no CPU work required) to push the noise floor down and thereby increase the equiv- alent resolution. With the 44x input differential amplifier and 256 averages, measured results indicate an equivalent per- formance of close to 15 bits RMS right at the bridge output terminals, equivalent to an RMS noise level of under 8 micro- volts, with a DC error that's very difficult to measure using Software to the rescue It is tempting to think about using the differential-input measurement channel to acquire the voltages of interest. However, in fact this is unnecessary. Instead, it suffices to measure the voltage on each end of each of the resistors, using a single-ended measurement channel. Subtracting the two readings gives you the voltage across the resistor. Of course, we know that subtraction of two nearly equal quantities can produce some uncertainties in a result, and we do need to make sure that our converter resolution doesn't result in a loss of numerical precision. Measured results on the front end in this mode indicate an RMS equivalent number of bits ('ENOB') well in excess of 16 bits. The big advantage of this method, which is another form of CDS, is that any static or quasi-static error at the input of the measurement channel gets cancelled out, even though only single-ended measurements are taken. So the result is essentially unaffected by channel offset or low frequency noise, as in the bridge measurement case. It's a great technique for getting good performance out of a single-ended measurement channel. It is still dependent on the reference voltage used by the ADC— but that term gets divided out too, when we ratio the voltages across thermistor and precision resistor. The result is a very system-insensitive measurement of a resistance ratio. This can be converted to a temperature value in software. The figure shows another elegant development afforded by the tools that support the SoC used here— the temperature conversion is done by a software component, included in the development tool, which is simply dragged onto the schematic and configured for the thermistor in use. In this example, the ADC measures eight different voltages from the bridge and thermistor circuits. Between the measurements, firmware controls the analog multiplexers to select the next voltage to be measured. The ADC in PSoC 4200 device has a digital post-processing block that can be used to average multiple ADC counts to yield a higher effective resolution. This averaging process is independent of the CPU. In power-sensitive applications, the CPU can spend most of the time in Sleep mode. The ADC wakes up the CPU after each measurement (including the averaging process). The CPU can then control the multiplexers to select the next voltage, initiate the ADC conversion, and go back to Sleep mode. After completing the measurement of all eight voltages, firmware can calculate the bridge strain and temperature. The programmable system-on-chip used has a variety of output options to show the calculated results. It can provide analog outputs using IDACs (which are current sourcing/ sinking digital to analog converters), directly drive segment LCDs, or communicate the results through I 2 C, UART, SPI or any custom communication protocol implemented using the programmable digital logic. 76 | September 2014 | www.elektor-magazine.com sponsored content Strain Gages Figure 4. Detail of the bridge measurement part of Figure 3. ordinary equipment. This is achieved with no special consid- erations for board layout. Figure 4 shows the simplified diagram of the bridge sub cir- cuit. The relative bridge strain is the ratio of bridge output to bridge excitation. Therefore, calculating the relative bridge strain requires measurement of voltages B1-B4 and B2-B3. For CDS, these voltages need to be measured twice, flipping the polarity. The ADC measures the excitation voltages B1-B4 and B4-B1 directly. Bridge outputs B2-B3 and B3-B2 are measured after the amplification provided by the differential amplifier. The firmware then calculates the relative bridge strain as: ADC count(B2,B3)- ADC count(B3,B2) strum — Gain preamp (ADC count(Bl,B4 ) - ADC count(B4,Bl)) where Gain p reamp is the gain of the differential preamplifier. Implemented on the development board of the SoC used, this configuration provides microvolt-level stability and can be used to accurately calculate very low levels of strain. The front-end gain of 44x set in this example suits full scale strain levels of around 2%. At the bandwidths required for these measurements, significantly higher gains could be set through appropriate external resistor choice, for systems where there is low static strain in the sensor. This example has also been equipped with a temperature measurement subsystem, operating simultaneously with the strain measurement subsystem, which also uses a form of correlated double sampling. Knowing the temperature of the transducer element itself is sometimes helpful for optimizing the calibration of the sensor sensitivity. These days, therm- istors offer probably the best accuracy to cost profile of all temperature measurement solutions. Calculating the tempera- ture requires measurement of the thermistor's resistance. To optimize accuracy, the resistance measurement must be only minimally dependent on the properties of the measurement Figure 5: Detail of the resistor ratio measurement part of Figure 3. system, such as offset, noise, and the accuracy of the refer- ence and the conversion gain. The basic resistance measurement idea is simple and illus- trated in Figure 5: pass a current through the thermistor and a precision resistor, measure the voltages across both the thermistor and that resistor, and the ratio of those volt- ages is identical to the ratio of the resistances. The accuracy is obviously directly related to the accuracy of the precision resistor, but these days that is a very affordable component. Flowever, it is also dependent on the fidelity with which we can capture the voltages across the two resistances, more about this in the inset. Conclusion Correlated double sampling can bring impressive levels of precision to the measurement of small transducer output volt- ages that you might not have thought were within reach of cost-effective microcontroller products. It's especially effective when implemented using the versatile analog routing capa- bility afforded by the programmable system-on-chip devices used in the example shown. The easy-to-use measurement subsystems described here make it possible to create small, low cost yet high performance smart sensor front-ends that can be customized to your own needs and brought to mar- ket rapidly. ( 140230 ) Web Links [1] Wien Bridge: http://en.wikipedia. 0 rg/wiki/File:M 0 stek_Wiena.svg [2] Filter Wizard: www. cypress. com/?docID=45637 sponsored content www.elektor-magazine.com | September | 77 •Industry CD m CD > TD < RECEIVE top quality boards in just days egress plblcom Air Core Inductors Offer Q Factors Up To 230 at 400 MHz Coilcraft's new VS Series air core inductors combine cur- rent ratings of up to 57 amps and excellent Q factors, making them ideal for high current IF/RF applications. Other applications include high power filtering, high fre- quency VRMs where magnetic material must be avoided (e.g. in MRI machines), and as high current IF chokes. The VS Series is offered in three sizes/configurations. The 1010VS measures 10.0 x 10.0 mm, with a maxi- mum height of 6.10 mm. It is available with five induc- tance values between 23.5 and 146 nH, current ratings up to 26.0 amps, and Q factors as high as 150. The 1212VS measures 12.0 x 11.5 mm with a maxi- mum height of 11.3 mm. It's offered with five inductance values rang- ing from 22.2 to 117 nH, cur- rent ratings up to 57 amps and Q factors as high as 200. The 2014VS measures 19.56 x 13.6 mm with a maxi- mum height of 11.4 mm. It's available with six induc- tance values between 33 and 257 nH, current ratings up to 43.0 amps and Q factors as high as 230. All VS Series air core inductors feature RoHS compliant tin-silver over copper terminations and offer a maxi- mum reflow temperature of 260°C. COTS Plus tin-lead terminations are also available. As with all Coilcraft parts, free evaluation samples and complete technical specifications for the VS Series are available online. www.coilcraft.com (140231-IX) Zero-Drift Instrumentation Amplifier Microchip Technology Inc. announced the expansion of its instrumentation amplifier portfolio with the new zero-drift MCP6N16. This self-correct- ing architecture maximizes DC performance by enabling ultra- low offset, low-offset drift, and superior common-mode and power-supply rejection, while eliminating the adverse effects of 1/f noise. The result is very high accuracy across both time and temperature. The MCP6N16's low-power CMOS process technology enables low power consumption while still provid- ing 500-kHz bandwidth, and it features a hardware-enable pin for even more power savings. This low-power operation and shutdown capability requires less current for the given speed and performance, which extends battery life and leads to less self-heating. Additionally, the amplifier's low, 1.8-V operation allows two dry-cell, 1.5-V batteries to be drained well beyond typical use, and its rail-to-rail input and output operation enables full-range use, even in low-supply conditions. This provides better perfor- mance across the entire operating-voltage range. The MCP6N16 instrumentation amp is ideal for applications that require a combination of high performance and precision, low power consumption, and low-voltage operation. www.microchip.com/get/PB60 (140301-1) 78 | September 2014 | www.elektor-magazine.com news & new products CD E CD c r CD > “O PE 5 Dt* , Subprogrl^fs X^rc hive r sUr ew Swfiif? I ? 81 £ (A.- s E r -> — -r' v - ^ L_, f, ra zi°s*l *ej> a ©lektor Ooyan Ibrahim Fun to Build and Use Projects Create 30 PIC I Microcontroller Projects with Flowcode 6 This book covers the use of Flowcode® version 6, a state-of-the-art, all-graphical based code development tool, for the purpose of developing PIC microcontroller applications at speed and with unprecedented ease. Without exception, the 30 projects in the book are fun to build and use. A secret doorbell, a youth deterrent, GPS tracking, persistence of vision (POV), and an Internet Webserver are just a few examples of projects in the book waiting to be explored and mastered. This makes the publication a perfect source of projects constantly challenging your hardware and software skills as you progress, resulting in advanced microcontroller applications you can be proud of. All sources referred in the book are available for free download, including the support software. 232 pages • ISBN 978-1-907920-30-1 £30.95 • € 34.95 • US $48.00 The RPi in Control Applications . Raspberry Pi 1 Hardware Projects This book starts with an introduction to the Rasp- berry Pi computer and covers the topics of purchas- ing all the necessary eguipment and installing/using the Linux operating system in command mode. Use of the user-friendly graphical desktop operat- ing environment is explained using example appli- cations. The RPi network interface is explained in simple steps and demonstrates how the computer can be accessed remotely from a desktop or a laptop computer. The remaining parts of the book cover the Python programming language, hardware develop- ment tools, hardware interface details, and RPi based hardware projects. 290 pages • ISBN 978-1-907920-29-5 £34.95 • € 39.95 • US $54.00 110 Elektor Editions, Over 2500 Articles DVD Elektor 2000 through 2009 This DVD-ROM contains all circuits and projects published in Elektor magazine's year volumes 2000 through 2009. The 2500+ articles are ordered chronologically by release date (month/year), and arranged in alphabetical order. A global index allows you to search specific content across the whole DVD. Every article is printable using a simple print func- tion. This DVD is packed with ideas, circuits and pro- jects that are ideal for any electronics enthusiast, student or professional, regardless of whether they are at home or elsewhere. ISBN 978-1-907920-28-8 £77.95 • € 89.00 • US $121.00 Measurement and Control using your PC IO-Warrior * Expansion Board Don't throw out your old PCs and notebooks or leave them gathering dust in the basement! They can be a useful resource: by adding this universal interface card an old PC can be pressed into service as a mea- surement and control hub. An IO-Warrior module on the I/F board takes care of USB communication, and source code is available that works with the free ver- sion of Visual Studio. Ready-built IO-Warrior56 module Art.# 130006-91 £34.95 • € 39.95 • $54.00 Advanced Robot Technologies Made Easy E Advanced Control Robotics It doesn't matter if you're building a line-following robot toy or tasked with designing a mobile system for an extraterrestrial exploratory mission: the more 86 | September 2014 | www.elektor-magazine.com Books, CD-ROMs, DVDs, Kits & Modules you know about advanced robotics technologies, the better you'll fare at your workbench. Hanno Sand- er's Advanced Control Robotics is intended to help roboticists of various skill levels take their designs to the next level with microcontrollers and the know- how to implement them effectively. Advanced Con- trol Robotics simplifies the theory and best practices of advanced robot technologies. You're taught basic embedded design theory and presented handy code samples, essential schematics, and valuable design tips (from construction to debugging). 160 pages • ISBN 978-0-96301-333-0 £34.95 • € 39.95 • US $54.00 Android User Interface Builder E Android Breakout Board The FTDI FT311D is a flexible bridge that can inter- face your circuit to an Android smartphone or tablet. This Elektor Android Breakout Board offers options for seven digital outputs, four PWM outputs, asyn- chronous serial and I2C and SPI interfaces. The board is compatible with Android 3.1 (Honeycomb) or higher (Android Open Accessory Mode should be supported). Ready-built module Art.# 130516-91 £26.95 • € 29.95 • US $41.00 Explore the RPi in 45 Electronics Projects E Raspberry Pi This book addresses one of the strongest aspects of the Raspberry Pi: the ability to combine hands-on electronics and programming. No fewer than 45 excit- ing and compelling projects are discussed and elab- orated in detail. From a flashing lights to driving an electromotor; from processing and generating ana- log signals to a lux meter and a temperature control. We also move to more complex projects like a motor speed controller, a Webserver with CGI, client-server applications and Xwindows programs. Each project has details of the way it got designed that way. The process of reading, building and programming not only provides insight into the Raspberry Pi, Python, and the electronic parts used, but also enables you to modify or extend the projects any way you like. 288 pages • ISBN 978-1-907920-27-1 £34.95 • € 39.95 • US $56.40 Build Your Own Robot E ActivityBot Learn real-world engineering skills with the friendly, capable, and peppy ActivityBot from Parallax. It's a great option for first-time robot-builders, as well as for an intro to technology and engineering courses in high schools and colleges. Step-by-step web tutorials Qektor take you through programming its multicore Propeller chip in C, wiring circuits on a breadboard, and build- ing sensor systems so your robot can navigate on its own. Following the checkmarks gets you to the fun fast, with optional links for added learning. Art.# 140191-71 £173.95 • € 199.90 • US $270.00 Further Information and Ordering: www.elektor.com or contact customer service for your region UK / ROW Elektor International Media 78 York Street London - W1H 1DP United Kingdom Phone: +44 20 7692 8344 E-mail: service@elektor.com USA / CANADA Elektor US 111 Founders Plaza, Suite 300 East Hartford, CT 06108 USA Phone: 860.289.0800 E-mail: service@elektor.com www.elektor-magazine.com | September | 87 Spotlight 88 | September 2014 | www.elektor-magazine.com advertorial @electronica 2014 3E?jGE Made in Munich Come MAKE it @electronica 2014 By Wisse Hettinga (Elektor Labs) You've all heard of the maker revolution and seen cool things described but how cool is it to MAKE some real electronics at the world's largest exhibition on real electronics? To have a place where you can relax, charge your phone, e-gossip, have a coffee and touch base with re- al-world electronics. Where you can bring along anything you'd want to unbox, (un)solder, show off, measure, check-4-specs, Arduino'd, or Raspberry Pi'd. Feel free to come work with us the Elektor way! Elektor designers and engineers are on standby to lend a helping hand and supply everything you need to get some real electronics work done right there and then. German, English, Dutch, Spanish, C++, spoken. For this special occasion Elektor Labs are putting at your disposal: desk space, tools, test & measurement equipment, a 3D printer, and free WiFi. Not forgetting mini work- shops, techtalk, coffee (please donate), and plenty of power sockets to charge phones, tablets, laptops, and gizmos. Navigate to the Elektor Maker Space in Hall A6, Booth 380 Stay in touch with Elektor's activities register for our newsletter on www.elektor.com , right hand bottom corner. WHO: and elektor INTERNATIONAL media WHAT ELEKTOR ^ MAKER SPACE WHEN: NOVEMBER H' 14 ' 20i ^. advertorial www.elektor-magazine.com | September | 89 •Regulars NEXT MONTH IN ELEKTOR MAGAZINE Nostalgic Nixie Clock For some reason Nixie tubes continue to exert a great attraction to electronics folks. Various projects based on these tubes got published in Elektor already and to these we now add a simple Nixie Clock with a twist: it receives time information via a built-in GPS module. That's a nice combination of old and new electronics! USB Hub with Legacy RS232 and RS422/485 Electronics designers often run into a problem with modern computers no longer having the legacy serial interfaces, while many micro- controller-circuits rely on them for commu- nication. This handy circuit offers a universal solution: it contains a USB hub with three USB connections, and in addition has two full du- plex RS232 and two RS422/485 ports. Sensor Board for ElektorBus The RS485 bus is perfect for remote reading of temperature sensors across large distances. This compact sensor board is equipped with an ATtiny microcontroller and an RS485 driver. Up to four sensors can be connected. The as- sociated firmware uses the ElektorBus protocol for data transfer, and demo PC software is also available. Article titles and magazine contents subject to change, please check www.elektor-magazine.com for updates. Elektor's October 2014 edition is processed for mailing to US, UK and ROW Members starting September 11, 2014. Please note: as of the October 2014 edition Elektor magazine is no longer available from bookshops, newsstands and kiosks. Readers not having an Elektor membership can purchase printed or digital copies of individual magazines directly from the publishers at www.elektor.com (click on MAGAZINES). See what's brewing @ Elektor Labs 24/7 Check out www.elektor-labs.com and join, share, participate! elektoriS labs Sharing Electronics Projects Search | e ® 1 Need some stuff? | Visit the Elektor Labs ; store! red Video Active Popular Active Popular Active Popular EDITOR’S . CHOTCF Create a Project Create a new project or enter a proposal Get hpln. feedback ft votes from other visitors. and maybe you will get Elektonzed too! IR Remote Control Learning Dimmer or Heat Contr... 797vl«ws ***** J2B Synthesizer 176 v.ewt ’6’ ★ ★ ★ ★ Feuchtegesteuerte Kellerluftung / Humidity Basem... 1,704 views ***** You want to post a project but you are not a member? fgfrmQ Click here to send a description of your project including a circuit diagram and a photograph for evaluation and maybe -ft 90 | September 2014 | www.elektor-magazine.com Ordering Information ORDERING INFORMATION To order, contact customer service for your region: USA / CANADA Elektor US 111 Founders Plaza, Suite 300 East Hartford, CT 06108 USA Phone: 860.289.0800 E-mail: service@elektor.com Customer service hours: Monday-Friday 8:30 AM-4:30 PM EST. UK / ROW Elektor International Media 78 York Street London W1H 1DP United Kingdom Phone: (+44) (0)20 7692 8344 E-mail: service@elektor.com Customer service hours: Monday-Thursday 9:00 AM-5: 00 PM CET. PLEASE NOTE: While we strive to provide the best possible information in this issue , pricing and availability are subject to change without notice. To find out about current pricing and stock , please call or email customer service for your region. COMPONENTS Components for projects appearing in Elektor are usually available from certain advertisers in the magazine. If difficulties in obtaining components are suspected, a source will normally be identified in the article. Please note, however, that the source(s) given is (are) not exclusive. TERMS OF BUSINESS Shipping Note: All orders will be shipped from Europe. Please allow 2-4 weeks for delivery. Returns Damaged or miss-shipped goods may be returned for replacement or refund. All returns must have an RA #. Call or email customer service to receive an RA# before returning the merchandise and be sure to put the RA# on the outside of the package. Please save shipping materials for possible carrier inspection. Requests for RA# must be received 30 days from invoice. Patents Patent protection may exist with respect to circuits, devices, components, and items described in our books, magazines, online publications and presentations. Elektor accepts no responsibility or liability for failing to identify such patent or other protection. Copyright All drawings, photographs, articles, printed circuit boards, programmed integrated circuits, discs, and software carriers published in our books and magazines (other than in third-party advertisements) are copyrighted and may not be reproduced (or stored in any sort of retrieval system) without written permission from Elektor. Notwithstanding, printed circuit boards may be produced for private and educational use without prior permission. Limitation of liability Elektor shall not be liable in contract, tort, or otherwise, for any loss or damage suffered by the purchaser whatsoever or howsoever arising out of, or in connection with, the supply of goods or services by Elektor other than to supply goods as described or, at the option of Elektor, to refund the purchaser any money paid with respect to the goods. MEMBERSHIPS Membership renewals and change of address should be sent to the Elektor Membership Department for your region: USA / CANADA Elektor USA P.O. Box 462228 Escondido, CA 92046 Phone: 800-269-6301 E-mail: elektor@pcspublink.com UK / ROW Elektor International Media 78 York Street London W1H 1DP United Kingdom Phone: (+44) (0)20 7692 8344 E-mail: service@elektor.com O Do you want to become an Elektor GREEN or GOLD Member or does your current Membership expire soon? Go to www.elektor.com/member. www.elektor-magazine.com | September | 91 _ Technology PicoScope® PC OSCILLOSCOPES For every application there’s a PicoScope Bandwidth from 5 MHz to 1 GHz • Sampling from 10 MS/s to 5 GS/s • Memory from 8 kS to 2 GS 2200A SERIES The pocket-sized PicoScope MSOs Mixed-signal analysis 3400 SERIES High performance Channels: 2 + AWG Bandwidth: 10 to 200 MHz Sampling: 100 MS/s to 1 GS/s Resolution: 8 bits Buffer memory: 8 to 48 kS Channels: 2 analog 16 digital + AWG Bandwidth: 25 to 200 MHz Sampling: 200 to 500 MS/s Resolution: 8 bits Buffer memory: 48 kS to 128 MS Channels: 4 Bandwidth: 60 to 200 MHz Sampling: 1 GS/s Resolution: 8 bits Buffer memory: 4 to 128 MS PICOSCOPE 4824 8 channels, high resolution 5000 SERIES Flexible resolution 6000 SERIES Ultimate performance, USB 3.0 Channels: 8 Bandwidth: 20 MHz Sampling: 80 MS/s Resolution: 12 bits Buffer memory: 256 MS ■ "■ * J ■ " Channels: 2 or 4 + External trigger + Low distortion AWG Bandwidth: 60 to 200 MHz Sampling: 1 GS/s Resolution: 8 to 16 bits Buffer memory: 8 to 512 MS 1 Channels: 4 + External trigger + AWG Bandwidth: 250 to 500 MHz Sampling: 5 GS/s Resolution: 8 bits Buffer memory: 256 MS to 2 GS ALL MODELS INCLUDE FULL SOFTWARE AND 5 YEAR WARRANTY. SOFTWARE INCLUDES MEASUREMENTS, SPECTRUM ANALYZER, SDK, ADVANCED TRIGGERS, COLOR PERSISTENCE, SERIAL DECODING (CAN, LIN, RS232, PC, PS, FLEXRAY, SPI), MASKS, MATH CHANNELS, ALL AS STANDARD, WITH FREE UPDATES. www.picotech.com/PS360