Introduction: Remote Die Reader

Suitable for both complete beginners and experienced electrical engineers alike, this project serves as a blank slate, from which one can take any number of directions as it progresses. Covered here will be the basic steps required to construct a remote input die. This will require Arduino code (included at the end of this document), some electrical circuit knowledge, access to a 3D printer, and basic soldering skills. 

The concept is to use a solenoid (a small component with a push-pull plunger action), a gyroscope, and an Arduino to remotely read the outcome of a dice roll. The gyroscope will first tell the Arduino the orientation of the die, which depending on the settings will trigger the solenoid, pushing down a number corresponding to the number rolled. If a five is rolled for instance, two solenoids will trigger, pushing down both 2 and 3. This project could easily be accomplished digitally with LEDs, or generalized to other applications. 

This will require CAD, some C coding, and analog electronics. Once you've gathered the necessary materials, follow the steps below, and in no time you'll have a remote reading die!

Supplies

MPU-6050 Gyroscope x1

3D Printer Access+CAD/Slicing Software 

Deltrol Controls 56597-60 INT Solenoid x3

Arduino Teensy 3.2 x1

ACDelco Super Alkaline Battery 9V (or BK Precision Triple Output DC Power Supply) 

Wires 

Soldering Iron+Solder 

MEDER Electronic DIP05-1A57-BV350 Relay x3

Step 1: Sort Out Your Code

This first step will cover the coding necessary for Arduino operation. The Arduino is essentially a tiny computer, so if we want it to do what we want it to, we need to tell it. First, download the Arduino IDE software, located at this link--- https://www.arduino.cc/en/software.

Then, copy the code included with this document and make sure that it compiles. Once the code is reading well, we’ll begin the wiring, small edits, and eventually upload. 

Step 2: Begin to Print Your 3D Model

My decision to include this step first is due to the challenging nature of 3D printing timescales, which are unpredictable at best. Found attached to this document is a 3mf file, which is uploadable to many kinds of slicing software. Although I will not cover how to 3D print a model in this tutorial, only ask your nearest engineer and they will explain in great depth. Once you begin printing the model, you will have to file the sides down to ensure that they are as smooth as possible. This file contains an outer box and base which will hold the wiring and power source and two halves of the die.

Step 3: 3.) Building the Circuit!

Now, while we wait for our model to print, let's begin constructing the circuit. This circuit is a relay circuit that makes use of the solenoid, a power source, and an arduino. Included here is the circuit diagram, a close up of the arduino rig, a fully hooked up circuit, and the arduino pinout (you may ignore the bright green container, as that will be addressed in the next step). First, solder your gyroscope wires to the arduino, ensuring that the wires are connected in accordance with the arduino pinout. Then, you must solder wires to the front prongs of the solenoids, as the solenoids themselves cannot sit on the breadboard. Construct the layout as pictured, ensuring that your relay is oriented the correct way. In the end, you will have a gyroscope soldered to an arduino, wires soldered to three solenoids, and identical relay circuits. Keep this setup attached to the breadboard, as it will eventually rest inside our 3D printed outer box.

Step 4: Full Assembly

Once you have your 3D printed model and your circuit, assembly is simple. Use an elastic adhesive, such as heavy-duty gorilla glue or shoe glue to secure the solenoids. Place them such that the metal can adhere to the top of the container, and such that the plungers can easily punch through the premade holes. After the solenoids are attached, maneuver the breadboard such that it fits within the container, and ensure the solenoids are hooked up properly. You may test the circuit using the following code: 

Loop(){ 

digitalWrite(pinOUTPUT, HIGH); 

Delay(1000); 

DigitalWrite(pinOUTPUT, LOW); 

-where pinOUTPUT corresponds to the pin you connected to the solenoid/s.

Finally, fit the two halves of the die together with the gyroscope inside. It's recommended to use clay or another type of staying agent to hold the gyroscope in place, as well as make the die heavier (which reduces the influence of the wires).

Step 5: Final Step-Editing the Code

The first step is to figure out which solenoid is attached to which arduino output. In the example given, the solenoids were attached to output 2, 4, and 6. However, if you wish to attach to another output, you must change the numbers accordingly. Please note that this code works best with digital pins. 

This input requires very precise calibration, and thus this step is the most time consuming. The gyroscope adheres to whatever orientation it is placed in, meaning that there is no set dimensions. Thus, you must choose a starting orientation, and calibrate the coordinates to match the respective rolls from that starting orientation. You can do this by adjusting the quaternion values (q.w, q.x, q.y, q.z). 

Starting from line 157 of the provided code, modify the values inside the "if" statements referring to the variable. For example, if you start on number 5, ensure that the appropriate solenoids are triggering (solenoid 2 and 3) for the appropriate output ( q.w = 1, q.x = 0, q.y = 0, q.z = 0). Continue this process for each orientation and be sure to test roll a couple of times. 

Step 6: Wrapping Up

With the final calibration steps, you have successfully made a remote reading die! To figure out where to go from here, you might expand upon this project, or come up with a new one yourself. It’s harder than it seems, but I have every faith that you can do it. Remember to check out other documents produced by my colleagues and thank you for reading this instructable!