I am working on a project with Arduino MKR 1400 GSM and I would like to power the arduino board using an external power source (https://www.reichelt.de/raspberry-pi-netzteil-5-1-v-3-0-a-usb-type-c-eu-stecker-s-rpi-ps-15w-bk-eu-p260010.html?PROVID=2788&gclid=CjwKCAjwy7CKBhBMEiwA0Eb7ah0tvjJTgi1IruE69oZEm51ONn9dgkCZK45JE1EU5hNgoXfJ1CA8NBoCJLgQAvD_BwE) via the VIN pin without an additional 3.7V battery.
I have copied the code that I am using and the board resets and restarts every time the board tries to initiate GSM connection (gsmAccess.begin(PINNUMBER) == GSM_READY). According to the documentation, this operation needs more current and the board restarts when it does not get enough current for this operation and 5V 3A power supply should be enough to power the board for cellular transmission without the need for an additional battery. However, I am not able to start GSM connection with this power source. I have cut the micro USB end and connect GND from the power source to GND on the arduino board and VCC from the power source to 5V/VIN on the arduino board. As mentioned, the board is not able to initiate the GSM connection with this set up.
I have gone through all the suggestions on the forum and I have not been able to resolve this. Could you please let me know the best way to power the arduino MKR 1400 GSM via VIN such that GSM connection is initiated.
The board works with the additional 3.7V battery (https://www.amazon.de/VinCorp-2500mAh-Stecker-Empf%C3%A4nger-Quadrocopter/dp/B0863PZPSM/ref=asc_df_B0863PZPSM/?tag=googshopde-21&linkCode=df0&hvadid=447410901006&hvpos=&hvnetw=g&hvrand=1221952135560228729&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9044320&hvtargid=pla-925522392231&psc=1&th=1&psc=1)
Please let me know if you need more information from my side.
Please ignore the values given for the variables server and path
#include <MKRGSM.h>
#include <ArduinoHttpClient.h>
#include <ArduinoJson.h>
// PIN Number
const char PINNUMBER[] = "";
const char GPRS_APN[] = "";
const char GPRS_LOGIN[] = "";
const char GPRS_PASSWORD[] = "";
GSMClient client;
GPRS gprs;
GSM gsmAccess;
String currentBarcode;
char server[] = "test.net";
char path[] = "/test";
int port = 80;
StaticJsonDocument<200> jsonBuffer;
HttpClient httpClient = HttpClient(client, server, port);
JsonObject root = jsonBuffer.to<JsonObject>();
int count = 0;
void setup() {
Serial.begin(9600);
boolean connected = false;
while (!connected) {
if ((gsmAccess.begin(PINNUMBER) == GSM_READY) &&
(gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY)) {
connected = true;
} else {
delay(1000);
}
}
}
void loop() {
root["boxid"] = "Test";
root["gtin"] = "Test";
if (client.connect(server, port)) {
postToWia(root);
delay(1000);
} else {
}
if (!client.available() && !client.connected()) {
client.stop();
for (;;)
;
}
}
void postToWia(JsonObject& data) {
String dataStr = "";
serializeJson(data, dataStr);
httpClient.beginRequest();
httpClient.post(path);
httpClient.sendHeader("Content-Type", "application/json");
httpClient.sendHeader("Content-Length", dataStr.length());
//httpClient.sendHeader("Authorization", "Bearer " + String(device_secret_key));
httpClient.beginBody();
httpClient.print(dataStr);
httpClient.endRequest();
}