Lora32u4 II running on battery

Dear, I have a lora32u4II board from bs france, I loaded the blink sketch, disconnected it from the pc and fed it with a cell phone charger through the usb port, and it works correctly. Now I upload the sender example sketch and I test it on the pc and it works correctly. He disconnected it and I put it on the same cell phone charger and it doesn’t work, I added to the code to turn on and off a led to be sure, and it does not work. It doesn’t even turn on the led. All tests are always using the cell phone charger that works ok. Anyone have any idea what’s going on? From already thank you very much Greetings John

The LoRa radio will require more current than just blinking an LED and the majority of cell phone chargers are built to a price, a very low one, so anything could be happening.

Have you considered trying a different one?

So the board can blink the LED.

Now I upload the sender example sketch and I test it on the pc and it works correctly.

Which ‘sender example sketch’ ?

Is this code that bs france who sell the module have published ?

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

// uncomment the section corresponding to your board
// BSFrance 2017 contact@bsrance.fr

// //LoR32u4 433MHz V1.0 (white board)
// #define SCK 15
// #define MISO 14
// #define MOSI 16
// #define SS 1
// #define RST 4
// #define DI0 7
// #define BAND 433E6
// #define PABOOST true

// //LoR32u4 433MHz V1.2 (white board)
// #define SCK 15
// #define MISO 14
// #define MOSI 16
// #define SS 8
// #define RST 4
// #define DI0 7
// #define BAND 433E6
// #define PABOOST true

//LoR32u4II 868MHz or 915MHz (black board)
#define SCK 15
#define MISO 14
#define MOSI 16
#define SS 8
#define RST 4
#define DI0 7
#define BAND 868E6 // 915E6
#define PABOOST true

int counter = 0;

void setup() {
delay(2500);
Serial.begin(115200);
while (!Serial);
Serial.println(“LoRa Sender”);
LoRa.setPins(SS,RST,DI0);
if (!LoRa.begin(BAND,PABOOST)) {
Serial.println(“Starting LoRa failed!”);
while (1);
}
pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
// send packet
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(5000);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000);
}

What type of diet do you suggest?

Diet? I suggested trying a different phone charger.

I’m wondering how you know the board is working with your LoRa to LoRa sketch - do you have another board for it to transmit to?

And are you going to configure the software for LoRaWAN on TTN which is what we discuss here.

Thanks for your answer, yes of course I have two of these plates. If I test everything from the pc, one sends and the other receives correctly.

You didn’t answer my second question - which is rather important because LoRa to LoRa is not discussed on this forum.

I am from Uruguay and there is no access to this network, but if what we can do is use this fantastic technology to join plates in the field, for this reason it is lora a lora

There would be if you buy a gateway.

You might want to consider choice of board also as looks like they shut down about a year ago. Though a later post in this thread also mentions boards still available through Aliexpress…

ok, but in this At the moment I am developing a solution for use in a forest. and this is delaying the delivery of it

That is very inconvenent for you but does not make the question on topic for this forum. This forum is for LoraWAN in particular using TTN. Not for point to point Lora.

sorry for the question in this forum, when checking on the internet I see that they are a community with a lot of action.

Jazpiroz

Here’s the problem I see. In the arduino sketch there is a line that reads

While(!serial);

The sketch WILL run when the 32u4 is connected to your PC through the serial port. The sketch will not run when using the phone charger because there is no serial port.

While(!serial); means: while there is not a serial connection wait forever, do not continue.

Either delete that line or comment it out with //

2 Likes

Only when a serial monitor is running.

Removing that line will lose the first output sent to the serial port when it’s not yet ready.

It’s better to build a loop that re-checks if the serial port is ready every second with a timout (e.g. 5 or 10 seconds).

This gives you time to start a serial monitor if not already open when connected to the PC and when not connected to a PC it will just continue after the timeout.

2 Likes

Thanks, a lot!!! I will check your post

Yes. That is a bettet answer but I wanted to get the sketch working first. Baby steps.