Device To Device Data Transfer?

I can’t seem to find how to send data from one device to another in the network. If I have multiple dash devices can I simply call to a device and dump data to it or is there a call that the “Master” can do to the cloud to receive this data? I did find this topic Howto send data to dash pro? - #13 by pmjackson . Is this the only way to do this data transfer?

Thank you,
jay777

Hi, we don’t have a way to do it directly right now, but we have added more methods to do inbound data since that post.

We support sending data down to a dash via our dashboard or API or via a special webhook. There is more information about this on the dashboard.

You can use the listen() and attachHandlerInbound functions to receive data messages in your sketch. See https://hologram.io/docs/reference/dash/api/#hologramcloud-listen-port-

So that all helps you get data into your dash, but how do you get that data to come from another dash? Well, you could create a device webhook and then make a cloud route that posts to that webhook. It’s a little convoluted right now, but should get the job done.

Is there an example of how to send an SMS to a device on the network using just the device ID? I see how to do it from the web dashboard but not from the arduino code in the dash itself. I did see how I can setup the routes in the dashboard but I not how to send messages to different devices depending on the message.

Thank you,
jay777

@jay777
I took the long road in making the UBlox module works in the Arduino environment.
If you’re comfortable with AT Commands, then read SMS on the UBLOX AT Command .
Reuben helped me a lot getting the right firmware to work for the Serial Passthrough in Version 0.9.2. Once you have the right setup, you will see all the expected logs in the Arduino Serial Monitor including asynchronous responses from UBlox.

Here is the skeletal arduino code to help you start with:

//========== CONNECTION VARIABLES
char inputChar;
String returnChar;


void setup() {
  Serial.begin(9600);
  Dash.begin();
  SerialCloud.begin(115200);
  setupConnection();
}

void loop() {
  // CALL YOUR SMS AT Commands here.

}

//SETUP CONNECTION
void setupConnection() {
  Serial.println("1 = AT+COPS=2");
  sendAT(5000, "AT+COPS=2\r\n");
  Serial.println("2 = AT+URAT=1,2");
  sendAT(1000, "AT+URAT=1,2\r\n");
  Serial.println("3 = AT+COPS=0");
  sendAT(10000, "AT+COPS=0\r\n");
  Serial.println("4 = AT+UPSD=0,1");
  sendAT(2000, "AT+UPSD=0,1,\"your.apn.here\"\r\n");
  Serial.println("5 = AT+UPSDA=0,1");
  sendAT(1000, "AT+UPSDA=0,1\r\n");
  Serial.println("========= CONNECTION SETUP FINISHED =========");
  Dash.onLED();
}

void sendAT(int timeDelay, char *ATCommand) {
  SerialCloud.write(ATCommand);
  delay(timeDelay);
  while (SerialCloud.available()) {
    inputChar = (char)SerialCloud.read();
    returnChar += inputChar;
  }
  Serial.print("Return value = ");
  Serial.println(returnChar);
}

Hi, Arnold,

Great starter sketch! Unfortunately, I can’t get it to compile.

Getting:
invalid conversion from ‘char*’ to ‘uint8_t {aka unsigned char}’ [-fpermissive].

I did change SerialCloud to HologramCloud and removed the 115k speed call.

This is a new one for me. Thoughts? Thanks in advance for your time!

Michael

Show us which libraries are being included and your makefile, the section headed
#---------------- Compiler Options C ----------------

Most of my makefiles have:
CFLAGS += -funsigned-char

Make any unqualfied char type an unsigned char. Without this option, they default to a signed char.

I think this might sort out your problem.

davef

The first line of sendAT() should be SerialCloud.print(ATCommand); The write function expects a single byte (uint8_t) whereas print can take a String or a char*. The signature for sendAT should also change to void sendAT(int timeDelay, const char *ATCommand) to avoid another compiler warning.

If you are using the latest firmware and Arduino package, you can use a direct-to-modem passthrough mode without loading special firmware. The hologram_dash_passthrough example sketch included with the Arduino package shows how to switch the Dash into this passthrough mode. Here’s the above sketch using built-in passthrough mode.

char inputChar;
String returnChar;

void setup() {
  Serial.begin();

  //Requires System Firmware 0.9.10 or higher
  HologramCloud.enterPassthrough();
  //WARNING: Not officially supported. Advanced users only.
  setupConnection();
}

void loop() {
  // CALL YOUR SMS AT Commands here.

}

//SETUP CONNECTION
void setupConnection() {
  Serial.println("1 = AT+COPS=2");
  sendAT(5000, "AT+COPS=2\r\n");
  Serial.println("2 = AT+URAT=1,2");
  sendAT(1000, "AT+URAT=1,2\r\n");
  Serial.println("3 = AT+COPS=0");
  sendAT(10000, "AT+COPS=0\r\n");
  Serial.println("4 = AT+UPSD=0,1");
  sendAT(2000, "AT+UPSD=0,1,\"your.apn.here\"\r\n");
  Serial.println("5 = AT+UPSDA=0,1");
  sendAT(1000, "AT+UPSDA=0,1\r\n");
  Serial.println("========= CONNECTION SETUP FINISHED =========");
  Dash.onLED();
}

void sendAT(int timeDelay, const char *ATCommand) {
  SerialSystem.print(ATCommand);
  delay(timeDelay);
  while (SerialSystem.available()) {
    inputChar = (char)SerialSystem.read();
    returnChar += inputChar;
  }
  Serial.print("Return value = ");
  Serial.println(returnChar);
}