D&D Stat Tracker W/ Physical Computing
by burke_pete15 in Circuits > Arduino
97 Views, 2 Favorites, 0 Comments
D&D Stat Tracker W/ Physical Computing
For this project, I decided to do something completely different from my IDC #1 for a few reasons. Primarily it was because of a lack of interest or passion in what I had decided for my first IDC. As well as a desire to build something with a more all-around applicable purpose. I have a love for Dungeons & Dragons and one of my biggest annoyances with it, is how slow some people can be. There's a lot of stuff to keep track of! So I thought it could be really useful to create something that could do all of that for you. One of the biggest challenges I faced in changing IDCs was the fact that my project was significantly different, meaning other than some general components almost nothing could be reused. As well across both IDC #1 and IDC #2, I found myself struggling to get code that did what I wanted. Often instead doing something almost right, but just a few steps off.
I was excited thought to tackle the challenges of this project. As well as create something that I would consistently use and not something that would end up stuffed away in the closet. As well one of the bigger challenges I found myself facing was ensuring all of my components fit properly within the display as well as ensuring there was enough room for all of the wire and other components that were integral to my IDC. Dealing with two different displays did create some challenges, especially with the OLED display. Which required very specific code and libraries to function properly. There were so many wires involved in the circuit. Overall I am really happy with how this project turned out. The code for this project ended up being simplified significantly but is easily modifiable to anyone's needs with the framework I have created.
Link to Video of Draft Circuit: Draft Functionality Movie
Link to Video of Finished Product: Functionality Movie
Supplies
1x - Arduino Uno
1x - Potentiometer - 10k Ohm, Linear
1x - USB Cable A to B
1x - OLED Display Module I2C 128X64 1.3in Display Module SSD1106
1x - LCD 1602 Module (with pin header)
1x - PS2 X Y Axis Joystick Module
1x - BreadBoard
10x - Jumper Wires Male to Male
10x - Jumper Wire Male to Female
1x - 24in X 12in Plywood - 1/4in (5mm) Thickness
Any items not linked can be found inside the ELEGOO Starter Kit
IDC #1 to IDC #2
Attached are images of my IDC #1 which was for the most part "cannibalized "for the creation of my IDC #2
LCD 1602 Module
The LCD 1602 Module displays the characters' names, classes, race, and level for this project. Thus it does not require any input from the joystick. It will require the "LiquidCrystal" library.
Library: LiquidCrystal.h
Pin Connections
- LCD RS pin to digital pin 12
- LCD Enable pin to digital pin 11
- LCD D4 pin to digital pin 5
- LCD D5 pin to digital pin 4
- LCD D6 pin to digital pin 3
- LCD D7 pin to digital pin 2
- LCD R/W pin to GND
- LCD VSS pin to GND
- LCD VCC pin to 5V
- LCD LED+ to 5V through a 220 ohm resistor
- LCD LED- to GND
As well, wire a 10k potentiometer to +5V and GND, with its wiper (output) to LCD screens VO pin (pin3).
OLED Display Module I2C 128x64
The OLED Display tracks a player's HP and Spell Slots. Thus it will take in inputs from the joystick and decrease or increase the HP respectively. Moving the joystick up or down with increase or decrease the HP respectively. Clicking the joystick will decrease the Spell Slot count by 1. Then if the joystick is moved to the left or right it will reset the Hp and Spell Slots to their original amounts.
Note: This circuit will require soldering as it has no pins attached to it. Be very careful as to not damage the display
Libraries: adafruit_SH1106.h, adafruit_GFX.h
Pin Connections
- OLED Vin pin to 5V
- OLED GND pin to GND
- OLED SCL pin to analog pin 5
- OLED SDA pin to analog pin 4
PS2 X Y Joystick Module
The Joystick Module is used to change the HP of the character. It is a rather simple component to attach so therefore I have not included any images regarding how to attach the pins.
Library: Joystick.h, Button.h, and AnalogReader.h
Pin Connection
- Joystick GND pin to GND
- Joystick +5V pin to 5V
- Joystick VRx pin to analog pin 3
- Joystick VRy pin to analog pin 1
- Joystick SW pin to digital pin 6
With the joystick complete the circuit is finished and we can move on to coding the final circuit should look like the pictures above.
Enclosure & Display
The enclosure for this project is laser cut and has engravings marking the different parts and displays of the project. I have attached the 3D Model as well as the dxf files for the laser cut. The enclosure took quite a few iterations, 3 to be exact. The first was 3D Printed, followed by 2 laser-cut enclosures.
- The Enclosure and Display are made from 1/4in wood (5mm)
- The Enclosure is built to hold the circuit and portable battery
Code
The code for this project is attached including some of the more specific libraries. As well as a test code file that can test all of the different components. The code for this project is used to take the inputs from the joystick and output the information and changes from the input onto the OLED screen. Tracking both a player's HP and Spell Slots.
Credit/Sources
- Liquid Crystal Displays
- Guide for OLED Display and Arduino NOTE: This guide uses the incorrect library as it is a slightly different component make sure you use the SH1106 library
- Chult/Dinosaur Image - Created by Ash Ruff