1

Hi i've a big problem with my project. I realized a simple project with Arduino Uno: i've attached interrupt to pin 2 to read water flow. If I power on Arduino from 5v usb all works as expected: my water counter (showed on an lcd) increase only if water pass trough the sensor flow.

But if poweron arduino with external 12v, the interrupt start immediately, also in no water passing trough sensor and also if i remove phisically the sensor from the circuit!!

Any suggest?

Flow sensor has 3 pins: vcc, gnd, data.

Data pin goes to pin 2 (interrupt), vcc to arduino 5v, and gnd with arduino gnd.

itajackass
  • 111
  • 1
  • What flow sensor do you have exactly? And what 12V power supply? – chrisl Jul 31 '21 at 13:31
  • @chrisl the flow meter is a yf-s201. But the sensor is not the problem, because the noise appear also if remove the sensor from my circuit. I use a power supply with output 12v/2.0A – itajackass Jul 31 '21 at 13:36
  • 3
    Did you enable the internal pull-up on the Arduino? Are you using an external pull-up instead? – Edgar Bonet Jul 31 '21 at 13:41
  • I ask because the sensor might need a pullup or pulldown resistor, which you don't currently use. A floating input pin (like when you disconnect the sensor without enabling the internal pullup) can change its state to whatever noise floats by, for example the noise from the 12V power supply. The example code that I found here enables the internal pullup resistor. Please do this via pinMode(pin, INPUT_PULLUP); , then report back if it worked – chrisl Jul 31 '21 at 14:14
  • @itajackass you said that the interrupts occur when the sensor is not connected, so why are you even talking about the sensor? – jsotola Jul 31 '21 at 16:34
  • @chrisl no luck. Setting it as INPUT_PULLUP instead INPUT, the problem of "noise" as gone.....but also the correct working is gone! The counter not increment, stay at 0, if I flow water inside sensor.... – itajackass Aug 01 '21 at 06:39
  • 2
    @itajackass Can you upload your code? – Coder9390 Aug 01 '21 at 07:20
  • correct behavior disappearing from pullup could indicate bad sensor wiring as well. – Abel Aug 01 '21 at 21:07

0 Answers0