Monitoring a reed-switch, analog or digital read?

I want to monitor a reed switch ( a rain sensor, tipping bucket type)
The sensors specs is that it comes with two reed switches in series, separated with a 1kw 0,25w resistor.

It has 4 terminals, NO and NC.
Ive tried reading both the NO and NC terminals with analog read.

Connecting 5V on the arduino and the other to A0.

If I use the NC terminals:
Im getting a sine wave, and if i manually tilt the sensor down, I get a reading of 1023, but this is unaccurate.

If im using the NO terminals:
The result is a flat line (1023), and it will start the sine wave as soon as the sensor get pushed sligthly down.

Is there something im doing wrong?

What i want is a simple and accurate way to let the arduino know when the sensor is tipping its bucket.

Is digital read a better approach?
Ive tried that also, with the internal pullup, and connecing the sensors terminal to ground and D2.
Still not sure if the result is better, it does not give sine wave, but i guess thats because im only seeing 0 or 1.

Mentis:
If im using the NO terminals:
The result is a flat line (1023), and it will start the sine wave as soon as the sensor get pushed sligthly down.

One possibility: Wire the NO terminals to a digital input and use the internal pullup. As long as the input is high reset a timer. If the input is low stop resetting the timer - thus allowing it to run and accumulate time increments.

Imagine the signal is high for 10 milliseconds then low for 10 milliseconds when tipping. If the timer has been given a preset of 25 milliseconds it will be in a 'not done' condition while the signal varies. It won't get to preset again until the input stays high.

Use the state of the timer being at less than preset as the tipping signal.

Can you please provide some more information about the rain sensor. Do you have a link to the product?

Can you please attach a simple drawing of the wiring.

Where is the sine wave coming from?

OK..... My guess is the sine wave is really an open circuit and the wires are picking up 60Hz (or 50Hz in EU)

When you say

separated with a 1kw 0,25w resistor.

I assume it really means 1k Ohm.

I think I know how it was meant to be hooked but I can't be sure with the information you've provided regarding the sensors and 4 terminals.

Please be more specific regarding the sensors. Draw a diagram of what you think it is and use an ohmmeter to verify you assumption.

John

A reed switch is (usually) just a switch that is actuated by a magnetic field, so use it the same as you would a push-button switch. The wiring seems a bit odd, with a NO and NC wired in series with a resistor between them, but the intent may be for you to be able to choose either a NO or NC switch, with an internal pull-up resistor, and simply ignore the other switch, but hard to tell without seeing the actual rain sensor and the positioning of the individual switches.

Sorry for the late reply here. I thought i had signed up for notifications when this topic got replies.

I have attached pictures of the sensor, and the supplied datasheet.

What I want to accomplish is a solid and bulletproof way to let the arduino register a trigger of the sensor, without getting to much false positives, or lost registrations.

The arduino is not doing any calculations, it will just be doing a http request. A external system will do the datalogging part.

It appears that the 2 reed switches are entirely separate.
Presumably one is to detect the bucket tipping and the other is to detect the bucket is in the home position (but that is not clear from the data sheet).

Anyway, to read the switches with an Arduino, treat these like two buttons.

Wire pins 1 and 3 to +5volts gnd.
Wire pin 2 to an Arduino digital pin. Use pinMode() with a pull up resistor to initialise it and digitalRead() to read it.
Do the same with pin 4, but use a different digital pin on the Arduino.

full data sheet: https://pronamic.com/Files/Images/Datablade/Datasheet-Small.pdf

Edit
Corrected pin wiring statement typo (spotted by @herbschwarz)

If you enable the pull-up resistor, the switch
must be wired from pin to ground.
Herb

20191014_205048.jpg

20191014_205114.jpg

datasheet.PNG