Trying to get Arduino to talk to an Electrisave energy consumption meter.

With an AC clamp, it is possible to measure the current traveling through a wire without physically touching it. Basically it is a simple transformer where the wire of interest acts as the primary coil and the AC clamp is the secondary coil. Most AC clamps are integrated into a multi-meter. It outputs 10mV per ampere and is intended to be connected to a multi-meter. All you do is multiply the voltage reading by 100 to get the current in the wire. This one is made by Steren, model MUL-285.
Here is a sample of the readings:
| 0 |
| 0 |
| 0 |
| 0 |
| 31 |
| 29 |
| 0 |
| 0 |
| 0 |
| 3 |
| 34 |
| 21 |
| 0 |
| 0 |
| 0 |
| 13 |
| 42 |
| 1 |
| 0 |
| 0 |
| 0 |
| 23 |
| 37 |
| 0 |
| 0 |
| 0 |
| 0 |
| 34 |
| 28 |
| 0 |
| 0 |
| 0 |
| 4 |
| 34 |
| 20 |
| 0 |
| 0 |
| 0 |
| 1 |
First question: Are these mv? Is it pumping out 10mv per ampere?
If so, all we need to do is times these by 100 to get the current.
But they are not consistent:
The readings come in groups of two or three positive integers surrounded by zeros. If we sum these groups of positive values we can see a pattern; the groups of integers which are preceded by four zeros are consistently higher than those preceded by only three zeros.
Okay, here is the code to convert the raw data into approximate MW consumption, and then post it to my Sinatra app hosted by heroku.com:
http://gist.github.com/547873