Lab 4 – External Sensors

During Lab 4 we became familiar with the installation and functioning of the reflactance sensors used in the AEV project. Theses sensors are an extremely important component of this project since they allow for measurement of distance which we can use with time measurements of the Arduino to calculate speed. This presents us with a method for comparing energy input to energy output, and therefore the efficiency of our vehicle. As well, the reflectance sensors allow for us execute commands based off of the vehicles position on the track, whereas the commands learned in Lab 2 provided functions that were executed for a period of time. We learned the Ardunio syntax for these new commands and ensured we had correctly installed the sensors by runnning the reflectance sensor test. A copy of the Executive Summary is provide below:

Lab 4 Executive Summary

Michael Ahlbeck-Fetch, Chenchao Jin, Thinh Tran, Bolong Zhang                                Lab 4: External Sensors

Group J – Instr. Kadri Parris, GTA Hossein Qarib                                                                     February 5th, 2015

Executive Summary

The External Sensors lab was completed with the goal of becoming familiar with the reflective sensors that will be used as part of our AEV design. Specific goals and objectives included: mounting and testing sensors for orientation, writing out the code for the track test as specified in the lab guidelines, testing the code on the table track, and testing the code on the overhead track. The AEV design was not changed from the one used in concept scoring in Lab 3. The AEV’s arm did not have countersunk holes for the external sensor mounts. Countersink drill was utilized to prepare arm for sensor mounting. External sensors were mounted onto arm with the provided screw and nut. Zip ties were not applied yet. The arduino microcontroller was than uploaded with the function reflectanceSensorTest() which was tested on the table. The sensors’ mark output was negatively oriented with respect to the direction of travel. Error was resolved by swapping sensors.

 

Microcontroller script file was written as specified in the lab guidelines for inner track run and uploaded to arduino. Code was tested on the table track with expected results. The AEV was brought to the overhead inner track and the same code was executed. The motors’ thrust was insufficient to produce motion. The script file was edited with a 5% increase to power to the first two calls of the function motorSpeed(). Updated code was uploaded to arduino and the file was executed on the inner track. The AEV traveled along the track at 30% power for 2 seconds and then 25% power until it traveled a total of 13.5 feet. It then ran the motors in reverse at 30% for 1 sec. The negative thrust was not sufficient to completely stop the AEV and it lightly tapped the gate before coming to rest. A copy of the code used can be found in the Appendix under Arduino Code.

 

In the previous lab the AEV’s motion along the track was more difficult to control and predict. Without a measurement of distance traveled, all functions relied on time alone. This makes stopping at the gate more difficult. With use of the reflective sensors, distance traveled can be accessed and used as flow control for other function calls. In Lab 4, the vehicle’s distance traveled was called with the function goToAbsolutePosition() to more accurately stop. Considering the Mission Concept Review document, preliminary coding of the scenario would flow as follows:

 

  1. Accelerate motors to running speed and traveling for a distance just short of station two using the functions celerate(), motorSpeed(), goFor() and goToAbsolutePosition().
  2. Stop before the gate using the functions reverse(), motorSpeed(), and goFor().
  3. Brake for time interval of gate operation using the functions brake() and goFor().
  4. Accelerating motors to running speed and traveling for a distance just short of station three using the functions celerate(), motorSpeed(), and goToAbsolutePosition().
  5. Decelerate to near zero speed using the functions reverse(), motorSpeed(), and goFor().
  6. Cease motor operation to allow magnetic caboose to attach using the functions brake() and goFor().
  7. Accelerate motors while still in reverse to a distance just short of station two using the functions celerate(), motorSpeed(), goFor() and goToAbsolutePosition().
  8. Stop before the gate using the functions reverse(), motorSpeed(), and goFor().
  9. Braking for time interval of gate operation using the functions brake() and goFor().
  10. Accelerating motors to running speed and traveling for a distance just short of station one using the functions celerate(), motorSpeed(), and goToAbsolutePosition().
  11. Stop at station one using the functions reverse(), motorSpeed(), and goFor().

 

Stopping the AEV via the reverse() and motorSpeed() functions needs to be contrasted against coasting the AEV into stops via the brake() function, primarily as a consideration of energy efficiency. Similarly, the percent power capacity argument of the motorSpeed() function may need augmentation to facility efficient energy consumption. Its also recommended to perform testing to ensure celerate() and motorSpeed() functions produce similar results once caboose is attached. The function arguments may be quite different during the return trip from Station 3 to Station 1 considering the change in the total weight.

 

Completion of Lab 4 produced the desired familiarity with the external sensors and insights into their functionality as required for the overall design project. The sensors will greatly help in facilitating the scenario as described in the Mission Concept Review. They have been mounted on the group’s AEV and have past basic testing to confirm they are functioning properly as mounted. They provide an accurate measure of distance that will be referenced within the arduino script file to appropriately stop at each station.

 

Appendix

Arduino Code

 

// Reverse all motors due to motors orientation.

reverse(4);

 

// Run all motors at 30% for 2s

motorSpeed(4,30);

goFor(2);

 

// Run all motors at 25% to 13.5ft

motorSpeed(4,25);

goToAbsolutePosition(332);

 

// Reverse all motors

reverse(4);

 

// Run all motors at 30% for 1 s

motorSpeed(4,30);

goFor(1);

 

// Brake all motors

brake(4);

Leave a Reply

Your email address will not be published. Required fields are marked *