1

I'm trying to create a basic 4-button battery powered remote. The logic behind it is that when one of the buttons is pushed it pulls the base of the PNP low thus turning on power to the circuit. The Arduino then takes over holding the base/gate down using a digital pin, it detects which of the 4 buttons is pressed, sends that info over LoRa with battery level using the RA-02 then pulls the PNP up turning everything off and conserving battery power. The current materials used:

  • ATmega328, the same uC used in the Arduino Nano.
  • RA-02 for LoRa communication.
  • 4 momentary simple push buttons.
  • PNP transistor or FET
  • resistors and diodes and whatever other passive components you think is needed.

schematic

simulate this circuit – Schematic created using CircuitLab

In the above schematic the radio is ignored since it's unimportant for the question.

I'm able to use each one of the four buttons to momentarily turn on the circuit, and keeping it on is not the issue.

The issue appears when I make the connection between even one of the buttons to one of the digital pins of the Arduino: it partially turns on the circuit with 2-3 ma current draw (uCurrent ranger).

Pin 5 of the Arduino keeps the circuit on while transmitting, pins 6-9 are for checking thd button state. I used diodes to prevent all pins of the Arduino from going low when one of the buttons is pressed. I used a 10 kΩ resistor to pull up the transistor to keep it off in a known state.

I'm not really sure about why the circuit is "leaking" when I connect any one of the four connections between the ATmega328P and the buttons.

I tried pulling the Arduino pins up using external resistors from 10 kΩ to 2 MΩ; it might vary the leakage but never resolves it. I tried adding resistors in series between the ATmega328P and the buttons instead of direct wires and that helped a lot, but it needed high value resistors like 1-2 MΩ and never stopped the issue completely; I stil get a few μA leakage which to me is not really a circuit that is off.

I have seen other answers on here but they're all using one button, and the main question is auto off in that case, whereas here it's a partially turned on circuit.

I don't want to leave the circuit in sleep mode since I might add other sensors that are power hungry even in sleep so I really would love it if someone has an idea to resolve the issue.

jsotola
  • 2,497
  • 2
  • 12
  • 21

1 Answers1

0

The current leaks through base into AVR, and also secondarily via diodes into AVR. It gets powered via the IO pin. And if current flows via base, it will turn the transistor on.

You have no base resistor, so pushing a button should simply damage the transistor by shorting the base to ground via diode. If the AVR pulls base low, the AVR output is basically shorted to base so the AVR output can also be damaged.

Justme
  • 127,425
  • 3
  • 97
  • 261
  • Hello! Thank you very much for your insight, if I understand correctly the whole problem would be resolved by adding a current limiting resistor in series between the base and the rest of the circuit or as you called it a base resistor? I have seen some circuits use one but I wasn't sure whayt it was and I haven't heard of what is apparently something common to be used. Do you have any other suggestions concerning the circuit and other bad practices I may be doing? Thanks a lot for your advice! – Gibran Zawahra Mar 31 '23 at 00:09
  • It needs a base resistor to not blow up but it may not fully solve the problem. It may be better if you just keep the AVR powered in standby mode, it may even consume less current that what the leakage to power from base to AVR is. – Justme Mar 31 '23 at 08:21
  • thank you for your help ! i tried adding a base resistor and it did make the issue a lot better but it seems like you suggested that sleep mode is drawing a lot less current. – Gibran Zawahra Mar 31 '23 at 16:00