Connecting 24V inductive sensors to Arduino

Dear Arduino users, any of you out there that could answer some of my questions ?

My goal: to measure RPM of our ships diesel engine. Hardware: arduino mega 2560 + ethernet shield, inductive sensor (pepperl+fuchs, datasheet here: Inductive sensor NBB5-18GK50-E2)

The engine can make 650rpm max but the sensor detects 4 holes in our huge flywheel so that generates a pulsetrain of max 44Hz.

I found lots of code for rpm calculations but I am at lost on how to connect the sensor to the Arduino for it puts out 24V.
I suspect that a voltage regulator (L7805ac-v) can not dissipate the voltage overshoot fast enough to keep up with the pulsetrain, maybe the same goes for a "ruggeduino" (tolerates 24V on its pins), not sure tough.

Any suggestions ? Optocoupler ? Transistor ?

I'd recommend a optocoupler with a drop-down resistor to make it safe. In case the signal is AC, use a AC optocoupler. That's what I have used here with my air conditioning system (the signals for most residential AC control systems in America are 24VAC). Attach the opto to a digital input and then count the pulse train. Given how slow the signal is, you could use a ISR to do the counting and then let your Arduino refer back to the count whenever you want.

Yes, use the 24v output to drive an optocoupler through a series resistor. The sensor is powered from DC not AC (the datasheet says it has reverse polarity protection), so no need for an AC optocoupler, a cheap DC one will do.

Thx dc42 & constantin. For those struggling with the same questions, found this schematic (see attachment).

PS: this post is edited twice, to simplify the circuit and to correct my nooby mistake. Thanks dc42 for your help & patience !!

opto2.jpg

The 24v side of that looks OK although I don't know what 800E is supposed to mean. Most opto isolators want around 16mA current so I would make the resistor 1.5 Kohms.

On the Arduino side, it's a little simpler to connect the phototransistor side of the opto isolator between ground and the input pin, then enable the internal pullup resistor in software. This avoids the need for an external resistor. Again, I don't know what 22E means, and 22 ohms is certainly far too low a value for that resistor in that circuit.

Thanks again dc42, implemented your suggestions in the drawing.

That's not quite right, you need to connect the emitter (lower right connection in your diagram) of the IR receiver to Arduino ground, and the collector (upper right connection) to the Arduino input pin.