ATmega on the Internet | High-End Amp for Active Speakers 2-amp MPP Tracking Charger UART Module for ECC | Mini Modules for Breadboarding www.elektor-magazine.com magazine March 2014 Let the Internet of Things DDS RF Signal Generator Intel Galileo-Arduino AC-AC & AC-DC Power Adapter Tester One Protocol for ioT PCB Transformer US$9.00 - Canada $10.00 03 WIZnet 5500 Challenge HP Model 200AB Audio Oscillator 7 25274 249 65 7 SPONSORED BY Looking to speed your analog development time? PIC® MCUs with Intelligent Analog make designs easier Microchip's first PIC® MCUs with 1 6-bit ADC and T 0 Msps 1 2-bit ADC With a powerful combination of rich analog integration and low power consumption, the PIC24FJ128GC010 family enables a significant cost reduction over a multi-chip design as well as enabling lower noise, faster throughput, smaller PCB size and a faster time to market. In addition to Microchip's first 16-bit ADC and a 10 Msps 12-bit ADC, the PIC24FJ128GC010 integrates a DAC and dual op amps to simplify precision analog design. The on-chip LCD driver provides the ability to drive displays with up to 472 segments for information-rich user displays; whilst mTouch™ capacitive touch sensing adds advanced touch capabilities. The PIC24FJ128GC010 family helps to reduce noise to deliver more consistent analog performance in a very small form factor. Simply add sensors to the low-cost starter kit for easy prototyping. GET STARTED IN 3 EASY STEPS: 1. Begin with the low-cost PIC24F Starter Kit for Intelligent Analog (DM240015) 2. Add custom sensors to the clean analog header to create a prototype 3. Re-use and modify the demo code to speed development PIC24F Starter Kit for Intelligent Analog (DM240015) For more information, go to: www.microchip.com/get/euGC010 Microchip Microcontrollers • Digital Signal Controllers * Analog • Memory • Wireless The Microchip name and logo, MPLAB, and PIC are registered trademarks of Microchip Technology Incorporated in the U.S.A., and other countries. mTouch is a trademark of Microchip Technology Inc. in the U.S.A. and other countries. All other trademarks mentioned herein are the property of their respective companies. DS300010046A. ME1089Eng10.13 Contents Community 8 I Connect the Magic * Join the Challenge Here are the basics to implementing the WIZ55io smart Ethernet board you get free by signing up to the Challenge jointly brought to you by Elektor, Circuit Cellar and WIZnet. 14 Elektor World • Who's looking in your fridge? • Don't touch— just wave • Raspberry to the rescue • The space-time existence of the zero-ohm resistor • Industry 74 News & New Products A selection of news items received from the electronics industry, labs and organizations. Projects 16 ATmega on the Internet (1) A router, an RPi and some clever programming are all you need to put the ubiquitous ATmega micro- controller on the web. This month we cover the preliminaries. 22 High-End Amplifier for Active Speakers This project underscores and proves some advantages of active filtering of loudspeaker signals. 30 2-amp Maximum Power Tracking Charger Here we follow Anders Gustafsson again on his sailboat, this time enjoying the thought of having the batteries charged optimally through a solar panel. Anders' project is also suitable for RVs and anything else electric moving under the sun. 36 UART Module for ECC Meet the Embedded Communica- tion Connector, ECC. Here it's used on a module designed for RS-485 serial communication. 42 Mini Modules for Breadboarding Don't build the same circuits like LCD, PIC MPU, LEDs, and power supply over and over again when you throw a new project on your breadboard. Be smart, follow Jen- nifer's modular approach. 50 DDS RF Signal Generator A rough-n-ready, no frills way of getting the AD913 DDS chip to work for you. Warning: Ugly Board Ahead! 56 AC-AC & AC-DC Power Adapter Tester It's time we deal with solid test- ing of that ton of wall warts in our households, and possibly grab a few that make a power supply for your experiments. 4 | March 2014 | www.elektor-magazine.com Volume 40 No. 447 March 2014 — — mm . H. w m v .Vi El ^ *AHIF S ^ • : L r * ,? \ :rs > r*- hjt ij\ ^ ,,, . p ■ C [ G- ] T *.L c PWh-, ;- (in@ Galileo Dt SIGNED ' IN TRELA 4 D' ‘ J" i l 1 J 1 • Regulars 58 One Protocol for the Internet of Things Here Elektor and Embedded Proj- ects Journal jointly call on you to participate in a steering group of specialists aiming to develop a solid protocol for IoT. to post-engineer a proposal for a Wattmeter project towards publica- tion. What do you think? 78 Retronics Hewlett Packard's Model 200AB is a worthy descendant of the leg- endary 200A. Series Editor: Jan Buiting. 84 Hexadoku The Original Elektorized Sudoku. 85 Gerard's Columns: Being Accurate A column or two from our colum- nist Gerard Fonte. Labs • DesignSpark 64 Intel Galileo-Arduino Free Poster Download! It seems we have to get used to Arduino boards with more muscular (and complex) processors than At- mel AVRs. Here's Intel's two cents. 68 DesignSpark Tips & Tricks Day #8: Custom Board Outlines A step by step description of shap- ing a board to make it fit perfectly in an enclosure— and it's not rect- angular. 66 A Tough One Labs need advice whether or not 72 PTC Fuses Weird Components— the series. 90 Next Month in Elektor A sneak preview of articles on the Elektor publication schedule. www.elektor-magazine.com | March 2014 | 5 •Community Volume 40, No. 447 March 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, concur- rently 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 The Thing with the Internet of Things It's hard to not see the Internet of Things as it (IT?) grabs a firm hold of electronics and embedded technology all round. Where once the Internet was a vehicle allowing vast amounts of data, information and prattle to be exchanged between people, the trend is now towards bidirectional man-machine communica- tion, which I am sure will be followed soon by machine-machine communication— inherently bidirectional or even closed loop— meaning the people who created the Internet and the machines are increasingly excluded from the conversation. If to you the IoT appears to be the next wave of innovation based on brand new concepts and marketable insights from SiVal, do browse the previous five or so year volumes of Elektor and discover that you and I have been designing and connecting stuff to the Net for ages, controlling hardware and measuring data thousands of miles away or just around the corner, from our PC keyboards, eating pizza. The thing is, it was nerdy and complex. We were early adopters though. It's hard to not see a strong presence of IoT in this edition: Connect the Magic (p. 8), ATMega on the Net (p. 16), and One Protocol for IoT (p. 58). In all articles, I've strived to concentrate on the engineering aspects of IoT, aiming to keep you in the forefront of technology where challenges are real and not reduced to do-I-buy-product-X-or-Y. For balancing purposes this edition again has a weighty proportion of micro- controller-free projects, including a peppy amp for active speakers (p. 22), a solar-cell MPP tracker (p. 30) and a $10 go/non-go wall wart tester (p. 56). Not a project per se but putting all this IoT stuff in a wonderful time perspective, the HP 200AB Audio Oscillator hails from the past on page 78. It is a Thing— some say a boatanchor— and its schematics are on the Internet for sure, but IoT? No. Happy reading, Jan Buiting, Editor-in-Chief The Team Editor-in-Chief: Publisher / President: Membership Managers Jan Buiting Carlo van Nistelrooy 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: Managing Director: Danielle Mertens Don Akkermans 6 March 2014 www.elektor-magazine.com Our Network USA Carlo van Nistelrooy + 1 860-289-0800 c.vannistelrooy@elektor.com United Kingdom Carlo van Nistelrooy +44 20 7692 8344 c.vannistelrooy@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 AP2C 2014 U APEC 2014 www.apec-conf.org . . Cad soft www. cadsoftusa. com ctavar Cleverscope www. cleverscope. com Obs Iq/z E 171 AC Inc DLP Design www. dlpdeslgn. com EMAC www.emaclnc.com . EEUve! ESC (EE Live!) www. eellveshow. com , Eurocircuits www. elektorpcbservlce. com .2 92 61 13 13 54 62 MaxBotix $ Michdchip pi CO npoioiu EebeHCI 4 FlfcliOnlCS. /Jreichelt ■iwt^nlEP Maxbotix www.maxbotlx.com/elektor 49 Microchip www. microchip. com/get/euGCOl 0 3 Pico www.plcotech.com/ps240 19, 21 Pololu www.pololu.com 49 Reichelt www.relchelt.com 35 Saelig www.saellg.com 73 Schaeffer AG www.schaeffer-ag.de 61 egress pc b Express PCB www. expresspcb. com 75 Front Panel Express www.frontpanelexpress.com 49 Singex Exhibition (IoTAsia) IoTasia www.lnternetofthlngsasla.com q .’ * ~ HKTTlf IM3 WIZnet www. circuitcellar. com/wiznet201 4 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 67 55 www.elektor-magazine.com March 2014 7 Community Connect the Magic An introduction to the WIZnet W5500 By Tom Cantrell (USA) Are you ready to join the Internet of Things (IoT) revolution? You can start by building an innovative Net-enabled design to enter in the WIZnet "Connect the Magic" Challenge. Before you begin, read through this comprehensive introduction to WIZnet's W5500 'smart' Ethernet chip and the WIZ550io integrated module. The microelectronics revolution is entering a new phase of mass market acceptance and application. I'm talking about the proliferation of popular low-cost SBCs (sin- gle-board computers) that let anyone craft their own embedded application. Like magic, these platforms turn mere 'users' into 'makers.' These magic microcontrollers all share certain characteristics. The hardware itself is low cost with a range of products and add-ons, the tools (i.e. compiler and IDE) are free and easy to use and, most importantly, there's a self-sustaining 'community' leveraging shared knowledge for the benefit of all. I've had the pleasure of working with popular platforms such as Arduino, Texas Instruments' WIZnet Connect the Magic Challenge March 3, 2014 - August 3, 2014. Visit CircuitCellar.com/wiznet2014: □KKIn Request free WIZ550io modules Learn how to register and enter the Challenge Read the rules and regulations Find out about prize information And more □ LaunchPad, ARM mbed, Parallax, and others (Fig- ure 1). All of them make it quick and easy, and dare I say fun, to whip out surprisingly sophis- ticated applications. And all have vibrant user groups with plenty of useful resources (tools, examples, advice) to share. Now it's time to connect all these gadgets to the 'Internet of Things.' Enter WIZnet and their latest and greatest 'Smart' Ethernet chip. The W5500 (Figure 2) starts with a standard 10/100 Ether- net interface (i.e. MAC and PHY) but then goes further with large RAM buffers (16-KB transmit and 16-KB receive) and hardware TCP/IP proto- col processing [9]. I discovered WIZnet's first chip, the W3100, way back in 2001 [1]. Of course by now, as with all things silicon, the new W5500 is better, faster, and lower cost. But the concept is still exactly the same: 'Internet-enable' applications by handling the network chores in hardware so the application microcontroller doesn't have to do it in software. The large RAM buffers help decouple the micro- controller from network activity. In a recent project [2] I used the RAM to receive an entire 10-KB+ webpage, completely eliminating the need for the microcontroller to juggle data at network speed. And any of the 32-KB on-chip RAM that isn't needed for network buffering is free for general-purpose use, a big plus for typ- ically RAM-constrained microcontrollers. The other major WIZnet hardware assist is TCP/ IP processing using IP addresses, sockets, and familiar commands including OPEN, CONNECT, Sponsored by Wiznet — circuitcellar.com/wiznet2014 8 March 2014 www.elektor-magazine.com WIZnet "Connect The Magic" Challenge SEND, RECEIVE, DISCONNECT. The high-level interface to the network frees up microcontroller cycles and code space that would otherwise be needed for a software TCP/IP stack. Disappearing Act The WIZ550io pictured in Figure 3 is an inte- grated module that includes everything you need to get online. Connecting the WIZ550io to your favorite micro- controller is easy. There's just an SPI (MISO, MOSI, SCLK, SCSn), three status/control lines (RESETn, RDY, INTn) and power and ground. Note 'n' suffixed to signal names indicates Active Low. The WIZ550io power supply is 3.3 V, but the module inputs are all 5-V tolerant. Ideally your processor has a hardware SPI port that can take advantage of the WIZnet modules high-speed (up to 80 MHz) SPI. But if not, bit banging is fine since the W5500 RAM buffers will take up the slack for a slow microcontroller connection. As for the three control lines, you can connect them or not, depending on the particulars of your application. RESETn does a hardware reset of the module, but the automatic power on reset will typically suffice. Alternatively, you can do a little house- keeping (save the current network parameters) and issue a software reset. After hardware reset (i.e. power on or RESETn), the RDY output will assert after a delay (50 ms) for internal module initialization. Instead of dedi- cating a pin to monitor RDY, it's easy to just insert a software delay when the application starts. The INTn pin is there if you want to implement an interrupt driven interface. Software can define which particular event(s) (e.g. data transfer, socket disconnect, link loss, etc.) trigger an interrupt request. But with the W5500 handling most network activity, there's no need to inter- rupt the microcontroller in normal operation. The network can be dealt with in the background leaving interrupts free for real-time tasks that truly need them. How many times have you gotten near the end of a project and discovered you really need one more I/O line? The W5500 offers an optional fixed transfer length SPI mode that works with the chip select (SCSn) input grounded. However, fixed mode only supports short transfers (1, 2, or 4 bytes), not the arbitrarily large block transfers Figure 1. The WIZnet W5500 is an Ethernet chip with a difference: large RAM buffers and hardware TCP/IP protocol processing make it easy for any microcontroller to go online. Figure 2. Magic tricks are easy when you've got the right Cards up your sleeve. possible using SCSn, so only consider it as a last resort if you're really desperate to free up a pin. Hidden Wires Blasting data fast and far is Ethernet's claim to fame, but that requires a lot of power (e.g. 100+ mA) just to maintain the link (i.e. PHY enabled). For- tunately, the W5500 has a standby mode that drops the link (i.e. disables the PHY) reducing the W5500 power con- sumption by a factor of 10, as well as that of the un-linked partner. Having an AC outlet nearby gives you the option of piggybacking your Ethernet data onto the power lines. That's exactly what I do with my Figure 3. The WIZ550io module has everything you need (like transformer, RJ45, and MAC address) to plug and play. www.elektor-magazine.com March 2014 9 Community Figure 4. My garage door monitoring 'Thing' uses a powerline adapter to connect with the household LAN. Figure 5. All you need are some cheap 'cheater g' cables (splitter and injector) and a variable power supply to homebrew your own Passive PoE solution. Figure 6. Low-cost Mobile Hot Spots like this TP-Link NanoRouter make it easy to convert Ethernet to Wi-Fi without any software changes. Figure 7. My garage door 'Thing' doing its thing. 10 March 2014 www.elektor own garage door monitoring 'Thing' appearing in Figure 4). Shop around and you'll find there are powerline communication (PLC) 'starter kits' that come with a pair of adapters (like my Rosewill RPLC-201KIT) in the $20 to $40 price range. If you're recalling the shaky early days of power line communication, be advised the latest gener- ation of gear works a lot better. There can still be situations where particular AC outlets are hard to reach, but usually you can find a nearby one with a decent connection. Since these new adapters are designed to handle streaming AV, I've found that even marginal connections (as indicated by the adapters signal quality LED) work fine with my low-bandwidth apps. Presumably the power- line adapter and/or W5500 are working their own magic handling any issues (e.g. automatic retry of corrupted/lost packets,) which is fine by me. If there isn't AC nearby and you're faced with stringing wire, Power-over-Ethernet (PoE) is the way to go. It's perfect for things like security webcams and VoIP phones, and now the popu- larity of those applications has fueled the market with new suppliers and lower prices (sub $100 routers; sub $10 modules) for IEEE standard 802. 3af PoE gear. An even simpler roll-your-own option is 'Passive PoE' that use the four spare wires in a standard Ethernet cable for power transmission (see Fig- ure 5). Note that this hack doesn't work with Gigabit Ethernet (which uses all eight wires) or 'Active PoE' (i.e. IEEE standard 802. 3af) gear- just plain vanilla 10/100. You may have to consider voltage drop, especially for long cable runs (up to 300 ft. / 100 m) and/or high-current loads. Use a 'PoE Calculator,' such as the one available from Stephen Foskett's PoE Blog [3] to estimate the voltage drop depending on your cable length and current requirements Or just wire everything up and dial it in using a variable power supply while measuring the actual voltage at the far end. Make sure your device is attached and fully active (i.e. pulling maximum expected current, not sleeping, etc.) to get an accurate voltage reading. Mindreader If your heart is set on wireless you can always add a low-cost Wi-Fi adapter. The TP-Link Nano- Router I've been using (Figure 6) is quite ver- satile with five different configuration options: Router, Access Point, Bridge, Repeater, and Client. Your attached Ethernet device can either join an existing wireless network or you can create an additional network with its own SSID. Thanks to the march of technology, the dual Eth- ernet + Wi-Fi approach is getting more affordable. The WIZnet online store has the WIZ550io for $18 (the W5500 chip is just $2.62) and you can find TP-Links online for $20 or so. By comparison, if you Google 'embedded Wi-Fi module' or 'Wi-Fi shield' you'll see a variety of different products ranging from around $20 for a bare Wi-Fi module (no PCB) to $80 for an official Arduino Wi-Fi Shield. Indeed, the large variety of Wi-Fi solutions does have a downside. There are more than a few embedded Wi-Fi chipsets in popular use (e.g. Broadcom, Gainspan, Microchip, Texas Instru- ments, no doubt more on the way), each with their own capabilities and unique commands. The magazine.com WIZnet "Connect The Magic" Challenge prospect of trying to write and support drivers for all the Wi-Fi chipsets across all the popular platforms gives me a headache. With the dual approach, it's easy to move Ethernet apps (any app, any platform) to Wi-Fi. Just plug into the TP-Link and you're done without changing a line of code— that's the kind of magic trick I like! Server Up My Sleeve Everyone wants to be Master of the IoT Universe from their browser screen. With assistance from WIZnet, even tiny microcontrollers are capable of running a simple web server. Checkout Fig- ure 7 showing the webpage served up by my garage door 'Thing'. But you can see the problem; or rather you can't see it. Where are the high-resolution graphics that a pixel-jaded populace demands? No way to cram more than a bit of FITML/JavaScript/JPG eye candy into the microcontroller itself, so you'll have to conjure up some external memory if you want to spice things up. The most popular add-on is a MicroSD card which, like the W5500, uses a SPI bus so you just need one extra pin for chip select. Using a standard file system driver (like FAT) you can actually do much of the development and testing of your 'website' on a PC, then when you're finished, just plug the SD card into your IoT gadget. For prototyping, check out the WIZnet ioShield pictured in Figure 8, which is a baseboard for the WIZ550io that includes an SD card socket. There are ioShields for different platforms (e.g. Arduino, LaunchPad, mbed, etc.) and with 0.1" headers they are breadboard friendly. Presto Change-O Since your browser is a 'client' it makes sense that every IoT gadget should be a 'server'— right? Not necessarily. Being a server typically implies being open for service 24/7, but many IoT appli- cations (e.g. my garage 'Thing') are character- ized by intermittent low duty-cycle activity. And while running on a LAN works fine, there may be issues reaching an in-house server from the WAN due to firewalls, ISP restrictions, changing IP addresses, and the like. Besides, do you really want to let the outside world anywhere near your LAN? Maybe it makes more sense for IoT gad- gets to be clients. But how do you get two clients (i.e. IoT device and browser) to talk to each other? The answer is you stick a server in between them courtesy of a 'Device Cloud' provider such as Xively (was Pachube), Exosite, DeviceFlub, ThingSpeak, Nim- bits, XOBXOB, the list goes on and on. (Posts- capes provides an extensive list) [4]. Much as the WIZnet chip offloads network chores, these services handle data storage and visualiza- tion to make life easy for the IoT application. Just send your raw data and the service will archive it, present it to a browser as a graphical chart, and send an e-mail, text, or tweet alert if you like. Better yet, you don't need any specialized web programming tools or know-how to get some- thing useful working quickly. The technical capabilities and look and feel of each device cloud service differ, as do their business models, everything from for-profit and pay-to- play to free and open source. But from 50,000 feet all work in a similar way. To send data to the cloud, the IoT client hits the cloud server with a request that carries the data (e.g. variable name and value) in the URL or the request body. To get data from the cloud, the IoT device sends a request specifying a variable and then retrieves the data from the server response. I decided to get my head in the clouds by proto- typing a client version of my garage door "Thing" (Figure 9) using an Arduino a WIZ550io [5] Figure 8. If you want a fancy server with lots of eye candy, a MicroSD card is the way to go. The WIZnet ioShields' include the card socket and are available for various platforms. The Arduino version is shown here. Figure 9. Prototype of the client version of my garage "Thing". www.elektor-magazine.com March 2014 11 Community Figure 10. There's an Exosite library for Arduino that makes accessing the cloud easy as can be. Figure 11. It only takes a few minutes to set up a simple Exosite Dashboard including an e-mail alert. I can 'see' my garage door without getting off the couch and now, via Exosite, from the farthest reaches of the web. ion® sendPcevTime ■ 0; int pr«vPos,currPos; / alRcad (2) ; I I (mi 11 1 - (1-sendPrevTirae) > HEARTBEAT) ) I 1»« i«t SNttfc TmK TTT 00 0 void loopO ( static unsigned static unsigned cucrPos « digit if { (cuccPos !» prevPos) prevpos = currPos; W5100.setPHYCF3R(0x4C) ; // power-up Wiz (phy enat H5100 . setPHYCTGR (OxDC ) ! String writaParam - "tin D2“"; // Exosita variable to wi vnriteParam ♦- string (currPos) ; String raadParam = // no read data for this String returnstring • ”"/ // Exosite response if (exosite. writeRead (writeParam, readParam, returnstring) ) ( lendPrevTim ■ millisO; ) sandPravTima - millisO -HEARTBEAT+SOOO? // arror, retry it wSlOO.setPHYCrGR(OxrO) ? M5100 . set PHYCEGR (0x70 ) } Sketch uses 14,732 bytes (45%) of proqram storaqc space. Maximum is 32,256 bytes. Globrtl variables use 017 bytes (39%) o! dynmnic n»emi>ry # leavimj 1,231 bytes for local variables. Maximum i*s 2,040 bytes. connected to Exosite. Note I'm powering the WIZ550io from the Arduino 3.3-V supply. That works for newer Arduinos (e.g. my UNO R3) that have a 150-mA, 3.3-V regulator. To work with earlier Arduino or clones that only specify 50 mA, a real 'shield' (e.g. the WIZnet ioShield) will include a 3.3-V regulator running off the 5-V supply. The Arduino code (Figure 10) just sits in a loop checking to see if the door state changes or it's time to send a heartbeat. Then it takes little more than a single function call (exosite. writeRead) to fire the door state off into the Exosite cloud. Over on the Exosite website [6], after signing up for a free 'Developer' account it was a quick and easy mainly point-and-click exercise to con- figure my 'Device/ 'Data,' 'Events,' and 'Alerts' (Figure 11). As a client, there's no need to keep the Thing's Ethernet link powered all the time. Data only needs to be sent when the garage door opens or closes, but I also recommend sending a periodic heartbeat just in case. My garage door monitor will only generate a minute or two of network activity (i.e. door state changes and hourly heart- beats) per day, so there's opportunity for signif- icant energy savings compared to a 24/7 server. Learn Some Tricks At WIZnet' s 'Connect the Magic' web page you can find the props for your own Magic show. There's support for the WIZnet hardware (i.e. W5500, WIZ550io, and ioShields) as well as links to W5500 drivers and demos for third party and References and Web Links [1] I-Way the Hard Way, T. Cantrell, Circuit Cellar 135, 2001. [2] Weatherize Your Embedded App, T. Cantrell, Circuit Cellar 273, 2013. [3] Power Over Ethernet Calculator, Blog, S. Foskett, http://blog.fosketts.net/toolbox/power-ethernet-calculator [4] IoT Data Broker and Cloud Service Providers, http://postscapes.com/companies/iot-cloud-services. [5] WIZnet, 'Connect the Magic' Resources, http://wizwiki.net/wiki/doku. php?id=connectthemagic. [6] Exosite Device Cloud: www.exosite.com Hardware Sources RPLC-201KIT AV adapter starter kit: www.rosewill.com TL-WR702N 150 Mbps Wireless N NanoRouter: www.tp-link.us W5500 Ethernet controller: wizwiki.net 12 March 2014 www.elektor-magazine.com WIZnet "Connect The Magic" Challenge The Author Tom Cantrell (microfuture@att. net) has been working on chip, board, and systems design and marketing for several years. Figure 12. The Parallax Spinneret Web Server 2.0 is one of the first platforms available featuring the W5500. open-source hardware including Arduino, Launch- Pad, mbed, and Parallax (Figure 12). The W5500 also works with some interesting plat- forms I haven't used before. Cookie and chipKIT are Arduino form-factor SBCs that uses ARM Cor- tex and Microchip PIC32 microcontrollers, respec- tively. GR-KURUMI is a Japanese variation on the mbed theme (i.e. web-based tools) using a Renesas microcontroller. If you want to leverage existing big iron network software, there's even a BSD Sockets library based on the UC Berkeley open-source UNIX derivative. The combination of magic micros with the W5500 and all the new device cloud services makes a compelling case for connection. Put 'em all in your hat, wave your magic wand, and amaze your friends with the cool 'thing' you pull out. ( 130482 ) Advertisement ( \ ■ ■ ^ |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 DQrai ©uddsqOD [P®m®Q IP© * ARM9 400Mhz Fanless Processor * Up to 1 GB Flash & 256 MB RAM * 4.3" WQVGA 480 x 272 TFT LCD r ■ Analog Resistive Touchscreen ' 10/100 Base-T Ethernet ' 3 RS232 & 1 RS232/422/485 Port * 1 USB 2.0 (High Speed) Host porf * 1 USB 2.0 (High Speed) OTG porjU * 2 Micro S D FI a s h C a r d S o c k e t s * SPI & I2C, 4 ADC, Audio BeepeyPT*^ * * Battery Backed Real Time Clock * Operating Voltage: 5V DC or 8 to 35V DC * Optional Power Over Ethernet (POE) * Optional Audio with Line-in/out RPC- E4+ Windows CE 2.6 KERNEL Designed and Manufactured in the USA the PPC-E4+ is an ultra compact Panel PC that comes ready to run with the Operating System installed on Flash. The dimensions of the PPC-E4+ are 4.8” by 3.0”, about the same as that of popular touch cell phones. The PPC-E4+ is small enough to fit in a 2U rack enclosure. Apply power and watch either the Linux X Windows or the Windows CE User Interface appear on a vivid 4.3” color LCD. Interact with the PPC-E4+ using the responsive integrated touch-screen. Everything works out of the box, allowing you to concentrate on your application rather than building and configuring device drivers. Just Write-lt and Run-lt. Pricing starts at $375 for Qty 1 . www.emacinc.com/sales/elektor14 Since 1985 I INI OPE. ^ BARS OF I Equipment Monitor hm Control Phone: ( 618) 529-4525 • Fax: (618) 457-0110 • Web: www.emacinc.com www.elektor-magazine.com March 2014 13 Community Compiled by Wisse Hettinga Elektor World Every day, every hour, every minute, at every given moment designers and enthusiasts are thinking up, tweaking, reverse-engineering and developing new electronics. Chiefly for fun, but occasionally fun turns into serious business. Elektor World connects some of these events and activities — for fun and business. Who's looking in your fridge? If we are to believe the predictions the year 2014 will see the dawn of the Internet of Things— all things. Your fridge, your car, your audio equipment, all and everything will be able to start communicating in a smart way. That will ask for drastic security measures. Writing this article I am just reading in the news that hackers used a fridge to get access to a home automation system. Elektor joined forces with Spanish company Intelligent SOC to launch the Secure Internet Chip. It can be used to secure all your internet communications. Pictured here are Carlos Ponce de Leon with Maria and Jaime from Elektor signing the contract. At Elektor we are busy with the tech preparation of this unique project and the production of the boards. Tentatively in the April 2014 editions Elektor will run a challenge to launch the product— there will be $25,000 prize money for the first code breaker! ii Don't touch— just wave Jean-Noel Lefebvre drove more than 450 miles from Lyon in France to Limbricht in The Netherlands. In his car was a box— and in that box another box to demonstrate the Ootsidebox. Jean-Noel is a lifetime Elektor reader. He is also an 'out-of-the-box thinker' and as a result of that he comes up with the most interesting projects and ideas. One of them is the Ootsidebox project, a capacitive sensing frame that can be fitted around your Tablet PC. It detects and calculates the movement of your hand and allows complete control of the system with easy gestures— you just have to wave! This means you can start playing games without touching the screen— you can use your hand like special small bat to play Pong like you have never done before or, if you are a programmer, you can think up a thousand other applications ranging from hygienic control systems to ice- cold situations when you cannot take off your gloves to control a tablet. We have agreed to team up with Jean- Noel and embark on a new project that will show you how to implement gesture control on your own projects and systems. Later this year hopefully we will develop some new initiatives to launch the Ootsidebox project. 14 March 2014 www.elektor-magazine.com All Around the World ... The base station for the Penn State Erie mobile tracker sandwiches a Raspberry Pi, an interface board, and a wireless modem. Raspberry to the rescue Enterprising employees at two very different US schools have at least one thing in common: They devised Raspberry Pi-based solutions for vexing communication issues their students were faced with. Both projects are previewed online in Circuit Cellar (bit.ly/LHjmHD) and will be fully described in upcoming issues of the magazine. In some ways, Salish Kootenai College (SKC) based in Pablo, MT, and Penn State Erie, The Behrend College in Erie, PA, couldn't be more different. SKC, whose main campus is on the Flathead Reservation, primarily serves students who are members of three Native American tribes. It has an enrollment of approximately 1,400. Penn State Erie is a fast-growing campus with roughly 4,300 students just outside one of Pennsylvania's larger cities. Each campus had a problem. At SKC, dorm residents had poor access to the Internet. At Penn State Erie, students weren't riding the newly introduced campus shuttle bus to class because of its unpredictable schedule. SKC IT Director Al Anderson and his team direct-wired the dorms to provide students better Ethernet service and built a Raspberry Pi-based system to monitor potentially damaging temperatures inside the dorms' sun-exposed utility boxes. Meanwhile, Penn State Erie Professor Chris Coulston and his group built an automated vehicle locator (AVL) that tracks their campus shuttle bus on a web page that students download to their smartphones. The system's base station consists of a wireless modem connected to a Raspberry Pi, which runs a web server to handle smartphone requests (pictured here). The space-time existence of the zero-ohm resistor Every month we run a short article on the lives of Weird Components. We do this together with the DesignSpark initiative from RS Components. In the January & February 2014 edition I discussed the existence of the 0-ohm resistor. Thomas Scherer, regular contributor and electronics designer from Germany was triggered and took the free thinking to the next level— towards infinity. If you start philosophizing about a 0-ohm resistor the next thing to conclude is that there must be an infinite capacitance and a 0-H inductance concurrently. In fact, you virtually created a new 3-in- 1 component which I would venture to call the Zerfinite. It has all the zero and infinite values and acts like a resistor, a capacitor and inductor in one. Using components like these will help you create filters with infinite bandwidth in a time/space moment of zero/everywhere! New and exciting products can be designed using this new component. Great stuff, a new technology is born! I will contact RS Components directly and propose they add the novel 'component' to their stock line so you can order it and play around with it. (if you ever might wonder how we spend our valuable time ... here's one answer.) www.elektor-magazine.com March 2014 15 •Projects ATmega on the Internet (l) Using Raspberry Pi as a network gateway By Dieter Holzhauser (Germany) Communicating with a microcontroller over the Internet is easy. All you need is a networked PC or smartphone, a local area network (LAN), and another computer connected to the ATmega32 over a serial link. The basis for this series of articles is a system in which a Fritz! Box router provides the LAN, and a Raspberry Pi is used as a network gateway. In the first instalment we present the basic concept and describe some typical hardware. Figure 1. The Raspberry Pi, which is roughly the size of a A Raspberry Pi in practical credit card, is a simple Linux PC. The "Model B" use - version, with 512 MB of RAM and an Ethernet port (see Figure 1), costs about 40 dollars. A monitor can be connected to its HDMI output, and its two USB 2.0 ports are used for a keyboard and a mouse. Power is supplied to the Raspberry Pi through a Micro USB connector. With a power consumption of less than 3 watts, it's no power glutton, so it can be left on all the time. After all, there wouldn't be much point in using a com- puter that is only occasionally powered up as an access point for the Internet. with SD adapter, with about 6 GB unused. It's really amazing that a computer this small can support a graphical user interface. However, in this project we use the command line interface instead. The software behind this is called a shell. You can access the command line interface of the shell by launching LXTerminal or by exiting the graphical user interface. If you don't want to use the graphical user interface at all, you can alter the configuration settings with the raspi-config utility to prevent the GUI from autostarting after a system boot. To run this utility using the com- mand line interface, enter: sudo raspi-config The prefix sudo allows regular users to use sys- tem calls normally reserved for the root user (Superuser). The procedure is largely self-explanatory. In the line: boot_behaviour Start desktop on boot? use the Tab key to set the focus on