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

Page history last edited by castro.flaviojr@... 7 years, 2 months ago

Part A

a) The range varies from 0 to 1023.

b) its 10 bits, this information is probably al in the datasheet, but I found it by knowing that 2^10 = 1024, the number of values seen.

Part B

Distance(cm)  2,5  10  15 20 
Analog Value read 340  420  600  460  340  230 

After 25 it gets confusing, it was supposed to be lower and lower, but instead it gets tricky it begins to vary a lot. 

PartB. 

This is my code:

void loop() {

lcd.setCursor(0, 0);
lcd.print("X= ");
lcd.print(analogRead(A1));
lcd.print(" Y= ");
lcd.print(analogRead(A2));
lcd.setCursor(0, 1);
lcd.print("Z= ");
lcd.print(analogRead(A3));
delay(500);
}

S the accelerometer work as follows: if you look at it with the used pins to your left, and the processor black box to the top. The X axis will be maximum when the chip is on horizontal, and the will be minimum when it is upside down.  If you point the small sensor to sky then you reach the maximum z. For achieve the maximum Y you have to point the left pins to the sky. It's hard to explain with words, hopefully I'll make a video.

 

Part C

Part D

 

So I want to keep track of my expenses over the day, so I'm gonna build a data logger to keep track of my transactions. For that I will use a rotary encoder to find out the values, and two buttons to navigate through the states of my machine, this will be my state diagram.

 

2. a) 1024 samples.

b) You basic have to restrict your domain of values to 8 bits-sized values, so from 1 to 256, for that you can simply ignore the last two bits of the received 10 bits analog read.

 

My video: http://www.youtube.com/watch?v=gShiXvoHv4U

Comments (1)

Vivien Tsao said

at 12:25 am on Aug 7, 2013

Good job! :)

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