Simple door sensor battery node drains 2 x AA in a week due to pin D2



  • I am looking for some input on a problem I have encountered with a battery powered node. Any comments appreciated.

    Problem: Bettery powered node is exhausting 2 AA batteries within 5 days due to pin D2 'sinking' ~7ma while sleeping.

    Node Description: This is a simple node. It monitors two garage doors for when they open or closed and reports the change to the controller. It sleeps perhaps 95% of the time. The hardware is a standard MySensors pcb with only two components mounted, a pro mini and a nrf24l01 radio. (Plus pin headers.) Pins D2 and D3 are used in "interupt on change mode", one for each garage door. The 'sensors' on the doors are standard magnetic reed switches. They are open when the door is open, and the magnet closes the contact when the door is shut. When shut, the reed switch pulls the respective pin (D2 or D3) to ground. To minimize current draw, the internal pullups on the pins are not used. A 3.3M ohm resistor is pullup for each pin. The software is a sketch created by @anticimex located here https://github.com/iot-playground/Arduino/blob/master/external_libraries/MySensors/examples/BinarySwitchSleepSensor/BinarySwitchSleepSensor.ino. The only changes made are to put in node id and comment out use of the internal piullups.

    The node works perfectly. When a door opens or shuts, the interupt awakens the node, it reports the change, and then returns to sleep. The ONLY problem is burning thru batteries.

    Investigation: I have put a fluke meter on the node to measure current draw. When pin D3 in in either the pulled up or pulled down position and the node is sleeping the node uses 20micro amps. When pin D2 is in pulled up position and node sleeping, also 20micro amps. But when D2 is in the pulled down position (the garage door is closed) it draws ~6-8ma while sleeping! This draw drains the batteries quickly. I have programmed 4 pro mini's, including one that works fine on another battery powered temp node, and they all perform the same way. I also tried programing the pro minis both with Platformio & Arduino IDE, and there is no difference.

    I have no idea why only D2 sinks so much current when the node is sleeping. Any ideas are much appreciated!



  • is the D2 pin also connected to the RF module?



  • @bjacobse Thank you for your comment. I should have looked at that but it has been ~6 years since I paid attention to basic radio connections. 😞 I am using the MYS11 board from www.sa2avr.se and the schematic shows D2 connected to the IRQ pin of the radio. That could be it. I will test it out.

    The "connecting the radio" page of MySensors states: "The IRQ pin is only required to be connected if the MY_RX_MESSAGE_BUFFER_FEATURE is defined in the sketch. I am not using that feature for this node so I might be able to fix it by cutting a trace.

    I post my results after testing. Again, great input! Thanks.



  • To close this post out, @bjacobse was correct. After cutting the trace to the IRQ pin of the radio there is no more drain on the D2 pin. Even though the pin was not used by MySensors, the radio apparently still drained current.

    Thank You!



  • This post is deleted!


  • @novicit @bjacobse Good call!


Log in to reply
 

Suggested Topics

9
Online

11.4k
Users

11.1k
Topics

112.7k
Posts