[SOLVED] How to read a pulse

shelleycat:
Can you post your entire circuit.

The statement that it works and "However when I remove the connection to the computer the whole thing goes crazy printing lots of pulse times which are all wrong as I am not pouring water, and thus should not receive anything." seem mutually exclusive.

One wire will not work; there is a sneaky earth coming in somewhere.

If your bucket tips quite slowly (say, as slow as 10ms which is 1/100 second), you have plenty of time to poll
for a change, double or triple check the signal is stable to allow for debounce, increment your counter, then continue to poll until the end of the pulse. An arduino runs its main loop about 20000 times a second. Polling allows debounce,
interrupts make that quite a bit harder. Try a quick polling sketch to see.

I created a quick scheme how I connected everything. I have a Serial2USB converter on the female serial connector that can be seen in the scheme. When the USB is connected to the computer the Arduino reads more or less the correct result. For each pulse I generate (by pouring water over the sensor) it displays 3 pulses via the serial port of the Arduino which I am listening to. So this might not be totally correct either. I read in the RG-11 documentation that each generated pulse stays HIGH for 50ms.

If I remove the USB from my computer then the Arduino registers hundreds of pulses as can be seen via the Serial listener. When I put a wire from the ground pin to the arduino ground pin then everything seems fine with the detail that it never will sense any pulses at all anymore ...
Also when I place the COM output into the Arduino GND pin and the NO output into the Arduino digital pin 2 then nothing will happen. Same behaviour as the last sentence above.

So somehow I am putting everything wrong together.