Hi,
I have arduino nano iot 33 and it is working on my garden for about a week.
But now it doesnt want to connect to cloud, if its powered by battery. If i plug it to usb it connects to cloud with no problems.
I have no idea what to do with it, i tryed to reuplouad the program, and also removing and ading the board again to cloud. I dont see any other options to do with this type of problem.
Hi @filiflaj. Do you have something like this in the Arduino IoT Cloud Thing sketch that is running on your Nano 33 IoT board?:
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
You'll often see something like that in Arduino sketches. This code will make your program stay in an infinite loop until the serial port is opened in the Arduino Cloud Serial Monitor (or an equivalent application). The reason that is useful is because on native USB boards like yours, the board is not reset when you open Serial Monitor. That means any serial output printed between the time the program starts running and when you get Serial Monitor open will be lost.
In applications where missing that serial output would be a problem, it's useful to add this code to the sketch in order to make the program wait for the Serial Monitor before running.
However, if you are wanting to run your program when the board is not connected to Serial Monitor, you must remove that while loop to allow the rest of the sketch to run.
One of the common causes (among other possibilities) of people reporting the symptom "it runs when connected to USB, but not when powered from a battery is that their sketch has this sort of code. In this case, the actual relevant factor is "Serial Monitor" vs. "no Serial Monitor" rather than "USB" vs. "no USB", but we are often so accustomed to using Serial Monitor all the time as a useful debugging tool that we don't even think about the fact that we have it open.
Another thing you need to consider is that the power supply used has enough power to power the board. I am guessing you are using the Vin of the board to power the board.