Skip to content

golain-io/golain-platformio-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golain PlatformIO SDK

Introduction

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.

Features

Feature Status
Device Shadow
Device Logs
Device Data
User Association
OTA
BLE alpha
Embedded RPC

Supported Hardware and Testing Status

Hardware Status Tested
ESP32-WROOM32-D stable
ESP32-C3 stable
ESP32-S3 stable
ESP32-C6 stable
nRF52840-DK + SIM7600E dev
nRF52832-DK + SIM800L dev &#x2714 ;
nRF9160 dev

Refer to Example Projects for more details.

Getting Started

Prerequisites

  1. Visual Studio Code

    • Download and install Visual Studio Code from here.
  2. PlatformIO Extension for VS Code

    • Install the PlatformIO extension for Visual Studio Code from here.
  3. ProtoCompiler

    • protoc is required for Golain SDKs and should be available in your PATH.
      • 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
      • MacOS:
        • via Homebrew:
          brew install protobuf
        • via MacPorts:
          sudo port install protobuf3-cpp

Setup

  1. 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.
  2. 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
    
    
  3. 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)
  4. 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's include folder.
    • Also, download the project template and place its contents in the src folder.

    template

  5. Update main.cpp

    • Replace the content of main.cpp with the content from the main.ino file provided during the header download.
  6. Install dependencies

    • From the quick access of PIO Home, go to libraries and install the following dependencies: golain-platformio-sdk.
  7. Verify your ESP32 board connection

    • Ensure your ESP32 board appears on the Serial Port from the device section in PIO Home.
  8. 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.
  9. Verify device status

    • If everything is done correctly, you should be able to see your device online on the Golain Console.

Contributing

We welcome contributions to enhance the Golain PlatformIO SDK. Please submit pull requests to the GitHub repository.

Support

For support and troubleshooting, please visit the Golain support page or contact us via email.

License

This project is licensed under the MIT License. See the LICENSE file for details.