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


Lab 4 Report for Alex Valderrama

Page history last edited by Alexander Valderrama 7 years, 3 months ago

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


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?


10 bits, all of them since 2^10 = 1024 aka 0-1023 range


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 output starts at around 370 and as I move my hand to about 3-4 inches away it increases up to 600. After this it slowly decreases down to background levels of 150 at about 1.5 feet away. Yes it matches up with figure 5's description in the spec.


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()
  lcd.begin(16, 2);

void loop()
  // print the sensor values:
  int x = analogRead(xpin);
  int y = analogRead(ypin);
  int z = analogRead(zpin);
  // delay before next reading: 


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?


1KB is short for 1024 bytes, therefore 1024 samples


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


Divide 1023 by 4 using integer division


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

Comments (0)

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