This is a simple project where a device simulator is used to act as Hexiwear and send sensors data to ARTIK Cloud. This is part one of the Connecting Hexiwear with ARTIK Cloud.
To use ARTIK Cloud, you need to create a Samsung Account.
Create a device typeFollow the following instructions to create a device type called "Hexiwear Simple":
- Select "Device Types" from the "Dashboard" menu. Click the "+ New Device Type" button.
- Enter a display name "Hexiwear Simple" and unique name (a valid example is given) for your device type.
- Click "Create Device Type." This takes you to a detailed view of your device types.
- Click "+ New Manifest" to enter Simple Manifest creation.
- Enter at least one field name, data type and unit. The form auto-suggests standard fields and units as you type. You may also click the "Browse" links to see all the available options. Click "Save".
- Click the "Device Actions" tab to optionally add Actions the device type is capable of receiving. As with the device fields, the form auto-suggests standard Actions as you type, or you may click "Browse" to see the Actions that are already available. Click "Save".
- After you have entered all fields and Actions for your Simple Manifest, click the "Activate Manifest" button on the corresponding tab to enable your Simple Manifest.
Follow these instructions to create an application using the Developer Dashboard:
- Set "Redirect URL" for your application to
http://localhost:8000/acdemo/index.php
- Choose "Client Credentials, auth code, implicit".
- Under "PERMISSIONS", click "Add Device Type" button. Choose "Hexiwear Simple" as the device type. Check both "Read" and "Write" permissions for this device type.
.
Connect a device- Select "My ARTIK Cloud" from the ARTIK Cloud main site. If you already have connected devices, click "+ Connect another device…".
- In the box, start typing the name of your device. The available options will pop up. Select one.
- Click the "Connect Device…" button.
- Click the settings icon of the device you just connected. A window like the following will appear.
- Make a note of the device ID on the above screen. You will use it in the following section.
Before you can run a device simulator, you need to get an access token:
- Navigate to the API Console and toggle the method
GET /users/self
in the Users API. Click the "TRY IT!" button.
- Copy the access token from the "Request Headers" block. The token is the string next to the word "Bearer".
- Download the Device Simulator and run the following command. Java JDK v8 update 77 or higher is required.
java -jar device-simulator.jar -token=<user_token>
- Use "ld" command to list available devices
- Guess scenario using the "gs" command.
- Execute the "rs" command to simulate sending data to ARTIK Cloud.
Visit My ARTIK Cloud to visualize the data sent to ARTIK Cloud by the Device Simulator.
- Click the device name on the dashboard.
- Click the "+/- CHARTS" button and check the data fields for your Hexiwear sensors:
temperature
,humidity
andpressure
.
- Now view the simulation data in real time.
- Click "DATA LOGS" to view the messages sent.
- Stop your simulation by entering
s
orstop
followed by the "Enter" key in the Simulator.
Comments