Introduction: PS2 Controlled Omnidirectional Robot
This omnidirectional robot is made with VEX holonomic wheels and a wireless PS2 controller (and receiver) from Hydra! Enjoy!!!
Step 1: Materials
You will need:
- Arduino Uno R3
- 8x8x0.5" wood (can be cut from a larger piece)
- Jumper wires: M/F, M/M, and Jumper Wire Kit
- Hydra Performance® Wireless Controller 2.4G (w/ wireless reciever)
- TLP-2000 Tenergy Universal Smart Charger
- Tenergy 7.4V Li-ion 18650 2200mAh Rechargeable Battery Module with PCB Hydra Performance® Wireless Controller 2.4G (w/ wireless receiver)
- Wood screws, Slotted round head, Zinc plated steel, #8 x 5/8"
- Bar 1x25 (8-pack)
- 2-Wire Motor 393
- Motor Controller 29
- 4" Omni Directional Wheel - Double Roller (2-pack)
- Shaft Collar (16-pack)
- Drive Shaft 2" & 3" Pack
The excel document below has more details such as part number and prices!
Step 2: Research
If you are new to Arduino -- like I was at the start of this project -- start off by checking out the tutorials below and refer back to the Arduino reference guide. These tutorials will help give you a strong enough understanding of Arduino to do this project!
- (general Arduino tutorial) https://learn.adafruit.com/series/ladyadas-learn-a...
- (PWM to control servo motors) https://core-electronics.com.au/tutorials/servo-co...
Step 3: Attach PS2 Receiver to Arduino
- Make sure the PS2 receiver is right-side-up!
- Use image above to connect jumper wires to the PS2 receiver (push hard and remember which color you use for each)
- Now connect the other side of the jumper wires to the appropriate pins (remember which one is which)
- brown: data --> any digital pin (I used pin 13)
- orange: command --> any digital pin (I used pin 11)
- red: power --> 3.3V
- black: ground --> GND (on same side as power)
- yellow: attention --> any digital pin (I used pin 10)
- blue: clock --> any digital pin (I used pin 12)
- NOTE: You should not use the white wire (or 8th connection point) and only use the grey wire (or 3rd connection point) if you would like to add a vibration (of the PS2 controller) otherwise it is unnecessary!
- If you are having any difficulties, please reference this more in depth youtube tutorial
Step 4: Configure Breadboard
Learn how breadboards work here before starting this part of the project!
I've also taken a picture of the actual breadboard to serve as a schematic.
Configuring your breadboard is very simple!
- Gather your materials: breadboard, 5 jumper wires (M/M), mini wires (you can cut jumper cables (or not) or use mini wires as shown in the image, and motor controllers
- Plug motor controllers into the bread board; space each motor controller about 5 boxes apart (horizontally)
- Use mini wires to connect to power (red wire) and ground (black wire) to the power and ground strips on the side of the breadboard
- Then use jumper cables to connect the white signal wires to PWM pins with this ~ symbol on the Arduino
- Take two more jumper cables (preferably red and black colored). Connect one side of the red wire to the Vin pin on the Arduino and the other side to the (red) power rail on the bread board. Connect one side of the black wire to a GND pin on the Arduino and connect the other side to the (blue) power rail on the breadboard.
You can place this part of your project on the side now!
Step 5: Design and Cut Base
For this step you will need to use power tools, so remember to be safe!
- Gather materials: Wood, jigsaw, ruler, and pencil
- Decide how long you want the sides of your hexagon to be (for 4'' wheels, 4'' sides were appropriate)
- Use this hexagon calculator to find dimensions
- To draw hexagon on wood
- Measure out the side length on one edge of the wood
- Use the short diagonal value to draw another side parallel to the one you drew
- Draw a center point
- Draw line from center point that is parallel to the sides you drew before. The line should be twice the size of the sides and the center point should be its midpoint
- Connect the sides by drawing 4 lines between the endpoints of all the lines you have drawn
Step 6: Measure and Plan for Motor Mounting
If you look closely you can see the lines that I drew in order to map out the motor placement.
- Draw 3 lines from the center point that are exactly 120 degrees apart (these lines will show you where to put the motors later on). If you don't have a protractor, you can achieve this 120 degree spacing by drawing a line from the middle of one side to the center point then skip a side. If you repeat this twice you should have the second and third lines drawn in the same fashion.
- Connect wheel and driveshaft to the motor
- Measure your motors to find the spacing (if you are using VEX servo motors there should be two protruding places to screw on a motor mount)
Step 7: Create L-Brackets/Motor Mount
Homemade l-brackets are what I used to mount the motor to the base. The purpose of this step is to mount the motor to the base so you can use whatever mounting solution your want!
- Grab your 1x25 Bars from VEX robotics, bench vice, hammer, and sharpie
- Draw a line on the bar that is slightly less than 1.5 squares from the end of the bar. Flip it over and do the same on the other end of the bar (if you use 3 bars you should be able to make 6 l-brackets).
- Put the bar (securely) into the vice up to the line and hammer the bar until it forms a 90 degree angle on either side. Do this for all the l-brackets.
- Use the Dremel (with a metal blade) to separate the l-brackets on either side. Depending on the size of your base and of your motors, the l-bracket length might change. For the purpose of this exact project I cut the bar to 6 squares long (plus the half square on the 90 degree angle).
Step 8: Mount Motors
Time to drill!
- Place the l-brackets flat against the base (with the shorter side perpendicular to the base) in the spaces that you measured out in step .
- Use the screws to drill the l-brackets to the base
- Use the short screws that come with the VEX servo motor to hand screw the motors to the l-brackets (if the motor doesn't fit snugly, you can super glue the motor to the underside/l-bracket/base).
- Drill hole through center of base to connect motor controller to the motor wire OR leave room for the motor controller elsewhere
Step 9: Attach Wheels (and Wheel Supports)
- To fashion wheel supports, take sharpie and mark the end of the 13th square of 3 bars, this will be the length of the support for a 4" wheel. (there are of course many ways to stabilize the wheels but I found this way to be the best for me)
- Mark the bars in between the 3rd and 4th squares and in between the 8th and 9th squares
- Extend the line you made in the step (the ones that were 120 degrees apart) to the top of the base (by taking the line to the very edge and continuing it up the side and then onto the top)
- Using this line, center the bars and drill them to the top of the base about 3 or 4 bars from the edge of the side
- Super glue the screws to the top for extra security
- Bend the bars so that they look like the image above. The line between the 8th and 9th bars should be where the gradual curve begins and the line between the 3rd and 4th bars should be where the bar curve changes direction
- Connect wheels to drive shafts placing one shaft collar on either side of the wheels.
- Make sure there is enough space to add another shaft collar.
- Also make sure the placement shaft collars ensure that the wheel will not touch the side of the base
- Put drive shaft on wheel support and secure with another shaft collar
Step 10: Final Assembly
Now you can take the components that you put to the side earlier and superglue them to the base
- CAREFULLY take the breadboard and glue it to the base with hot glue (make sure to put the side with the active power rails in to the center.
- Glue the Arduino to the base (make sure to leave space for the USB to reach be able to connect to the)
- Glue power source to the base (leave room to recharge!!!)
- Put the motor controller end of the through the hole in the bottom and connect them to the appropriate motor
- Make sure to label both the motor controller and the base (with a letter or number)
- Glue wires to bottom of the base to avoid pulls and tangling
- Glue receiver to base or power source.
Now all the mechanical aspects of this project are done!!!
Step 11: Arduino Code
This code is complicated and probably would work better with regular DC stepper motors and a shield! So if you want to make your life easier, here is a tutorial to an easier coding ordeal with those items.
- To test out motors use the sweep code (already installed with the Arduino application).
- Start by using the PS2 library example code for the general outline for your code and for inspiration
- make sure to read the example code
- change the configuration to match the pins that you used for each of the PS2 receiver ports
- For omnidirectional movement there are three ways that I found to do this project
- using vectors you can that represent speed and angle
- (the easiest way) To control each motor individually using buttons and learn how to maneuver it that way. (you can try to use pressure of the button press to control speed for better control)
- (the most complicated way) Use trigonometry!!!
This is my code (on GitHub) along with the library and example code I used!
Step 12: Going Further
There are so many ways to modify this project so just have fun and go wild!! This website has some ideas to get you inspired.
Step 13: My Robot in Action!!!
I made a video of my robot after adding some bling (EL wires w/ inverter and metallic tape!!), so check it out if you want to see how the finished product moves!
Participated in the
First Time Author Contest