Introduction: Voice-chess, a Chess Board With Voice Commands
Hi! First of all, I wanna thank you just because you are my instructable. This is my first one and I want to share my knowledge and Ideas to the biggest number of people. I want to say also that English is not my mother tongue. Sorry for any mistake or bad grammar :D. So....let´s move on! The Idea I am a chess player with many years of practice. When people ask me "What sport you like to do more?" I always say "chess, of course". Since many years the high-level chess competitions are considered a sport and I love it. You have so much techniques you can use...And this takes me to the problem this instructable tries to solve: the people with incapability, like the ones who lose the hands/arms (it is a big problem) can´t play chess! Well... they can play if the other player moves for them the pieces...But if the 2 players have got some kind of problem? And if the player is playing with himself? Or, if you don´t want to make this instructable not for somebody but just to have a cool and different chess board? (By the way, if you are a lazy person this project is exactly for you!) Because of all of this, I found an interesting solution for this problem. Why we don´t use a voice commanded chess board? It would be stupendous!
Step 1: Just One More Word
Since I like to preserve our planet, a big part of this project was made with reused materials. Some of them were going to the rubbish. Therefore, the appearance of this project is not so perfect and the design was compromised.
Step 2: Stuff You Will Need
*Some stuff here is very abstract. Try to use pieces like this ones. These were the ones I´ve used in my project. Dimensions described later.
+Aluminum foil with 0.5mm
+Chess pieces with a circular base
+32 metal (it must be magnetic, ex: iron) washers
+Copper wire (if you haven´t at your home just dissemble a transformer)
+2 Stepper motors (3 is better)
+Batteries or a voltage step down regulator with an external power source for the motors (i don´t recommend to use batteries, although I used. The power consumption is high and after a short while I ran out of battery.)
+Alkaline batteries (9V or more)
+Arduino Mega (uno is ok too, but I used this one)
+Power supply for the arduino (12V in my case)
+Bluetooth module for arduino (just reception)
+Breadboard (Not exactly necessary)
+2 L298N Driver modules
+Fan (I used 12V to connect with the batteries)
+1 Big Screw
+Hollow metal tubes (I used some from an old antenna)
+Cables to wire connections on arduino
+Cables to wire the rest of components
+2 Belts for your motors (in case of using 3 motors pick up one more) +Super glue +2 Switch buttons
+4 Plastic Pieces to make the supports (You will understand later)
+Hollow Tubes (I dismounted an old antenna)
+Microphone to your phone (an external one)
Step 3: Skills and Tools
You should be able to:
+Make wholes in wood
+Cut and bend aluminum plate
+Program in C++ (The basics of arduino)
+Understand the basics of motors and electromagnetic fields
+Cut metal tubes
+Use hot glue (Well....That is easy)
+Fret saw or handsaw (I used both)
+Compass for metal
+Scissors for aluminum/metal
*I think it's all here, but I may have forgotten one or two tools
Step 4: The Concept
Now, lets start with the theory. I will describe how the system works: first, we are going to install an android app called "Arduino Voice Control" (I don´t know if it exists on the app store). Basically, with this app, we are going to be able to spell to the smartphone and "translate" our voice to text and send it by Bluetooth to the arduino. It uses the Google voice, so you need a wifi/mobile data connection to use it. Thanks, Google. This process, if you want to understand it better is very simple. Pressing the button, you are activating the micro (for people that cannot do this, we will add a small rubber and put the smartphone on the ground so we may click with the foot). When you talk to your smartphone, it will convert your voice in an audio file that is sent to the Google servers. With the help of clusters (massive computers interconnected), the frequencies of our radio and pre-recorded audio frequencies are checked to see which of them match. If the margin is small than a certain value, the server says that our audio is equal to the pre-recorded (not just one sound pre-recorded, but many are used), so it sends back a text file with the word/phrase we said. It is very simple, but this technology is not super precise and some errors may happen and we will get a different text file than we were expecting. To solute this problem, a led will be added to our project. It will blink when the code is right. Now, we got a string that should be sent to our arduino. We will use a Bluetooth module (I bough this one from ebay but I recommend you to buy 2 because they easily burn if incorrectly connected) and connect it to our smartphone. Our string will be sent by this module to our arduino, via serial communication on 2.4 Ghz band. We now have got, for instance, the string "A2 B6". "A2" is the starting house and the "B6" is the house where we want to move the piece to. The arduino now needs to know if there is any piece in the the end house. To solve this, we are going to create in the beginning an array with all the values of the occupied houses. We will use a number system. 1 = 1, 2 = 2 and so on, but the letters will be A = 10, B= 20, and so on. If the house C3 is occupied, the list will have the value 33 (C=30 + 3=3). With this system we know always what are the occupied houses. Since we want to go to the B6 house, whose value is 26 (B=20 + 6), our arduino will check if there is the number 26 in the list. If is there, so we need to remove the piece, using our motors and let it fall into a box. If there the number 26 is not in our list, so we can move one directly to move the piece. We should not forget to update our list. The starting house value should be deleted from the list and the end house should be added, so the program works well in the other movements. Supposing there isn´t any piece in the end house, we just need to convert our letters from A2 B6 to numbers. A=1, B=2.....So we should move one house to the right, and to two upwards. We will now use our stepper motors to move the right amount of houses. We add a delay() function too, so the program waits to finish the move to continue. After this step is completed, we should activate our electromagnetic magnet. An electromagnetic magnet works with a simple principle: when current pass through it, a strong magnetic field is created. Since on the base of our pieces we will add a iron base, they become magnetic-sensible, and we can use the magnet. Therefore, we will add a relay switch to control this part of the system. Now, we just need to move our piece to the right house,without knock the other pieces. To solute this problem, the pieces will be softly moved to the right and upwards so it just move in the lines of the boards, between the houses, without knocking the other pieces. On the end of the move, the motors move back and left again to take the piece to the center of the house. The relay is turned off, so no current flows in the wire and no magnetic field will be created. The motors will move the magnet to the house A1 again to wait for another command and the LED will be turned off so the players know the arduino is ready to receive another move.
Step 5: L298N Driver
L298N driver module can directly drive motors in a range of 3 to 30V, and provide a 5V output interface to your arduino (My mega do not accept 5V so I didn´t use it). It has maximum amperage of 2A, which is enough to our system. You should notice on your own driver that is written the input is 12V. This is the normal value but there is no problem in using the range of 3 to 30V. Be careful with your finger while using these modules. Since we have a huge amount of current plus voltage, 12 watts in my case, they heat up easily and can hurt you. They are controlled by 4 pins and in the case of stepper motors there is a library that is super easy to work with, making our job a lot simpler.
Step 6: The Stepper Motors
I used 2 MITSUMI (model M42SP-6P) stepper motors in this project. I disassembled them from an old printer that was not working well anymore to reuse them. They are very precise and strong so they are ideal for this project. And the biggest pro point is: They were free and we contribute to save the planet!
The stepper motors have 4/5/6 cables to connect them (different number of cables tell us the motors have a different way to work). My ones have 4. The problem is to find out what cable represents what. With the help of our friend Google, I found, after 5 minutes of research, the pin out description. If you can´t find anything online just pick your multimeter and test 2 of the wires. If the resistance is low you find 2 cables that which make one coil. If is infinite, change the connection of one cable to another and check. Here are the cables of your coil. Now, pick the 2 cables from one coil and connect them to one of the L298N driver output parts. One cable in the GND and the other in the VCC. Repeat for the other 2 cables and after to the other motor/motors. If you are using 3 motors (which is the best), 2 of them will be used to control the x axis. You can connect 2 motors to the same output connectors on the L298N driver without problem. If you could not understand where you should connect the wires just check the wiring diagram that I made.
My 2 stepper motors have a voltage range from 10 to 26V and the normal and tested value is 24V. They use around 0.5mA, so they consume, both, 24Watts on tested conditions. I used a 16V supply because I wanted to decrease the amperage a bit. While doing this project I discovered that this motors (ANY STEPPER) can easily go to 100ºC. You can actually use them to make some toasts when you are playing or boil some water to make tea. Now, without joking, please be careful and do not touch these motors after playing for a while. This can be strange but their normal working temperature is around 90ºC. You may use a fan to cool them or use a weaker power supply to reduce the amperage, like I did. Furthermore, I tested the motors with 24V and they were working in a way a bit "heavy" reducing the precision level. With less voltage they work slower, making your game more precise. Like I said before, we are going to use a l298n driver to control them, using what we call "H-Bridge". In resume, the driver has 2 bridges, one for each coil and the way we close the circuit, since we have 4 switches on each H-Bridge, changes the current flow direction, changing the way we are moving the motor. You can find a lot of cool and better documented information on the web. This is just the principle of an unexplored world.
Note: If your motors are moving in the wrong direction just shift the cables.
Step 7: Some Calculations
Before we can proceed we have to do some math. We cannot do this project without knowing the dimensions that we are going to deal. The first thing to do is measure the diameter of the base of our chess pieces. My ones are relatively small, with a diameter of 2cm. Since we want enough space in the middle of the pieces so other ones can pass in the middle of them while moving without knocking we have to add 1cm in the left and one in the right, making 4cm for 1 house. Since the other house has an 1cm margin too, this makes 2cm exactly to the piece that is moving pass through them. But we need to add another margin, since we don´t want the pieces to scrape and some errors (in the order of milliliters) may occur. 0.5cm on each side seams to be enough. This makes our houses with 5cm side. Now, Each chess board has 8 houses on the x axis and another 8 on the y, so 8*5=40cm. Our board game will have 40cm. We can´t forget we need to write the letters and numbers of the houses on the sides of the board and we need a box to take out the pieces with a ramp. Besides that, we need enough space to the motors and the magnet to move freely to every house. To make sure everything works fine I added 10 cm on each side, making our board game with 60cm. Another thing we should consider is the wood base that will support our entire system. I used one with 65cm to give me a decent margin of work.
Step 8: Pick Your Material. Let´s Start!
First thing to do is get a wooden board with the right dimensions. I had one at my home from old furniture with 65cm side and 2 meters long. I cut it to make a 65cm side square.
Step 9: Make a Square
Find the middle of your base and make a square corresponding with your future game board. In my case it have 40cm side.
Step 10: Base for X Motor
The x motor (or motors, if you are using 2), needs a support to be fixed to the wood base. Pick up a one piece made from aluminum sheet (a square) and make a 90 degree bend with a 3:5 ratio (don´t need to be exact) like in the picture. With your compass make a circle and cut it If you prefer to not use the compass just make a small space so the "screw"(I don´t know what we call the toothed part that moves in the motor) as image 5. Initially I made a circle but I repeated again and made with one square. Make 2 holes and fix, with rivets, the motor(s), using the 2 holes the stepper motor has on its base. If your stepper motor don´t have holes to fix it, you may skip this step and just add a bit of hot glue in the base (ideal for stepper like the NEMA-17 that is a cube).
Step 11: Fix the Motor to the Base
Align the motor with your square. Here, you should be very precise since a one milliliter error can impair efficiency and accuracy when moving the pieces. You should place the motor out of the square you made. Although this picture shows the motor right next to the square, I had to change this while I was doing the project. Because of the supports I had to install to make sure the y motor didn´t swing, the space was not enough. Give a 5 cm margin. You will understand it better after. Make the holes in the wood and use screws.
Step 12: Pulley and Belt
Now, pick up one pulley and your belt. Since our square board has a 40cm side, we made a space of 5 cm in the left side, and a margin to the pulley should be added, we need a belt of around 50cm when stretched out (1 meter in total). By the way, for the y motor the dimensions of the belt are the same. Almost for sure this cable is a bit longer than what we need but it needs to be in tension. Dismount your pulley and attach the belt to it. Find the right place to fix with a screw the pulley. The belt should be parallel to the square. If you are using 2 motors to the x axis repeat the whole process and fix the other stepper on the other side of the square, parallel to this one.
Step 13: Y Axis
To make the base of the y axis I picked up from an old antenna a hollow tube.With the hammer I smashed the tips so I could fix the it to the belt (Don´t fix it now. We still having something to do.).
Step 14: Bearing Guide
Skip this step if using 2 x axis motors.
Since we just have 1 motor, in the other tip of the tube we have to use a bearing to support our tube. To make sure this bearing is always in the right way (we will glue it but is not enough) we have to make a guide to it. I used an old piece of metal that was 90º bended. I cut one of its sides to have a ratio of roughly 1:10. As you can see in the picture, I fixed it with 2 screws and it is parallel with the belt. Give a small margin so the piece is not touching the square.
Step 15: Hot Glue
Now, with hot glue, connect the tube with your bearing (the central part! DON´T GLUE THE PART THAT MOVES! If you do this the bearing will be there almost for nothing) and with your belt. On the side of the belt, right next to it, add another bearing to support the structure. The tube should be in the horizontal. If it is oblique just raise or low the bearing guide you made.
Step 16: Y Motor
Just like we did the support to the x motor, we have to do one for the y axis. Pick a bit of aluminum foil and bend it. You have the pictures to support you. Use 2 rivets to fix the foil to the motor and another 2 to fix the foil to the tube. The toothed "screw" should be out of the square that we made. Use the 5cm margin from the beginning of the project to help you.
Step 17: Pulley and Belt
Now, we have to fix the y axis pulley to support the belt. Using aluminum foil and 2 rivets make a small base so we can fix the pulley, like in the picture. Make a hole in the base to fix the pulley and add the belt. Remember: The belt must be in tension to work well and the pulley should be out of your square. If your belt is too long, you can cut it a bit and glue it again with super glue. Just make sure it is really well glued.
Step 18: Making a Anti-swing System
Since our y axis system is supported by 2 bearings they roll and make the system to swing. We can solve this problem using 2 other bearings and a bit of aluminum foil with the help of 2 small hollow tubes. Fix the aluminum rectangle with 2 rivets 2 the hollow tubes and, with the help of hot glue, fix the bearing in the tubes.The aluminum foil should be at the level of the under belt.
Step 19: Fixing the Anti-swing System
With the help of hot glue, fix the aluminum foil to the under belt. As you can see in the picture, I added another 2 sheets of metal on the other side like on step 14. This serves to stabilize and straighten the tube.
Step 20: Test the System
To make sure everything is ok, lets test the motors. No energy required, use your hands to pull the motors. I added some photos to reference if you want to check.
Step 21: More Metal!
Now, we are going to make a base to the electromagnet. I used a already 90º bended metal sheet. I just had to cut it in one of the tips so it could fit with the motors. I used the spirit level to see if it was parallel to the surface. If it a bit oblique just add some hot glue.
Step 22: A Bit of Welding
Since the cables of my stepper motors were too short, I cut them and I welded some news ones.
Step 23: Preparing the Batteries
I used 2 12V battery to power the motors. That was a HUGE error. Don´t do like me. Pick up a transformer right to the voltage of your motors (use a lower voltage if you could. For example: if the normal voltage is 24V use something like 16V so the motors don´t end heating too much). I had to, every 10 minutes, recharge them since the energy consumption was too high.
Step 24: Eletric Magnets!
Since an electromagnet is one of the core pieces of our pieces, we need to made (or buy, but that´s boring) one. An electromagnet basically consists in 3 parts: An iron core, like a nail with a flat part in the top, Cooper wire rolled on it and a battery. When we plug our battery (Remember: do not use lithium because we are creating a short circuit that can damage your batteries. Use alkaline.) a current flows in our copper wire, creating a magnetic field.
This expression computes the force between a solenoid and another piece of ferromagnetic material separated by a gap of distance g: F = (N*I)2 μ0 A / (2 g2), where: F is the force in Newtons; N is the number of turns, I is the current in amps, A is the area in length units squared, g is the length of the gap between the solenoid and a piece of metal. As we can see, more turns is equal to stronger magnetic fields and the same is thrush to the amperage. If you don´t like equations here is a link to a online calculator. I prefer to use equations. So, resuming, the keys to make a strong magnet are:
- Batteries in series so we´ve got high voltage = high amperage.
- More turns is always better
When making your magnet try to roll the copper wire always in the same direction. Rolling the wire in different angles/directions will make your magnet weaker.
Another thing you may notice is that your electromagnet will heat up easily. That is normal. The battery will heat too and, for us, that is a big problem. When doing my research on the web no tutorial (that I saw) mentioned this. That´s a bit weird. What happens is, because we are making a short circuit, the resistance is too low (just the cable), and since our voltage is a bit high (more than 9V) we will have a huge amount of current flowing by the cables, heating them and the battery itself. When we do this for too many time (like this project), the battery can get damaged or even destroyed. Another thing I noticed is: when we use the battery for a while and it warm up the voltage drops (even after disconnecting) and returns to the original value very slowly. Test it at your home! Use the magnet for a while to warm the battery and disconnect the circuit. Pick up your multimeter and check the voltage for a while. The voltage, when the battery is cooling again slowly raises. With a fan is faster. To solve this problem I added a fan to our project to cool down the battery. With a bigger airflow the battery gets time to cool when it is not being used (when waiting a user command for instance). I tested 1 battery with fan and another without fully charged. With the fan the lifespan of the one cooled with the fan was bigger. Therefore, besides extending the lifespan, the voltage is higher, representing a stronger magnetic field.
I made a electromagnet with a 9V battery and around 100 turns. It is in the picture. If your magnet, instead of attract the metal it repulse it, just switch the polarity of the cables.
Step 25: Connect Your Magnet
Use hot glue and connect the magnet to the belt (connect the down side-is more stable). As you can see in the picture, I added a sheet of metal so the magnet does not fall so easily while moving.
Step 26: Hold It!
When testing the system, the magnet often felt, so I added a bit of metallic wire to hold it to the support we made. I used a normal screw instead of the magnet so you can see better.
Step 27: Adding a Button to the Fan
Since we don´t want the fan always turned on, I just added a switch.
Step 28: Preparing the Eletronics...
Positioning everything in the right place. Use screws and the pre-made holes on the boards to fix them or just add some hot glue in their base.
Step 29: Eletronic Schematic
Now, is the time for connections. We´ve got many parts to connect together:
- Arduino Mega
- Power source for arduino (I used a powerbank and connected to the USB port of the arduino)
- Power source for the motors (My case:16V)
- Another power source
Here it depends of your magnet. Higher voltages = higher magnetic fields = stronger magnet... I used a 9V battery (those ones that are very cheap). I recommend you to use a cheap battery (DO NOT USE LITHIUM) since we are making a short circuit because the amperage is very high (the unique resistance we´ve got is the copper cable, that is very small). The batteries will easily harm up and this kills batteries so make sure to "refresh" your battery. Use a fan, for example and connect it to a different power source.
- Led with 100ohm resistor to make sure it does not blow up
- Fan 2 button switches
- 2 L298N Module Drivers
- 2/3 Stepper Motors (well....that´s obvious)
- Relay module
The relay has 3 pins: VCC 5V, GND and one pin for the communication. When we send a signal for this pin the relay turn on or off.
- Bluetooth module HC-05
This module has 6 pins but we just need to use 4. The VCC 5V, GND, and 2 for the connections: TX and RX. Remember, this module uses serial communication to talk with our arduino.
Now, the wiring. I left here an image of the wiring but it is a bit difficult to understand. Please, do not judge me, but I am bad at using fritzing. If you think it is difficult to understand, I just read the connections I write below.
- GND » LED
- PIN 2 » 100ohm resistor » LED
- PIN 7 » IN1 Relay Switch
- GND » GND on Relay
- VCC 5V » VCC on Relay
- VCC 5V » VCC on Bluetooth module
- GND » GND on Bluetooth module
- TX0 » RXD on Bluetooth module
- RX0 » TXD on Bluetooth module
- PIN 29, 31, 33, 35 » PIN 1,2,3,4 of the l298n driver of x motor
- PIN 37,39, 41, 43 » PIN 1,2,3,4 of the other l298n driver of y motor
Power supply for fan
- VCC » VCC of fan
- GND » Button switch » GND of fan
- VCC » VCC of motor power supply
- GND » Button switch » GND of Power supply
- GND » GND of arduino
- NC » Electromagnet (in)
- COM » Alkali battery
- Alkali battery » Electromagnet (out)
Step 30: Connecting Everything
Step 31: How It Is Under the Box
Step 32: Stowage Is Essential
Since we don´t want the cables obstructing the bearing, make sure everything is glued to the wood base or use tape.
Step 33: The Box
I made the box from aluminum foil. I had to bend it and cut it as shown in the pictures. Since our wood base had a side with 65cm, I made the base of the box with 60.
Since we have buttons and a fan, we have to make some holes on the box.
Step 35: Making the Houses
With a permanent marker I draw the houses and the numbers/letters. I made some measurements and I found the center. I just had to make the 40 cm square, like the one I draw on the wood.
Step 36: Hole for the LED
Since we added a led to make sure thee system is working, I made a hole near to the houses on the box.
Step 37: The Box for the "dead" Pieces
Since we don´t want nobody taking out the pieces, our system is responsible for that too. Make some kind of ramp so the pieces will fall. Make sure you bend the aluminum foil near to the center of the "house" (is not exactly a house, but if the board was bigger it would be) just like I did. Add a box so the pieces fall on it.
Step 38: Adding Some Bases
Since we don´t want the screws scratching our tables I added some plastic bases. I used hot glue.
Step 39: Preparing Your Chess Pieces
Pick your 32 washers and, with superglue,glue them to the base of the pieces. This will make them magnetic sensible, and now we can use our electromagnet to push them.
Step 40: Adding a Foot Clicking Feature
Since we want a system for people that can´t play chess by the normal ways, is a bit strange have to click on the phone each time we want to send a command. Because of this, I added a foot clicking feature. I just added a rubber on the top of the screen of the phone (attention: not even all works. There is a special type (I don´t know what to call it) that, if we make pressure, the smartphone recognizes a touch). Now, our android may be on the floor and people can play the game without using their hands. But another problem appears: the microphone of our smartphone can´t recognize our voice from this distance. It needs to be near us. To solve this problem, I bought this microphone and this one. They are pretty much the same thing and they work very well. Just use hot glue to glue them to the box.
Step 41: Programming-The Code
Now, the programming part. Since your project´s dimensions may be different there are some stuff you should change (I marked the value where you must write your own with this symbol: [?]), but I will explain what you need to do later. PLEASE DO NOT COPY AND PAST THE CODE! IT WON´T WORK! Here is the code:
Step 42: Programming-Code Explanation
Step 43: The App
The app I used was the "Arduino Voice Control" available on the playstore. After install it and when ready to use the board, make sure the language is English and connect your cellphone to wifi and to your bluetooth module. It would show in the available bluetooth devices the HC-05 or HC-06. Connected to it. If it asks you a code is the 1234 or 0000, but it depends from the manufacturer. When you want to send a command just click on the microphone and do not click again,because it will cancel the command.
Step 44: How It Looks Like
Step 45: How to Play-small Guide
A small guide if you don´t understand something on the rest of the instructable.
- Turn on the 2 button switches
- Turn on your arduino power source
- Connect to internet your smartphone
- Connect to your Bluetooth module (The name is HC-05 or HC-06)
- Click on the button of the app when ready to send a command
- Speak your command (for example: A1B2)
- The LED will turn on in a few seconds to show the arduino received the message
- When the LED turn off you can send another command
Step 46: Testing the System
*Sorry for my bad spoken English :D
Step 47: Conclusion
So....Thanks for reading my instructable. If your have any questions or tips just write below on commentaries. Normally, when I make a project, in the end, I try to reflect about how did it go and what could I do to improve it. Here is a small list of things you can change:
- Instead of using a smartphone, use a proper module. Yeah! There are modules to send command by voice but they are a bit expansive and they work by a different way.
- Buy a decent Bluetooth module from a well-know shop, not ebay. My bluetooth module burned out and I had to wait for a new one to continue this project. If you are buying on ebay buy 2 or 3 modules.
- If you don´t like our planet and want to contribute to the deforestation, buy some wood and make a nice design to the board.
- Instead of using a relay and a electromagnet, we could use a permanent magnet and, with the help of a selanoid valve, we could rise or fall it, when we want to move a piece. We don´t waste batteries but errors will appear easily.
- Instead of using a LED, you may use a LCD to show what move is going to be done. I could have done this, but I still thinking the led is enough. Is just an idea.
Until the next project!
Participated in the