mcpField
E
embedded-iot

embedded-iot

github.com/travisjneumanDevelopment106195 installsUpdated 1d ago
Repository

About embedded-iot

A reference skill for embedded systems and IoT development, aimed at firmware developers working across common microcontroller platforms. It combines platform guidance with firmware patterns, protocol examples, and practical engineering practices.

Key features

  1. 01Microcontroller platform overview
  2. 02GPIO and I2C patterns
  3. 03FreeRTOS task example
  4. 04IoT protocol comparisons
  5. 05Firmware reliability practices

Use cases

  1. 01Choosing a platform for an IoT device
  2. 02Referencing sensor and peripheral code
  3. 03Planning MQTT or BLE communication
  4. 04Reviewing firmware testing and update practices

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/travisjneuman/.claude --skill embedded-iot

After installing, type/embedded-iotin Claude Code to confirm it loaded.

Details

From the project README

Embedded Systems & IoT

Microcontroller Platforms

PlatformBest ForLanguageIDE
ESP32WiFi/BLE IoT devicesC/C++, MicroPythonPlatformIO, Arduino IDE
STM32Industrial, real-timeC/C++STM32CubeIDE, PlatformIO
ArduinoPrototyping, learningC++ (Arduino)Arduino IDE, PlatformIO
Raspberry Pi PicoRP2040, dual-coreC/C++, MicroPythonThonny, VS Code
nRF52BLE-focused IoTC, ZephyrnRF Connect SDK

Firmware Patterns

GPIO & Peripherals
// ESP-IDF GPIO example
gpio_config_t io_conf = {
    .pin_bit_mask = (1ULL << GPIO_NUM_2),
    .mode = GPIO_MODE_OUTPUT,
    .pull_up_en = GPIO_PULLUP_DISABLE,
    .pull_down_en = GPIO_PULLDOWN_DISABLE,
    .intr_type = GPIO_INTR_DISABLE,
};
gpio_config(&io_conf);
gpio_set_level(GPIO_NUM_2, 1);
I2C Communication
// Read sensor via I2C
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (SENSOR_ADDR << 1) | I2C_MASTER_WRITE, true);
i2c_master_write_byte(cmd, REG_TEMP, true);
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (SENSOR_ADDR << 1) | I2C_MASTER_READ, true);
i2c_master_read(cmd, data, 2, I2C_MASTER_LAST_NACK);
i2c_master_stop(cmd);
i2c_master_cmd_begin(I2C_NUM_0, cmd, pdMS_TO_TICKS(1000));
i2c_cmd_link_delete(cmd);

RTOS (FreeRTOS)

// Task creation
void sensor_task(void *pvParameters) {
    while (1) {
        float temp = read_temperature();
        xQueueSend(data_queue, &temp, portMAX_DELAY);
        vTaskDelay(pdMS_TO_TICKS(1000));
    }
}
xTaskCreate(sensor_task, "sensor", 4096, NULL, 5, NULL);

// Mutex for shared resources
SemaphoreHandle_t spi_mutex = xSemaphoreCreateMutex();
if (xSemaphoreTake(spi_mutex, pdMS_TO_TICKS(100)) == pdTRUE) {
    spi_transfer(data);
    xSemaphoreGive(spi_mutex);
}

IoT Protocols

MQTT
// ESP-IDF MQTT client
esp_mqtt_client_config_t mqtt_cfg = {
    .broker.address.uri = "mqtt://broker.hivemq.com",
};
esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg);
esp_mqtt_client_start(client);
esp_mqtt_client_publish(client, "/sensors/temp", "23.5", 0, 1, 0);
Key IoT Protocols
ProtocolTransportUse Case
MQTTTCP/TLSPub/sub messaging, telemetry
CoAPUDP/DTLSConstrained devices, REST-like
BLERadioShort-range, low power
LoRaWANRadioLong-range, low data rate
MatterIPSmart home interoperability

Best Practices

  • Power management: Deep sleep modes, wake-on-interrupt, duty cycling
  • Watchdog timers: Always enable, reset periodically, catch firmware hangs
  • OTA updates: Dual partition scheme, rollback on boot failure, signature verification
  • Memory: Static allocation preferred, avoid heap fragmentation, use memory pools
  • Testing: Hardware-in-the-loop (HIL), mock hardware interfaces for unit tests

Comments

Markdown supported