# Gobot — Robotics and IoT Framework for Go > A Go framework for robotics, drones, and the Internet of Things that provides drivers for 40+ hardware platforms including Arduino, Raspberry Pi, and Sphero. ## Install Save in your project root: # Gobot — Robotics and IoT Framework for Go ## Quick Use ```bash go get gobot.io/x/gobot/v2 # Blink an LED on Arduino import ( "gobot.io/x/gobot/v2" "gobot.io/x/gobot/v2/drivers/gpio" "gobot.io/x/gobot/v2/platforms/firmata" ) func main() { adaptor := firmata.NewAdaptor("/dev/ttyACM0") led := gpio.NewLedDriver(adaptor, "13") work := func() { gobot.Every(1*time.Second, func() { led.Toggle() }) } robot := gobot.NewRobot("bot", []gobot.Connection{adaptor}, []gobot.Device{led}, work) robot.Start() } ``` ## Introduction Gobot is a Go framework that provides a consistent API for interacting with hardware devices, robots, and IoT platforms. It abstracts away platform-specific details so you can write device-control logic once and run it across Arduino, Raspberry Pi, drones, and many other platforms. ## What Gobot Does - Provides drivers for GPIO, I2C, SPI, and serial communication protocols - Supports 40+ hardware platforms including Arduino, Raspberry Pi, BeagleBone, and Jetson Nano - Integrates with drones (DJI Tello, Parrot), Sphero robots, and Leap Motion controllers - Offers an event-based programming model with timers and callbacks - Includes an optional HTTP API for remote-controlling robots over the network ## Architecture Overview Gobot is organized around three concepts: Adaptors (platform connections), Drivers (device interfaces), and Robots (units of work). An Adaptor handles the low-level connection to a board or protocol. Drivers use the Adaptor to communicate with specific hardware (LEDs, motors, sensors). A Robot groups connections, devices, and a work function into a runnable unit. Multiple Robots can be managed by a single Master. ## Self-Hosting & Configuration - Install with `go get gobot.io/x/gobot/v2` — pure Go core, platform packages are separate - Connect to Arduino via Firmata protocol over serial USB - For Raspberry Pi, use the built-in GPIO adaptor with direct memory-mapped I/O - For drones, install platform-specific packages like `gobot.io/x/gobot/v2/platforms/dji/tello` - Optionally enable the built-in API server for HTTP and WebSocket remote control ## Key Features - Unified API across dozens of hardware platforms and protocols - Event system for reacting to sensor data, button presses, and device state changes - Built-in support for MQTT and BLE for wireless IoT communication - Composable architecture — combine multiple robots into coordinated swarms - Full concurrency support using Go goroutines for parallel device control ## Comparison with Similar Tools - **Johnny-Five (JS)** — similar abstraction for hardware; Gobot brings Go's concurrency and type safety - **Arduino IDE** — C/C++ firmware development; Gobot controls Arduino from Go over Firmata - **ROS** — full robotics middleware; Gobot is lighter and focused on device-level control - **TinyGo** — compiles Go to microcontrollers directly; Gobot runs on the host and controls devices remotely ## FAQ **Q: Does Gobot run on the microcontroller itself?** A: No, Gobot runs on a host machine (PC, Raspberry Pi) and communicates with devices over serial, I2C, GPIO, or network protocols. **Q: What Go version is required?** A: Gobot v2 requires Go 1.18 or later. **Q: Can I control multiple devices simultaneously?** A: Yes, each Robot runs concurrently. You can manage multiple Robots in a single program. **Q: Does Gobot support computer vision?** A: It has an OpenCV integration for camera access and image processing. ## Sources - https://github.com/hybridgroup/gobot - https://gobot.io/ --- Source: https://tokrepo.com/en/workflows/asset-ac5f5cc1 Author: AI Open Source