Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5

measure height of snow
#11

Hi engolling,

I think it would be interesting for many users of this forum - for example for me  Smile

Best Regards
Zdenek

Brandys/L Weather
Reply
#12

I am very interested in this method of measurement.

thanks
Reply
#13
Information 

Thank you for your interest.
During the last years - unfortunately winter and snow is only at a limited period I tried to get a working snow depth measurement.


  1. "Optical measurement" with an array of photo diodes. 
    My first try was to bulid an vertically aligned array of photo diodes in order to get an changement of the brightness when under snow. The test device was 1m high with 50 diodes every 2cm. Because I did not get suitable readings i added an array of IR LEDs in a distance of about 2m to illuminate the diodes.I'm still thinking this should have worked, but it's now about 5 years ago. Maybe I made some other mistake in multiplexing the diodes...
    So, first try: failed

  2. Optical measurement with a scale like a flood marker, every 2cm black and white marks.
    I built a scale and pointed with a (IR) camera on it to make a picture in order to analyze it with a python script. Here I faced the problem with different gray scales during day and night. Since I am not as deep in image processing than in hardware I didn't it get to work properly...
    Second try: failed

  3. Ultrasonic measurement. I built a ultrasonic measurement device in a case and set it up on my own built station.
    Mounted in 150cm height it generated a noise between -4cm and 24cm shown height. Lowered to about 100cm height the noise lowered to about 5cm. Left outside at the Station I soon got wrong readings maybe due to rain or wetness. The electronic part even was mounted in a water proof housing but the ultrasonic Generator and Receiver necessarily were exposed to the environment.
     At some Point I did not get any longer (wrong) readings. I think the sensor has been destroyed due to environmental influence.Third try: failed
    [Image: 31221858ld.jpg]

  4. So I did some investigation how weather services do a snow height measurement and I found out that it is done by a laser ranging system. With this knowledge I searched a supplier of commercial laser ranging systemes, used for example at construction sites. Here I found the company were I could sample a device which allowes to be read over a serial Interface. The supplier even gave me the comunication protocol and all information I needed to read it with my arduino. Mounted in a waterproof housing I can achieve very precise readings (see pictures).

    [Image: 31221809aj.jpg]

    [Image: 31221870cw.jpg]
I still have a quotation from the supplier, but I would have to take 100pcs which cost about 20 EUR per Piece including VAT.
So if there is a huge demand we could think of a collective order, but I don't want to have 100 laser ranging devices liying at home.  Rolleyes


Since I'm tired in working and debugging alone in my weather station software I'm planning to switch to WeatherDuino and to contribute with some sensor development.
Reply
#14

(12-12-2017, 22:17)engolling Wrote:  I still have a quotation from the supplier, but I would have to take 100pcs which cost about 20 EUR per Piece including VAT.
So if there is a huge demand we could think of a collective order, but I don't want to have 100 laser ranging devices liying at home.  Rolleyes

Since I'm tired in working and debugging alone in my weather station software I'm planning to switch to WeatherDuino and to contribute with some sensor development.

Hi engolling,

We can not expect such numbers ...  Rolleyes
But otherwise -> good work!

Unfortunately, Werk_AG is totally busy and will probably be a long time. And I do not know whether
anyone else would do "some" integration. On the other hand, we can try at least to put the read data
on the web and to process it - it should not be such a big problem. And the others we will see ...

Can you publish more details?

Best Regards
Zdenek

Brandys/L Weather
Reply
#15

Hi Zdenek,

Quote:Unfortunately, Werk_AG is totally busy and will probably be a long time.

As usual in this season of the year, my professional job, is requesting all of my time.


The problem with any "intregation" is: We can add almost any kind of sensor that we want to the WeatherDuino, but we can't "integrate" everything that we may want in the Davis Emulation. Mapping things to the Davis Extra sensors have huge limitations, and its not a solution for everything, as the data field have only 1 byte (integers values from 0 to 255).
By other words, we can show anything on the screen, but we can't pass anything to a PC or a PI, because to do it we need to follow the Davis Serial protocol, its it that deals with the comunication between the WeatherDuino and the PC or PI (no mather the software we use).
Reply
#16

(12-12-2017, 22:17)engolling Wrote:  Since I'm tired in working and debugging alone in my weather station software I'm planning to switch to WeatherDuino and to contribute with some sensor development.

Hello engolling,
Welcome to the forum. Independently if your sensor can or not be integrated in the WeatherDuino system, I'm also interested in following your developments.

Reply
#17

(13-12-2017, 05:36)Werk_AG Wrote:  The problem with any "intregation" is: We can add almost any kind of sensor that we want to the WeatherDuino, but we can't "integrate" everything that we may want in the Davis Emulation. Mapping things to the Davis Extra sensors have huge limitations, and its not a solution for everything, as the data field have only 1 byte (integers values from 0 to 255).
By other words, we can show anything on the screen, but we can't pass anything to a PC or a PI, because to do it we need to follow the Davis Serial protocol, its it that deals with the comunication between the WeatherDuino and the PC or PI (no mather the software we use).

Hi Werk_AG,

That's absolutely clear to me - even though I did not write it ...  Smile

Best Regards
Zdenek

Brandys/L Weather
Reply
#18

I think an integration on the TX unit of weatherduino would be easy possible, if the UART interface ist not used.
At the moment I simply send a scheduled request over uart to the device and poll the results from the uart rx buffer 5 seconds later. It would be better and more efficient to use an interrupt since the measurement takes accordiung to the outer condition a different amount of time. But this could be added easily.

I will give you more details in the evening.

Concerning the davis emulation using the Input of an "extra sensor" is OK because you can measure up to 255cm snow height. Think this is fairly enough in most cases. Moreover a scaling with factor 2 would be imagineable...
Actually I "stole" your davis emulation code to use it in my software at the moment to communicate with CumulusMX running on a PI. Moreover I use a second UART to send all the raw values with full precision as ASCII string to a Server. There I'm generating the graphs and debugging the stuff and evaluate the sensors.

PS. Somewhere is written, that the WeatherDuino supports different 433MHZ rx/tx modules. Is there anywhere a thread where I can see the supported modules? Because I want to set up a decentralized sensor Network and therefore I Need quite some transmission power. Moreover I will start  new thread, maybe during the christmas holidays, introducing the sensors I'm using at the moment and my ideas

Regards,
engolling
Reply
#19

(13-12-2017, 09:45)engolling Wrote:  PS. Somewhere is written, that the WeatherDuino supports different 433MHZ rx/tx modules. Is there anywhere a thread where I can see the supported modules? Because I want to set up a decentralized sensor Network and therefore I Need quite some transmission power. Moreover I will start  new thread, maybe during the christmas holidays, introducing the sensors I'm using at the moment and my ideas

Hi again,

Maybe these will be usefull for you:

http://www.meteocercal.info/forum/Thread...Parts-List

http://www.meteocercal.info/forum/Thread...o-Buy-RXB6

https://www.ebay.com/sch/i.html?_from=R4...6&_sacat=0

Best Regards
Zdenek

Brandys/L Weather
Reply
#20

As promised here some more information about the laser range meter.
Attached you can find a protocol overview.

The following code sends the request to the laser device:

Code:
 //Define laser measurement on USART2
#define LASER_POWER_PIN 25
#define LASER_START_PIN 24
#define LASER_HEIGHT 1986
#define LASER_LATENCY 1999 //time for laser to answer in ms
int16_t laser_distance_array[SNOW_ARRAYSIZE] = { -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200};
uint8_t laser_distance_array_ind = 0;
uint8_t laser_wd;
uint32_t LaserReqtime;
uint8_t LaserFlag = 0;
union laser_send_data_t {
  struct bytes_t {
    uint8_t preamble;
    uint8_t command;
    uint8_t data[3];
    uint8_t check_code[2];
  } bytes;
  uint8_t array[sizeof(bytes)];
} laser_send_data;
union laser_rcv_data_t {
  struct bytes_t {
    uint8_t preamble;
    uint8_t command;
    uint8_t result;
    uint8_t data[3];
    uint8_t check_code[2];
  } bytes;
  uint8_t array[sizeof(bytes)];
} laser_rcv_data;


  pinMode(LASER_POWER_PIN, OUTPUT);
 pinMode(LASER_START_PIN, OUTPUT);
 digitalWrite(LASER_POWER_PIN, HIGH);
 digitalWrite(LASER_START_PIN, HIGH);
 delay(50);
 digitalWrite(LASER_START_PIN, LOW);
 laser_send_data.bytes.preamble = 0xAA;
 laser_send_data.bytes.command = 0x03;
 Serial2.begin(38400);

Code:
  //Read distance with laser ---- data is retrieved at the end of callback_10s
  laser_send_data.bytes.check_code[0] = (uint8_t)(laser_send_data.bytes.preamble + laser_send_data.bytes.command + laser_send_data.bytes.data[0] + laser_send_data.bytes.data[1] + laser_send_data.bytes.data[2]) << 8;
  laser_send_data.bytes.check_code[1] = (uint8_t)(laser_send_data.bytes.preamble + laser_send_data.bytes.command + laser_send_data.bytes.data[0] + laser_send_data.bytes.data[1] + laser_send_data.bytes.data[2]);
  Watchdog.reset(); //Reset global watchdog, just to make sure that it won't get trapped
  Serial2.write(laser_send_data.array, sizeof(laser_send_data.array));
  LaserReqtime = millis();
  LaserFlag = 1;
  //Check laser watchdog reset condition - if watchdog is not resetted within the data retrieving section reboot the laser distance sensor
  if (laser_wd < 5) {
    laser_wd++;
  }
  else {
    digitalWrite(LASER_POWER_PIN, LOW);
    delay(100);
    digitalWrite(LASER_POWER_PIN, HIGH);
    digitalWrite(LASER_START_PIN, HIGH);
    delay(50);
    digitalWrite(LASER_START_PIN, LOW);
    laser_wd = 0;
  }
After 2 seconds the results are polled from the uart rx buffer
Code:
/////////////////////////////////////////////////////////////////////////////////
//////// Read values of laser distance sensor via USART 2 ///////////////////////
/////////////////////////////////////////////////////////////////////////////////
void read_laser(void) {
 //Get data of Laser distance measurement
 Watchdog.reset(); //Reset global watchdog, just to make sure that it won't get trapped

 //Try to get data from serial 2
 if (Serial2.available() >= 8) {
   laser_wd = 0;//Reset Watchdog of laser meter if data is received - device is resettet after 5 sending counts without an answer
   //Get data from buffer
   Serial2.readBytes(laser_rcv_data.array, sizeof(laser_rcv_data.array));
   //Calculate checksum
   uint16_t checksum = 0;
   for (uint8_t i = 0; i < sizeof(laser_rcv_data.array) - 2; i++) {
     checksum = checksum + laser_rcv_data.array[i];
   }
   //Calculate distance if command, result and checksum is ok
   if ((laser_rcv_data.bytes.command == 0x03) && (laser_rcv_data.bytes.result == 0x06) && (checksum == (laser_rcv_data.bytes.check_code[0] << 8 | laser_rcv_data.bytes.check_code[1]))) {
     int32_t distance_temp = ((int32_t)(laser_rcv_data.bytes.data[0] << 16) | (int32_t)(laser_rcv_data.bytes.data[1] << 8) | (int32_t)laser_rcv_data.bytes.data[2]);
     if (distance_temp < 32000 && distance_temp > -1) {
       laser_distance_array[laser_distance_array_ind] = (int16_t)distance_temp;
       //Serial.println(laser_distance_array[laser_distance_array_ind]);
     }

     //Move array pointer
     if (laser_distance_array_ind < SNOW_ARRAYSIZE) {
       laser_distance_array_ind++;
     }
     else {
       laser_distance_array_ind = 0;
     }
   }
   //If laser answers with wrong values
   /*
     else {
     laser_distance_array[laser_distance_array_ind] = -100;
     //Serial.println(laser_distance_array[laser_distance_array_ind]);

     //Move array pointer
     if (laser_distance_array_ind < SNOW_ARRAYSIZE) {
       laser_distance_array_ind++;
     }
     else {
       laser_distance_array_ind = 0;
     }
     }
   */
   uint32_t uart_timeout = millis();
   //Flush serial buffer if something is left for any reason and protect from endless looping
   while (Serial2.available() > 0 && (millis() - uart_timeout < 500)) {
     Serial2.read();
     //Serial.println("Empty Buffer");
   }
 }
}

To make it better the answer should be, as already described, received with an interrupt routine.
Reply




Users browsing this thread: 1 Guest(s)