<?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>John&#039;s Ramblings &#187; currentcost</title>
	<atom:link href="http://john.crouchley.com/blog/archives/tag/currentcost/feed" rel="self" type="application/rss+xml" />
	<link>http://john.crouchley.com/blog</link>
	<description>Personal record for family and friends - contact me: john at crouchley.me.uk</description>
	<lastBuildDate>Tue, 24 Aug 2010 12:56:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>A TinyXML library for the Arduino</title>
		<link>http://john.crouchley.com/blog/archives/454</link>
		<comments>http://john.crouchley.com/blog/archives/454#comments</comments>
		<pubDate>Mon, 11 Jan 2010 19:14:37 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Home monitoring]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://john.crouchley.com/blog/?p=454</guid>
		<description><![CDATA[<p>A lot of devices use XML these days &#8211; and parsing the XML by hand is quite complex. I use a CurrentCost CC128 power monitor and also Twitter. Both of these have an XML interface.</p>
<p>Over the last couple of months I have been developing a simple XML parser as an Arduino library &#8211; it is [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of devices use XML these days &#8211; and parsing the XML by hand is quite complex. I use a CurrentCost CC128 power monitor and also Twitter. Both of these have an XML interface.</p>
<p>Over the last couple of months I have been developing a simple XML parser as an Arduino library &#8211; it is table driven and so compact and easily modified. This is now ready for release &#8211; you can download it <a href="http://john.crouchley.com/files/TinyXML.zip">here</a>. The CC-128 example compiles at less than 9kB.</p>
<p>I have included a Twitter API example and also a CurrentCost CC-128 example.</p>
<p>The CC-128 example is being used to provide a data concentrator for CC-128. I am using an Arduino (Mini Pro 328) to take the cpu burden off the main Arduino,  processing serial data at 57600 baud takes up most of the power of an Arduino.</p>
<p>Connect the Mini Pro to the CC-128 using GND and CC-128 Tx to Mini Pro pin digital 1. The Mini Pro acts as an I2C slave for the main Arduino (simple connection &#8211; just link up GND, A4 and A5 &#8211; also 5V if you don&#8217;t have a separate power supply).</p>
<p>I have three current cost devices feeding the CC-128 &#8211; Electricity, Gas and a light sensor. It should be quite easy to modify the example for your configuration.</p>
<p>Master code to read from the CC128 I2C slave is roughly as follows<br />
<code><br />
  CC128Data cc128data;   // structure definition is held in the .h file</p>
<p>  Wire.beginTransmission(I2CADDR);<br />
  Wire.send(COMMAND);<br />
  Wire.send(SNAPSHOT | READALL);<br />
  Wire.endTransmission();<br />
  delay(5);      // give the I2C transmission and the slave time to deal with request<br />
                 // 2mS does not work - 3 does - give it 5 to be safe<br />
  Wire.requestFrom(I2CADDR, sizeof(CC128Data));    // request data structure bytes from slave device<br />
  byte* b = (byte*)&#038;cc128data;<br />
  for (int i = 0; i&lt;sizeof (CC128Data); i++)<br />
  {<br />
    *b++ = Wire.receive(); // receive a byte as character<br />
  }<br />
</code><br />
I will be writing up another post about the CC-128 data concentrator and the main Arduino, describing how to set up multiple I2C slaves all linked to a central Arduino CPU.</p>
]]></content:encoded>
			<wfw:commentRss>http://john.crouchley.com/blog/archives/454/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino code for Currentcost/XPORT/Pachube</title>
		<link>http://john.crouchley.com/blog/archives/404</link>
		<comments>http://john.crouchley.com/blog/archives/404#comments</comments>
		<pubDate>Tue, 21 Jul 2009 17:28:44 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Home monitoring]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[ethernet]]></category>
		<category><![CDATA[HomeMonitoring]]></category>

		<guid isPermaLink="false">http://john.crouchley.com/blog/?p=404</guid>
		<description><![CDATA[<p>The code I have been developing for my Current Cost meter updating to Pachube via Arduino with XPORT is ready for sharing.
You can download the code from this link.
Current cost sensors are
0) Main electricity sensor &#8211; clamp on incoming live cable
1) Gas pulse sensor &#8211; see entry below
2) light sensor &#8211; photo resistor (about 2M [...]]]></description>
			<content:encoded><![CDATA[<p>The code I have been developing for my <a href="http://www.currentcost.co.uk/" target="_blank">Current Cost</a> meter updating to <a href="http://www.pachube.com" target="_blank">Pachube</a> via <a href="http://www.arduino.cc" target="_blank">Arduino</a> with <a href="http://www.lantronix.com/device-networking/embedded-device-servers/xport.html">XPORT</a> is ready for sharing.<br />
You can download the code from <a href="http://john.crouchley.com/files/CC_XPort_Pachube_v1_4.zip">this link</a>.<br />
Current cost sensors are<br />
0) Main electricity sensor &#8211; clamp on incoming live cable<br />
1) Gas pulse sensor &#8211; see <a href="http://john.crouchley.com/blog/archives/345" target="_blank">entry below</a><br />
2) light sensor &#8211; photo resistor (about 2M ohms dark to 100 ohms bright light) as sensor across the channel inputs on the <a href="http://www.ceesquared.com/?p=11" target="_blank">Current Cost dev board</a>.<br />
Current Cost sensors are read by <a href="http://arduino.cc/en/Main/ArduinoBoardDuemilanove" target="_blank">Arduino</a>, displayed on 4&#215;20 lcd module and uploaded to <a href="http://www.pachube.com/feeds/2189" target="_blank">Pachube</a> via <a href="http://www.adafruit.com/index.php?main_page=product_info&#038;cPath=17_21&#038;products_id=83" target="_blank">Adafruit XPort</a> shield every 15 minutes.</p>
]]></content:encoded>
			<wfw:commentRss>http://john.crouchley.com/blog/archives/404/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Gas meter to CurrentCost to Arduino to Pachube up and running</title>
		<link>http://john.crouchley.com/blog/archives/345</link>
		<comments>http://john.crouchley.com/blog/archives/345#comments</comments>
		<pubDate>Sun, 12 Jul 2009 18:35:13 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Home monitoring]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[Gas]]></category>
		<category><![CDATA[HomeMonitoring]]></category>

		<guid isPermaLink="false">http://john.crouchley.com/blog/?p=345</guid>
		<description><![CDATA[<p>Built to circuit and connected it all up. Bluetacked reed switch to meter and board + cc dev board + 2 AA batteries into small container.



CurrentCost meter connect to Pachube via Arduino. In order to try and get some idea of energy usage and comparison with the electricity usage I am logging KW. The calculations [...]]]></description>
			<content:encoded><![CDATA[<p>Built to circuit and connected it all up. Bluetacked reed switch to meter and board + cc dev board + 2 AA batteries into small container.<br />
<a href="http://www.flickr.com/photos/22788868@N02/3713069233/" class="tt-flickr tt-flickr-Medium" target="_blank"><img class="alignnone" src="http://farm4.static.flickr.com/3526/3713069233_7ec60d1dd0.jpg" alt="CurrentCost dev board with gas meter circuit" width="500" height="226" /></a><br />
<a href="http://www.flickr.com/photos/22788868@N02/3713128495/" class="tt-flickr tt-flickr-Medium" target="_blank"><img class="alignnone" src="http://farm3.static.flickr.com/2669/3713128495_956b000969.jpg" alt="P7122949" width="321" height="500" /></a><br />
<a href="http://www.flickr.com/photos/22788868@N02/3713129005/" class="tt-flickr tt-flickr-Medium" target="_blank"><img class="alignnone" src="http://farm3.static.flickr.com/2461/3713129005_1743fc5a8f.jpg" alt="P7122950" width="500" height="444" /></a><br />
CurrentCost meter connect to <a href="http://www.pachube.com/feeds/2189" target="_blank">Pachube</a> via <a href="http://www.ardunio.cc" target="_blank">Arduino</a>. In order to try and get some idea of energy usage and comparison with the electricity usage I am logging KW. The calculations are:<br />
<a href="http://www.ukenergy.co.uk/pages/gas-kwh.html" target="_blank">Gas KWhours</a> = cubicmeters * correctionfactor * calorificvalue / 3.6<br />
1 pulse is 0.01 cubic meters<br />
correctionfactor is 1.022646 (from gas bill)<br />
calorificvalue is 39.4 (from gas bill)<br />
So 1 pulse is 0.1119223 KWh.<br />
Average KW = totalKWh * 3600 / measurementperiod(seconds)<br />
I have set the measurement period to 5 minutes &#8211; this gives a reasonable resolution. At peak use I seem to get about 1 pulse every 18 seconds. Latest &#8211; I now update every 15 minutes &#8211; that way Pachube displays every update.</p>
<p><img src="http://www.pachube.com/feeds/2189/datastreams/3/history.png?w=600&#038;h=300&#038;c=33cc66&#038;b=true&#038;g=true&#038;t=Home&#038;l=Gas KW&#038;s=6" alt="Last 24 hours Gas KWatts" /></p>
]]></content:encoded>
			<wfw:commentRss>http://john.crouchley.com/blog/archives/345/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Why the diode in the circuit?</title>
		<link>http://john.crouchley.com/blog/archives/336</link>
		<comments>http://john.crouchley.com/blog/archives/336#comments</comments>
		<pubDate>Sat, 11 Jul 2009 19:45:44 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Home monitoring]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Gas]]></category>
		<category><![CDATA[HomeMonitoring]]></category>

		<guid isPermaLink="false">http://john.crouchley.com/blog/?p=336</guid>
		<description><![CDATA[<p>When the switch opens the falling edge will cause a negative pulse on the 4013 input. The diode removes that negative pulse.</p>
<p>Input to 4013 without diode &#8211; one pulse (on/off) &#8211; zero volts is the centre line. The signal goes negative to minus 1.44 volts. Positive pulse comes from direct connection to +3 volts, negative [...]]]></description>
			<content:encoded><![CDATA[<p>When the switch opens the falling edge will cause a negative pulse on the 4013 input. The diode removes that negative pulse.</p>
<p>Input to 4013 without diode &#8211; one pulse (on/off) &#8211; zero volts is the centre line. The signal goes negative to minus 1.44 volts. Positive pulse comes from direct connection to +3 volts, negative pulse is smaller because capacitor has to discharge through 1M resistor.<br />
<a href="http://www.flickr.com/photos/22788868@N02/3710077167/" class="tt-flickr tt-flickr-Medium" target="_blank"><img class="alignnone" src="http://farm3.static.flickr.com/2476/3710077167_48d99cf45e.jpg" alt="P7112944" width="500" height="266" /></a> </p>
<p>Input to 4013 with the diode &#8211; the negative signal is almost totally removed. The signal goes negative to minus 0.35 volts.<br />
<a href="http://www.flickr.com/photos/22788868@N02/3710077825/" class="tt-flickr tt-flickr-Medium" target="_blank"><img class="alignnone" src="http://farm4.static.flickr.com/3466/3710077825_7410b9ef26.jpg" alt="P7112945" width="500" height="283" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://john.crouchley.com/blog/archives/336/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Final gas meter to current cost circuit</title>
		<link>http://john.crouchley.com/blog/archives/322</link>
		<comments>http://john.crouchley.com/blog/archives/322#comments</comments>
		<pubDate>Fri, 10 Jul 2009 13:26:31 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Home monitoring]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Gas]]></category>
		<category><![CDATA[HomeMonitoring]]></category>

		<guid isPermaLink="false">http://john.crouchley.com/blog/?p=322</guid>
		<description><![CDATA[<p>Here is the final circuit I will use, the resistor and capacitor values give a time constant of about 0.5 sec &#8211; I&#8217;m sure many other values would work but I have these ones in my box.
I have added a pull down resistor on the reset line just to make sure it is low unless [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the final circuit I will use, the resistor and capacitor values give a time constant of about 0.5 sec &#8211; I&#8217;m sure many other values would work but I have these ones in my box.<br />
I have added a pull down resistor on the reset line just to make sure it is low unless deliberately raised high. I will build this over the weekend.<br />
<a href="http://www.flickr.com/photos/22788868@N02/3706400689/" class="tt-flickr tt-flickr-Medium" target="_blank"><img class="alignnone" src="http://farm4.static.flickr.com/3514/3706400689_3d7e93a64e.jpg" alt="ccgas" width="500" height="322" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://john.crouchley.com/blog/archives/322/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Energy tracking part 2a</title>
		<link>http://john.crouchley.com/blog/archives/314</link>
		<comments>http://john.crouchley.com/blog/archives/314#comments</comments>
		<pubDate>Thu, 09 Jul 2009 09:13:31 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Home monitoring]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[Gas]]></category>
		<category><![CDATA[HomeMonitoring]]></category>

		<guid isPermaLink="false">http://john.crouchley.com/blog/?p=314</guid>
		<description><![CDATA[<p>This is the CurrentCost development board. Note the 10 pin programming header &#8211; the leftmost pins are at 0V the rightmost at the positive supply voltage. I have attached a wire to the anode of the led.
   </p>
<p>This is my gas meter &#8211; there is a cut out at the bottom right of [...]]]></description>
			<content:encoded><![CDATA[<p>This is the CurrentCost development board. Note the 10 pin programming header &#8211; the leftmost pins are at 0V the rightmost at the positive supply voltage. I have attached a wire to the anode of the led.<br />
<a href="http://www.flickr.com/photos/22788868@N02/3703963504/" class="tt-flickr tt-flickr-Small" target="_blank"><img class="alignnone" src="http://farm4.static.flickr.com/3437/3703963504_4af8990621_m.jpg" alt="Currentcost dev board" width="240" height="179" /></a>  <a href="http://www.flickr.com/photos/22788868@N02/3703155683/" class="tt-flickr tt-flickr-Small" target="_blank"><img class="alignnone" src="http://farm3.static.flickr.com/2524/3703155683_16a0557f18_m.jpg" alt="Currentcost dev board" width="240" height="195" /></a> </p>
<p>This is my gas meter &#8211; there is a cut out at the bottom right of the display that can accept a reed switch.<br />
<a href="http://www.flickr.com/photos/22788868@N02/3703156373/" class="tt-flickr tt-flickr-Medium" target="_blank"><img class="alignnone" src="http://farm3.static.flickr.com/2447/3703156373_3e581f701d.jpg" alt="gas meter detail" width="500" height="339" /></a><br />
<a href="http://www.flickr.com/photos/22788868@N02/3703976198/" class="tt-flickr tt-flickr-Medium" target="_blank"><img class="alignnone" src="http://farm4.static.flickr.com/3427/3703976198_9c8c7e077a.jpg" alt="Gas meter" width="401" height="500" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://john.crouchley.com/blog/archives/314/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Energy tracking part 2</title>
		<link>http://john.crouchley.com/blog/archives/307</link>
		<comments>http://john.crouchley.com/blog/archives/307#comments</comments>
		<pubDate>Wed, 08 Jul 2009 19:53:57 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Home monitoring]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Gas]]></category>
		<category><![CDATA[HomeMonitoring]]></category>

		<guid isPermaLink="false">http://john.crouchley.com/blog/?p=307</guid>
		<description><![CDATA[<p>@MartinDix from CurrentCost kindly sent me a dev board so I could interface other feeds to the CurrentCost meter. After some experimentation this is the circuit I intend to use. I have not yet fully finalised values of components but it seems to work pretty well on the breadboard. Note my dev board is version [...]]]></description>
			<content:encoded><![CDATA[<p>@MartinDix from <a href="http://www.currentcost.co.uk" target="_blank">CurrentCost</a> kindly sent me a <a href="http://www.ceesquared.com/?p=11" target="_blank">dev board</a> so I could interface other feeds to the <a href="http://jtlog.wordpress.com/2009/06/22/my-first-currentcost-development-board-circuit/" target="_blank">CurrentCost meter</a>. After some experimentation this is the circuit I intend to use. I have not yet fully finalised values of components but it seems to work pretty well on the breadboard. Note my dev board is version 1.1, the positive connection to ch1 is connected to positive power line.<br />
The idea of the circuit is that a rising edge (start of pulse) is latched until it has been transmitted to the meter.<br />
<a href="http://www.flickr.com/photos/22788868@N02/3701432275/" class="tt-flickr tt-flickr-Original" target="_blank"><img class="alignnone" src="http://farm3.static.flickr.com/2586/3701432275_dfe7de633c_o.jpg" alt="ccgas" width="616" height="420" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://john.crouchley.com/blog/archives/307/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
