Jump to content

Sketches

DIY cloud and rain sensor with ascom support?


Corpze
 Share

Recommended Posts

Ok, so we now know that something's wrong with the Nano/hardware/firmware somewhere.  I'm assuming that it's compiling correctly...

It's probably getting hung up in initialization somewhere....

You could do some spying on what's going on by un-commenting the following lines in CloudSensorEvoPlus:

//  Serial.println("Initializing DS18B20 sensor...");

//  Serial.println("Initializing MLX90614 sensor...");

Just remove the // part and upload again.  You can't use my ASCOM driver when these lines are enabled but they will provide some feedback from the serial monitor.  For, example if the DS18B20 message comes up but not the MLX90614 then it's getting stuck trying to find the DS18B20 (my guess.)

Howard

Link to comment
Share on other sites

Ok, so we now know that something's wrong with the Nano/hardware/firmware somewhere.  I'm assuming that it's compiling correctly...

It's probably getting hung up in initialization somewhere....

You could do some spying on what's going on by un-commenting the following lines in CloudSensorEvoPlus:

//  Serial.println("Initializing DS18B20 sensor...");

//  Serial.println("Initializing MLX90614 sensor...");

Just remove the // part and upload again.  You can't use my ASCOM driver when these lines are enabled but they will provide some feedback from the serial monitor.  For, example if the DS18B20 message comes up but not the MLX90614 then it's getting stuck trying to find the DS18B20 (my guess.)

Howard

Hi Howard,

Got the following feedback from the serial monitor

Initializing DS18B20 sensor...
Initializing MLX90614 sensor...
Steve
Link to comment
Share on other sites

Well, so much for my first guess.  There was an obvious potential for an infinite loop in the DS18B20 init. code.

Next guess would be one of these lines:

    ds18b20_celsius = read_DS18B20();
    MLX90614_celsius = read_MLX90614();
 

If you could add // before both of these lines to comment them out and run again.  You'll have send :IP# to see if it's working.  If it works then try them one at a time to see which one did it.

Link to comment
Share on other sites

Another good check is that it returned from the MLX90614 init.  change the setup() function to add the println as shown below:

void setup(void)
{
  Serial.begin(9600);

  init_DS18B20();
  init_MLX90614();

  Serial.println("Init. Done.");
}
 

Link to comment
Share on other sites

Well, so much for my first guess.  There was an obvious potential for an infinite loop in the DS18B20 init. code.

Next guess would be one of these lines:

    ds18b20_celsius = read_DS18B20();

    MLX90614_celsius = read_MLX90614();

If you could add // before both of these lines to comment them out and run again.  You'll have send :IP# to see if it's working.  If it works then try them one at a time to see which one did it.

Hi Howard,

Both OK

   ds18b20_celsius = read_DS18B20();

// MLX90614_celsius = read_MLX90614();  OK

// ds18b20_celsius = read_DS18B20();

   MLX90614_celsius = read_MLX90614();  Nothing.......

Steve

Link to comment
Share on other sites

Did you try adding that line println() as shown below, need this to see if we returned from the init_MLX90614();  function:

void setup(void)
{
  Serial.begin(9600);

  init_DS18B20();
  init_MLX90614();

  Serial.println("Init. Done.");
}
 

My next step would be to put a Serial.print("."); within the main loop so it prints once a second to see that the processor made it there.

It can take persistence, but there is a reason why it's working and it can be found, if taken step by step.

Link to comment
Share on other sites

Did you try adding that line println() as shown below, need this to see if we returned from the init_MLX90614();  function:

void setup(void)

{

  Serial.begin(9600);

  init_DS18B20();

  init_MLX90614();

  Serial.println("Init. Done.");

}

My next step would be to put a Serial.print("."); within the main loop so it prints once a second to see that the processor made it there.

It can take persistence, but there is a reason why it's working and it can be found, if taken step by step.

Hi Howard,

i'll try the setup when I get back home from work and let you know the results.

Just try and change the SDA and SCL, it doesn't damage anything and takes a second... And you have the 3V and ground connected right i assume.

/Daniel

Hi Daniel,

I've tried the sda / scl swop. It's connected to 3v and I'll check continuity on all connections. Also, units led power is on.

Steve

Edited by sloz1664
Link to comment
Share on other sites

My rain sensor has been running outside without a single hickup*, the rain sensor threshold was adjusted to 99% dry and 98% wet. I think this has to do with the larger contact-stripes on this model vs the "retail" sensors out there.
The driver setup dialog always "indicates" "overcast or fog" - even when there is clear sky.

So, it has been working very good, the last test is on a actual image run - with the "safety monitor" activated.

* The only hickup was when it good flooded and died :embarrassed: ... again :sad: 
Sealing is IMPORTANT.... the cloud sensor is in the oven for 60 min @50 degrees celsius, or when it´s golden brown  :tongue: 
Hope it's still alive

The DIY heaven is amazing some times.

Over and out 

Link to comment
Share on other sites

Hi Howard,

Did you try adding that line println() as shown below, need this to see if we returned from the init_MLX90614();  function:

 

void setup(void)
{
  Serial.begin(9600);

  init_DS18B20();
  init_MLX90614();


  Serial.println("Init. Done.");
}

 

Init. Done  - feed back from serial monitor

 

Sorry Howard, how do I   put a Serial.print("."); within the main loop so it prints once a second to see that the processor made it there.

 

Steve

Link to comment
Share on other sites

Just add it as indicated below:

  // gather data from sensors once a second
  if ((now%1000==0) && (last!=now)) {
    Serial.print(".");

    last=now; // blocks calling more than once during the same ms

 

Weird, it's getting hard to believe that it's not responding to the :IP# command, you did hit Enter or the send button yes?

Link to comment
Share on other sites

Ok Howard,

Tried to get back to this last night but a family gathering curtailed that....

Inputted the following yellow text. 

  // gather data from sensors once a second
  if ((now%1000==0) && (last!=now)) {
    Serial.print(".");

 

    last=now; // blocks calling more than once during the same msOk inputted 

opened the searal monitor, typed :IP# and pressed send.

feed back from serial monitor

Init.Done.

.

cheers

It returned with:-

Link to comment
Share on other sites

I'll be away this weekend but we're getting somewhere...

That "." should print once a second, over and over.  the stuff between the braces {} as follows

void loop(void)

{

};

in the program gets run one line after another, over and over,  except the stuff in the "if" statement braces is blocked from running for all but once time a second (generally.)  

Next step will be moving the

Serial.print(".");

you just added down in the sequence of statements until you don't see the "." print.  What ever line in the code that's then immediately above it caused the program to lock.

Link to comment
Share on other sites

I hardly believe the code is the problem... if you use the latest code on hdutton's github, it should work.
What kind of hardware do you use? Maybe you have the links to the supplier?

Your cloud and rain sensor behaves exactly as mine, when there was i wire connected wrong, or some sensor not responded etc. 
Can you take a picture of your hardware?

I actually got mine working again, even though it was totally drenched in water. i have now sealed the box even more (wish me luck) and it is up and running again :)

Link to comment
Share on other sites

post-12560-0-42941800-1441461185_thumb.j

I hardly believe the code is the problem... if you use the latest code on hdutton's github, it should work.
What kind of hardware do you use? Maybe you have the links to the supplier?

Your cloud and rain sensor behaves exactly as mine, when there was i wire connected wrong, or some sensor not responded etc. 
Can you take a picture of your hardware?

I actually got mine working again, even though it was totally drenched in water. i have now sealed the box even more (wish me luck) and it is up and running again :)

Hi Daniel

The components I purchased were these:-

MLX 90614 - http://www.ebay.co.uk/itm/MLX90614-Contactless-IR-infrared-Close-Temperature-Sensor-Module-for-Arduino-/262011525748?

Rain Detector - http://www.ebay.co.uk/itm/171823749829

DS18B20 - http://www.ebay.co.uk/itm/DS18B20-Waterproof-Digital-Probe-Temperature-Sensor-Thermometer-Thermal-Module-/281392057533?hash=item4184460cbd

Rain Sensor:  R1,R2 connected to board. VCC (red wire) to 5v. GND (brown wire) connected to GND. A0 (grey wire) to A0.

DS18B20:  Signal to D10 (coupled with 4k7 resistor to 5v. GND wire to GND. VCC to 5v.

I have also connected it in parasitic mode VCC + GND to GND. Signal to D10 (coupled with 4k7 resistor to 5v).

I know the DS18B20 works as I connected it in the AAF2 Focuser circuit and it's registering temp.

MLX 90614:  GND (black wire) to GND. VCC (grey wire) to 3v. SDA (yellow wire) to A4. SCL (red wire) to AS.

BTW. I find covering everything in clear silicon stops any rain getting in.... but if you need to get access to any of the internal components  :eek:

Steve

Link to comment
Share on other sites

I hardly believe the code is the problem... if you use the latest code on hdutton's github, it should work.

What kind of hardware do you use? Maybe you have the links to the supplier?

Your cloud and rain sensor behaves exactly as mine, when there was i wire connected wrong, or some sensor not responded etc. 

Can you take a picture of your hardware?

I actually got mine working again, even though it was totally drenched in water. i have now sealed the box even more (wish me luck) and it is up and running again :)

I totally agree, I doubt the code is the problem too... but this debugging exercise can probably identify the problem causing device attached.

This firmware really needs a once over to make it more "robust" against component failures... if something stops working it shouldn't silently fail or hang the device....  I probably will revisit this aspect one day, but my hobby time is spread very thin for now.

Link to comment
Share on other sites

When i was debugging ( not the way to go with the firmware though) i was simply uploading a IDE for each sensor, testing them one by one.
My Cloud and Rain sensor are now working wonderful again, even under a thunderstorm and heavy rain for about 4-5hrs.
:)

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
 Share

×
×
  • 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.