Go to Post I love science. :D - artdutra04 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-01-2012, 10:35
flyvin flyvin is offline
Registered User
FRC #0095
 
Join Date: Dec 2009
Location: Lebanon NH
Posts: 8
flyvin is an unknown quantity at this point
Accelerometer Showing All Zeros

I'm trying to get the accelerometer to work using Java, but I'm having some trouble. I'm wiring it with I2C and using the "ADXL345_I2C" class. When I try to print out the x, y, and z values using "getAcceleration()", it just prints out zeros for everything.

I've gone over the wiring a bunch of times and it all looks correct to me. We also checked to voltage on the pins and it seems to change when we shake the accelerometer, so I don't think it's broken. Our java and crio are both up to date (as of today). I've never used I2C before, so there might be something obvious I'm missing. Any help would be appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 16-01-2012, 13:10
abrightwell abrightwell is offline
Lead Software Engineer
FRC #0342 (Burning Magnetos)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Charleston, SC
Posts: 20
abrightwell is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

We seem to be having the same problem. We will continue to research it, if we resolve it we will report back.
Reply With Quote
  #3   Spotlight this post!  
Unread 16-01-2012, 13:17
youxinche95 youxinche95 is offline
Registered User
AKA: Eugene Che
FRC #0649 (MSET)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Saratoga, CA
Posts: 18
youxinche95 is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Did you wire it correctly? We had the saem problem with our gyro, but it turned out it the pwm was not supposed to be in the digi-sidecar.

Good luck!
Reply With Quote
  #4   Spotlight this post!  
Unread 16-01-2012, 19:49
JewishDan18's Avatar
JewishDan18 JewishDan18 is offline
Registered User
FRC #1700
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Sunnyvale, CA
Posts: 185
JewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to behold
Re: Accelerometer Showing All Zeros

You have the wires going to the special pins on the digital sidecar? There are two sets of four, and you want the set closer to the edge.
Reply With Quote
  #5   Spotlight this post!  
Unread 17-01-2012, 00:19
sjspry sjspry is offline
Registered User
FRC #1984
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Kansas
Posts: 125
sjspry has a spectacular aura aboutsjspry has a spectacular aura aboutsjspry has a spectacular aura about
Re: Accelerometer Showing All Zeros

I know it doesn't add much, but our team had this same problem last year. We followed the diagram as best we could, and even asked on CD. I guess we can look forward to having the same problem this year, too
Reply With Quote
  #6   Spotlight this post!  
Unread 17-01-2012, 01:22
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Are you using the flat ribbon db37 cable included in this years KoP, or the previous round one?
Reply With Quote
  #7   Spotlight this post!  
Unread 19-01-2012, 13:27
abrightwell abrightwell is offline
Lead Software Engineer
FRC #0342 (Burning Magnetos)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Charleston, SC
Posts: 20
abrightwell is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

As promised, we resolved it by following ggorsuch's recommendation. Apparently the older round cable doesn't work for this purpose. Also, be sure to follow the directions here to make sure your flat cable is "built" correctly. Again, thanks ggorsuch for your help on this issue.
Reply With Quote
  #8   Spotlight this post!  
Unread 20-01-2012, 22:00
sand500 sand500 is offline
Registered User
FRC #3540 (Wildcat Robotics)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: United States
Posts: 81
sand500 is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Quote:
Originally Posted by abrightwell View Post
As promised, we resolved it by following ggorsuch's recommendation. Apparently the older round cable doesn't work for this purpose. Also, be sure to follow the directions here to make sure your flat cable is "built" correctly. Again, thanks ggorsuch for your help on this issue.
we were following that a week ago and we broke our cable... so do we really need to order another one?
Reply With Quote
  #9   Spotlight this post!  
Unread 20-01-2012, 22:29
sand500 sand500 is offline
Registered User
FRC #3540 (Wildcat Robotics)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: United States
Posts: 81
sand500 is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

The sensor manual says
Quote:
Note: The ADXL345 starts in a power saving mode. You must turn it on by writing 0x08 to POWER_CTL
(0x2D) before it will do anything interesting.

so how would someone go about doing this?
Reply With Quote
  #10   Spotlight this post!  
Unread 21-01-2012, 00:03
nickpeq nickpeq is offline
Turing-complete
FRC #1255 (Blarglefish)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Baytown, TX
Posts: 60
nickpeq is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Quote:
Originally Posted by sand500 View Post
The sensor manual says



so how would someone go about doing this?
I'm just going off the javadocs, as I've never used accelerometers.
But the "write" method of the I2C class seems useful.

Last edited by nickpeq : 21-01-2012 at 00:05. Reason: better method
Reply With Quote
  #11   Spotlight this post!  
Unread 21-01-2012, 01:17
theprgramerdude theprgramerdude is offline
WPI Freshman
AKA: Alex
FRC #2503 (Warrior Robotics)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Brainerd, Minnesota
Posts: 347
theprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud of
Re: Accelerometer Showing All Zeros

Does the built-in ADXL345_I2C class do this automatically when the constructor is called, or do we have to do something else, like use the I2C class?
__________________
Attending: MN Duluth Regional
Reply With Quote
  #12   Spotlight this post!  
Unread 21-01-2012, 01:37
JewishDan18's Avatar
JewishDan18 JewishDan18 is offline
Registered User
FRC #1700
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Sunnyvale, CA
Posts: 185
JewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to behold
Re: Accelerometer Showing All Zeros

Quote:
Originally Posted by theprgramerdude View Post
Does the built-in ADXL345_I2C class do this automatically when the constructor is called, or do we have to do something else, like use the I2C class?
It does it for you; take a peak at the ADXL345_I2C source code and you can see it right there.

Code:
m_i2c.write(kPowerCtlRegister, kPowerCtl_Measure);
Reply With Quote
  #13   Spotlight this post!  
Unread 21-01-2012, 15:45
sand500 sand500 is offline
Registered User
FRC #3540 (Wildcat Robotics)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: United States
Posts: 81
sand500 is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

this is what we are using for the code:

Code:
ADXL345_I2C acll= new ADXL345_I2C(2,ADXL345_I2C.DataFormat_Range.k8G);
public void teleopPeriodic()
	{	
		hi1 = acll.getAcceleration(ADXL345_I2C.Axes.kX);
		hi2 = acll.getAcceleration(ADXL345_I2C.Axes.kY);
		hi3 = acll.getAcceleration(ADXL345_I2C.Axes.kZ);
                disp(1, "" + hi1 + "                        ");
		disp(2, "" + hi2 + "                        ");
		disp(3, "" + hi3 + "                        ");
        }
disp is a custom method we made to output to the DS LCD
but this gives us just all 0

We also have the accelerometers plugged into the the 2 sets of 4 pins next to the "phone jack".

Last edited by sand500 : 21-01-2012 at 16:22.
Reply With Quote
  #14   Spotlight this post!  
Unread 21-01-2012, 17:59
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Quote:
We also have the accelerometers plugged into the the 2 sets of 4 pins next to the "phone jack".
You are using more than one accelerometer?
Reply With Quote
  #15   Spotlight this post!  
Unread 22-01-2012, 00:01
sand500 sand500 is offline
Registered User
FRC #3540 (Wildcat Robotics)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: United States
Posts: 81
sand500 is an unknown quantity at this point
Re: Accelerometer Showing All Zeros

Quote:
Originally Posted by ggorsuch View Post
You are using more than one accelerometer?
no just one, we tried both sets of 4 pins and both showed 0.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:39.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi