Doc, Tic-Tac-Toe robot
Here is my entry to OddBot's contest, "Naughts and crosses".
His name is Doc, not stunningly original, I must admit, but... here it is.
The ideea behind it's design was to make a board like game of Tic-Tac-Toe which use a reusable table and pieces instead of drawn shapes. For this, I needed a robot capable to scan the game board in order to determine where the game pieces are placed and put it's own pieces on the board.
The main parts are as follows:
- In place of his brain, is an Arduino Uno plus an homemade shield for connection with sensors and servos.
- Right arm have 3 LDR sensors used for detecting the placement of pieces on the game board.
- Left arm have an gripper used for picking up the balls used for play.
- Movement along the board is provided by an continuos rotation servo and a pair of car chassis wich run on hobby train tracks.
- On the front of robot is a ultrasonic sensor used to detect when player makes a move.
- On top of it's head are a green and red LEDs used to indicate when the robot is busy (red LED) or when the player can make his move.
- Power is provided by a 2 cells LiPo pack put inside plus a 2A UBEC. I had the ideea to supply the power through tracks, but I decided this will be a future upgrade.
Theory of operation is as follows:
- After power up, the top green light is turned on and Doc wait for it's ultrasonic sensor to pick a player movement on the board.
If a movement is sensed, red light is turned on and scaning of the game board begins. For rows detection I used white markers placed between the tracks read by two sensors placed on each side of the body. Those markers are also used by the placing routine.
After the scan is complete, agorithm decides if the player have a winning combination of pieces. If not, a "O" ball is picked and is put on a free place on the table. If player wins, Doc raise it's right arm and flashes the red light.
I did not want to make the playing algorithm too smart (yet) because my 5 y.o. daughter wants to play with the robot and she got frustrated if she lose every time :)
After the "O" ball is placed, board is evaluated again to see if Doc has a winning combination. If not, it turn on the green light and the cycle continues. If Doc wins, it flashes the green light and rise it's left arm.
After the player or robot wins, the green and red lights flash alternatively for 20 seconds, in this time board can be manually cleared and a new game can be started.