Constructing a pyranometer – monitoring Daylight Levels using a photodiode and PIC

One of the things it would be good to track at the farm is light level over the year. It’s part of a tri-sensor I want to develop to read light level, temperature and humidity, which will then radio-report to an OpenKontrol Gateway to log the values centrally.

The correct tool for this job is apparently a pyranometer which uses a thermopile to sense the heat incoming to a black surface. Presumably the thermopile, being a differential device by design, tracks variations in ambient temperature. About 40% of incoming solar energy is visible light, and a similar amount is infrared.

The obvious cheapest tool for the job is a silicon photocell, which doesn’t respond across the whole spectrum, but mainly to visible light and IR. Unfortunately the IR peak coincides with a water vapour absorption peak that makes it sensitive to water vapour too because the spectral response peak is in the IR. David Brooks’ website summarises the issues there. In his other website, he describes the fact that there’s a case to be made for measuring just the visible spectrum for photosynthetically active radiation. I’m going to start with a regular Si photocell and fight that issue later 😉

So there’s a lot wrong with the approach, but as Brooks notes

Despite their shortcomings, solar-cell based pyranometers are widely used for meteorological, environmental, and agricultural monitoring, and their performance relative to thermopile-based pyranometers has been studied extensively. Although they are not suitable for producing stable and highly reliable research-quality data required for detecting small long-term changes in insolation, data from simple solar cell pyranometers are still very interesting. They can be used to characterize the potential of sites to produce solar power and to demonstrate seasonal effects on available solar energy. Pyranometer data recorded at intervals of a minute or so provide a record of cloud cover during the day and it has been shown in peer-reviewed scientific literature [Duchon and O’Malley, 1999] that it is possible to use pyranometer data to classify cloud amounts and types even when individual measurements of insolation are not highly accurate. It follows that such data can also be used to track long-term changes in cloud amount and type – an extremely important indicator of climate change.

Looks good enough for me. I’m going to use a BPX65 because I have some and they’re cheap-ish. The BPW21 is a better choice for visible light only, but it’s dearer, I don’t have one and it’s easy enough to switch the photodiode later on.

Right off the bat I don’t like the design of the system described on David Brooks’ page, because it takes the photodiode and rams the signal into a 470 ohm resistor across the diode. In itself there’s nothing wrong with that, but because the resulting signal voltage is low, to keep the response linear, it demands 12-bit resolution from the datalogger A/D converter though it only uses the few lower bits. Making the sensor cheaper makes the datalogger needlessly dearer without using the extra precision you’re paying for, and makes the whole system more sensitive to noise and crap due to the low signal level. However, it makes it simpler to replicate, which probably was the main design brief for that project, but I can do better because I have control of the whole system.

I’m not going to fiddle about with Arduino here – though Arduino makes some things easier it makes things dearer, and seems to lead people to a penchant for digital sensors like the TSL235R or even truly digitised sensors like the DHT22 humidity sensor with proprietary non-standard interfaces. These get hard to service in future years, compared to an analogue voltage interface.

I want a  single supply transimpedance amplifier that I can limit to 5V so I don’t nuke the A/D converter of my PIC. Fortunately I have one- a CA3140 can run the input down to 0V or even 0.5V lower, can bring the output to 0V, and the strobe input lets me limit the output to 5V if I run the opamp off a higher voltage (haven’t decided there yet – if I run it off 5V then there’s no problem).

Looks like once a minute is the fastest that it’s worth sampling this and light level doesn’t really change that fast. The photocurrent is rated at 10nA/lux, daylight is about 10,000 lux peak corresponding to a photocurrent of 100µA. Given a maximum output of 4V the transimpedance resistor should be about 4/100 MΩ = 40kΩ. 39k is the closest preferred value to that, but I took 47k. This is the UK, I can probably expect a little bit less peak sunlight than noon in the Sahara. With the slow response time needed I can slug the frequency response with the 220nF capacitor – this gives me a 10 second RC time constant.

Transimpedance amplifier
Transimpedance amplifier

You can’t suddenly demand Peak Noonday sun, NOW so I will have to field test this for sensitivity. On the bench it works fine, though the peak output with my bench lamp close to the diode is all of about 400mV. However, it’s not bright as the noonday sun there 😉

The CA3140 is a great opamp for this. Being a MOSfet design, it has virtually no input bias current to speak of, compared to the diode dark current (0.1pA as opposed to 1nA dark current). It can run down to -0.5V on the inputs, and to 0.13V on the output low. I could improve the low end by biasing the input (diode cathode and pin3) up 0.6V on a silicon diode and referring the low end of the A/D converter to that, or just sense it with another input and subtract it in software. The input offset voltage of the opamp is the waek point with MOSFET op-amps – 5mV worst case which would get a bipolar opamp binned.

However, it isn’t the worst limitation on the lowest light that can be sensed, that is the 0.13V saturation point, which would correspond to an current of .13/47k = 2.8µA, an illumination of about 280 lux. This probably needs improving, as it’s higher than a dark overcast day. The 5mV offset voltage limit corresponds to about 10㏓, though it has to be added to the various PIC A/D converter offsets which I haven’t developed yet.

This will need fine-tuning later on, but it’s good enough to get me going and ready to tackle the PIC side of things.

reference

Notes on Silicon Photodiode Detectors, J.D.Riggs, 1983