01 Arduino Programming Basics

 

Week 2

Situation

This week the group’s main goal was to form an understanding of how to create programs to be uploaded into the AEV and run. After downloading the software to create programs the group was given a scenario which they were to create a program for. The program was then created using a set of commands that were provided in the lab manual. Once the program was completed it was ran using the Arduino and the motors from the AEV kit. By performing this lab, the group was better able to understand the process of creating, uploading, and testing software into the Arduino. This is important to the AEV project because the success of the AEV project depends heavily on the ability of the group to create functioning software for the Arduino.

Results & Analysis

Once the program was created and ran the group observed that while the acceleration process was taking place the motors did not begin spinning immediately. Instead the motors made a low noise for a moment before beginning to rotate. This observation would suggest that the blades will not begin spinning as soon as any power is given to the motors. Rather it would appear that there is a threshold power that must be reached before the blades will spin.

As the group began to experiment with and better understand the various commands that would be used they quickly began to see some of the limitations that the different commands have. The most obvious of these limitations is with the brake command. This is because the brake command does not actually break the AEV but simply cuts the power to it. This means that the AEV will continue moving forward until enough time passes for it to slow down.

While creating the code the team was at uncertain about how long it would take for the program to run through each of the commands. It was clear the commands with a time input like celerate or goFor would run for their set times before the program could progress to the next line. With other commands like motorSpeed or brake the group was uncertain of how long it would take for the program to go from one line to the next. Once the program was tested the group realized that if two motorSpeed commands are given one after the other the program will run them virtually simultaneously. The understanding of the timing of different functions in the program will be important later in the project when the timing of various commands become more important.

After creating the code and uploading it into the Arduino, it originally did not work. The group quickly found the source of the issue, which was the fact that the program had not yet been saved into its own tab. Once this was resolved the team once again ran the program successfully. The team had little trouble navigating through the lab but some of the expectations of what was expected for next lab were unclear and could be better clarified.

Takeaways

  • Learned the set of commands to control AEV
  • Learned how programs can be uploaded to Arduino using USB
  • Learned how to connect motors and battery to the Arduino
  • Unless time is input in a command the program runs through commands very quickly
  • Brake command does not actually brake

 

 

Week 3

Situation

Before the lab a prototype needs to be built. Using the AEV documents. First, the wheel count sensor will need to be tested. The reflectance test will be used every week to test these sensors. The two sensors will be attached with nuts and bolts to vertical support arm. The arduino code will then be run and the serial monitor should show number increasing or decreasing by 1 depending on whether cart is moving backwards or forwards. Then it must be oriented and calibrated. These sensors are crucial because they affect/measure the velocity and position.  Next, propulsion efficiency will be dealt with. Group members will need to be familiar with the propulsion efficiency system and the wind tunnel testing equipment. The AEV will also be compared to real life objects for real world application purposes. The last objective is to link the wind tunnel testing to the AEV. We will calculate efficiency using the efficiency equation and measure the power from the wind tunnel test. This is important because all vehicles need to be energy efficient and this vehicle is no exception.

 

Weekly goals

  1. Complete Progress Report for Lab 01.
  2. Chose a Battery Manager and Tool Manager.
  3. Create AEV prototype.
  4. Use the Wheel Count Sensor.
  5. Complete Lab 02.

 

Weekly schedule

Table 1: Week 2 Schedule

Task Teammate(s) Start Date Due Date Time Needed
Regular group meeting All 1/21/16 1/21/16 1.5hrs
Lab 2 Progress Report final draft All 1/21/16 1/25/16
Additional group meeting All 1/24/16 1/24/16 .5hrs
Lab 2 procedure All 1/25/16 1/25/16 2hrs
Regular group meeting All 1/28/16 1/28/16 1hrs

 

 

Appendix

 

Team meeting notes, 12pm-1:30pm, Thompson Library, all members

 

Purpose of meeting: Complete this progress report and create a weekly schedule to determine what needs to be completed in the upcoming week.

 

  • Tasks Completed from the last meeting
    • Students familiarised themselves with the programming of the arduino/AEV. (all members)
    • All members of the group created a program to upload into arduino. (all members)
    • Group set up motors stand and connected motors and battery to arduino. (Axal, Cole)
    • One code was selected and uploaded into the arduino. (Sky, Nick)
    • Gained experience with troubleshooting various problems within the programming of code and uploading of the arduino. (all members)

 

  • Tasks to be completed for upcoming week
    • Complete construction of prototype AEV (tuesday all members)
    • Complete lab 3 and understand the concepts it presents (wednesday all members)
    • Complete a progress report for lab 3 (all members)

 

  • Decisions made by group
    • Weekly meetings will be on Saturday at 12p.m unless otherwise specified(consensus)
    • Additional meeting will be held this tuesday 1/24/16 to complete prototype AEV

 

  • Reflections from previous assignment
    • Only roadblock in last lab was with uploading the program into the arduino. Upload did not work at first due to group error but even when upload was successful the blue light on arduino did not flash
    • No deadlines were missed in previous week
    • No work was substandard, or differing expectations, or other conflicts
    • In future it would be beneficial for the group to look into what is to be complete each lab and then plan who will do what so that the most work can be completed in the lab.

 

Arduino Source Code (with comments):

 

  1. celerate(1,0,15,2.5); //M1 starts at 0% and then increases to 15% in of 2.5 seconds
  2. goFor(1); //Motor one runs at 15% for a span of one second
  3. brake(1); // power to motor 1 is cut
  4. celerate(2,0,27,0); //accelerates motor 2 from 0% to 27% in four seconds
  5. goFor(2.7); //motor 2 continues at 27% for 2.7 seconds
  6. celerate(2,27,15,1); //motor 2 decelerates from 27% to 15% in 1 second
  7. brake(2); //power to motor 2 is cut
  8. reverse(2); // the direction that motor 2 turns is reversed
  9. celerate(4,0,31,2); //all motors accelerate from 0% to 31% in 2 seconds
  10. motorSpeed(4,35); // all motors run at 35%
  11. goFor(1); //motors run at 35% for 1 seconds
  12. brake(2); // power is cut to motor 2
  13. goFor(3); // motor one continues running at 35% for 3 seconds
  14. brake(4); //cuts power to all motors
  15. goFor(1); //motors stay with power cut for one second
  16. reverse(1); //reverses the direction that motor 1 turns
  17. celerate(1,0,19,2); // accelerates motor 1 from 0% to 19% in 2 seconds
  18. motorSpeed(2,35); // motor 2 runs at 35%
  19. goFor(2);// motor 2 runs at 35% and 1 runs at 19% for 2 seconds
  20. motorSpeed(4,19); // both motors run at 19%
  21. goFor(2); //motors run at 19% for 2 seconds
  22. celerate(4,19,0,3); //motors decelerate from 19% to 0% in 3 seconds
  23. brake(4); //cuts power to all motors