This is an implementation of a tic tac toe game using a 3x3 array of bicoloured LEDs for a display, a simple resistive touchpad, and an Arduino to tie everything together.
To see how it works, check out the video:
What this project requires:
Parts and consumables
One perf board (or strip board)
Nine bicoloured LEDs, common cathode
Nine identical resistors, in the 100-220 ohm range
Six identical resistors, in the 10kohm - 500kohm range
One single pole, double throw switch
A bunch of header pins
A bunch of electrical wire
One small square sheet of transparent acrylic, ~ 1 mm thick, 8 cm on the side
Clear sticky tape
Heatshrinks (optional)
All of the above are quite common items, total cost should not exceed USD$20.
Tools
One Arduino setup (Arduino Duemilanove, Arduino IDE, computer, USB cable)
Usual electrical tools (multimeter, solder solder gun, wire snips, wire cutter)
Everything Arduino related can be found at http://www.arduino.cc.
On with the build!
Remove these ads by
Signing UpStep 1: Wiring up the LED matrix
To do this, the LEDs are wired up in a crossbar fashion, as shown in the first figure. The LEDs are grouped in columns of threes, and their cathodes are grouped in rows of sixes.
By setting a particular anode line high, and a particular cathode line low, and having a high impedance on all the other anode and cathode lines, we can select which LED we want lit up, as there is only one possible path the current can take.
For instance, in the second figure, setting the green anode 1 line high, and the cathode 1 line low, the bottom left green LED lights up. The current path in this case is shown in blue.
But what if you want to light up more than one LED on different lines? We'll use persistence of vision to achieve this. By selecting pairs of LED lines very very quickly, it gives the illusion that all the selected LEDs are lit at the same time.











































Visit Our Store »
Go Pro Today »




Please see the following video we made as documentation of the problem:
http://www.youtube.com/watch?v=HlCw08GTqDo&feature=plcp
PLEASE HELP!
btw, great project idea - I'm enjoying building it!
Let's say you have one row line and one column line, with the dipole LED across them. Then, if the row line is set to HIGH and the column line is set to LOW, it will turn on one LED colour. To get the other colour, the row line is set to LOW while the column line is set to HIGH.
Thanks for everything.
I used PWM here because I wanted the LEDs to fade out. You can use the normal pins as well, but the LEDs will just have two brightness levels - on, or off.
-- Wolf
!
Example: ChaN's Simple Touch Sensor
any solution to download them proper?
they all got a .tmp extension
A few comments however.
1. I see that the random number sequence is always the same. You need to add a random seed.
2. The computer is very easy to beat since it does not take a winning move or try to block the user's winning moves. These changes make the computer more difficult to beat but not impossible, so playing is still fun.
I updated the code to correct these two items and to make it work without your special hardware (i.e. you can play with a standard Arduino and a serial monitor or with your led touchpad).
This could be the start of the old 'tic-tac-toe playing chicken' seen in some county fairs where the person plays against the chicken. When it is the chickens 'turn' the door to the chicken food is opened and the chicken appears to be thinking then pecks a selection. This works so long as the person can't see what the chicken is packing at and assumes it is a similar display/keyboard they are presented with. Very funny seeing kids getting beat by a chicken!
If there is community interest we could always make the 'impossible to beat the computer' version but where is the fun in playing that? :-)
Best Wishes
Yes, the code in my instructable is very minimal, and there's so much that can still be done. For instance, instead of having it rigidly rule based, it would be possible to code up a learning algorithm. So initially, the computer plays randomly, but each win or loss will strengthen (or weaken) particular moves.
Such algorithms exist already, but it would be fun to see it on an Arduino. :)
Thanks
Here, I'm using an LED with 3 terminals - one red anode, one green anode, and a common cathode.
Had a few questions popping in my head..! Since Arduino is popular BECAUSE it's an open-source platform, can we say the same about all the instructables out here using the arduino board? Who owns the IP..the guys at instructables.com or the individual author? What if I were to publish an article in a mag about this touchpad tic-tac-toe..whose permission do I take..if at all I need one?
Thanks. Hope to hear from you!
The Instructables ToS states that the author owns and is responsible for their instructable. So one would need to get permission from the author to publish their work in a mag.
when I ran this in circuir wizard it was the only way I could get it to work
what is your suggestions
keven
here is the link
can you tell me why I can't attached it in instructable ?
thank you for your persistance
Anyway, I can't quite understand your circuit...for instance, why's there -12V going into pins 2, 4 and 8?
i have tried to attached the image to this email and for some reason it will not
I haved uploaded it to ImageShack
file name is circuitdia.jpg
please see if you can see it
the circuit is a simplfied version of the actual one
each led in the circuit represents 24 led with resistors and a 12v+ power supply
I hope this helps
keven