Introduction: "Big Two" Poker Game Box (9B_J05033_張傳楷)

Are you ever frustrated because you forgot who's turn is it while playing the Poker game Big Two? Here's how this box can help. After each turn, the player should press the button and the stepper motor with an arrow on it will turn, pointing at the next player; there will also be lights flashing and tones to remind the player that it is their turn.

Ideally, each player participating in the poker game "Big Two" have a hand of 13 cards; in other words, in most games, there are 4 players. So this box is designed for four players participating, by having the stepper motor turning 90 degrees for each turn. But despite this design, you can also adjust the code for different numbers of players by dividing 512 with the number of players.

Sounds simple, huh? Yes, it is really easy – but you can't imagine how convenient it is if you get to use it in your card game! Please enjoy my project below!

Step 1: Supplies/ Materials

Some materials listed below has a link attached for a purchasing source.

For the Arduino Device:

  1. Any Arduino Board x1 (In this project, I used Arduino Leonardo)
    Purchasing Source
  2. Breadboard (Optional)
    Purchasing Source
  3. Jumper Wires (the specific number is based on your need)
    Purchasing Source
  4. LED x1 (in any color you preferred)
    Purchasing Source
  5. Stepper Motor x1 (Unipolar one with a Driver)
    Purchasing Source
  6. Push Button x1
    Purchasing Source
  7. 82Ω Resistor x1
    Purchasing Source
  8. 10kΩ Resistor x1
    Purchasing Source
  9. 5V Small Speaker x1
    Purchasing Source

For Decoration:

  1. Cardboard box x1 (Size: 18.5 cm * 13.5 cm * 8 cm)
  2. White Paper (the specific number is based on your need)
  3. Black Paper (the specific number is based on your need)
  4. Red Paper (the specific number is based on your need)
  5. Glue Gun x1 (Optional)
    Purchasing Source
  6. Glue specifically for Glue Gun (the specific number is based on your need)
    Purchasing Source
  7. Utility Knife x1 (Optional)
  8. Ruler x1 (Optional)

Step 2: Circuit

Connect the jumper wires with the components according to the circuit picture provided.

Here are some details about the circuit diagram:

  1. the 5V small speaker: connect to GND (negative) and D pin [8]
  2. the stepper motor: connect to both 5V (positive), GND (negative), and D pin [10, 11, 12, and 13]
  3. the LED: connect to D pin [5] and GND (negative) having a 82 ohm resistor in between GND and the LED
  4. the push button: connect to D pin [7], 5V (positive), and GND (negative) having a 10K ohm resistor in between GND and the push button

Step 3: Design of the Box Structure

For this box, I mostly use a hot glue gun to fix the component on the cardboard box. Below are some videos of the box structure I did.

1. Structure of push button and LED: to be specific, the cut for the button is 1cm x 1cm, while the cut for the LED is 0.4cm x 0.4cm. I also used the glue gun to stick it on the cardboard.

2. Structure of the USB cable: to be specific, the cut for the hole is 1.3cm x 0.6cm. I did not use a glue gun for this.

3. Structure of the Stepper motor: I used the glue gun as a structure to hold the stepper motor steadily. I did not cut a hole for it because I can leave the box closed with the wires.

4. Structure of the arrow on the stepper motor: I cut a piece of cardboard into arrow-shape and colored it reddish to gain attention. I also used a glue gun to stick the arrow piece on the stepper motor. If you wanted to find a piece that fits on the stepper motor, the diameter that connects to the center of the stepper motor must be larger than 0.6cm.

Step 4: Decoration

Simply put your Arduino Board into a cardboard box and decorate it!

(Size: 18.5 cm * 13.5 cm * 8 cm)

For me, I used different colors of paper to create Poker-cards-themed decoration, as shown in the pictures:

Step 5: The Code

Here's the code, please read the remarks (additional details/註解) for more information:

<p>void click(); //this is for declaration of a sub-program</p><p>void __StepMotor(int MotorStep,int MotorSpeed,int pinNumberA, int pinNumberB,int pinNumberC,int pinNumberD)
{ // this part of the code defines the step motor
  pinMode(pinNumberA, OUTPUT);
  pinMode(pinNumberB, OUTPUT);
  pinMode(pinNumberC, OUTPUT);
  pinMode(pinNumberD, OUTPUT);
  for(int i=0;i</p><p>void setup()
{ //here lists the components that will be used: 1 push button and one LED
  pinMode( 5 , OUTPUT);
  pinMode( 7 , INPUT);
}</p><p>void loop()
{ 
  digitalWrite( 5 , HIGH );//light up the LED before the code starts
  
  if (digitalRead( 7 )) //if the push button was pressed
  {
    __StepMotor(128.0, 5.0, 10, 11, 12, 13); //then the stepper motor will move 90 degrees, if you wanted to change the number of players, simply divide 512 by the number of players
    click(); //run the "click" sub-program below
  }
}</p><p>void click()
{
  digitalWrite( 5 , HIGH ); //turn on the led
  tone(8, 1000.0, 1000.0); //short tone
  delay( 1000.0 );
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 1000.0 );
  digitalWrite( 5 , HIGH );
  tone(8, 1000.0, 1000.0);
  delay( 1000.0 );
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 1000.0 );
  digitalWrite( 5 , HIGH );
  tone(8, 1000.0, 1000.0);
  delay( 1000.0 );
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 500.0 ); //the speed of LED and tone increases
  digitalWrite( 5 , HIGH );
  tone(8, 1000.0, 500.0);
  delay( 500.0 );
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 500.0 );
  digitalWrite( 5 , HIGH );
  tone(8, 1000.0, 500.0);
  delay( 500.0 );
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 500.0 );
  digitalWrite( 5 , HIGH );
  tone(8, 2000.0, 250.0);
  delay( 250.0 ); //the speed of flash of LED and tone increases once again, and the frequecy of the tone increases to raise attention
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 250.0 );
  digitalWrite( 5 , HIGH );
  tone(8, 2000.0, 250.0);
  delay( 250.0 );
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 250.0 );
  digitalWrite( 5 , HIGH );
  tone(8, 2000.0, 250.0);
  delay( 250.0 );
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 250.0 );
  digitalWrite( 5 , HIGH );
  tone(8, 2000.0, 250.0);
  delay( 250.0 );
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 250.0 );
  digitalWrite( 5 , HIGH );
  tone(8, 2000.0, 250.0);
  delay( 250.0 );
  noTone(8);
  digitalWrite( 5 , LOW );
  delay( 250.0 );
}</p>

You can also Click Here! for the website version with some colored differentiation between the functions of the code.

Step 6: Brief Description of the Function

Here are a few videos filming a close-up of the function of the stepper motor. In the code, I entered 128 steps for the motor to move each time; since 512 meant 360 degrees, 128 meant 90 degrees.

Step 7: Completed!

After you finished uploading the code, completed the circuit arrangements, and decorated it beautifully, it is time for you to use it in your "Big Two" poker games! Have fun!

Below is a in-game demonstration of this project:

Below is a Function Demonstration of this project:

Below is a Time-Lapse Function Demonstration of this project [no sound]: