Skip to main content

Custom hardware integration

Guide for teams that ship their own PCB (no IOTMER reference board). The SDK handles cloud connectivity; you own pins, buses, and sensors.

Quick start

From any directory (ESP-IDF environment optional for scaffold):

python /path/to/iotmer-sdk-esp-idf/tools/iotmer.py create-app my-gateway --chip esp32s3 --profile field
cd my-gateway
source $IDF_PATH/export.sh
idf.py set-target esp32s3
idf.py menuconfig
idf.py build flash monitor

Validate sdkconfig before debugging TLS or OTA:

python /path/to/iotmer-sdk-esp-idf/tools/iotmer.py doctor --project .

Project layout

my-gateway/
├── components/
│ ├── hw/ ← YOU: pins, RS485, sensors, LEDs
│ └── cloud/ ← IOTMER: init, MQTT, telemetry (extend carefully)
├── main/ ← Boot order only
├── sdkconfig.defaults
├── sdkconfig.defaults.field
├── sdkconfig.defaults.factory
└── partitions_ota_4mb.csv
LayerResponsibility
hwhw_init(), hw_read_telemetry(), Kconfig for GPIO / peripherals
cloudiotmer_app_start() — Wi‑Fi, provision, MQTT, command handler
mainnvs_flash_init()hw_init()iotmer_app_start()

Keep hardware and cloud separate so you can change PCB revisions without touching MQTT logic.

Integration checklist

StepYou doSDK / tool
1. Scaffoldiotmer create-appTemplate + sdkconfig defaults
2. Target chipidf.py set-target <chip>Supported: esp32, esp32c3, esp32s3, …
3. Partition / flashAdjust partitions_*.csv if flash ≠ 4MBdoctor warns on OTA layout
4. HW bring-upImplement hw_init.cmenuconfigHW
5. Wi‑FiSSID/password in menuconfig, NVS, or BLEiotmer_wifi_* API
6. Factory flash--profile factory, set auth code01_provisioning flow
7. Field flash--profile field, empty auth code02_telemetry flow
8. Remote configHandler in app04_config + iotmer_config.h
9. BLE setup (optional)Add iotmer_ble dependency05_ble_json
10. Pre-releaseiotmer doctorCatches TLS / stack / OTA mistakes

Dependencies

Registry (default) — for customer repos:

# idf_component.yml
dependencies:
iotmertech/iotmer: "*"

Local SDK checkout — when developing against this monorepo:

iotmer create-app my-gateway --deps local --sdk-root /path/to/iotmer-sdk-esp-idf

Common mistakes

SymptomFix
TLS / mbedTLS crash on bootCONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
Certificate verify failedEnable CONFIG_MBEDTLS_CERTIFICATE_BUNDLE (see template defaults)
OTA partition too smallCustom partitions_ota_4mb.csv or increase slot size
MQTT not authorizedField image with empty NVS — re-provision with factory profile
Auth code in field firmwareUse factory vs field profiles

Reference examples

The numbered examples under examples/ remain the authoritative SDK behaviour reference. The create-app scaffold wraps the 02_telemetry field flow with a hw/cloud split.

Further reading