I got a flowmeter that is operating at 5v (basically an enclosed hall effect sensor and magnet). It needs a pullup resistor of between 1.6k - 2.2k between sig and vcc. ( https://www.conrad.com/p/bio-tech-ek-fch-m-pom-lc-g-18-flow-meter-fch-m-pom-lc-001-35-lmin-150391 )

Now, knowing that connecting a 5v device to the pis gpio that are using 3.3v, i would probably kill the pi.

I know you can put some resistors to step down the voltage to 3.3v, but I have no clue of how what resistors to use and how to connect them.

Could someone please help me telling me what resistors to use and how to connect them?

Thanks! :)

  • 1
    Without detail of the device this is unanswerable. Resistors are NOT likely to be the solution. This is also NOT a Pi specific question.
    – Milliways
    Jul 18, 2019 at 0:20
  • Updated with info and details about the device.
    – Rickard
    Jul 18, 2019 at 0:44
  • I thought it was pi specific, since I want info on how to connect a 5v device to the Pi's 3.3v gpio.
    – Rickard
    Jul 18, 2019 at 0:45
  • 2
    @Rickard, I read the datasheet (produktinfo.conrad.com/datenblaetter/150000-174999/…) and found that it says "Vcc = 5~24V 15mA max, NPN Open Collector Sinking". That means Foxrider83's answer is good. In other words, my first suggestion of using CD4050 or a signal diode to "step down" the signal (push/pull, non NPN open drain) is RUBBISH, though ii works, IF you "pull down" the signal at the device side. My apologies. So you just count the pulses at GPIO, per second, which should be proportional to the flow rate. Cheers.
    – tlfong01
    Jul 18, 2019 at 8:07
  • 2
    @Rickard, just to clarify - Datasheet suggests to use 1k6 ~ 2k2 pull up to Vcc (5V ~12V) . This way you need to step down (using CD4050 or diode, as I first suggested). But datasheet also says output is NPN open drain, so Foxrider83's suggestion of pulling up to Rpi Vcc = 3V3 is the best engineering effective and efficient solution. I am glad that Foxrider83 points out my careless mistake of not carefully reading the datasheet.. Many thanks to him.
    – tlfong01
    Jul 18, 2019 at 8:24

2 Answers 2


This device is and open collector sinking (see the datasheet). That mean that you need to connect a pull-up resistor on the output. So if you connect the output pull-up resistor to the Pi 3.3V and the output to the Pi GPIO it will work. Connection to the Pi

  • 1
    Foxrider83, your answer is very good. My first suggestions before reading the datasheet are rubbish. So I apologized to the OP.
    – tlfong01
    Jul 18, 2019 at 8:09

If the device outputs a square wave (i.e. a digital signal) you should use a level converter. These are quite inexpensive and guaranteed safe. They are readily available on-line and from most retailers who sell Pi products.

https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide shows one common option.

See also https://elinux.org/RPi_GPIO_Interface_Circuits

It MAY be possible to use a resistive divider, but in order to determine the values more detail is required.

If the output is open drain, then connecting the pullup to 3.3V should work, but again detail of the interface is required to be sure.

  • 1
    +1 for the SparkFun level converter - I keep a handful of these lying around at all times because they just work and are a far superior solution to using a resistor.
    – MTCoster
    Jul 18, 2019 at 10:31
  • The unit is "NPN open collector sinking" according to the datasheet. Is there any other details about the interface we need to know, or does that confirm the "open drain" condition you state at the end?
    – LudvigH
    Jun 9, 2020 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.