ECE 452 Final Project: Mobile Robot

Members: Michael Gray, Akeem Olaosebikan, Karl Swanson

Professor Zefran

Demo Video

Course

Software

The code for this robot was written with the Arduino IDE. We used a gyro sensor from Adafruit to keep track of the orientation of the robot, and we used infrared sensors to find the distance of objects around our robot. For the code we used libraries Servo.h and wire.h from the Arduino website, in addition we used Adafruit_Sensor.h and Adafruit_L3GD20_U.h from Adafruit website. These libraries were used for running the servo motors we used to turn the wheels and then to read the gyro sensor we used to keep track of the robots orientation. When we read the gyro the values returned are in radians, and positive when the robot rotates counterclockwise and negative when the robot rotates clockwise. As a result, we had to convert the values so the variable (degPos) which holds the angle of the robot are always between 0 and 2*PI. In addition, we had to write a method for the distance sensors, when the sensors are read they return a value from about 0-600. When something is close to the robot the value is high and when objects are far the value is small. As a result, we wrote a method that will convert this value to a unit of measurement we could use (we choose cm).

The code for this robot was tricky because we had to keep reading our sensors while the robot was moving. It would have been easy to tell the robot to move wait a short time tell the robot to stop and measure the distance we moved, but if we spent time in a delay function we wont be able to read our sensors. However, Arduino IDE has a built in function millis() which will return the amount of milliseconds that have passed since the board has been powered on. With this function we were able to keep reading our sensors while the robot is moving. We were able to read the millis() function add the time we wanted the robot to run for to that value and save it to a variable (tempTime). Then, once the millis() function caught up tempTime, we then knew how long the robot was moving for. Then, reading the values from distance sensors we knew if we need to move around an object or keep heading towards the goal. If nothing was in front of our robot then the robot would move towards the goal otherwise the robot would have to turn left and follow the object until it was clear and could continue towards the goal. We were always able to know if our robot was heading towards the goal because we used a gyro to keep track of the orientation of our robot.

When our robot was powered on it would turn towards the goal and start moving towards it. if the robot ran into an object it would stop, then turn left until nothing is in front of the robot. Once the robot was clear it would move forward following the object. The robot would use a sensor on the right side to keep the robot close to the object while it moved around it. While the robot was moving around the object it would keep checking if it was pointed in the direction of the goal, and if pointed towards goal and nothing is in front of the robot move towards goal. Then, the robot will keep doing this until it reaches the goal.

Chassis

The robot frame was constucted using scrap aluminum U channel. Two slots were cut out for mounting of the continous rotation servos. These motors operate like common hobby servos. Instead of an angle, the pulse-width modulated signal gives a direction and speed. A ball mounted in the front of the robot allowed for easy turning using tank steering.

Sharp IR sensors were used in the front and sides of the robot to guide the robot and keep it away from the walls. These were mounted using double stick tape. These provide an analog signal which is read by the ADC.

Block Diagram

Custom PCB

This custom PCB is arduino compatible. Instad of arduino's row of female headers, this board provides a row of male RC style headers. Servos and sensors plug directly into the board. A small soldered breadboard area is also provided.

The board also includes an FTDI USB Serial converter and user-selectable 5V/3V3 power supply

Bill of Materials

Description Vendor Quantity Price Each Total
PCB Custom 1 $12.00 $12.00
Servo Wheel Adafruit 2 $4.00 $8.00
Ball Caster Adafruit 1 $4.95 $4.95
Continous Rotation Servo Sparkfun 2 $13.95 $27.90
AA Battery Holder DigiKey 1 $1.16 $1.16
Gyro Adafruit 1 $39.95 $39.95
Light Sensor Acroname 3 $11.00 $33.00
Total $126.96

Download

Download code for the robot