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

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Finke Andrew Lab 4

Page history last edited by zahraa@... 8 years, 7 months ago

Part A.  Writing to the Serial Monitor

 

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

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

     From some extensive googling, I have determined that the Atmega32U4 has 10 bits of resolution. In the range of values (0-1023), we see 1024 states.

Part B. Voltage Varying Sensors 

 

1. IR Distance Sensor

 

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?

    Yes, the voltage vs distance matches up roughly with the data sheet. Voltage is highest when the reflective object is closest to the sensor. As the object moves away, the voltage decreases, though not in a linear fashion.

2. Accelerometer

 

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);

 

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

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

  Serial.begin(9600);

  lcd.begin(16, 2);

}

 

void loop() {

  lcd.clear();

  lcd.print(analogRead(xpin));

  // print a tab between values:

  lcd.print("\t");

  lcd.print(analogRead(ypin));

  // print a tab between values:

  lcd.print("\t");

  lcd.print(analogRead(zpin));

  // delay before next reading:

  delay(100);

} 

Part C. Count/Time-Based Sensors

 

1. Rotary Encoder

 

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

     http://imgur.com/iHRKgWn

Part D. Logging values to the EEPROM and reading them back

 

1. Design your logger

 

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

     http://imgur.com/5xds7d

2. Reading and writing values to the EEPROM

 

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

     You can store 1k bite.

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

     Divide the analog data by 4.

3. Create your data logger!

 

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:04 pm on Aug 11, 2015

Well done.

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