1-wire reader & laser sensor

Fantastic Brian on your son’s accomplishment and your Version 1.9 Laser Snow script. MikeyM is reporting SUCCESS! Fantastic! Absolutely, Fantastic !!! :onfire:

Enjoy the day and take the family out to celebrate!!!

Thanks for your efforts. =D> Hopefully Rick and Tom will now be able to use the LR4/414D. Just started to snow here so I’m currently in the operating mode using your Dallas 1 wire option. I’ll test after this minor snow event is over. Today will be a good day … :D/

the offset less the snow reading in that vers 1.9 is now written to the registry entry for WD to pick up
(Is that correct Mikeym? i,e the snow level after offset reading)

what I need to do now is add an option in WD to use this cron program instead of the dallas1wire reader program, yes? (i.e to start this cron program when WD starts)

ps Mikeym, I am curious how you are adding artificial snow?)

Brian

Yes that is correct - offset less the lazer reading give snow depth (level). Yes, the option to use the cron instead of the dallas 1-wire would be a Great option. If I remember correctly the LRTimelog has to be started before the cronlazersnow is started or the first reading is goofy. That was the way the dallas 1-wire reader worked. If it was started before LRTimelog then there was a really goofy first reading like mega amount of snow. Hope that makes sense. That way in the current setup we had to shutdown the dallas 1-wire reader before we started LRTimelog and then restart the dallas 1-wire reader. Hope that makes sense

To add fake snow I use either 2" X 6" (which is really 1 3/4" US) and 1 X 6 (which is really 3/4" US) boards under the sensor. I’ve on some occasions used thin cardboard boxes.

I have added option now to use this new cron program instead of the dallas1wirereader program
in the latest .zip update of WD
in
setup, advanced/misc, snow…

re having to run the LRTimelog first
I wonder if that sends an initialisation command to the unit first
which I could get cronlazer snow to do

Brian

I’m not sure about initializing the lazer sensor. The option to use the cron or the dallas 1-wire is great. I talked to Breezy regarding the auto startup of the cronlazersnow.exe and we both agree that would be a problem of LRTimelog isn’t already runnning. Maybe an option to auto start or not auto start cronlazersnow.exe would work. Basically the issue with LRTimlog is it has to be started a couple minutes before the top of the hour and it is set to only sample once an hour as we had problems with taking too many sample during the hour and getting minor fluctuations. That’s why we chose to only sample once or twice an hour at the most.

Thanks for all your work on this. I’ll download the new WD zip and let you know how it does. Enjoy your day!

:smiley:

MikeyM

maybe I can get cronlazer snow to do the actual sample (i.e send the command to go that) at the time freq you set
(assuming I can get sending a command to do that to work)

the is from the source code
// Turn on the laser 10 seconds prior to the goal time
if (TicksNow >= (TicksGoal-10)) {
if ((ConfigValue & 0x0000008) == 0) {
// Write the rangefinder’s configuration (writes it from ConfigValue global variable)
ConfigValue |= 0x00000008; //Set the Single mode bit
if (SetConfiguration() == FALSE) {
printf (“Error: Could not write configuration to the rangefinder device.\n”);
goto ExitFromApp;
}
}
}

	// If we are past the goal time, then trigger a measurement
	if (TicksNow >= TicksGoal) {
		TicksGoal = TicksGoal + Interval;  // Calculate the next goal time

		// Write the rangefinder's configuration (writes it from ConfigValue global variable)
		ConfigValue |= 0x00008000;		//Set the Run bit to trigger the measurement
		if (SetConfiguration() == FALSE) {
			printf ("Error: Could not write configuration to the rangefinder device.\n");
			goto ExitFromApp;
		}
	}

BOOLEAN SetConfiguration (void)
{
UCHAR CmdBuf[8];

CmdBuf[0] = CMD_SET_CONFIG;
CmdBuf[1] = (UCHAR)(ConfigValue);
CmdBuf[2] = (UCHAR)(ConfigValue >> 8);
CmdBuf[3] = (UCHAR)(ConfigValue >> 16);
CmdBuf[4] = (UCHAR)(ConfigValue >> 24);
CmdBuf[5] = 0;
CmdBuf[6] = 0;
CmdBuf[7] = 0;

return DYNCALL(writeData)(&CmdBuf[0]);

}

i,e its turning on some bits

I should be able to get cronlazersnow to do this
will need to be tested

Brian

That would be awesome. Breezy and I did some testing, but it was inconclusive with B61 whether it’s correctly recording the additional snowfall. I have to take a break for dinner, but I’ll do further testing later tonight. Cronlazersnow is working perfectly, it’s just whether WD is seeing the input from cronlazersnow. I’m assuming you have to head to school soon. Have fun!

:smiley:

MikeyM

new update
http://www.weather-display.com/downloadfiles/cronlazersnow.zip

I have added button to try and trigger a reading
got no idea if will work

Brian

This what I get when I run the new version and it the “get reading” button. I did it twice which is why there 2 readings.


I am using the original hid component to send the commands (easier)
looks like no new reading was triggered
I will see if I can figure out how to send data using the new HID component

new update ready to test re the trigger a data read

Brian

Here’s the last test. I did hit the “get reading” button several times. I’m heading to bed. Hope you had a good day with the family!

Cheers

MikeyM


that is not working
but I cam compile the LRTimelog
and so make that program run, trigger a reading, and exit (ie get cronlazersnow to run that program at set intervals)

V1.9 is worked for me overnight after opening LRTimelog and starting it to record snow depths every 6 minutes (360 seconds)

I’m looking forward to the next steps as to how to update WD and eventually upload the V1.9 data to my website.

Thank you so much.

Brian,

Mike asked me to tell you that he had to go shopping this morning. He’ll be back to continue testing around 2:30 p.m. our time (EST) or 8:30 a.m. your time.

Thanks for your continuing work and progress! Much appreciated!

Jeff

@schwab
re getting WD to use the snow data
use the latest .zip update
and in setup, advanced/misc, snow section, tick enable for the lazer snow and tick to use the cronlazer snow
and set your needed offset too (you can do that in the cron lazer snow)
and then make sure WD is getting live data from your weather station (or at least set to stationless mode)
and then try adding some fake snow to test?

I have re compile the LRTimelog.exe
(and renamed it as LRTimelogtest.exe)
download
http://www.weather-display.com/downloadfiles/lrtest.zip

run that (double click) and see if it triggers a reading in a runing cronlazersnow.exe

the idea is that I get cronlazersnow to run this program and a user selectable interval

Brian

The LRTimeLogtest.exe does trigger a reading, but if cronlazersnow is running before LRTimelog that it produces an erroneous reading in cronlazersnow. Also the interval you have have set in LRTimeLogtest is 30 sec and the reading has to be 60 sec or greater otherwise LRTimelog quits. So it works but only takes 1 reading which is an erroneous depth.
MikeyM


yeah I hard coded the reading interval
but in the code it does say 30 seconds or longer
what I have done in the code to trigger one reading is added to sleep 10 seconds after turning on the lazer before requesting a reading
I see that that LTtimelog does then look to get a reading back ,…then after that sets the lazer back to sleep and then it should exit…yes?
does the reading it get back look ok? (maybe I can make it report to the terminal instead of to a log)