Bluetooth Mecanum Robot
Mecanum wheels are revolutionary wheels that work using rollers along the wheels, all angled at a 45° angle. These rollers allow for omnidirectional movement. This means the robot can not only move forward and backward, but it can also strafe left to right, travel on diagonals, and rotate along multiple axes. I am going to teach each step to make, CAD, and program your own mecanum robot.
Supplies
To create a mecanum robot, you will need a few things:
- 1x Chassis kit (1 frame, 4 TT motors, 4 mecanum wheels)
- 1x Bluetooth module
- 1x Arduino microcontroller (I used the Arduino Mega)
- 1x Motor driver Arduino shield
- Batteries and cases (1x 9v and 4x AA)
For my project, I used a chassis kit, which included the chassis, wheels, and motors. However, you can also make the chassis and purchase wheels and motors separately.
Wiring
When wiring the wheels, it is crucial to connect the correct motors, as the robot won't move properly otherwise. Return to this step if the directions are incorrect later on.
Front Left --> M1 on shield
Front Right --> M2 on shield
Back Left --> M4 on shield
Back Right --> M3 on shield
Bluetooth module:
RXD --> D2
TXD --> A8 (If you don't use a mega, you will have to change this number in the code to another analog pin)
GND --> GND
VCC --> 5V
Power:
6V (4 AA batteries) --> +M and GND terminal on shield
**Remove the yellow jumper pin from the shield. It connects power from the board and Arduino, which causes voltage drops when the motors turn on, shutting down the robot.
9v --> Vin and ground on Arduino
**Don't attach the 9v to any pin but the Vin ( Voltage input ) pin; it could fry the board.
CAD
I've used Onshape to design the top battery holder and modified open-source designs to mount the Arduino, 9v battery, and breadboard.
I've also included the step file for a servo-operated claw. The code to run this claw is included in both the app and the program. Feel free to 3d print it for yourself!
These robots can do more than drive, so be creative and have it do whatever you want!
Building the Robot
You should have 2 types of wheels, a left and a right. Like the diagrams, make sure the rollers create an X. This X must be on the top, not the bottom. You can get/make the chassis either a rectangle or a square; both are good for different uses. A square chassis rotates better and is slightly more ideal, while a rectangular chassis can improve straight-line stability and speed in some cases.
Simply attach the wheels to the motors and the motors to the chassis. Different robots will mount these parts in different ways. For me, a hub attached the wheels to the motors, and the motors got screwed into the chassis. If you bought a chassis, there will likely be a video specific to the one you have.
Programming
Mecanum wheels have tons of directions and ways to move, and it all comes down to which wheels move when and how. When all wheels go either forward or backward, the robot will go in that direction. The robot can also move right to left, called strafing, by having the diagonal wheel pairs go in opposite directions. This is just the simplified movement; all of the possible directions and rotations are in the image above
The code can quickly know which wheels to move by using functions that define the proper motor directions for each movement. Each button on the app sends the Arduino a separate letter, which corresponds to each of the movements.
The code has two modes: Turning and strafing. These modes can be switched by clicking the toggle button on the app. The code changes the mode and will either strafe side to side or rotate. This implementation was crucial as the controller would feel cluttered without it. Instead of rotating with another whole set of buttons, a single button allows you to switch between the two.
Downloads
The Program
Connecting the App
The app for this robot was created on the MIT App Inventor. The app is what sends the commands to the robot. For each button press, the program checks if any other buttons were previously pressed. If, for example, the front and left buttons are pressed, it will move diagonally to the left.
Logic for each button press
- While the button is pressed, set a boolean value to be on
- Check if any other buttons are also pressed
- If none are, go the direction pressed; if 2 are, go the combination direction.
For example, the forward button checks if either the left or right are pressed
- If none are, it goes forward
- If the left button is also pressed, move forward to the left
- If the right button is also pressed, move forward to the right.
You can connect the robot with Bluetooth, and you should be done!
The .apk file can be used to download it onto an Android device.
Downloads
Finishing and Troubleshooting
Now that you are done, drive it around with the app and have fun!
If you have any issues, there are a few things you should check.
- Do the wheels make an X from the top?
- Are the motors plugged in the correct order?
- Is the motor polarity the same?
- Is the yellow jumper on the motor shield removed?
If these are all correct and the problem persists, feel free to leave a comment!