Made by @adidshaft ↗

SpaceXAI

Grok is made by SpaceXAI.
Grok Gadgets is an independent project.

↗

Grok Gadgets ESP32 SDK

On this page

Build USB gadgets for your Grok Bot in an Arduino sketch: declare commands and events, and grok::Gadget talks to the local Grok Gadgets gateway. Two examples compile; neither has been flashed here. Experimental alpha: see the project status. Independent project, not affiliated with SpaceXAI or xAI.

Quickstart

You need Python 3.11+, CMake 3.16+, Git and a C++14 compiler. No board or account.

git clone https://github.com/adidshaft/grok-gadgets-esp32-sdk.git
cd grok-gadgets-esp32-sdk
python3 -m venv .venv
.venv/bin/pip install -r requirements.lock
.venv/bin/pio pkg install
sh tools/check.sh
.venv/bin/python tools/check_contract.py
.venv/bin/pio run -e atoms3-lite-usb

Expected: four host test suites pass, both sketch transcripts pass the contract check, and the C124 firmware compiles: build verified, hardware pending. Next, create your own gadget.

What a gadget looks like

#include <GrokSession.h>

bool on = false;
grok::Gadget gadget("Desk LED", "0.1.0", "esp32s3");

void report(JsonObject state, void *) { state["led"]["on"] = on; }
grok::Error setLed(JsonObjectConst args, void *) {
  on = args["on"];
  digitalWrite(4, on ? HIGH : LOW);  // your hardware
  return {};
}
void setup() {
  pinMode(4, OUTPUT);
  gadget.state(report);
  gadget.command("led.set", setLed, nullptr,
                 R"({"description":"Turn the desk LED on or off","type":"object",)"
                 R"("properties":{"on":{"type":"boolean"}},"required":["on"]})");
  gadget.button(0);
  gadget.begin();
}
void loop() { gadget.loop(); }

The schema's description tells the model what the command does. Declare the gadget as a global (it uses about 40 KB). The full version is examples/led-button; names, events and limits are in the library guide.

Flash a board

The gadget talks over USB to a bridge on your computer, and the bridge talks to the gateway. Build, flash and recovery covers flash offsets, the device ID, grok-gadgets-gateway enroll, usb-bridge and unplug recovery. No board has been flashed for this project yet, so hardware results are welcome.

Grok Bot today

Today the gateway works with local MCP clients. A cloud Grok Bot cannot reach your computer yet, Wi-Fi is not built (#5), and a button press does not wake the Bot. See the hosting FAQ.

Learn more

Topic Guide
Commands, events and limits Library
Retries, loss reports and reconnects Protocol and recovery
C124 pins, and the GPIO48 RGB_BUILTIN trap Board sources
What was checked, and what is still open Verification and build-checksums.json
Dependency licenses before you share firmware Dependencies and NOTICE

Host tests compile the sketches against a simulated board; they never open a serial port.

Community

Show your build, ask for help and share ideas on r/GrokGadgets. Report bugs through the issue chooser. New here? Pick a good first issue and read CONTRIBUTING. Build errors: SUPPORT. Vulnerabilities: SECURITY. Contribute on the dev branch; main holds tagged stable releases (branches).

License and affiliation

Apache-2.0; see LICENSE and NOTICE. Grok Gadgets is an independent open-source project. It is not affiliated with, endorsed by or sponsored by SpaceXAI or xAI, which make Grok and Grok Bot, nor with M5Stack. Pre-publication commit dates were reconstructed; see the history record.

Source: grok-gadgets-esp32-sdk/README.md