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:
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:
Code:
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
Comment