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?
From 0 to 1023 units.
✓
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 of resolution. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit. 10bits as well
✓
Part B. Voltage Varying Sensors
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?
From 0 to 8cm, voltage inceases drastically from 0V to 3V
From 8cm onwards, voltage dreases more gradually.
It match up with what I expect from the datasheet.
✓
2. Accelerometer
a. Include your accelerometer read-out code in your write-up.
/*
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 <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:
Serial.begin(9600);
}
void loop()
{
lcd.setCursor(1, 1);
lcd.print(analogRead(xpin));
lcd.setCursor(5, 1);
lcd.print(analogRead(ypin));
lcd.setCursor(12, 1);
lcd.print(analogRead(zpin));
delay(100);
}
✓
Part C. Count/Time-Based Sensors
a. Upload a picture of your rotary encoder in action!
✓
✓
-
Turn in a copy of your final state diagram.
When button 1 is high, my datalogger is basically recording down the sensor reading from the infra-red sensor during the logging which is determined by the distance of an object from the sensor, assuming that the object is only within a 8cm range. When button 2 is high, data from the EEPROM will be displayed on the serial monitor. Finally when button 3 is high, any data from EERPOM will be cleared and the datalooger is either recording not displaying data, therefore in its idle state.
✓ ? ok
✓
-
How many byte-sized data samples can you store on the Atmega32U4?
1000
✓
-
How would you get your analog data from the ADC to be byte-sized?
I can use the map function to map the analog data in the range of 0-1023 to 0-255. As the number in the range of 0-255 can be represented by 8 bits.
✓ :)
Comments (1)
Vivien Tsao said
at 5:40 pm on Aug 10, 2013
Good job!
You don't have permission to comment on this page.