Automatic Dice Shaker

by ivsaadi in Circuits > Arduino

27 Views, 1 Favorites, 0 Comments

Automatic Dice Shaker

Screenshot 2026-05-12 014959.png

This project is an automatic dice shaker built with an Arduino, a gear motor, an H‑bridge motor driver, a servo , and two control buttons. Pressing the Start button makes the motor spin the dice holder, and pressing the Stop button stops the shaking so the dice can be released into a tray.

Supplies

  1. SparkFun Kit
  2. Arduino UNO board
  3. Motor Driver
  4. Hobby Gearmotor
  5. Micro Servo
  6. Push Buttons (2)
  7. Wires
  8. Cardboard
  9. 3D printer
  10. Tape
  11. Hot Glue Gun
  12. PVC pipes
  13. Zip ties

Power Breadboard

Screenshot 2026-05-12 013525.png

You must power the breadboard before connecting any components.

Connect Arduino GND → breadboard (-) rail

Connect Arduino 5V → breadboard (+) rail

Wiring Motor

Screenshot 2026-05-12 013733.png

Place the H-bridge firmly on the breadboard

Connect all grounds to GND

Connect VM (motor power) → (+) rail

Connect VCC (logic power) → (+) rail

The H-bridge controls the direction and speed of the gear motor.


Wire the H-Bridge to the Arduino

AIN1 → Arduino Pin 13

AIN2 → Arduino Pin 12

PWMA (speed control) → Arduino Pin 11

These pins allow the Arduino to control motor direction and speed.


Connect the Gear Motor

Connect the two motor wires → A01 and A02 on the H-bridge

Polarity does not matter; reversing them only changes spin direction

Wiring Servo

Screenshot_12-5-2026_14456_www.tinkercad.com.jpeg

Servo black → ground rail

Servo red wire → (+) rail

Servo white wire → Arduino Pin 9

Wiring Buttons

Screenshot_12-5-2026_14527_www.tinkercad.com.jpeg

Place two push buttons on the breadboard

Start button: Wire one side → Pin 2, wire other side → ground

Stop button: Wire one side → Pin 7, wire other side → ground


These buttons control when the motor begins and ends shaking.

Code

Attached is our Arduino code. Copy or download the code.

Downloads

CAD Model

Screenshot 2026-05-12 015412.png

Build the dice holder above in SolidWorks using the attached files.

Base Construction

Screenshot 2026-05-12 014959.png

Build a triangular base with PVC pipes and cardboard supports at the bottom of the pipes.


Glue a cardboard platform on top.


Build a box with a cutout for the motor to hang out with the 3D printed part and cover the Arduino board.

Flowchart

Screenshot 2026-05-12 020052.png

Above is a simple flowchart of how the code works.

Video

Attached is a video of our project working.

Downloads