Introduction: Atmel Microcontroller Plays the Tic-Tac-Toe Game

This is Tic-Tac-Toe game implemented with bare bone ATmega168 micro controller. It works at lowest possible for this controller frequency 1 MHz . That allowed to power it directly from two AAA rechargeable batteries.  You may find some additional details in this blog post: http://www.jumbleview.info/2013/07/atmel-microcontroller-plays-tic-tac-toe.html

Step 1: Components

All electronics is mounted on a RadioShack component PC Board 276-168.

Here is the list of other components:

 Central processor ATmega 168 
 Nine Bi-polar bi-color 5mm Green/Red LEDs. 
 RadioShack 2 AAA battery holder  270-398
 Nine resistors 51 Ohm 0.25 W (0.125 W is OK as well)
 Panasonic  EVQ-WTEF2515B Encoder 
 Ceramic capacitor 0.47 uF.
 RadioShack slide switch 275-409
 Male headers 2.54 mm to make six contacts ISP header. 
 RadioShack 2-pack 14-PIN IC socket (optional, just to have the possibility to reuse controller  on other projects).
 Hook-up 26 gauge wire  and 30 gauge wire  .

Step 2: Circut Diagram

Here is the circuit diagram of this toy. 

Step 3: Mounting Components on the PC Board

I had to treat edges of the board with file to make it fit into the enclosure (a box from the Johnson&Johnson emergency kit.). All components were mounted on the PC Board and soldered to it. As you can see the density of project components on the boards is not high.  Soldering elements  to the board and connecting it with 26 gauge wire was not that hard. To find out how LED was oriented on the board follow the simple rule: top of any LED on my diagram corresponds to the longer LED leg.  Contacts of the encoder are very fragile  so I used 30 Gauge wire here.

Step 4: Mounting the ISP Header

The PC board layout does not provide the proper place to solder an ISP header. So I had to separate  three contact plates with utility knife and had to solder wire directly to contact plates occupied by headers.

Step 5: Accessing the Device With Programming IDE

Of course, the main part here is the program. To program I have used Atmel Sudio 6.1 and Atmel AVRISP MKII programming interface device.

Step 6: Controller Configuration

Default controller setting is OK for the project. You can check this setting  through the Atmel Studio 6.1 menu.

Step 7: Programming

Atmel Studio 6.1 is an excellent programming IDE.

Step 8: Writing the Code Into the Controller Flash Memory

After development and debugging compiled code was written into the controller flash memory.

Step 9: Source Code at Bitbucket

Source code for the toy can be fetched from here  https://bitbucket.org/jumbleview/three-in-a-row/src/

Step 10: Put It Into the Box

The last steps are to prepare the enclosure  (make proper holes for LEDs, encoder and power switch),  put the assembled box into the enclosure, add two AAA rechargeable batteries and play the game.  
 

Comments

About This Instructable

3,797views

8favorites

License:

Bio: I got my education and initial job experience in Ukraine, but in 1998 moved to California. I work as software engineer in one of Bay ... More »
More by jumbleview:Tea Cans As Paint Brush HoldersRedwood Stakes As Bender BoardsHow I Made Money While I Worked on My Front Yard
Add instructable to: