DIY

Electronic Dice

Electronic dice  Electronic dice Electronic dice  Electronic dice Electronic dice In this article, the master will tell how to make a set of electronic dice. It is a small handheld device with 5 dice and a button that activates a random roll. Switches are used to turn each die on or off, depending on the game. Those. the game can use from 1 to 5 cubes. Another general switch, turns the device on and off.
Let's watch a short video with an example of how the device works.
Tools and materials: – ATtiny85 microcontroller; – MAX7219CWG IC LED display driver; – Boost module; – 3.7V 420mAh lithium polymer battery; – 0603 red LED – 35 pcs; – 5-position SPST DIP switch; – Slide switch SPDT switch; -Microbutton 6 mm; -Resistor 0603 10 kOhm;
-Resistor 0603 32.4 kOhm;
-Programmer;
-Soldering accessories;
– Prototype board;
-Connecting wires;
-3D-printer;
-Emery paper;
-Superglue;
Step one: prototype
The first step in some electronics projects involves temporary installation of equipment to ensure that the circuit is correct. Once the proper connections have been made, you can start coding/programming. Since the craftsman mainly used surface mount components in the final design, including the MAX7219 LED driver IC, he purchased an equivalent DIP version for prototyping.
The craftsman wanted to first understand how the MAX7219 IC works. Since he was more familiar with Ardunio programming and there is a rather significant difference between Arduino and Attiny85, he decided to do some initial testing/programming with the Ardunio mega.
Initial tests involved writing a simple program to communicate between the Arduino and the MAX7219 with 7 LEDs connected.
Then the master has activated all the LEDs. Added on/off switch, button and piano DIP switch for individual control of each “matrix”. The button will control each random throw.
The device schematic and the 7-segment “dice” diagram can be downloaded below.
Liar's Dice Schematic.pdf7 Segment Dice Equivalent.pdf
Electronic dice  Electronic dice Electronic dice  Electronic dice Electronic dice Step two: programming < br>As mentioned earlier, the master first programmed in the Arduino environment. After debugging and testing it, he converted the program to run on Attiny85. Despite the fact that the IDE of Attiny85 and Arduino is the same, libraries and functions are not the same. For him it was quite a difficult task, since he did all this for the first time. At the end of a step, you can download both codes for both Arduino and Attiny.
In a dice game, players shake the dice for a while before rolling. He also wanted to include a similar feature in his electronic dice. It is implemented as follows. When the button is pressed, the iteration of the values ​​on the stones begins, as soon as the button is released, the roll begins, and a random number appears on each die.
Another feature that he included is scroll animation and triggered scroll animation. These features can be seen in action in the video above.
Overall, the code is pretty simple and uses fairly simple conditional loops. He tried to comment out the attached code so that users can understand each step. The Arduino software uses the “LedControl.h” library, which makes it easy to interact with the MAX7219. Attiny85 cannot take advantage of this library, and the code has a more manual approach to interacting with Max IC.
LiarsDie.inoLiarsDie85.ino
Electronic dice Step Three: PCB Design
Now that he had a working program and a schematic, it's time make a printed circuit board. For this, the wizard used easyEDA.
You can learn more about this process at this link.
After design, he makes a board at one of the manufactures. Together with the board, he ordered a mask for mounting SMD components.
< img class = "aligncenter" alt = "Electronic dice" src = "https://usamodelkina.ru/uploads/posts/2021-01/1610468602_1-14.jpg"/> Electronic dice  Electronic dice Electronic dice  Electronic dice Electronic dice Step four: PCB assembly
After the boards have been manufactured and delivered, he stencils the solder paste, then places the SMD components and sends them to the oven.
 Electronic dice Electronic dice  Electronic dice Electronic dice  Electronic dice I soldered all large parts with a soldering iron.
Electronic dice  Electronic dice Electronic dice  Electronic dice Electronic dice On the board you can see space for a 2032 battery. After installation, the master tested the device with this battery, and decided to replace it with a Li-Po battery. The battery wires are soldered directly to the battery pads. In addition, a JST connector was installed to charge the Li-Po battery.
The Li-Po battery is an excellent power source for such a small device, and it is convenient to charge it between games.
Electronic dice  Electronic dice Electronic dice Step five: 3D printing
The next step was 3D printing of parts. He used Fusion360 for design.
Electronic Dice Electronic dice You can download the files for printing details below.
Die_Cap.stlDie_Divider.stlDie_Spacer.stlCaseBottom .stlCaseTop.stl Step Six: Build
Parts printed on a 3D printer need to be processed. It also had to be done so that the light from the LEDs shone through every point of each stone. To do this, the upper part was cut off from the black lattices and the sections cut from the transparent thread were glued to this place.
Electronic dice Electronic dice  Electronic dice Electronic dice  Electronic dice When the glue was dry, he sanded the protruding thread with 60 grit sandpaper. Then he began grinding each white cube. For the white cube and black spacer, he gradually increased the grit size 220, 400, 800, 1000, 3000 to get a very smooth surface.
After sanding, I installed the black grid in the cube and fixed it with glue.
 Electronic dice Electronic dice  Electronic dice Electronic dice  Electronic dice Then I sanded the case into which the board will be installed. I screwed the board to the case with screws.
Electronic dice  Electronic dice Electronic dice  Electronic dice Glued cubes to the board.
Electronic dice  Electronic dice Electronic dice Everything is ready.
Electronic Dice  Electronic dice  Electronic dice  Electronic dice

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button