Water pressure monitoring on Homeseer.

Credit goes to Greig Dempster for the excellent Arduino Plugin for the Homeseer. I’m using an Arduino Mega, with the pressure sensors feeding the analogue inputs. Greg’s plugin creates a device with the resulting AD count.


Been on the lookout for good value pressure sensors for quite a while now and finally found these:

http://www.ebay.co.uk/itm/181110950113

 

This 80 psi device gives a linear output between 0.5v and 4.5v for the pressure. I subtract 0.5v from 4.5v to get a 4 volt swing for the full range. I divide 4 volts by 80psi to get 0.05 volts per PSI.


5 volts on the Analogue input gives a count of 1023, so I divide 5 by 1023 to get 0.0048 volts per AD count.

I subtract the 0.5v offset from the reading to account for the fact that 0psi on the sensor gives out 0.5v (an ADC count of approx. 100)


They come with a 1/8npt thread, a quick rummage around in my fittings box got it working quickly, then I ordered the correct tap and made a brass fitting on the lathe for it.

 

Changed the settings for the Analogue device as shown in the pictures so I end up with the raw ADC count for the value. I then created a new virtual device that would receive the water pressure that's calculated from the following script:


Public Sub Main(ByVal Parms As Object)

       Dim adc As Double = hs.DeviceValue(338) 'Get the ADC count using the device reference ID


       Dim psi As Single

       psi = (adc * (5 / 1023) - 0.5) / (4 / 80)

'        hs.WriteLog("AD Count=", adc)

'        hs.WriteLog("Water pressure PSI=", psi)

       hs.SetDeviceValueByRef(339, Math.Round(psi, 0), True) 'Update Virtual Device ID 339 with the calculated pressure


   End Sub



On the left is the quick mockup and the right is my custom brass fitting that I made:

You need to modify the homeseer device that the plugin creates to provide the actual ADC count for the device, as the script does all the maths:

Hs.devicevlaue(338) is the ADC count from the device created by the Arduino plug.

I created a new virtual device in Homeseer and called it “water pressure”. It’s device refernce ID is 339, this line then updates that virtual device with the calculated water pressure:

hs.SetDeviceValueByRef(339, Math.Round(psi, 0), True)  updates a new virtual

Here’s the event that triggers when the ADC count changes and updates the virtual device with the pressure:

At the moment the event cant retrigger for 5 seconds, but I will probably increase that to 60 seconds once things have settled in. The reason for this is just to keep the CPU load low, as I dont need it performing real-time updates of the pressure.

I use Jon00 graphing tool to track the pressure over 30 days: