Arduino Code

The AEV depends on a set of code in order to run. This program is created using the Arduino compiler, which contains a variety of unique commands that send instructions to the device. Some of these commands include changing motor speed, reversing motor polarity testing the motion sensors, or cutting all power to the system. Below are some of our test runs for the AEV project, along with the results of these tests.

TEST 1:

AEV_Test_1

This was our first test, which was performed using time limits rather than mark measurements. This test was used simply to ensure that the motion sensor wheels were secured properly, to test the balance of the AEV, and to test the efficiency of varying motor speeds. Following this test, the motion sensors were removed and remounted, and multiple adjustments were made to the AEV to evenly distribute its weight.

 

TEST 2:

AEV_Test_2

This was our first attempt at using mark counters to move the AEV. Despite our confidence, this test was considered a failure. Rather than going to its desired distance, the AEV continued to accelerate until we caught the device and manually turned it off. This was due to a simple coding fault, in which a negative sign was not included when it should have been. This was corrected in the next trial.

 

TEST 3:

AEV_Test_3

This simple test was performed to double check that the aforementioned fault was a correct assumption, and it was. The AEV moved properly, which allowed us to begin creating our final code.

 

FINAL CODE:

Although it was incomplete, our final code took into account both of our previous tests and forged them into one ultimate program. This program follows the instructions described on the Overview page, but has a few shortcomings that are worth describing.

The first issue with our code came about with Stop #1. This stop was supposed to occur in the center of the first section just after the curve in the middle of the track. Instead, the AEV stopped at the very end of the aforementioned section. With just a small tweak to the mark count, this stop would be perfect.

The second issue arose with Stop #2, which had a similar issue. Rather than stopping in the middle of the slope (the downwards slope just after turning around at Alaska Glacier Station), the AEV + Cart stopped at the bottom of the slope. This would have also been perfected with a quick alteration.

The third (and most complicated) issue was found while attempting to climb the second slope (on the way to Grand Canyon Station before dropping off the cart). The AEV went up the first half of the slope, but then came to an unintentional halt. This lack of momentum could be fixed in two different ways.

The first method would be to change how the motors were activated following Stop #3. In our final version of the code, a celerate command was used to accelerate motor speed from 20% power to 37% power over the course of three seconds. This was to prevent the propellers from coming loose in a sudden jolt of power, as a slow transition to a higher speed would induce less trauma to the hardware. Had an instant jolt to 37% power been implemented instead, however, the AEV likely would have made it up the slope.

The second method would simply be to set the motors to accelerate from 20% power to 40% power, instead of 37% power. This extra boost in power likely would have given the AEV just enough power to get up the crest of the slope.

The final issue was, coincidentally, with the final stop. The AEV was supposed to return to its initial position, but in our final run, the AEV stopped one to two feet past this position. To come to its final halt, we reversed the polarity of both motors and applied a gentle force backwards while the cart glided back down the final slope. Had we applied this backwards force sooner, the cart likely would have stopped on the desired point.

Below is our final version of the Arduino code, despite it being unsatisfactory.

FinalCodeAEV