Introduction: Arduino Game "NIM"
I got my inspiration form the game Dr.Nim which is plastic toy with mechanism, but it works same as Nim.
Nim is a game with 12 balls, If is your turn you can pick 1,2 or 3 balls and then your opponent plays. The winner is the one who takes the last one.
If you want to learn more about Dr.Nim you can check it out HERE, and if you are interasted in Nim you can read abaut it HERE.(*Nim and Dr.Nim is not same thing)
I made my version with arduino nano,and with lots of plywood, there are two controlers(they are same) and they have 2 buttons and switch, you can turn lights on controler with switch. When you press "play" button motor will push ball and it will come down.
Next button is used when you want to end your turn, but you cant end it if you didn't took at least 1 ball(you can take 3 max).Indicator shows you how many balls left for you to take and winner indicators shows winner.
It is not realy easy to make so if you are just starting with arduino you should get some expiriance before this, but you can download code if you want to try it.
It is cheap and fun project, it took me araund one week to finish this project.
Step 1: Making Base
I made a sketch of it, but I calculated bad, so I fixed it 2 times. It is designed so it will work on angle araund 50°.
When make base, cut pieces of wood and make wall araund holes, you need to make them so balls won't stuck or fall trough gap between base and lower base.
So if you are making something you should be sure that mesures are right or you will end up in problems like me. :P
Step 2: Making Lower Base
This is part that goes under base and here goes motor and little block that pushes balls (block is connected to servo). Just use plywood of same dimensions as base and cut line for motor to move block, make shure that you cut right size line or you might have problems.
Step 3: Ball Indicator for Base
Drill holes where to glue balls and LEDs goes behind them.
I added those pieces of wood to isolate light from jumping to wrong ball.
You can wire them like any regular LED but I used transistors, there is scheme how I wired them, same way I did in this project.
I used transistors to power LEDs with another power source, not arduino, you should do this because arduino wont have enough current for all things(If you are using a lot of components you need to power for example).
Step 4: Add Motor to Lower Base
I took some gears that could fit and I used it to move block that pushes balls. Plate with gears needs to be connected with block and attach gear to servo so it moves it.
Wire servo like any other (I added scheme, just in case you need it).
But you should power it with another power source, it will work better that way(just connect GND of arduino to GND of power source and positive of power source to servo).
I used pin 5 for servo.
Step 5: Controllers
Just make the little boxes that are right size and drill holes for buttons.
I added red LEDs to sides of controllers just to make them more cool (They are wired like this 5V-Switch-LED-GND).
Later I added LED for "turn" on each controlers
Step 6: Wirring
This is how I wired all buttons I used in this project(In controllers and in bottom part) .
Just be careful for controllers, you should wire 10k resistors behind USB connectors(I wired them inside controllers and I realized that won't work).
Step 7: Bottom
I cutted plywood and glued all components(That green LEDs are for indicating player"turn").
All the wiring in this project is simple, so if you have some experience there should be no problems.
Step 8: Connect Base and Lower Base
I made few squares, glued them in place(Lower base) and drilled holes in them for screws.
Be sure to cut hole for indicator wires.
Step 9: Making Conectorc for Bottom and Base
I mate these to connect all removable parts with screws, If you have any better option then do that.
Step 10: Assemble Bottom
Just glue all parts(except back plate) and wire all switches like others.
Transistors you see next to the USB jack are used as switches for LEDs.
Wire all switches like others.
DC connector is for back plate, I used female and male headers next to DC connector so the back plate would be removable.
Step 11: Make Connector for Arduino
I used female and male headers to connect everything.
Transistor that you can see on pictures is used for winner indicator, LEDs on indicator are wired to turn LEDs, but they will only be ON if transistor is ON (In other words, it is just like switch that switches GND on and off).
Step 12: Assemble Evrything
Connect evrything with connectors and screws. Drill holes in connectors that you made and screw things together.
Step 13: Winner Indicator
Wire LEDs with transistors like you wired it for ball indicator. You will need 2 of them.
I used 220omh resistors for LEDs and transistors, maybe they are not perfect for them, but they work.
Drill the holes in the place you want top put it and drill the hole in lower base for wire.
Step 14: Add Reset Button and Wire Other Buttons
It goes like this GND-Button-RST pin (It is that simple). I added this button so I don't need to turn it on and off every time I want to play again. And you don't need to add anything in code for this to work.
Step 15: Code
It is dumb device, it means it have no senzors and no way to know how many balls are left, It counts that by how many times you pressed play button.When it caunts 0 the winner is picked(The guy who played last).
I made this code, and you are free to download it, change it or do whatever you want with it.
It may not be the best, but I tried my best.
If you see some mistakes in code or something you would change, please notify me.
Step 16: Finishing Touches
I added little pieces of wood around the middle of base and lower base (Just for the looks).
I used soldering iron to write down all things, but some of them turned out bad so I made few little wooden squares and glued them in place.
Step 17: Done
If you want to see video of it working, you can find it HERE.It is not on english but you can see that game works.
I did not made that video, so I didn't wanted to include it in this instructables (My professor made it).
I wanted to make video of it but I don't have good enough camera for It, so if I ever make video, I will add it here.
If you want to see more projects follow me. Thanks :-D
Participated in the
Microcontroller Contest 2017
2 years ago
Wow!! Amazing post. Thanks buddy for sharing it.
Question 3 years ago on Introduction
Bro did you used two Arduino kit for two remotes please reply fast
3 years ago on Step 6
bro what is digital 2, 12,13 please reply
3 years ago
bro what is the name of the machine
3 years ago
Bro that code is not opening
6 years ago