Minecraft2Arduino is a project that enables interactions between Minecraft and Arduino, allowing actions in the real world based on in-game events. Think of it as a direct portal between Minecraft and reality!
- Global Architecture
- Arduino Side
- Gateway Side
- Minecraft Side
- Documentation
- Setup Example 🚀
The system consists of three main components:
- Arduino: Connects to the gateway via WebSockets and executes received commands.
- Gateway: Acts as a WebSocket server relaying messages between Arduino and Minecraft.
- Minecraft Plugin: Captures in-game interactions and forwards them to the gateway.
📂 Code Location: Microcontroller
The Arduino connects to the gateway using WebSockets and processes incoming messages to perform actions in the real world.
Libraries Used:
WiFi.h(for network connectivity)ArduinoWebsockets.h(to communicate via WebSockets)string.h(for handling strings)
📂 Code Location: WebSocketGateway
The gateway is a WebSocket server that facilitates communication between Arduino and Minecraft.
Technology Stack:
Node.js(for WebSocket server implementation)ws package(for WebSocket handling)
📂 Code Location: MinecraftPlugin
A Minecraft plugin that captures player interactions and transmits relevant data to the gateway.
Libraries Used:
Spigot-API(to interact with Minecraft server events)Socket(to communicate with the gateway)
/m2a Gives you the registeration item.
/m2a debug Toggles debug mode.
/m2a gui Opens the block management GUI.
/m2a list Displays all registered blocks.
/m2a remove <name> Removes a block by its name.
/m2a rename <old_name> <new_name> Renames a block.
save.yml list of registred blocks
socket.yml socket connexion informations (ip and port)
Default port : 8080
Default port : 8080
For my example I use an esp32 for the microcontroller, and I host the minecraft server and the gateway on a VPS.
You can found all the files here:
You need to install
nodenpm
Move the websocket-server.js file to the directory you want (on my VPS for me)
start with node websocket-server.js
You need to install
java
Move the MinecraftServer file where you want (also on my VPS for me)
-
start it with
sh start.sh -
connect to it
-
execute
m2ato get registration item -
right click on the block you want (lever for me)
-
in my example I rename it 'led' with
/m2a rename lever led -
edit
socket.ymlto put the ip and port (I use my VPS ip and the 8080 port) -
save the file
-
restart the server
You need:
- esp32
- ArduinoIDE
wire your esp32 like that:
-
open
test_esp32.inofile -
install libraries
-
change wifi informations
-
upload the
test_esp32.inoprogramm to your esp32
Go on your server and click on the lever.
Here is a video of my setup:


