<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>nathan.chantrell.net &#187; Home Automation</title> <atom:link href="http://nathan.chantrell.net/category/home-automation/feed/" rel="self" type="application/rss+xml" /><link>http://nathan.chantrell.net</link> <description>Errors and omissions expected.</description> <lastBuildDate>Fri, 20 Jan 2012 20:34:26 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=</generator> <item><title>Building a Web Based Infrared Remote Control</title><link>http://nathan.chantrell.net/20120119/building-a-web-based-infrared-remote-control/</link> <comments>http://nathan.chantrell.net/20120119/building-a-web-based-infrared-remote-control/#comments</comments> <pubDate>Thu, 19 Jan 2012 21:15:35 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[nanode]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2530</guid> <description><![CDATA[<p>This little project was born out of a wish to control a DAB tuner from other rooms of the house and a couple of hours on a Sunday afternoon made it reality. A Nanode (an original Nanode 5 in this case) is plugged into my ethernet network and an infrared emitter is connected to digital [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:ddc403319f531c66c5ca37963afbcaf118057af5'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2012/01/Nanode_Web_IR_Remote.png"><img class="alignright  wp-image-2560" title="Nanode Web IR Remote" src="http://cdn.chantrell.net/blog/wp-content/uploads/2012/01/Nanode_Web_IR_Remote_c.png" alt="" width="216" height="203" /></a>This little project was born out of a wish to control a DAB tuner from other rooms of the house and a couple of hours on a Sunday afternoon made it reality. A <a title="Nanode Website" href="http://www.nanode.biz/" target="_blank">Nanode</a> (an original Nanode 5 in this case) is plugged into my ethernet network and an infrared emitter is connected to digital pin 3, on visiting the ip address of the Nanode using a web browser you will see a series of buttons (shown on my phone in the screenshot on the right, click to see it full size) and selecting the various options makes the Nanode transmit the relevant infrared code to operate the DAB tuner.</p><p>The hard work here is done by the <a title="Infrared remote library for Arduino" href="http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html" target="_blank">IR Remote library by Ken Shirriff available here</a>. This infrared library has direct support for several common IR protocols (NEC, Sony SIRC and Philips RC5 and RC6) but not the one that my DAB tuner uses, fortunately this isn&#8217;t a problem as the library also makes it easy to read and transmit using the raw infrared codes (mark and space intervals) from any remote control.<br /> NB. If you are using Arduino IDE 1.0 note the comment on the library page about changing WProgram.h for Arduino.h &#8211; that&#8217;s the only change required for 1.0</p><p><span id="more-2530"></span></p><p><strong>Getting the codes from the original remote control</strong><br /> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2012/01/IR_Sensor.jpg"><img class="wp-image-2531 alignleft" title="IR Sensor" src="http://cdn.chantrell.net/blog/wp-content/uploads/2012/01/IR_Sensor.jpg" alt="" width="122" height="181" /></a><br /> The first step is to use an IR receiver connected to the Nanode to read the codes from the original remote control. An IR receiver is basically a photocell that is tuned to the infrared spectrum along with a demodulator that gives an inverted logic level output. I used a Vishay TSOP31238 IR sensor (63p +VAT from Farnell) and connected it to the Nanode as shown on the left.</p><p>To read the codes load the IRrecvDump example sketch that is included with the IR library onto the Nanode, open the serial monitor and point the remote control you want to get the codes from at the sensor, for supported protocols it will output the protocol, a hex value, the number of bits and the raw code as each button is pressed, for an unsupported protocol it will return &#8220;Could not decode message&#8221; and output the raw code only.</p><p>Press each button in turn and save the codes in a safe place. Once all the necessary codes have been gathered the IR receiver is no longer required for this project but has lots of potential for future use.</p><p><strong>Sending the codes from the Nanode</strong><br /> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2012/01/IR_Emitter.jpg"><img class="wp-image-2532 alignright" title="IR Emitter" src="http://cdn.chantrell.net/blog/wp-content/uploads/2012/01/IR_Emitter.jpg" alt="" width="150" height="181" /></a><br /> To transmit the IR codes you need an infrared emitter &#8211; a type of LED that emits infrared light. I used a Vishay TSAL7400 2.6V IR emitter (18p +VAT from Farnell) connected via a 27 Ohm resistor (as I&#8217;m using a 5V Nanode 5) to pin 3 of the Nanode as shown on the right.</p><p>The codes are transmitted by the library using pulse width modulation so a PWM pin must be used on the Nanode, the library is configured to use pin 3 which is convenient as it is free for use on a Nanode 5 (and on a Nanode Classic or RF provided you aren&#8217;t using an MCP7941x RTC).</p><p><strong>Supported protocol codes</strong></p><p>To send a code using one of the supported protocols you just need to use to use the relevant irsend command with the hex value and the number of bits, for example to send an NEC protocol command that IRrecvDump reported as &#8220;<em>Decoded NEC: A10C800F (32 bits)</em>&#8220; you would use:</p><p style="padding-left: 30px;"><em>irsend.sendNEC(A10C800F, 32)</em></p><p>Change sendNEC to sendSony, sendRC5 or sendRC6 depending on the protocol that IRrecvDump reported.</p><p><strong>Raw Codes</strong></p><p>For raw codes we first need to modify the output from the IRrecvDump sketch slightly, just remove the first group of digits and make all the numbers positive, then add commas between each group and put it into an array.</p><p>eg. The code received from the IRrecvDump sketch:</p><p style="padding-left: 30px;"><em>-14368 4500 -4500 600 -500 600 -1650 600 -550 550 -550 600 -500 600 -550 600 -500 600 -1650 600 -550 550 -1700 550 -550 600 -550 550 -550 600 -500 600 -550 600 -1600 600 -1650 600 -550 550 -550 600 -550 550 -550 600 -550 550 -550 600 -550 550 -550 600 -1650 600 -1600 600 -1650 600 -1650 600 -1650 600 -1650 600 -1650 600 </em></p><p>becomes</p><p style="padding-left: 30px;"><em>unsigned int rawCode[68] = {<em>4500, 4500, 600, 500, 600, 1650, 600, 550, 550, 550, 600, 500, 600, 550, 600, 500, 600, 1650, 600, 550, 550, 1700, 550, 550, 600, 550, 550, 550, 600, 500, 600, 550, 600, 1600, 600, 1650, 600, 550, 550, 550, 600, 550, 550, 550, 600, 550, 550, 550, 600, 550, 550, 550, 600, 1650, 600, 1600, 600, 1650, 600, 1650, 600, 1650, 600, 1650, 600, 1650, 600</em>};</em></p><p>and then to send it we use the sendRaw command with the array name, array length and the frequency (38kHz):</p><p style="padding-left: 30px;"><em>irsend.sendRaw(rawCode,68,38);</em></p><p><strong>Turning all this into a functional web based remote control</strong></p><p>So now I have all the relevant codes for my target device and can send them from the Nanode to control it, the next step was to build a simple web server on the Nanode to allow easy selection of the various codes.</p><p>I based this on the <a title="EtherCard RESTduino" href="https://github.com/thiseldo/EtherCardExamples/tree/master/EtherCard_RESTduino" target="_blank">Ethercard version of RESTduino</a> by Andrew D Lindsay (itself based on <a title="RESTduino" href="http://jasongullickson.posterous.com/restduino-arduino-hacking-for-the-rest-of-us" target="_blank">the original by Jason Gullickson</a>) modifying it to transmit IR codes instead of controlling the I/O pins and adding the menu. The only problem I ran into here was due to all the arrays for the raw codes eating up the RAM in the ATmega 328 but storing them in flash using <a title="PROGMEM - Store data in flash (program) memory instead of SRAM" href="http://arduino.cc/en/Reference/PROGMEM" target="_blank">PROGMEM</a> instead solved that. I&#8217;m not sure the way I&#8217;m reading them back is the most elegant but it works!</p><p>My <a title="Nanode Web IR Remote" href="https://github.com/nathanchantrell/Nanode_Web_IR_Remote" target="_blank">code for this is available on GitHub here</a> and it would be simple to modify for other IR controlled devices. There is also an optional css file there to prettify the basic HTML output, due to the lack of RAM this would need to go on a separate web server. Another option would be to build a full fat web interface on another server and just call the Nanode&#8217;s URLs to send each command, eg. &#8220;<em>http://192.168.0.188/4</em>&#8221; to send the command for preset 4.</p><p><strong>Other uses for infrared</strong></p><p>The IR library along with the IR receiver makes it easy to use an arbitrary infra red remote control to control the Nanode (or any other Arduino compatible for that matter). It&#8217;s as simple as building a conditional structure in the loop to do what you want on reception of the relevant code, this could be used to turn outputs on and off or trigger events over the network or RF.</p></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120119%2Fbuilding-a-web-based-infrared-remote-control%2F&amp;linkname=Building%20a%20Web%20Based%20Infrared%20Remote%20Control" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120119%2Fbuilding-a-web-based-infrared-remote-control%2F&amp;linkname=Building%20a%20Web%20Based%20Infrared%20Remote%20Control" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120119%2Fbuilding-a-web-based-infrared-remote-control%2F&amp;linkname=Building%20a%20Web%20Based%20Infrared%20Remote%20Control" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120119%2Fbuilding-a-web-based-infrared-remote-control%2F&amp;linkname=Building%20a%20Web%20Based%20Infrared%20Remote%20Control" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120119%2Fbuilding-a-web-based-infrared-remote-control%2F&amp;linkname=Building%20a%20Web%20Based%20Infrared%20Remote%20Control" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120119%2Fbuilding-a-web-based-infrared-remote-control%2F&amp;linkname=Building%20a%20Web%20Based%20Infrared%20Remote%20Control" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20120119%2Fbuilding-a-web-based-infrared-remote-control%2F&amp;title=Building%20a%20Web%20Based%20Infrared%20Remote%20Control" id="wpa2a_2"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20120119/building-a-web-based-infrared-remote-control/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Further extending the TempTX battery life</title><link>http://nathan.chantrell.net/20120107/further-extending-the-temptx-battery-life/</link> <comments>http://nathan.chantrell.net/20120107/further-extending-the-temptx-battery-life/#comments</comments> <pubDate>Sat, 07 Jan 2012 04:25:50 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[nanode]]></category> <category><![CDATA[OpenEnergyMonitor]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2503</guid> <description><![CDATA[<p>I&#8217;ve been struggling for thinking and tinkering time this week due to a bad cold that has totally wiped me out but I did have some more thoughts on further reducing the power usage of the TempTX V2. The first one is quite simple and will only have a minor effect but only needs [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:545cd06c963ac60a847af645b33c72362e47250a'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2012/01/temptx2-rt.jpg"><img class="alignright size-medium wp-image-2506" title="TempTX V2" src="http://cdn.chantrell.net/blog/wp-content/uploads/2012/01/temptx2-rt-300x212.jpg" alt="" width="300" height="212" /></a>I&#8217;ve been struggling for thinking and tinkering time this week due to a bad cold that has totally wiped me out but I did have some more thoughts on further reducing the power usage of the <a title="TempTX V2 Wireless Temperature Sensor Module" href="http://nathan.chantrell.net/20111229/temptx-v2-wireless-temperature-sensor-module/">TempTX V2</a>. The first one is quite simple and will only have a minor effect but only needs a minor code change &#8211; it turns out that it is possible to reduce the time the DS18B20 temperature sensor takes to get a reading by reducing its resolution as shown in the table below. It is currently using a 12 bit resolution but even reducing it to the lowest setting of 9 bit, an effective resolution of 0.5°C at a time would be acceptable for most applications I think.</p><table><tbody><tr><th>Resolution</th><th>9 bit</th><th>10 bit</th><th>11 bit</th><th>12 bit</th></tr><tr><td>Conversion Time (ms)</td><td>93.75</td><td>187.5</td><td>375</td><td>750</td></tr><tr><td>LSB (°C)</td><td>0.5</td><td>0.25</td><td>0.125</td><td>0.0625</td></tr></tbody></table><p>Milliseconds might only seem like a small difference but that is as much as an 8 fold difference and as I said in the last post, every little counts.</p><p>Secondly, a <a title="@Monsonite @ceejay It looks like a fuse issue. The BOD is too high. Current value is 2.7V for 3.3V board. Change to 1.8V and its OK." href="https://mobile.twitter.com/andrewdlindsay/status/153554435673559040" target="_blank">completely unrelated discussion on Twitter</a> at the weekend lead to a likely explanation for the total drop out when the battery voltage reaches 2.7V, namely that the default BOD (Brown Out Detection) fuse setting for the ATmega328 when using the default Arduino bootloader is 2.7V (<a title="I’ve also run some tests on the voltage required to keep it running and it seems to run fine until it drops below 2.71V" href="http://nathan.chantrell.net/20111229/temptx-v2-wireless-temperature-sensor-module/#voltage">sound familiar</a>?), when the voltage drops below this level the mcu is put into a reset loop until it rises again. That explains the sudden cut off at 2.7V.<br /> With some fiddling and reflashing of the bootloader this BOD setting can be changed to 1.8V or even disabled completely and some brief research shows that the ATmega328 can run from as little as 1.8V (although it would be out of spec running at 16MHz at that low of a voltage) and that the RFM12B module should run OK down to 2.2V so there is plenty of room there. Surprisingly the DS18B20 temperature sensor is not so tolerant, the datasheet says it needs a minimum of 3.0V, however, I&#8217;ve already proved that it runs ok at 2.7V (at current average temperatures anyway) and a little research found some reports that it works down to around 2.6V before it starts to give errors and the addition of an electrolytic capacitor should be sufficient for it to get a reliable reading at even lower voltages, especially at the lower resolutions where it needs to be powered for a shorter amount of time. I might try some more voltage tests with the BOD disabled to see how low I can get the whole thing will go before it starts to become unreliable.<br /> Another, maybe more sensible option might be to look at some different temperature sensors that are rated to work at lower voltages, there are several cheaper analogue alternatives to the DS18B20 that might make more sense, they would need to be calibrated though and it would mean only one sensor per input (not really a factor with the way I&#8217;ve been using these boards so far) but would have a secondary advantage in that the 1-wire and Dallas Temperature libraries wouldn&#8217;t be required which might mean that the code can be reduced to fit into one of the smaller ATmega microcontrollers thus reducing cost again.</p><p>Please feel free to post in the comments if you can think of any other suggestions or improvements.</p></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120107%2Ffurther-extending-the-temptx-battery-life%2F&amp;linkname=Further%20extending%20the%20TempTX%20battery%20life" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120107%2Ffurther-extending-the-temptx-battery-life%2F&amp;linkname=Further%20extending%20the%20TempTX%20battery%20life" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120107%2Ffurther-extending-the-temptx-battery-life%2F&amp;linkname=Further%20extending%20the%20TempTX%20battery%20life" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120107%2Ffurther-extending-the-temptx-battery-life%2F&amp;linkname=Further%20extending%20the%20TempTX%20battery%20life" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120107%2Ffurther-extending-the-temptx-battery-life%2F&amp;linkname=Further%20extending%20the%20TempTX%20battery%20life" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20120107%2Ffurther-extending-the-temptx-battery-life%2F&amp;linkname=Further%20extending%20the%20TempTX%20battery%20life" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20120107%2Ffurther-extending-the-temptx-battery-life%2F&amp;title=Further%20extending%20the%20TempTX%20battery%20life" id="wpa2a_4"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20120107/further-extending-the-temptx-battery-life/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>TempTX V2 Wireless Temperature Sensor Module</title><link>http://nathan.chantrell.net/20111229/temptx-v2-wireless-temperature-sensor-module/</link> <comments>http://nathan.chantrell.net/20111229/temptx-v2-wireless-temperature-sensor-module/#comments</comments> <pubDate>Thu, 29 Dec 2011 15:08:48 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[nanode]]></category> <category><![CDATA[OpenEnergyMonitor]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2428</guid> <description><![CDATA[<p> The original wireless temperature sensor module that I built at the end of October is still happily working away proving that the concept of a very minimal wireless node works and that it is quite happy running from two AA batteries.</p><p>There were a couple of factors that influenced the previous boards design [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:4beb3a70263300eca586bc6f5873eaf95239ffec'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/temptx_v21.jpg"><br /> <img class="alignright size-medium wp-image-2441" title="TempTX V2 Wireless Temperature Sensor Module - Click to enlarge" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/temptx_v21-300x218.jpg" alt="" width="300" height="218" /></a>The <a title="Wireless Temperature Sensor Module" href="http://nathan.chantrell.net/20111102/wireless-temperature-sensor-module/">original wireless temperature sensor module</a> that I built at the end of October is still happily working away proving that the concept of a very minimal wireless node works and that it is quite happy running from two AA batteries.</p><p>There were a couple of factors that influenced the previous boards design that meant is was less than ideal, firstly the need to remove the RFM12B when programming using a 5V FTDI cable complicated things and due to Royal Mail dragging their feet and my impatience to get the thing built I only had a piece of stripboard 18 rows high which necessitated placing the RFM12B alongside the ATmega instead of in line with it .</p><p>Now, armed with new supplies of stripboard and some new ideas I&#8217;ve made a new improved and smaller (40x65mm) board. To resolve the voltage issue I decided to make a small adapter board which contains a voltage regulator and smoothing caps (I didn&#8217;t want to put these on the main board in order to keep it as minimal as possible) and I&#8217;ve also moved the capacitor and pull up resistor for the reset on to this board meaning the TempTX (as I&#8217;ve been calling it) now requires two less components and a little less space. Of course only one adapter is required for as many of the TempTX nodes that are used so in the long run the saving of components required and time to build will make more sense. This adapter also allowed me to re-order the programming pins on the main board which further reduced the number of links required and therefore the space required. Other than using a resonator instead of the crystal and load capacitors I think this is as minimal as this board is going to get. I suppose you could omit the programming header and program the ATmega in another board but that&#8217;s probably taking minimalism a bit too far.</p><p><span id="more-2428"></span></p><p>One thing I overlooked in the original design was that the DS18B20 temperature sensor was constantly powered up, so even when the ATmega was put to sleep it was still sat there wasting power, they don&#8217;t draw much power when idle but every little helps so I&#8217;ve changed this in the new design by connecting the power pin to an output that is only turned on long enough to get a reading, turns out this is only around 840ms.</p><p><strong>Smaller, simpler and more efficient; The TempTX V2:</strong></p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/temperature_sensor_v21.png"><img class="alignnone size-medium wp-image-2438" title="TempTX V2 Wireless temperature sensor - Click to enlarge" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/temperature_sensor_v21-300x228.png" alt="" width="300" height="228" /></a></p><p>I&#8217;ve also cleaned up the code and updated it for Arduino IDE 1.0, adding plenty of comments along the way and removed a rogue delay that was causing the previous version to stay awake for longer than required for each reading. To further reduce the power consumption I&#8217;ve changed the time between each reading to once a minute as every 10 seconds was a bit over the top on reflection. That and the other improvements mean it is now only fully active for around 900ms out of every minute, for the rest of time the RFM12B is in standby, the DS18B20 is off and the ATmega is in low power mode waiting for the watchdog timer to wake it.</p><p>I&#8217;ve done some measurements and it is drawing approx 7mA for the 900ms it is awake and the idle current is too low for my cheap meter to read (its going to be in the µA range). Should have some nice improvements on the already good battery life.</p><p><a name="voltage"></a>I&#8217;ve also run some tests on the voltage required to keep it running and it seems to run fine until it drops below 2.71V. I&#8217;ve put a fresh set of batteries in and will see how long it runs, don&#8217;t expect an update on that any time soon!</p><p>Here is a picture of the FTDI to TempTX adapter and one with it connected.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/temptx_v2_adapter1.jpg"><img class="alignnone size-thumbnail wp-image-2442" title="TempTX V2 FTDI Adapter - Click to enlarge" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/temptx_v2_adapter1-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/temptx_v2_with_adapter1.jpg"><img class="alignnone size-thumbnail wp-image-2443" title="TempTX V2 Temperature Sensor Module and FTDI Adapter - Click to enlarge" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/temptx_v2_with_adapter1-150x150.jpg" alt="" width="150" height="150" /></a></p><p>The code is available <a title="TempTX Wireless Temperature Module code on GitHub" href="https://github.com/nathanchantrell/TempTX" target="_blank">on GitHub here</a> and this is the <a title="NanodeRF_emoncms on GitHub" href="https://github.com/nathanchantrell/NanodeRF_emoncms" target="_blank">code I&#8217;m running on a NanodeRF</a> (actually a <a title="Building an OpenEnergyMonitor system" href="http://nathan.chantrell.net/20111008/building-an-openenergymonitor-system/">Nanode 5 with an RFM12B</a>) to upload the readings from these and the sensors I&#8217;ve built into my graphical displays to my installation of <a title="emoncms web app for processing, logging and visualising energy, temperature and other environmental data" href="http://openenergymonitor.org/emon/emoncms" target="_blank">emoncms</a>.</p><p>Here is a screenshot of emoncms showing power usage and readings from 5 temperature sensors.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/emoncms_v3.png"><img class="alignnone size-medium wp-image-2450" title="Emoncms v3 - Click to enlarge" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/emoncms_v3-300x201.png" alt="" width="300" height="201" /></a></p><p>Cost to build one of the TempTX units is approx £12 (a couple of pounds less while I still have some of the cheap ATmegas that I bought when Proto-PIC had them on special offer) and that is almost all the cost of the ATmega, RFM12B and DS18B20.</p><p><strong>Parts list for the TempTX:</strong><br /> Stripboard min 15 holes x 24 rows (40x65mm)<br /> RFM12B transceiver<br /> ATmega328P-PU with Arduino bootloader<br /> 28 pin DIL socket<br /> 16MHz Crystal<br /> 2 x 22pF ceramic capacitors<br /> DS18B20 temperature sensor<br /> 4K7 resistor<br /> 2 x Battery holder<br /> 5 pin right angle male header<br /> 3 pin header &amp; connector for sensor (optional)<br /> Wire for links<br /> Wire for antenna (165mm for 433MHz or 82mm for 868MHz)</p><p><strong>Parts list for the programming adapter:</strong><br /> Stripboard min 10 holes x 6 rows<br /> 6 pin right angle male header (with one pin pulled out)<br /> 5 pin right angle female header<br /> MCP1702-33 voltage regulator<br /> 10uF electrolytic capacitor<br /> 3 x 100nF ceramic capacitors<br /> 2 x 10K resistor</p></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111229%2Ftemptx-v2-wireless-temperature-sensor-module%2F&amp;linkname=TempTX%20V2%20Wireless%20Temperature%20Sensor%20Module" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111229%2Ftemptx-v2-wireless-temperature-sensor-module%2F&amp;linkname=TempTX%20V2%20Wireless%20Temperature%20Sensor%20Module" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111229%2Ftemptx-v2-wireless-temperature-sensor-module%2F&amp;linkname=TempTX%20V2%20Wireless%20Temperature%20Sensor%20Module" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111229%2Ftemptx-v2-wireless-temperature-sensor-module%2F&amp;linkname=TempTX%20V2%20Wireless%20Temperature%20Sensor%20Module" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111229%2Ftemptx-v2-wireless-temperature-sensor-module%2F&amp;linkname=TempTX%20V2%20Wireless%20Temperature%20Sensor%20Module" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111229%2Ftemptx-v2-wireless-temperature-sensor-module%2F&amp;linkname=TempTX%20V2%20Wireless%20Temperature%20Sensor%20Module" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20111229%2Ftemptx-v2-wireless-temperature-sensor-module%2F&amp;title=TempTX%20V2%20Wireless%20Temperature%20Sensor%20Module" id="wpa2a_6"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20111229/temptx-v2-wireless-temperature-sensor-module/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>WiNode Based Wireless Graphical Display</title><link>http://nathan.chantrell.net/20111217/winode-based-wireless-graphical-display/</link> <comments>http://nathan.chantrell.net/20111217/winode-based-wireless-graphical-display/#comments</comments> <pubDate>Sat, 17 Dec 2011 15:29:18 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[nanode]]></category> <category><![CDATA[OpenEnergyMonitor]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2398</guid> <description><![CDATA[<p>I&#8217;ve recently put together another wireless GLCD display, this time using a WiNode together with a ST7565 GLCD with RGB backlight and a Nintendo DS touchscreen. The WiNode is fitted with a 433MHz RFB12B transceiver and the MCP79410 Real Time Clock (RTC) option as well as a DS18B20 temperature sensor for the room temperature reading.</p><p>This is [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:c5b9283b170b8970c970128b48a9b2325793fbe3'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-purple.jpg"><img class="alignright size-medium wp-image-2399" title="WiNode Based Wireless GLCD Display" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-purple-300x207.jpg" alt="" width="300" height="207" /></a>I&#8217;ve recently put together another wireless GLCD display, this time using a <a href="http://nanode.eu" rel="nofollow">WiNode</a> together with a ST7565 GLCD with RGB backlight and a Nintendo DS touchscreen. The WiNode is fitted with a 433MHz RFB12B transceiver and the MCP79410 Real Time Clock (RTC) option as well as a DS18B20 temperature sensor for the room temperature reading.</p><p>This is quite an improvement on the <a title="OpenEnergyMonitor Graphical Display" href="http://nathan.chantrell.net/20111015/building-a-graphical-display-for-openenergymonitor/">first display I made</a>, the feature list is now:</p><ul><li>Touch control using Nintendo DS touchscreen</li><li>3 Different display views selectable via touchscreen</li><li>Receive power reading from <a title="Building an OpenEnergyMonitor System" href="http://nathan.chantrell.net/20111008/building-an-openenergymonitor-system/">emonTX</a> via RF</li><li>Receive <a title="Wireless Temperature Sensor Module" href="http://nathan.chantrell.net/20111102/wireless-temperature-sensor-module/">remote temperature reading</a> via RF</li><li>Read room temperature from DS18B20 sensor</li><li>Transmit room temperature reading via RF</li><li>Backlight colour changes depending on power reading</li><li>Supports MCP79410 RTC for time &amp; date display</li></ul><p>The WiNode makes a great base on which to build a display like this and being 3.3V it pairs well with the 3.3V ST7565 displays. This particular display is the Adafruit one with the RGB backlight (available from <a title="Graphic ST7565 Positive LCD (128x64) with RGB backlight" href="http://proto-pic.co.uk/graphic-st7565-positive-lcd-128x64-with-rgb-backlight/" target="_blank">Proto-PIC</a>) that <a title="GLCD Screens and Touchscreens with the Arduino" href="http://nathan.chantrell.net/20111209/glcd-screens-and-touchscreens-with-the-arduino/">I covered here</a> and I&#8217;ve connected it up along with the touchscreen and temperature sensor as follows:</p><p><span id="more-2398"></span> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-rear.jpg"><img class="alignright size-medium wp-image-2402" title="WiNode based GLCD" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-rear-300x235.jpg" alt="" width="300" height="235" /></a></p><table><tbody><tr><th>WiNode Pin</th><th>Connected to</th></tr><tr><td>D0</td><td>RST on ST7565</td></tr><tr><td>D1</td><td>SID on ST7565</td></tr><tr><td>D4</td><td>DS18B20 data pin (with 4.7K pull up to +3.3V)</td></tr><tr><td>D5</td><td>Red cathode for backlight</td></tr><tr><td>D6</td><td>Green cathode for backlight</td></tr><tr><td>D7</td><td>SCLK on ST7565</td></tr><tr><td>D8</td><td>A0 on ST7565</td></tr><tr><td>D9</td><td>Blue cathode for backlight</td></tr><tr><td>A0</td><td>X1 on DS touchscreen</td></tr><tr><td>A1</td><td>Y2 on DS touchscreen</td></tr><tr><td>A2</td><td>X2 on DS touchscreen</td></tr><tr><td>A3</td><td>Y1 on DS touchscreen</td></tr><tr><td>3.3V</td><td>VDD on ST7565, VDD on DS18B20,<br /> Backlight Anode via 100 Ohm resistor</td></tr><tr><td>GND</td><td>CS and GND on ST7565, DS18B20 GND</td></tr></tbody></table><p>That makes it a full house, A4 and A5 are used for the I2C bus for the RTC, D2 is in use for the RFB12B interrupt, D3 is interrupt/wake up for the RTC, D10 is CS for the RFM12B and D11-D13 are for the SPI bus to the RFM12B. There is always the possibility of using more I2C devices or an I2C IO expander if I wanted to add anything else.</p><p>I haven&#8217;t used pull down resistors for the touchscreen, <a title="Using the Nintendo DS Touchscreen with the Arduino" href="http://nathan.chantrell.net/20111209/glcd-screens-and-touchscreens-with-the-arduino/">as I noted here</a> this allows it to be used on 3.3V and the accuracy is fine for this purpose (detecting relatively large areas for use as buttons).</p><p>Here you can see the menus and the colour changing with the power usage, there are a <a title="WiNode GLCD" href="http://www.flickr.com/photos/nathanchantrell/sets/72157628454795161/" target="_blank">few more pictures on Flickr here</a>.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-menu.jpg"><img title="WiNode GLCD Main Menu" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-menu-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-settings.jpg"><img title="WiNode GLCD Settings Menu" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-settings-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-view1.jpg"><img title="WiNode GLCD View 1" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-view1-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-purple1.jpg"><img title="WiNode GLCD Purple" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-purple1-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-red.jpg"><img title="WiNode GLCD Red" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/glcd-red-150x150.jpg" alt="" width="150" height="150" /></a></p><p>My code for this so far is <a href="https://github.com/nathanchantrell/EmonGLCD/blob/master/emonGLCD_ST7565_RGB_Touch/emonGLCD_ST7565_RGB_Touch.pde" rel="nofollow">available on GitHub here</a>.</p><p>For the above connections it is also necessary to change the pin numbers defined in the <a title="JeeLabs GLCDlib for ST7565 Displays" href="http://jeelabs.net/projects/cafe/wiki/GLCDlib">JeeLabs GLCDlib library</a>, in GLCD_ST7565.cpp to:</p><p style="padding-left: 30px;">#define PIN_SID 1<br /> #define PIN_SCLK 7<br /> #define PIN_A0 8<br /> #define PIN_RST 0</p><p>and the other changes for the ST7565 that I mentioned in the <a title="GLCD Screens and Touchscreens with the Arduino" href="http://nathan.chantrell.net/20111209/glcd-screens-and-touchscreens-with-the-arduino/">GLCD post here</a>.</p><p>Change LCDUNUSEDSTARTBYTES from 4 to 1 otherwise the display will be off to the right hand side:</p><p style="padding-left: 30px;"><em>#define LCDUNUSEDSTARTBYTES 1</em></p><p><em></em>Uncomment the slowSPI define:</p><p style="padding-left: 30px;"><em>// Switch from fast direct bit flipping to slower Arduino bit writes.</em><br /> <em>#define slowSPI</em></p><p>Change the PAGE_FLIP mode by changing from 0×7 to 0×3</p><p style="padding-left: 30px;"><em>// If the top line is appearing halfway down the screen, try the other mode.</em><br /> <em>//#define PAGE_FLIP 0×7</em><br /> <em>#define PAGE_FLIP 0×3</em></p><p>Adjust the contrast to your liking. I settled on 0×20</p><p style="padding-left: 30px;"><em>st7565_Set_Brightness(0×20); // strictly speaking this is the contrast of the LCD panel, the twist on the crystals.</em></p><p>and I reversed the colour defines in <em>GLCD_ST7565.h</em> so it makes more sense for a positive display:</p><p style="padding-left: 30px;"><em>#define BLACK 1</em><br /> <em>#define WHITE 0</em></p><p><strong>Still to do:</strong> It needs a case, mounting the touchscreen is going to be tricky, it&#8217;s just held on with insulation tape at the moment. I also need to come up with a better way of setting the RTC rather than putting it in the code, either through the touchscreen or possibly do it automatically from NTP over RF from a Nanode. Something to look into over the Christmas break I think. I also need to add a supercap so the RTC keeps its time when the display is powered off.</p></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111217%2Fwinode-based-wireless-graphical-display%2F&amp;linkname=WiNode%20Based%20Wireless%20Graphical%20Display" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111217%2Fwinode-based-wireless-graphical-display%2F&amp;linkname=WiNode%20Based%20Wireless%20Graphical%20Display" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111217%2Fwinode-based-wireless-graphical-display%2F&amp;linkname=WiNode%20Based%20Wireless%20Graphical%20Display" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111217%2Fwinode-based-wireless-graphical-display%2F&amp;linkname=WiNode%20Based%20Wireless%20Graphical%20Display" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111217%2Fwinode-based-wireless-graphical-display%2F&amp;linkname=WiNode%20Based%20Wireless%20Graphical%20Display" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111217%2Fwinode-based-wireless-graphical-display%2F&amp;linkname=WiNode%20Based%20Wireless%20Graphical%20Display" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20111217%2Fwinode-based-wireless-graphical-display%2F&amp;title=WiNode%20Based%20Wireless%20Graphical%20Display" id="wpa2a_8"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20111217/winode-based-wireless-graphical-display/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>GLCD Screens and Touchscreens with the Arduino</title><link>http://nathan.chantrell.net/20111209/glcd-screens-and-touchscreens-with-the-arduino/</link> <comments>http://nathan.chantrell.net/20111209/glcd-screens-and-touchscreens-with-the-arduino/#comments</comments> <pubDate>Fri, 09 Dec 2011 22:17:31 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[OpenEnergyMonitor]]></category> <category><![CDATA[tech]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2358</guid> <description><![CDATA[<p>I&#8217;ve been playing with some more GLCDs (Graphical Liquid Crystal Displays) recently, along with a Nintendo DS touchscreen. The parallel KS0108 display I used for my emonGLCD used an awful lot of pins, 16 including the power, which doesn&#8217;t leave a lot left over for anything else, so I thought I would try some [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:4df95e2b0df529c4641738fc86a26ab3870c8b86'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/st7565-rgb.jpg"><img class="alignright size-medium wp-image-2362" title="ST7565 GLCD RGB" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/st7565-rgb-300x179.jpg" alt="" width="300" height="179" /></a>I&#8217;ve been playing with some more GLCDs (Graphical Liquid Crystal Displays) recently, along with a Nintendo DS touchscreen. The parallel KS0108 display <a title="Building a graphical display for OpenEnergyMonitor" href="http://nathan.chantrell.net/20111015/building-a-graphical-display-for-openenergymonitor/">I used for my emonGLCD</a> used an awful lot of pins, 16 including the power, which doesn&#8217;t leave a lot left over for anything else, so I thought I would try some of the serial displays that are available, one from SparkFun and a nice one from Adafruit that has a RGB backlight, you can see a montage of pictures of this display on the right.</p><p>Interfacing with and coding for each of these displays is subtly different as there isn&#8217;t a single unified Arduino library but none of them are complicated, it&#8217;s basically commands to move to a particular pixel of the display, select a font and print it, or for boxes, lines etc. you need to provide coordinates for the start and end points.</p><p>In combination with these screens I&#8217;ve also been experimenting with the Nintendo DS Touchscreen which is available on its own from a number of suppliers and makes for a cost effective method of adding touch control to screens of this size. When you only want to detect relatively large areas of the screen, such as for a menu, they are very easy to use.</p><p><span id="more-2358"></span></p><h2>SparkFun LCD-09351 Serial 128&#215;64 GLCD</h2><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/LCD-09351.jpg"><img class="size-medium wp-image-2363 alignright" title="LCD-09351" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/LCD-09351-300x174.jpg" alt="" width="300" height="174" /></a>The <a title="SparkFun LCD-09351" href="http://www.sparkfun.com/products/9351" target="_blank">LCD-09351 from SparkFun</a> is basically a parallel KS0108 with an ATmega168 based serial backpack attached and only needs 3 pins including the power. It&#8217;s not all fun out of the box though as the firmware that is supplied on it isn&#8217;t very good at all. Fortunately someone has written a much <a title="summoningdark's firmware for the SparkFun Serial GLCD backpack" href="https://sourceforge.net/projects/serialglcd/" target="_blank">improved firware, available here</a>. To update this you will need to use an ICSP programmer to flash it with AVRDUDE or WinAVR, <a title="Flashing new firmware to the LCD-09351" href="http://www.sparkfun.com/products/9351#comment-4eaad851757b7fd351008a9f" target="_blank">this post</a> on the SparkFun product page has details. Unfortunately the ICSP pads on the serial backpack are unpopulated and they aren&#8217;t the easiest thing to solder to when the backpack is fixed to the screen. I did it by pushing some wires up from between the two and soldering on the top.</p><p>Here is the pinout for the ICSP:</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/SparkFun_LCD-09351_ICSP.jpg"><img class="alignnone size-medium wp-image-2369" title="SparkFun LCD-09351 ICSP Pinout" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/SparkFun_LCD-09351_ICSP-300x122.jpg" alt="" width="300" height="122" /></a></p><p>Once the new firmware from summoningdark has been flashed to the backpack you can use the <a title="Serial GLCD library for summoningdark's firmware" href="http://sourceforge.net/projects/serialglcdlib/" target="_blank">serialglcdlib library here</a>.</p><p>Another oddity of this screen is that VIN on the 4 pin header requires 6-7V for the display to work properly but on inspection this just goes to a regulator to feed 5V to the rest of the board so as long as you are providing it with a regulated 5V (eg. from an Arduino) you can just connect to the 5V pad on the opposite side of the board instead.</p><p>This is a nice display with a crisp output and good contrast, the 3 wire connection is very handy but on the downside it isn&#8217;t cheap, at <a title="Sparkfun serial GLCD LCD-09351 at SK Pang" href="http://www.skpang.co.uk/catalog/serial-graphic-lcd-128x64-p-655.html" target="_blank">£27+delivery from SK Pang</a> it&#8217;s nearly twice the price of a <a title="KS0108 GLCD at SK Pang" href="http://www.skpang.co.uk/catalog/graphic-lcd-128x64-stn-led-backlight-p-542.html" target="_blank">bare KS0108</a>. Also, unlike with the bare KS0108 it isn&#8217;t easy to use different fonts with this display, only two can be used and they can only be changed by compiling them into the firmware when flashing the backpack.</p><p>I&#8217;ve put some code <a title="Alternative versions of the EmonGLCD display from openenergymonitor.org" href="https://github.com/nathanchantrell/EmonGLCD" target="_blank">on GitHub</a> for using this display with an Arduino and RFM12B transceiver as a display for <a title="Open Energy Monitor" href="http://www.openenergymonitor.org" target="_blank">OpenEnergyMonitor</a>.</p><p>&nbsp;</p><h2>Adafruit ST7565 Serial 128&#215;64 GLCD with RGB backlight</h2><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/ST7565.jpg"><img class="alignright size-medium wp-image-2364" title="ST7565" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/ST7565-300x183.jpg" alt="" width="300" height="183" /></a>Another display I&#8217;ve been playing with is a <a title="Adafruit RGB Backlight GLCD" href="http://www.adafruit.com/products/250" target="_blank">ST7565 based unit branded by Adafruit</a> and <a title="ST7565 GLCD with RGB backlight at Proto-PIC" href="http://proto-pic.co.uk/graphic-st7565-positive-lcd-128x64-with-rgb-backlight/" target="_blank">sold in the UK by Proto-PIC</a> at the great price of only £17.99 It&#8217;s the same resolution as the KS0108 displays (128&#215;64) but is slightly larger and more readable in good light without the backlight on. The backlight is where this display differs from most 128&#215;64 displays as it is an RGB backlight, essentially three in one, you have a common anode and a separate cathode for each of red, green and blue, which means you can drive them from separate pins on the Arduino and use PWM to fade and mix the colours giving you a whole range of colours, not just red, green and blue.</p><p>To drive the LCD part you can either use the <a title="Adafruit ST7565 GLCD Library" href="https://github.com/adafruit/ST7565-LCD" target="_blank">Adafruit libary</a> or the <a title="JeeLabs ST7565 GLCD Library" href="http://jeelabs.net/projects/cafe/wiki/GLCDlib" target="_blank">JeeLabs library</a>. The Jeelabs library is an extension of the Adafruit one and is more actively developed, recently having been updated for Arduino 1.0 and has some nice <a title="JeeLabs GLCD-Library" href="http://jeelabs.org/2011/01/05/glcd-library/" target="_blank">additional functions</a> including support for remote displays that I&#8217;ve not looked at yet. It&#8217;s also the one that OpenEnergyMonitor use so was the natural choice.</p><p>This screen runs on 3.3V so you can either run your whole system on 3.3V or Proto PIC have included a very handy CD4050BC chip which can be used as a logic level converter as described on <a title="ST7565 GLCD Tutorial" href="http://www.ladyada.net/learn/lcd/st7565.html" target="_blank">this Adafruit tutorial</a>.</p><p>I&#8217;ve been testing this on a 5V Arduino and in order to leave pins free for the RFM12B transceiver and Nintendo DS touchscreen that I am also be using I&#8217;ve connected it as follows:</p><table><tbody><tr><th>Arduino pin</th><th>Screen</th></tr><tr><td>0 (via CD4050BC)</td><td>SID</td></tr><tr><td>1 (via CD4050BC)</td><td>SCLK</td></tr><tr><td>2</td><td>- will be used with RFM12B transceiver</td></tr><tr><td>3</td><td>Red backlight cathode</td></tr><tr><td>4 (via CD4050BC)</td><td>A0</td></tr><tr><td>5</td><td>Green backlight cathode</td></tr><tr><td>6</td><td>Blue backlight cathode</td></tr><tr><td>7 (via CD4050BC)</td><td>RST</td></tr><tr><td>8 (via CD4050BC)</td><td>CS</td></tr></tbody></table><p>Pins 3, 5 and 6 are used for the backlight as these pins can do hardware PWM which will allow the three colours to be dimmed individually.</p><p>The anode for the backlights is connected to 5V via a 270 Ohm resistor</p><p><strong>Changes to the JeeLabs library</strong></p><p>The JeeLabs library is written for their Graphics Board and if you want to use it with this display on an Arduino you will need to make a few minor changes.</p><p>Firstly, in <em>GLCD_ST7565.cpp</em> make sure the defines for the pins reflect what you are using, eg. I used:</p><p style="padding-left: 30px;"><em>#define PIN_SID 0</em><br /> <em> #define PIN_SCLK 1</em><br /> <em> #define PIN_A0 4</em><br /> <em> #define PIN_RST 7</em></p><p>Change LCDUNUSEDSTARTBYTES from 4 to 1 otherwise the display will be off to the right hand side:</p><p style="padding-left: 30px;"><em>#define LCDUNUSEDSTARTBYTES 1</em></p><p><em></em>Uncomment the slowSPI define:</p><p style="padding-left: 30px;"><em>// Switch from fast direct bit flipping to slower Arduino bit writes.</em><br /> <em> #define slowSPI</em></p><p>Change the PAGE_FLIP mode by changing from 0&#215;7 to 0&#215;3</p><p style="padding-left: 30px;"><em>// If the top line is appearing halfway down the screen, try the other mode.</em><br /> <em> //#define PAGE_FLIP 0&#215;7</em><br /> <em> #define PAGE_FLIP 0&#215;3</em></p><p>Adjust the contrast to your liking. I don&#8217;t think the contrast is as good on this as the KS0108 displays, you can adjust it in the library by changing the badly named <em>st7565_Set_Brightness</em> value in <em>GLCD_ST7565.cpp</em>, the default 0&#215;15 was far too light for me and I settled on 0&#215;19. 0&#215;20 does gives slightly better text but then lines start to appear in the background with some colours.</p><p style="padding-left: 30px;"><em>st7565_Set_Brightness(0&#215;19); // strictly speaking this is the contrast of the LCD panel, the twist on the crystals.</em></p><p>A minor point but the library has been written for a negative display so I reversed the colour defines in <em>GLCD_ST7565.h</em> to it makes more sense for a positive display, this will save some hair pulling later on I&#8217;m sure.</p><p style="padding-left: 30px;"><em>#define BLACK 1</em><br /> <em> #define WHITE 0</em></p><p>My code for using this screen as a display for <a title="Open Energy Monitor" href="http://www.openenergymonitor.org" target="_blank">OpenEnergyMonitor</a> with the backlight colour changing with power usage is also available <a title="Alternative versions of the EmonGLCD display from openenergymonitor.org" href="https://github.com/nathanchantrell/EmonGLCD" target="_blank">on my GitHub page</a>.</p><p>&nbsp;</p><h2>Using the Nintendo DS Touchscreen with the Arduino</h2><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/LCD-09351-ds-touchscreen.jpg"><img class="alignright size-medium wp-image-2365" title="LCD-09351 with Nintendo DS Touchscreen" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/LCD-09351-ds-touchscreen-300x216.jpg" alt="" width="300" height="216" /></a>The touchscreen from the Nintendo DS handheld game console makes a good companion to these small GLCDs, it&#8217;s slightly larger but this doesn&#8217;t matter and you could even use the extra off screen space for fixed (ie. none graphical) buttons.</p><p>They aren&#8217;t expensive either <a title="Nintendo DS touchscreen at Proto-PIC" href="http://proto-pic.co.uk/nintendo-ds-touch-screen/" target="_blank">£5.65 for the screen</a> and <a title="Nintendo DS Touchscreen breakout board from Proto-PIC" href="http://proto-pic.co.uk/nintendo-ds-touch-screen-connector-breakout/" target="_blank">£2.51 for a breakout board/connector</a> from Proto-PIC.</p><p>You WILL want the breakout board, don&#8217;t be tempted to try and solder to the ribbon connector, if you think it looks small in a picture I promise it is smaller in real life.</p><p>They are very easy to connect to an Arduino, it connects to four analogue pins and give you an x and y value of the place the screen was touched so you can build button areas by doing something like:</p><p style="padding-left: 30px;"><em>if (y&gt;510 &amp;&amp; x&lt;490) { //top left quadrant touched }</em></p><p>There is some good info on using these touchscreens with an Arduino <a title="Arduino and a Nintendo DS touch screen" href="http://kalshagar.wikispaces.com/Arduino+and+a+Nintendo+DS+touch+screen" target="_blank">here</a> and <a title="Nintendo DS Touchscreen Arduino Tutorial at Tronixstuff" href="http://tronixstuff.wordpress.com/2010/12/29/tutorial-arduino-and-the-ds-touch-screen/" target="_blank">here</a>.</p><p>The four connections from the touchscreen change purpose depending on which axis is being read, eg. to read the x value you need to put a positive voltage on X2 and ground on X1 the use the analogRead function to get the value of Y1. To read the y value you switch the positive to Y2, ground to Y1 and read X1</p><p>I haven&#8217;t used pull down resistors as the accuracy is fine for detecting large segments of the screen to use as buttons and not using resistors allows 3.3V to be used and I plan to use a <a title="WiNode" href="http://nathan.chantrell.net/20111204/the-nanode-family-expands/">WiNode</a> which is 3.3V for my final build.</p><p>My <a title="emonGLCD_ST7565_RGB_Touch" href="https://github.com/nathanchantrell/EmonGLCD/blob/master/emonGLCD_ST7565_RGB_Touch/emonGLCD_ST7565_RGB_Touch.pde" target="_blank">code for the ST7565 display</a> makes use of this touchscreen.</p></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111209%2Fglcd-screens-and-touchscreens-with-the-arduino%2F&amp;linkname=GLCD%20Screens%20and%20Touchscreens%20with%20the%20Arduino" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111209%2Fglcd-screens-and-touchscreens-with-the-arduino%2F&amp;linkname=GLCD%20Screens%20and%20Touchscreens%20with%20the%20Arduino" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111209%2Fglcd-screens-and-touchscreens-with-the-arduino%2F&amp;linkname=GLCD%20Screens%20and%20Touchscreens%20with%20the%20Arduino" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111209%2Fglcd-screens-and-touchscreens-with-the-arduino%2F&amp;linkname=GLCD%20Screens%20and%20Touchscreens%20with%20the%20Arduino" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111209%2Fglcd-screens-and-touchscreens-with-the-arduino%2F&amp;linkname=GLCD%20Screens%20and%20Touchscreens%20with%20the%20Arduino" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111209%2Fglcd-screens-and-touchscreens-with-the-arduino%2F&amp;linkname=GLCD%20Screens%20and%20Touchscreens%20with%20the%20Arduino" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20111209%2Fglcd-screens-and-touchscreens-with-the-arduino%2F&amp;title=GLCD%20Screens%20and%20Touchscreens%20with%20the%20Arduino" id="wpa2a_10"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20111209/glcd-screens-and-touchscreens-with-the-arduino/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>The Nanode family expands</title><link>http://nathan.chantrell.net/20111204/the-nanode-family-expands/</link> <comments>http://nathan.chantrell.net/20111204/the-nanode-family-expands/#comments</comments> <pubDate>Sun, 04 Dec 2011 00:34:18 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[nanode]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2345</guid> <description><![CDATA[<p>The original Nanode has proved to be a great success with a growing community of people building many interesting networked devices and this month, Ken Boak, the creator of the Nanode has launched several new additions to the line. The new Nanode RF is essentially an upgrade to the original Nanode 5 with an [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:32ba6e596efc2a064e5a280ecf68e835bca3ac04'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/WiNode2.jpg"><img class="alignright size-medium wp-image-2349" title="WiNode" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/WiNode2-300x220.jpg" alt="" width="300" height="220" /></a>The <a title="Nanode – The Network Application Node" href="http://nathan.chantrell.net/20110821/nanode-the-network-application-node/" target="_blank">original Nanode</a> has proved to be a great success with a growing community of people building many interesting networked devices and this month, <a title="Sustainable Suburbia" href="http://sustburbia.blogspot.com/" target="_blank">Ken Boak</a>, the creator of the Nanode has launched several new additions to the line. The new Nanode RF is essentially an upgrade to the original Nanode 5 with an on board RFM12B wireless transceiver and options for several extras such as a real time clock (RTC), 32KB SRAM and a Micro SD socket.</p><p>The second new member of the Nanode family is the WiNode, a low cost wireless node that is available in several different configurations, all using the same PCB with just the installed components differentiating between them. As with the Nanode and Nanode RF, the WiNode can be fitted with the standard Arduino headers for compatibility with Arduino shields as well as the RTC (SOIC or DIP), 32KB SRAM and Micro SD options as with the Nanode RF. The WiNode also features four 16V tolerant analogue inputs and when fitted with a dual H-bridge driver chip it can provide 2A digital outputs for driving relays or motors (although you can&#8217;t use the SRAM/SD if the H-bridge is used). Due to a nifty bit of design the WiNode can also be built for use as a shield for the original Nanode to add RFM12B wireless capability and more. Prices are very good, with WiNode kits starting at £17.50 (or £15 if you buy a pair) for the basic stand alone wireless node or only £10 if you want to use one to expand an existing Nanode 5. The Nanode RF kits start at £30 and for the first time a fully assembled unit with all the options is available for £40.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/NanodeRF.jpg"><img class="alignleft size-medium wp-image-2386" title="Nanode RF" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/12/NanodeRF-300x228.jpg" alt="" width="216" height="164" /></a>Pictured  above is my first WiNode build, decked out with the SRAM and SOIC RTC options. I&#8217;ve fitted all the optional bits on this one, headers, screw terminals and even the socket for the H-bridge driver as I will keep this one aside for experimentation and prototyping, subsequent builds will just include whatever is required for the particular use. That&#8217;s the Nanode RF on the left.</p><p>As with the original Nanode, both the Nanode RF and WiNode are supplied as a kit for you to build yourself and anyone with basic soldering skills should find it very straightforward. <a title="Ian Chilton's website" href="http://www.ichilton.co.uk" target="_blank">Ian Chilton</a> has already created a very comprehensive <a title="Nanode RF Build Guide with Photos" href="http://ichilton.github.com/nanode/rf/build_guide.html" target="_blank">guide to building the Nanode RF</a> which is available here and I suspect a WiNode version won&#8217;t be far behind (update: <a title="WiNode Build Guide" href="http://ichilton.github.com/nanode/wi-node/build_guide.html" target="_blank">WiNode build guide</a> is now almost complete).</p><p>Ken says he will have an online shop available shortly but for now you can order by sending a Paypal payment, for further details and prices of the various options see <a title="A Weekend Of Nanode" href="http://sustburbia.blogspot.com/2011/11/weekend-of-winode.html" target="_blank">this blog post</a>.</p></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111204%2Fthe-nanode-family-expands%2F&amp;linkname=The%20Nanode%20family%20expands" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111204%2Fthe-nanode-family-expands%2F&amp;linkname=The%20Nanode%20family%20expands" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111204%2Fthe-nanode-family-expands%2F&amp;linkname=The%20Nanode%20family%20expands" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111204%2Fthe-nanode-family-expands%2F&amp;linkname=The%20Nanode%20family%20expands" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111204%2Fthe-nanode-family-expands%2F&amp;linkname=The%20Nanode%20family%20expands" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111204%2Fthe-nanode-family-expands%2F&amp;linkname=The%20Nanode%20family%20expands" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20111204%2Fthe-nanode-family-expands%2F&amp;title=The%20Nanode%20family%20expands" id="wpa2a_12"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20111204/the-nanode-family-expands/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Wireless Temperature Sensor Module</title><link>http://nathan.chantrell.net/20111102/wireless-temperature-sensor-module/</link> <comments>http://nathan.chantrell.net/20111102/wireless-temperature-sensor-module/#comments</comments> <pubDate>Wed, 02 Nov 2011 20:48:53 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[nanode]]></category> <category><![CDATA[OpenEnergyMonitor]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2264</guid> <description><![CDATA[<p></p><p>UPDATE: There is a new improved version of this here: TempTX V2 Wireless Temperature Sensor Module</p><p>As I mentioned in my last post I wanted to get the GLCD display that I built for my OpenEnergyMonitor system to transmit the reading from its internal temperature sensor so that the Nanode could upload it to the emoncms web interface. [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:d4aa32b0f79d08832cc66d4150c636f3ed8ee44e'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/11/temperature_sensor.jpg"><img class="alignright size-medium wp-image-2266" title="Wireless Arduino Temperature Sensor Module" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/11/temperature_sensor-300x224.jpg" alt="" width="300" height="224" /></a></p><p><span style="color: #ff0000;"><strong>UPDATE:</strong> There is a new improved version of this here: <a title="TempTX V2 Wireless Temperature Sensor Module" href="http://nathan.chantrell.net/20111229/temptx-v2-wireless-temperature-sensor-module/"><span style="color: #ff0000;">TempTX V2 Wireless Temperature Sensor Module</span></a></span></p><p>As I mentioned in my last post I wanted to get the <a title="emonGLCD Graphical Display for OpenEnergyMonitor" href="http://nathan.chantrell.net/20111015/building-a-graphical-display-for-openenergymonitor/">GLCD display</a> that I built for my <a title="OpenEnergyMonitor posts" href="http://nathan.chantrell.net/tag/openenergymonitor/">OpenEnergyMonitor system</a> to transmit the reading from its internal temperature sensor so that the Nanode could upload it to the emoncms web interface. Once that was working it gave me the idea of building wireless temperature sensor modules for other areas of the house, the first of these is now complete and is sensing the outside temperature which is being displayed on the GLCD as well as being uploaded to emoncms by the Nanode. This has now allowed me to retire the old one wire temperature sensor system that I had connected to <a title="My Home Automation System" href="http://nathan.chantrell.net/old-stuff/home-automation/my-home-automation-system/">my MisterHouse server</a>.</p><p>The board for the wireless temperature sensor module is basically the same as my <a title="Build your own Arduino for under £10" href="http://nathan.chantrell.net/20110819/build-your-own-arduino-for-under-10/">minimal Arduino build</a> with an RFM12B transceiver and a DS18B20 temperature sensor added. As it&#8217;s running directly from 2 x AA batteries no voltage regulation was added.</p><p>As I only have a 5V FTDI cable for programming and the RFM12B isn&#8217;t 5V tolerant I soldered it to a small carrier board so that it can be removed during programming, this also has the benefit of making the footprint for the main board smaller while still keeping things neat as the space under the RFM12B can be used for some of the links. The idea of soldering the RFM12B in this manner came from a picture that Andrew Lindsay <a title="Mounting an RFM12B transceiver" href="http://twitpic.com/748xsf" target="_blank">posted on Twitter</a> showing how he uses them with breadboard, simple but very effective.</p><p><span id="more-2264"></span></p><p>Here is the stripboard layout for the main board and RFM12B carrier, note that I haven&#8217;t connected all the connections on the RFM12B, only those actually required to interface with the ATmega.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/11/Wireless_Temp_Sensor.png"><img class="alignnone size-medium wp-image-2265" title="Wireless Temperature Sensor Module" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/11/Wireless_Temp_Sensor-300x256.png" alt="" width="300" height="256" /></a></p><p>I&#8217;ve lifted most of the code for the temperature module from the emontx examples, just removing the CT sensor parts and as it implements several power saving measures (putting the ATmega to sleep and powering down the RFM12B in between readings) the battery life should hopefully be as good as or better than the 5 months that the <a title="Real world battery life test" href="http://openenergymonitor.org/emon/node/115" target="_blank">OpenEnergyMonitor real world test</a> got.</p><p><strong>Displaying the readings</strong></p><p>I&#8217;ve now got the emoncms web interface showing the temperature readings from the GLCDs sensor and the wireless temperature module as well as the power reading from the emontx, I&#8217;ve also installed the <a title="emoncms multigraph extension" href="https://github.com/openenergymonitor/emoncms2_extras/tree/master/Visualisations/MultiGraph" target="_blank">Multigraph extension</a> which makes it easy to show all three on the one the graph:</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/11/emoncms_multigraph.png"><img class="alignnone size-medium wp-image-2267" title="emoncms multigraph" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/11/emoncms_multigraph-300x198.png" alt="" width="300" height="198" /></a></p><p>Here is my home made emonGLCD displaying the reading from its own sensor (Room Temp) and the temperature received from the wireless module (Outside Temp). The slight contrast difference on a couple of lines is due to the camera catching the refresh, it doesn&#8217;t show in real life.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/11/P1020896.jpg"><img class="alignnone size-medium wp-image-2269" title="emonGLCD with temperature readings" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/11/P1020896-300x229.jpg" alt="" width="300" height="229" /></a></p><p><strong>Code</strong></p><p>Here is the code I am currently using, it&#8217;s a bit rough and ready in places as I&#8217;m still experimenting but it works:<br /> <a title="TempTX on GitHub" href="https://github.com/nathanchantrell/TempTX" target="_blank"> Wireless Temperature Sensor Module</a><br /> <a title="emonGLCD_KS0108 on GitHub" href="https://github.com/nathanchantrell/EmonGLCD/tree/master/emonGLCD_KS0108" target="_blank"> emonGLCD with KS0108 display and temperature TX and RX</a><br /> <a title="NanodeRF_emoncms on GitHub" href="https://github.com/nathanchantrell/NanodeRF_emoncms" target="_blank"> Nanode receiving multiple transmitters</a></p><h3><span style="color: #ff0000;"><strong>UPDATE:</strong> There is a new improved version of this here: <a title="TempTX V2 Wireless Temperature Sensor Module" href="http://nathan.chantrell.net/20111229/temptx-v2-wireless-temperature-sensor-module/"><span style="color: #ff0000;">TempTX V2 Wireless Temperature Sensor Module</span></a></span></h3><h3><span style="color: #ff0000;"><br /> </span></h3></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111102%2Fwireless-temperature-sensor-module%2F&amp;linkname=Wireless%20Temperature%20Sensor%20Module" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111102%2Fwireless-temperature-sensor-module%2F&amp;linkname=Wireless%20Temperature%20Sensor%20Module" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111102%2Fwireless-temperature-sensor-module%2F&amp;linkname=Wireless%20Temperature%20Sensor%20Module" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111102%2Fwireless-temperature-sensor-module%2F&amp;linkname=Wireless%20Temperature%20Sensor%20Module" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111102%2Fwireless-temperature-sensor-module%2F&amp;linkname=Wireless%20Temperature%20Sensor%20Module" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111102%2Fwireless-temperature-sensor-module%2F&amp;linkname=Wireless%20Temperature%20Sensor%20Module" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20111102%2Fwireless-temperature-sensor-module%2F&amp;title=Wireless%20Temperature%20Sensor%20Module" id="wpa2a_14"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20111102/wireless-temperature-sensor-module/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Building a graphical display for OpenEnergyMonitor</title><link>http://nathan.chantrell.net/20111015/building-a-graphical-display-for-openenergymonitor/</link> <comments>http://nathan.chantrell.net/20111015/building-a-graphical-display-for-openenergymonitor/#comments</comments> <pubDate>Sat, 15 Oct 2011 19:01:54 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[nanode]]></category> <category><![CDATA[OpenEnergyMonitor]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2207</guid> <description><![CDATA[<p>As a followup to my post on building an OpenEnergyMonitor system here is a description of two different remote displays I have made, one using a 128&#215;64 pixel graphical LCD and one using a 4&#215;20 line LCD.</p><p>The GLCD Version</p><p>The OpenEnergyMonitor project is working on a graphical display and I&#8217;ve based the code [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:642f6e3e94c56e2f3e8588a75c726290767b29c4'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_3.jpg"><img class="alignright size-medium wp-image-2237" title="OpenEnergyMonitor GLCD" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_3-300x236.jpg" alt="" width="300" height="236" /></a>As a followup to <a title="Building an OpenEnergyMonitor system" href="http://nathan.chantrell.net/20111008/building-an-openenergymonitor-system/">my post on building an OpenEnergyMonitor system</a> here is a description of two different remote displays I have made, one using a 128&#215;64 pixel graphical LCD and one using a 4&#215;20 line LCD.</p><p><strong>The GLCD Version</strong></p><p>The <a title="OpenEnergyMonitor Website" href="http://openenergymonitor.org/" target="_blank">OpenEnergyMonitor project</a> is working on a graphical display and I&#8217;ve based the code on their examples. For the <a title="OpenEnergyMonitor wireless open-source graphical LCD unit" href="http://openenergymonitor.org/emon/emonglcd" target="_blank">emonGLCD</a> they are using a serially connected JeeLabs based graphic LCD that uses the GLCD_ST7565 library, for the parallel <a title="SparkFun Graphic LCD 128x64 STN LED Backlight" href="http://www.sparkfun.com/products/710" target="_blank">SparkFun GLCD</a> that I&#8217;m using I needed to use the KS0108 compatible GLCD library (formerly the KS0108 library) so modifications in both hardware and software were required.</p><p>To use a KS0108 based display you will need to download the <a title="glcd-arduino Graphical LCD library for Arduino" href="http://code.google.com/p/glcd-arduino/downloads/list" target="_blank">GLCD library</a> and copy it to your Arduino IDE library directory.</p><p>The first problem is that the KS0108 based screens use a lot of pins, 8 data pins and 5 command pins in addition to the power connections and the standard pinout uses several of the pins we will need for the RFM12B wireless module so the pin assignments must be changed.</p><p><span id="more-2207"></span></p><p>We need digital pins 2 and 10 to 14 for the RFM12B so I made the following modifications; In the GLCD library directory edit <em>config/ks0108_Arduino.h</em> and change the definitions for the data pins to:</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_2.jpg"><img class="alignright size-medium wp-image-2239" title="OpenEnergyMonitor GLCD" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_2-300x249.jpg" alt="" width="300" height="249" /></a>#define glcdData0Pin      14<br /> #define glcdData1Pin      15<br /> #define glcdData2Pin      16<br /> #define glcdData3Pin      17<br /> #define glcdData4Pin      4<br /> #define glcdData5Pin      5<br /> #define glcdData6Pin      6<br /> #define glcdData7Pin      7</p><p>and change the command pins to:</p><p>#define glcdCSEL1      9<br /> #define glcdCSEL2      8<br /> #define glcdRW      3<br /> #define glcdDI      19<br /> #define glcdEN      18</p><p>Then wire your LCD as follows (<strong>NOT to the standard layout</strong>):<br /> Note that this is for a &#8220;Pinout A&#8221; type KS0108 panel, for other variants you will have to alter the pins accordingly.</p><table><tbody><tr><th>Arduino pin</th><th>GLCD Function</th><th>GLCD Pin</th><th>Comment</th></tr><tr><td>5V</td><td>+5 volts</td><td>1</td><td></td></tr><tr><td>GND</td><td>GND</td><td>2</td><td></td></tr><tr><td>n/a</td><td>Contrast in</td><td>3</td><td>Connect to wiper of 10k potentiometer</td></tr><tr><td>14 (alog 0)</td><td>D0</td><td>4</td><td></td></tr><tr><td>15 (alog 1)</td><td>D1</td><td>5</td><td></td></tr><tr><td>16 (alog 2)</td><td>D2</td><td>6</td><td></td></tr><tr><td>17 (alog 3)</td><td>D3</td><td>7</td><td></td></tr><tr><td>4</td><td>D4</td><td>8</td><td></td></tr><tr><td>5</td><td>D5</td><td>9</td><td></td></tr><tr><td>6</td><td>D6</td><td>10</td><td></td></tr><tr><td>7</td><td>D7</td><td>11</td><td></td></tr><tr><td>9</td><td>CSEL1</td><td>12</td><td></td></tr><tr><td>8</td><td>CSEL2</td><td>13</td><td></td></tr><tr><td>Reset</td><td>Reset</td><td>14</td><td>Connect to reset</td></tr><tr><td>3</td><td>R_W</td><td>15</td><td></td></tr><tr><td>19 (alog 5)</td><td>D_I</td><td>16</td><td></td></tr><tr><td>18 (alog 4)</td><td>EN</td><td>17</td><td></td></tr><tr><td>n/a</td><td>Contrast out</td><td>18</td><td>Connect to one leg of 10k potentiometer</td></tr><tr><td>n/a</td><td>Backlight +5</td><td>19</td><td>Connect via 100 ohm resistor to +5v</td></tr><tr><td>GND</td><td>Backlight Gnd</td><td>20</td><td>To ground and other leg of potentiometer</td></tr></tbody></table><p>Due to changing the library to the KS0108 compatible one there are quite a few changes to make in the example emonGLCD Arduino sketch, you can get my modified version <a title="EmonGLCD for KS0108 Display" href="https://github.com/nathanchantrell/EmonGLCD" target="_blank">on GitHub here</a>.</p><p>The GLCD library comes with a few basic fonts (in the fonts directory) but the larger digital style one I am using for the power reading is one I converted from a TTF font, you can <a title="Digital font for Arduino GLCD library" href="http://nathan.chantrell.net/downloads/arduino/openenergymonitor/Digital.h">download it here</a>. If you want to convert fonts yourself there is a a free java app called <a title="GLCDFontCreator2" href="http://code.google.com/p/glcd-arduino/downloads/detail?name=GLCDFontCreator2.zip&amp;can=2&amp;q=" target="_blank">GLCDFontCreator2 available here</a> that will convert TTF fonts for use with this library.</p><p>As well as changing the commands to use the GLCD library I have moved the Dallas one wire temperature sensor to pin 1 and removed the green/red LED outputs which leaves us with one pin spare (digital 0) for future use which may be useful to add a mode change button to change what the display shows. I&#8217;ve also made the output to the serial monitor optional as if it is active with the temperature sensor connected on pin 1 it will prevent the temperature from being read and will output garbage anyway, you can re-enable it by changing <em>#define SERIAL 0</em> to <em>#define SERIAL 1</em> but you will need to disconnect pin 1 while it is running.</p><p>If you want to include the temperature sensor you will need a DS18B20 one wire temperature sensor and a 4.7K resistor plus the <a title="OneWire Library for Arduino" href="http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip" target="_blank">OneWire library</a> and the <a title="DallasTemperature Library for Arduino" href="http://download.milesburton.com/Arduino/MaximTemperature/DallasTemperature_371Beta.zip" target="_blank">DallasTemperature library</a> installed in your Arduino libraries directory.</p><p>Connect the DS18B20 temperature sensor to pin 1 of the Arduino as shown below:</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/DS18B20_Connection.jpg"><img class="size-medium wp-image-2227 alignnone" title="DS18B20 Connection to Arduino" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/DS18B20_Connection-300x263.jpg" alt="" width="300" height="263" /></a></p><p>To receive the wireless signal from the transmitter a RFM12B and breakout board is required. The breakout board should be built with all the components the same as the one built for the <a title="Building an OpenEnergyMonitor" href="http://nathan.chantrell.net/20111008/building-an-openenergymonitor-system/">Xino based OpenEnergyMonitor transmitter</a>: With the board positioned with the headers at the bottom fit 3 x 4K7 resistors on the left and 3 x 10K on the right. Fit two 0.1uF/100nF ceramic capacitors in the C1 and C2 positions and a 10uF electrolytic capacitor in C4 (positive to the right hand side as marked on the board). Fit the MCP1702-33 to follow the orientation marked on the board and fit a 5 pin male header across the GND, SCK, SDO, SDI and SEL positions. When soldering the RFM12B to the breakout board you only need to solder the top 3 and bottom 3 pads on the left hand side and the bottom 2 on the right. Solder a 165mm length of solid core wire to the hole next to the top left pin of the RFM12B for use as an antenna.</p><p>Link the 5V pin on the RFM12B breakout board to the 5V on the Arduino and the IRQ pin to the Arduino&#8217;s D2 pin then plug the breakout board into the 8 way header on the Arduino so that it is across the GND and D10 pins.</p><p>Upload the sketch to the Arduino and you should start to see data on the display.</p><p>After testing everything out on a breadboard first I built the final device using a ProtoX prototype shield. The Proto X shield comes with 4 sets of standard header pins but I replaced the one where the RFM12B breakout board connects with a stackable header so it could be plugged in on top of the prototype board. I used an old IDE hard disk cable to connect the screen, cutting off one end and soldering the relevant connections to the prototype board which makes it easy to position and remove the display. The temperature sensor, resistors and contrast pot are also soldered to the prototype board.</p><p><strong>The 4&#215;20 LCD Version</strong></p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_LCD_1.jpg"><img class="alignright size-medium wp-image-2238" title="OpenEnergyMonitor LCD" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_LCD_1-300x120.jpg" alt="" width="300" height="120" /></a>While I was at it I knocked up a second version using a 4&#215;20 character HD44780 LCD display connected via a <a title="SparkFun Serial Enabled LCD Backpack" href="http://www.sparkfun.com/products/258" target="_blank">SparkFun SerLCD</a> serial LCD Backpack. The HD44780 compatible displays use a parallel connection natively so normally need 12 pins connecting but the useful serial backpack from SparkFun allows it to be connected via a serial connection requiring only 3 pins (5V, ground and data). They aren&#8217;t cheap compared to the cost of a 4&#215;20 LCD but they are very handy.</p><p>The LCD is connected to the Arduino pin 1 and the DS18B20 temperature sensor is connected to pin 3 using the same connection as for the GLCD version above. You can download the sketch for this one here. Note that you will probably want to disconnect the pin 1 connection to the display while uploading to the Arduino otherwise it will spam the display with garbage and could potentially reconfigure the SerLCD if the right sequence hits it.</p><p>You can download my version of the emonGLCD Arduino sketch modified to work with a serial 4&#215;20 LCD <a title="4 Line LCD for OpenEnergyMonitor" href="https://github.com/nathanchantrell/EmonLCD" target="_blank">on GitHub here</a>.</p><p><strong><br /> More pictures</strong> (click to enlarge)</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/breadboard_glcd.jpg"><img title="OpenEnergyMonitor GLCD on breadboard" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/breadboard_glcd-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_1.jpg"><img title="OpenEnergyMonitor GLCD" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_1-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_2.jpg"><img title="OpenEnergyMonitor GLCD" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_2-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_3.jpg"><img title="OpenEnergyMonitor GLCD" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_GLCD_3-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_LCD_2.jpg"><img title="OpenEnergyMonitor LCD" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_LCD_2-150x150.jpg" alt="" width="150" height="150" /></a></p><p><strong>Video of the GLCD in operation:</strong></p><p><iframe width="500" height="281" src="http://www.youtube.com/embed/OyOGha9BvNw?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p><p>&nbsp;</p><table><tbody><tr><th>Parts used for the graphical display version</th><th>Parts used for the 4 line LCD version</th></tr><tr valign="top"><td><a title="SparkFun Graphic LCD 128x64 STN LED Backlight" href="http://www.sparkfun.com/products/710" target="_blank">SparkFun LCD-00710 128&#215;64 pixel LCD</a><br /> Arduino compatible board<br /> <a title="Ciseco ProtoX Prototype Shield" href="http://www.ebay.co.uk/itm/220853116416" target="_blank"> ProtoX prototype shield</a><br /> <a title="RFM12B 433MHz transceiver" href="http://www.skpang.co.uk/catalog/rfm12bs2-wireless-transceiver-8dbm-p-660.html" target="_blank">RFM12B transceiver</a><br /> <a title="JeeLabs RFM12B Breakout Board" href="http://jeelabs.org/2011/02/02/meet-the-rfm12b-board/" target="_blank"> Jeelabs RFM12B breakout boards</a><br /> DS18B20 Temperature sensor<br /> 1 x 100 to 330 ohm resistor<br /> 3 x 10K resistors<br /> 4 x 4.7K resistors<br /> 2 x 0.1uF/100nF ceramic capacitors<br /> 1 x 10uF electrolytic capacitors<br /> 1 x MCP1702-33 low dropout 3.3V voltage regulator<br /> 1 x 10K potentiometer<br /> 1 x 5 way male header<br /> 1 x 165mm length of wire for antenna<br /> Old IDE Cable<br /> USB Power supply</td><td>HD44780 compatible 4&#215;20 character LCD<br /> <a title="SparkFun Serial Enabled LCD Backpack" href="http://www.sparkfun.com/products/258" target="_blank"> SparkFun SerLCD backpack</a><br /> Arduino compatible board<br /> <a title="RFM12B 433MHz transceiver" href="http://www.skpang.co.uk/catalog/rfm12bs2-wireless-transceiver-8dbm-p-660.html" target="_blank">RFM12B transceiver</a><br /> <a title="JeeLabs RFM12B Breakout Board" href="http://jeelabs.org/2011/02/02/meet-the-rfm12b-board/" target="_blank">Jeelabs RFM12B breakout boards</a><br /> DS18B20 Temperature sensor<br /> 3 x 10K resistors<br /> 4 x 4.7K resistors<br /> 2 x 0.1uF/100nF ceramic capacitors<br /> 1 x 10uF electrolytic capacitors<br /> 1 x MCP1702-33 low dropout 3.3V voltage regulator<br /> 1 x 5 way male header<br /> 1 x 165mm length of wire for antenna<br /> USB  Power supply</td></tr></tbody></table><p>&nbsp;</p><p><strong>Next Steps</strong></p><p>Some sort of enclosure would be good and as both these units contain a temperature sensor and a transceiver and will be situated in different rooms of the house it would be nice if they could upload their readings to the emoncms web interface via the Nanode base station. I don&#8217;t know if this is feasible but in theory it sounds good and is something I will look into more.</p><p>There is also plenty of opportunity to display extra information on these displays such as usage over time, estimated energy costs, date, time etc. Maybe this information could be switchable via a mode button connected to that one remaining pin on the GLCD version.</p><p>&nbsp;</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/emonGLCD_Complete.jpg"><img class="alignright size-medium wp-image-2261" title="emonGLCD Complete" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/emonGLCD_Complete-300x231.jpg" alt="" width="300" height="231" /></a><strong>Update 26 October</strong></p><p>I&#8217;ve now made a case for the GLCD display using laser cut acrylic glued together with epoxy. This was my first time trying anything like this and it was mostly successful although if I was doing it again I would redesign the back cover and base so that it is easier to screw the Arduino board in place. I did get the front with the logo laser engraved into it but it didn&#8217;t turn out as well as I&#8217;d hoped with some burning around the edges of the letters so I flipped the front over and went with a stick on logo cut in a frosted vinyl with a vinyl cutting plotter. I&#8217;m pretty pleased with how it turned out overall.</p><p>You can download the <a title="emonGLCD_Laser_Layout.svg" href="http://nathan.chantrell.net/downloads/arduino/openenergymonitor/emonGLCD_Laser_Layout.svg">.svg file for the case here</a>.</p></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111015%2Fbuilding-a-graphical-display-for-openenergymonitor%2F&amp;linkname=Building%20a%20graphical%20display%20for%20OpenEnergyMonitor" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111015%2Fbuilding-a-graphical-display-for-openenergymonitor%2F&amp;linkname=Building%20a%20graphical%20display%20for%20OpenEnergyMonitor" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111015%2Fbuilding-a-graphical-display-for-openenergymonitor%2F&amp;linkname=Building%20a%20graphical%20display%20for%20OpenEnergyMonitor" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111015%2Fbuilding-a-graphical-display-for-openenergymonitor%2F&amp;linkname=Building%20a%20graphical%20display%20for%20OpenEnergyMonitor" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111015%2Fbuilding-a-graphical-display-for-openenergymonitor%2F&amp;linkname=Building%20a%20graphical%20display%20for%20OpenEnergyMonitor" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111015%2Fbuilding-a-graphical-display-for-openenergymonitor%2F&amp;linkname=Building%20a%20graphical%20display%20for%20OpenEnergyMonitor" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20111015%2Fbuilding-a-graphical-display-for-openenergymonitor%2F&amp;title=Building%20a%20graphical%20display%20for%20OpenEnergyMonitor" id="wpa2a_16"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20111015/building-a-graphical-display-for-openenergymonitor/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Building an OpenEnergyMonitor system</title><link>http://nathan.chantrell.net/20111008/building-an-openenergymonitor-system/</link> <comments>http://nathan.chantrell.net/20111008/building-an-openenergymonitor-system/#comments</comments> <pubDate>Sat, 08 Oct 2011 20:25:43 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[nanode]]></category> <category><![CDATA[OpenEnergyMonitor]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2145</guid> <description><![CDATA[<p>OpenEnergyMonitor is a project to implement an open source whole house energy monitoring system built on the Arduino platform. This guide will show you how to make a complete system that will monitor your mains power usage and transmit it over a wireless link to a base station which will upload the data to a web [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:d34b349e5b266741b78f9a1122432146f0c9525a'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_Graph.png"><img class="alignright size-medium wp-image-2196" title="OpenEnergyMonitor emoncms Graph" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/OpenEnergyMonitor_Graph-300x182.png" alt="" width="300" height="182" /></a><a title="Open Source Energy Monitor System" href="http://openenergymonitor.org/" target="_blank">OpenEnergyMonitor</a> is a project to implement an open source whole house energy monitoring system built on the Arduino platform. This guide will show you how to make a complete system that will monitor your mains power usage and transmit it over a wireless link to a base station which will upload the data to a web server where you can view graphs of your power usage over time. The image to the right shows one example of the output from the web interface.</p><p>There are many options when it comes to building an OpenEnergyMonitor system and you can have systems with multiple current sensors, pulse count sensors and temperature sensors. The OpenEnergyMonitor website is a mine of information but it is very spread out and there isn&#8217;t really a simple description of how to build a complete wireless system from end to end so I thought I would document how I made my single sensor system for use on single phase electricity systems such as that used in the UK.</p><p>First of all you are going to need some parts. I used a <a title="Nanode Network Application Node" href="http://nathan.chantrell.net/20110821/nanode-the-network-application-node/">Nanode</a> as the base station which receives the data from the transmitter and uploads it to a web app running on your server. For the transmitter I used a <a title="Xino Basic for Atmel Arduino Compatible Board" href="http://nathan.chantrell.net/20110910/xino-basic-arduino-clone/" target="_blank">Xino Basic for Atmel</a> which is a no frills Arduino compatible with a handy prototyping area which allows everything to be made on the one board. Here is my full parts list:</p><p><span id="more-2145"></span></p><p><strong>Parts list</strong></p><p>1 x <a title="Nanode suppliers" href="http://nanode.eu/buy" target="_blank">Nanode Kit</a><br /> 1 x <a title="Xino Basic for Atmel on eBay" href="http://www.ebay.co.uk/itm/220843962987" target="_blank">Xino Basic for Atmel Kit</a><br /> 2 x <a title="RFM12B Transceivers at SK Pang Electronics" href="http://www.skpang.co.uk/catalog/rfm12bs2-wireless-transceiver-8dbm-p-660.html" target="_blank">RFM12B transceivers</a><br /> 2 x <a title="RFM12B Breakout boards from JeeLabs" href="http://jeelabs.org/2011/02/02/meet-the-rfm12b-board/" target="_blank">Jeelabs RFM12B breakout boards</a><br /> 1 x <a title="Efergy CT sensor on eBay" href="http://www.ebay.co.uk/itm/180718611167" target="_blank">Efergy CT Sensor</a><br /> 1 x ATmega 328 chip with the Arduino bootloader<br /> 1 x 16 MHz crystal<br /> 8 x 10K resistors<br /> 6 x 4.7K resistors<br /> 1 x 24 Ohm resistor<br /> 2 x 22pF ceramic capacitors<br /> 4 x 0.1uF/100nF ceramic capacitors<br /> 2 x 10uF electrolytic capacitors<br /> 2 x 100uF electrolytic capacitors<br /> 1 x LM7805 5V voltage regulator<br /> 1 x MCP1702-33 low dropout 3.3V voltage regulator<br /> 1 x 8 way male header<br /> 1 x 5 way male header<br /> 2 x 165mm length of wire for antennas<br /> 1 x 7V to 9V DC power supply for the Xino<br /> 1 x 7V to 9V DC power supply for the Nanode or a USB power supply<br /> 1 x Stereo 2.5mm jack socket<br /> 2 x 2.1mm DC power sockets<br /> 2 x ABS plastic cases</p><p>&nbsp;</p><p><strong>The Sensor</strong></p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/efergyct.jpg"><img class="alignright size-thumbnail wp-image-2163" title="Efergy CT Sensor" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/efergyct-150x150.jpg" alt="" width="150" height="150" /></a>The current is measured using a current transformer or CT sensor which works by induction. A CT sensor contains a split ferrite core which is clipped around the live wire bringing the mains feed into to the house, the current in the mains wire produces a magnetic field in the ferrite core which induces a current flow in a secondary coil that is proportional to the current in the mains wire. As the current in the secondary coil is electrically isolated from the primary current it offers a safe, non invasive way of measuring the mains current.</p><p>The efergy CT sensor I used needs to connected across a resistor (the 24 Ohm &#8220;burden resistor&#8221;) to get a voltage reading (some CT sensors have this resistor built in) and then a voltage divider is used to bias the output around 2.5V instead of 0V so that it can be connected to one of the analogue inputs on the transmitter (an Arduino needs a positive voltage).<br /> I used the Efergy CT sensor which doesn&#8217;t appear to be available on their website at the moment but is available from them on <a title="Efergy CT sensor on eBay" href="http://www.ebay.co.uk/itm/180718611167" target="_blank">eBay</a>. If you want to use <a title="How to connect up a CT sensor to an Arduino (circuit design)" href="http://openenergymonitor.org/emon/node/156" target="_blank">a different CT sensor</a> you will need to know if it has a burden resistor built in and how many turns the secondary coil has.</p><p>&nbsp;</p><p><strong>The Transmitter (<strong>Xino</strong>)</strong></p><p>Any Arduino type board can be used here, or you could even <a title="Build your own Arduino clone on stripboard" href="http://nathan.chantrell.net/20110819/build-your-own-arduino-for-under-10/">roll your own</a>. I decided to use the <a title="Xino Basic for Atmel review" href="http://nathan.chantrell.net/20110910/xino-basic-arduino-clone/">Xino</a> as it is very cost effective and the prototyping area allows the burden resistor, voltage divider and filter capacitor to be installed all on the one board.</p><p>The biased output from the CT sensor will connect to an analogue input on the Xino which will then transmit the power reading over a 433MHz radio link to the Nanode base station.</p><p>Build the Xino to match the picture below, you don&#8217;t need to fit the 6 pin headers or the 8 pin for the 0 to 7 digital pins but you will need the one for 8 to 15. You won&#8217;t need the 6 pin ICSP headers and you can also omit the power LED and the 1K resistor as I have.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/xino.jpg"><img title="Xino basic for Atmel" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/xino-300x255.jpg" alt="" width="300" height="255" /></a></p><p>Now we need to add the other components in the prototyping area of the Xino to regulate the power input and connect the CT sensor. Fit the 24 Ohm burden resistor, two 10K resistors, 10uF capacitor, two 100uF capacitors and the LM7805 voltage regulator as per the following diagram. Connect the two wires for the CT sensor to the tip and collar pins of the 2.5mm jack socket (it doesn&#8217;t matter which way round), the center ring isn&#8217;t used. The V IN and GND IN are for connection of your power supply, I connected these to a 2.1mm DC power socket so a standard 7 to 9V DC power supply can be used.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/openenergymonitor_xino_prototype_layout.jpg"><img class="size-medium wp-image-2190 alignnone" title="OpenEnergyMonitor Xino Prototype Area Layout" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/openenergymonitor_xino_prototype_layout-300x241.jpg" alt="" width="300" height="241" /></a></p><p>&nbsp;</p><p>The Xino should now look like this:</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/xino_openenergymonitor-rx.jpg"><img class="alignnone size-medium wp-image-2191" title="Xino OpenEnergyMonitor TX" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/xino_openenergymonitor-rx-300x288.jpg" alt="" width="300" height="288" /></a></p><p>&nbsp;</p><p><strong>The Base Station (<strong>Nanode</strong>)</strong></p><p>The <a title="Nanode Network Application Node" href="http://nathan.chantrell.net/20110821/nanode-the-network-application-node/">Nanode</a> is an ethernet enabled Arduino workalike, it will act as the base station and receiver for the OpenEnergyMonitor, receiving the power reading from the Xino based transmitter and uploading it to the web server.</p><p>Build the Nanode as per the <a title="Building a Nanode" href="http://wiki.london.hackspace.org.uk/view/Project:Nanode/Building_a_Nanode" target="_blank">instructions here</a> but note that you must <a title="Modify Nanode to allow RFM12B and ethernet to be used together" href="http://wiki.london.hackspace.org.uk/view/Nanode_Applications#RFM12_Wireless_Module" target="_blank">make the modification</a> to allow the RFM12B transceiver to be used at the same time as the ethernet, this involves not fitting R13 (the 10K resistor one down from the 1 ohm ferrite) and lifting pin 4 of the ENC28J60 so that it is not connected to the socket. You do not need to fit the standard Arduino headers  but you will need to fit one 8 way header for the RFM12B port. If you intend to power the Nanode via the USB port you won&#8217;t need to fit the screw terminals or voltage regulator and conversely if you intend to power using the screw terminals you wouldn&#8217;t need to fit the USB socket. I fitted both so I have the option.</p><p>Your Nanode should now look like this:</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/nanode.jpg"><img class="alignnone size-medium wp-image-2148" title="Nanode" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/nanode-300x252.jpg" alt="" width="300" height="252" /></a></p><p>&nbsp;</p><p><strong>The Radio Link</strong></p><p>To link the two boards wirelessly two 433MHz RFM12B transceivers are used, to connect these boards to the Arduino platform requires a few extra components and the easiest way to achieve this is to use a breakout board.</p><p>Build one RFM12B breakout board for the Xino with all the components. With the board positioned with the headers at the bottom you want to fit 3 x 4K7 resistors on the left and 3 x 10K on the right. Fit two 0.1uF/100nF ceramic capacitors in the C1 and C2 positions and a 10uF electrolytic capacitor in C4 (positive to the right hand side as marked on the board). Fit the MCP1702-33 to follow the orientation marked on the board and fit a 5 pin male header across the GND, SCK, SDO, SDI and SEL positions. When soldering the RFM12B to the breakout board you only need to solder the top 3 and bottom 3 pads on the left hand side and the bottom 2 on the right. Solder a 165mm length of solid core wire to the hole next to the top left pin of the RFM12B for use as an antenna.</p><p>Solder a wire from the 5V pin on the RFM12B breakout board to the 5V on the Xino and solder one from the IRQ pin to the Xino&#8217;s D2, plug the breakout board into the 8 way header on the Xino so that it is across the GND and D10 pins.</p><p>Build a second RFM12B breakout board for the Nanode but this time you don&#8217;t need to fit the capacitors or the voltage regulator as the Nanode will provide the 3.3V to run the RFM12B. Fit an 8 pin male header to this one and plug it into the 8 way header fitted to the Nanodes RFM12B port.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/rfm12B_boards.jpg"><img class="alignnone size-medium wp-image-2150" title="RFM12B boards" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/rfm12B_boards-300x223.jpg" alt="" width="300" height="223" /></a></p><p>Fit the RFM12B boards to the Nanode and Xino and that is the hardware completed.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/nanode_with_rfm12b.jpg"><img class="alignnone size-medium wp-image-2154" title="Nanode with RFM12B fitted" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/nanode_with_rfm12b-300x237.jpg" alt="" width="300" height="237" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/xino_with_rfm12b.jpg"><img class="alignnone size-medium wp-image-2192" title="Xino with RFM12B 433MHz wireless board fitted" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/xino_with_rfm12b-300x300.jpg" alt="" width="237" height="237" /></a></p><p>&nbsp;</p><p><strong>Software</strong></p><p>Now you need to install the web interface and load the sketches onto the Nanode and Xino.</p><p>First install the <a title="emoncms web interface for OpenEnergyMonitor" href="http://openenergymonitor.org/emon/emoncms" target="_blank">emoncms2 package</a> on your web server and register an account.</p><p>Now load the sketches onto the Nanode and Xino using the Arduino IDE and an FTDI cable/board. The Xino has a 5 pin header for programming so you might wanto <a title="FTDI adapter for Xino for Atmel board" href="http://nathan.chantrell.net/downloads/arduino/FTDI_to_XINO_adapter.png">make an adapter</a> to convert it to a normal FTDI connector.</p><p>On the Xino upload the <a title="OpenEnergyMonitor Arduino sketch for a single CT transmitter" href="https://github.com/openenergymonitor/emonTxFirmware/tree/master/emonTx_SingleCT_Example_" target="_blank">emonTx_SingleCT_Example_ sketch</a> from the emonTxFirmware repository.<br /> On the Nanode upload the <a title="OpenEnergyMonitor Arduino sketch for the Nanode base station" href="https://github.com/openenergymonitor/NanodeRF/tree/master/nanodeRF_ctonly" target="_blank">nanodeRF_ctonly</a> sketch from the NanodeRF repository.</p><p>Before uploading the Nanode sketch make sure you set the mac to something unique and change the emoncms details to reflect where you installed emoncms and copy the write only API key from your emoncms2 web interface.</p><p>If you now fit the CT sensor around your mains feed and plug it into the Xino transmitter and connect the Nanode receiver to your network or router and you should soon start to see data appearing in your emoncms web interface.</p><p>&nbsp;</p><p><strong>Calibration</strong></p><p>The system is now working but should be calibrated against a known source. I used an old Owl energy monitor system I had for this, you need to adjust the &#8220;double CAL&#8221; value in the sketch for the Xino until the readings match your known source across a range of loads. If you change &#8220;#define SERIAL 0&#8243; to &#8220;#define SERIAL 1&#8243; you can use the Arduino IDE serial monitor to view the readings as they are read which can help speed this process up, don&#8217;t forget to change it back afterwards as it can apparently affect stability otherwise.</p><p>&nbsp;</p><p><strong>Finishing up</strong></p><p>To make things a bit neater you will probably want to put the Nanode and Xino in a case. Ciseco, the maker of the Xino do <a title="Arduino/Nanode case from Ciseco" href="http://www.ebay.co.uk/itm/Arduino-suitable-ABS-plastic-wall-box-your-projects-/320766622762" target="_blank">a nice ABS plastic box</a> which is perfect for housing Arduino boards and will just about fit a Nanode too once a hole is cut for the ethernet jack.</p><p>Here is my completed transmitter and receiver:</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/openenergymonitor-tx.jpg"><img class="alignnone size-thumbnail wp-image-2158" title="Completed OpenEnergyMonitor Transmitter" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/openenergymonitor-tx-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/openenergymonitor-rx.jpg"><img class="alignnone size-thumbnail wp-image-2162" title="OpenEnergyMonitor receiver" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/openenergymonitor-rx-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/openenergymonitor-tx2.jpg"><img class="alignnone size-thumbnail wp-image-2193" title="OpenEnergyMonitor wireless transmitter with CT sensor" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/10/openenergymonitor-tx2-150x150.jpg" alt="" width="150" height="150" /></a></p><p><strong><br /> Next Steps</strong></p><p>Next I&#8217;m going to look at making a <a title="OpenEnergyMonitor Output Modules" href="http://openenergymonitor.org/emon/output" target="_blank">graphical LCD display unit</a> which will involve another Arduino based board with an RFM12B and some sort of graphical LCD. I found <a title="128x64 GLCD" href="https://p.twimg.com/AbLPw9GCAAAde6L.jpg">a nice 128&#215;64 pixel</a> display from an old car alarm programmer in my salvage pile that I hope to be able to use for this.</p><p>&nbsp;</p></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111008%2Fbuilding-an-openenergymonitor-system%2F&amp;linkname=Building%20an%20OpenEnergyMonitor%20system" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111008%2Fbuilding-an-openenergymonitor-system%2F&amp;linkname=Building%20an%20OpenEnergyMonitor%20system" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111008%2Fbuilding-an-openenergymonitor-system%2F&amp;linkname=Building%20an%20OpenEnergyMonitor%20system" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111008%2Fbuilding-an-openenergymonitor-system%2F&amp;linkname=Building%20an%20OpenEnergyMonitor%20system" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111008%2Fbuilding-an-openenergymonitor-system%2F&amp;linkname=Building%20an%20OpenEnergyMonitor%20system" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20111008%2Fbuilding-an-openenergymonitor-system%2F&amp;linkname=Building%20an%20OpenEnergyMonitor%20system" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20111008%2Fbuilding-an-openenergymonitor-system%2F&amp;title=Building%20an%20OpenEnergyMonitor%20system" id="wpa2a_18"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20111008/building-an-openenergymonitor-system/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Nanode powered Twitter door bell</title><link>http://nathan.chantrell.net/20110826/nanode-powered-twitter-door-bell/</link> <comments>http://nathan.chantrell.net/20110826/nanode-powered-twitter-door-bell/#comments</comments> <pubDate>Fri, 26 Aug 2011 19:22:20 +0000</pubDate> <dc:creator>Nathan Chantrell</dc:creator> <category><![CDATA[Arduino]]></category> <category><![CDATA[Home Automation]]></category> <category><![CDATA[electronics]]></category> <category><![CDATA[nanode]]></category><guid isPermaLink="false">http://nathan.chantrell.net/?p=2056</guid> <description><![CDATA[<p>I&#8217;ve had my front door bell sending me text messages since 2004 using a combination of a hacked X10 wireless remote control and Misterhouse, initially through an email to SMS gateway (not ideal as it cost me every time someone pressed the door bell) and more recently using TTYtter. It worked well enough most of the time but the X10 [...]]]></description> <content:encoded><![CDATA[<div class='microid-mailto+http:sha1:b7e1341026da4f01601b203a1e463d9cf6030cd0'><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/08/doorbell_twitter2.jpg"><img class="size-medium wp-image-2058 alignright" title="Twitter Door Bell" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/08/doorbell_twitter2-300x225.jpg" alt="" width="300" height="225" /></a>I&#8217;ve had my front door bell <a title="Old SMS Door Bell" href="http://nathan.chantrell.net/20040420/wireless-door-bell/">sending me text messages since 2004</a> using a combination of a hacked <a title="X10 Powerline Home Automation" href="http://en.wikipedia.org/wiki/X10_(industry_standard)" target="_blank">X10 wireless remote control</a> and <a title="MisterHouse is an open source home automation program written in Perl" href="http://misterhouse.net/" target="_blank">Misterhouse</a>, initially through an email to SMS gateway (not ideal as it cost me every time someone pressed the door bell) and more recently using <a title="TTYtter is a fully functional command-line Twitter client written using Perl." href="http://www.floodgap.com/software/ttytter/" target="_blank">TTYtter</a>. It worked well enough most of the time but the X10 (both the radio and mains components) was always the weak link in the chain.  I first had the idea of changing this over to an Arduino based system some time ago when I bought a Duemilanove clone and ethernet shield but it seemed like a lot of money to have tied up in a doorbell, that all changed with the <a title="Nanode - The Network Application Node" href="http://nathan.chantrell.net/20110821/nanode-the-network-application-node/">Nanode</a> of course, £22 seems like a much more reasonable figure.</p><p>So here is the first Nanode version working, it&#8217;s very simple, just a few small changes to the ethershield Twitter demo code that sends a tweet using <a title="Supertweet.net Twitter API Proxy" href="http://www.supertweet.net/" target="_blank">Supertweet.net&#8217;s API proxy</a> when a pin is grounded. I have set it up to send a message via another Twitter account which I have told Twitter to send me a text message for, the tweet from the Nanode includes a link to the web feed for my front door camera so I am just one link away from seeing who is there. Twitter won&#8217;t send two identical messages in succession so I&#8217;ve added a changing number to the URL for the camera so that each message is always different from the last, it&#8217;s a bit hacky at the moment but it works. I&#8217;m now thinking of other things I can connect to in the vicinity of the front door, a snail mail alert is an obvious next step.</p><p>The picture above shows the message coming into the Twitter client with the web interface in the background. There are another couple of pictures below, one showing the text message coming in and one showing the result of clicking on the link (yes my path needs weeding but where&#8217;s the fun in that?).</p><p>I need another Nanode now.</p><p><a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/08/doorbell_txt2.jpg"><img class="alignnone size-thumbnail wp-image-2059" title="Twitter Door Bell Text Message" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/08/doorbell_txt2-150x150.jpg" alt="" width="150" height="150" /></a> <a href="http://cdn.chantrell.net/blog/wp-content/uploads/2011/08/doorbell_cam.jpg"><img class="alignnone size-thumbnail wp-image-2060" title="Twitter door bell camera" src="http://cdn.chantrell.net/blog/wp-content/uploads/2011/08/doorbell_cam-150x150.jpg" alt="" width="150" height="150" /></a></p></div><p><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20110826%2Fnanode-powered-twitter-door-bell%2F&amp;linkname=Nanode%20powered%20Twitter%20door%20bell" title="Twitter" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20110826%2Fnanode-powered-twitter-door-bell%2F&amp;linkname=Nanode%20powered%20Twitter%20door%20bell" title="Facebook" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20110826%2Fnanode-powered-twitter-door-bell%2F&amp;linkname=Nanode%20powered%20Twitter%20door%20bell" title="Reddit" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20110826%2Fnanode-powered-twitter-door-bell%2F&amp;linkname=Nanode%20powered%20Twitter%20door%20bell" title="Digg" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20110826%2Fnanode-powered-twitter-door-bell%2F&amp;linkname=Nanode%20powered%20Twitter%20door%20bell" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fnathan.chantrell.net%2F20110826%2Fnanode-powered-twitter-door-bell%2F&amp;linkname=Nanode%20powered%20Twitter%20door%20bell" title="Delicious" rel="nofollow" target="_blank"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnathan.chantrell.net%2F20110826%2Fnanode-powered-twitter-door-bell%2F&amp;title=Nanode%20powered%20Twitter%20door%20bell" id="wpa2a_20"><img src="http://nathan.chantrell.net/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://nathan.chantrell.net/20110826/nanode-powered-twitter-door-bell/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 3/52 queries in 0.019 seconds using disk: basic
Object Caching 1051/1158 objects using disk: basic
Content Delivery Network via Amazon Web Services: S3: cdn.chantrell.net

Served from: nathan.chantrell.net @ 2012-02-05 06:22:00 -->
