Crab Controller & Crab Simulator
Interactive Art and Computational Design, Carnegie Mellon University, 2015
A 3D-printed, posable crab input joystick for controlling tetrapod walkers, motion capture, and simulations. With 4 legs and 3 degrees of freedom per leg, the Crab Controller sends data through an Arduino Mega via the Standard Firmata protocol to another device. Here, the crab controller is being used to control an underwater virtual crab simulator in real time. This project is expected to cost around 60-80 USD and 1 week for assembly.
A PERSONAL MESSAGE FROM THE AUTHOR:
This Instructable has been entered in several contests where 3D printers are listed as prizes. If I win a 3D printer, I will donate it to a middle or high school that does not have access to 3D printing technology. So, if you liked this Instructable, please vote for it! Every vote counts, and it would mean so much for me to make this happen.
Thank you and enjoy,
Step 1: Parts and Tools
You will need the following parts for this project:
- Arduino Mega 2560 (https://www.sparkfun.com/products/11061)
- Large Perf Board (http://www.allelectronics.com/make-a-store/item/pc...)
- 12x Rotary Potentiometer (https://www.sparkfun.com/products/9288)
- 2x 330 Ohm Resistor (https://www.sparkfun.com/products/8377)
- 2x 5mm LED (https://www.sparkfun.com/products/9592 )
- Male/Female Jumper Wires (https://www.sparkfun.com/products/12794)
- Breakaway Headers (https://www.sparkfun.com/products/116)
- Stranded Core Wires (Recommended at least 4 Colors)
- 3D Printer Filament
- 2-56x3/8 Screws
- Heat Shrink
- Hot Glue
You will need the following tools for this project:
- Soldering Iron
- Hot Glue Gun
- Wire Stripper
- 3D Printer
- Heat Gun
Step 2: 3D Printing the Parts
Go to this GitHub repository: https://github.com/johnchoi313/Crab-Controller-Sim...
Click on the download ZIP button, and extract the downloaded files. Navigate to the CAD folder.
Here, you will find all necessary files to 3D print in STL format. Go ahead and 3D print the following files in whatever colors you please (I chose white and orange):
If you do not have a 3D printer, I recommend using a 3D printing service like 3D Hubs (https://www.3dhubs.com/) to find a local 3D printer in your area. Expected print time for all parts is around 8-12 hours.
Step 3: Leg Assembly
Before assembling the legs, I highly recommend looking at the full CAD file to get a sense of how everything will fit together. Rhino 3DM and STP files, which can be opened in either Rhinoceros or Solidworks, are located in the same CAD folder as from the previous step.
Assembly: There are 4 legs, 3 potentiometers per leg. Assemble each leg as follows:
- Attach the Leg1 piece to two potentiometers. Do this by applying a dab of hot glue and sliding the potentiometers through the holes.
- Attach the Leg3 piece to one potentiometer. Do this in the same fashion as the first step.
- Attach the Leg2 piece to the Leg1 piece applying a dab of hot glue and sliding the potentiometer on the Leg1 piece through the Leg2 piece.
- Attach the other end of the Leg2 piece to the Leg3 piece in the same fashion as step 3.
Do the above 4 steps for all four legs.
Note: Be very careful not to mix up the pieces for the legs! (The a,d and b,c pieces are mirrored back and front, so they are not the same.) If you do happen to mix some parts up and glue them incorrectly, use a heat gun to melt the hot glue inside the joint and pull out the potentiometer slowly.
Step 4: Soldering and Electronics
This is step is somewhat complex, so follow closely:
First, I will tell you the basic usage of a 3-pin potentiometer. There are 3 pins, one for power, one for ground, and one for signal. When powered, the potentiometer (also known as a variable resistor) will change the signal value based on the potentiometer's current position. In our case, we change the potentiometer's rotation to get different voltages, effectively allowing us to get the angle of the potentiometer. We use exactly 12 potentiometers in our crab controller, 3 for each leg.
Refer to the Fritzing diagram above to get a sense of how all the electronics are going to fit. Once you are comfortable with the arrangement of the pins and wires, proceed to the following steps:
- Solder the four legs onto the four corners of the perf board as shown. Make sure you do this in the correct position so that everything may fit when the top and bottom shells are closed.
- Then, solder the 4 potentiometers' wires from the Leg 1 pieces onto their correct locations (I recommend using white wires for signal, red for 5V, and black for ground). Note that the signal pin is the middle pin for each potentiometer.
- When you have soldered all the Leg 1 potentiometers, proceed onto soldering the wires for the Leg 2 potentiometers. Because these potentiometers are not directly attached to the perf board, I recommend using heat shrink to cover the wire connections on the Leg 2 potentiometers (not doing this may cause short circuits).
- Finally, solder the connections for the Leg 3 potentiometers onto the perf board, and use heat shrink to cover the wire connections in the same way as the previous step.
- When you have completed soldering the potentiometers for all the legs, solder the LEDs and resistors. Because these will be used for the eyes, make sure you solder them in the correct positions.
Step 5: Final Assembly
Fit the perf board onto the top shell. Make sure the LED eyes are facing forward. Fasten the perf board onto the top shell by applying four screws, one for each mounting hole on the perf board. If the holes on the top shell are too small, you may need to use a drill to increase their size. When you have securely fastened the perf board onto the top shell, bend the LED eyes and fit them through the small eye holes in front of the top shell.
For the bottom shell, fit the Arduino Mega onto place. If it snaps on tightly, you do not need to add screws to secure the Arduino Mega. If it does not snap on tightly, apply 4 screws in the 4 mounting holes of the Arduino Mega. Again, if the holes on the bottom shell are too small, you may need to use a drill to increase their size.
When both the Arduino Mega and the perf board are fastened onto their respective shells, use the male-female jumper wires to connect the header pins from the perf board onto the Arduino Mega. Note that you need jumper wires for the ground, 5V, 2 for the PWM LED eyes, and 1 for each of the 12 signal wires going into the analog inputs. When all the jumper wires have been connected, close the top shell onto the bottom shell (this may require some effort). When the top and bottom shells are successfully closed, fasten them into place by applying 2 screws on the front, 1 on the back, and 1 for each side.
Step 6: Result
Voila! You have just built a 12 degree of freedom posable crab controller. Take a moment to reflect upon your work. It probably was not easy for you, and it certainly was not easy for me. In any case, I hope you learned a lot in the process. The final few steps are here to show you how to use your new posable crab input joystick in controlling an underwater virtual crab simulator via the Standard Firmata protocol. Proceed onto the next step when you are ready.
Step 7: Readying the Arduino
As stated earlier, this project runs on the Standard Firmata protocol. In essence, Standard Firmata is an easy to use interface with the Arduino board that lets you control it directly in real time through another programming language on another device, such as Python or C++ on a laptop. Do the following steps to setup Standard Firmata:
Open the Arduino IDE and connect the crab controller's Arduino Mega to your computer using a USB A to B cable. Click on File->Examples->Firmata->StandardFirmata. This will load the necessary example code onto the Arduino IDE. Now, click on Tools->Board->Arduino Mega 2560 or Mega ADK. This will change the board type so that the IDE knows what hardware it is working with. Finally, click on Tools->Serial Port->(Serial Port Name). This will set the Arduino IDE to the specified serial port where the Arduino Mega is connected (usually, the Serial Port Name is something like COM# for Windows). When all the settings have been set correctly, upload the Standard Firmata code onto the Arduino by clicking on the arrow button next to the check mark on the upper left of the Arduino IDE. If there are no glaring orange errors in the Arduino IDE log, then the code has been uploaded successfully onto the Arduino board.
You can test the Standard Firmata protocol and make sure it works by using the Firmata Test application. You can download this here: http://firmata.org/wiki/Main_Page. Run the Firmata_Test executable. From here, click on Port->(Serial Port Name). The Serial Port Name is the same one used to upload the code in the Arduino IDE. After a few seconds, you should see a lot of pin information appear. You can control these in real time. In particular, we are interested in PWM pins 2 and 3, as well as all the analog input pins used for the potentiometers. Note that the Firmata Test program is somewhat glitchy with the Arduino Mega, so you may have to restart it a couple times to get the full analog pin data. Take note of all the pins being used and their ranges, as they will be used in the Crab Simulator.
Step 8: Running the Crab Simulator
Inside the same folder downloaded and extracted from the GitHub repository in Step 2, there is a file called Crab Simulator.exe. Double click on it to launch the executable. Shortly afterwards, you will see a small window pop up asking what settings you want to use. Choose whatever settings you like, and press Play to begin the simulator. Shortly after doing this, you will see an underwater seascape with a crab in the middle. On the upper left hand corner of the screen, you will also see a series of pin mappings. These are here for you to change and adjust to fit your crab controller.
Setup and Calibration:
Change the Port Name setting to the Serial Port Name of the crab controller's Arduino Mega (this is the same from the last step). Change the Left Eye and Right Eye Pins to the PWM pins used. Change the pin numbers for the analog inputs to the pins corresponding to their leg pieces. Now, press the Connect button at the top to begin the serial communication between the virtual crab simulator and the crab controller. Note that the pins may not be calibrated yet. Look at the Pin Value column to see the current values of the analog input pins. You can find the Pin Min and Pin Max values by rotating each joint as far as possible, forward and backward. Set the Pin Min and Pin Max values according to your observations. If a joint's rotation is reversed, simply swap the Pin Min and Pin Max values for that joint. Inside the same folder, there is a file called info.text, which has the all pin information data saved. Press escape to quit. The next time the Crab Simulator is run, it will load the settings saved in info.text.
- [Joints] when rotated, will rotate the corresponding joint on the virtual crab.
- [R] resets the orientation of the crab in the crab simulator.
- [Mouse Move] allows you to look around the crab.
- [Mouse Wheel] allows you to zoom in and out.
Third Prize in the
Second Prize in the
Mind for Design
Participated in the
3D Printing Contest