Miscellaneous Debris => Tech Corner => Weather sensors, design, analysis, discussion, home brew => Topic started by: vreihen on January 25, 2017, 08:28:37 PM

Title: DIY solar Lux/UV sensor
Post by: vreihen on January 25, 2017, 08:28:37 PM
Background: My Acu-Rite 5-in-1 and supporting hardware have become increasingly unstable.  When I was outside at 5:30 AM on a cold morning last month power-cycling the 5-in-1 because it stopped sending Type 31 packets for the third time, my wife sensed my frustration and asked me why I didn't just build my own weather station?  Long story short, I take that to be a blank check to start construction.

My first project was to make a weewx bridge, using a Raspberry Pi and SDR USB dongle to catch the Acu_Rite signals off the air using rtl_433.  While researching how to add a barometer, I found this project that brought by attention to the incredibly cheap NodeMCU Arduino board:

https://github.com/DanV410/weewx-sdr-arduino (https://github.com/DanV410/weewx-sdr-arduino)

It made me think that I could build a complete wifi network of individual sensors for peanuts, so that there was no single point of failure like with the bundled consumer-grade weather stations like the 5-in-1.  I built the barometer on a NodeMCU, and it has been running for almost a week as a second sensor.

My next project is the subject of this thread, namely a wifi Lux/UV sensor.  I bought two individual sensor modules from Adafruit, and plan to put them into a waterproof electronic project case.

My first challenge is to find an appropriate lens to protect the sensors from the weather.  There are acrylic security camera domes available on Amazon, but I'm not sure that they are not coated with some sort of UV/IR inhibitors that would interfere with the sensor measurements.  Instead, I chose to go with optical-grade glass rectangles, in the form of microscope slides.  My plan is to drill two holes through the project case for the sensors to see out, and then cover them with two microscope slides held on by silicone caulk.  It should do the job.

I suspect that my second challenge will be dealing with condensation inside the box, and am hoping that a large packet of silicon gel desiccant will keep the inside dry.

I'm waiting for the materials to arrive via big brown truck, and plan to build the first revision over the weekend.  I'll post follow-ups to this thread, and will upload the final NodeMCU into Github in case anyone wants to replicate my work.....
Title: Re: DIY solar Lux/UV sensor
Post by: mcrossley on January 26, 2017, 04:15:23 AM
I put an opaque white perspex window over my solar sensor, the UV sensor diode sticks out directly through a hole in the enclosure - nothing to obscure the UV then.
Title: Re: DIY solar Lux/UV sensor
Post by: vreihen on February 24, 2017, 12:29:12 PM
This simple project has been a learning experience for sure, and I'm starting to wonder if maybe I'm over-thinking the whole thing?

First off, standard microscope slides are made of a glass that is not 100% UV transparent.  The only glass option is fused silica, and it adds about $15 to the project cost to get a small piece with a published 95% UV transparency spec.

Second thing that I learned is that a solar-powered USB battery pack cell phone charger automatically turns itself off when it thinks the phone has stopped charging.  For some reason, it thinks that the NodeMCU controller has a full battery after 5 minutes, and switches it off.  If I plug in a passthrough USB current/voltage meter, the power supply seems to keep running.  I do not know how the extra load of the meter and its LED display will impact my power budget, not to mention that it is far from weatherproof.

I'm not going to recommend that anyone try to power small projects from one of those USB solar battery packs, because the limited size of the solar panel on the battery pack takes 96+ hours to recharge it from dead.  The only reason why I am trying it is out of curiosity, since I had it sitting in my racing pit box for the winter and wanted to see how many days it could run the NodeMCU so that I can determine the power requirements for a permanent supply.

Third lesson (that I still have to research) is whether or not there is a standard sensor orientation for measuring lux and UV?  Should the sensor be mounted parallel to the ground, pointed south at some pre-defined elevation angle, or incorporate a rotating platform to keep it always pointing at the sun?  I could see an argument for measuring watts/meter^2 parallel to the ground, since that's the way that the soil will absorb it.

I didn't take a picture of the assembled prototype yet, but here's the breadboard layout.  Note that the board is mounted vertical, and that's why the two sensor modules are hanging over the edge and turned 90 degrees:



I put it in one of these NEMA-rated gasketed boxes, with two holes knocked through the side for the sensors to see through:


We had a rare 100% sunny day yesterday with temps in the 60's...which was wasted because I was at work and didn't put the sensor outside.  #-o  I was poking around WU, and found a nearby Davis station that produced a perfect bell-shaped curve yesterday.  It peaked at about 620 watts/M^2, which I'm going to use as the sanity check number for my own sensor's calibration.  Today is partly cloudy, and the solar numbers are jumping all over the place.  In terms of UV, 2-4 seems to be the norm at other local stations, but I'm getting 9+ in full sun.  (I put the microscope slide over the fused silica glass out of curiosity, and it only dropped the readings into the 7's.)  Guess I'll have to check the sensor math on that.....
Title: Re: DIY solar Lux/UV sensor
Post by: vreihen on February 24, 2017, 12:35:30 PM
I forgot to point out that the purple module at the top right corer is a spare BMP-280 barometer/thermometer that I had on-hand, so I put it in the box as a thermometer to get a rough idea how warm it is getting inside the case.....
Title: Re: DIY solar Lux/UV sensor
Post by: mcrossley on February 24, 2017, 01:24:41 PM
Orientation depends on what you want to build. Most amateur sensors are 'global', i.e. they take a whole sky reading and are mounted level with the ground. If you want to build a 'direct' irradiation measurement device, then it has to track the sun, and provide shielding so that the sensor is only exposed to the sun and not the whole sky.

Edit: You will see if the sensor isn't level, the theoretical and actual bell curves will be offset.

Would a slide cover slip would be more transparent being soo much thinner? May not be mechanically strong enough for you though?
Title: Re: DIY solar Lux/UV sensor
Post by: weathernick on February 24, 2017, 04:31:43 PM
Sweet Project! I have been very pleased with my homemade Pyranometer build from this site: http://www.instesre.org/construction/pyranometer/pyranometer.htm. I just contacted them and got the kit for 25 dollars. The sensor outputs voltage which can be read with an AD converter.

You can see my live data on my web site here: http://mccolls.weewx.s3-website-us-east-1.amazonaws.com/ most days the image is just a typical sine wave.