Lab 2 Fall 2023

pdf

School

University of California, San Diego *

*We aren’t endorsed by this school

Course

170

Subject

Aerospace Engineering

Date

Dec 6, 2023

Type

pdf

Pages

7

Uploaded by GeneralFlowerDragon7

Report
MAE 170 [FA23]: LAB 2 Introduction to making observations and providing supported interpretation using Arduinos and oscilloscopes Submit your answers to the questions posed in this lab to gradescope and turnitin via the Canvas course website by 11:59 pm (midnight) the evening before your next lab section. Lab quiz will be at the start of the lab session. Please review lecture and lab instruction prior to arriving in the lab. Learning objectives: LLO1-1: Gain familiarity with the use of an Arduino. LLO1-2: To gain familiarity with the use of: an oscilloscope; a digital multimeter (DMM), a signal generator, and the use of an electronic breadboard. LLO1-4: Be able to identify dimensions of effective presentation of observations and interpretations. 1
MAE 170 [SP23]: LAB 1 IN-LAB: Part I: Introduction to Arduino This component is intended to get you set up with Arduino and familiar with coding in the Arduino Integrated Development Environment (IDE). It will also teach you how an Arduino communicates with a computer through serial communication. The open-source Arduino IDE makes it easy to write code and upload it to the board. It runs on Windows, Mac OS X, and Linux. This software can be used with any Arduino board. The IDE is already installed on laboratory desktops, but if you’d like to install it on your personal machine, refer to the Getting Started page for Installation instructions. View the Arduino lecture videos: Getting started with Arduino (note, some parts of this video are specific to Grove Arduino boards and can be ignored, e.g., no libraries need to be installed), Arduino Lecture 1A and Arduino Lecture 1B . Brief Introduction to the IDE Open the Arduino IDE.The code editor by default contains two blocks of code that need to be present in every Arduino program: setup () and loop () as shown in Figure 1 . The code in between the curly braces after setup is run exactly once when the Arduino is first powered on, and then the code in between the curly braces after loop is then run repeatedly forever. Figure 1: An empty Arduino sketch containing the two default functions: void and loop. 2
MAE 170 [SP23]: LAB 1 Building a “Hello World” Program 1. Unpack your Arduino and connect it to the desktop using the provided cable. 2. Open the Tools dropdown at the top toolbar of the IDE, and ensure that the Board selected is an Arduino Uno . 3. Also in the Tools dropdown, ensure that the proper Port is selected. This may look like “ COM ## ”. a. If you see multiple options and are unsure which is the correct port, unplug your Arduino and see which option disappears. Then plug the Arduino back in and reselect that port. 4. Inside the setup () function, establish a Serial connection to the Arduino at a baud rate of 9600 by using the function Serial.begin (9600); a. Note: every statement must end in a semicolon ( ; ). 5. Inside the loop () function, have the Arduino output the text “Hello World!” over the Serial connection by using the function Serial.println ( “Hello World!” ) ; a. There is a similar function called Serial.print () which we could also use. Feel free to play around with both of these functions to understand how they are different. 6. Click on the icon at the top of the IDE to check your code for errors and compile the code. You can see the progress of the check towards the bottom of the code editor. a. If there is an error, raise your hand, and a TA or instructor will help you. 7. Click on the icon at the top of your IDE to upload the code to your Arduino. You can see the progress of the upload towards the bottom of the code editor. Once the code has been uploaded to the Arduino, it will remember that code until something new is uploaded to the board. a. If there is an error, raise your hand, and a TA or instructor will help you. 8. Open the Serial Monitor by clicking the icon at the top left, by clicking on the option under Tools or by using the keyboard shortcut Ctrl + Shift + M . Ensure that the baud rate in the monitor is set to the same value as our Serial.begin () function - 9600 in this case. You should now see “Hello World!” being constantly printed to the screen over and over. 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
MAE 170 [SP23]: LAB 1 Investigating Baudrate Make the following modifications to the Arduino code 1. Inside the loop () function, but before our Serial.println () command, initialize an integer named “t” to be the current number of milliseconds since the Arduino program started by writing int t = millis (); 2. Inside the loop () function, but after our Serial.println () command, output the difference between the current value of number of milliseconds since the Arduino program started, and the previously stored value, t, by writing Serial.println ( millis () - t); a. This will output the number of milliseconds it took to print our “Hello World” statement over the Serial connection. 3. Upload this modified code to the Arduino, and open up the Serial monitor to see the resulting output, and note the amount of time it took to print “Hello World!”. 4. Modify your Serial.println () function to instead say “Hello my name is [your name]”. Reupload the code, and open the Serial Monitor to see how the time may have changed. 5. Change the baud rate of your Serial connection to 38400 by changing the value of your Serial.begin () function. Reupload the code, open the Serial Monitor (ensuring to match the new baud rate) and see how the time may have changed. 6. Experiment with different strings inside of your Serial.println () in order to find something to print out that takes 25 +/- 2 milliseconds to say. Q1: Take a Screenshot of your code and results from part 6 of the Baud Rate Investigation for submission. 4
MAE 170 [SP23]: LAB 1 Part II: Oscilloscope trainer An oscilloscope is a form of a data acquisition device (DAQ), and is one of the most versatile, useful, and prevalent pieces of experimental equipment available to us as scientists and engineers. It allows you to digitize, characterize, and record signals ranging from quasi-static to high frequency time varying. Throughout the course, we will simultaneously use the oscilloscope and the data acquisition functionality of the Arduino. While these devices are similar in some of their functions, they have distinct advantages: Arduino’s are inexpensive and have relatively low performance and precision, while oscilloscopes are opposite in these aspects. It is important to become proficient with both. This ‘Oscilloscope’ trainer is intended to have you start gaining this proficiency through hands-on practice. Setup: Attach a BNC cable from the waveform generator output port and connector to one channel of the oscilloscope. Unplug any Arduinos from the computer. Power on the Waveform Generator. Turn off the display of your Waveform Generator by pressing the following sequence of buttons: System → System Setup → User Settings → Display Options → Display (Off) . Open the provided ‘Scope Trainer’ app in MATLAB desktop app and click on the Connect button. If the app is not already installed, you can download the app installer from Canvas. Click on the Start button once the Connect signal turns green. Check that the green ‘active’ light on the front of the waveform generator is on. Characterize the signal output from the waveform generator, using the oscilloscope, which is generated by the MATLAB program. Determine the frequency , offset voltage , and peak-to-peak voltage and enter them into the MATLAB app. Your signals will fall within 4.0 Hz - 5.0 kHz, 0-5.0 Vpp, and an offset of +/- 2.5 V. When all identified values are within 10% of the generated signal, a new signal is created. Your task is to identify 5 signals of increasing difficulty. Q2: Identify five signals and take a screenshot of the completed trainer for submission. Comment on the most challenging part of the signal identification. As there are multiple methods to identify the signal characteristics, comment on your preferred method for identifying the signal traits. Your answers should be somewhat thoughtful (e.g. not one line). 5
MAE 170 [SP23]: LAB 1 Part III: Technical writing Three samples of technical writing have been provided to you in the ‘Canvas→Files→MAE 170...→Lab 1→Technical writing’ folder of the files section of the course webpage . These three samples contain a figure with text describing the researcher/engineer’s observations, along with accompanying discussion, and can be viewed as components of larger research or technical paper. For the experiments that are described in the provided writing samples, the researchers were tasked with characterizing the voltage range and resolution of the output channel of a data acquisition system using a digital multimeter. Q3: Critique the three writing samples and compare their efficacy in the context of technical writing learning outcome 1 (WLO1) dimensions discussed in class (and listed on the next page for your reference). Please refer to the grading rubric posted to the course website, as to how your critique will be graded. 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
MAE 170 [SP23]: LAB 1 WLO1: Be able to make observations and providing supported interpretations useful to others in the scientific and engineering community Analysis of data [mostly Results section, potentially some Discussion section]: Methods used for the collection of data (e.g. where the data came from and how it was acquired) are stated in appropriate detail (the reader understands how the data presented was collected; note that procedural information to the level needed for reproducibility is not required [e.g. not a methods section]). The assumptions, relationships, or models used in the analysis are explicitly stated. Observation [Results section]: Contains a description of key trends or values that are readily apparent from the presented, analyzed data (tell the readers what you see). All observations relevant and important for analysis are given. Interpretation [Discussion section]: To the greatest extent possible, all potential explanations or conclusions that can be drawn from the presented, analyzed data, including comparison with theoretical models are specified/considered. The discussion points are accompanied by language that specifies that it is an interpretation, or assertion by the author (e.g. “One possible explanation is this trend means that; This suggests that this phenomena may contribute to these observed effects”). Accurate and thorough scientific/engineering logic is applied to differentiate between the likelihood of possible interpretations. The stated likelihoods are quantitatively supported, using engineering models (e.g. ways certain quantities may vary in existing relationships is presented) and uncertainty analysis. Conclusions drawn provide insights that are likely not obvious to the reader without the provided clarification in your analysis (e.g. the model used makes the argument clear). The points addressed in the discussion section should address your stated knowledge gap. This also helps address “why the reader should care” and the motivation for your experiment. Recommendations for the future may be included and should stem from your stated interpretations and conclusions. Clear statements connecting the used signal processing techniques with their implications for the interpretations and conclusions drawn. Acknowledgements Some elements of the lab instructions have been adapted from prior MAE170 iterations. 7