Skip to main content
All CollectionsConnect your Devices
Hologram and Ubidots Cloud-to-Cloud Integration
Hologram and Ubidots Cloud-to-Cloud Integration

Connect and send data from SIMCOM module to Hologram and Ubidots

Sergio M avatar
Written by Sergio M
Updated over a month ago

Hologram.io is a cellular connection platform changing the data connection game with a Free SIM cards and 1MB of data per month (for life) via their developer plan. Hologram is trailblazing to say the least and their platform lets you interact with the devices easily to route incoming and outgoing messages, all via a secure and scalable API. Matching Hologram with Ubidots unlocks 1,000s of IoT solutions at extremely affordable prices (if not free). 

For more on the Hologram Platform and its history, check out: "Konekt is now Hologram - A Cellular Platform for the internet of Things"

With this guide, an IoT solution in mind, and Hologram's Dash in hand, you will learn how to setup a cloud-to-cloud integration using the features and tools provided by Hologram and Ubidots!

Requirements 

1. Hardware Setup

1.- First, activate the global SIM card for connecting to the Hologram cellular network. If you don't know how activate the global SIM card, please reference this link, follow all the steps, and return back to this article.

2. Once the SIM card is activated, insert the SIM card and plugin the atenna into the SIMCOM module.

3. Connect the SIMCOM module with the Arduino UNO. Please reference to the table below for the connections:

NOTE: Before running our examples please, download Adafruit_FONA library and run FONAtest example to verify the connectivity of the module. 

2. Hologram setup

Every time the SIMCOM module sends a message over the cellular network, its first destination is the Hologram Cloud, but the message's journey doesn't have to end there! Using the Cloud Services Router (CSR) you can forward your data to Ubidots via HTTP for additional analytics and visualization for your IoT solution. 

Routes in the Hologram platform provide convenient methods to trigger actions (Data storage, Email, SMS, Webhooks, etc) by the presence or even absence of a device message’s topic. In this case, we're going to trigger a Webhook action to forward the module's messages to Ubidots to simple display.

1.- Go to the Routes section from the Hologram Dashboard and click the "Add new route" button.

2.- Next, you have to assign the route components as the topics and the action. Assign "Ubidots Route" as the nickname for the route; this will be the identifier of this route in your route list:

3.- Next, select topics which the route will act upon. In this case select the topic assigned to your device "_DEVICE_{Device-ID}_":

4.- Then, select the Action App called "Advanced Webhook Builder (Your Own App)" to integrate it with Ubidots:

Building your Webhook
Now, you have to set the configuration required to handle the request. Please assign the parameters below to the specific fields:

  • Destination URL:

https://industrial.api.ubidots.com/api/v1.6/devices/<<device_id>>/?token={Assign_your_Ubidots_TOKEN}
  • Payload for POST:  <<decdata>> 

Once you've entered the parameters, reference the image below to verify. 

NOTE: To know more about the available variables to POST and the structures, see this guide.

4.- To finish, press "Add route":

Once the route is added, you will see it in the route list:

3. Sending messages

Now that you've configure your webhook from Hologram to Ubidots and connected the SIMCOM module with the Arduino UNO, it is time to code! :)   

1.- Download the Arduino IDE if you not already  have it.

2.- Select your Arduino UNO from Tools > Board menu.

3.- Additionally, we need to be able to communicate with the Arduino so be sure to select the correct port com with your computer. 

  • Go to Tools > Port >  Select the appropriate PORT for your device. Also, to keep everything running fast and smooth - let's make sure the upload speed is optimized to 19200. Go to Tools > Upload Speed > 19200:

4.- Next, go to the library repository to download the Hologram SIMCOM library. To download the library click the green button, "Clone or download," and select "Download ZIP".

5.- Now back in the Arduino IDE, click on Sketch -> Include Library -> Add .ZIP Library

6.- Select the .ZIP file you've just downloaded and then “Accept” or “Choose”. If successful you will receive the message below in the Arduino IDE:

7.- Copy and paste the code below into the Arduino IDE:

/********************************
 * Libraries included
 *******************************/
#include <HologramSIMCOM.h>

/********************************
 * Constants and objects
 *******************************/
#define RX_PIN 2 // SIM800 RX connected to pin D8
#define TX_PIN 3 // SIM800 TX connected to pin D7
#define RESET_PIN 4 // SIM800 reset connected to pin D10
#define HOLO_KEY "********" // Replace w/your SIM key

/* Put here your variable's labels*/
String VARIABLE_LABEL_1 = "temperature";
String VARIABLE_LABEL_2 = "humidity";

/****************************************
 * Initializate constructors for objects
 ****************************************/
HologramSIMCOM Hologram(TX_PIN, RX_PIN, RESET_PIN, HOLO_KEY); // Instantiate Hologram

/****************************************
 * Main Functions
 ****************************************/
void setup() {

  Serial.begin(19200);
  while(!Serial);

  /* begin(baud, serverPort) starts modem, syncs baud and opens incoming port
     begin(baud) would start the modem but not open an incoming server port */
  Hologram.begin(19200, 8888);

}

void loop() {

  /* debug() allows you to send commands directly to the module and see responses */
  Hologram.debug();

  /* Reading the values of the sensors */
  float sensor_1 = analogRead(A0);
  float sensor_2 = analogRead(A1);

  /* Transforms the values of the sensors to String */
  String sensor1_value = String(sensor_1);
  String sensor2_value = String(sensor_2);  

  /* Builds the payload with structure: {"temperature":25.00,"humidity":50.00} */
  String payload = "{\"" + VARIABLE_LABEL_1 + "\":" + String(sensor1_value) + ", \"" + VARIABLE_LABEL_2 + "\":" + String(sensor2_value) + "}";
 
  /* Send JSON data to Hologram's Cloud */
  Hologram.send(payload);

  /* 10 seconds delay */
  delay(10000);
}

8. Once you pasted the code, you have to assign the SIM key into the parameters required:

To get the SIM key, go to the device's details into the Hologram portal and select the Configuration tab:

Scroll down until you see the "Cloud service router" section, then press "+ Show Router Credentials":

To generate the key, just press "Generate new CSR key". Once the key is generated, assign it into the code where is required.

9.- Once you've pasted the code and updated the device key, you must Verify this within the Arduino IDE. To do this, in the top left corner of our Arduino IDE you will see the below icons. Choose the "check mark" icon to verify any code.

Once the code is verified, you will receive a "Done compiling" message below in the Arduino IDE.

Next, your have to upload the code into your Arduino UNO. To do this, choose the right-arrow icon beside the check mark icon. 

Once the code is uploaded, you will receive a "Done uploading" message bellow in the Arduino IDE.

10.- Open the Serial Monitor to visualize the response of the SIMCOM module and the data sent to the hologram cloud. To do this, in the top-right corner of our Arduino IDE select the "magnifying glass" icon to display a serial monitor.

NOTE: Wait a couple of moments until the device initializes the connection, and sends the message to the Hologram Cloud.

13.- You can verify the message with the "Ubidots Route" previously configured. Go to your Ubidots account, enter the Devices section and find your the incoming messages:

The device is created with the ID of your device; If you desire you can modify the name of the device with a friendly one, like the one below, please reference the article below: 

12.- To complete your work, go to the Console tab from the Hologram portal and confirm the message has been received:

4. Result

In only a few minutes you've built a cloud-to-cloud integration between Hologram's cellular connectivity and Ubidots for your IoT solution. Now it is time to create a dashboard to control and manage the variables of your new device(s). To learn more about Ubidots widgets and events, check out these video tutorials.

Did this answer your question?