CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Converting accelerometer adc values to Gs
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kein



Joined: 23 Jul 2007
Posts: 103

View user's profile Send private message

Thanks
PostPosted: Wed Sep 05, 2007 4:15 pm     Reply with quote

Quote:
If( VinX > 1.63 )
{
Calibrate_Output = (( VinY - 1.63 ) * MA_x ) + 1.65

}else if( VinX == 1.63 )
{
Calibrated_Output = 1.63

}else if( VinX < 1.63 )
{
Calibrated_Output = 1.63 - ((VinX - 1.63 ) * MB_x )
}
*buf_xptr++ = Calibrated_Output;

Calibrated_Output = 0;

/* for the case of "Y" */

VinY = READ ADC Value for Y_Axis

If( VinY > 1.64 )
{
Calibrated_Output = (( VinY - 1.64 ) * MA_y ) + 1.65

}else if( VinY == 1.64)
{
Calibrated_Output = 1.64

}else if( VinY < 1.63 )
{
Calibrated_Output = 1.64 - ((Vin - 1.64 ) * MB_y )
}

*buf_yptr++ = Calibrated_Output;

Calibrated_Output = 0;
}

Thanks alot. I think the input voltage in the following line should be VinX instead of VinY
Code:
If( VinX > 1.63 )
   {
          Calibrate_Output = (( VinY) - 1.63 ) * MA_x ) + 1.65
   
   }

and there should be VinY in the following line(typo error)
Code:
else if( VinY < 1.63 )
   {
          Calibrated_Output = 1.64 - ((Vin - 1.64 ) * MB_y )
   }

thanks
collegeman
Guest







pulling up accelerometer using pic16f877a
PostPosted: Fri May 01, 2009 5:38 pm     Reply with quote

My fellow students and I are trying to program a pic16f877a controller to control a rc car. We are using an accelerometer and want to integrate the signal to get the distance traveled. We are having a hard time trying to figure out how to get the information from my accelerometer to be able to integrate it. can any one help us with this.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun May 03, 2009 10:52 am     Reply with quote

To understand, if you can get a meaningful distance measurement, I suggest to to determine the expectable error of your acceleration value, put in the intended duration of measurement after zeroing the position and calculate the position offset.
Code:
s = 0.5 a * t**2

I fear, you won't go far with it.
nachum



Joined: 23 Aug 2009
Posts: 3

View user's profile Send private message

Re: Converting accelerometer adc values to Gs
PostPosted: Sun Aug 23, 2009 9:41 am     Reply with quote

hi
You have the code to reading from ADXL330 ?
vinniewryan



Joined: 29 Jul 2009
Posts: 154
Location: at work

View user's profile Send private message MSN Messenger

PostPosted: Sun Aug 23, 2009 1:22 pm     Reply with quote

Wow this is all great help to me as well! I'm working with an accelerometer right now as well, though I do have one question in regard to wiring it to the PIC: will I need any extra components in order to get the accelerometer to send signal to the PIC? All I want to do is have the pic read the x, y, and z inputs as decimal values. I've looked it up but everything I've found is specific to some other circuit and I don't need anything else. Accelerometer, PIC, battery.

Thanks!
nachum



Joined: 23 Aug 2009
Posts: 3

View user's profile Send private message

adxl330
PostPosted: Sun Aug 23, 2009 2:04 pm     Reply with quote

hi
You read the data from the pic...to computer

You have electric diagram of the circuit ?
u can send me the code that wrote or what you have ?
nachum.adi@gmail.com
nachum



Joined: 23 Aug 2009
Posts: 3

View user's profile Send private message

Re: pulling up accelerometer using pic16f877a
PostPosted: Sun Sep 13, 2009 12:01 pm     Reply with quote

hi
You read the data from the pic...to computer

You have electric diagram of the circuit ?
u can send me the code that wrote or what you have ?
nachum.adi@gmail.com
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 13, 2009 2:36 pm     Reply with quote

Nachum,
He is buffering the output of the ADXL330 with 3 opamps which are
configured as Voltage Followers. It's similar to this circuit:
http://www.mikroe.com/pdf/accelboard_schematic_v202.pdf

Read this thread for more discussion on the best OpAmp to use:
http://www.ccsinfo.com/forum/viewtopic.php?t=31907

In the same link, you can see that he's using ADC channels 0, 1, and 4
for the ADXL outputs X, Y, and Z. The output of the opamps goes to
pins AN0, AN1, and AN4 on the 16F877.
avneesh



Joined: 27 May 2010
Posts: 1

View user's profile Send private message

Adxl335
PostPosted: Thu May 27, 2010 5:33 pm     Reply with quote

Hi
I have a similar problem with using the adxl335. I read the values using my 12 bit ADC in the aduc7020. The result is a 12bit binary, which I can convert to decimal, but I want to know how to get the values to voltage.

when the adx335 is flat on the table the values of x=2773 y=2857 z=1192
note: these value are decimal

How do I convert these values to voltage... the math to do this what I need.

Thanks.

I'm new to this so any help will be appreciated.
Also I would really appreciate a quick back, I need to complete this work very soon.

+++++++++++++++++++++++++
The ADuC7020 micro is off topic.
Please ask on a ADuC7020 forum.

-- Forum Moderator
+++++++++++++++++++++++++
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group