Summary A MLX90614 infra-red thermometer I.C. and a 16c84 PIC microprocessor to sense clear skies for astronomy
The biggest drawback to astronomy as a hobby is the amount of time the night sky is clouded out. For example in the month just gone (November 2010) of the 300+ hours of darkness during the month, the local weather station reported that only 20 of them were classed as Clear. With that sort of ratio, it would be very handy to have something that would alert me when the sky was clear enough to observe.
Short of continually looking out of the window there aren't many options. I did consider sing a webcam and a little (unwritten) software to differentiate between stars and clouds. However that never really got off the ground. As it turns out there is a way used both by professionals and some amateur astronomers. It's not expensive and doesn't need a computer running the whole time to work.You've probably noticed, when flying somewhere, that the crew sometimes make announcements like: "We're currently flying at 36,000 feet and the outside air temperature is minus 50°Centigrade ...". In fact, the sky is quite cold - the clearer it is, the colder it is. The trick is to be able to measure that temperature without being at 36,000 feet.
An easy way to measure the temperature of something without having to be in contact with it is to use an infra-red thermometer.
. All you need do is point it at the thing you want to measure and it will give you a (rough) value for its temperature. The value you get back depends on all sorts of things: what else is "seen" by the thermometer, how accurate the device is and how much infra-red the target is emitting. When you point one of these at a clear sky, you get quite low temperature readings - typically with my handheld IR thermometer I get values of -30°C and lower. The key to using one of these to check for clouds is that the clouds tend to be a lot warmer than a clear sky. That difference allows an instrument to say whether the sky is clear or overcast.
Now, that's all very nice in theory. However it becomes tiresome to have to sit there pointing a thermometer at the sky and taking its temperature every few minutes. You might as well just look up and check the sky yourself. To remove the manual aspect of checking, I decided the simplest route would be to interface the same sort of sensor used by these thermometers to a microprocessor and then have it decide, on the basis of the difference between the temperature of the sky and the ground, whether the sky was clear.To that end I built a prototype device using an MLX90614 (thanks, Anne) sensor and a 16c84 PIC that I had lying about. To see just what sort of temperatures the device was reading, I added the LCD in the image. The MLX90614 (at the bottom of the PIC, just to its right) contains two temperature sensors and has an SMBus (I2C) interface. One sensor measures the devices ambient temperature and the other measures the "remote"temperature. The results are read in 1/50ths of a degree Kelvin and converted into human readable form in software. You can see the sorts of values the device returns in the image. I added a third field to the display: Clr shows an asterisk " * " on the right side of the display when the difference in temperatures is greater than 40°C [update: I decided this was too high and have since changed the alert to signal a difference of 28°C, there's still some work to be done to tune this value]. The only real complication is that the LCD needs to run off 5 Volts, but the MLX90614 requires 3 Volts. I decided to drop the 5 V supply down to about 3 V using 3 series diodes, dropping 0.6V each. The end result is a supply to the sensor and the 16c84 of 2.8 V. The devices seem quite happy with this supply and the 74HC174 in the 2-wire LCD interface is quite able to handle the lower signal levels.
As is usual with my projects, I added a selection of LEDs that I used to track some conditions in the software (every microprocessor project should have at least one flashing light). Two of these are Charlieplexed off a single I/O pin - not because I was short of pins, I just like the technique.
The code [available here and the header file here ] is written in HiTech C and uses pretty much all of the available eeprom and RAM on the 16c84. The schematic [ here ] shows that there are plenty of I-O pins available, since only 4 are used for the thermometer function (2 to the MLX90614 and 2 to the LCD, which uses
As a prototype, the project has been a success. The question now is what to do to "productionise" the device. While I have no desire to turn this into a commercial product, I have had some helpful feedback from people who would like to seethis sort of device integrated into an alarm clock. The idea being that they could either set up their observatories toautomatically execute an imaging session and have this device wake them up if the clouds rolled in. Others want the opposite - to be woken before / after a certain time if the sky becomes clear. My initial requirements were simpler: just to "beep" if the sky was both dark and clear, although I am also thinking about developing a version that talks directly to a PC to collect clear/cloudy stats from my house in Spain. At present all I can say is that whatever path(s) this prototype leads to, I'll be using a more modern microprocessor for it.