Control Arduino robots with AI-powered commands
MCP server that connects Claude AI to Arduino/ESP32 robotics hardware, enabling control of LEDs, motors, servos, sensors, and relays via Johnny-Five.
Why it matters
Enable AI assistants like Claude to directly control Arduino-based robots and ESP32 devices for real-world automation tasks, bridging the gap between conversational AI and physical hardware.
Outcomes
What it gets done
Send commands from Claude AI to Arduino ESP32 microcontrollers
Execute real-world automation tasks through robot hardware
Bridge conversational AI interfaces with physical device control
Orchestrate robotics workflows using natural language instructions
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-arduino | bash Overview
Arduino MCP Server
Chotu Robo Server is an MCP server that connects Claude AI to Arduino-based robotics hardware using the Johnny-Five library. It provides tools for controlling LEDs, buzzers, motors, servos, fans, relays, and reading from ultrasonic distance and temperature sensors. The server supports both NodeMCU ESP32 (wireless mode with Wi-Fi web server) and Arduino Nano 368 (wired USB mode). Use this server when you want to control Arduino or ESP32 robotics projects through AI prompts instead of writing low-level hardware code. It fits IoT prototyping, educational robotics, and automation projects where commands like "turn left" or "read temperature" simplify hardware interaction.
What it does
Chotu Robo Server is an MCP (Model Context Protocol) server that bridges Claude AI and Arduino-based robotics hardware. It exposes tools for controlling physical components - LEDs, buzzers, motors, servos, fans, relays, ultrasonic distance sensors, and temperature sensors - through AI prompts. The server uses the Johnny-Five JavaScript robotics library to communicate with NodeMCU ESP32 or Arduino Nano 368 microcontrollers, translating AI commands into hardware actions.
When to use - and when NOT to
Use this server when you need to control Arduino or ESP32 robotics projects through AI interfaces, prototype IoT automation with AI commands, or build educational robotics systems that respond to AI assistants like Claude. It fits projects where you want to issue commands like "turn Chotu left" or "set speed to 5" instead of writing low-level hardware code.
Do NOT use this in Wired Mode (Arduino Nano 368) if you need real-time network commands - the Nano requires USB connection and runs pre-uploaded code only, without network connectivity. Avoid this server if you need sub-millisecond response times or safety-critical control loops, as the AI-to-hardware translation layer introduces latency.
Inputs and outputs
You provide AI prompts to Claude (e.g., "blink the LED for 3 seconds", "read temperature", "move servo to 90 degrees") and hardware configuration details (pin assignments, component types). The server executes these as Johnny-Five commands on the connected hardware.
Integrations
The server integrates with:
- NodeMCU ESP32: Wireless mode with Wi-Fi-enabled web server accepting REST API or WebSocket commands for real-time hardware control
- Arduino Nano 368: Wired mode via USB for pre-programmed operation without network connectivity
- Johnny-Five: JavaScript robotics library that provides the hardware abstraction layer for sensors and actuators
- Claude AI / Anthropic MCP: Uses the Model Context Protocol framework to handle AI-based communication and command processing
- Arduino IDE: Required for uploading firmware to the microcontroller boards
The ESP32 wireless mode supports both TypeScript MCP servers and Java Spring-based MCP servers.
Setup
Install the required Node.js dependencies:
npm install johnny-five
npm install @modelcontextprotocol/sdk
Set up the ESP32 or Arduino Nano 368 in the Arduino IDE by installing the ESP32 board support, connecting the microcontroller via USB, and uploading the provided code. For wireless operation with ESP32, configure your Wi-Fi credentials so the board can start its web server and accept commands over the network.
Run the MCP inspector to test the server:
npx @modelcontextprotocol/inspector node build/choturobo.js
Who it's for
This server is built for robotics hobbyists and educators who want to add AI control to Arduino projects without writing complex integration code. It suits makers prototyping IoT devices with conversational interfaces, students learning how AI interacts with physical hardware, and developers building proof-of-concept systems that combine language models with sensors and actuators. The two-mode architecture (wired Nano for simple projects, wireless ESP32 for networked applications) accommodates both beginners working with basic USB setups and advanced users deploying Wi-Fi-connected robotic systems.
Source README
**Chotu Robo Server - MCP Server for Arduino **
DEMO
๐ Chotu Robo Demo 1
๐ Chotu Robo Demo 2
๐ Chotu Robo Demo 3
๐ Chotu Robo Demo 4
๐ Chotu Robo Article
๐ Chotu Robo Article 2
Overview
This project showcases how to integrate Arduino-based robotics (using the NodeMCU ESP32 or Arduino Nano 368 board) with AI using the MCP (Model Context Protocol) framework from Claude AI by Anthropic. It provides a seamless connection between hardware components and AI through a simple interface that can be controlled by a user via a mobile phone or computer.
This system acts as a robotic server (named Chotu Robo) that can interact with various physical components like LEDs, motors, servos, fans, sensors, and more. These components can be controlled remotely by sending commands to the server, which in turn controls the hardware via the ESP32 or Arduino Nano 368 microcontroller.
This setup opens up the possibility for future AI-based applications, such as controlling the robot through AI assistants (like Claude) from mobile or web applications.
The Chotu Robot operates in two modes: Wired Mode and Wireless Mode, each designed for different use cases and hardware configurations.
Wired Mode - Arduino Nano 368
In Wired Mode, the robot uses an Arduino Nano 368 board, where the code is uploaded directly via USB. This mode does not support real-time commands over the network as it requires a physical USB connection to operate. The robot runs its pre-uploaded code, making it suitable for projects where Wi-Fi or network connectivity is not required.
Wireless Mode - ESP32 Wi-Fi Enabled Web Server
In Wireless Mode, the robot is powered by an ESP32 board. The ESP32 connects to your local Wi-Fi network and starts a Wi-Fi enabled web server that listens for real-time commands through REST API or WebSocket. This mode allows the robot to interact with external devices and control various hardware components like LEDs, motors, servos, and fans.
Once the ESP32 is connected to Wi-Fi, it accepts incoming commands that control hardware functionality in real-time. These commands can be sent from a TypeScript MCP server or a Java Spring-based MCP server, allowing seamless integration between microcontroller hardware and AI-based systems for automation, robotics, or IoT applications.
Features
- LED Control: Blink an LED for a given duration.
- Buzzer Control: Sound a buzzer for a specified time.
- Motor Control: Run a motor at a certain speed for a set time.
- Servo Control: Move a servo motor to a specific angle.
- Fan Control: Turn a fan on/off.
- Relay Control: Switch a relay on or off.
- Sensor Readings:
- Read temperature from a sensor.
- Measure distance using an ultrasonic sensor.
- AI-powered Commands: Control the robot using AI-based prompts for actions like moving, starting, stopping, turning, and adjusting speed.
Components Used
- NodeMCU ESP32 or Arduino Nano 368: Microcontrollers responsible for controlling the hardware and communicating with the server.
- Johnny-Five: The JavaScript robotics and IoT library to interact with the hardware components.
- MCP Framework: The Model Context Protocol framework to handle requests and interactions with external systems, enabling AI-based communication.
- Sensors & Actuators:
- LED (for indicating status)
- Buzzer
- Servo Motor
- Motor
- Relay Module
- Ultrasonic Distance Sensor
- Temperature Sensor
How It Works
The Chotu Robo Server acts as the main hub for handling commands from an AI system. The following flow outlines how the system works:
Setup:
- The NodeMCU ESP32 or Arduino Nano 368 board is connected to various sensors and actuators (LEDs, motors, etc.).
- The Johnny-Five library allows the server to control hardware components through the microcontroller.
MCP Integration:
- The McpServer manages communication between the hardware and AI.
- The server provides several tools (commands) such as
blinkLED,buzz,runMotor,moveServo, and more. - Each tool is associated with a specific function, and the server waits for commands from the AI system to execute those actions.
AI Control:
- AI Prompts are used to trigger actions like moving the robot (
move-chotu), controlling speed (set-chotu-speed), and turning the robot (turn-chotu). - The AI uses Claude or other AI assistants to send commands to the server. The server processes these commands and interacts with the hardware accordingly.
- AI Prompts are used to trigger actions like moving the robot (
Real-Time Communication:
- StdioServerTransport ensures the server can connect to external AI systems and execute commands in real-time.
User Commands:
- The AI can send user-friendly commands like "turn Chotu left" or "set speed to 5" to control the robot's behavior.
Commands and Tools
Here are some of the available commands and their functionalities:
blinkLED: Blink the LED for a specified time.buzz: Activate the buzzer for a certain duration.runMotor: Start the motor at a given speed for a set period.moveServo: Move the servo motor to a specified angle.controlFan: Turn the fan on or off.toggleRelay: Switch a relay module on or off.readTemperature: Get the current temperature reading.readDistance: Measure the distance using the ultrasonic sensor.move-chotu: Move Chotu in specific steps (via AI prompt).start-chotu: Start Chotu and get ready to operate.stop-chotu: Stop Chotu and shut down operations.turn-chotu: Turn Chotu to a specified direction (left or right).set-chotu-speed: Set the speed for Chotu.
How to Use
Requirements
Hardware:
- NodeMCU ESP32 or Arduino Nano 368 (or any supported Arduino/ESP32 board).
- Various sensors and actuators (LED, servo, motor, ultrasonic sensor, temperature sensor, relay).
Software:
- Install Node.js.
- Install Johnny-Five for hardware control.
- Use the MCP SDK to integrate with AI.
- Use the Arduino IDE to program the microcontroller.
Steps to Setup
Install Node.js and Johnny-Five:
npm install johnny-five npm install @modelcontextprotocol/sdk Set up the ESP32 or Arduino Nano 368 on the Arduino IDE: Install the ESP32 board support in the Arduino IDE for ESP32 or Arduino Nano 368 board if using. Connect the NodeMCU ESP32 or Arduino Nano 368 to your computer via USB. Upload the Code to the Board: Use the Arduino IDE to upload the provided code to the ESP32 or Arduino Nano 368.Run the Server:
Start the MCP server by running the script. This will set up the server and establish communication with the hardware. Connect to the AI: Send commands from the AI system (like Claude) to control the robot.
Example AI Commands
Move Chotu:
Command: "Move Chotu forward by 5 steps."
Action: The robot will move based on the specified number of steps.
Set Speed:
Command: "Set speed to 10."
Action: The robot's speed will be adjusted accordingly.
Turn Left:
Command: "Turn Chotu left."
Action: The robot will rotate left.
Debug using the MCP Inspector:
npx @modelcontextprotocol/inspector node build/choturobo.js
Future Improvements
This project can serve as a foundational framework for developing more advanced AI-based robotic systems. You can extend the functionality by:
- Adding more sensors like cameras or microphones.
- Integrating advanced AI models for better decision-making.
- Developing a mobile app or web interface to control the robot via a graphical interface.
- Using a Raspberry Pi:
- Setup: Use a Raspberry Pi to run the MCP server and control the hardware components.
- Installation:
sudo apt-get update sudo apt-get install nodejs npm npm install johnny-five npm install @modelcontextprotocol/sdk - Connecting to Java-based Server:
- Java Server Setup: Create a Java-based MCP server to handle requests and communicate with the Raspberry Pi.
- Java Code Example:
import org.modelcontextprotocol.server.McpServer; import org.modelcontextprotocol.server.transport.WebSocketTransport; public class ChotuRoboServer { public static void main(String[] args) { McpServer server = new McpServer(); WebSocketTransport transport = new WebSocketTransport("ws://raspberrypi.local:8080"); server.connect(transport); // Define tools and prompts here server.tool("blinkLED", params -> { // Implement LED blinking logic }); server.start(); } } - Running the Server:
javac -cp modelcontextprotocol-sdk.jar ChotuRoboServer.java java -cp .:modelcontextprotocol-sdk.jar ChotuRoboServer
- Connecting Raspberry Pi to Java Server:
- Ensure the Raspberry Pi and Java server are on the same network.
- Use WebSocket or REST API to send commands from the Java server to the Raspberry Pi.
- Example command from Java server to Raspberry Pi:
WebSocketClient client = new WebSocketClient(new URI("ws://raspberrypi.local:8080")); client.connect(); client.send("{\"command\": \"blinkLED\", \"params\": {\"time\": 5}}");
By following these steps, you can enhance the Chotu Robo project with more advanced features and better integration with AI and Java-based systems.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.