| 
  • 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
 

Sun Kevin Lab 4

Page history last edited by xinyi xie 9 years, 8 months ago

Make a Data Logger!

 

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?

The integers 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?

Since 1024 = 2^10, there are 10 bits. And I am using all of them.

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?

Distance (cm) Datasheet (V)  Serial Report  Actual (V) 
60 0.50 92  0.45 
40 0.75  160  0.78 
30 0.90 194  0.95 
20 1.30 284  1.39 
10 2.25  473  2.31 
5 3.10 631  3.08 
1.50 334  1.63 

The actual data matches pretty well with the datasheet.

2. Accelerometer

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

// include the library code:

#include <LiquidCrystal.h>

 

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

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

 

void setup() {

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

  lcd.begin(16, 2);

  lcd.clear();

}

 

void loop() {

  int x = analogRead(A3);

  int y = analogRead(A2);

  int z = analogRead(A1);

  lcd.setCursor(0, 0);

  lcd.print("x:");

  lcd.print(x);

  lcd.print(" y:");

  lcd.print(y);

  lcd.print(" ");

  lcd.setCursor(0, 1);

  lcd.print("z:");

  lcd.print(z);

  delay(100);

}

 

Part C. Count/Time-Based Sensors

1. Rotary Encoder

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

 

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.

 

2. Reading and writing values to the EEPROM

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

1K bytes, which means 1024 bytes.

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

Divide it by 4, then all the data will be less than 255.

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.

https://www.youtube.com/watch?v=VNqEvENMD2k&feature=youtu.be

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

 

Comments (1)

xinyi xie said

at 12:17 am on Aug 1, 2014

Great job!

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