Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5

UV sensor for WeatherDuino Pro2 weather station
#1

Getting UV data in a WeatherDuino Pro2 weather station it's not expensive, and also it's not an hard task.

Buy one of this UVM-30 UV sensors:

[Image: uvm-30.jpg]

You can find it on eBay and other sources for around 10€.

Get a suitable outside waterproof case with a clear acrylic cover (avoid glass, unless it's cristal). Mount the sensor inside the case, facing the acrylic cover. Mount the case horizontaly, in a place with clear sky view.

Connect the output sensor pin, to pin A1 on UV-Solar connector on your TX board. Power for the UV sensor is available on the same connector. Don't use too long cables between TX board and UV sensor (1 to 1,5 meters máx).
Enable the transmission and reception of Solar / UV data, in TX and RX software.
Some small adjusts may be needed in calculations on RX software. None of this is plug and play, which is why building it, is fun and educational.
A nearby weather station (use Weather Underground Maps to find one), with available UV data, can be a great help.

That's it!

In this example I am using the same waterproof case for the UV sensor, and described here "Solar Radiation" sensor.

[Image: sensorUV_Sol_V31_03.jpg]

[Image: SolRad.jpg]

Reply
#2

Hello, I think that something isn't quite correct:
(09-09-2014, 17:39)Werk_AG Wrote:  Get a suitable outside waterproof case with a clear acrylic cover (avoid glass, unless it's cristal). Mount the sensor inside the case, facing the acrylic cover. Mount the case horizontaly, in a place with clear sky view.

Connect the output sensor pin, to pin A1 on UV-Solar connector on your TX board. Power for the UV sensor is available on the same connector. Don't use too long cables between TX board and UV sensor (1 to 1,5 meters máx).
Enable the transmission and reception of Solar / UV data, in TX and RX software.
Some small adjusts may be needed in calculations on RX software. None of this is plug and play, which is why building it, is fun and educational.

When I plugged UVM-30A trial without cover, I measured UV Index between 7 and 15. In the evening I had still UV Index for example 4. And when I covered sensor by acrylic cover, UV Index was too low. So:

I tested voltage output and analyzed program. WeatherDuino calculates UV Index by this formula (WeatherDuino_RX_v1.4_b034.ino, table RX_TX, raw 212):
 
IndiceUV = ((ADC1 * 16.5) / 1024.0)

But this is not correct. It includes the impact of acrylic cover, but there is a question, if that impact is linear or not. And measurement in area of low UV indexes has to be fail, because the curve of UV Index isn't here linear:
 
[Image: PorovnaniVypoctu.png]

The upper part of the picture shows the curve from the manufacturer, the bottom is from our programme (it includes the acrylic cover shadow effect).

In the Arduino UVM-30A datasheet is:
 
[Image: UVM-30A_Index.png]
 
[Image: UVM-30A_Table.png]

So, I think, it would be better:

1) Don't cover UVM-30A sensor by anything. Water small lens doesn't matter, but we have to tighten it around.
2) Our programme would be modified, for example:
Code:
      float IndiceUV;
      int lastUV = -1;
      int uvIndexValue [13] = { 50, 227, 318, 408, 503, 606, 696, 795, 881, 976, 1079, 1170, 3000};
      int uvIndex;
      //long ADC0, ADC1;
      //long SolarRad;
      unsigned int ADC0, ADC1;
      unsigned int SolarRad;
  
      ADC0           = RX_Data[2];                     // Data from Analog Digital Converter 0 on Arduino TX
      ADC1           = RX_Data[3];                     // Data from Analog Digital Converter 1 on Arduino TX
      //NOT USED = RX_Data[4]; //

      #if Solar_Sensor == 1
        // --- ADC0 is data from Solar Radiation
        if (ADC0 < 4) ADC0 = 0;
        SolarRad = map(ADC0, 0, 1023, 0, 1400); // Output an integer, between 0 and 1400 W/m2

      #else
        SolarRad = 0;
      #endif

      #if UV_Sensor == 1     
        // --- UVM-30A on Unit1
        for (int i = 0; i < 13; i++)
        {
          if (ADC1 <= uvIndexValue[i])
          {
            uvIndex = i;
            IndiceUV = uvIndex;
            break;
          }
        }
        if (uvIndex != lastUV)
          {
            lastUV = uvIndex;
          }
        //IndiceUV = ((ADC1 * 16.5) / 1024.0) ;
      #else
        IndiceUV = 0;
      #endif

But - my problem is I am very bad programmer, maybe there are some mistakes in the new code ...
I've tested it now for 2 days, I think the measurement is more correct than before:

Best Regards
Zdenek

[Image: banner.php]
My outdoor AQM-I: here
Reply
#3

Hi, Zdenek

Quote:I tested voltage output and analyzed program. WeatherDuino calculates UV Index by this formula (WeatherDuino_RX_v1.4_b034.ino, table RX_TX, raw 212):

IndiceUV = ((ADC1 * 16.5) / 1024.0)

But this is not correct. It includes the impact of acrylic cover, but there is a question, if that impact is linear or not. And measurement in area of low UV indexes has to be fail, because the curve of UV Index isn't here linear:

First of all, are you testing your sensor in horizontal position? Maybe I'm wrong, but even in very bright sunny days, I never been able to read a UV index of 11, without any correction in the reading formula. I reach to this formula, by comparing readings (after assembling) with other nearby weather stations.

Said that, yes, the used formula includes some correction.
Not taking in account the nonlinearity of the readings between UV index 0 and UV Index 1 (less significant part of the readings) , theoretically the formula should be: IndiceUV = ((ADC1 * 12.0) / 1023.0)

Each one may need to slightly adjust this formula according to characteristics of the material (thickness, UV transmission, etc) used to cover the sensor (it must be covered by something with good UV transmission, to protect it from natural elements).
Each person can build the Solar Radiation / UV sensor in a different manner with different materials, because of this, some final software / hardware adjustments always be required.
Nearby weather stations and Wunderground are of great help at this stage. Cool

Your changes in the code are an interesting approach, and don't seem wrong to me. If they work better for your, why not use them?
I only see one drawback: The results are always integer numbers. I know that UV index is defined as a scale of integer numbers, but personally I like have them with one decimal place (it's better for the graphs too).

Below is real time graph of my UV readings

[Image: graphUV.php]

Reply
#4

Hi Werk_AG,
thank you for your reply.
(21-06-2015, 16:52)Werk_AG Wrote:  First of all, are you testing your sensor in horizontal position?

Yes, of course, my UV sensor is in horizontal position, but now not yet in any case ...
(21-06-2015, 16:52)Werk_AG Wrote:  I only see one drawback: The results are always integer numbers. I know that UV index is defined as a scale of integer numbers, but personally I like have them with one decimal place (it's better for the graphs too).

You are right, your UV Index curve looks much better then me ...

I would also like one another addendum:
(21-06-2015, 16:52)Werk_AG Wrote:  Said that, yes, the used formula includes some correction.
Not taking in account the nonlinearity of the readings between UV index 0 and UV Index 1 (less significant part of the readings) , theoretically the formula should be: IndiceUV = ((ADC1 * 12.0) / 1023.0)

Each one may need to slightly adjust this formula according to characteristics of the material (thickness, UV transmission, etc) used to cover the sensor (it must be covered by something with good UV transmission, to protect it from natural elements).
Each person can build the Solar Radiation / UV sensor in a different manner with different materials, because of this, some final software / hardware adjustments always be required.
Nearby weather stations and Wunderground are of great help at this stage. Cool

I think, this theoretic formula isn't correct too. Not just the non-linearity in the begining of the curve - the curve doesn't passes through the origin of the coordinate system! I think you have to add a constant to correct this problem. For example - appropriate voltages - in the first column are by datasheet, in the second by your formula IndiceUV = ADC1 * 12.0/1024.0 and in the third new approximated curve:
[Image: NewFormula-table.png]

The resulting curves to compare:
[Image: NewFormula-graf.png]

The new formula is:
IndiceUV = (((ADC1-135) * 11.0) / 1024.0)

This formula doesn't include impact of cover, i.e everyone must verify own cover impact, if the cover is used.

Best Regards
Zdenek

[Image: banner.php]
My outdoor AQM-I: here
Reply
#5

This seems very interesting! I'm more inclined to a modification of the formula, than your previous suggestion, mostly because this way we keep the results with one decimal place.

It will be interesting, if we could have something like a table, to adjust the formula, considering the absorbing of the cover, in factors of, say 5 to 30%

Exactly now, I'm testing a new simple and very low cost housing, for the the Solar / UV sensor. In this implementation, the UV sensor is covered with just a very thin film of clear epoxy resin (liquid epoxy, two components - long cure time). Later I'm planning to add a very thin crystal glass over the PV cell and the UV sensor (epoxy resin don't resist for a long time when directly exposed to hail)
I will gonna try your formula with it.

How your readings are comparing with other nearby weather stations? (Supposing you are having a clear day without clouds in a large area)

Reply
#6

(21-06-2015, 19:18)Werk_AG Wrote:  This seems very interesting! I'm more inclined to a modification of the formula, than your previous suggestion, mostly because this way we keep the results with one decimal place.

It will be interesting, if we could have something like a table, to adjust the formula, considering the absorbing of the cover, in factors of, say 5 to 30%

You are right, it would be universal solution for everybody. My formula is useful only for the case we don´t use any cover. And if anybody wants to use it, he has to add switch negative number off. For example:

Code:
#if UV_Sensor == 1    
        // --- UVM-30A  on Unit1
        IndiceUV = (((ADC1 - 135.0) * 11.0) / 1024.0) ;
          if (IndiceUV <= 0) IndiceUV = 0;
      #else
        IndiceUV = 0;
      #endif

(21-06-2015, 19:18)Werk_AG Wrote:  Exactly now, I'm testing a new simple and very low cost housing, for the the Solar / UV sensor. In this implementation, the UV sensor is covered with just a very thin film of clear epoxy resin (liquid epoxy, two components - long cure time). Later I'm planning to add a very thin crystal glass over the PV cell and the UV sensor (epoxy resin don't resist for a long time when directly exposed to hail)
I will gonna try your formula with it.

It's very important for me, once you have any conclusion, publish it, please. (The cover of my box I am very disappointed.)

(21-06-2015, 19:18)Werk_AG Wrote:  How your readings are comparing with other nearby weather stations? (Supposing you are having a clear day without clouds in a large area)

New formula is only 2 hours old Wink But I always compare my measurments with the meteo station in Hradec Kralove, it's very authoritarian station. And my UV Index measurements has to be correct. because I don't have any cover on my sensor and the measured voltage from it with the calculated UV Index I compared with datasheet.

Best Regards
Zdenek

[Image: banner.php]
My outdoor AQM-I: here
Reply
#7

Just a thought... could you try get some readings with something covering the UV sensor, a very thin glass or a transparent CD cover. I think it will not be possible to use the sensor without any cover on it.

A rapid test with your formula, with the UV sensor covered as said on previous topic, I get too low values. To get values compared to my other two sensors I need to keep the original formula.
At least the immediate conclusion is that a thin film (0,2 mm or less) of epoxy resin, is absorbing the same than a 1 mm of acrylic plastic (which is almost transparent to UV).
Now is almost night, next weekend I will continue with the tests.

-----------------------
Edited to add images of one of the new test units.


Attached Files Image(s)
       

Reply
#8

(21-06-2015, 20:19)Werk_AG Wrote:  Just a thought... could you try get some readings with something covering the UV sensor, a very thin glass or a transparent CD cover. I think it will not be possible to use the sensor without any cover on it.

Yes, of course. OK, I will try it.

(21-06-2015, 20:19)Werk_AG Wrote:  Now is almost night, next weekend I will continue with the tests.

Yes, almost night is here too Smile , have a nice time ...

Best Regards
Zdenek

[Image: banner.php]
My outdoor AQM-I: here
Reply
#9

We will continue... Smile
This discussion could not come in a better time. I tell you why

I'm planning to release soon, something like an hardware kit to add the Solar Radiation / UV sensors to the WeatherDuino Pro 2 system.
Therefore, this discussion can be very important to alert everyone that the construction of this unit is far from a plug and play thing. The final results depend largely on the construction process, and even choosing one, that can lead to good results, final adjustments always be needed. Unless you have equipment to do the calibration, it must always be done by comparing values with reference weather stations.
For everyone, be warned: It is a process that can be time consuming, but if done right, you will get very good results.

Zdenek, wish you a good time too. Don't take too much UV radiation Smile

Reply
#10

(21-06-2015, 20:19)Werk_AG Wrote:  Just a thought... could you try get some readings with something covering the UV sensor, a very thin glass or a transparent CD cover. I think it will not be possible to use the sensor without any cover on it.

A rapid test with your formula, with the UV sensor covered as said on previous topic, I get too low values. To get values compared to my other two sensors I need to keep the original formula.
At least the immediate conclusion is that a thin film (0,2 mm or less) of epoxy resin, is absorbing the same than a 1 mm of acrylic plastic (which is almost transparent to UV).
Now is almost night, next weekend I will continue with the tests.

-----------------------
Edited to add images of the new test unit.


Would these do as a cover with the sensor mounted in, for example a , piece of 22mm conduit pipe with this as a lense?
http://www.ebay.co.uk/itm/Watch-Glass-Ac...5d5563789b
Reply




Users browsing this thread: 3 Guest(s)