{"id":22579838,"url":"https://github.com/mfossociety/8-8","last_synced_at":"2025-04-10T18:23:48.003Z","repository":{"id":94716573,"uuid":"183856361","full_name":"MFOSSociety/8-8","owner":"MFOSSociety","description":"8/8: Smart Chess Board: An Automated AI Chess Board.","archived":false,"fork":false,"pushed_at":"2021-07-26T12:32:58.000Z","size":2056,"stargazers_count":12,"open_issues_count":2,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-24T16:04:47.543Z","etag":null,"topics":["chess","chessboard","gpio","hardware","internet-of-things","mqtt","raspberry-pi","robotics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MFOSSociety.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-28T04:41:05.000Z","updated_at":"2024-05-14T18:45:24.000Z","dependencies_parsed_at":"2023-06-30T05:30:44.073Z","dependency_job_id":null,"html_url":"https://github.com/MFOSSociety/8-8","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MFOSSociety%2F8-8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MFOSSociety%2F8-8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MFOSSociety%2F8-8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MFOSSociety%2F8-8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MFOSSociety","download_url":"https://codeload.github.com/MFOSSociety/8-8/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248270615,"owners_count":21075795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chess","chessboard","gpio","hardware","internet-of-things","mqtt","raspberry-pi","robotics"],"created_at":"2024-12-08T05:12:57.005Z","updated_at":"2025-04-10T18:23:47.998Z","avatar_url":"https://github.com/MFOSSociety.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 8/8: Smart Chess Board\n\nAs my minor project for my Computer Engineering course I and my teammate, Piyush decided to build an Automated AI chess board with [Raspberry Pi](https://www.raspberrypi.org/).\n\n\n### Motivation\n\nThe **8/8** aims to move the pieces in resemblance to the movie Harry Potter. We wanted to build an affordable but fully functional project. While not having fancy way of killing pieces, but still, a cool project nevertheless.\n\n\n## Installation\n\n```bash\nchmod +x build/tools/install.sh\nbash build/tools/install.sh\npython3 cli/main.py\n# optionally\npython3 cli/manual.py # moves the motor manually, giving it inital and final coordinates\npython3 drivers/ElectroMagnet.py # let's you control the electromagnet\n```\n\n\n## Hardware Design Notes\n\n### Core XY Motion\n\nThe 8x8 matrix of the board can house any of the 32 pieces. We needed a mechanism which will let the piece move at any given point on the board. After a lot of thought we decided that the movement, we wish to make is very similar to the motion a 3D printer makes while printing so we decided to dive in deeper into 3D printer axes (plotters) internal workings. After reading a ton, we decided that we will use two lead screw mechanism to make movements in the XY direction one on top of the lead screws that would be the intersection point of the lead screws will be the electromagnet which will make the pieces move.\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"hardware/images/chessboard-xy-frame-schematic.jpg\"/\u003e\n\t\u003cbr\u003e\n\t\u003ci\u003eChessboard XY Frame Schematics\u003c/i\u003e\n\u003c/p\u003e\n\n**Ø M** = Stepper Motor\n\n**Ø TR** = Threaded Rod\n\n**Ø S** = Slide\n\n**Ø R** = Rod\n\n**Ø C** = Catch Accessory\n\n**Ø B** = Ball Bearing\n\n**Ø EM** = Electromagnet\n\n### Electromagnetic Clamp Head\n\nWe decided to move the chess pieces with the electromagnetic head. Each chess piece will have magnetic bottoms and the electromagnet at the top of the lead screw is controlled with the Raspberry Pi and using the force of magnetic attraction we move the board pieces.\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"hardware/images/ELE-Mount.jpg\"/\u003e\n\t\u003cbr\u003e\n\t\u003ci\u003eElectromagnet Mounting on XY Table\u003c/i\u003e\n\u003c/p\u003e\n\n### Stepper Motors\n\nWe used two Nema-17 Motors. We tried a lot of motor drivers but, none of the motor driver were reliable, we either burnt the driver or didn't recieve a good one. So we decided to use L298n instead. Using the H-bridge we wrote a simple code to rotate the motor and after a few tests we concluded that five complete rotations of the motor were equal to the movement of one square of the board.\n\nX Axis Motor               |  Y Axis Motor\n:-------------------------:|:-------------------------:\n![](hardware/images/XAxis-Motor.jpg)  |  ![](hardware/images/YAxis-Motor.jpg)\n\n## Parts List\n\nThe [Master Parts List](parts_list/master_parts_list_raw.csv) contains all the parts necessary to build the entirety of the project as it is listed in our documentation.\n\n### Moving Pieces\n\nOur agent predicts the move and returns the move in a 2-d coordinante system. If our agent predicts a move from (0,0) to (5,6), the motor first rotates 5 x `scale_x` times in the X direction and a total of 6 x `scale_y` steps in the Y direction, where `scale_x` and `scale_y` being the number of rotations required to traverse half the square.\n\n### Avoiding Collision\n\nTo prevent the pieces from collision and preventing us to rewrite the whole codebase, we came up with a solution wherein we move the pieces through the borders postulating the pieces will not collide into other pieces if they will move by the border.\n\n\n## The Chess Engine\n\nThe Chess Engine for the game was fairly simple. Each of the pieces of the game was assigned a score.\n\n| Piece  | Score |\n|--------|-------|\n| King   | 100   |\n| Queen  | 9     |\n| Rook   | 5     |\n| Bishop | 3     |\n| Knight | 3     |\n| Pawn   | 1     |\n\nThe goal of our algorithm is to try to minimize the total score of the opponent and try to maximize its own score. Keeping the next two moves in mind (more than two moves will perform better, but the algorithm will be really slow) we generate a move tree. After the applying min-max algorithm on the move tree an array of best possible moves is generated and the best prediction is predicted out of all the possibilities.\n\n\n## Maintainers\n\n| [\u003cimg src=\"https://avatars0.githubusercontent.com/u/25363324\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eVidhyanshu Jain\u003c/b\u003e\u003c/sub\u003e](https://github.com/vidu171)\u003cbr /\u003e| [\u003cimg src=\"https://avatars3.githubusercontent.com/u/5800726\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePiyush Raj\u003c/b\u003e\u003c/sub\u003e](https://github.com/0x48piraj)\u003cbr /\u003e|\n| :---: | :---: |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfossociety%2F8-8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmfossociety%2F8-8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfossociety%2F8-8/lists"}