Jump to content

Banner.jpg.32030495336bee81a52546621b6f39a2.jpg

DIY cloud and rain sensor with ascom support?


Corpze

Recommended Posts

You need to declare the "avg_delta_celsius" up near the start of the program, so that it persists and the value isn't thrown away over and over (so accumulates the average.) 

Probably want to assign it a starting value to get it into the expected range too.

I don't really understand the purpose of this line:

delta_celsius = abs(ds18b20_celsius - MLX90614_celsius);
 

I just read that the MLX's returns the "object" temperature - it already knows the ambient temperature and calculates it in.  Which is unlike someone trying to use a peliter (thermopile)

type sensor who needs to know the ambient temperature to find the true temperature (and even then, I'd think that one would simply add the two measurements.)

Link to comment
Share on other sites

You need to declare the "avg_delta_celsius" up near the start of the program, so that it persists and the value isn't thrown away over and over (so accumulates the average.) 

Probably want to assign it a starting value to get it into the expected range too.

I don't really understand the purpose of this line:

delta_celsius = abs(ds18b20_celsius - MLX90614_celsius);

I just read that the MLX's returns the "object" temperature - it already knows the ambient temperature and calculates it in.  Which is unlike someone trying to use a peliter (thermopile)

type sensor who needs to know the ambient temperature to find the true temperature (and even then, I'd think that one would simply add the two measurements.)

Reading up on this... I see that it is the delta (between the ambient and sky temperature) that is used, that code looks good carry on!

Link to comment
Share on other sites

I have tried the ASCOM driver, and it connects fine, and reads the hardware, but i it says "Unsafe" as you can see, but that is probably because i have not yet entered the average value of the Delta temp.

That is why i am getting a error message as well?

post-28724-0-62210700-1438352589_thumb.p

Link to comment
Share on other sites

You need to declare the "avg_delta_celsius" up near the start of the program, so that it persists and the value isn't thrown away over and over (so accumulates the average.) 

Probably want to assign it a starting value to get it into the expected range too.

I don't really understand the purpose of this line:

delta_celsius = abs(ds18b20_celsius - MLX90614_celsius);

I just read that the MLX's returns the "object" temperature - it already knows the ambient temperature and calculates it in.  Which is unlike someone trying to use a peliter (thermopile)

type sensor who needs to know the ambient temperature to find the true temperature (and even then, I'd think that one would simply add the two measurements.)

Is perhaps to CPU heavy to use a float? 

i am currently modifying your CloudSensorEvoPlus.ino instead of mine code, but i am out on deep water here, a lot of new type of coding for me :D

I will experiment with 15 average readings instead of 300 to speed it up a bit.

I put the average formula at the top-ish but i do not understand where the print is...

/*** This sketch reads three sensors:*  DS18B20 - Connected to D10*  MLX90614 - Connected to SCL-A5, SDA-A4*  Rain sensor conected to A0* It calculates the temperatures (DS18B20 and MLX90614)* DS18B20: http://playground.arduino.cc/Learning/OneWire* MLX90614: http://bildr.org/2011/02/mlx90614-arduino/*/#define DEBUG_MODE_OFF#ifdef DEBUG_MODE_OFF//get it here: http://www.pjrc.com/teensy/td_libs_OneWire.html#include <OneWire.h>#include <i2cmaster.h>#include <SPI.h>#endif// lowest and highest rain sensor readings:const int sensorMin = 0;     // sensor minimumconst int sensorMax = 1024;  // sensor maximum// misc#define FirmwareName "CloudSensorEvoPlus"#define FirmwareNumber "0.1"#define invalid -999#define CHKSUM0_OFF// last rain sensor readingint rainSensorReading = invalid;// last cloud sensor readingfloat ds18b20_celsius = invalid;float MLX90614_celsius = invalid;float delta_celsius = invalid;// Average of delta temperaturefloat avg_delta_celsius= (avg_delta_celsius*14.0+delta_celsius)/15.0; <---------------------------#ifdef DEBUG_MODE_OFFOneWire  ds(10);  // DS18B20 on Arduino pin 10#endif

This is the error i get from microsoft.net framework;

************** Undantagstext **************
System.Runtime.InteropServices.COMException (0x80040402): Timed out waiting for received data
   vid ASCOM.Utilities.Serial.ReceiveTerminated(String Terminator) i C:\ASCOM Build\Export\ASCOM.Utilities\ASCOM.Utilities\Serial.vb:rad 1204
   vid ASCOM.CloudSensorEvoPlus.SetupDialogForm.SendCommand(String Command, Boolean Responding)
   vid ASCOM.CloudSensorEvoPlus.SetupDialogForm.timer1_Tick(Object sender, EventArgs e)
   vid System.Windows.Forms.Timer.OnTick(EventArgs e)
   vid System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   vid System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Inlästa sammansättningar **************
mscorlib
    Sammansättningsversion: 2.0.0.0
    Win32-version: 2.0.50727.5485 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Sequencer
    Sammansättningsversion: 0.2.0.8
    Win32-version: 0.2.0.8
    CodeBase: file:///C:/Program%20Files%20(x86)/Sequence/Sequencer.exe
----------------------------------------
System.Windows.Forms
    Sammansättningsversion: 2.0.0.0
    Win32-version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Sammansättningsversion: 2.0.0.0
    Win32-version: 2.0.50727.5485 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Sammansättningsversion: 2.0.0.0
    Win32-version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualBasic
    Sammansättningsversion: 8.0.0.0
    Win32-version: 8.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
Microsoft.VisualBasic.Compatibility
    Sammansättningsversion: 8.0.0.0
    Win32-version: 8.0.50727.5483
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic.Compatibility/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.Compatibility.dll
----------------------------------------
Interop.PinPoint
    Sammansättningsversion: 1.0.0.0
    Win32-version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Sequence/Interop.PinPoint.DLL
----------------------------------------
mscorlib.resources
    Sammansättningsversion: 2.0.0.0
    Win32-version: 2.0.50727.5485 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
ASCOM.Utilities
    Sammansättningsversion: 6.0.0.0
    Win32-version: 6.1.1.2627
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/ASCOM.Utilities/6.0.0.0__565de7938946fba7/ASCOM.Utilities.dll
----------------------------------------
System.Core
    Sammansättningsversion: 3.5.0.0
    Win32-version: 3.5.30729.5420 built by: Win7SP1
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
ASCOM.Exceptions
    Sammansättningsversion: 6.0.0.0
    Win32-version: 6.1.1.2627
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/ASCOM.Exceptions/6.0.0.0__565de7938946fba7/ASCOM.Exceptions.dll
----------------------------------------
CloudSensorEvoPlus
    Sammansättningsversion: 0.5.5690.13704
    Win32-version: 0.5.0.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Common%20Files/ASCOM/SafetyMonitor/CloudSensorEvoPlus.DLL
----------------------------------------
ASCOM.DeviceInterfaces
    Sammansättningsversion: 6.0.0.0
    Win32-version: 6.1.1.2627
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/ASCOM.DeviceInterfaces/6.0.0.0__565de7938946fba7/ASCOM.DeviceInterfaces.dll
----------------------------------------
ASCOM.Astrometry
    Sammansättningsversion: 6.0.0.0
    Win32-version: 6.1.1.2627
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/ASCOM.Astrometry/6.0.0.0__565de7938946fba7/ASCOM.Astrometry.dll
----------------------------------------
System.Windows.Forms.resources
    Sammansättningsversion: 2.0.0.0
    Win32-version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_sv_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
************** JIT-felsökning **************
För att aktivera JIT-felsökning (just-in-time ) måste .config-filen för
det här tillämpningsprogrammet eller datorn (machine.config) ha 
jitDebugging-värdet angivet i avsnittet system.windows.forms.
Tillämpningsprogrammet måste också vara kompilerat
med felsökning aktiverat.
Till exempel:
<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>
När JIT-felsökning är aktiverad kommer alla undantag som inte
hanteras att skickas till JIT-felsökaren som är registrerad på
datorn snarare än att hanteras av den här dialogrutan.
/Daniel
Edited by Corpze
Link to comment
Share on other sites

I have the driver's serial timeout at 1 second, works fine here, but a bet the sensors hold things up the way your firmware is designed.  I've changed the driver serial timeout to 3 seconds.  Also added a way to control the threshold.  Will upload soon.

Also be sure to update your firmware.

Link to comment
Share on other sites

Is perhaps to CPU heavy to use a float?

No the Arduino is plenty fast.

i am currently modifying your CloudSensorEvoPlus.ino instead of mine code, but i am out on deep water here, a lot of new type of coding for me :D

Good

I will experiment with 15 average readings instead of 300 to speed it up a bit.

Not a bad idea

I put the average formula at the top-ish but i do not understand where the print is...

Not the whole formula, just declare the variable and assign a value.  This is already done on my current GitHub firmware. 

So you just need to leave the formula where it was, right after delta_celsius is calculated, it should look like:

avg_delta_celsius = (avg_delta_celsius*14.0+delta_celsius)/15.0;

The Command.ino file has a function named processCommands() which gets called over and over again in your main loop.  It takes input from the serial port, waits for an entire command to arrive, and then processes it (which often leads to a print.)

Link to comment
Share on other sites

I have tried the new fw and it works better, no microsoft.net error at all

but it is still UnSafe, despite a delta temp of 30 degrees, well above 21

I hope i got the code right-ish  :rolleyes: ;

/*** This sketch reads three sensors:*  DS18B20 - Connected to D10*  MLX90614 - Connected to SCL-A5, SDA-A4*  Rain sensor conected to A0* It calculates the temperatures (DS18B20 and MLX90614)* DS18B20: http://playground.arduino.cc/Learning/OneWire* MLX90614: http://bildr.org/2011/02/mlx90614-arduino/*/#define DEBUG_MODE_OFF#ifdef DEBUG_MODE_OFF//get it here: http://www.pjrc.com/teensy/td_libs_OneWire.html#include <OneWire.h>#include <i2cmaster.h>#include <SPI.h>#endif// lowest and highest rain sensor readings:const int sensorMin = 0;     // sensor minimumconst int sensorMax = 1024;  // sensor maximum// misc#define FirmwareName "CloudSensorEvoPlus"#define FirmwareNumber "0.1"#define invalid -999#define CHKSUM0_OFF// last rain sensor readingint rainSensorReading = invalid;// last cloud sensor readingfloat ds18b20_celsius = invalid;float MLX90614_celsius = invalid;float delta_celsius = invalid;#ifdef DEBUG_MODE_OFFOneWire  ds(10);  // DS18B20 on Arduino pin 10#endifbyte ds18b20_addr[8];void setup(void) {  Serial.begin(9600);  init_DS18B20();  init_MLX90614();}void init_DS18B20(){//  Serial.println("Initializing DS18B20 sensor...");#ifdef DEBUG_MODE_OFF  while( !ds.search(ds18b20_addr))   {    ds.reset_search();    delay(250);  }#endif}void init_MLX90614(){//  Serial.println("Initializing MLX90614 sensor...");#ifdef DEBUG_MODE_OFF  i2c_init(); //Initialise the i2c bus#endif  //  PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups if you use 5V sensors and don't have external pullups in the circuit}long last = 0;void loop(void) {  long now=millis();  // gather data from sensors once a second  if ((now%1000==0) && (last!=now)) {    last=now; // blocks calling more than once during the same ms    // Cloud sensor ------------------------------------------------------------    // it might be a good idea to add some error checking and force the values to invalid if something is wrong    #ifdef DEBUG_MODE_OFF    ds18b20_celsius = read_DS18B20();    MLX90614_celsius = read_MLX90614();    delta_celsius = abs(ds18b20_celsius - MLX90614_celsius);    float avg_delta_celsius = (avg_delta_celsius*14.0+delta_celsius)/15.0;    #endif    // End cloud sensor    // Rain sensor -------------------------------------------------------------    // it might be a good idea to add some error checking and force the values to invalid if something is wrong    // read the sensor on analog A0:    int sensorReading = analogRead(A0);      // map the sensor range (four options):    // ex: 'long int map(long int, long int, long int, long int, long int)'    rainSensorReading = map(sensorReading, sensorMin, sensorMax, 0, 3);    // End rain sensor  }  processCommands();}#ifdef DEBUG_MODE_OFFfloat read_DS18B20(){  byte i;  byte present = 0;  byte type_s;  byte data[12];  float celsius;  if (OneWire::crc8(ds18b20_addr, 7) != ds18b20_addr[7])   {    Serial.println("CRC is not valid!");    return -300.0f;  }  // the first ROM byte indicates which chip  switch (ds18b20_addr[0])   {  case 0x10: type_s = 1; break;  case 0x28: type_s = 0; break;  case 0x22: type_s = 0; break;  default:    return -301.0f;  }   ds.reset();  ds.select(ds18b20_addr);  ds.write(0x44, 1);        // start conversion, with parasite power on at the end  delay(1000);     // maybe 750ms is enough, maybe not  // we might do a ds.depower() here, but the reset will take care of it.  present = ds.reset();  ds.select(ds18b20_addr);      ds.write(0xBE);         // Read Scratchpad  //read 9 data bytes  for ( i = 0; i < 9; i++)   {    data[i] = ds.read();  }  // Convert the data to actual temperature  int16_t raw = (data[1] << 8) | data[0];  if (type_s)   {    raw = raw << 3; // 9 bit resolution default    if (data[7] == 0x10) {      // "count remain" gives full 12 bit resolution      raw = (raw & 0xFFF0) + 12 - data[6];    }  }   else   {    byte cfg = (data[4] & 0x60);    // at lower res, the low bits are undefined, so let's zero them    if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms    else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms    else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms    //// default is 12 bit resolution, 750 ms conversion time  }  celsius = (float)raw / 16.0;  return celsius;}float read_MLX90614(){  int dev = 0x5A<<1;  int data_low = 0;  int data_high = 0;  int pec = 0;  i2c_start_wait(dev+I2C_WRITE);  i2c_write(0x07);  // read  i2c_rep_start(dev+I2C_READ);  data_low = i2c_readAck(); //Read 1 byte and then send ack  data_high = i2c_readAck(); //Read 1 byte and then send ack  pec = i2c_readNak();  i2c_stop();  //This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps  double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)  double tempData = 0x0000; // zero out the data  int frac; // data past the decimal point  // This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.  tempData = (double)(((data_high & 0x007F) << 8) + data_low);  tempData = (tempData * tempFactor)-0.01;  float celcius = tempData - 273.15;  return celcius;}#endif
Link to comment
Share on other sites

Here's what (I think) you need.  It's on GitHub now.  Remember to get the latest Command.ino too, otherwise my ASCOM driver can't correctly read the "avg_delta_celsius" value.

/*** This sketch reads three sensors:*  DS18B20 - Connected to D10*  MLX90614 - Connected to SCL-A5, SDA-A4*  Rain sensor conected to A0* It calculates the temperatures (DS18B20 and MLX90614)* DS18B20: http://playground.arduino.cc/Learning/OneWire* MLX90614: http://bildr.org/2011/02/mlx90614-arduino/*/#define DEBUG_MODE_OFF#ifdef DEBUG_MODE_OFF//get it here: http://www.pjrc.com/teensy/td_libs_OneWire.html#include <OneWire.h>//get it here: http://jump.to/fleury#include <i2cmaster.h>#include <SPI.h>#endif// lowest and highest rain sensor readings:const int sensorMin = 0;     // sensor minimumconst int sensorMax = 1024;  // sensor maximum// misc#define FirmwareName "CloudSensorEvoPlus"#define FirmwareNumber "0.1"#define invalid -999#define CHKSUM0_OFF// last rain sensor readingint rainSensorReading = invalid;// last cloud sensor readingfloat ds18b20_celsius = invalid;float MLX90614_celsius = invalid;float delta_celsius = invalid;float avg_delta_celsius = 21.5;#ifdef DEBUG_MODE_OFFOneWire  ds(10);  // DS18B20 on Arduino pin 10#endifbyte ds18b20_addr[8];void setup(void) {  Serial.begin(9600);  init_DS18B20();  init_MLX90614();}void init_DS18B20(){//  Serial.println("Initializing DS18B20 sensor...");#ifdef DEBUG_MODE_OFF  while( !ds.search(ds18b20_addr))   {    ds.reset_search();    delay(250);  }#endif}void init_MLX90614(){//  Serial.println("Initializing MLX90614 sensor...");#ifdef DEBUG_MODE_OFF  i2c_init(); //Initialise the i2c bus#endif  //  PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups if you use 5V sensors and don't have external pullups in the circuit}long last = 0;void loop(void) {  long now=millis();  // gather data from sensors once a second  if ((now%1000==0) && (last!=now)) {    last=now; // blocks calling more than once during the same ms    // Cloud sensor ------------------------------------------------------------    // it might be a good idea to add some error checking and force the values to invalid if something is wrong    #ifdef DEBUG_MODE_OFF    ds18b20_celsius = read_DS18B20();    MLX90614_celsius = read_MLX90614();    delta_celsius = abs(ds18b20_celsius - MLX90614_celsius);    avg_delta_celsius = ((avg_delta_celsius*299.0) + delta_celsius)/300.0;    #endif    // End cloud sensor    // Rain sensor -------------------------------------------------------------    // it might be a good idea to add some error checking and force the values to invalid if something is wrong    // read the sensor on analog A0:    int sensorReading = analogRead(A0);      // map the sensor range (four options):    // ex: 'long int map(long int, long int, long int, long int, long int)'    rainSensorReading = map(sensorReading, sensorMin, sensorMax, 0, 3);    // End rain sensor  }  processCommands();}#ifdef DEBUG_MODE_OFFfloat read_DS18B20(){  byte i;  byte present = 0;  byte type_s;  byte data[12];  float celsius;  if (OneWire::crc8(ds18b20_addr, 7) != ds18b20_addr[7])   {    Serial.println("CRC is not valid!");    return -300.0f;  }  // the first ROM byte indicates which chip  switch (ds18b20_addr[0])   {  case 0x10: type_s = 1; break;  case 0x28: type_s = 0; break;  case 0x22: type_s = 0; break;  default:    return -301.0f;  }   ds.reset();  ds.select(ds18b20_addr);  ds.write(0x44, 1);        // start conversion, with parasite power on at the end  delay(1000);     // maybe 750ms is enough, maybe not  // we might do a ds.depower() here, but the reset will take care of it.  present = ds.reset();  ds.select(ds18b20_addr);      ds.write(0xBE);         // Read Scratchpad  //read 9 data bytes  for ( i = 0; i < 9; i++)   {    data[i] = ds.read();  }  // Convert the data to actual temperature  int16_t raw = (data[1] << 8) | data[0];  if (type_s)   {    raw = raw << 3; // 9 bit resolution default    if (data[7] == 0x10) {      // "count remain" gives full 12 bit resolution      raw = (raw & 0xFFF0) + 12 - data[6];    }  }   else   {    byte cfg = (data[4] & 0x60);    // at lower res, the low bits are undefined, so let's zero them    if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms    else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms    else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms    //// default is 12 bit resolution, 750 ms conversion time  }  celsius = (float)raw / 16.0;  return celsius;}float read_MLX90614(){  int dev = 0x5A<<1;  int data_low = 0;  int data_high = 0;  int pec = 0;  i2c_start_wait(dev+I2C_WRITE);  i2c_write(0x07);  // read  i2c_rep_start(dev+I2C_READ);  data_low = i2c_readAck(); //Read 1 byte and then send ack  data_high = i2c_readAck(); //Read 1 byte and then send ack  pec = i2c_readNak();  i2c_stop();  //This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps  double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)  double tempData = 0x0000; // zero out the data  int frac; // data past the decimal point  // This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.  tempData = (double)(((data_high & 0x007F) << 8) + data_low);  tempData = (tempData * tempFactor)-0.01;  float celcius = tempData - 273.15;  return celcius;}#endif

IsSafe in the ASCOM Driver is implemented as follows:

        public bool IsSafe        {            get            {                if (!IsConnected)                {                    tl.LogMessage("IsSafe Get", "false (not connected)");                    return false;                }                string reply = CommandString(":GS#", true);                double cloud=Convert.ToDouble(reply, CultureInfo.GetCultureInfo("en-us"));                reply = CommandString(":GR#", true);                int rain = Convert.ToInt16(reply, CultureInfo.GetCultureInfo("en-us"));                if ((rain <= 0) || (cloud < -200))                {                    tl.LogMessage("IsSafe Get", "false  (rain or cloud value invalid)");                    return false;                }                if ((rain == 1) || (cloud <= threshold))                {                    tl.LogMessage("IsSafe Get", "false  (rain or cloud threshold exceeded)");                    return false;                }                tl.LogMessage("IsSafe Get", "true");                return true;            }        }
Link to comment
Share on other sites

I most certenly will.

Right now, i have all sensors loose on my desk, i have ordered a waterproof enclosure, so i won't be able to test it under the sky in a couple of weeks.

I am also wondering of how it will handle negative celsius reading, for instance -50C cloud temp and -20C ambiant.

/Daniel

Link to comment
Share on other sites

Yea i think so too.

All seems to work pretty good, except one thing, if i choose the right driver and sets the right properties, press ok, it runs good.

But if i open up the "choose ascot driver" dialog and choose CloudSensorEvoPlus - properties, it is as it can't read the values. But if i close down the dialog box, it seems that my sequence program keeps on getting "SafeMon: OK". 

Link to comment
Share on other sites

I have been reading a bit bout cloud detecting to fine tune the settings.

The IR Sensor

There is several different FOV for the MLX90614 sensor, this effects how many avg_delta_celsius we have to take to be sure that there are cloud present, and not just a quick cirrus residue making the Cloud sensor trigger a "Not Safe" command.

Here is the PDF for the Malexis 90614 family. Download DataSheet Now

For now, we have set the avg_delta_celsius value to be calculated from 300 delta_celsius values, or about 10 minutes (one reading every 2 seconds)

This might be a good number if you have a very narrow FOV (the version with the smallest FOV is 5 degrees.)

Note that the sensor itself calculates an average over the entire FOV.

If we use a FOV that is very large (the version with the biggest FOV is 90 degrees) maybe there is no need to make an average of 300 values, but maybe 100 (total 200 seconds in time)

Here are the different sensor and their FOV:

post-28724-0-50564000-1438414385.png

Cloud Detection

Ok, so what we are doing is taking a temperature reading of the sky, if there is no cloud that is. 

If there is cloud present, we are taking a temp reading of that cloud.

I have spent hours trying to find any good scientific papers regarding cloud vs sky temp but haven't found anything...

The delta 21-25 degree came up when i searched about ir cloud sensor.

If anyone know more about this or have stumbled upon some papers about this, feel free to post the links :D

I have found a sky temp chart, illustrating the sky temp vs altitude and it is fairly linear, thats good, easy to work with :)

post-28724-0-80713100-1438424143.jpg

/ Daniel

Link to comment
Share on other sites

Meanwhile searching for realiable sources of cloud temp etc. i have tested the rain sensor a bit more, it seems that it is far less sensitive that is has to be.

  1. When placing one droplet of water on the sensor, it reports damp, that is fine, but even after seven drops of water it reports "Damp", I woul'd rather have it report "Raining" after fewer drops. Parhaps one could implement a sensitivity slider for the rain sensor as well?
     
  2. Even when the driver sais "Raining", the safety monitor reports OK... I do not know if this has to do with my Sequence program or if there is som miss-comminucation with the driver though :/

    /Daniel



     
Edited by Corpze
Link to comment
Share on other sites

Yea i think so too.

All seems to work pretty good, except one thing, if i choose the right driver and sets the right properties, press ok, it runs good.

But if i open up the "choose ascot driver" dialog and choose CloudSensorEvoPlus - properties, it is as it can't read the values. But if i close down the dialog box, it seems that my sequence program keeps on getting "SafeMon: OK". 

You can't configure/access properties while it's connected too, each mode of operation takes over the serial port so the other can't access it at the same time.  I'm not even sure it's a good idea to overcome this behaviour.

I think your one reading every two seconds is a good estimate.

Did you see this?  Somewhat dated but some useful info:

http://www.atnf.csiro.au/pasa/15_3/clay/paper.pdf

Howard

Link to comment
Share on other sites

Ok, that seems logical.

I have read that report and it also points out (very rough) that there is a 20-ish Celsius difference when the sky is clear, its a good starting point, i might have to wait until i can mount the hardware in a waterproof box and test it out myself, at least, we have a lot of clouds to test in on.

Link to comment
Share on other sites

I have spent hours trying to find any good scientific papers regarding cloud vs sky temp but haven't found anything...

The delta 21-25 degree came up when i searched about ir cloud sensor.

If anyone know more about this or have stumbled upon some papers about this, feel free to post the links :D

Have a look at this: http://www.caha.es/WDXI/CLOUDS/clouds_info.php which is used at Calar Alto as part of their environmental monitoring.

I just wish I could get their level of seeing

20150726_seeing.gif

but I suppose that's what altitude is for :smiley:

Link to comment
Share on other sites

Meanwhile searching for realiable sources of cloud temp etc. i have tested the rain sensor a bit more, it seems that it is far less sensitive that is has to be.

  1. When placing one droplet of water on the sensor, it reports damp, that is fine, but even after seven drops of water it reports "Damp", I woul'd rather have it report "Raining" after fewer drops. Parhaps one could implement a sensitivity slider for the rain sensor as well?

     

  2. Even when the driver sais "Raining", the safety monitor reports OK... I do not know if this has to do with my Sequence program or if there is som miss-comminucation with the driver though :/

    /Daniel

     

Testing the driver/firmware Rain detection:

I forced the value returned by :GR# command to both 1 and 3 and all functions in the ASCOM driver and it's setup dialog worked as expected.  Not sure what's going wrong for you.  The "driver" is ? the ASCOM driver setup dialog? The ASCOM driver IsSafe() function?  The Firmware?

I'll add a slider for the min/maxSensitivity and change the :GR# command to return the value read from the Analog pin.  It'll be a day or two.

Howard

Link to comment
Share on other sites

Testing the driver/firmware Rain detection:

I forced the value returned by :GR# command to both 1 and 3 and all functions in the ASCOM driver and it's setup dialog worked as expected. Not sure what's going wrong for you. The "driver" is ? the ASCOM driver setup dialog? The ASCOM driver IsSafe() function? The Firmware?

I'll add a slider for the min/maxSensitivity and change the :GR# command to return the value read from the Analog pin. It'll be a day or two.

Howard

Sorry,, forgot to specify, the setup dialog sais raining and declares a "Not safe" but my sequence program does not get updated with "not safe" but instead sais OK.

The firmware seems to work because the setup dialog box gets updated as it should, it semms to be the communication between the driver and my sequence program...

That info from the link is spot on, exactly what i was looking for, nice seeing also :-D

I've actually measured 0,9 Arcseconds in my hometown once :-)

/Daniel

Edited by Corpze
Link to comment
Share on other sites

Sorry,, forgot to specify, the setup dialog sais raining and declares a "Not safe" but my sequence program does not get updated with "not safe" but instead sais OK.

The firmware seems to work because the setup dialog box gets updated as it should, it semms to be the communication between the driver and my sequence program...

That info from the link is spot on, exactly what i was looking for, nice seeing also :-D

I've actually measured 0,9 Arcseconds in my hometown once :-)

/Daniel

So... you select my ASCOM driver in the sequence program, connect to my ASCOM driver (setup dialog not open,) and the sequence program only indicates safe when the rain sensor is set to wet?

Does the sequence program indicate un-safe if the cloud sensor exceeds the threshold?

Link to comment
Share on other sites

So... you select my ASCOM driver in the sequence program, connect to my ASCOM driver (setup dialog not open,) and the sequence program only indicates safe when the rain sensor is set to wet?

Does the sequence program indicate un-safe if the cloud sensor exceeds the threshold?

Not quite (bad at explaining)

When i first open up my sequence program, i choose your ASCOM driver and check the settings in the dialog, all values are correct (higher delta than 21 degrees and not raining) - Is Safe, i then press ok and closes ASCOM chooser box.

The sequence program indicates Safe - everything is in order.

I then open up the ASCOM chooser and setup dialog and maybe here is what is wrong (that i am opening it again) - when i do this, i cannot see the values in the setup dialog from the Hardware, it display N/A at all values.

This is what i came up with during som more tests;

Assumed sensor values (can't check them)                  Sequence program
Dry                                                                                      - Safe, i than applied water (read next line)
Rain                                                                                    - Still reports Safe
Delta lower than 21                                                             - Not Safe, i than applied heat to the sensor making it (next line)
Delta higher than 21                                                            - Still reports Not safe, even after 10minutes with heat present to make a high delta
In conclusion;
Applied water before choosing ASCOM driver, opened setup dialog, that said Not safe,
 pressed ok and now the sequence program sais Not OK - as it should
I than dried off the rain sensor, the sequence program still sais Not ok. I cannot now open the setup dialog because it
can't display the values (N/A)
I don´t know if it is the sequence program that is not updating the values or the driver :/

/ D

Edited by Corpze
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.