Professional Documents
Culture Documents
UNIVERSI
TY OF
DETROIT
MERCY
Ryan Welsh
Theodore Chase
MICROCONTROLLER DESIGN
REPORT
Our Pixy Camera was responsible for the main goal of this project: locate and
exit a door. This is a complex task which also requires obstacle avoidance for safe
driving. The camera will locate a color signature, and drive toward it. We will
assume our color code is located on the left side of a door-way. Upon reaching the
door, if it is open than continue through. Otherwise, our robot will wait until the door
is opened. When opened, the robot will drive through the doorway.
Hardware Overview
I.
Sonars
Labeled
Sensors
The sonars (see Figure 1) were used to steer the Pioneer 3DX
away from obstacles that the robot may encounter. We
developed many different methods of using the sonars in an
attempt to derive a smooth, consistent avoidance system.
1. Initial Plan
At first, we believed that the data being read from our SCI Buffer
coordinated directly to the distance from the sonar. Our method for
avoidance was to locate obstacles while they were still far away from the
robot. Our search range was three meters from the front sensors (sonars
2,3,4 and 5), and roughly a half meter from the side sensors (sonars 0,1 and
6,7).
After reading the sonars, we developed nested if statement which
separated the sonars into a subsections for the front, left, right, front-left and
front-right. Depending on which sonars were reading objects, we immediately
sent a new velocity for our robots path. For example, if an object was found
to be in the front-left section of the robot, a quick speed change would occur
to dodge the obstacle. In contrast, if the left section of the robot found an
object, the speed change would be less drastic because less turning is
necessary to avoid the obstacle.
2. Revisions
a foot away from our outermost sensors. This increased the smoothness of
our obstacle avoidance system, minimizing the occurrence of random and
unnecessary avoidances.
When approaching our control algorithm, we realized that a flag-style
system may be better for adding more varying control. We developed a
function to set obstacle flags (either obstacleLeft, obstacleRight,
obstacleLeft_Front, obstacleRight_Front, and/or obstacleFront). The definition
of our flags is determined by the location of the sensors (see Figure 2, below).
A flag is set when any single sensor in a subsection breaks the threshold
distance for its group. At first, our new method was found to work much
better as we were able to make specific cases if multiple flags were set.
However, we realized that we took on too much complexity when creating the
obstacleRight_Front and obstacleLeft_Front flags. After removing these and
lowering the sensor distance threshold, our driving algorithm smoothed
drastically.
Key
ObstacleRight =
ObstacleRight_Front =
ObstacleLeft =
ObstacleLeft_Front =
ObstacleFront =
Figure 2: Pioneer 3DX Sonar Arrangement and Flag Definitions Based on Location
II.
Pixy Camera
1. Initial Plan
The Pixy Camera enables the robot to recognize a color signature and sends
data to the HS12 using full duplex SPI communication. The color will indicate the
location of a door that the robot must reach. Our initial plan does not require full
duplex communication because we decided that we did not need to use the pan
and tilt function on the Pixy Camera. This plan would send the value in the index
that corresponds to the X value in the view frame from the data packets.
Once the data is received, the processor compares the value to X center of
the view frame, and the robot will drive accordingly. If the data indicates that
the object is within the designated range of left view, the robot will drive left,
sending lower values to the left motor than the right. If the object is in the
center range, both motors receive the same velocities to drive straight. If the
object x coordinate falls into the right view range, the robot will drive right,
sending lower velocities to the right motor than the left motor to turn right. This
is a basic step function that we created to have the robot follow a selected
object.
2. Revisions
Revisions will and have be made in this code that will send velocities to the
robot to turn based on how far away from the X center of the view frame. This
would be a linear function that would increase the precision of the robots ability
5
III.
XBEE:
6
Design Specifications
MC9S12DP512:
Pixy Camera:
The Pixy Camera communicates using Serial Peripheral Interface with Master
Out Slave In (Mosi) and Master In Slave Out (Miso) to send data
The Mosi and Miso connections are made at the H1 primary digital I/O port on
the HS12.
The Pixy Camera can run on 5 volts from the SPI communication off of the
HS12 board or can receive 6-10 volts through the cameras main power
supply.
XBEE Modules:
There are two XBEE modules: XBEE router (connects to the computer) and
XBEE coordinator (connects to the HS12).
The XBEE modules are a wireless serial communication tool. The
coordinator is connected to the 4 pin SCI1 RS232 port. The router is
connected to the computer using a 9 pin RS232 serial cable.
XCTU software tool is used to pair these modules and communicate
between them.
9
The XBEE modules themselves run at 3.3 which is regulated from the 5
volts given by their adaptors.
Workload Distribution
20% Design: Nayan (25%), Ted (30%), Ryan (45%)
35% Hardware Implementation: Nayan (50%), Ted (35%), Ryan (15%)
35% Software Implementation: Nayan (25%), Ted (30%), Ryan (45%)
10% Report Writing: Nayan (30%), Ted (40%), Ryan (30%)
Conclusion
Although challenging, this project allowed us to enhance our knowledge with
microcontrollers. This field is quickly growing and the skills we gained through this
design process will greatly affect our professional careers in the future. Through
hardships arose lessons which taught us more efficient methods for developing,
testing, and implementing software and hardware configurations.
The idea for this project was developed well by the professors and TA.
However, there were minute issues that could have been overcome easily.
Throughout the term, our TA was unavailable for much questioning. Granted, being
10
11