MKR1500 with Hologram to Arduino Cloud

I have successfully connected the Arduino MKR1010 WiFi and published data to the Arduino Cloud, Dashboard and Phone widgets.

I am now trying to do the same with an Arduino MKR1500 NB-IoT. I am using a Hologram Sim. I can clearly see the Hologram SIM is connected through their dashboard to AT&T or TMobile depending on if I'm at my house or office. There is data sessions and some non-data sessions.

I can not get this device connected to the Arduino Cloud. I am using their APN = hologram with no pin, username or password. I have edited the Things Properties page to reflect:

NBConnectionHandler ArduinoIoTPreferredConnection(GPRS_APN);

At this point, I am using only the #include <BQ24195.h> to read battery life. I have a boolean for battery state, I am using cloudTime, and cloudLocation with fixed or static long, lat. All of this worked just fine on MKR1010.

#include "thingProperties.h"

#include <BQ24195.h>
float rawADC;
float voltADC;
float voltBat;
int R1 = 330000;
int R2 = 1000000;
int max_Source_voltage;

float batteryFullVoltage = 4.2;
float batteryEmptyVoltage = 3.7;

float batteryCapacity = 3.000;

void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);

// Defined in thingProperties.h
initProperties();

// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();

analogReference(AR_DEFAULT);
analogReadResolution(12);
PMIC.begin();
PMIC.enableBoostMode();
PMIC.setMinimumSystemVoltage(batteryEmptyVoltage);
PMIC.setChargeVoltage(batteryFullVoltage);
PMIC.setChargeCurrent(batteryCapacity/2);

PMIC.enableCharge();
max_Source_voltage = (3.3 * (R1 + R2))/R2;

}

void loop() {
ArduinoCloud.update();
// Your code here
rawADC = analogRead(ADC_BATTERY);
voltADC = rawADC * (3.3/4095.0);
voltBat = voltADC * (max_Source_voltage/3.3);
int new_batt = (voltBat - batteryEmptyVoltage) * (100) / (batteryFullVoltage - batteryEmptyVoltage);
Serial.print("The ADC on PB09 reads a value of ");
Serial.print(rawADC);
Serial.print(" which is equivialent to ");
Serial.print(voltADC);
Serial.print("V. This means the battery voltage is ");
Serial.print(voltBat);
Serial.print("V. Which is equivalent to a charge level of ");
Serial.print(new_batt);
battery=(new_batt);
Serial.println("%.");

locationCoordinates = Location(40.1863260943,-84.92832157);//static address

if (ArduinoCloud.connected()) {
cloudTime = ArduinoCloud.getLocalTime();
}

if (battery >=21) {
batteryState = true;
}
else if (battery <=20) {
batteryState = false;

}

}//end of programUse code tags to format code for the forum

Please edit and fix your post above. Code tags should always be used when posting code. Read the forum guide in the sticky post at the top of most (but, unfortunately, not this) forum sections to find out how to do that and other important stuff.

Were you able to fix it? I am having the same problem.

Not necessarily.
Watch the MKR1010 on the serial monitor so you can see the MQTT broker progress. This made me change some code (against recommendations) to add delays in the connection process. I did get the NB1500 to connect, but doing anything such as sleep, lower power, re-connect, etc. is not really working

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.