<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: How to build a web connected gas meter with your Arduino</title>
	<atom:link href="http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/</link>
	<description>C#, Cloud Computing and Tech-miscellany</description>
	<lastBuildDate>Tue, 17 Jan 2012 22:20:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: John</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-733</link>
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 17 Jan 2012 22:20:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-733</guid>
		<description><![CDATA[Hello Richard,
I am new to Arduino and would like to make a similar project as yours on gas metering. I work with IDE 1.0 (last one) and modified a bit your sketch . It compile ok but do not know if it is correct. Could you let me know if it sounds rigth ?
That would be super .
Thanks


#include 
#include 
#include 

#include 
#include 
#include 


// --- [ Pin setup ] ---
int sensorPin = 5;
int ledPin = 9;
int fanPin = 7;
int tempPin = 3;
int unlockPin = 8;

// --- [ Ethernet setup ] ---
static uint8_t mac[6] = { 0x02, 0xAA, 0xAA, 0xCC, 0x00, 0x22 };
static uint8_t ip[4] = { 192,168,123,99};
static uint8_t gateway[4] = { 192,168,123,254};
int serverPort = 80;

String url = String(25);
int maxLength=25;

// --- [ Variables to control when the unit fan kicks in/cuts out... ] ---
float maxTemp = 26.0;
float minTemp = 24.0;

// --- [ Variables to store our sensor values ] ---
volatile int totalTicks = 0;
float tempc = 0.0;
int maxi = -100, mini = 100;

// --- [ Misc. vars ] ---
float inputVolts = 5.01;
int previousState = -2;
int delayMs = 1500;
int i;
boolean lock;

EthernetServer server(serverPort);

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(fanPin, OUTPUT);
  pinMode(sensorPin, INPUT);
  pinMode(unlockPin, INPUT);
  previousState = digitalRead(sensorPin);
  Serial.begin(115200);                                   // Use serial for debugging locally...
  Serial.println(&quot;Ardugas server saying: Howdy!&quot;);
  Ethernet.begin(mac, ip, gateway);
  server.begin();
}

void loop() {
  checkUnitTemp();                                      // Take action based on unit temp
  checkSensor();                                        // Check the gas meter sensor

  listenWeb();                                          // Handle any web connections
  digitalWrite(ledPin, !digitalRead(sensorPin));        // Light LED if sensor is LOW
}

// Serve pachube EEML and accept a querystring param to set the current value
void listenWeb() {   

 boolean read_url = true;
 boolean unlock = false;

 EthernetClient client = server.available();
  if (client) {

    Serial.println(&quot;Ethernet client connected...&quot;);

    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    int valuesChanged = 0;
    while (client.connected()) {

      if (client.available()) {

        char c = client.read();
          if (url.length()  0) &amp;&amp; unlock) {
            Serial.println(url);
            String v = String(10);
            int startIndex = url.indexOf(&#039;=&#039;) + 1;
            int stopIndex = url.indexOf(&#039;H&#039;);
            v = url.substring(startIndex, stopIndex);
            Serial.println(v);
            char buf[100];
            v.toCharArray(buf, 100);
            totalTicks = atoi(buf);
          } 

          int t = tempc;

          // EEML
          client.println(&quot;&quot;);
          client.println(&quot;&quot;);

          client.println(&quot;&quot;);
          client.println(&quot;Ardugas Server&quot;);
          client.println(&quot;&quot;);

          // Gas Meter Reading
          client.println(&quot;&quot;);
          client.println(&quot;gascubic metres&quot;);
          client.print(&quot;&quot;);
          client.print(totalTicks);
          client.println(&quot;&quot;);
          client.println(&quot;&quot;);

          client.println(&quot;&quot;);
          client.println(&quot;temperaturedegreescelsius&quot;);
          client.print(&quot;&quot;);
          client.print(t);
          client.print(&quot;&quot;);
          client.println(&quot;&quot;);         

          client.println(&quot;&quot;);
          client.println(&quot;&quot;);

          client.println(); 

          break;

        }

        if (c == &#039;\n&#039;) {
          // we&#039;re starting a new line
          current_line_is_blank = true;
        } else if (c != &#039;\r&#039;) {
          // we&#039;ve gotten a character on the current line
          current_line_is_blank = false;
        }

      }
    }
    // give the web browser time to receive the data
    url = &quot;&quot;;
    delay(5);
    client.stop();
  } 

}

// Switch the cooling fan on if it&#039;s too hot!
void checkUnitTemp() {
 if (tempc &gt;= maxTemp) {
   digitalWrite(fanPin, HIGH);
 }
  if (tempc &gt; maxi) {maxi = tempc;} // record max temperature
  if(tempc &lt; mini) {mini = tempc;} // record min temperature
}

// Count sensor values
void checkSensor() {
  int currentState = digitalRead(sensorPin);
  if (currentState == LOW &amp;&amp; previousState == HIGH) {
    if (!lock) {
      lock = true;
      delay(delayMs);
      totalTicks++;
    }
  }
  if (currentState == HIGH &amp;&amp; previousState == LOW) {
    lock = false;
  }
  previousState = currentState;
}]]></description>
		<content:encoded><![CDATA[<p>Hello Richard,<br />
I am new to Arduino and would like to make a similar project as yours on gas metering. I work with IDE 1.0 (last one) and modified a bit your sketch . It compile ok but do not know if it is correct. Could you let me know if it sounds rigth ?<br />
That would be super .<br />
Thanks</p>
<p>#include<br />
#include<br />
#include </p>
<p>#include<br />
#include<br />
#include </p>
<p>// &#8212; [ Pin setup ] &#8212;<br />
int sensorPin = 5;<br />
int ledPin = 9;<br />
int fanPin = 7;<br />
int tempPin = 3;<br />
int unlockPin = 8;</p>
<p>// &#8212; [ Ethernet setup ] &#8212;<br />
static uint8_t mac[6] = { 0&#215;02, 0xAA, 0xAA, 0xCC, 0&#215;00, 0&#215;22 };<br />
static uint8_t ip[4] = { 192,168,123,99};<br />
static uint8_t gateway[4] = { 192,168,123,254};<br />
int serverPort = 80;</p>
<p>String url = String(25);<br />
int maxLength=25;</p>
<p>// &#8212; [ Variables to control when the unit fan kicks in/cuts out... ] &#8212;<br />
float maxTemp = 26.0;<br />
float minTemp = 24.0;</p>
<p>// &#8212; [ Variables to store our sensor values ] &#8212;<br />
volatile int totalTicks = 0;<br />
float tempc = 0.0;<br />
int maxi = -100, mini = 100;</p>
<p>// &#8212; [ Misc. vars ] &#8212;<br />
float inputVolts = 5.01;<br />
int previousState = -2;<br />
int delayMs = 1500;<br />
int i;<br />
boolean lock;</p>
<p>EthernetServer server(serverPort);</p>
<p>void setup() {<br />
  pinMode(ledPin, OUTPUT);<br />
  pinMode(fanPin, OUTPUT);<br />
  pinMode(sensorPin, INPUT);<br />
  pinMode(unlockPin, INPUT);<br />
  previousState = digitalRead(sensorPin);<br />
  Serial.begin(115200);                                   // Use serial for debugging locally&#8230;<br />
  Serial.println(&#8220;Ardugas server saying: Howdy!&#8221;);<br />
  Ethernet.begin(mac, ip, gateway);<br />
  server.begin();<br />
}</p>
<p>void loop() {<br />
  checkUnitTemp();                                      // Take action based on unit temp<br />
  checkSensor();                                        // Check the gas meter sensor</p>
<p>  listenWeb();                                          // Handle any web connections<br />
  digitalWrite(ledPin, !digitalRead(sensorPin));        // Light LED if sensor is LOW<br />
}</p>
<p>// Serve pachube EEML and accept a querystring param to set the current value<br />
void listenWeb() {   </p>
<p> boolean read_url = true;<br />
 boolean unlock = false;</p>
<p> EthernetClient client = server.available();<br />
  if (client) {</p>
<p>    Serial.println(&#8220;Ethernet client connected&#8230;&#8221;);</p>
<p>    // an http request ends with a blank line<br />
    boolean current_line_is_blank = true;<br />
    int valuesChanged = 0;<br />
    while (client.connected()) {</p>
<p>      if (client.available()) {</p>
<p>        char c = client.read();<br />
          if (url.length()  0) &amp;&amp; unlock) {<br />
            Serial.println(url);<br />
            String v = String(10);<br />
            int startIndex = url.indexOf(&#8216;=&#8217;) + 1;<br />
            int stopIndex = url.indexOf(&#8216;H&#8217;);<br />
            v = url.substring(startIndex, stopIndex);<br />
            Serial.println(v);<br />
            char buf[100];<br />
            v.toCharArray(buf, 100);<br />
            totalTicks = atoi(buf);<br />
          } </p>
<p>          int t = tempc;</p>
<p>          // EEML<br />
          client.println(&#8220;&#8221;);<br />
          client.println(&#8220;&#8221;);</p>
<p>          client.println(&#8220;&#8221;);<br />
          client.println(&#8220;Ardugas Server&#8221;);<br />
          client.println(&#8220;&#8221;);</p>
<p>          // Gas Meter Reading<br />
          client.println(&#8220;&#8221;);<br />
          client.println(&#8220;gascubic metres&#8221;);<br />
          client.print(&#8220;&#8221;);<br />
          client.print(totalTicks);<br />
          client.println(&#8220;&#8221;);<br />
          client.println(&#8220;&#8221;);</p>
<p>          client.println(&#8220;&#8221;);<br />
          client.println(&#8220;temperaturedegreescelsius&#8221;);<br />
          client.print(&#8220;&#8221;);<br />
          client.print(t);<br />
          client.print(&#8220;&#8221;);<br />
          client.println(&#8220;&#8221;);         </p>
<p>          client.println(&#8220;&#8221;);<br />
          client.println(&#8220;&#8221;);</p>
<p>          client.println(); </p>
<p>          break;</p>
<p>        }</p>
<p>        if (c == &#8216;\n&#8217;) {<br />
          // we&#8217;re starting a new line<br />
          current_line_is_blank = true;<br />
        } else if (c != &#8216;\r&#8217;) {<br />
          // we&#8217;ve gotten a character on the current line<br />
          current_line_is_blank = false;<br />
        }</p>
<p>      }<br />
    }<br />
    // give the web browser time to receive the data<br />
    url = &#8220;&#8221;;<br />
    delay(5);<br />
    client.stop();<br />
  } </p>
<p>}</p>
<p>// Switch the cooling fan on if it&#8217;s too hot!<br />
void checkUnitTemp() {<br />
 if (tempc &gt;= maxTemp) {<br />
   digitalWrite(fanPin, HIGH);<br />
 }<br />
  if (tempc &gt; maxi) {maxi = tempc;} // record max temperature<br />
  if(tempc &lt; mini) {mini = tempc;} // record min temperature<br />
}</p>
<p>// Count sensor values<br />
void checkSensor() {<br />
  int currentState = digitalRead(sensorPin);<br />
  if (currentState == LOW &amp;&amp; previousState == HIGH) {<br />
    if (!lock) {<br />
      lock = true;<br />
      delay(delayMs);<br />
      totalTicks++;<br />
    }<br />
  }<br />
  if (currentState == HIGH &amp;&amp; previousState == LOW) {<br />
    lock = false;<br />
  }<br />
  previousState = currentState;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-726</link>
		<dc:creator><![CDATA[Richard]]></dc:creator>
		<pubDate>Fri, 13 Jan 2012 09:00:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-726</guid>
		<description><![CDATA[Hi John,
This article is quite old now; but yes the project did work and it still does today. This version here was written using the Arduino IDE available from arduino.cc, however recently I&#039;ve upgrade this to use Netduino and the Visual Studio 2010 IDE (don&#039;t forget there is also a free version of Visual Studio you can use).
Good luck with your project!
Richard.]]></description>
		<content:encoded><![CDATA[<p>Hi John,<br />
This article is quite old now; but yes the project did work and it still does today. This version here was written using the Arduino IDE available from arduino.cc, however recently I&#8217;ve upgrade this to use Netduino and the Visual Studio 2010 IDE (don&#8217;t forget there is also a free version of Visual Studio you can use).<br />
Good luck with your project!<br />
Richard.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-725</link>
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Fri, 13 Jan 2012 05:45:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-725</guid>
		<description><![CDATA[Hello,
I found your project and am very interrested to do something similar.
What is the status ? Was it working and if yes , on which IDE was it made ?
Thanks a lot
Regards]]></description>
		<content:encoded><![CDATA[<p>Hello,<br />
I found your project and am very interrested to do something similar.<br />
What is the status ? Was it working and if yes , on which IDE was it made ?<br />
Thanks a lot<br />
Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 2010 in review &#124; Richard Parker&#039;s blog</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-592</link>
		<dc:creator><![CDATA[2010 in review &#124; Richard Parker&#039;s blog]]></dc:creator>
		<pubDate>Sun, 02 Jan 2011 09:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-592</guid>
		<description><![CDATA[[...] The busiest day of the year was November 30th with 123 views. The most popular post that day was How to build a web connected gas meter with your Arduino. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] The busiest day of the year was November 30th with 123 views. The most popular post that day was How to build a web connected gas meter with your Arduino. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-585</link>
		<dc:creator><![CDATA[Richard]]></dc:creator>
		<pubDate>Fri, 17 Dec 2010 08:14:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-585</guid>
		<description><![CDATA[Hi Malcom, thanks for stopping by and for taking the time to leave a comment. The tip about the magnet is golden - I wish I had known that when I started the project! I&#039;ve ordered a reed switch to test with as I don&#039;t have a compass, so I&#039;ll check it out ASAP. Merry Christmas! :)]]></description>
		<content:encoded><![CDATA[<p>Hi Malcom, thanks for stopping by and for taking the time to leave a comment. The tip about the magnet is golden &#8211; I wish I had known that when I started the project! I&#8217;ve ordered a reed switch to test with as I don&#8217;t have a compass, so I&#8217;ll check it out ASAP. Merry Christmas! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Malcolm</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-584</link>
		<dc:creator><![CDATA[Malcolm]]></dc:creator>
		<pubDate>Thu, 16 Dec 2010 18:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-584</guid>
		<description><![CDATA[Hi Richard , Thanks for the gas meter reader info.
Just for your info most gas meters that have a silver spot, also have a magnet going round with the index. I use a micro reed switch RS 530-8933 &amp; blue tac in to a one-wire DS 2423.
To check for a magnet, place a compass near the reading when your using gas.   Seasons regards MT.]]></description>
		<content:encoded><![CDATA[<p>Hi Richard , Thanks for the gas meter reader info.<br />
Just for your info most gas meters that have a silver spot, also have a magnet going round with the index. I use a micro reed switch RS 530-8933 &amp; blue tac in to a one-wire DS 2423.<br />
To check for a magnet, place a compass near the reading when your using gas.   Seasons regards MT.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-547</link>
		<dc:creator><![CDATA[Richard]]></dc:creator>
		<pubDate>Sun, 05 Dec 2010 09:18:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-547</guid>
		<description><![CDATA[Hi Paul, thanks for the comment! Would recommend the Arduino, for sure, but if you&#039;re a .NET developer, take a look at the new Netduino! They&#039;re pretty awesome too. Thanks for stopping by!]]></description>
		<content:encoded><![CDATA[<p>Hi Paul, thanks for the comment! Would recommend the Arduino, for sure, but if you&#8217;re a .NET developer, take a look at the new Netduino! They&#8217;re pretty awesome too. Thanks for stopping by!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Baker</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-541</link>
		<dc:creator><![CDATA[Paul Baker]]></dc:creator>
		<pubDate>Sat, 04 Dec 2010 00:06:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-541</guid>
		<description><![CDATA[Great write up.  Just the sort of inspiration I need to order an Arduino for my Christmas present. :)]]></description>
		<content:encoded><![CDATA[<p>Great write up.  Just the sort of inspiration I need to order an Arduino for my Christmas present. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-537</link>
		<dc:creator><![CDATA[Richard]]></dc:creator>
		<pubDate>Thu, 02 Dec 2010 14:36:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-537</guid>
		<description><![CDATA[£4000 for a Gas Meter with pulse output? http://www.gasproducts.co.uk/acatalog/G4_Gas_Meter_with_Pulse.html - £85.61 including VAT. It is legal for use, providing installed by either your gas transporter/registered installer (if you have permission to change the meter). I really don&#039;t think I know enough about what it is you need to achieve, or how you plan to go about it, but providing it&#039;s safe I&#039;d be more than happy to have a look at the design you come up with. Good luck and thanks for reading!]]></description>
		<content:encoded><![CDATA[<p>£4000 for a Gas Meter with pulse output? <a href="http://www.gasproducts.co.uk/acatalog/G4_Gas_Meter_with_Pulse.html" rel="nofollow">http://www.gasproducts.co.uk/acatalog/G4_Gas_Meter_with_Pulse.html</a> &#8211; £85.61 including VAT. It is legal for use, providing installed by either your gas transporter/registered installer (if you have permission to change the meter). I really don&#8217;t think I know enough about what it is you need to achieve, or how you plan to go about it, but providing it&#8217;s safe I&#8217;d be more than happy to have a look at the design you come up with. Good luck and thanks for reading!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: graham</title>
		<link>http://blog.richard.parker.name/2009/04/25/how-to-build-a-web-connected-gas-meter-with-your-arduino/#comment-536</link>
		<dc:creator><![CDATA[graham]]></dc:creator>
		<pubDate>Thu, 02 Dec 2010 14:29:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.richard.parker.name/?p=204#comment-536</guid>
		<description><![CDATA[i know what your saying take this for example the meter that i have been asked to price is nearly £4000 and i can build one that is reading direct to the computer and i will keep you in the loop see what you think when i come up with a design]]></description>
		<content:encoded><![CDATA[<p>i know what your saying take this for example the meter that i have been asked to price is nearly £4000 and i can build one that is reading direct to the computer and i will keep you in the loop see what you think when i come up with a design</p>
]]></content:encoded>
	</item>
</channel>
</rss>

