Connecting a 24Volt NPN sensor to Arduino

Dear all,

I am doing a project where I would like to connect a sensor for waterflow measurements. The water flows through a tube which rotates and the magnets then send a signal to the Hall sensor. I would like to read the pulses.

The sensor is a hal effect sensor with 3 wires:

  • pin 1: 24 volt D/C
  • pin 2: NPN open Collector
  • Pin 3: Ground

I found some tutorials online (https://www.bc-robotics.com/tutorials/using-a-flow-sensor-with-arduino/) which is exactly what I want. However, there is a small difference namely that the sensor runs on 24V instead of 5V.

I am planning on using a pull-up resistor from the internal Arduino. If i'm not mistaken this will prevent the signal from floating, simple with pinmode(pin1, INPUT_PULLUP) for example.

The connection I plan on making is shown in the attachment. I connect the ground from the sensor together with - from the 24volt power supply to the GROUND for the Arduino. Then, the signal cable I connect directly to an inut pin of Arduino. Finally, I connect the last pin of the sensor to the + of the 24v power supply and power the Arduino with the USB.

My question is if this will not create any problems for the Arduino? The signal is sending 24 Volt pulses if I am correct? I read somewhere else that this is not a problem, but I would like to know if this is true and why.

Any tips or feedback is much appreciated, I would like to learn more about Arduino but I don't want to destroy it right away, that is why I am double checking.

Thank you for reading,

Kind regards,

You did not bother to supply a link to a data sheet for the flow sensor. Are you willing to try running the sensor at 5 volts? Probably will work just fine.

Paul

Hi Paul,

Thank you for the reply.

Unfortunately I am not able to find the datasheet, even with the product number. Only on the sensor itself it says:
Pin 1: 24 volt D/C. +- 10%
Pin2: NPN open collector
Pin3: Ground
Pin4: not connected
Pin5: not connected

I did try with 5 volt but did not work. Do you think the setup as I showed is safe/correct?

Kind regards,

Looks ok to me. The sensor most likely is using an opto-isolator on the output and the transistor in your drawing is part of that.

Paul

NPN open collector sensors are intended to be used with a pullup resistor. In your case, that pullup (10K should be fine) should be connected to Arduino Vcc, or just use INPUT_PULLUP.

Don't forget to connect all the grounds.