I have followed the instructions on
http://www.weather-above.com/usbnontiprain.html and have got it working in a simple test connected from the relay to a Serial Port via Serial To USB adapter.
I have written this simple test application in c#
using System;
using System.IO.Ports;
using System.Diagnostics;
namespace SerialTrigger
{
class Program
{
static bool on = false;
static Stopwatch st;
static void Main(string[] args)
{
st = new Stopwatch();
SerialPort sp = new SerialPort("COM3", 19200, Parity.None, 8, StopBits.One);
sp.DtrEnable = true;
sp.PinChanged += new SerialPinChangedEventHandler(sp_PinChanged);
sp.Open();
Console.Write("Waiting....");
while (Console.KeyAvailable == false)
{
System.Threading.Thread.Sleep(500);
}
sp.Close();
}
static void sp_PinChanged(object sender, SerialPinChangedEventArgs e)
{
if ((sender as SerialPort).DsrHolding == true)
{
on = true;
st.Reset();
st.Start();
}
else if ((sender as SerialPort).DsrHolding == false)
{
st.Stop();
on = false;
Console.WriteLine("Elapsed = {0}", st.Elapsed.ToString());
}
Console.WriteLine(String.Format("{0} - Pin changed : {1} - State = {2}", DateTime.Now, e.EventType, (sender as SerialPort).DsrHolding));
}
}
}
So this program produces the following when I place drops on the acrylic dome using a syringe.
26/11/2011 3:21:29 p.m. - Pin changed : DsrChanged - State = True
Elapsed = 00:00:00.1946935
26/11/2011 3:21:29 p.m. - Pin changed : DsrChanged - State = False
26/11/2011 3:21:33 p.m. - Pin changed : DsrChanged - State = True
Elapsed = 00:00:00.6140709
26/11/2011 3:21:34 p.m. - Pin changed : DsrChanged - State = False
26/11/2011 3:21:34 p.m. - Pin changed : DsrChanged - State = True
Elapsed = 00:00:01.0220083
26/11/2011 3:21:35 p.m. - Pin changed : DsrChanged - State = False
26/11/2011 3:21:35 p.m. - Pin changed : DsrChanged - State = True
Elapsed = 00:00:00.0009336
26/11/2011 3:21:35 p.m. - Pin changed : DsrChanged - State = False
26/11/2011 3:21:35 p.m. - Pin changed : DsrChanged - State = True
Elapsed = 00:00:00.4080836
26/11/2011 3:21:36 p.m. - Pin changed : DsrChanged - State = False
26/11/2011 3:21:38 p.m. - Pin changed : DsrChanged - State = True
Elapsed = 00:00:00.4100449
26/11/2011 3:21:38 p.m. - Pin changed : DsrChanged - State = False
The state goes to TRUE when there is a drop detected and stays high until the drop clears.
Thanks everyone for the help... Now to put it to test in a live envrionment.
Chris