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

View
 

Lab Report _4

Page history last edited by Benjamin Tee 7 years, 12 months ago

Lab Report #4

- Huda Aumir

 

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

 

The range is from 0 to 1024

2. 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, as values on serial monitor were from 0 to 1024. Also solving for x:

2^x=1024 gives x as 10.

3. 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?

 

When nothing was placed over the sensor, there was a reading of 0.5 to 1V. However, when an object was placed in front of the sensor, initially, the voltage increased to a peak value with distance but then began to decrease. The values were non linear and matched with the conclusions from the datasheet.

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

 

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

 

const int xpin = A3;

const int ypin = A2;

const int zpin = A1;

 

int xValue = 0;

int yValue = 0;

int zValue = 0;

void setup()

{

// initialize the serial communications:

Serial.begin(9600);

}

void loop()

{

// print the sensor values:

lcd.begin(16, 2);

int xValue = analogRead(xpin);

Serial.print(xValue);

lcd.print(xValue);

lcd.print(" ");

int yValue = analogRead(ypin);

Serial.print("\t");

Serial.print(yValue);

lcd.print(yValue);

lcd.print(" ");

int zValue = analogRead(zpin);

Serial.print("\t");

Serial.print(zValue);

lcd.print(zValue);

lcd.print(" ");

Serial.println();

delay(1000);

}

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

 


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

 

Pressure sensors from cars, supply the data logger with the current level of traffic. The datalogger uses this data to change the time between the changing of lights to minimize traffic. For example, when more cars are present, the green light stays on for longer than at times with lesser traffic on the road. The data is saved onto EEPROM, and a new set of data can be obtained later, probably after 2 hours or so.

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

 

10,000 bytes can be stored

 

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

 

The data has to be divided by 4, because bytes store data from 0 to 255 while analog data ranges from 0 to 1024

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

 

IMG_0948.MOV

 

Comments (1)

Benjamin Tee said

at 12:21 pm on Aug 13, 2012

Very interesting traffic light system using FSR. Great job!

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