0

I am using an Arduino Pro Mini and a non-contact liquid sensor (XKC-Y25-V). I have the positive of the liquid sensor connected to pin 5, its sensor to pin 3 and ground to ground. I turn on the device digitalWrite (5,HIGH);, and then read pin 3 . When the sensor senses water it is ON and I have The Arduino turn on another pin for a second and then turn it back off, then I turn off the power to pin 5 disabling the sensor. If no water is present nothing happens and I turn off the sensor. After everything is turned off I put the Arduino in sleep mode.My problem is when the sensor detects water and everything is turned off the multimeter says the power consumption is 110mA in sleep mode where as if the sensor doesn't detect water and it turned off the power consumption is 20-30mA in sleep mode. I have checked all the pins and none are powered up. I have unplugged the sensor and its power when the Arduino is in sleep mode and nothing changes. I have tried putting digitalWrite (2,LOW); to disconnect the sensor from the board after the sensor is turned off. Still the same. What could be activated so that it draws power even after everything is turned off. Some code;

int valA = 0;

void setup() {
   
   pinMode(3,INPUT);
  
   pinMode (5,OUTPUT);
 
   pinMode(9,OUTPUT);
}

void loop() {
digitalWrite (5,HIGH);
int val = digitalRead(3);
delay(1000);
 digitalWrite(5,LOW);

if (valA ==1){
  
 delay(500);
 digitalWrite(9,HIGH);

 delay(1000);

   


 digitalWrite(9,LOW);
   
   Delay = 2;
  }

if(Delay ==2){
lowPower();
}
}


void lowPower(){

  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
 LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
 LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
 LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
 LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
 LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}

I have an older model of this and it works without using so much power 20mA after detection or no detection. The only difference I can see is the original has no capacitors (there are four now) the wiring is .5mm copper where now it is either .25mm copper for power and everything else is .25mm 1oz copper PCB tracings. and instead of HK19 relays I use r70-5d1-5. Could the capacitors or small wiring cause this problem? I just don't understand what I drawing current since when I disconnect the sensor 3 and power 5 from XKC it still draws the same amount. Hope this helps.

I removed the capacitors, no change. Enlarged wire it sensor, no change. Ran old code on new device, no change. Larger relays are using more power to run but shouldn't cause a problem when power cut to XKC. Using a power boost to power antenna and HT12E with pin 9 if water detected but no power to them when 9 is pulled LOW. Where can bleed of power consumption be.

If anyone has any idea, questions, has solved this before I would really appreciate some help.

circuit diagram new

6
  • please include the sensor datasheet – jsotola Aug 18 '20 at 0:32
  • Please provide your circuit diagram. It is hard to understand how you wire and turn on and off all the parts with your description. BTW, XKC-Y25-V may take up as much as 50mA, XKC-Y25-V basically is a capacitor, it take up current when it is charging (when water level changed) and discharging. – hcheung Aug 18 '20 at 1:34
  • 1
    Since removing the sensor doesn't reduce the current consumption, the problem is likely in your code, or one of the other components "reaction" to your code. That code doesn't do anything (digitalRead is stored in val, while the if statement uses valA). Also I can't find the XKC-Y25-V in your schematic. Also in your schematic, power is connected to pin 3, and the sensor output to pin 5. While your code has these the other way around. Please be more clear, as there is no way for us to answer your question(s). – Gerben Aug 18 '20 at 19:01
  • 1
    valA never becomes 1, so Delay can never be 2, so it never calls lowPower(). – Majenko Aug 18 '20 at 19:22
  • sorry val is supposed to be valA. I know it gets to and calls lowPower() because it sends a RF signal and then the power consumption drops to 10 but not to 4 or 5 which is should. I am reconstruction another board to see if there are any wiring mistakes. Will let you know how it goes. Thanks – user1114881 Aug 19 '20 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.