a. Based on the readings from the serial monitor, what is the range of the analog values being read?
The integers from 0 to 1023.
✔
b. How many bits of resolution does the analog to digital converter (ADC) on the Atmega32U4 have (hint: where might you look to find this sort of thing)? How many are you using with the range of values you're seeing?
Since 1024 = 2^10, there are 10 bits. And I am using all of them.
✔
a. Describe the voltage change over the sensing range of the sensor. A sketch of voltage vs. distance would work also. Does it match up with what you expect from the datasheet?
Distance (cm) | Datasheet (V) | Serial Report | Actual (V) |
60 | 0.50 | 92 | 0.45 |
40 | 0.75 | 160 | 0.78 |
30 | 0.90 | 194 | 0.95 |
20 | 1.30 | 284 | 1.39 |
10 | 2.25 | 473 | 2.31 |
5 | 3.10 | 631 | 3.08 |
2 | 1.50 | 334 | 1.63 |
The actual data matches pretty well with the datasheet.
✔
a. Include your accelerometer read-out code in your write-up.
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.clear();
}
void loop() {
int x = analogRead(A3);
int y = analogRead(A2);
int z = analogRead(A1);
lcd.setCursor(0, 0);
lcd.print("x:");
lcd.print(x);
lcd.print(" y:");
lcd.print(y);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("z:");
lcd.print(z);
delay(100);
}
✔
a. Upload a picture of your rotary encoder in action!✔
a. Turn in a copy of your final state diagram.✔
a. How many byte-sized data samples can you store on the Atmega32U4?
1K bytes, which means 1024 bytes.
✔
b. How would you get your analog data from the ADC to be byte-sized?
Divide it by 4, then all the data will be less than 255.
✔
a. Use the lab camera or your own camera/cell phone to record and upload a short demo video of your logger in action.
https://www.youtube.com/watch?v=VNqEvENMD2k&feature=youtu.be
b. Post a link to the Lab 4 Data Logger Hall of Fame.