Atmel Microcontroller Plays the Tic-Tac-Toe Game
by jumbleview in Living > Toys & Games
6011 Views, 9 Favorites, 0 Comments
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
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 .
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 .
Circut Diagram
Here is the circuit diagram of this toy.
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.
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.
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.
Controller Configuration
Default controller setting is OK for the project. You can check this setting through the Atmel Studio 6.1 menu.
Programming
Atmel Studio 6.1 is an excellent programming IDE.
Writing the Code Into the Controller Flash Memory
After development and debugging compiled code was written into the controller flash memory.
Source Code at Bitbucket
Source code for the toy can be fetched from here https://bitbucket.org/jumbleview/three-in-a-row/src/
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.