navitron
 
Renewable Energy and Sustainability Forum
UK's most popular Renewable Energy Forum May 25, 2012, 09:01:10 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Anyone wishing to register as a new member on the forum is strongly recommended to use a "proper" email address - following recent spam/hack attempts on the forum, all security is set to "high", and "disposable" email addresses like Gmail, Yahoo and Hotmail tend to be viewed with suspicion, and the application rejected if there is any doubt whatsoever
 
Recent Articles: UPDATE ON DECC APPLICATION FOR LEAVE TO APPEAL TO THE SUPREME COURT | Yingli Green Energy's PV Module Ranks No.2 in TUV Rheinland Energy Yield Test | Navitron Solar Showers at Glastonbury for Year 5!
   Home   Help Search Login Register  
Pages: [1] 2 3 4   Go Down
  Print  
Author Topic: Gas/elec meter reading (Arduino)  (Read 10879 times)
myozone
Full Member
***
Offline Offline

Posts: 170


Gweek - Cornwall


« on: December 22, 2008, 01:48:55 PM »

Been using my Arduino (freeduino) to log gas/elec for months now
Logged
cornishben
Sr. Member
****
Offline Offline

Posts: 260


« Reply #1 on: December 22, 2008, 01:51:17 PM »

Been using my Arduino (freeduino) to log gas/elec for months now
any feedback?
Logged
stephend
Hero Member
*****
Offline Offline

Posts: 562



WWW
« Reply #2 on: December 22, 2008, 02:05:29 PM »

Been using my Arduino (freeduino) to log gas/elec for months now

What are you using as a current sensor?
Logged

KenB
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2691


Energy Self Enlightenment


WWW
« Reply #3 on: December 22, 2008, 02:22:39 PM »

Myozone, List

Quote
Been using my Arduino (freeduino) to log gas/elec for months now

Yes come to mention it, you did suggest the Arduino back in August.

Have you gone for optical sensing of the gas meter digit?   How about the electricity meter, has it a flashing Led or a spinning disc?

If you'd like to share some of your code, I'm sure a few of us would be interested.  What do you use for storing the logged data?  SD cards look attractive for mass storage, now that someone in the Arduino community has released driver code for the SD.

This example contains code for pulse counting using an opto-reflective sensor.  It produces a serial/USB output back to the PC as well as an ethernet connection.

http://community.pachube.com/?q=node/65



Ken
Logged
Paulh_Boats
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2768



« Reply #4 on: December 22, 2008, 02:45:51 PM »

List,

I love off-topic...lots of creative ideas but I took the liberty to move the meter reading detour to its own topic.


I've seen approved import/export meters for £30 with an optically decoupled pulse output (GoodEnergy insist on approved export meters).
Its easy to read the pulses...also water meters on fleabay for £10 have a pulse output so a generic meter reading program for gas/water/elec makes sense?

Lets allow for say 7 inputs, which is enough for gas, mains water, rain water, elec import, elec export and 2 spare.


Ideally beer consumed also, to place an automatic online order.  Wink

-Paul
« Last Edit: December 22, 2008, 02:48:41 PM by Paulh_Boats » Logged
KenB
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2691


Energy Self Enlightenment


WWW
« Reply #5 on: December 22, 2008, 03:20:44 PM »

Paul, List,

I found two electricity export meters (on approved list) with flashing LED and no-volts pulse contacts on ebay at about £15 each.

The newer gas meters sometimes have a reflective zero or 6 on the least significant digit. On the older types you might even be able to sense a change in reflectivity as the red pointer spins round.  This probably needs an analogue sensing input as you would be looking for a small change in reflectivity rather than one that would fully saturate a phototransistor.  - see the Pachube electricity meter example code.

Perhaps what's needed is a generic firmware sketch that allows for several pulse inputs and several analogue inputs and logs these to SD card and outputs totals as serial data.  Individuals could then tailor this generic logger to suit their application.  Perhaps a shield design with Dallas RTC, SD socket and some screw terminals or sockets to connect  sensors might be worthwhile.

As a historical note - Many years ago, my gas datalogger design had just 128K of static RAM, well before the days of cheap flash memory. 

I split this up into 256 byte blocks each representing a 24hr period. 

There were 10 readings per hour so 240 bytes was a whole days worth plus a spare 16 bytes for daily totals etc.

(The same byte-scheme could be done for electricity - so long as you scaled things such that your 6 minute accumulations didn't exceed 255 units either Wh or Ah)

I then allocated 32 of these daily blocks for each month - so you had enough storage for any month - plus at least a day's spare. 

The 128K could therefore hold 16 months of readings.  The main point being that it was easy to address and retrieve the data whether you wanted just a day's worth or a month's worth.

At that time (1998) it communicated back to a server over a 1200 baud telephone modem.  It could retrieve a month's gas consumption data with a 90 second phone call.



Ken


Logged
myozone
Full Member
***
Offline Offline

Posts: 170


Gweek - Cornwall


« Reply #6 on: December 22, 2008, 04:26:27 PM »

Really simple setup photo diode 'counts' flash’s of an LED on the electricty meter 1 per watt and an IR reflective sensor 'looks' at the shinny zero center on the gas meter 1 per 10 liters of gas (~112 watts), outputs to a lcd display and via the serial (USB) rate and cumulative usage.
Logged
Paulh_Boats
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2768



« Reply #7 on: December 22, 2008, 04:34:01 PM »

Ken,

We can adapt your older architecture this way:

Since the Arduino does not have an RTC it can only count its internal clock (one forum said 5 minutes/day accuracy) .

Instead of logging date/time we could just store data in minutes since startup. Recent weeks would be accurate, further back in time less accurate.

A client HTML program running on a PC could read the meter data and save it to a disk file using the accurate PC clock, as and when the user ran the program.

The PC program could offset the N minute drift by comparing Arduino time now and a previous reading weeks/months ago. We might even be able to sent the correction to the Arduino.

This removes the cost and complexity of the RTC and its user interface to set date/time.

As Einstein said, time is relative to the observer. Ta Da!

-Paul
Logged
myozone
Full Member
***
Offline Offline

Posts: 170


Gweek - Cornwall


« Reply #8 on: December 22, 2008, 04:39:29 PM »

Just taken a couple of pictures (not reading elec at the moment)




All very alpha as you can see ! Wink
Logged
wyleu
Guest
« Reply #9 on: December 22, 2008, 04:45:46 PM »


Instead of logging date/time we could just store data in minutes since startup. Recent weeks would be accurate, further back in time less accurate.


Bit too easy to end up with data that looses all context.
If you can communicate with some form of remote logger could you not download a datetime stamp as an ack and thus at least embed some element of actual time?
Logged
KenB
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2691


Energy Self Enlightenment


WWW
« Reply #10 on: December 22, 2008, 05:04:59 PM »

Paul, List,

I'm sure I read on the Arduino forum that someone had got the Arduino to set itself to PC time, every time it was re-connected to the PC USB port for programming.

Here: "Who Needs a Software RTC"

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1211215328 

I think also there's a way of connecting a 32.768KHz crystal to a couple of pins and have a usual 500mS interrupt driven  RTC running in firmware.


Paul's Suggestion:

Quote
A client HTML program running on a PC could read the meter data and save it to a disk file using the accurate PC clock, as and when the user ran the program.

This small application would connect with my router IP at regular intervals - say once per minute, and could effectively datalog the temperature data that my Arduno server is putting out.

i.e.  Connect to http://91.111.101.240  every minute

      Strip out the temperature or other data from the html page source  - i.e. the 16.47 from the source below

Quote
<center><p><h1>Arduino Internet Thermometer  </h1></p> <hr><br><form METHOD=get action="http://91.111.101.240/"><h2> Thermistor reads </h2> <h1><font color="#0000FF"> + 16.47 &#176C</font></h1><br> <input type=hidden name=cmd value=1><input type=submit value="Get Temperature"></form>

Then store this data against PC time or later graphing and display.

In effect a poorman's Pachube - or at least one half of it.  - Good Ideal Paul - How's your HTML Client writing skills??

How best to modify the simple server so that it can send an array (fixed) of data which contains pulse counts, analogue values etc.

Do we have to resort to the POST method, I seem to remember that the GET method was only suitable for 15 bytes or less? 

This is perhaps why Pachube have resorted to XML / EEML as their means of serving data.



Ken














Logged
Paulh_Boats
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2768



« Reply #11 on: December 22, 2008, 05:22:27 PM »

Do we have to resort to the POST method, I seem to remember that the GET method was only suitable for 15 bytes or less? 

This is perhaps why Pachube have resorted to XML / EEML as their means of serving data.

No, not sure, yes!

As per the "..serves its first temperature" topic XmlHTTPRequest() is a standard way for a client to quiz a server. Its a Javascript method supported by all browsers, only ~20 lines of code. Also known as AJAX. (Google is your friend Smiley)

XmlHTTPRequest() can load just the "<temp>16.6C</temp>" bit from the server, not the whole page.

The PIC servers respond to XmlHTTPRequest() ok but the limited nutronics demo server does not. Too much to explain here - Google for HTTP content - we want html content when looking at the web page, xml content when doing XmlHTTPRequest(). It might be worth buzzing nutronics to see how they might support XmlHTTPRequest.

If you compare the demo server and eeml server, you'll see they do html OR xml content but not both (I think).
« Last Edit: December 22, 2008, 05:29:35 PM by Paulh_Boats » Logged
stephend
Hero Member
*****
Offline Offline

Posts: 562



WWW
« Reply #12 on: December 22, 2008, 05:24:52 PM »

Wouldn't it be easier to read energy usage from a current sensor?  It also means that you can attach sensors to a number of different loads, and not just the mains supply.  
Not sure if this would output the right voltage for Arduino, but this looks like a cheap (8 squid) current sensor: http://www.theowl.com/product/Standard+sensor.htm


Logged

Paulh_Boats
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2768



« Reply #13 on: December 22, 2008, 05:33:41 PM »

Wouldn't it be easier to read energy usage from a current sensor?  It also means that you can attach sensors to a number of different loads, and not just the mains supply.  
Not sure if this would output the right voltage for Arduino, but this looks like a cheap (8 squid) current sensor: http://www.theowl.com/product/Standard+sensor.htm

Current sensors are not accurate enough for "metering" (see the small print  Smiley).

All meters should be calibrated and approved..... and its easier to count pulses that will also be spot-on.
Logged
myozone
Full Member
***
Offline Offline

Posts: 170


Gweek - Cornwall


« Reply #14 on: December 22, 2008, 05:41:34 PM »

Quote
Wouldn't it be easier to read energy usage from a current sensor?  It also means that you can attach sensors to a number of different loads

http://www.plugwise.nl/en/ Like these, you can also turn them on and off via zigbee/bluetooth ? - hmmm another Arduino project..
« Last Edit: December 22, 2008, 05:48:46 PM by myozone » Logged
Pages: [1] 2 3 4   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!