TicTacToe Playing LEGO Mindstorms Robot Using Computer Vision

You can play TicTacToe with this LEGO Mindstorms EV3 robot. It uses three motors to drop the balls into the right field. It uses a NXTCam to view the board and then calculates the best move using a MiniMax Algorithm. All future moves are explored an rated according to their winning chances. The work is based on the TicTacToe code of Thomas Kaffka. An IR sensor detects your hand when you drop your ball. The robot is using red balls and the human player uses blue balls. The Java code is available over at Github. The building instructions are available for LEGO Digital Designer. I used the MinuteBot baseplate, which is useful for building static Technic/Mindstorms models.

 

LDD does not have all the required pars in its database. You will have to replace 22961 with 27940. You will also need to add a worm wheel 27938. In addition you should use a lamp to provide consistent lighting. I used a USB powered LED circular lamp the can be powered through the USB port of the EV3. I only had to take out the lens in the middle so that the camera fits through the hole. A rubber band holds the light in place. To calibrate the robot I added a little arm at the end of the base plate against which the robot arm rotates. The position of the camera can be centered on the board using the wrench and through sliding along the axles.

You can also find information about the robot over at Rebrickable. The inventory there is correct and complete. Except for the base plate of course.

 

14 thoughts on “TicTacToe Playing LEGO Mindstorms Robot Using Computer Vision”

  1. Hi there,

    is it possible that you can come out with a parts list? It would be greatly appreciated.

    Thanks,
    Dev

  2. Hi Dev,
    You can download the LDD file from the link in the text. This will give you a parts list. You can also follow the link to Rebrickable, which lists all the parts.
    Christoph

  3. Hi Christoph,

    I am collecting the parts to do this project. I found most of the things. I just wanted to ask whether it is ok to use the Pixy LEGO Camera rather than the NXT Camera you have used.

    Thanks!

  4. I have no experience wit the Pixy camera. The camera hardware is probably the lesser issue. Make sure that the software works. The NXT Camera software did all the recognition and simply communicated back the coordinates of the balls. This was very convenient.

  5. Hey! This is a great project! Thank you for sharing it.
    I have one question: which program did you use to transfer the code onto the EV3? Did you use Eclipse?

  6. Which program did you use to transfer the code to the robot? Was it Eclipse?

Leave a Reply

Your email address will not be published. Required fields are marked *