Introduction: Lucky Mini Slot Machine

About: Kittenbot designs and develops amazing hardware, software, and tutorials for STEAM education.

Are you going to throw a party lately? or going to a carnival? or just want to have fun with your kids? See if this mini slot machine can make your event much more fun! 


This machine would choose a number itself and show the number on the screen. When people press the joystick, the number in the middle of the machine changes. When it changes to the number that is shown, a prize would come out.


If you like our projects and tutorials, you can follow us on TwitterFacebook, and Youtube for more interesting STEM projects and ideas.

Supplies

Hardware

paperboard * 1

several LEGO bricks

3D printed reel * 1

Geekservo 2KG servo *2

Robotbit base *1

Robotbit Edu *1

18650 Lithium Battery *1

Future board *1

Sugar Joystick *1


Software

Kittenblock


Tool

Utility knife

scissors

ruler

pencil

double-side tape

3M tape

markers

3D printer

Step 1: Idea

The slot machine is basically a cuboid, so we will use a piece of paperboard to cover the LEGO working parts and draw something on it to make it look like a real slot machine. The turning of the reel and the presentation of the prize require a servo.

Step 2: The 3D Printed Reel

When finished printing, get rid of the extra parts, and write down the numbers with markers.

Step 3: Assemble the Inner Part of the Machine

Assemble everything following the assembly instructions.

Step 4: Design the Cover

Draw on the paperboard and cut out the parts we need.

Step 5: Cover the Lego Framework With the Paperboard Cover

Use LEGO technic rubber stoppers to fix the cover to the LEGO parts.

Step 6: Draw on the Cover!

Draw everything you like on the slot machine. We drew some patterns to make it looks more like a real slot machine.

Step 7: Write the Program

We need to write the program to show a random number on the screen and make the reel turn to a random number and analyze whether the random number on the screen is the same as the one on the reel.


Download the program

Step 8: Write the Program: First Step - Set Variables

Set the x variable as the goal number (the number shown on the screen, and the reel needs to turn to this number to win); set the y variable as the reel number.

Step 9: Write the Program: Second Step - to Analyze

To analyze whether x equals y. If so, then win the prize (the prize tray then extends); if not, then the game continues and nobody wins.

Step 10: Write the Program: Third Step - Joystick Module

The triggering of the joystick changes the y variable. As y changes, the angle of the servo that controls the reel changes too. (the servo angles need to be adjusted before we write the program.)

Step 11: Write the Program: Fourth Step - Indication

Add a boot animation to the beginning of the program.

Add the display of the goal number to the middle of the program. When the joystick is triggered once, the indication sound and image of not winning will be added to the program part that runs when not winning; same as the winning parts.

Step 12: Now You Finish the Slot Machine!

Give it a go and have fun with your family and friends!