The Golain PlatformIO SDK is a C++ Software Development Kit designed for seamless integration with the Golain IoT Platform. This SDK leverages the PlatformIO framework to facilitate quick and efficient setup, enabling developers to connect their IoT devices using various communication methods. The SDK supports Wi-Fi, GSM, 4G, LTE, LoRaWAN, and NB-IoT via TinyGSM, providing a robust solution for diverse IoT applications.
Feature | Status |
---|---|
Device Shadow | ✔ |
Device Logs | ✔ |
Device Data | ✔ |
User Association | ✔ |
OTA | ✔ |
BLE | alpha |
Embedded RPC | ✘ |
Hardware | Status | Tested |
---|---|---|
ESP32-WROOM32-D | stable |
✔ |
ESP32-C3 | stable |
✔ |
ESP32-S3 | stable |
✔ |
ESP32-C6 | stable |
✔ |
nRF52840-DK + SIM7600E | dev |
✔ |
nRF52832-DK + SIM800L | dev |
✔ ; |
nRF9160 | dev |
✔ |
Refer to Example Projects for more details.
-
Visual Studio Code
- Download and install Visual Studio Code from here.
-
PlatformIO Extension for VS Code
- Install the PlatformIO extension for Visual Studio Code from here.
-
ProtoCompiler
protoc
is required for Golain SDKs and should be available in yourPATH
.- Windows - Download and install from here.
- Linux:
- Debian/Ubuntu:
sudo apt install protobuf-compiler
- Fedora:
sudo dnf install protobuf-compiler
- Arch:
sudo pacman -S protobuf
- Debian/Ubuntu:
- MacOS:
- via Homebrew:
brew install protobuf
- via MacPorts:
sudo port install protobuf3-cpp
- via Homebrew:
-
Create a new PlatformIO project
- Open VS Code and click on the PlatformIO icon on the left sidebar.
- Click on
New Project
and select your board. - Select a project name and click on
Finish
.
-
Add these lines in platformio.ini
[env:esp32dev] board = esp32dev framework = arduino monitor_speed = 115200 build_flags = -D "MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED" -D ROOT_TOPIC='"/xxxxx/"' // single -D DEVICE_NAME='"xxxxx"' lib_deps = ga/golain-platformio-sdk@^0.2 custom_nanopb_protos = +<src/*.proto> custom_nanopb_options = --error-on-unmatched
-
Update metadata
- Update the
ROOT_TOPIC
in this format:'"/xxxxx/"'
(replace xxxxx with your topic) - Update the
DEVICE_NAME
in this format:'"xxxxx"'
(replace xxxx with your device name)
- Update the
-
Get device credentials from Golain Console
- Login to Golain Console and navigate to the
Devices
section. - Click on
Add Device
and follow the instructions. - Download the PlatformIO
certs.h
file and place it in your project'sinclude
folder. - Also, download the
project template
and place its contents in thesrc
folder.
- Login to Golain Console and navigate to the
-
Update
main.cpp
- Replace the content of
main.cpp
with the content from themain.ino
file provided during the header download.
- Replace the content of
-
Install dependencies
- From the quick access of PIO Home, go to libraries and install the following dependencies:
golain-platformio-sdk
.
- From the quick access of PIO Home, go to libraries and install the following dependencies:
-
Verify your ESP32 board connection
- Ensure your ESP32 board appears on the
Serial Port
from thedevice
section in PIO Home.
- Ensure your ESP32 board appears on the
-
Build and flash the program
- Once all dependencies and files are placed and modified, build the program. Your build will be flashed onto the board.
-
Verify device status
- If everything is done correctly, you should be able to see your device online on the Golain Console.
We welcome contributions to enhance the Golain PlatformIO SDK. Please submit pull requests to the GitHub repository.
For support and troubleshooting, please visit the Golain support page or contact us via email.
This project is licensed under the MIT License. See the LICENSE file for details.