Lab_4 Report


PART A

a. Based on the readings from the serial monitor, what is the range of the analog values being read?

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?

Looking at the data sheet from http://www.atmel.com/Images/doc7766.pdf, I can see that the resolution bits for the ADC are 10 bits. I am using the 10 bits (10^2=1024)

PART B

1a. 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?

The range of voltage goes from 0V to 3.5V, but sometimes it went up to 4V. If I see the graph of Ouput voltage vs Distance in the datasheet, the maximum voltage at 8 cm is like 3.2V, so my sensed values match up with the datasheet.

 

2a. Include your accelerometer read-out code in your write-up.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// these constants describe the pins. They won't change:
const int xpin = A3;                  // x-axis of the accelerometer
const int ypin = A2;                  // y-axis
const int zpin = A1;                  // z-axis (only on 3-axis models)

void setup(){
  lcd.begin(16, 2);  
}

void loop(){

  lcd.setCursor(0, 0);
  lcd.print(" X     Y     Z");
  lcd.setCursor(0, 1);
  lcd.print(analogRead(xpin));
  lcd.setCursor(6, 1);
  lcd.print(analogRead(ypin));
  lcd.setCursor(12, 1);
  lcd.print(analogRead(zpin));
  // delay before next reading:
  delay(100);

}

PART C

1a. Upload a picture of your rotary encoder in action!

Fliqz has shut down their service. To access this video, email support with this video id: 2cbbe88a3f4e43c7bf4e7f6ac5b59c26

PART D

1a. Turn in a copy of your final state diagram.

2a. How many byte-sized data samples can you store on the Atmega32U4?

1024 byte-sized data samples

2b. How would you get your analog data from the ADC to be byte-sized?

1024/8

Do you mean divide by 4 instead?

I byte is 8 bits, which means 2^8 = 256

3a. Use the lab camera or your own camera/cell phone to record and upload a short demo video of your logger in action.

 

3b. Post a link to theLab 4 Data Logger Hall of Fame.