Minecraft Sword Hits When You Do

by Arduino_having11_Guy in Circuits > Sensors

2558 Views, 8 Favorites, 0 Comments

Minecraft Sword Hits When You Do

DSC_3642.JPG
Use a REAL Minecraft SWORD in MINECRAFT!

Tinkernut recently did a live comments show where he was looking for suggestions from his audience for new projects. He mentioned doing a project where a person could swing a sword in real life that would cause a sword in Minecraft to also swing. Here is that project.

Design

MC-sword.jpg

I started this project by going into Fusion 360 and inserting an image of a basic Minecraft sword. Then I traced it to create an outline of the sword. After extruding the shape I generated GCode from it for use in my CNC router. Additionally, I created a PCB using Eagle that would use an ESP8266 ESP12e and Bluetooth to communicate with the PC.

Creating the Sword

DSC_3170.JPG
DSC_3629.JPG
DSC_3628.JPG
DSC_3638.JPG

I cut out the sword design on my CNC router and then traced the sword onto some foam. I then sandwiched the foam between the plywood pieces. Finally, I painted the sword by first drawing the "pixels" and following the iron sword design.

The PCB and Electronics

DSC_3133.JPG
DSC_3141.JPG
DSC_3147.JPG
DSC_3158.JPG
DSC_3165.JPG
schematic.png
DSC_3631.JPG
DSC_3635.JPG

After using chilipeppr.com to generate GCode from my PCB design, I milled a blank copper-coated FR4 board using a 1/32inch router bit. Next I soldered on the ESP12e module and other connectors.

I then attached the board to the sword (my ESP12e module was broken)

The Code

There is code needed for both the ESP12e and the host PC. The ESP12e simply reads accelerometer data from the Sparkfun 9DoF stick and if it exceeds 2g of force it sends a message over serial. The python script runs on the host PC. It waits for the serial data from the ESP12e and then uses pyautogui to click the mouse.

Using It

DSC_3640.JPG
DSC_3641.JPG

All that is needed is for a user to simply plug in the module into the PC, run the python script, and then have fun! Just swing the sword and the Minecraft character will swing it's sword as well.