Arduino Automatic Dice Tower

1,399

14

1

For my school project ' if this, then that ' I had to make something Interactive with the use of an arduino. I chose to create this automatic dice tower. In this project I'll show you how I put it together.

The tower itself is simple, its just a wooden case with an extra tray to catch the dice. On top of the tower are 6 different cases to put the dice, all closed by a hatch controlled by a servo motor.
The six buttons on the tower each controll a different hatch. The tray has leds underneath it that light up different colours when the buttons are pressed.

Step 1: Things You'll Need

The things I used for this project:


  • Arduino Uno
  • WS2812B LED STRIP
  • SG90 Analog Servo
  • 6 tactile led button white
  • Four battery clips
  • Four 9 volt batteries
  • Any set of clear polydice. I used Chessex Borealis purple/white
  • printed wiring board
  • Mahogany Planks
  • Plexiglass, I used one that isn't entirely see through
  • Any clear ballpoint pen.
  • Any kind of thin MDF wood
  • A phone charger

Ofcourse you can switch a lot of the materials to something else of your liking, These are just the specifics for what I used.

Step 2: The Case

Creating the case is a fairly straight forward process.

  1. For the sides and the back: cut 3 planks of your desired wood, 320 cm tall and 150 wide. To fit it together nicely in the end I cut the sides diagonally.
  2. For the front: You'll have to create an entrance of your desired height. Keep in mind that you have to fit in the buttons, servos and the arduino itself so make sure you don't run out of space.
  3. For the tray: Cut the side pieces 160 cm wide and cut the sides diagonally like the tower. This way you can easily slot it into the tower without necessarily having to attach it, Cut out two slits on each piece. One in the middle for the plexiglass, and one on the bottom so you can slot in the piece of wood with your ledstrip.
  4. For the buttons: Drill 6 holes justr above the entrance, make sure its spaced like you'll space your buttons because they'll be put behind them on the inside.
  5. For your charger : This is something I completely forget to do but I can absolutely recommend you do. Take out a little bit of wood on the botton of the backpiece, you can let your charger wire for the leds feed through this so your tower doesnt rest on it and wobble.
  6. Putting it together: Lay your pieces in the right order with the right side up. Apply tape diagonally along the seams and a few horizontal pieces for support. Then turn it around and apply generous amounts of glue. Fold them together and apply enough clamps to keep it all together. Dry overnight

Step 3: The Buttons

For this project I wanted the buttons to resemble the dice that were going to fall out when pressed. Because the buttons light up I thought it would be cool for the dice to be translucent.

I considered a few options here:

3d print them:

pros:

  • Fairly cheap
  • If you have knowledge of 3d programs it would be fairly easy to make

Cons:

  • If you don't have knowledge of 3d programms, its not that easy to model a set of dice
  • 3d printing takes a while
  • 3d printers are not accessible for everyone
  • The result often is fairly rough

Resin Print them:

Pros:

  • Clear and pretty result
  • If you have knowledge of 3d programs it would be fairly easy to make

Cons:

  • Resin printing takes a while
  • Is even less accesible then 3d printing

Buy a set of dice , get the chainsaw:

Pros:

  • You have to model nothing yourself
  • Great range of colours, glitters , finish.
  • Quick and easily obtainable

Cons:

  • Fairly expensive
  • Cutting them in half is quite the project
  • Chance of breaking whilst cutting
  • If you're a dice fanatic like me , it hurts a little to buy a set only to destroy it

In the end I went for buying a set of dice because I did not have that much time left and I did like the thought of having a pretty colour.

Cutting them:

The nasty part about cutting these in half is that they conduct heat...extremeeely well. So if you go too quick you get a dice melted to your saw which is incredibly inconvenient to get off. What I did was take two pieces of scrap wood, drill a partial hole in them and wedge the dice inbetween. Then I took a handsaw and just slowly and steadily started to half them. Once I got through I got a fairly rough sandpaperblock and sanded the underside evenly. This worked for all dice except the d4, Its fairly thin and small and I just didn't do it carefully enough, it ended up melting/breaking away. I replaced it with the d100 for aesthetic reasons but I can recommend just putting it on the button as a whole.

Assembeling the button:

Because the actual buttons are on the inside of the tower you'll need something that reaches through the drilled holes and portrudes a little on the outside so you can press it. Because light needs to travel through it needs to be translucent aswell. To do this I simply took the barrel of a ballpoint pen, cut it in six equal pieces long enough to go through the holes and glued the halved dice on the other side. I didnt permanently attach mine to the buttons on the inside because this way I can take them out when travellling with the tower.

(I used the other half of the dice to put next to the hatches of the tower so you know in which one to put the corrosponding dice)

Step 4: The Button/Led/Battery Printplate

Get ready for an unholy amount of wires.

The printplate:

I completely forgot to take a clear picture of the printplate with all wires soldered to so these two have to do. Cut two pieces of printplate, drill 4 holes at the corners for each and attach your buttons. Put appropriate resistors for both the button and the led on it (treat the led on it like you'd treat a seperate normal one). Then solder a wire for each button and led.

Attach all the volt wires of the buttons and leds together, and add a wire that leads back to the 5v input on the arduino.

Attach all the ground wires of the buttons and leds together, then add a wire that leads back to the ground on the arduino.

This is also where I attached my battery clips and male connector to plug into the arduino.


Step 5: The Servos

To make the little dice compartments:

  1. Cut out two different pieces of wood, that fit perfectly in the width of the tower. Glue 3 servos on each, make sure they can be put opposite each other later (see first and second picture)m drill a hole where the turning part of the servo fits in.
  2. Put little dividers between them so you have the dice compartments
  3. Cut a piece of wood fo rthe middle , then put each piece of wood on a side.
  4. cut 6 hatches (make sure they're not too heavy, the servos arent that strong) drill a tiny tiny hole in the side and put an equally smale nail in. Glue(be sure to use strong glue and let it dry appropriately) that into the moving part of the servo
  5. Tada, you got your compartments.

Wiring:

Now put all the ground wires of your servos together, solder them and lead one wire from there into a ground pin on the arduino.

Now put all the power wires of your servos together, solder them and lead one wire from there to the printplate with the buttons and attach it there so they can take energy from the batteries.

attach all the signal pins into your arduino

Step 6: The LEDS

I used 15 leds for this project, I divided them in 3 pieces and glued them to a piece of mdf. Then slotted them into the dice tray. I attached this to a wire with an usb end so I can just use a phone charger because these ledstrips take a lot of energy to run.

You'll need two ground wires for this one , one goes into the charger and the other goes to the arduino. Also lead the signal wire to the arduino.

Step 7: Putting It All Together

This will sound so much easier then it actually is. Cause I wanted a fairly sleek tower I absolutely sacrificed a bit of comfort. Putting it in is a lot of fumbling and cursing and I absolutely reccomend a second pair of hands for this.

If you want this all to be a bit easier, size up your tower.

  1. Start with wedging your servos into the top of the tower. I made it such
    a tight fit I just had to push it in , no need for glue or anything. I then glued the other halves of the dice to the top so I know what slot needs what dice.
  2. Turn the tower around.
  3. Put the printplate of the buttons behind the drilled holes. Screw tiny screws into the 8 drilled holes you got. Take extra care to make sure the buttons are pressable and there are no wires accidentally infront of it!
  4. Screw in your arduino opposite of that printplate, all the wires are now in the middle of the tower. (I don't think this the most professional way of doing this but I was so afraid of wires popping out I put a layer of hotglue on them once they were all plugged inside the arduino. Its easibly peelable so you dont destroy your arduino. )
  5. Wire manage, tie them together, keep them in the middle (this is the worst I'm sorry)
  6. Make a ramp, put it infront of your arduino so its hidden and the dice can roll off it.Make it overlap the outside of the tower slightly so you can slot in your dice tray. (picture) Make sure your ramp is prettier then mine.

I'm sorry I don't have more picturees for refrence, I was too busy crying whilst putting it together.

Step 8: The Coding

#include <servo.h> //include servo library<br>#include <fastled.h> //include fastled library</fastled.h></servo.h>
#define LED_PIN     19 //define the LEDSTRIP pins 
#define NUM_LEDS    24 //define the amount of leds you use, your first one counts as 0
CRGB leds[NUM_LEDS];
const int ledPin1 = 2; //define which pins you'll use for the button LEDS
const int ledPin2 = 3;
const int ledPin3 = 4;
const int ledPin4 = 5;
const int ledPin5 = 6;
const int ledPin6 = 7;
const int buttonPin1 = A0; //define which pins you'll use for your buttons
const int buttonPin2 = A1;
const int buttonPin3 = A2;
const int buttonPin4 = A3;
const int buttonPin5 = A4;
const int buttonPin6 = A5;
int servoPin1 = 8; //define which pins you'll use for your Servo's
int servoPin2 = 9;
int servoPin3 = 10;
int servoPin4 = 11;
int servoPin5 = 12;
int servoPin6 = 13;
int buttonState1 = 0; //create a variable for your buttonstate
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;
Servo Servo1;
Servo Servo2;
Servo Servo3;
Servo Servo4;
Servo Servo5;
Servo Servo6;
void setup() {
Serial.begin(9600);
FastLED.addLeds<ws2812, led_pin,="" grb="">(leds, NUM_LEDS); </ws2812,>
pinMode(ledPin1, OUTPUT); //set led pins as output
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
pinMode(ledPin6, OUTPUT);
Servo1.attach(8); //attach your servos
Servo2.attach(9);
Servo3.attach(10);
Servo4.attach(11);
Servo5.attach(12);
Servo6.attach(13);
}
void loop() //Servo 1
{
Servo1.write(0);                         //automatically puts the servo to 0 at the begin
buttonState1 = digitalRead(buttonPin1); //the state of the button gets saved as buttonstate1
if (buttonState1 == HIGH) { //if you press the button
digitalWrite(ledPin1, HIGH); //turns led on
Servo1.write(90); //servo turns 90 degrees
for(int i=0;i<6;i++){ //leds 0-5 turn your defined colour
    leds[i].setRGB(131, 7, 247);
    
}
for(int i=5;i<11;i++){ //leds 6-10 turn your defined colour
    leds[i].setRGB(255, 13, 93);
    
}
for(int i=11;i<16;i++){ //leds 11-15 turn your defined colour
    leds[i].setRGB(253, 185, 155);
   
}
FastLED.show(); 
Serial.println("Servo1 ON"); //prints that the servo is on
delay(5000); //waits 5 seconds
Servo1.write(0); //servo turns back to 0 degrees
}
else {
digitalWrite(ledPin1, LOW);
Serial.println("Servo1 OFF");
}
//repeat x6 
//Servo 2 
Servo2.write(0);
buttonState2 = digitalRead(buttonPin2);
if (buttonState2 == HIGH) {
digitalWrite(ledPin2, HIGH);
Servo2.write(90);
for(int i=0;i<6;i++){
    leds[i].setRGB(131, 7, 247);
    
}
for(int i=5;i<11;i++){
    leds[i].setRGB(255, 255, 93);
    
}
for(int i=11;i<16;i++){
    leds[i].setRGB(253, 185, 155);
   
}
FastLED.show();
Serial.println("Servo2 ON");
delay(5000);
Servo2.write(0);
}
else {
digitalWrite(ledPin2, LOW);
Serial.println("Servo2 OFF");
}
//Servo 3
Servo3.write(0);
buttonState3 = digitalRead(buttonPin3);
if (buttonState3 == HIGH) {
digitalWrite(ledPin3, HIGH);
Servo3.write(90);
Serial.println("Servo3 ON");
delay(5000);
Servo3.write(0);
}
else {
digitalWrite(ledPin3, LOW);
Serial.println("Servo3 OFF");
}
//Servo 4
Servo4.write (0);
buttonState4 = digitalRead(buttonPin4);
if (buttonState4 == HIGH) {
digitalWrite(ledPin4, HIGH);
Servo4.write(90);
for(int i=0;i<6;i++){
    leds[i].setRGB(131, 7, 247);
    
}
for(int i=5;i<11;i++){
    leds[i].setRGB(255, 13, 93);
    
}
for(int i=11;i<16;i++){
    leds[i].setRGB(253, 185, 155);
   
}
FastLED.show();
Serial.println("Servo4 ON");
delay(5000);
Servo4.write(0);
}
else {
digitalWrite(ledPin4, LOW);
Serial.println("Servo4 OFF");
}
//Servo 5
Servo5.write (0);
buttonState5 = digitalRead(buttonPin5);
if (buttonState5 == HIGH) {
digitalWrite(ledPin5, HIGH);
Servo5.write(90);
Serial.println("Servo5 ON");
delay(5000);
Servo5.write(0);
}
else {
digitalWrite(ledPin5, LOW);
Serial.println("Servo5 OFF");
}
//Servo 6
Servo6.write (0);
buttonState6 = digitalRead(buttonPin6);
if (buttonState6 == HIGH) {
digitalWrite(ledPin6, HIGH);
Servo6.write(90);
Serial.println("Servo6 ON");
delay(5000);
Servo6.write(0);
}
else {
digitalWrite(ledPin6, LOW);
Serial.println("Servo6 OFF");
}
}

Step 9: Enjoy Your Finished Dice Tower !

Share

    Recommendations

    • Epilog X Contest

      Epilog X Contest
    • Paper Contest

      Paper Contest
    • Remix Contest

      Remix Contest

    Discussions

    0
    None
    randofo

    4 weeks ago

    Nice. I like how the dice are also the buttons.