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

Johansson Theodor Lab 4

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

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

 

The analog values range 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?

 

The ADC has 8 bits of resolution.

Each analog input pin ADC of the Atmega32U4 has 10 bits of resolution. This can be found in the datasheet, or alternatively, on the Arduino Micro web page.

 

 All 10 bits are being used.   -0.25

 

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? 

 

As the distance increases, the voltage decreases.

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

 

/*

  LiquidCrystal Library - Hello World

 

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 

 This sketch prints "Hello World!" to the LCD

 and shows the time.

 

  The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * LCD VSS pin to ground

 * LCD VCC pin to 5V

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD VO pin (pin 3)

 

 Library originally added 18 Apr 2008

 by David A. Mellis

 library modified 5 Jul 2009

 by Limor Fried (http://www.ladyada.net)

 example added 9 Jul 2009

 by Tom Igoe

 modified 22 Nov 2010

 by Tom Igoe

 

 This example code is in the public domain.

 

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

 */

 

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

 

void setup() {

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

  lcd.begin(16, 2);

  Serial.begin(9600);

}

 

void loop() {

  lcd.clear();

  // set the cursor to column 0, line 1

  // (note: line 1 is the second row, since counting begins with 0):

  // print the sensor values:

  String s = "";

  s += analogRead(xpin);

  // print a tab between values:

  s += "    ";

  s += analogRead(ypin);

  // print a tab between values:

  s += "    ";

  s += analogRead(zpin);

  lcd.print(s);

  // delay before next reading:

  delay(100);

}

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?

 

1000

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

 

Divide it 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.

https://youtu.be/tICCM0XvIwg

 

 

 

Comments (1)

xyyue@... said

at 2:09 pm on Aug 11, 2015

Well done.

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