Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Cloud and Rain Sensor


Gina

Recommended Posts

Neil C has very kindly sent me the bits and some information to make a cloud and rain sensor so I'm now sorting out what he has already done and seeing how all this fits together.  I had the idea of making a cloud sensor on my to-do list (somewhere in the dim mists :D) but now Neil has given me the bits from his incompleted project, having bought a commercial unit, it has come to the front :)  I think I have a bit of research to do and this will not be an overnight project :D

The main parts are an IR sensor, the Melexis MXL90614, and a capacitive rain sensor with inbuilt heating.  These connect to an Arduino.

Link to comment
Share on other sites

  • Replies 61
  • Created
  • Last Reply

How many times do you expect to replace all the components owing to their expected life spans before there are no clouds? :grin: :grin: :grin: :grin: :grin:

Poor thing will get tired of telling you there are clouds.

Link to comment
Share on other sites

Neil has the IR cloud sensor working in a test rig so this info will be in the info he sent me but says he didn't get the capacitive rain sensor working so I'll take a quick look at the latter.

Rain sensor datasheet says no rain capacitance is about 100pF and that it increases with rain or moisture on the sensor as shown in this table.

post-13131-0-25372800-1432734699.jpg

100pf is pretty low to measure with the basic Arduino capacitance meter shown here, using just two digital and one analog pin.  This uses the property of Arduino digital pins of having very high resistance when specified as INPUT and low resistance when specified as OUTPUT.  These properties are not fixed when set but may be changed later within the sketch.

Another idea for low values is to use a "pump" circuit whereby charge is transferred from the test capacitor to a reference one.  The test capacitor is charged to a known voltage then this charge transferred to the reference capacitor which gradually accululates charge.  The number of times this has to be done to reach a certain charge/voltage on the reference capacitor is inversely proportional to the value of the test capacitor.

post-13131-0-80778500-1432738618_thumb.j

I'll do some experimenting to see which would be best.  We don't need much accuracy so the first method might work.

Link to comment
Share on other sites

Looking at some calculations...

Starting with 100pF.  The largest value of resistor I have ATM is 1M so this would charge to 63% in 100p x 1M secs.  100pF = e-10, 1M = e+6 thus TC = e-4 which is 100 micro seconds.  This sort of time could be measured using the "micros" function.  The resolution is 4us (u is micro) ie. 4% of the value.  This seems just about doable.

post-13131-0-11003000-1432740776_thumb.j

Link to comment
Share on other sites

I've taken the example sketch from the Arduino web site and altered it for micros timing and picoFarads.  It complied but I haven't uploaded it to an Arduino to test yet.   I'll post the sketch when I've worked out why it won't post coirrectly ATM - ie. what I'm doing wrong :D

Link to comment
Share on other sites

Hi Gina

put an oscillating 60KHz sin wave across the capacitor and put it through an amplifying op amp AC filter before rectifying it and measuring the dc output.

Using the variable cap as the feedback element of the op amp and putting the signal into the opamp on the inverting leg through a reference cap controls the gain and by measuring the signal gain you can measure the amplified capacitance as Vf = Vin * gain

Its an op amp, an oscillator and a reference cap; you could even clip the output with a diode and measure the peak-to-peak voltage as output.

cheers

Mike

Link to comment
Share on other sites

I already know of those methods but too complicated :D  It can be done with just an Arduino with a resistor or two and/or capacitor, I'm sure :)

Link to comment
Share on other sites

// RCTiming_capacitance_meter

// Paul Badger 2008 Modified by Gina Davis 2015 for low capacitance.

// Demonstrates use of RC time constants to measure the value of a capacitor

//

// Theory - A capcitor will charge, through a resistor, in one time constant,

// defined as T seconds where

// TC = R * C

//

// TC = time constant period in seconds

// R = resistance in ohms

// C = capacitance in farads

//

// The capacitor's voltage at one time constant is 63.2% of the charging voltage.

//

// Hardware setup:

// Test Capacitor between common point and ground

// Test Resistor between chargePin and common point

// 220 ohm resistor between dischargePin and common point

/ Wire between common point and analogPin (A/D input)

//

#define analogPin 0 // analog pin for measuring capacitor voltage

#define chargePin 13 // pin to charge the capacitor

#define dischargePin 11 // pin to discharge the capacitor

#define resistorValue 1000000.0F // charging resistor value

// F means compliler it's a floating point value

unsigned long startTime;

unsigned long elapsedTime;

float picoFarads;

//

void setup(){

pinMode(chargePin, OUTPUT); // set chargePin to output

digitalWrite(chargePin, LOW);

Serial.begin(9600); // initialize serial transmission for debugging

}

//

void loop(){

digitalWrite(chargePin, HIGH); // set chargePin HIGH and capacitor charging

startTime = micros();

while(analogRead(analogPin) < 648){ // 647 is 63.2% of 1023, ie. full-scale voltage

}

elapsedTime= micros() - startTime;

// convert microseconds to seconds ( 10^-6 ) and Farads to pF ( 10^12 ),= 10^6

picoFarads = ((float)elapsedTime / resistorValue) * 1000000;

Serial.print(elapsedTime); // print the value to serial port

Serial.print(" uS "); // print units and carriage return

Serial.print((long)picoFarads); // print the value to serial port

Serial.println(" picoFarads"); // print units and carriage return

//

/* dicharge the capacitor */

digitalWrite(chargePin, LOW); // set charge pin to LOW

pinMode(dischargePin, OUTPUT); // set discharge pin to output

digitalWrite(dischargePin, LOW); // set discharge pin LOW

while(analogRead(analogPin) > 0){ // wait until capacitor is completely discharged

}

//

pinMode(dischargePin, INPUT); // set discharge pin back to input

}

Link to comment
Share on other sites

These code listings seem to have become difficult to read - or at least they have on both my main PCs :(   Colours have changed.  Anyone else noticed this?

Link to comment
Share on other sites

I already know of those methods but too complicated :D  It can be done with just an Arduino with a resistor or two and/or capacitor, I'm sure :)

It can. A fine example is the Superprobe. However the lower limit on that seems to be about 1nF

Link to comment
Share on other sites

Why not using the SGL code and a MLX sensor and the DS18B20? Temp probe for the cloud sensor and a 2€ rain sensor from ebay?

I just got mine delivered and the rain sensor works like a charm :)

/Daniel

Link to comment
Share on other sites

Corpze,

The sensor is the mxl sensor from the sgl code/aag but the rain sensor is much better than the cheap ebay ones, if it is the cheap ones i have seen, as it has a built in heater which will keep the dew of both it and the ir sensor.

Plus I don't think Gina's one for copying code and designs 100%.

Part of the fun's in the building, playing and putting your own twist on it.

I like seeing what Gina comes up with, it's always entertaining!

Sent from my SM-N9005 using Tapatalk

Link to comment
Share on other sites

Corpze,

The sensor is the mxl sensor from the sgl code/aag but the rain sensor is much better than the cheap ebay ones, if it is the cheap ones i have seen, as it has a built in heater which will keep the dew of both it and the ir sensor.

Plus I don't think Gina's one for copying code and designs 100%.

Part of the fun's in the building, playing and putting your own twist on it.

I like seeing what Gina comes up with, it's always entertaining!

Sent from my SM-N9005 using Tapatalk

Sure it is fun to write your own code :-)

I bought one of the cheap ones but it works fine so far, regarding the heating, i use a 5w heat-pad mounted underneath the raindensor, dont know how that is Working yet though.

/Daniel

Link to comment
Share on other sites

The aag uses the heater but also has holes in the bottom of the box for ventilation.

I was trying to keep my cloud sensor box sealed but mucked it up and ended up flooding it.

I bought the aag only because i didn't have time to integrate the software into ACP, observatory control software.

It's great fun watching the cloud levels and the one i built picked up high faint cloud as well.

Sent from my SM-N9005 using Tapatalk

Link to comment
Share on other sites

Thank you for all your replies :)

I do have a conductance type rain sensor as it happens (with heater) - had it some time and not got round to trying it :D  I shall be trying it out - it might work or it might not depending on the pollution level.  I think the air is usually pretty clean here but I don't really know.  Anyway, it will be interesting to try a different type :)  Plus, the deal with Neil was to see if I could get it working and provide interesting feedback.  That is something I'm well up for - I love a challenge :)

The standard method of measuring capacitance with a microcomputer will give around 1nF accuracy, that's why I have investigated and modified the Arduino version to go down to pF level.  I expect to give it a try today.

Regarding temperature, the rain sensor has an NTC thermistor for measuring the temperature which I think is for measuring the rain sensor temperature even though the datasheet says "ambient".  I'm already using the DS18B20 for various temperature measurements and know this device well :)  Good accuracy and easy to use.  I could attach one to the back of the rain sensor and use it instead of the built in NTC thermistor.  I'll use one for ambient anyway.  In fact I might incorporate this project with my All Sky Camera.

Link to comment
Share on other sites

Regarding temperature, the rain sensor has an NTC thermistor for measuring the temperature which I think is for measuring the rain sensor temperature even though the datasheet says "ambient".  I'm already using the DS18B20 for various temperature measurements and know this device well :)  Good accuracy and easy to use.  I could attach one to the back of the rain sensor and use it instead of the built in NTC thermistor.  I'll use one for ambient anyway.  In fact I might incorporate this project with my All Sky Camera.

The MLX90614 already contains an ambient temperature sensor.

Link to comment
Share on other sites

Here is the sketch I'm using.  It's working - sort of - saying a 100pF capacitor is 340pF...

/*  RCTiming_capacitance_meter *   Paul Badger 2008  Modified by Gina Davis 2015 for low capacitance. *  Demonstrates use of RC time constants to measure the value of a capacitor  * * Theory   A capcitor will charge, through a resistor, in one time constant, defined as T seconds where *    TC = R * C *  *    TC = time constant period in seconds *    R = resistance in ohms *    C = capacitance in farads (1 microfarad (ufd) = .0000001 farad = 10^-6 farads )  * *    The capacitor's voltage at one time constant is defined as 63.2% of the charging voltage. * *  Hardware setup: *  Test Capacitor between common point and ground *  Test Resistor between chargePin and common point *  220 ohm resistor between dischargePin and common point *  Wire between common point and analogPin (A/D input) */#define analogPin      0            // analog pin for measuring capacitor voltage#define chargePin      8            // pin to charge the capacitor - connected to one end of the charging resistor#define dischargePin   7            // pin to discharge the capacitor#define resistorValue  1000000.0F   // change this to whatever resistor value you are using                                    // F formatter tells compliler it's a floating point valueunsigned long startTime;unsigned long elapsedTime;float nanoFarads;                // floating point variable to preserve precision, make calculationsfloat picoFarads;void setup(){  pinMode(chargePin, OUTPUT);     // set chargePin to output  digitalWrite(chargePin, LOW);    Serial.begin(9600);             // initialize serial transmission for debugging}void loop(){  digitalWrite(chargePin, HIGH);  // set chargePin HIGH and capacitor charging  startTime = micros();  while(analogRead(analogPin) < 648){       // 647 is 63.2% of 1023, which corresponds to full-scale voltage   }  elapsedTime= micros() - startTime; // convert microseconds to seconds ( 10^-6 ) and Farads to picoFarads ( 10^12 ),  net 10^6 (1,000,000)    picoFarads = ((float)elapsedTime / resistorValue) * 1000000;     Serial.print(elapsedTime);       // print the value to serial port  Serial.print(" uS    ");         // print units and carriage return  Serial.print((long)picoFarads);       // print the value to serial port  Serial.println(" picoFarads");         // print units and carriage return   /* dicharge the capacitor  */  digitalWrite(chargePin, LOW);             // set charge pin to  LOW   pinMode(dischargePin, OUTPUT);            // set discharge pin to output   digitalWrite(dischargePin, LOW);          // set discharge pin LOW   while(analogRead(analogPin) > 0){         // wait until capacitor is completely discharged  }  pinMode(dischargePin, INPUT);            // set discharge pin back to input} 
Link to comment
Share on other sites

Doesn't really matter what the actual reading is as long as it detectes the increase.  So I'm now going to add a 10pF capacitor in parallel.

A bit later... Added 10pF - no change - doesn't work :(  OK I'll try more - 47pF. 

Later still... Still no joy :(  Now we go into debugging phase :D

This is definitely NOT working - I have something wrong!  I have added a 1nF capacitor and it's still saying 340pF :eek:

Later...  Tried again with just the 1nF capacitor and made sure all the wires were well pushed into the Uno sockets :D  It's now giving values of 1236 - 1244 pF.  Maybe I should test with a fully wired and soldered Arduino rather than relying on making contact with the test sockets :D

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.