Lab 4

advertisement
ME 445 – Lab 4 – Measurements
Objective: Taking measurements is a large part of creating mechatronic systems. While it’s easy to think
of a measurement you want to take (for example, you may want to measure the temperature of some
process, or even the voltage of a battery) the process is often more complicated than you would first
expect. Additionally, it can be difficult to identify and limit sources of error in your experiment. This lab
will give you some experience designing an experiment and investigating some of the errors that occur
when you take measurements.
1) Noise and measurement errors
Noise and measurement errors are ubiquitous when you are working with instrumentation. In the first part
of this lab, you will build a very simple measurement circuit (a voltage divider) and will observe how
even with a simple circuit, measurement errors can become a problem.
You will need to use the single transistor motor driver from Lab 3 Part 2 for this section. Build two
voltage dividers with equal-sized resistors to measure the 5V supply on your breadboard or from one of
the 9V batteries in the lab.
Power your motor from the power supply you are measuring. For one divider, use relatively large
resistors (500k or higher). For the other divider, use smaller resistors (between 1k and 10k).
Use the PMD-1208 to measure the voltage at the common node of each divider over a reasonable period
of time for 3 different scenarios. First, measure the voltage without the motor running. Second, measure
the voltage with the motor running at a 50 percent duty cycle. Third, measure the voltage with the motor
running at full speed.
Come up with some way to quantify the noise on the voltage you are measuring. You can modify the code
for the PMD-1208 from the class website to do some simple noise analysis. Calculate the mean voltage
and the average error (noise) from the mean. The variable chan0 contains the voltages measured for
channel 0.
Report:
Create a table for the six noise measurements you recorded. Show Motor Speed, Resistors, Noise, Mean
Voltage. Explain your measurements. Was the mean voltage in each case what you were expecting? If
not, think about what might have caused the discrepancy and recommend both a hardware fix and a
software fix to this problem.
2) Experimental measurements
To help you obtain more experience designing experiments and taking measurements, we want you to
think of something in the world around you that you would like to measure with the Arduino. It doesn’t
have to be complicated. The important thing is that you get curious about the world around you and try to
take some measurements. For example, you can measure temperature vs time as the AC in a car cools a
hot cabin. As part of this process, you may want to turn the Arduino into a portable data logger, and some
information is provided at the end of the lab to help you out. We have a number of different sensors in the
lab for temperature (thermocouple, thermistor, and solid-state temperature sensor), acceleration
(accelerometer), angular rate (gyroscope), wind speed (anemometer), distance (IR and ultrasonic), and
many other sensors.
Report:
Write a reasonably detailed explanation of your experiment. Decide how best to present your results,
whether it is with a plot, a table, a picture etc. We also want you to explain your results, and talk about
whether they make sense, or if there was anything surprising about your results. Make sure to pay careful
page 1 of 2
ME 445 – Lab 4 – Measurements
attention to any errors that may have occurred in your experiment and talk about what you did, or would
do if you had to do the experiment again, to reduce or quantify those errors.
Troubleshooting question: Pick the biggest problem you ran into while working on this lab and describe
the problem in your report. Also provide the steps you followed to solve the problem. Think about how
you could have determined what the problem was as quickly as possible and write about a method you
would use to diagnose similar problems in the future. If you didn’t run into any problems, write about
what you think could have been a major issue.
EEPROM basics:
The Arduino has a small amount of built-in memory called EEPROM (Electrically Erasable
Programmable Read Only Memory). The nice thing about EEPROM is that any data you store there is
available even after you reset the power on your Arduino. You may want to consider using the EEPROM
to turn your Arduino into a portable data logger. The Arduino separates the EEPROM into 1024 addresses
(numbered 0 to 1023) where you can store 1 byte of data. We haven’t done much with addresses yet in
lab, but think of the address as the variable name for one byte of data. If you write a byte to an address,
and read the address later (even after you cycle the power) you will get the latest value you wrote to that
address. Remember that the EEPROM can only store numbers between 0 and 255, so you may have to
scale your data to save it in EEPROM and reverse the scaling when you take your data back out to get a
meaningful number.
One important point about EEPROM is that there is a limit to how many times the EEPROM can be
written to or read. In general, you don’t have to worry too much about it, but you would not want to write
to one address thousands of times per second. EEPROM is best used for storing a few values every time
you run your code.
Tutorial of how to use EEPROM follow these 3 links:
https://www.arduino.cc/en/Tutorial/EEPROMClear
https://www.arduino.cc/en/Tutorial/EEPROMWrite
https://www.arduino.cc/en/Tutorial/EEPROMRead
page 2 of 2
Download