SumeetBatraLab4


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

The range of values is 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? 

The Atmega32U4 has 10 bits of resolution. From 0 to 1023 is 10 bits. 

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?

The voltage increases linearly from 0 to 3 volts until about 6 cm. From there, the voltage decreases at a decreasing rate, until it is less than 0.5 Volts at 80 cm away from the object. This is for white paper.

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

#include <LiquidCrystal.h>

 

// initialize the library with the numbers of the interface pins

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

const int xpin = A3;                  // x-axis of the accelerometer

const int ypin = A2;                  // y-axis

const int zpin = A1;     

void setup() {

  // set up the LCD's number of columns and rows:

  lcd.begin(16, 2);

}

 

void loop() {

lcd.setCursor(0,0);

lcd.print(analogRead(xpin));

lcd.setCursor(4,0);

lcd.print(analogRead(ypin));

lcd.setCursor(8,0);

lcd.print(analogRead(zpin));

delay(250);

}

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?

1025 byte-sized data samples can be stored on the Atmega32U4

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

Divide the analog date  by four.

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

 Lab 4 Data Logger Hall of Fame.