MCEN 4115-5115: Mechatronics and Robotics I: Team Hodor
MCEN 4115-5115: Mechatronics and Robotics I: Team Hodor
Team Hodor:
Faizan Mir
Vinodharani Murugadoss
Santhosh Lakshmanan
Ramakrishnan Balasubramanian
Phillip Wu
1. Introduction
The competition held for Mechatronics and Robotics this semester drew upon aspects of
rocket league and soccer. The competition was to fabricate and design a robot that can find the
yellow ball located on the field and hit the ball into the opposing team's goal, earning a point.
The robot was to compete completely autonomously against one other robot per match.
This semester’s competition was quite difficult as there were many things that the robots
needed to account for and many different ways to compete. To start, the robot had to know
where it was located in relation to the ball. This could be done using radio communication as
well as some sort of CV, Computer Vision. This is hard enough as is, but then the robot still
needs to take into account the location of the goal and opponent as well. After doing all of this,
the robot still has to make decisions based on all of these factors and determine the best course
of action. This report will go into our team’s design and approach to this challenge, highlighting
some of the critical decisions we made along our path.
2. Mechanical Design
2.1 Chassis Design
The main design of our robot featured three layers made out of MDF and separated by
3.5 inch standoffs. MDF (Medium Density Fiber) was chosen for layers as it has a smooth
surface, is easy to manufacture, is heat resistant, and most importantly, is rigid and structurally
sound. The MDF sheets were designed to be laser cut for precision and accuracy. Single-layer
parts were laser cut and a few complex parts were 3D printed in PLA because of its ease of
manufacturability. The differences between each layer and what components they each house
is shown here:
1. The 1st bottom layer consisted of the wheel assembly, and its associated components
like motor, power sources (battery, power bank).
2. Next upcoming layer is the heart of the robot, having the Raspberry Pi, assembled
printed circuit board, an Arduino board, motor driver, and a transistor for the hitter setup.
3. The final top layer has the director of the entire robot, the Pixy cam, which guides the
entire robot, the ball holder (for team identification), and a switch for turning the robot
setup. A handle is placed on the bottom of this layer for lifting the entire setup
4. The hitter mechanism, which was a powerful setup, with torsional springs for creating
more tension when the ball nears the robot.
The robot was designed in such a way that no component exceeded the 3 layers’
dimensions. The design was also tested for strength and rigidity. Mecanum wheels were chosen
because they allow much higher maneuverability than other designs that we were considering.
Maneuverability is important because there are going to be many different ways we are going to
want to position ourselves in order to hit the ball. We decided to use high-speed motors
(250rpm) because we felt that moving quicker would allow us to take complete control over the
ball throughout the game.
Here are some photos of our robot and the basic dimensions governing our design:
3. Electrical design
Components Used:
3.1 Microcontrollers
Raspberry pi 3:
Raspberry pi 3 is a Single-board computer with wireless LAN and Bluetooth
connectivity. It has the following functionality,
In this project we use the PI to send serial data from one arduino to
another. We prefer using the pi because of its high computational speeds and
power. This makes the system have faster response time and be able to “think “
faster than other microprocessors.
We have used Arduino to get data from all the sensors and send the data it
receives to the pi. The controller then receives the decisions made by pi
and activates what it needs to in order to do what the pi told it to do.
We have connected the pixy camera using ICSP to the Arduino. Frist, we have
trained the pixy to identify the yellow ball (the ball of the game), so that every
time the pixy sees the ball, it captures the frame and the pixy ccc library gives us
the width, height, x and y axis of the all as data. We use that data of pixy to move
our robot towards the ball.
Motor drivers act as an interface between the motors and the control circuits.
Motors require a high amount of current whereas the controller circuit works on
low current signals. The function of motor drivers is to take a low-current control
signal and then turn it into a higher-current signal that can drive a motor.
We are using these motor drivers to drive the motor of the mecanum wheels. We
connect the PWM signals of the motor driver to the Arduino PWM signals and
give the speed constraints using that. We have used 2 motor drivers for the 4
wheels, which acts as a bridge between the wheels and Arduino mega.
The RFM69 operates in 3.3 Volts and is connected to Arduino using BI-direction
voltage convertor. The antenna is connected to the A pin of the transceiver and it
receives the data from sky pixy which was 915MHz in our case.
After receiving data from RMF69 we have used it to obtain the coordinates of our
position, opponent position and the ball position from sky pixy connected. These
positions help us identify whether we are having to go on defence or offence.
3.6 Gyroscope:
GY521 is connected to the Arduino mega using the SDA, SCL that is the I2C
connection from Arduino to the gyroscope. In our project we have used GY521 to
calculate the yaw value, thus calculating it gives us the position of our vehicle.
Calculating the position gives us heads on which direction we are headed, and
helps us in orienting ourselves towards our home goal for defence and to score
goals during offence.
3.7 Motor: Hitter
For the hitter we have used a wiper motor coupled with IRF540 MOSFET. The
motor tends to use more power than an Arduino input can handle directly, so we have
used an IRF540 transistor in order to power the motor. The IRF540 is an N-channel
MOSFET used for fast switching and amplification purposes.
4. Circuit Design:
5. Algorithm
5.1 Ball Detection
Our Pixy2 camera was paired up with an arduino
mega for ball detection. The color connected
components program was used for ball detection
from the Pixy2. The data that the pixy processes
sends the location of the ball as x and y coordinates
to the arduino. The Pixy2 camera is easy to set up
but in order to get better results the camera settings
were configured to detect the object in low light and
the detection settings were refined for better
detection of the yellow ball.
a) Ball signature received from Pixy. b) Robot turning clockwise as ball signature not
received from pixy. c) Ball Signature received from pixy and sent to Pi
Raspberry pi was used as the main microcontroller to Dead Zone
perform all the computation for the robot due to its higher
processing speed. We defined a dead zone for the x-
coordinate of the ball between the range of -0.20 and 0.20.
This helped the robot identify the location of the ball in its
frame. The robot would make a right turn if the value was
greater than 0.20 and left turn if it was less than -0.20. This
helped the robot to navigate in the direction of the ball and
always keep the ball in front of the robot.
The playground was divided into 6 different zones and different functions were executed
when the ball and the robot were in these regions. The main purpose of doing this was
to make sure the robot aligns itself towards the opponent goal after reaching near the
ball. The robot would calculate its distance from the center line (shown in blue color in
the figure below) and distance of the ball from the center and then position itself in
various zones to execute commands specific to that region.
a) If the Robot distance (DH) is greater than ball distance (DB), the robot would move left.
b) The robot moves clockwise until a specific yaw angle to align itself towards the goal.
c) The robot aligned itself towards the goal and would move forward with the ball.
If the robot was in Zone 1 and Zone 2, then the robot would first compare its distance
and ball’s distance to the center. If the distance of ball (D B) is closer to center than the
robot’s distance (DH) then the robot would directly move towards the goal maintaining a
specific yaw angle which was tuned in the playground. For the case when the ball is
farther away from the center as compared to the robot, the robot would move right and
then rotate in counter-clockwise direction. This was done in order to align the robot
towards the goal.
a) If the Robot distance (DH) is greater than ball distance (DB), the robot would move right.
b) The robot moves in counter-clockwise direction till a specific yaw angle to align itself towards
the goal.
c) The robot aligned itself towards the goal and would move forward with the ball.
The robot is programmed to move forward till it reaches the opponent goal, however
when the opponent goal is 2 feet away from the robot it would stop and use the hitter by
powering the hitter motor. The hitter uses a spring loaded mechanism to shoot the ball
into the goal.
6. Real-time problem
The robot was detecting multiple yellow signatures during the competition which confused the
robot and made it move towards the wrong direction. This happened because the pixy camera
was programmed to detect yellow balls in a very low light setting and the playground had very
bright lights, which resulted in even mildly yellow or even orange colors to be detected as
yellow. Even though we used raspberry pi for computation, the ball and robot data was sent to
the pi by arduino which became bottle neck in the system and dictated the speed of the robot
motion. This huge difference in the processing speeds at which the directions were sent to the
arduino and executed by the arduino caused delay in the robot motion. This problem was
corrected by adding a delay while moving the robot clockwise, so that it gets time to receive
directions from raspberry pi and implement them.
7. Budget
Sl.
Purchased Source Purchased Product Cost (In Total)
No.
MOTORS, MOTOR
1 AMAZON $101.78
MOUNTS & WHEELS
STANDOFFS (3.5"
2 DIGIKEY $27.99
HEIGHT)
3 HOME DEPOT MDF SHEETS $16.00
4 HOME DEPOT SCREWS $11.00
5 HOME DEPOT WIRES $5.00
6 MCGUCKINS SCREWS & NUTS $10.63
7 MCGUCKINS SPRINGS $4.00
8 MCGUCKINS SCREWS $3.72
9 Amazon Prototyping board $2.00
10 Amazon Switches $1.00
11 Amazon Ribbon cable $3.00
Total $186.12
8. Lessons Learned
In the end, we were able to reach second place in the competition and even knocked the
1st place team out of the winners bracket for a true final match. We are very happy with our
result as we did not expect to compete as well as we did.
The biggest thing that I would recommend would be to stay with a breadboard. While the
benefits of a protoboard or a PCB are definitely tangible, it is an extremely time consuming and
laborious process to solder every wire into place. If you are sure you know what your electronics
will look like 2-3 weeks before the competition, the time commitment could be worth it. But if you
haven’t finalized your electronics a week before your competition, stick with the breadboard and
noodle soup.
10. Appendix
Raspberry Pi Code.
https://drive.google.com/file/d/1vd1F6ApXFalGjS5A6IoL_zjtJuZJBjG4/view?usp=sharing
Arduino_1 Code:
https://drive.google.com/file/d/1zKG8KihaJriNoUgMnKsTIb68RGVNzh-O/view?usp=sharing
Arduino_2 Code:
https://drive.google.com/file/d/1dXVNaP2NyNqdkwjK6kajakZQLNAZJ2U6/view?usp=sharing