Using a Rain Gauge with HomeVision
Rain Gauge Description
The RainWise rain gauge is a large bucket with a "rocker" in the base that changes position each time 0.01 inches of rain is received. The rocker movement triggers a relay that briefly shorts two wires together. These wires can be connected to a HomeVision input port and used to track the amount of rainfall.
Unfortunately, the wires are only shorted together for a small amount of time, possibly under 20ms. HomeVision could miss such a short pulse if it were performing some other functions at that precise time. This would cause HomeVision to under-measure the amount of rain. This may or may not be a problem, depending on how accurate you want the measurement. This article shows two different setups, the second of which overcomes this problem by the use of a timed relay.
The easiest configuration is to connect the rain gauge wires directly to a HomeVision input port. One wire would go to the desired input, and the other would go to the HomeVision ground.
In this configuration, the wires will normally be "open", allowing them to be pulled high (to 5V) on HomeVision. Thus, the input will be read as a "high". When the rain gauge triggers, the wires will briefly short, causing the HomeVision input to go "low".
This configuration adds a timed relay from Elk Products (part number ELK-960). This relay will act as a "pulse stretcher", lengthening the rain gauge pulse to ensure that HomeVision detects it.
Connections are as follows:
Make the following settings on the relay:
Here's how this will work. The rain gauge wires will normally be "open", which causes the relay to be off. Since the "normally open" relay output (which is open when the relay is off) is connected to HomeVision, the open HomeVision input will be pulled high (to 5V) by HomeVision. Thus, the input will be read as a "high".
When the rain gauge triggers, its wires will briefly short. This will cause the timed relay to trigger, and it's "normally open" output will close to ground, in turn causing the HomeVision input to go "low". The rain gauge wires may very quickly open again, but the relay will remain triggered for the duration of it's timeout period. Since we set it to 5 seconds, the relay will remain triggered for 5 seconds. When this time is up, the relay goes off and the HomeVision input port returns high.
With this setup, HomeVision can only detect one pulse within the relay timeout period of 5 seconds. However, it would take a VERY heavy rainstorm to trigger the rain gauge more quickly than this. 0.01 inches of rain every 5 seconds equates to 36 inches per hour!
In the HomeVision software, you should put your rain tracking code in the "low" actions for the input port. Each time 0.01 inches of rain occurs, the port will go low, and your actions will be performed.
Let's assume you want to track the total amount of rainfall each day. To do this, create two variables called:
Put the following commands in the "low" actions for the input port:
Increment var #1 (Today's rain: Hundredths) [roll over at 255] If Var #1 (Today's rain: Hundredths) = 100 Then Var #1 (Today's rain: Hundredths) = 0 Increment var #2 (Today's rain: Inches) [roll over at 255] End If
Each time this runs, the hundredths value will be incremented. When it reaches 100 (meaning it has rained a full inch), we reset the hundredths value to zero and increment the inches value.
You should also create a scheduled event that runs every day at midnight and resets the variables to zero, like this:
Var #1 (Today's rain: Hundredths) = 0 Var #2 (Today's rain: Inches) = 0
You can also display the data on HomeVision's weather conditions TV screen. Add these two weather conditions commands to the end of the input port actions shown previously:
Today's rainfall (hundredths) = var #1 (Today's rain: Hundredths) Today's rainfall (inches) = var #2 (Today's rain: Inches)
These commands put your variables into the corresponding "weather variables" that are automatically displayed on the TV screen.
It's quite easy for HomeVision to track rainfall. You could extend this by tracking weekly, monthly, or annual rain amounts as well, just be adding a few variables and commands. You could also use this information to adjust your lawn watering schedule.