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

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Curtis Ryan Lab 4

Page history last edited by zahraa@... 5 years, 1 month ago

Ryan Curtis

EE 47

Summer 2015

Lab Report 4

 

Part A

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

The range of analog values read between 300 and 1023.

It should be 0 – 1,023.      -0.25

 

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 ADC has 16 bits of resolution but we are only using 10 bits of data.

Each analog input pin ADC of the Atmega32U4 has 10 bits of resolution. This can be found in the datasheet, or alternatively, on the Arduino Micro web page.

 

 All 10 bits are being used.   -0.25

 

Part 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?

I expected a linear relationship between voltage and the analog value but in fact it is an inverse relationship where an increase in distance causes a proportional decrease in voltage. This does match up with the data sheet.

 

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

440 339 413

455 307 409

439 264 352

415 217 321

377 217 374

330 200 339

290 199 377

243 214 360

207 297 409

222 307 438

257 367 413

269 398 448

 

What's this ?

^Output

Code below |

                  \/

 

// 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()

{

  // initialize the serial communications:

  Serial.begin(9600);

     lcd.begin(16, 2);

}

 

void loop()

{

  int x = analogRead(xpin);

  int y = analogRead(ypin);

  int z = analogRead(zpin);

  lcd.print(x + "  " + y + "  " + z);

  delay(100);

}

 

 

 

Part C

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

 

Part 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?

If each data sample used 1 byte, then you could store 1000 samples in the 1KB. But if each byte also needed a start and end bit, then 8000 bits/ 10 bits would leave room for 800 data samples.

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

Use the ADC to convert the analog data to be digital and representable in a binary format.

Not specific 

 Since the ADC input has 10 bits of resolution, and each EEPROM entry can only store 8 bits, the input value should be (a) divided by 4, or (b) shifted right by 2 bits, or (c) used in the Arduino map() function, each of which discards the 2 least-significant bits. 

-0.25

 

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.

 

Comments (1)

xyyue@... said

at 2:02 pm on Aug 11, 2015

Well done.

You don't have permission to comment on this page.