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

View

# Lab 4 write-up (redirected from Lab 4 write up)

last edited by 7 years, 6 months ago

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

The range is 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?

According to the arduino reference, (http://www.arduino.cc/en/Reference/AnalogPins) the chip has 10 bit resolution. This might also be found on the atmega's datasheet.

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 ranges from 75 to 650 depending on the distance. It then drops quite a bit when I get closer than about 2.5 inches or so. This matches up with the data sheet graph.

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

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:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("ACCELEROMETER!");
}

void loop() {

// print the sensor values:

// print a tab between values:

lcd.print("  ");

// print a tab between values:

lcd.print("  ");

delay(100);
lcd.clear();

}

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

1024

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

Divide by 4

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