Automatic Dice Shaker
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
- SparkFun Kit
- Arduino UNO board
- Motor Driver
- Hobby Gearmotor
- Micro Servo
- Push Buttons (2)
- Wires
- Cardboard
- 3D printer
- Tape
- Hot Glue Gun
- PVC pipes
- Zip ties
Power Breadboard
You must power the breadboard before connecting any components.
Connect Arduino GND → breadboard (-) rail
Connect Arduino 5V → breadboard (+) rail
Wiring Motor
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
Servo black → ground rail
Servo red wire → (+) rail
Servo white wire → Arduino Pin 9
Wiring Buttons
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
Build the dice holder above in SolidWorks using the attached files.
Base Construction
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
Above is a simple flowchart of how the code works.
Video
Attached is a video of our project working.