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.

 

17 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?

  7. Dear Cristoph Bartneck,

    me and my friend from Germany want to build your Tic Tac Toe robot with EV3. We are completely amazed of your robot and also of your other robots you‘ve built, for example the Spirograph Automaton.

    When we had the idea of making a EV3 robot which can play Tic Tac Toe, we immediately browsed the internet for an instruction for our dream of an EV3 robot. Unfortunately, there are not many instructions for this robot and yours is on of the best versions of the Tic Tac Toe robot.

    The only problem we have now is that your instruction is just available for Lego Digital Designer, which is not available right now because Lego decided to take the platform offline.

    To conclude, we now can’t open your instruction which means we can’t build our dream robot. In this case, we could search a different instruction, but we were so astonished by your incredible work that we really want to have your instruction.

    So it would be amazing if you could send us your instruction as an pdf or other document which we can open on an iPad or an Microsoft Computer.

    We really hope that you are able to do this and would be really thankful.

    Yours faithfully

    Susanne

  8. Dear Cristoph Bartneck,

    me and my friend from Germany wanted to build your Tic Tac Toe robot. When we had the idea of building a EV3 robot we had the idea of building an EV3 robot which can play Tic Tac Toe. We then immediately browsed the internet for an instruction and as we saw your version, we were astonished by your EV3 robot.

    We wanted to download your instruction on Lego Digital Designer but unfortunately we can’t open it because Lego decided to take Lego Digital Designer offline.

    Due to this, we can’t build our dream robot, but we really want to. So it would be amazing if you could send us your instruction as an pdf or other format which we can open on an iPad or Microsoft computer.

    It would be so amazing if you do this for us and we would be rally thankful.

    Yours sincerely

    Janna

Leave a Reply

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