How to Link a Device
Linking your GRiSP2
board to your account is simple, whether you choose automatic or manual linking.
Prerequisites
Before you can begin using GRiSP.io
to manage your IoT devices, ensure you have the following:
- GRiSP.io Account: You must have an account registered at GRiSP.io If you don't have one, please Register before continuing.
- GRiSP Board: Ensure you have access to a GRiSP board to link to your account. If you do not currently own a GRiSP board, you can purchase one from the GRiSP shop on the official website.
Automatic Linking Ethernet Only
For a straightforward setup:
- Download the pre-configured application After logging in to GRiSP.io, download the pre-configured application for your GRiSP board. This template contains the necessary files for automatic linking.
- Prepare the MicroSD Card Insert a MicroSD card into your computer and ensure it is formatted to
FAT32
(on macOS, this is called "Format MS-DOS FAT"). Extract the downloaded template file to the root directory of the MicroSD card. Make sure no other files are on the card to avoid potential conflicts. - Connect the GRiSP Board to the Network via Ethernet Insert the prepared MicroSD card into your GRiSP board. Then, connect the board to your network using an Ethernet cable. Ensure your network has DHCP enabled, as this will allow the board to automatically obtain an IP address.
- Automatic Device Registration Once powered on and connected, your GRiSP board will
automatically
link to your account. You can monitor and manage the device through your account dashboard.
Manual Linking Ethernet / Wi-Fi
In this tutorial, we will use the project name robot
. Replace the MicroSD card path /tmp/sd_card
with the path where your MicroSD card is mounted.
Prerequisite
Set up your development environment by following this guide.
- Create your project: Follow the CLI instruction by running
rebar3 grisp configure
. This will guide you through creating the application, ensuring all required dependencies are included.
In the following example, we set up a Wi-Fi
connection, but this step can be skipped by pressing n
. We also activated distributed Erlang
if you want to use the remote shell.
Additionally, you will need to replace the value MyToken
with your private token from GRiSP.io.
$ cd GRiSP
$ rebar3 grisp configure
# Enter the name of your application
App name (default: robot)>
# Specify the Erlang version to use
Erlang version (default: 25)>
# Define the path to the SD card where the application will be deployed.
SD Card path (default: /path/to/SD-card)>
Use network ? (y/N)> y
# If you want to use ethernet press 'n'
Use Wi-Fi ? (y/N)> y
# Your Wi-Fi name
Wi-Fi SSID> my_wifi
# Your password
Wi-Fi password> my_wifi_password
Enable GRiSP.io integration ? (y/N)> y
Do you need to link your GRiSP-2 board ? (y/N)> y
# Write the token without any <, > or "
Please enter your personal device linking token> MyToken
# If you want to use the remote shell press 'y'
Enable Distributed Erlang ? (y/N)> y
# Cookie is necessary for remote shell.
Erlang Cookie (default: grisp)> my_cookie
- Deploy and access the Erlang shell Once configured, deploy your application to the MicroSD card. Then, access the Erlang shell on your GRiSP board. You can connect to the GRiSP board shell via serial (USB) or remote shell.
- Link the device From the Erlang shell, run the following command to link your GRiSP-2 board:
1> grisp_connect:link_device().