Dash Cloud Example not working after first success

Newbie here:
I am running the arduino software to program my Hologram Dash. I have loaded the example script (hologram_dash_cloud) from the examples and have successfully loaded it onto my Dash. My Dash begins to blink a LED as it should and I can see the data on the hologram cloud console.

The sketch is written to send a message to the cloud every 30min, but it never sends another message.

I have not modified the default sketch in any way. Further, simply power cycling the Dash doesn’t wake it back up for another attempt. It stays in deep sleep mode and I have to rather wait or re-flash it.

I have the same issue on my second Dash.

Trying to work myself through these steps before stepping further into development.

Thanks!

@abartjc, I’ve been noticing the same thing with cloud messaging. Upon reset the device will transmit to the cloud successfully, but never seems to send another message that shows up on the Dashboard. I have to hit reset or disconnect power to get a message to show.

As far as your power issue disconnect the power and leave it disconnected for 15 seconds or so. I have found that because the sleep current is so low that if you just disconnect the battery and plug it back in the Dash never really seems to detect that it lost power.

Are you both on the latest firmware?

When I switched to my spare Dash yesterday the IDE asked me to update the firmware which I did, but I don’t recall which version it updated to. What I have noticed is that when I push the sketch to the Dash (serially or OTA) it will transmit upon restart, then it doesn’t seem to transmit any more after that even though it goes through it’s sleep and wake cycles normally. It is clearly connecting to the Cloud, because it is able to get OTA updates that I push from the IDE. I am going to restart from scratch this morning with a clean sketch and see if it was something I did or something else.

HologramCloud.systemVersion() returns 0.10.3
Dash.bootVersion() returns 3.1.1

Had to push an OTA update to get it to transmit that.

Yes, running the latest firmware here as well. I am seeing the same behavior as @ShaneO where it will wake out of deep sleep and act like its working but it doesn’t actually send any data to the cloud.

Make sure you update the Arduino package for the Dash in addition to the firmware. There is a change in that example that was needed to work with changes to the firmware. Here’s the updated sketch:

Doesn’t seem to be any major change to the Dash_Cloud demo file. It looks like the Dash is being snoozed while waiting for the cloud connection and the socket has changed from 4444 to 4010.

Doesn’t explain why the one I am using works one time and not afterwards, or I just can’t see it.

I went another route and stripped a lot of calls that were of no use to me and had the Dash connect and rather than sleep I just had it snooze for 60 seconds every loop. That seemed to work and I was getting a transmission every 60 seconds.

I am going to load the new arduino file and see if that works as well.

Am I correct in determining that the While loop that snoozes the Dash is to make sure the Dash is connected to the cloud before continuing? Was this necessary to prevent the Dash from running through the sketch and trying to send the message when no connection had been established?

@abartjc and @Erik, Got it working. I took a bit to upgrade the Arduino package to 1.11 because I couldn’t find the Dash Board package listed anywhere. I finally reloaded the Arduino IDE and setup the board manager URL again and the package showed up and I was able to update it.

I did find a few more changes than I initially noticed in the Repo. Below is the stripped version I have working right now. This is stripped down from the Dash Cloud example.

//Process a received SMS
void cloud_sms(const String &sender, const rtc_datetime_t &timestamp, const String &message) {
//Echo the received SMS back into the cloud
HologramCloud.print("From: “);
HologramCloud.print(sender);
HologramCloud.print(” @ “);
HologramCloud.print(timestamp);
HologramCloud.print(” Message: ");
HologramCloud.print(message);
HologramCloud.attachTopic(“rx_sms”);
HologramCloud.sendMessage();
}

#define SIZE_INBOUND 4096 //Inbound message size limit
char buffer_inbound[SIZE_INBOUND]; //Holds inbound message

//Process a received inbound message
void cloud_inbound(int length) {
buffer_inbound[length] = 0; //NULL terminate the data for printing as a String

HologramCloud.sendMessage(buffer_inbound, “inbound”);
}

void cloud_notify(cloud_event e) {
switch(e) {
case CLOUD_EVENT_CONNECTED:
//re-open the server socket on port 4010
HologramCloud.listen(4010);
break;
}
}

void setup() {
//On startup the modem attempts to connect to the cell network, if available

//Use the cloud_sms function to process incoming SMS
HologramCloud.attachHandlerSMS(cloud_sms);

//Use the cloud_inbound function to process a received message.
//Uses a buffer and size defined in the sketch for user requirements.
//If String data, reserve one byte for NULL-terminator
//The full buffer size can be used for binary or non-printed data.
HologramCloud.attachHandlerInbound(cloud_inbound,
buffer_inbound,
SIZE_INBOUND-1);

HologramCloud.attachHandlerNotify(cloud_notify);

while(!HologramCloud.isConnected()) {
Dash.snooze(1000);
}
//Send a message to the Hologram Cloud with the topic “cloud_demo”
//Will connect to the Hologram Cloud automatically
HologramCloud.sendMessage(“Hologram Cloud Demo Active”, “cloud_demo”);

//sync clock with network time
rtc_datetime_t dt;
if(HologramCloud.getNetworkTime(dt)) {
Clock.setDateTime(dt);
}
}

void loop() {
//Blink the LED while the Dash is awake
Dash.pulseLED(500, 500);

//Set the Clock Alarm to wake the Dash up - Sets alarm state true for x mins
Clock.setAlarmMinutesFromNow(2);

while(!HologramCloud.isConnected()) {
Dash.snooze(1000);
}
//Open a server socket on port 4010 to receive messages
HologramCloud.listen(4010);

//Buffer a message to send to the Hologram Cloud
HologramCloud.print("A01: ");
HologramCloud.println(analogRead(A01));
// HologramCloud.print(“ChargerBattery: “);
// HologramCloud.print(Charger.batteryPercentage());
// HologramCloud.println(”%”);
HologramCloud.print("Signal Strength: ");
HologramCloud.println(HologramCloud.getSignalStrength());
//Attach topics to the message for advanced routing and processing
HologramCloud.attachTopic(“A01”);
//HologramCloud.attachTopic(“Battery”);
HologramCloud.attachTopic(“SignalStrength”);
HologramCloud.print("System Version: ");
HologramCloud.println(HologramCloud.systemVersion());
HologramCloud.print("BootVersion: ");
HologramCloud.println(Dash.bootVersion());

//Send Message
HologramCloud.sendMessage();
HologramCloud.clear();
//Dash.snooze(60000);

//Done with the modem for now, turn it off to save power
//This closes all sockets
//if(!Clock.alarmExpired())
HologramCloud.powerDown();

// deep sleep for x mins
// if(!Clock.alarmExpired())
Dash.deepSleepMin(15);

HologramCloud.powerUp();

 //Manually check for events, such as an SMS received while in deep sleep

//Optional here because events are checked automatically before powering
//down the modem in the next line…
HologramCloud.pollEvents();
}
//After each loop, if the modem is powered, modem events are checked.

You are right about the check for connection. The internal workings of sendMessage have changed to be less blocking. To ensure message delivery you need to either check the connection state first, or retry after message send failures.

Makes sense. I assuming doing the way above where I snooze while waiting could result in a continuous loop if the Dash was unable to connect. I can see where the retry on failure would be a better option

@ShaneO I am running on my backup board (plugged it in when I got to the office today and haven’t had a chance to check it until now) and sure enough it has been hitting the cloud console every 30min without me changing 1 thing since yesterday. @Erik is there any way of checking if there was a change on your end?

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