Lab 02 – Arduino Programming Basics

Lab two introduced the programming side of the AEV project. The program that the AEV uses to run its motors and other various  is arduino, and in this lab the basics of arduino coding were discussed. The written arduino program uses several pre-written functions such as reverse(m) and motorspeed(m,p) which correspond to varying physical results on the AEV motors, and will form the set of sequential instructions which determine the behavior of the AEV.

Executive Summary

In the Arduino Programming Basics Lab, the group learned basic arduino code to use in the operation of the AEV, following the lab manual in the AEV Documents (1). Testing the propellers and writing preliminary code was important in that it strengthened the team’s understanding of key lab requirements and prepared the team for the final phase of the AEV project. This lab introduced arduino coding, utilizing methods created by the Engineering Department. The Arduino Programming Basics Lab included multiple parts. First, the group put together the testing assembly, attaching the motors and propellers to the y-frame and attaching the motors to the arduino.  Next, the problem presented in scenario one was solved using arduino code using commands such as celerate(m,p1,p2,dt), motorspeed(m,p), reverse(m), and brake(m), as seen in Figure 1.  The result of scenario one was functional code, and the group was able to observe the behavior of the motors. Scenario two was completed in much the same way as scenario one, but with a different outcome. Scenario two’s solution included the same basic arduino commands as scenario one’s, but resulted in the playing of what sounded like the Imperial March from the Star Wars Soundtrack.

 

The propellers on the AEV acted differently than the team expected. When the program had the propellers running in a low powered mode, the propellers either did not move or had significant resistance to their movement. This resistance surprised the group as it was not expected that the motors would need to reach a maximum power threshold in order to operate correctly. One instance of this was in the first few lines of the arduino code contained in Figure 1. There were more problems with the propeller’s operations in the first set of code. The second code operated without much resistance at all and met the expectations of the team members. The team can use this new knowledge of the arduino chip and how the propellor resistance works in future labs.

 

Commands used in this lab may limit the success of the AEV in its completion of the objective. Though commands may have a set time limit, this will still not guarantee the same distance travelled due to the spinning of the propellers. Though the command “brake(m)”, shown in Figure 1, cuts the power from the motors, the propellers may still move due to inertia and the AEV will still move even without the power of the propellers, affecting the travel distance of the vehicle. The command “reverse(m)”, also shown in Figure 1, may also impede the performance of the AEV due to the same reasons, as the AEV will not immediately change direction when the propellers change rotation. In order to guarantee the success of the brake and the reverse function, a servo assist will have to be used.

 

Some errors occurred during the lab when the team was trying to complete the scenarios. One error that occurred is that one of the group members entered “power” for motor speed in for an arduino command when it should have been “motorSpeed”. Another error that occurred is that the team did not realize that the commands were case sensitive and the second word in the commands had to be capitalized in order for the program to operate correctly. After these problems were corrected, the programs were successfully completed and run in the lab. The team noticed that the second scenario played out the theme song for Star Wars using the sound of the motors.

 

Overall, the team agrees that the lab procedure in the lab manual was self-explanatory and teams need no further information on how to complete the lab. The guidance from the instructing team helps move the groups even more quickly.

 

During the lab, The team gained some ultimate knowledge from the lab. First, the team now learned how to install and use the software to control the AEV. Second, the team learned how to upload the programs to the arduino and troubleshoot problems after testing the program. Lastly, the team became familiar with the hardware components used for the AEV’s structure. All of this ultimate knowledge is in correspondence with the lab objectives in the lab manual.

 

Appendix

 

Figure 1: Code Sample 1

Code 1

Figure 2: Code Sample 2

Code 1.1

References
“AEV Lab Manual.” Retrieved from https://eedcourses.engineering.osu.edu/sites/eedcourses.engineering.osu.edu/files/uploads/1182/AEVLab/AEVDocuments/LabManual/AEV_Lab_Manual_Rev_2015_08_07.pdf