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

Labs:MartinSanner4

Page history last edited by Martin Sanner 10 years, 8 months ago

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

2^10-1(10 bits, including the 0, so 1023 different possible Values).


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.cc website, it has 20 bits. As stated in a., i'm only using 10.

 

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 Voltage decreases with increasing length of view. That turns out to be what i expected, since i imagined it to work as an electronic echolot.

 

2a.)

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



31    33    0
16    14    0
6    0    43
35    33    0
0    0    0
33    0    0
27    17    19
15    0    0
31    0    31
0    0    0
0    0    0
9    0    15
25    40    0
41    21    43
37    6    0
2    6    0

 

/*

 ADXL3xx

 

 Reads an Analog Devices ADXL3xx accelerometer and communicates the

 acceleration to the computer.  The pins used are designed to be easily

 compatible with the breakout boards from Sparkfun, available from:

 http://www.sparkfun.com/commerce/categories.php?c=80

 

 http://www.arduino.cc/en/Tutorial/ADXL3xx

 

 The circuit:

 analog 0: accelerometer self test

 analog 1: z-axis

 analog 2: y-axis

 analog 3: x-axis

 

 created 2 Jul 2008

 by David A. Mellis

 modified 4 Sep 2010

 by Tom Igoe

 

 This example code is in the public domain.

 

*/

 #include <string>
 // 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);
// 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:
  lcd.begin(16, 2);
  Serial.begin(9600);

}

 

void loop()

{

 
  // print the sensor values:

  Serial.print(analogRead(xpin));
  lcd.print(analogRead(xpin));
  // print a tab between values:

  Serial.print("\t");
  lcd.print ("");
 
  Serial.print(analogRead(ypin));
  lcd.print(ypin);
  // print a tab between values:

  Serial.print("\t");
  lcd.print("");
  Serial.print(analogRead(zpin));
  lcd.print(analogRead(zpin));
  delay(1000);
  lcd.clear();
  Serial.println();

  // delay before next reading:

  delay(100);

}

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

http://imageshack.us/scaled/thumb/209/ssgd.jpg

 

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

Will do so :)


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

Since the Arduino micro has got 1kbyte of EEPROM, we can store 1000 Samples.


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

We have to divide the data by 10, since the analogreadfunction returns a 10 byte-value.

Comments (1)

Vivien Tsao said

at 5:19 pm on Aug 10, 2013

Good job!! ... are you sure about 2b though? -0.5

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