Introduction: Dice Generator

About: Student Maker - Design Technology @ UWCSEA East Singapore - Brown Design Workshop

This Instructables is for my Major Project that I completed as part of my IGCSE Systems and Controls Course. It received an A* grade and I will guide you through how to make it in this instructable. A decent background in electronics as well as experience with Arduino and it's IDE is required in order to complete this project.


Background

With board games decreasing in popularity and electronics booming, it may seem hard to sit down and play without the interference of gadgets. In this specific case, my client, a teacher of the Warhammer club would rather use physical dice than an online one in his club. The problem is, he can’t have dice with 100 sides which is why he must resort to using an online dice simulator. This is where an opportunity for this product rises.

While the size of the market this product is aimed at is declining, the need for it still exists. Board games are becoming a feature of the past while online and electronic games emerge. In this particular instance, my product reduces the need for phones or the internet during board gameplay making the players feel less disconnected from the actual game. The systems which it will make use of are the 4511 IC and an Arduino Nano microcontroller. This project will have to make use of a microcontroller because, without one, the circuit would be too inefficient.


Function

The product allows the user to select a number between 0 and 100 using two rotary switches on the left side of the device. This number is displayed to the user through the two 7 segment displays directly above the rotary switches as feedback. Then, as the user presses the roll button, a random number between 0 and the selected number will be rolled and displayed on the 7 segment displays on the right side of the device.

Step 1: The Circuit

The simplified circuit diagram above shows each of the necessary Arduino inputs and outputs to be used as a reference for later steps in the project.

How does the circuit work?

The user first inputs the number of sides they want their dice to have by making use of the two rotary switches of which one controls the 10s digit place and the other controls the 1s digit place. This number is displayed through feedback on the first 7 segment PCB making it easier for the user to understand the number that they have picked.

The user's decimal input is converted into a binary format on the Rotary PCB and is sent to the Arduino Nano. The nano will then choose a random number between 0 and the selected number. This information will then be sent in a binary format to the 2nd 7 Segment PCB when the Push-To-Make (Roll) switch is pressed down.

I have attached the Arduino code for reference below in order to make the understanding of how this product works easier.

Step 2: Printed Circuit Boards

Bill Of Materials:

  • 470 Ohm Resistors x28
  • 10K Ohm Resistors x22
  • CD 4511BE x4
  • 7 Segment Display (Green, CC) x4
  • Diode 1N4002 x44
  • Rotary Switch (1P12T) x2
  • Rocker Switch (On-Off) x2
  • Push To Make x1
  • Arduino Nano x1
  • LED Green x2

Using Autodesk Eagle on my computer, I designed the schematic of each PCB as seen in the photo above. From the schematic design, I had the PCBs (2x 7 Segment PCB, 1x Rotary PCB) made in China and shipped over.

Gerber Files can be found here (Eagle files are attached below)


Soldering Components

Before soldering, make sure to have good ventilation and safety glasses. You also need to make sure to orient and place all components in their correct positions before soldering them to the board. Be quick with the iron as holding it over a pin for too long can cause the IC to burn out. Make sure each contact point is securely fastened to the board with solder and that there aren't any dry joints.


Cutting Out Holes

First, I marked out the holes on each PCB and aligned them to make sure they were marked correctly. This was done using a try square, marker, and ruler. After marking the holes, I used a steel clamp to hold the PCB in place and drill 4x 2mm holes in each PCB board, followed by the required 3 mm holes in order to prevent the cracking of the TRFE material.

This step is important as it will allow you to properly secure the PCBs to the housing later on.

Step 3: Circuitry + Testing

Tasks

  • Check all PCB connections.
  • Set up the entire circuit.
  • Run the code through the circuit for testing.
  • If it doesn’t work, fix the problem and repeat.


Quality Control: Using the continuity setting on the multimeter, I checked each track and component to detect and eliminate any shorts that could affect the function of the circuit. If a short was found, the following steps were taken in order to resolve the problem.

1. Identify the short - make sure that the short is indeed a problem and does exist as the more times heat is applied to the copper pads, the more likely they are to either melt, become damaged or non-conductive.

2. Using a solder sucker, gently heat the joint and suck up the liquid solder. Repeat until all the solder is removed. If the solder does not come off, using solder wick in order to try and absorb some of it.

3. Finally, re-solder both joints with care and with minimal solder but just enough so that the joint is secure and conductive.


Uploading The Code:

In order to upload the code to the Arduino Nano, first, download the Arduino IDE. Next, download this Arduino Nano Driver and this FTDI driver.

Then using the code from Step 1, upload it via a USB to Micro-USB cable to the Arduino Nano. The circuit should now be operational. If it does not work, start troubleshooting by double-checking all components and connections.


Additional LED

If you look at the 7 segment PCB board carefully, you will notice that there is a slot for an LED. This LED is there to light up when the number 100 is displayed and the two 7 segment displays would show two 0s. In order to make this work, use two NOT gates and two AND gates in a configuration that will trigger the LED when their are no inputs into the 4511 IC.

Step 4: User Interface

Tasks

  • Design the UI using Adobe illustrator.
  • Laser-cut the UI and make sure it fits with the circuit components. Engrave the Warhammer eagle design onto the UI.
  • Spray paint the design gray/silver.


Material: Black Acrylic

Using Adobe Illustrator, I designed the User Interface in accordance with the dimensions listed in the image above (click see more images). I then exported this design file to the laser cutter and cut out the piece of acrylic.

Then, leaving the plastic sheet on the acrylic, I spray painted the engraved sections of the acrylic with a silver/gray color. This was done several times (4 times with 10-minute intervals) in order to ensure a bold and clear image. After leaving it all to dry, I peeled off the plastic layer and made sure there weren't any irregularities.

Step 5: Side Plates

Tasks

  • Collection Of Ash Wood.
  • Draw out all the cutting lines on the piece of wood for a guide when cutting. Cut out both the left and right side for the housing.


Materials

1. Ash Wood 135mm (w) x 300mm (l) x 10mm (d)

The next step of this project, and perhaps the most complex part of the housing, are the side plates. First, using the measurements given above, mark out both side pieces on a 10mm thick piece of Ash Wood. Using a band saw, cut out the general shape of the pieces.

Next, using a router (routing machine), cut out the grooves shown in the diagrams above. There are two10mm wide x 5mm thick grooves. and one3mm (wide) x 150mm (long) x 5mm (deep) groove at a 50 degree angle.

Finishing

In order to correct any small errors in surface alignment or sharp edges, use fine sandpaper to go over those sections in order to smooth them out giving them a nice aesthetic appeal. Professionalism is key.

Step 6: Top, Bottom and Back Plates

Tasks

  • Cut out the top bar.
  • Cut out the bottom plate.
  • Laser-cut the backplate after creating the adobe illustrator file for the laser cutter.


Top Plate (Material: Ash)

The top plate is a tricky piece to produce as it includes an angle of 50 degrees on one face. In order to cut this piece out, first mark out the general shape of the block using the dimensions given above and a try square. Next, create the angle by setting the bank angle of the band saw platform at 50 degrees. From there, cut along one side of the rectangle in order to produce the slanted face.

Furthermore, level out the platform in order to use the band saw to cut out the other three sides of the rectangular top piece.


Bottom Plate (Material:
Ash)

The bottom plate is easy to cut out using a band saw as it is a rectangular block of Ashwood with the dimensions of 220mm x 145mm x 10mm.


Back Plate (Material: Acrylic)

Using adobe illustrator, I designed the backplate (135mm x 230mm) along with a slot for the Power In cable and the On-Off switch along with the holes for the screws as seen in the diagrams above. I then exported this file to the laser cutter and had it cut.

Using a pencil and ruler, mark out 4 holes (2 on each side) for the holes for screws (diameter depends on the screw you use). Using a center punch and a mallet, make a dent over each one of these holes and finally, use the appropriate drill bit with a hand drill to drill out all 4 holes.

Next, I followed the same steps for spray painting letters onto acrylic as in step 4. Finally, using a countersink drill bit, I went over each of the screw holes in order to ensure that the screw heads would be flush with the acrylic surface when assembled.


Power Electronics:

The incoming power supply must be around 5V. Once routed through the power hole in the backplate, the positive wire must be routed through the power switch so that the user is able to control the power into the product. The positive terminal from the switch must then be connected to the V(in) pin on the Arduino and the negative/GND wire must be connected to the Arduino GND (in) pin.

Step 7: Gluing and Clamping

Now that all the housing pieces have been cut out, we need to put them together. All the pieces are listed below:

  • 2x Side Plates
  • 1x Top Bar
  • 1x Bottom Place
  • 1x User Interface
  • 1x Back Plate

In this step, the pieces we will be gluing together are:

  • 1x Top Bar
  • 2x Side Plates

It is very important that these pieces and these pieces ONLY are glued to one another. The bottom plate is shown in the images above but IS NOT glued to the side plates. It is solely placed there as a guide and for positioning.


Steps:

1. Arrange the pieces in order and ensure that they can all be placed and fitted together properly. If this is not the case, either file down the problematic piece until it does work, or remake it.

2. Apply a small but reasonable layer of PVA glue over the key contact points. In this case, these points would be the top rebate joint on both side pieces.

3. Combine all the pieces together using the bottom plate as a guide to help hold up the side plates and the top bar.

4. Use one or two clamps to secure the piece in this configuration until the glue has dried and the joints are all secure.

Step 8: Drilling

In total, there are 8 holes that must be drilled into the Ashwood. All holes must be drilled using a 2.5mm drill bit.

First I clamped down the housing in order to ensure that it doesn’t move during the drilling process for quality control. Then, using a ruler and pencil, I marked out all 8 holes that needed to be drilled at the back and at the bottom. Using a center punch and a ball pen hammer, I indented each point in order to guide the drill bit. Finally, using a hand drill and a 2.5mm drill bit, I drilled out each hole.

After drilling the holes through the acrylic back piece and the wooden bottom piece, I used a countersink drill bit to create a countersink for each hole. This was necessary as I was using self-tapping screws to join the back and bottom pieces to the housing. This meant that with these countersink indents, the screw head would be flush with the surface of the material it was screwed into giving it a nice look and safe exterior.

Step 9: Sanding and Finishing

Sanding down impurities

After the housing was glued together, I first used rough sandpaper to get rid of any excessdriedglue or obvious misalignment problems. Then, for quality control. I switched to finer sandpaper and went over every surface to ensure a smooth finish.


Applying a finish: Furniture Wax

Finally, in order to give the ash wood a nice finish and feel, I decided to wax the surface. Using a polishing cloth, I applied the furniture wax to every exterior surface of the wood 4times over with 30 minutes drying sessions in between for quality control. This was for quality control which ensured that every inch of the wood was coated properly and had the same texture.

Step 10: Secure Electronics to the Housing

Materials

  • 12x M4 Bolts
  • 12x M4 Nuts
  • 12x M4 Nylon Washers

Above, I attach the PCBs to the UI using the bolts, nuts and nylon washers. I used Nylon washers because they are non-conductive and therefore won’t create any shorts on contact with my PCB. After the PCBs were hooked up, I used a drill and a screwdriver to attach my back and bottom plates to the final housing. Do this process with care as the electronics can tend to be quite delicate.

Should any solder joints break or come apart, it is imperative that you fix it there and then b4 continuing. Make sure to test the circuit before and after securing it to the housing in order to ensure everything remains in working order.

Step 11: Put the Housing Together

In this final step, take the user interface and slide it up the side plate grooves into the housing. Next, place the bottom plate underneath the housing between the two side plate's rebate joints. Align the screw holes and using a screwdriver, insert all 4 screws (2 on each side) in order to secure the plate in place.

The last step is to attach the backplate to the housing. Do this by aligning the screw holes and then insert the 4 self-tapping wood screws into each position checking to make sure that it is a tight and flush fit.

Finally, you can smooth out any errors using fine sandpapers and furniture wax. If there are any errors with alignment, please revisit the previous steps. If you should need any help during this process, please feel free to post your questions in the comment section below.

Step 12: You Are Done!

Well done on completing the project! Enjoy!

STEM Contest

Participated in the
STEM Contest