I want to use water flow sensor using Raspberry Pi 2 but the water flow sensor accepts only 5v as a input and gives the pulses of 5v as a output but my Raspberry Pi can take only 3.3v.
Is this possible to implement?
And if possible code please.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
This is no software issue.
Look at the sensor's datasheet, it might be able to operate at 3.3V just fine. If it doesn't, you have to build a voltage divider between the sensor's output and your Pi's input.
This question decides whether to connect the sensor's voltage in to 5V or 3V! In turn, it determines the maximum voltage applied to Pi' GPIOs. So never connect it to 5V without the voltage divider!
Assuming your sensor requires almost no power, this can be achieved easily with for example 3x 10K Ohm resistors.
R2 = 10K R1 = 5K (2x 10K in parallel) Hence, 10K/15K =~ 0.66 0.66 * 5V = 3.3V