Set up Your Programming Environment
The first step in developing your Direct Connected Device is getting your programming environment up and running.
#
Clone the RepositoryThere are two Git repositories for working with the Direct Connected Devices SDK. The first Git repository has the core Device SDK library. The second Git repository contains reference Device applications.
You can choose to download only the References repository from Git if the chipset you are using has already been ported to SmartThings. In this case, the IoT Core Device Library and chipset SDK can be downloaded as submodules in the reference repository through the setup.py
script defined below. If you are new to the SmartThings SDK for Direct Connected Devices, we recommend you to use the reference repository for easier understanding.
Clone the Git repository into your desired directory on your local machine. In this example, we will use the References repository:
info
For the rest of this document, we will assume the above path ~st-device-sdk-c-ref
is the default example source code.
#
Download the Core Device Library and chipset vendor SDKWhen using the reference repository, you can use the setup.py
script found in the repo to automatically download the IoT Core Device Library
and your chipset vendor's SDK (e.g. esp8266
):
#
Create a Device IdentityIn order for your Device to connect to the SmartThings Cloud, authentication data files are required.
Run the following stdk-keygen
script in a terminal on your local machine to create a Device Identity.
Copy the serial number and public key. You will need to upload these values to the Developer Workspace - Projects page when you register your device later in the development process.
If you create a device identity with a command line option like the example above, you can get ready to use the device_info.json directly.
#
Set Up the Appropriate ToolchainYou must set up a toolchain according to each chipset you selected.
#
Example: ESP8266- Set up the ESP8266 toolchain by following the official Espressif documentation.
- Set up the ESP8266 environment for the SmartThings SDK for Direct Connected Devices by running
setup.py
:
#
Example: ESP32- Set up the ESP822 development environment by following the official Espressif documentation.
- Set up the ESP32 environment for the SmartThings SDK for Direct Connected Devices by running
setup.py
:
#
Example: ESP32_v3.3 (legacy)- Set up the ESP32 toolchain by following the official Espressif documentation.
- Set up the ESP32 v3.3 environment for the SmartThings SDK for Direct Connected Devices by running
setup.py
:
#
Example: RTL8195- Install and configure the mbed microcontroller to use the USB serial port on Windows.
- Upgrade the DAP firmware. The recommended DAP firmware is
DAP_FW_Ameba_V12_1_3-2M.bin
note
You must use a Windows PC for downloading a binary, while the source code for this chipset must be built using cygwin or linux.