People keep asking me,"Hey,what do you do all the time in your workbench?", or "Hey,show us something you have made." And for most of the time I don't have anything at my hands to show them. So I decided to make something that I can keep,without using too many valuable parts (Like Servos,power Supplies)...so I decided to make a shield for the Arduino So that I can play Tic-tac-toe with it anytime I want. The Process is pretty Simple.
1. Plug the Shield into Arduino (Diecimila,Duemilanove,UNO.......all works....actually a board with Atmega328/168 processor is required.)
2.Upload the code to the board
3..............what? Go and Play....have fun
User Inputs are nomally lit LEDs and CPU inputs are blinking LEDs.
Here is the video-
The MCU waits sometime for the User Input, if it doesn't find one within the timeframe, then it gives it's turn. And after a win or Draw, any button can be pressed to reset the board. When draw, the LEDs show a "X".
I shall try to describe the steps one by one.....First I made a Breadboard Circuit to test the Code, then I converted it into a shield...
Step 1: Breadboarding
First I uploaded the code to the Atmega328 via the Arduino board, and then I took the IC off the board........(code is attached here.)
I Plugged the Atmega328/168 into the breadboard and attached the required crystals, then connected the power lines to it...see the pics...
Step 2: Attaching the LEDs and the Switches..
Now, it was possible to make two separate colours for the "X" and "O" of the game,but,for that I would need bidirectional LEDs, or some multiplexing solution...But it would take too much time. So I decided to use some other easy method. Here's what I decided-
If I give a turn then the corresponding LED will lit up, and if CPU gives a turn then the corresponding LED will blink fast. So,the fast blinking LEDs are CPU's turn ,and the normally lit LEDs are player's turn.
Here's how I attached the LEDs and Switches......
and finally powered the board with a 9V battery regulated via one 7805 Voltage regulator IC (accompanied with two 0.1uF Caps)
In the Circuit Diagram I am connecting the board to an Arduino,cause 123D circuits doesn't support adding Microcontroller IC to the breadboard. I think they should add that soon. What I like most of the webpage is "Simulation". It is really fun to see those LEDs blink,switches being pressed,without even touching soldering iron. And yes, you can also even CODE in there..That website is really awsum.
in the diagram I have connected the breadboard to the Arduino just to show which pin goes where. And instead of using the power supply from Arduino 5V, I used 7805 5V regulator IC on the breadboard itself....some pics follow......
And that's it. That's how I made a shield to play Tic-Tac -Toe with my Arduino....
Well,I have set the AI so that both CPU and Player has the chance to win. My previous attempt was a bit tougher,where either CPU wins or the match is draw. Using the previous code,I made a robot called "Strike'm". it's Documented here.