• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

• Finally, you can manage your Google Docs, uploads, and email attachments (plus Dropbox and Slack files) in one convenient place. Claim a free account, and in less than 2 minutes, Dokkio (from the makers of PBworks) can automatically organize your content for you.

View

# Lab 4 Make a Data Logger!

last edited by 7 years, 11 months ago

A

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

0-1024

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?

10 bits. I am using all of them.

B

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

It matched the datasheet.

#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;                  // z-axis (only on 3-axis models)

int xvalue = 0;  // variable to store the value coming from the sensor

int yvalue = 0;

int zvalue = 0;

void setup() {

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

lcd.begin(16, 2);

}

void loop() {

// set the cursor to column 0, line 1

// (note: line 1 is the second row, since counting begins with 0):

lcd.clear();

lcd.print("x:");

lcd.print(xvalue);

lcd.setCursor(0, 1);

lcd.print("y:");

lcd.print(yvalue);

lcd.print(" z:");

lcd.print(zvalue);

delay(100);

}

C

D

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

2.

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

1 Kbytes

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

Divide the 10-bit data by 4;

3.

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

b. Post a link to the Lab 4 Data Logger Hall of Fame.

DONE