ME348_S24_Lab1 (1)

docx

School

Pennsylvania State University *

*We aren’t endorsed by this school

Course

348

Subject

Mechanical Engineering

Date

Feb 20, 2024

Type

docx

Pages

23

Uploaded by BarristerSnowManatee27

Report
ME 348: Circuit Analysis, Instrumentation, and Statistics Lab 1 Getting Familiar with the Essential Lab Equipment Instructions for Completing this Lab: Please answer each question completely, showing all work as necessary. Any steps in the lab that require answers from you begin with the number of points in parentheses, highlighted yellow. You may type your answers into this document, use a tablet to write in your answers, or insert pictures of written work into the spaces provided. The most important thing is that your answers can be easily read/comprehended. Please follow all of the guidelines shown in the formatting guidelines document provided on Canvas. If pictures are requested, take a picture with your phone and insert it into the space provided if possible. Otherwise, include your picture in a clearly labeled Appendix. Remember to use figure captions. You need to include properly formatted Excel/MATLAB plots as requested. However, you do not need to include the data used to make these plots unless explicitly requested. After all of the answers have been entered, save this document as a PDF for submission to Canvas. You can delete the Introduction, Background, and Prelab if you desire, but this is not required. Attach a completed Lab Cover Sheet (provided below) to the front of your submission. Make sure to include all the documents requested, as appropriate. Only one person (designated by the team on the submission cover sheet) should upload the final submission to Canvas on behalf of the team. Questions regarding the completion of this lab should be directed towards your lab section TA on Canvas, with the course instructor included on the message as well.
Activities: 1. Oscilloscopes and Function Generators 2. Multimeters 3. Pushbutton Switch and Testing Continuity with DMM 4. Introduction to Arduino and Arduino IDE 5. Arduino Analog and Digital Read Learning Objectives: After completing this lab, students will be able to: Use a digital multimeter for static measurements of resistance and voltage Generate a periodic signal (e.g., a sine wave) with a function generator Use analog oscilloscopes, digital oscilloscopes, and computerized digital data acquisition-based virtual instruments for dynamic measurements of voltage and data logging Understand how to connect electrical components to a breadboard Set up an Arduino Uno to perform simple commands Program an Arduino Uno with MATLAB Introduction and Background: The intent of this first lab is to introduce students to some of the equipment in the Arduino student kits that will be used throughout the course, and to give them practice using these elements. Almost every lab exercise involves electronic instruments of some kind. In most cases, a voltage, current, or resistance must be measured and converted to a quantity of interest in the experiment (such as temperature, intensity, etc.). The key to a successful lab experience is to become familiar with the function and operation of the laboratory components and equipment. Instruments are available for both static and dynamic measurements. Static measurements are appropriate for parameters that are either constant or changing very slowly, such as the resistance of a resistor or the temperature in a room, respectively. These measurements can be done with a digital or analog readout in which only the time-averaged (mean) value is required. Oscillations around the mean may exist but may not be relevant to the measurement. In this lab, a digital multimeter (DMM) is used for static measurements. Depending on the brand and model, multimeters can measure voltage (both AC and DC), current, resistance, and sometimes capacitance as well as inductance. Dynamic measurements are necessary for time-varying parameters. For example, the stress and strain experienced by a vibrating beam oscillates in time with some frequency, and the amplitude of the oscillation decays with time. A multimeter would be of little use in this situation. Instead, an oscilloscope (or sometimes just “scope”) is used for such dynamic measurements. Digital oscilloscopes digitize and save the signal(s) so that better quantitative analysis is possible. Digital scopes use digital electronics, which require use of an analog-to-digital converter. A digital oscilloscope enables the user to move a cursor along the trace and read the voltage and time values numerically. This is often very convenient for estimating the amplitude or frequency of a periodic signal. In most cases, digital scopes provide Page 2 of 23
some kind of connection so that stored data can be directly transferred to a computer for further analysis. Since the 1980s and 90s, a new type of instrument has become ubiquitous for laboratory use in digital data acquisition via a computer. The graphical resolution and size of a computer monitor, as well as the storage capacity of PCs, are much better than those of a typical digital oscilloscope, and thus very attractive virtual instruments have been created for use with the computer. With graphical programming software such as LabVIEW, and with programs like MATLAB/Simulink, the computer can be programmed to function as a multimeter, oscilloscope, spectrum analyzer, or almost any other electronic instrument, and the computer display can even be made to look like the instrument it is simulating. An obvious advantage for the computer is its flexibility. State of charge (SoC) is the level of charge of an electric battery relative to its capacity. SoC is usually expressed as percentage (0% = empty; 100% = full). An alternative form of the same measure is the depth of discharge (DoD), calculated as 100 SoC (100% = empty; 0% = full). SoC is normally used when discussing the current state of a battery in use, while DoD is most often seen when discussing the lifetime of the battery after repeated use. Equipment: Your kit comes with several parts and components that you will use to build circuits as you will complete lessons and projects throughout this course. Here is a brief description of what is included in your kit: Arduino UNO – This is the microcontroller development board that will power, control, and digitize data from your circuits as we go along this semester. In 2005, the Interaction Design Institute Ivrea in Ivrea, Italy started the Arduino project to create a low-cost and user-friendly device that can control sensors and actuators. An Arduino is a single-board microcontroller. This is essentially a very small computer with a processor and sets of digital and analog input/output (I/O) pins that may be interfaced to various expansion boards ('shields') or breadboards and other electronic components or circuits. This allows users to create and program customized digital devices. In this class, we will learn two methods to program the Arduino board, (1) using the open-source Arduino Software (IDE) and (2) programming with MATLAB. Jumper Wires & Power Leads – Used to connect components to each other on the breadboard and Arduino board. Figure 2. Jumper wires and power leads Page 3 of 23 Figure 1. Arduino Uno board
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
A B Short bus R 2 R 1 Pushbutton – A pushbutton is a switch that closes the circuit when pressed. When released, the circuit becomes open again. Pushbuttons are used as input devices and allow the Arduino board to detect on/off signals. Breadboard – Engineers often use a breadboard to quickly build prototypes of circuits for testing. A breadboard has a series of holes or sockets into which jumper wires are inserted to make electrical connections. The wires are easy to connect and disconnect; thus, circuits wired on a breadboard are quickly and easily modified. Some of the sockets are hard-wired to other sockets, forming a bus . Breadboards have both short buses (typically containing 5 sockets) and long buses (typically running the full length or width of the breadboard and containing many sockets, often also in groups of 5). Short buses are used for component connections, in which two to five wires may be connected to one short bus. Long buses are generally saved for high-usage connections, such as a DC voltage power supply or ground (zero volts). A bus used as ground would, for example, be called a ground bus . Engineers should be familiar with the way the breadboard is internally wired before using the breadboard to create prototype circuits. Components, such as resistors, capacitors, and diodes can be inserted directly into the sockets. An example of how the leads of a resistor can be inserted directly into the breadboard is shown here. Clusters of 11 short buses are shown on the top and bottom, each containing 5 sockets, aligned vertically and indicated by the red rectangle that encircles them. These 5 sockets are connected to each other , but not to any other sockets. Resistor – A resistor is a component that resists the flow of electrical energy. As a result, resistors can change the voltage and current in the circuit. Resistor values are measured in ohms (represented by the Greek letter omega: Ω). The colored stripes on the resistor indicate its resistance value and tolerance. Familiarize yourself with these color codes (e.g., the Wikipedia article here may be a good starting point). The equation for calculating the percent error of the resistance reading is: Page 4 of 23 Figure 3. Pushbutton schematic Figure 4. Breadboard schematics with connected resistors Figure 5. Examples of resistors with different resistances
Percent Error ( % ) = | theoretical measured theoretical | where measured is the value measured with the multimeter and the theoretical is the one you will calculate using the voltage divider equation. Digital Multimeter (DMM) – The digital multimeter (DMM), or just multimeter for short, is a multifunctional measurement unit used frequency in circuit analysis and testing. DMMs may vary slightly from one unit to the next, but they are often capable of measuring at least the following: Voltage (common) Current (common) Resistance (common) Continuity (common) Capacitance (sometimes) Temperature via thermocouple input (sometimes) Transistor tester (sometimes) Watch the following video to learn the basics of how to use a digital multimeter (DMM): Digital Multimeter . Note: There are many different types of multimeters. The main difference between that in your kit and those in the video is that your “overflow” message is simply a “1.” If you get a reading of exactly 1, increase the range. Potentiometer – A variable resistor with three pins. Two of the pins are connected to the ends of a fixed resistor, while a third (sometimes referred to as the ‘middle’ or ‘wiper’ pin) is connected in such a way that it moves across the length of the resistor, essentially ‘tapping’ the primary resistor at a variable spot and dividing the resistor into two parts. Potentiometers are sometimes referred to as ‘pots’ and are used in this way to adjust the voltage in a circuit as both a means of control, as well as a sensor input. An example of a pot is the volume knob on an older radio. Project Board: The project board is a precut plastic base that combines the Arduino board and breadboard into one piece of hardware. The project board makes building circuits easy by securely holding the circuit close to the microcontroller. If you haven’t already assembled your project board, these instructions will help you do so. A. To build the project board, locate the plastic sheet. B. Carefully separate the pieces. After the pieces are separated, place Parts B, C, D, and E back into your kit. You will not need these pieces for the lessons in this course. These pieces are used for Page 5 of 23 Figure 6. Multimeter from Arduino kit Figure 7. Potentiometer drawing
projects in other Arduino books and courses. C. Attach the four Part A pieces into the holes in the corners of the base. This creates feet to hold the base up off the table. D. Your kit has three bolts that hold the Arduino board to the base. Start by removing the plastic base from the Arduino. Then insert each bolt through the Arduino board and then through the base. Use three provided nuts to hold the bolts in place. Be careful not to overtighten the nuts. E. Carefully peel the backing from the breadboard. F. You will attach the breadboard to the plastic base next to the Arduino board. First arrange the breadboard so that hole 1a is near the reset button on the Arduino board. When it’s in position, stick the breadboard to the plastic base. Lab Circuit Description/Primer In addition to familiarizing yourself with and using various pieces of laboratory equipment, this lab will introduce a useful circuit (voltage divider) and a component that can be used to make a variable version of it (potentiometer). Voltage Divider – As discussed in lecture, the voltage divider (schematic to the right) is a simple circuit that “steps-down“ the voltage supply (V in ) to some lower output level (V o ). Based on the choice of values for the two resistors, R 1 & R 2 , the output Vo can be set to a certain value according to the following equation: V o = R 2 R 1 + R 2 V ¿ As an example, if a sensor requires a supply voltage of 2 V to function properly and all you have is a 5 V source, you could choose values of R 1 and R 2 such that the potential difference across R 2 (V o ) is 2/5 of the 5 V supply (V in ). Potentiometer as a Voltage Divider – In this lab, we will use a potentiometer as a compact, variable voltage divider together with an Arduino. Referring to the schematic above for the voltage divider, think Page 6 of 23 Figure 8. Instructions to put together project board Figure 9. Circuit drawing for a voltage divider
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
of the ‘wiper’ in the potentiometer as the point that divides the total resistance of the potentiometer (10 kΩ for the ones in the kit) into two separate resistances, R 1 and R 2 , between the ‘wiper’ pin and the other two connections/pins. As the knob of the potentiometer is turned, the values of R 1 and R 2 will change in such a way that as one of them increases (say R 2 ), the other will decrease (say R 1 ). If the potentiometer is wired such that an input voltage (V in ) is connected across the non-wiper pins, the voltage output (V o ) from the potentiometer-based voltage divider is directly proportional to the value of R 2 . When R 2 is approximately zero, the output voltage is zero, and when R 2 is at its maximum, the voltage output from the potentiometer equals the input voltage; just as expressed in the voltage divider equation above. Lab Safety: You must follow all safety procedures outlined here and in the lab manuals themselves. Safety requirements for all labs include (but are not limited to): No food or drinks should be in your work area. Do not wear loose clothing or jewelry. Tie back long hair. Turn off the power supply to the Arduino or circuit when reconfiguring its wiring. Do not rest electronics on a conductive table or surface. Discharge any buildup of static electricity in your body before touching metal components. Avoid workspaces and clothing that are prone to building static charge (e.g., carpeted floor). Double check the polarities of any connections you make. Keep a consistent wiring color code. A typical convention would be to use red for power and black for ground, however the ability to use that may depend on the colors/numbers of wires in your kits. Connect and test one small part at a time as you build complex circuits. Only work where a functional fire extinguisher is nearby and know where that fire extinguisher is. Don't put cords where people can trip on them. Be careful what you touch while troubleshooting. Arduinos usually don't deal with very high voltages, but inductors and capacitors can build up high charges. Be sure to safely discharge any capacitor after use. Page 7 of 23
ME 348: Circuit Analysis, Instrumentation, and Statistics SUBMISSION COVER SHEET: LAB NUMBER _________ DATE COMPLETED _________ TEAM ROSTER SECTION #: _________ TEAM #: ________ MEMBER #1: MEMBER #2: MEMBER #3: TEAM MEMBER UPLOADING FINAL LAB REPORT TO CANVAS IS ________________________________ Checklist: MUST be completed to receive full credit ¨ ¨ Calculations: o Units included in all calculations o Appropriate number of significant digits reported ¨ Correct spelling and grammar throughout ¨ Tables: o Numbered caption above each table o All columns labeled, including units if appropriate ---------------------------------------------------------------------- ¨ Figures: o Numbered caption below each figure o Data points only connected if appropriate for the context o All axes labeled, including units if appropriate o Legend included if more than one set of data plotted o Axis limits chosen to minimize white space o Reasonable divisions for axis units o Horizontal axis aligned at the bottom of the figure FOR GRADER USE: Lab Participation Grade and Deductions : The instructor or TA reserves the right to deduct points for any of the following, either for all group members or for individual students: Arriving late to lab or leaving before your lab group is finished Not participating in the work of your lab group (freeloading) Causing distractions, arguing, or not paying attention during lab Not following the rules about formatting plots and tables Grammatical errors in your lab report Sloppy or illegible writing or plots (lack of neatness) in your lab report Other (at the discretion of the instructor or TA) Name Reason for deduction Deduction amount Individual grade Page 8 of 23 TOTAL GRADE _____ / _80 __
Lab #1 Procedures & Questions Part 0: Team Introductions and Communication 1. Exchange contact information with your team and decide on the preferred mode of communication (e.g., email, text message, MS Teams, WhatsApp, Discord, etc.). Part 1: Oscilloscopes and Function Generators For this section, you may wish to review the video on the Function Generator and Oscilloscope from the prelab. 1. Connect the function generator to the digital oscilloscope . Vary the frequency of the output wave, the DC offset, and the amplitude. Note : On some function generators, the DC offset knob must be pulled out or pushed in to be activated . 2. Watch the waveforms on the oscilloscope as the frequency, amplitude, and DC offset of the function generator are adjusted. Turn the various knobs on the oscilloscope to become familiar with the time scale, trigger, and voltage scale adjustments on the oscilloscope. Switch between a sine wave, rectangular wave, and triangular wave – the oscilloscope should correctly display the generated waveform. 3. Set up this standard case with the function generator: A sine wave of 100 Hz, with peak- to-peak voltage about 6 V, and with nearly zero DC offset. Record the frequency displayed by the function generator. 4. (5) Include a picture below of the oscilloscope display. Once you are done, scramble the amplitude and frequency knobs for the next lab group. Note: A warning about the digital oscilloscopes in the lab: For our purposes, it is important to not push the “Default Set-Up” button . Pressing this button results in the oscilloscope being reverted back to factory settings, with a default amplification of 10X for all output signals. (For instance, you will read 98 V instead of 9.8 V.) If you are seeing a factor of 10 showing up like this, here are the steps to correct it: Push the “1” button to access Channel 1. (If you cannot see this option, press the “1” button again.) On the right-hand menu, an option should read “Voltage 1X”. If so, then this channel is okay. But if it shows “Voltage 10X”, then you know there is a problem. By pushing the button on the oscilloscope that is next to that option, you can cycle through the different amplifications. Once you reach 1X amplification, stop. The voltage amplification for Channel 2 can be changed in the same manner as Channel 1. If Channel 1 has the wrong amplitude, it is to assume that Channel 2 is wrong as well. Please change Channel 2 even if you are not using that channel this lab. This will save future headaches on upcoming labs. For all labs, the amplification should be set to 1X (no amplification) for all channels. Therefore, you should always check that the amplification is 1X on all channels . If you are viewing results Page 9 of 23
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
that are off by a magnitude of ten, you should check the amplification by following the steps outlined above. This will be extremely important for future labs. Part 2: Measuring Resistance and Voltage Using the Digital Multimeter (DMM) Materials: Digital multimeter (DMM) & test leads Resistors in the Arduino Student Kit A battery (could be the 9V battery with your Arduino Student Kit) 1. Watch the following video to learn the basics of how to use a digital multimeter (DMM): Digital Multimeter . Note: There are many different types of multimeters. The main difference between that in your kit and those in the video is that your “overflow” message is simply a “1.” If you get a reading of exactly 1, increase the range. For this part, only use the provided multimeters on the work tables, but pay attention, since they have automatic voltage and resistance ranges, so they may need to be adjusted. 2. Using the resistor color band codes discussed previously, identify the (nominally) 220 Ω resistors. Note: Some resistors have 4 bands (two significant figures, a multiplier, and a tolerance), and some have 5 bands (three significant figures, a multiplier, and a tolerance). Be sure to account for this whenever you use the color codes. Select one resistor and measure its resistance. Experiment with the range setting on the instrument, paying particular attention to the number of decimal places displayed for each range. 3. (6) Which range would give the highest number of decimal places when measuring a 220 Ω resistor? A 2.2035 kΩ resistor (note kΩ meaning “kilo-Ohm”)? A 22.035 kΩ resistor? Give your answers and discuss your reasoning in the space below. 4. Using the resistor color band codes discussed previously, identify each of the 5 types of resistors in your kit (220 Ω, 560 Ω, 1 kΩ, 4.7 kΩ and 10 kΩ) and put them in groups. This resistor color code calculator ” may come in handy. Each group member should use the DMM to measure the resistances of each resistor and report the average value for each resistance for entry into the table below (if there’s only one measurement/resistor, that’s the value you report). Once all members have reported a value, calculate the overall average in the appropriate table cell (you can copy/paste your data into MATLAB or Excel to perform these calculations quickly). Experiment with the range setting on the DMM to maximize the number of decimal places displayed. - Reported Averages Nominal Value 220 Ω 560 Ω 1 kΩ 4.7 kΩ 10 kΩ Team Member #1 Page 10 of 23
Team Member #2 Team Member #3 Overall Average 5. (4) Use the DMM to measure the voltage output from any charged small household battery (e.g., AA, AAA, 9-volt). Write down the type of battery and the measured voltage. 6. (4) The voltage of a battery typically decreases as it is drained. Based on your measurement, is your battery nearly full, nearly empty, or somewhere in between? You may use the Internet to help you, but be sure to cite your references. 7. Now experiment with the voltage range setting on the multimeter that came with your Arduino kit. Pay particular attention to the number of significant digits displayed for each range. 8. (6) Which range would give you the highest number of decimal places when measuring a 10 mV supply? A 1 V supply? A 10 V supply? Give your answers and discuss your reasoning in the space below. If needed, repeat Question 2. Page 11 of 23
Part 3: Pushbutton Switch and Testing Continuity with DMM In this section we will use the “continuity tester” setting of the DMM to map the connections of a pushbutton switch. Pushbutton – A pushbutton is a switch that closes the circuit when pressed. When released, the circuit becomes open again. Pushbuttons are used as input devices and allow the Arduino board to detect on/off signals. Materials: Digital multimeter (DMM) & test leads Pushbutton from the Arduino Student Kit Breadboard 1. The continuity tester (see photo at right with wheel rotated to red diode/audio symbol) is a great tool for determining whether or not two points are connected via a low-resistance path (“short-circuit”) or not connected at all (“open- circuit”). If the two points under test are “short- circuited”, then the meter will make an audible tone/beep to let you know without having to look up from the circuit (very convenient). 2. To connect the pushbutton, orient the button so that the XYJ text in the picture goes across the gap of the breadboard. The two pictures help to demonstrate the correct orientation. Page 12 of 23 Figure 10. Needed material for Pushbutton activity Figure 11. Continuity tester setting
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
3. ( 6 ) Using the continuity tester, determine and sketch the connection diagram for the pushbutton switch (i.e., identify which pins either are or are not connected to each other when the switch is both open and closed). Be sure to test each pin-to-pin combination carefully, both while pushing the button and while not. Insert two sketches below—one for when the switch is pressed, and one for when it is not pressed. Ensure that the orientation of the pushbutton is clear in your sketch. Page 13 of 23 Figure 12. Pushbutton connectors Figure 13. Pushbutton on breadboard
Part 4: Introduction to Arduino and Arduino IDE: Blink an LED Materials: Arduino Uno board Arduino IDE software 1. Connect the Arduino Uno to the computer using a USB cable. You should see a green LED labeled “ON” light up. An additional yellow light may light up on the Arduino. It’s very important to firmly plug the cable into the Arduino port. If the cable is only partially connected, then the Arduino may still light up but be unable to communicate with your computer. Figure 14. Necessary materials for Blink an LED activity 2. Open the Arduino software. 3. Select your Arduino Uno board by selecting Tools Board: Arduino Uno. Page 14 of 23
4. Select the Port by selecting Tools Port The correct USB port (names vary by computer, but often COM3). Page 15 of 23
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
5. Load the file Blink.ino. Select File Examples 0.1Basics Blink . You will see the code pictured below. As noted, the ‘setup’ function initializes variables and the ‘loop’ function runs continuously. 6. Hit Upload (as shown below). When the upload is complete, the code you just uploaded should cause the internal LED (the yellow light) on the Arduino to blink at one second intervals. 7. (4) Re-examine the code. Change the delay time from 1000ms to 500ms so that the Arduino’s internal LED blinks every 0.5 seconds and attach a screenshot of your code. 8. Unplug the USB connection to the Arduino. 9. This is just a basic introduction to the Arduino IDE. We will look into the code further in other labs throughout the course, but feel free to play with any of the other demo codes in the Arduino IDE! Page 16 of 23 Loop function: Repeats continuously and can be programmed with “if” and “for” statements to allow the program to respond to different conditions. Setup function: Initializes variables, pin modes, etc.
Part 5: Arduino Analog and Digital Read Materials: Arduino Uno board Arduino IDE software 10kΩ potentiometer 1. A diagram of an Arduino Uno board has been provided in the Lab 1 folder on Canvas. Open it and review the pin connections. 2. Identify the 10kΩ potentiometer from your Arduino Student Kit. You may need to connect the turning shaft to the potentiometer if this is the first time using the potentiometer. By turning the shaft from one direction to the other, the resistance of the potentiometer changes from 0Ω to 10kΩ. A pin diagram of the potentiometer is provided below. 3. Watch the following video on breadboarding: Breadboarding . Note: Orientation of the breadboard matters. We will examine the breadboard in Lab 2, but not following the instructions carefully could fry your hardware. 4. Connect the potentiometer to the Arduino with the following steps. Be careful not to push the potentiometer too hard into the breadboard or the pins may break. Note: Always disconnect the Arduino from its power source (laptop or computer) before breadboarding or wiring. Page 17 of 23 3 2 1
4.1 Place the potentiometer on the breadboard, such that each pin is in a different bus. Specifically, each pin should be in a differently numbered row and the potentiometer should span the small gap from e to f. 4.2 Connect a jumper cable between port A0 on the Arduino and Pin 2 of the potentiometer. 4.3 Connect a jumper cable between the ground (GND) on the Arduino and Pin 3 of the potentiometer. 4.4 Connect a jumper cable between the power (5V) on the Arduino and Pin 1 of the potentiometer. 4.5 Similar to a multimeter, The Arduino’s A0 port measures an analog voltage relative to its ground (in this case, it will measure the voltage V 0 from the voltage divider schematic in the introduction). However, there are two key differences from a multimeter. First, the Arduino can only read a much more limited range of voltages —in this case from 0 V to 5 V. Second, the raw value that the Arduino will send to your computer will not be the measured voltage directly, but instead a number from roughly 0 to 1000 that changes in proportion to the measured voltage. We’ll see this raw value next. Following that, we’ll use a different set of code that converts the raw value to a voltage. 5. Reconnect the Arduino by plugging in the USB to the computer. 6. With the Arduino software open, open the sample AnalogReadSerial file by clicking Examples Basics AnalogReadSerial (as shown below). Page 18 of 23
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
7. Examine the sample code (shown below), and when ready, upload the code to the Arduino. 8. Open the Serial Monitor by clicking Tools Serial Monitor . Page 19 of 23 Loop function: Reads the analog input and prints the output to the Serial Monitor every 1 millisecond.
9. This monitor prints the readings in real time. To get a more visual depiction, close the Serial Monitor and open the Serial Plotter by clicking Tools Serial Plotter . 10. (3) Turn the dial of the potentiometer to view the effect that changing the potentiometer has on the analog readings. Note the maximum and minimum values. What is the serial value range? 11. Close the Serial Plotter. 12. Open the sample ReadAnalogVoltage file by clicking Examples Basics ReadAnalogVoltage and examine the code shown below. 13. Upload the code to the Arduino. This may take a few seconds. 14. Open the Serial Plotter by clicking Tools Serial Plotter . 15. (3) Turn the dial of the potentiometer to view the effect that changing the potentiometer has on the analog readings. Note the maximum and minimum values. What is the voltage range? 16. Use your multimeter to measure and record the voltage between Pin 2 and Pin 3 when the potentiometer is somewhere between the high and low values. Confirm that this matches the value shown in the serial monitor. Page 20 of 23 Loop function: Reads the analog input, converts it to a voltage, and prints the output to the Serial Monitor every 1 millisecond.
17. (4) Using the voltage divider equation in the introduction, calculate the resistance of the potentiometer at its current position. Do not move the knob on the potentiometer until the resistance is measured below. Show your work below . 18. Close the Serial Plotter. 19. Disconnect the Arduino from the computer by removing the USB connection to the computer. 20. Temporarily remove the jumper cables from the breadboard, but do not move the knob on the potentiometer. 21. (4) Now measure the resistance of the potentiometer using your multimeter. Calculate the percent error of this reading (percent error is calculated as the ‘Theoretical’ value minus the Measured’ value from 17, divided by the ‘Theoretical’ value). 22. Reconnect the GND and 5V jumper cables to Pin 3 and Pin 1 of the potentiometer, respectively, and connect a jumper cable from Pin 2 of the potentiometer to Digital Pin 2 of the Arduino. Note: Digital Pins and Analog Pins function very differently, even though both are measuring voltages. While Analog Pins read values from an analog signal (we’ll cover this more later in the class), Digital Pins can only give two values – either a 1 that corresponds to ‘ON’ or ‘HIGH’, or a 0 that corresponds to ‘OFF’ or ‘LOW’. For your Arduino Uno, input voltages around 5 V will be read as ‘HIGH’ and input voltages around 0V will be read as ‘LOW’. 23. Reconnect the Arduino by plugging in the USB to the computer. 24. Open the sample DigitalReadSerial file by clicking Examples Basics DigitalReadSerial and examine the code shown below. Page 21 of 23
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
25. Upload the code to the Arduino. 26. Open the Serial Plotter by clicking Tools Serial Plotter . 27. (3) Turn the dial of the potentiometer to view the effect that changing the potentiometer has on the digital readings. Note the maximum and minimum values. What is the digital value range? 28. (2) When twisting the potentiometer, when does the serial value change? (Only a rough answer is expected here: Is it when the knob is far to one side or the other? When the knob is halfway?) Part 6: Clean Up and Check-Out with TA Return all items to your kits (be sure to turn off your multimeter). Ensure all shared equipment, cables, etc. are returned to the original location for the next lab section to use. Turn off all equipment (oscilloscope, function generator, etc.) and log out of the computer. Check out with TA prior to leaving lab. Discussion Questions Page 22 of 23 Loop function: Reads the digital input and prints the output to the Serial Monitor every 1 millisecond.
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
1. (8) Describe the difference between the Analog Read, Analog Voltage Read, and Digital Read for Arduino measurements. In particular, discuss the how their ranges and values relate to each other. 2. (4) Brainstorm and list an example in the “real world” where only the functionality of a digital input would be needed, rather than an analog input. 3. (4) List at least 2 common devices that use potentiometers. You may use the Internet to help you, provided that you put your answer in your own words and cite your references. 4. ( 4 ) Based on your observations in lab, why is it important to always measure a given quantity (voltage, current, resistance, etc.) on the lowest possible range setting? 5. ( 6 ) Give one specific “real-world” example where a DMM would be the “right” tool for measuring an unknown voltage (as opposed to an oscilloscope), and a second example where an oscilloscope would be the “right” tool (as opposed to a DMM. You may use the Internet to help you, provided that you put your answer in your own words and cite your references. Page 23 of 23
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