Reading rain gauge

EL34

Active Member
I'm currently reading HB Ds1820 temp sensors and HB humidity sensors via Visual basic 2008 and the one wire SDK


I don't see any rain gauge containers in the one wire docs.

Curious as to how to read the rainwise gauge I got from HB?
 
I'm currently reading HB Ds1820 temp sensors and HB humidity sensors via Visual basic 2008 and the one wire SDK


I don't see any rain gauge containers in the one wire docs.

Curious as to how to read the rainwise gauge I got from HB?

There is no container specific to the rain gauge. You need to use the container for the DS2423 counter chip and read the counts and multiply them by 0.01 to get the rain amount in inches.

Eric
 
Thanks Eric,
but are the .01 rain counts stored on the rain gauge?

In other words, you poll a temp sensor or humidity sensor and get a current reading,
but on a rain gauge, counts go on all the time and rain amounts are an accumulated total of those counts.

still confused about getting the total times the rain gauge registers each .01 count.
 
Don't have a rain gauge yet, but I understand this to be ...

The DS2423 counter will increment for each .01 inch of rain.

When you read the counter, you get a value.
By design, the counter starts at zero and increments with each contact/pulse.

You need to know the beginning and ending values of the counter over a period of time.

If the value today is 555, and the value yesterday was 555. You got no rain.

If the value today is 555, and the value yesterday was 455, the counter went up by 100, so you got 1" of rain.

If you sample and log the value on a regular basis, at least once a day, better yet every hour, you can calculate how much rain you got over days, weeks, months.
 
ok, that makes sense. I knew that .01 counts had to be stashed somewhere.

I would image that you should get the counts and then reset the counts back to zero (if possible)
If I unplug my one wire hub power supply, the rain gauge would loose power and the counts it has stored?

Wserver (my weather program) seems to record increments of .01 in the rain gauge log file.

In other words, it is not reading 342 counts. It shows
.01
.03
.02
.01
, etc in the log file.
So my guess is that the counts are reset back to zero every time the rain gauge is read.



Don't have a rain gauge yet, but I understand this to be ...

The DS2423 counter will increment for each .01 inch of rain.

When you read the counter, you get a value.
By design, the counter starts at zero and increments with each contact/pulse.

You need to know the beginning and ending values of the counter over a period of time.

If the value today is 555, and the value yesterday was 555. You got no rain.

If the value today is 555, and the value yesterday was 455, the counter went up by 100, so you got 1" of rain.

If you sample and log the value on a regular basis, at least once a day, better yet every hour, you can calculate how much rain you got over days, weeks, months.
 
ok, that makes sense. I knew that .01 counts had to be stashed somewhere.

I would image that you should get the counts and then reset the counts back to zero (if possible)
If I unplug my one wire hub power supply, the rain gauge would loose power and the counts it has stored?

Wserver (my weather program) seems to record increments of .01 in the rain gauge log file.

In other words, it is not reading 342 counts. It shows
.01
.03
.02
.01
, etc in the log file.
So my guess is that the counts are reset back to zero every time the rain gauge is read.

The rain gauge comes with a HB counter. I assume its the same counter board sold separately, and the only way to reset the counter is to disconnect the battery cell - not an easy task.

My guess is that wserver is just reading the counter and logging the difference between the previous and current sample. You'll have to add them up to get a daily/weekly/monthly total. Hopefully there's some sort of timestamp to go by.
 
ah ok, I'll mess around with trying to read it and see what happens.
Not sure how to start, the one wire sdk docs don't show how to read a 2423
There is no container listed, it just says that it is a

MemoryBank PagedMemoryBank

Under interface, there isn't anything listed.
 
I went the HB store and looked at the dual counter Eric sells.
I see it has a lithium battery on the board and so I bet if I look inside my rainwise gauge, there is a battery in there also.
That's how it maintains the counts.

Makes sense now.
Wasn't sure if the counts would be lost if the one wire nentwork lost power, but it looks like the battery handles that.

Eric, does that all sound correct?
 
I was able to read my rainwise rain gauge using container1D and readcounter page 15

the count of 6269 I received is the same count that Wserver is reading

Here's my VB express 2008 code for anyone interested.

Code:
Imports System

Public Class Form1

	'dim one wire
	Dim adapter As com.dalsemi.onewire.adapter.DSPortAdapter
	Dim owd As com.dalsemi.onewire.container.OneWireContainer
	Dim state As Object
	Dim SwitchContainer As com.dalsemi.onewire.container.SwitchContainer
	Dim CounterContainer As com.dalsemi.onewire.container.OneWireContainer1D
	Dim Switches As Integer
	Dim CurrentTime As Date

	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Try
			adapter = com.dalsemi.onewire.OneWireAccessProvider.getAdapter("{DS9097U}", "COM1")
			' print that adapter was found
			ResultsTextBox.AppendText(adapter.getAdapterName & " 1 wire Port: " & adapter.getPortName & vbCrLf)
		Catch ex As Exception
			ResultsTextBox.AppendText("Error reading adapter: " & ex.ToString & vbCrLf)
		End Try

	End Sub


	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		ReadSensors()
	End Sub


	'read one wire sensor
	Sub ReadSensors()
		CurrentTime = TimeOfDay
		ResultsTextBox.AppendText("Time: " & CurrentTime & vbCrLf)

		' get exclusive use of 1-Wire network
		Try
			adapter.beginExclusive(True)
			adapter.setSpeed(com.dalsemi.onewire.adapter.DSPortAdapter.SPEED_REGULAR)
		Catch ex As Exception
			ResultsTextBox.AppendText("Error: " & ex.ToString & vbCrLf)
		End Try

		Try
			owd = adapter.getDeviceContainer("000000000505801F") 'set switch to channel 2
			SwitchContainer = DirectCast(owd, com.dalsemi.onewire.container.SwitchContainer)
			state = SwitchContainer.readDevice ' read the device
			Switches = SwitchContainer.getNumberChannels(state)
			SwitchContainer.setLatchState(1, True, True, state) 'set switch to aux
			SwitchContainer.writeDevice(state)
		Catch ex As Exception
			ResultsTextBox.AppendText("Error: changing switch " & ex.ToString & vbCrLf)
		End Try


		Try
			owd = adapter.getDeviceContainer("1100000009F06F1D")
			CounterContainer = DirectCast(owd, com.dalsemi.onewire.container.OneWireContainer1D)
			Dim counterstate As Long
			counterstate = CounterContainer.readCounter(15)  ' read the device
			ResultsTextBox.AppendText(counterstate & vbCrLf)
		Catch ex As Exception
			ResultsTextBox.AppendText("Error reading counter: " & ex.ToString & vbCrLf)
		End Try

		' end exclusive use of 1-Wire net adapter
		adapter.endExclusive()

	End Sub

End Class
 
I went the HB store and looked at the dual counter Eric sells.
I see it has a lithium battery on the board and so I bet if I look inside my rainwise gauge, there is a battery in there also.
That's how it maintains the counts.

Makes sense now.
Wasn't sure if the counts would be lost if the one wire nentwork lost power, but it looks like the battery handles that.

Eric, does that all sound correct?

Yes that is correct. The Rain Gauge has a Dual Counter inside and it has a battery so that it can keep up with counts even if your computer is off which means there is no way to reset the counter to 0 (unless the battery dies which won't happen for a long time).

Eric
 
Thanks Eric,
I got the big picture nailed down on the rain gauge now. :p


I went the HB store and looked at the dual counter Eric sells.
I see it has a lithium battery on the board and so I bet if I look inside my rainwise gauge, there is a battery in there also.
That's how it maintains the counts.

Makes sense now.
Wasn't sure if the counts would be lost if the one wire nentwork lost power, but it looks like the battery handles that.

Eric, does that all sound correct?

Yes that is correct. The Rain Gauge has a Dual Counter inside and it has a battery so that it can keep up with counts even if your computer is off which means there is no way to reset the counter to 0 (unless the battery dies which won't happen for a long time).

Eric
 
Back
Top