this code works perfectly if connected with usb cable. but as soon as i connect my Arduino nano with battery (two 18650 batteries in series connected to VIN) it runs loop only once. it sends only 0 to another LoRa module (3.3v) and i assume it runs loop only once. blink works without a problem.

#include <SPI.h>
#include <LoRa.h>

int counter = 0;

void setup() {

  Serial.println("LoRa Sender");

  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);

void loop() {
  Serial.print("Sending packet: ");

  // send packet
  counter ++;


battery pack voltage is 7.01v.

connections I've tried so far:

  1. 2x 18650 -> VIN = Does not work
  2. 2x 18650 + regulator -> 5v = Does not work
  3. 2x 18650 + regulator -> USB = Does work
  4. USB -> USB = Of course works

when I say it works I mean it Arduino powers up and LoRa module sends data but only once and looks like loop is running only once.

  • it works if i connect usb cable with a power bank. but wont work if i power with regulated 5v on 5v pin
    – LongToeBoy
    Aug 2, 2021 at 17:55
  • voltage on vin pin is 7.01v
    – LongToeBoy
    Aug 2, 2021 at 18:00
  • 1
    A diagram of how you have all this wired together may be relevant.
    – timemage
    Aug 2, 2021 at 22:13
  • are you powering the lora with the nano's 5v pin? iirc, Vin goes through an LDO, USB is fed directly.
    – dandavis
    Aug 2, 2021 at 22:53
  • no. i'm powering lora from 3v3 as vcc for lora is not 5v tolerant
    – LongToeBoy
    Aug 3, 2021 at 12:37

1 Answer 1


Again, it would be nice to looking at how you have it set up. You didn't mention any proper signal level conversion, so I'm going to assume there isn't any. My best guess is one of the signals being produced by the Lora module is near the edge of being correct on the ATMega328P.

In comments I asked:

If you measure the "5V" pin does the measured value read appear to be lower in the working scenarios and higher in the failing scenarios?

The reason for the question is that the logic levels of the ATmega328P are dependent on its VCC, what we're nominally calling "5V".

when in working condition 5v output reads 4.48 but when using regulator and its failing 5v pin is constantly at 5.05v

By operating the 328P closer to 3.3V (when you're at 4.48), you're lowering the threshold voltage needed for the Lora's signals to reliably register as a HIGH on the Nano's pins.

You will likely need proper level conversion between the Nano and Lora module, but that will depend on the exact module. Keep in mind that if your module says it has "5V tolerant" data pins, that doesn't mean it produces logic levels acceptable to a 5V Arduino Nano; it just means the module will accept 5V signals at its own inputs.

  • 1
    shouldn't according to datasheet, read ATmega328p operating at 5V everything above 3 V as HIGH?
    – Juraj
    Aug 3, 2021 at 17:59
  • In a roundabout way it does say that. I assume you're talking about the 0.6 * VCC for VIH low spec. I'm aware of that. I can't tell if you genuinely think this is relevant and not understood or you're just screwing with me. On the assumption that you're running at exactly 5V and you have a VIN(min) of 3V, you are still talking to a 3.3V device, nominal, which may not even be operated at exactly 3.3V. Taking the RFM95W as an example, VOH(min) is 0.9 * VCC, or 2.96V at 3.3V VCC. Even if the figure were slightly above 3V, they are still operating with no margin to speak of.
    – timemage
    Aug 6, 2021 at 14:50
  • yes it is possible
    – Juraj
    Aug 6, 2021 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.