Filter results by

Hello, World!

Time To First Hello World (TTFHW) is 4 minutes.

This article is a hands-on introduction to several ARTIK Cloud concepts we covered in Basics. We will connect a simulated device to ARTIK Cloud that sends and receives data. In doing so, you'll get a tangible understanding of ARTIK Cloud without writing a single line of code.

We will also demonstrate some ARTIK Cloud tools that you'll be using often. This diagram shows how the ARTIK Cloud entities interact in this Hello World exploration (click to expand).

System diagram

Step 1: Log in and connect a device

Log into My ARTIK Cloud. You may need to create an account first.

Now connect a "Example Activity Tracker" device to ARTIK Cloud (device type unique name: cloud.artik.example.activitytracker).

You do not need a real device to perform the connection.

  • If this is your first time in the Portal, you will be asked to connect your first device. Type "Example Activity Tracker" into the search box. This calls up the device type "Example Activity Tracker". Connect a device
  • Name the activity tracker device you are connecting to ARTIK Cloud (e.g., "My GearFit Device"). Name a device
  • Click "CONNECT DEVICE…"

Step 2: Get an access token

Navigate to the API Console and log in with your user account used in Step 1.

  • Toggle the method GET /users/self in the Users API. Toggle method
  • Click the "TRY IT!" button.
  • Copy the access token from the "Request Headers" block. The token is the string next to the word "Bearer". Request header

Stay logged into the API Console. Otherwise the token becomes invalid and you cannot perform the following operations in the Device Simulator.

Step 3: Configure the Device Simulator

Download the Device Simulator. In a terminal, type cd to navigate to the directory containing the Simulator, and run the following command to start it. (You need the token obtained above.)

1
java -jar device-simulator.jar -token=1c49e70b6

Enter list devices (or its shortcut ld) to display the device list. The list, which includes your Gear Fit device, will look like this (click to expand): List devices

Create a scenario template to configure the simulation of My GearFit Device data. In the following command, the first input argument is did (device ID of the device), which we obtained from the output of ld above.

1
gs 1263e1b220364c889793c5d602772b75 myGearFitSim

The output will display the location of the created scenario file: Guess Gear Fit Scenario

You can open the JSON file to see how the data for each field is generated. Normally you want to edit this JSON file to tweak the fields based on your needs. For this exploration, we can skip this step.

If you want to be thorough, this is how you can edit the JSON file to generate data that makes the most sense for the "Example Activity Tracker" device type.

We're ready to start the simulation!

Step 4: Send data to ARTIK Cloud

To simulate sending data to ARTIK Cloud, enter the rs command. The first input argument is did and the second is the scenario filename.

1
rs 1263e1b220364c889793c5d602772b75 myGearFitSim

The Simulator will make an HTTP POST to send each message from My GearFit Device. The output looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Loading scenario from /home/someuser/device-simulator/target/1263e1b220364c889793c5d602772b75/myGearFitSim.json
Reading file: /home/someuser/device-simulator/target/1263e1b220364c889793c5d602772b75/myGearFitSim.json
$ Using this token to send the messages: 44d8ebcb82d908
Send #0 {"stepCount":1008,"description":"jbt","heartRate":39,"state":0,"activity":2}
Got MID: bb7d02c0181d4445b04f6b0575e78d04
Send #1 {"description":"afvu","heartRate":165,"state":0,"activity":1}
Got MID: 5771ec32ee8b41949cfd3c0b9b417886
Send #2 {"description":"zkxl","heartRate":185,"state":0,"activity":1}
Got MID: ff691299577c42b19e7f2fa927394fbc
Send #3 {"description":"hqmtwyvcpk","heartRate":195,"state":0,"activity":1}
Got MID: 7dc2faf9c0a9431fbf918a41b342df04
Send #4 {"stepCount":1010,"description":"elbn","heartRate":179,"state":0,"activity":0}
Got MID: 8aa1a183895c42efb905223b3cb5f918
...

Step 5: Visualize the data

Go back to My ARTIK Cloud to visualize the data sent to ARTIK Cloud by the Device Simulator. Since this data is sent on behalf of My GearFit Device, click the device name on the dashboard.

device simulator quick start magnifying glass

Click the "+/- CHARTS" button and check the data fields for your Gear Fit sensors: heartRate, stepCount, state, activity.

device simulator select charts

Now you can view your simulation data in real-time!

device simulator realtime data

You can also click "DATA LOGS" to view and sort the individual messages sent.

device simulator data table

Stop your simulation by entering s or stop followed by the "Enter" key in the Simulator. You can also enter ? for more help.

That's it!

Now you have a feel for the ARTIK Cloud basics: connecting a device, sending data to ARTIK Cloud, and viewing and visualizing that data.

Protip: You can also send commands called Actions to devices via ARTIK Cloud. Feeling adventurous enough to try it out?

Read on to learn about ARTIK Cloud in depth. You can also jump ahead to peek at other tutorials or play with some advanced ARTIK Cloud features using the Device Simulator.