Any experience with a Davis Pyranometer

Dear All

First of all, happy new year to all of you, and I wish you all the best for the coming new year!!!

I am setting a Pyranometer from Davis Instrument https://www.meteo-shopping.fr/files/doc/Pyranometre-pour-mesure-du-rayonnement-solaire-Documentation-6450.pdf

My main concern is about the sensor calibration, because it look like it need to be calirated, isn’t?

First here some information about my board.

I am using a ATSAMD21G18 ARM Cortex M0 at 48Mhz with 3V3 logic board with 256K memory.
My analog output résolution is 10

analogReadResolution(10);
    analogReference(AR_EXTERNAL);

and I connected my AREF pin to 3.3V pin to have a 3.3V analog reference.

The doc say:

Range of measure : 0 to 1800W/m2
Analog output: 0 à 3V CC; 1.67 mV par W/m2

The sensor is powered with a 3.3V digit pin
Analog output is connected to A2 without pull-up or down resistance
GND is connected to GND

I have created the following code

[sup]
[/sup]
[sup]float sunValue = analogRead(pin_readSun); //Get a value between 0 and 1023 from the analog pin connected to the anemometer
    Serial.print(F("DEBUG: ")); Serial.println(sunValue);
    float v1 = (3/1023.0) * sunValue;
    Serial.print(F("DEBUG: ")); Serial.print(v1); Serial.println(F("V"));
    float sunValueWm2 = (1796.4 / 3) * v1;
    
    Serial.print(F("Sun radiation: ")); Serial.print(sunValueWm2); Serial.println(F("W/m2"));[/sup]

The problem I obeserved, it during the night or when I cover the sensor with a box, the sensor measure 38W/m2 but during the day (bad weather) the sensor measure up to 140W/m2

I am surprised about the 38W/m2 during the night, or when I cover the sensor with an object. It should return 0W/m2 or some thing close to the zero, isn’t?

That’s the reason, I supposed it should be calibrated, but I have no idea how, as I can not produced 1800W/m2, or let say 1796.4 W/M2.

My main question is, someone has a experience with the Davis Pyranometer and could tell me how to calibrate it , or to exlain me why I get 38W/m2?

My other question , as voltage reference of the sensor is 3V, and my analog reference is 3.3V, do you really think it make a big difference?? I do not think, it’s a problem as the sensor will never return more than 3V.

I hope someone has an experience with the Davis Pyranometer and how can I make it working with a 3.3V board?

Many thank and happy new year

First, I need to read twice the analog output to have a more consistent value.

The timing between the calls does not matter much, the question is how fast you read after switching the input of the ADC from one pin to another.

But I am still interrested about someonewho can share his/her experience with that sensor, with Arduino, specially about calibration.

Why do you call (AR_EXTERNAL), and connect the Aref pin to 3.3volt.
That is already the default situation at bootup.

I would rather call the 2.23volt reference for an absolute/voltage sensor like this (for increased stability), and ignore the rarely used 1800W top range of the sensor. And set the resolution to max (12-bit).

Then read the sensor in full darkness, and note/record the returned A/D value.
You can then use that offset value to subtract from the read A/D value, for a better defined zero point at low light.

float lightValue = (analogRead(sensor) - offset) * 0.3267; // calibrate, to get the right W/m2 value

Leo..

Hello

Why do you call (AR_EXTERNAL), and connect the Aref pin to 3.3volt.
That is already the default situation at bootup.

My board is based on a Adafruit ATSAMD21G18 ARM Cortex M0. I followed their recommendation here
But I understand your writing, may be I could remove that.

Then read the sensor in full darkness

My question will surpise you, but what's a full darkness?
Someone told me that recovering the sensor either with my finger or my a black t.shirt will absolutely not help
I might go to my bathroom, where there is not windows, and nothing to produce a light and turn off the light
But is sufficient to take a measure in full darkness? How could I guess the offeset in the desert? :slight_smile:

Would it be useful to know the offset in the opposite situation?

I took a measure in my flat, and the sensor return me 14W/m2. I beleive it's sufficient to be the light of my leaving room?

pierrot10:
How could I guess the offeset in the desert? :slight_smile:

I'm talking about the DC offset of the amplifier in the sensor.
Your sensor must have some voltage offset in full darkness.
Not a big problem if compensate for that in A/D values, before you convert to W/m2.
Like I am doing in that line I posted ( - offset).

First write/upload a simple sketch that just reads A/D values, and prints them once a second.
Then see what lowest A/D values you get by covering the sensor or turning off the light, or whatever.
Let us know if you need help with that.
Leo..

Thanks Leo,
I am going to do it later in the after noon.
I will give you a feedback
Cheers

Dear Leo,

Thank again. I took some measures in a full darkness for about 30mn.
I placed the pyranometer in my bathroom and trun off the light (it was full dark)
The analog pin returned 9, as when the pyranometer was in my leaving room with light of bulb.
I was surpised even if the light if bulb (in fact a LED bulb) is not the luight of the sun.

I supposed I can trust of the 9 and concider it as the offset?

I missed to ask you somethings else

loat lightValue = (analogRead(sensor) - offset) * 0.3267;

What's the 0.3267?

Was that offset with the A/D set to 12-bit?
A small offset like that seems right, so use it.
These sensors are AFAIK designed for bright sunlight, so don't expect reliable values with artificial light.

pierrot10:
What's the 0.3267?

That should give about the right W/m² value with the resolution of the A/D set to 12-bit, and Aref set to 2.23volt.

Aref/sensorvoltage * 1800w/m² = 2.23/3 *1800 = ~1338W/m² max range (more than enough for earth).
max range/12-bit = 1337.99/4096 = ~0.3267

Post your new code, so we can check.
Leo..

Dear Leo

To be honnest, I have not done the test as you expected yet.
I only placed the sensor in a real full darkness room, to see the difference.

Tomorrow, I can not work on that topics (Christmas with my goddaughter)

But tomorrow evening and monday, I will do next step

  • Change the resolution to 12
  • Make a voltage bridge to power the sensor with 3V
  • Change the AREF to 2.23 as you suggest

But I have two other question.

Why do you want me to have AREF at 2.23V? As the sensor should be power at 3V, shoud I not have it at 3V as well?

Sortie (output) de 0à 3VCC; 1.67 mV par W/m²

Additionally, I have a doubt about how to do it.

My first suggestion, will be to

  • Disconnect AREF pin to 3V pin
  • Change
analogReadResolution(10);
analogReference(AR_EXTERNAL);

to

analogReadResolution(12);
analogReference(AR_INTERNAL2V23);
or may be
analogReadResolution(12);
analogReference(AR_INTERNAL);
[iurl=https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/]https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/[/iurl]

I keep you posted
Thanks
NB: I have to be careful, because my Davis Anemometerr (wind direction) is on A2 and the fact to change the AREF reference will have a result on the wind direction measure. But that will be easy to solve later. (Sun radiation is much important than the wind direction)

Sensor supply specs are 3volt ±10% (2.7-3.3).
Just power the sensor from the 3.3volt (VCC) pin of the processor.
A small RC filter (100R+100n) near the sensor could be a nice addition, to remove processor/wire noise and drop a tenth of a volt.

The sensor seems to have a voltage (not ratiometric) output, so 2.23Aref should result in a more stable readout.
That reduces max readout from 1800W/m² to 1338W/m², which as said is not a problem on earth (Google it).

Don't know the quirks of a SamD21. Better set AR to (12), to make sure.

Aref can be dynamically switched between "Default" and "2.23volt".
No experience there. You might have to add a double read and/or a delay between switching.

Get each of the sensors working reliably, before you think of merging.
I assume you understand to NOT power the Anemometer from 5volt.
Leo..

Dear Leo

The result are not realy better
I disocnnect aref pin from 3V pin (floating)
I powered with 3.3V the sensor
I tried all of those options

    analogReadResolution(12);
    //analogReference(AR_EXTERNAL);
    analogReference(AR_DEFAULT); // 3.3V
    //analogReference(AR_INTERNAL2V23); // 2.23V

In a fulll dakrness bathroom,
AR_DEFAULT printed 10 -12
AR_INTERNAL2V23 printed 16 - 18

while aref with 3.3V and the resolution to 10, it print 9

void get_sun()
{
  #if defined(SENSOR_SUN)
    Si.sprintln(F("\r\nSun Radiation"), 0);
    Si.sprintln(F("******************************"), 0);
    //https://www.meteo-shopping.fr/Station-meteo/Pyranometre-pour-mesure-du-rayonnement-solaire-6450-Davis-Instruments#caracteristique
    float sunValue = analogRead(pin_readSun); //Get a value between 0 and 1023 from the analog pin connected to the anemometer
    sunValue = analogRead(pin_readSun); // read twice to avoid (The timing between the calls do not matter much, the question is how fast you read after switching the input of the ADC from one pin to another. )
                                        // Read #30 : https://forum.arduino.cc/index.php?topic=714834.30
    Serial.print(F("DEBUG: ")); Serial.println(sunValue); // it print 10-12 with aref 3.3 or 16-18 with aref 2.23V
  
// The code below is not relevent for now, as I am monitoring the analogread(), but I kept it    
float v1 = (3/1023.0) * sunValue; //0.00967, 0.00879, 0.00733
    Serial.print(F("DEBUG: ")); Serial.print(v1); Serial.println(F("V"));
    float sunValueWm2 = (1796.4 / 3) * v1;
    
    Serial.print(F("Sun radiation: ")); Serial.print(sunValueWm2); Serial.println(F("W/m2"));

    //sunValueWm2 = sunValueWm2 * 100;
    mesMesures[c_sun][capteur_sun_id].valeur = (int16_t)sunValueWm2;

#endif
}

pierrot10:
The result are not realy better

Short term differences are of course small, but if you do it right you get the added benefit of stability with fluctuating supply voltages, without gaps in displaying the last digit, which you have with trying to display >=1338 with a 10-bit (1024) A/D.
So I would still use 2.23volt Aref and set (leave) A/D resolution at the processor's default 12-bit.
Leo..

Then we are agree that

AR_INTERNAL2V23 printed 16 - 18

(with resolution of 12)
would be the offset

float lightValue = (analogRead(sensor) - offset) * 0.3267; // calibrate, to get the right W/m2 value

Offset you say is 10-12 with default 12-bit resolution and default Aref (3.3volt).

It is increasing to 16-18 if you drop Aref to 2.23volt.
Expected, because the A/D becomes more sensitive (4096 values spread over 0-2.23 in stead of 0-3.3).

Just see if the printed value drops to (almost) 0W/m² if you cover the sensor.
That's what that offset value does.
Leo..

It's look nice now, but my anemmeter does not like it.
When I want to mesure the wind direction, it print 4096 from +/-230°.
Then when my vane is from SW it show 4096 until I rotate to N

I do not know what the reason, but I will try to come back to AREF 3.3 as it was working before (or may be I change the resolution to 10, to see the differences)

I am bit suprised that analog pirnt 4096 from +/- 230°.
It should print (more or less)
N => 0/4096
E => 1024
S => 2048
W => 3072

For W, it already print 4096 :o

If you power (4k7) the instrument from 3.3volt, you should have the values in range of the A/D.
Even with 2.23volt Aref and 12-bit resolution.
Check your wiring.
Leo..

Hello

If you power (4k7) the instrument from 3.3volt

What do you mean by 4K7? A pull down resistance???

pierrot10:
What do you mean by 4K7? A pull down resistance???

In post#8 you added a link to the anemometer.
The diagram in there has a 4k7 resistor between pin 2 and 5 of the RJ-11 connector.
That is the pull up resistor for the resistor ladder (with reed switches) inside the instrument.
Since you're using a 3.3volt processor, you should connect that pull up resistor to 3.3volt.
Leo..

In post#8 you added a link to the anemometer.
The diagram in there has a 4k7 resistor between pin 2 and 5 of the RJ-11 connector.

Ho ye, but that for the wind speed, not for the wind direction and my issue is with the wind direction
Morever, that link /tuto says

As we move the wind vane around we should get a reading between 0 and 1023. The Arduino has a 10 bit A to D converter which gives us the range of 0 to 1023. This would also correspond to a voltage of 0 to 5V. In the software we need to convert the 0 to 1023 to a 0 to 360 range to give us the wind direction.

I think, I am going to go back with a resolution of 10. I think it does make a very very big difference for the pyranometer, isn't?

Duhh, correct. 4k7 is the pull up resistor for the wind speed pulses.
But it still needs to be connected to the 3.3volt pin with a 3.3volt processor.

I Googled the internals of the sensor, and it seems to have a 20k pot for the wind direction, connected to 2,3,4 of RJ11.
Should work with 12-bit/2.23volt, with some values/directions out of range.
I still suspect a wiring problem. Look for that first.

You might have to add a ~6.5k resistor between 3.3volt and pin2 of the sensor.
That will get the 20k pot in range with 2.23volt Aref.

Another solution is to power pin2 of RJ-11 from Aref pin of the processor.
Not sure if I would without knowing how much you can load that pin.

Don’t go back to 10-bit. That creates gaps in the W/m² readout.
Leo…