D&D Initiative Tracker (Motor Project Using Stepper Motor

by burke_pete15 in Circuits > Arduino

165 Views, 0 Favorites, 0 Comments

D&D Initiative Tracker (Motor Project Using Stepper Motor

IMG_0587.JPG
IMG_0598.JPG
IMG_0595.JPG

This is a rather simple, at least conceptual object. Its task is simple it is made to track the turn order of players in a game of Dungeon and Dragons. I have created a display with the names of my players' characters printed on it as well as a pointer that is attached to the Stepper motor. This project also uses some rather specific code that creates a simple interface that allows the user to choose the order of the players and then points to the first player. It will then prompt the user to continue until all players have gone. It will prompt you again to see if you want to continue the initiative order or if you want to try a new order. I have specified this project to my group but with the code and model provided it would be very easy to convert it to your own specifications.

Supplies

Everything needed for this project can be found in the Arduino Starter Kit which I have linked below

For specific parts, you'll need

Wiring the Circuit

Screenshot 2024-04-13 042734.png
F5OUE4JLUWOHUH7.jpg

The wiring for this circuit is fairly simple, all the wire centers around the Stepper Motor Drive Module. Firstly attach the Stepper Motor to the Drive Module, then connect the wires as follows

Black Wire - GRD to GRD

Red Wire - 5V to Vin

Green Wire - In1 to Pin 11

Blue Wire - In2 to Pin 10

Purple Wire - In3 to Pin 9

Yellow Wire - In4 to Pin 8


Your circuit should now be properly wired and ready to code!

Modeling Enclosure and Display

IMG_0590.JPG
IMG_0588.JPG
IMG_0591.JPG

The 3D modeling and printing aspect of this project is fairly minimal. The front display has the names of the characters engraved in the 3D print and in the small piece, you see if the needle points to the player currently in initiative order.

For the pointer,

-Make sure you measure the end of the Stepper motor accurately so that the needle points move with its rotation and aren't damaging it to get it on.

For the display,

-This display was fairly easy for me to model the only trick part was getting the names engraved and creating the side pieces so the top could click into the bottom piece.

Coding

The coding is probably the most complicated part of this project, using multiple nested loops within the motor code. Firstly you have to center your motor to ensure that the movements to point at each character's names are accurate. I achieved this by creating a program that let me incrementally move the needlepoint until it rested straight up away from the names; establishing this at my position zero.

Then I created the motor code which has quite a few moving parts to it. Firstly it asks for single-letter inputs of the characters' names in the correct initiative order. This was accomplished using a for loop as well as an array of chars that decided the order the pointer would move around. It will then enter a while loop whose continuous is conditional on a prompt at the end of the loop asking the user if they wish to do another round with the current initiative. Then within the side that loops there is another while loop that is conditional that the count is less than 4, thus once all 4 players have had their turn the initiative will reset, and prompt the user if they want to continue or enter a new initiative order.

Final Results

IMG_0599.JPG
IMG_0597.JPG
IMG_0593.JPG
IMG_0596.JPG
IMG_0589.JPG
IMG_0600

With that, you should have the following working Arduino-powered D&D Initiative Tracker!!!! I had a lot of fun doing this project it was exciting and a lot more code-heavy than I anticipated. Overall an awesome project would have done the display as a laser cut top if I had thought ahead, 3D printing engraving(esq) words did not work super well. Though it got the job done, I think a laser-cut top would look a lot nicer.