Logging raw analog values

Jun 17, 2013 at 3:10 PM
Hi!
First off, awesome project :)

Is there - or can there be - a way to log the raw Arduino analog pin values to the custom values v8-v12 on pvOutput? I was hoping to log some additional sensors for weather readings, along with being able to tell when my meter box's door has been opened by the meter reader.

Thanks!
Jun 17, 2013 at 5:29 PM
Yes
You have to pay for this options bij pvo.
Or make a new sid [ weather ], and send your data to a 2 with the arduino [ solarmeter ]
Coordinator
Jun 17, 2013 at 9:13 PM
The standard sensors do not log raw values but measure the time between pulses.
You can create your own sensor relatively easy.
But PvOutput has an upload resolution of 5 minutes. Is this enough for your application?

The sensor would have a function like this:

void RawAnalogSensor::CalculateActuals()
{
Actual = analogRead(pin);
}
Jun 18, 2013 at 1:22 AM
Yeah 5mins is enough. I will give that code a go!

Is that all the code I will need? I was looking at the existing sensor code and there looked like there was more to it? (Unfortunately C programming is not my native language; so whilst I got the basics of what was going on, I had trouble following some of the more advanced C 'constructor' notations about how it all linked together.
Coordinator
Jun 18, 2013 at 6:54 AM
No, you will need more but this was just to show you the core function.

You can take make a copy of AnalogSensor.h and AnalogSensor.cpp, rename them and every instance of 'analogSensor' in these files to 'RawAnalogSensor'. Then remove all functions except 'begin' and add the new function.
Next is to include the 'RawAnalogSensor.h' in solarmeter.ino
Finally create a reference to the new sensor in userfdefs.h

Most of it is copy/paste/rename so take a good look at all references to analogsensor and use that as a guideline.