Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   ADXL345 I2C Accelerometer NOT WORKING (http://www.chiefdelphi.com/forums/showthread.php?t=91183)

saquib 02-07-2011 06:12 PM

ADXL345 I2C Accelerometer NOT WORKING
 
ive been having some trouble coding for the accelerometer and i am very confused as to how i can use the i2c bus to actually read from the accelerometer
it would be very helpful if i could get some some sample code or a basic outline of what i need to do

jhersh 02-08-2011 01:45 AM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
Quote:

Originally Posted by saquib (Post 1017870)
ive been having some trouble coding for the accelerometer and i am very confused as to how i can use the i2c bus to actually read from the accelerometer
it would be very helpful if i could get some some sample code or a basic outline of what i need to do

There is a class for the sensor that only has a few functions and they are documented. What exactly are you having trouble with? You can look at the LabVIEW example for the ADXL345 to see a wiring diagram.

-Joe

brian3795 02-09-2011 03:00 PM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
Quote:

Originally Posted by jhersh (Post 1018226)
There is a class for the sensor that only has a few functions and they are documented. What exactly are you having trouble with? You can look at the LabVIEW example for the ADXL345 to see a wiring diagram.

-Joe

Either we have a borked ADXL345, or the LabVIEW code isn't working. The example code just returns a "sensor not responding" error code. It's wired correctly, with the "correct" address of 0x3A.

jhersh 02-09-2011 03:13 PM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
Quote:

Originally Posted by brian3795 (Post 1019246)
Either we have a borked ADXL345, or the LabVIEW code isn't working. The example code just returns a "sensor not responding" error code. It's wired correctly, with the "correct" address of 0x3A.

Do you have any equipment (oscilloscope or logic analyzer) you can debug this with? Can you look at the I2C bus to determine if the traffic looks good or not?

-Joe

brian3795 02-09-2011 03:18 PM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
Quote:

Originally Posted by jhersh (Post 1019254)
Do you have any equipment (oscilloscope or logic analyzer) you can debug this with? Can you look at the I2C bus to determine if the traffic looks good or not?

We have access to a scope...have any references for us as to what "good traffic" will look like?

jhersh 02-09-2011 03:19 PM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
Quote:

Originally Posted by brian3795 (Post 1019258)
We have access to a scope...have any references for us as to what "good traffic" will look like?

Just look at the data sheet for the ADXL345... it should have some waveforms in it.

brian3795 02-09-2011 04:42 PM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
Yep, see them...will give the scope a try and see what's up.

brian3795 02-12-2011 05:20 PM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
Well, we ended up getting it to work in SPI mode (we did have to shorten the loop time from 100ms to 10ms). So we'll just live with that unless we run out of DIO ports. Thanks!

Trevin 03-03-2011 07:13 PM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
I have been trying to hook up my accelerometer and have had similar problems. I am writing in Java and have tried using the ADXL345_I2C class to interface with the accelerometer, but to no end. Every time I try to get the acceleration all I get back is 0, no matter how much I shake it.

I have also tried using I2C directly and still got nothing.

I would like to try SPI, but I don't know how I would get the data back in the code, the DigitalInput class only returns boolean values, not doubles.

If someone could tell me how to use SPI in Java or what I'm doing wrong with the I2C I would really appreciate it!!! Thanks.

jhersh 03-04-2011 12:48 AM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
Quote:

Originally Posted by Trevin (Post 1034278)
I have been trying to hook up my accelerometer and have had similar problems. I am writing in Java and have tried using the ADXL345_I2C class to interface with the accelerometer, but to no end. Every time I try to get the acceleration all I get back is 0, no matter how much I shake it.

I have also tried using I2C directly and still got nothing.

I would like to try SPI, but I don't know how I would get the data back in the code, the DigitalInput class only returns boolean values, not doubles.

If someone could tell me how to use SPI in Java or what I'm doing wrong with the I2C I would really appreciate it!!! Thanks.

There is not currently an easy-to-use API in java for accessing SPI so I recommend against that (unless you are savvy C++ to Java porters and would like to contribute an implementation). I2C should work (works on the sensor I have) but check for errors on the console.

Joe

Bob649 02-05-2012 08:18 PM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
(Bump on an old thread and hope someone sees it!)

Hello all,
I am having the same problem. We are using Java. Can someone post the wiring diagram from LabView or a screenshot of it? I can not find one though I looked. I did put a scope on the clock and data and they show traffic, but I don't have a protocol analyzer to tell if the traffic is correct.
Also can anyone who has it working confirm if we need to put out own pullup resistor on the CS pin to get into i2c mode? It doesn't look like it, but it could just be the cRIO telling the senor to wake up over and over again.
The code seems so simple I can't imagine it is the code, but if anyone knows any non-obvious points, that would also be appreciated.
Thank you in advance!

Bob
PS My first CD post!

jhersh 02-05-2012 08:58 PM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
We have it working. We did nothing but solder the pins to the board and wire the 4wires to the digital sidecar. The LabVIEW example shows how.

Joe

Mr. Lim 02-06-2012 02:47 AM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
We are having the same issue.

Tried multiple DB-37 cables - round, ribbon, several different connectors, etc.
Tried multiple 4-pin I2C cables.
Tried 2 different ADXL345 board.
Tried both a 4-slot and 8-slot cRIO.
Checked that the pull-up resistors in the DSC are working - we see about 3k between 5V and SDA, 5V and SCL.
SDA and SCL see about 4.6V.

We don't have a scope to check waveforms unfortunately.

We are programming in Java, and all we get back are 0.0 for all three axes.

There are no errors thrown.

I would love to get this working, but we opted to use a 2nd analog gyro turned sideways instead.

Bob649 02-06-2012 11:17 AM

Re: ADXL345 I2C Accelerometer NOT WORKING
 
Hello all,
I am beginning to wonder if the issue is the specific combination we are using. Does anyone out there have it running with this combination:
* Java
* 8 slot cRIO

So far I have seen LabView and 4 slot examples running, but nothing confirmed with Java and 8 Slot. I wonder if there is a bug somewhere in the library support?

Does anyone have _any_ i2c devices working with that combination?

Thanks again!

Bob

xisybyl 02-06-2012 01:51 PM

Yet another case of ADXL345 I2C Accelerometer NOT WORKING
 
We ARE using LabVIEW and tried both SPI and I2C examples, having updated the example from Sourceforge as mentioned in another thread. We rang out several round cables (checked good), but don't have a flat cable (it was damaged during repair). (I can't see why that should make a difference). We don't have a scope available.

There seem to be teams for which it works, and teams for which it doesn't. Again, we ARE using LabVIEW and are fully updated. The example gets into the Read VI and appears to stay there waiting for a response. I have no way of knowing whether the accelerometer didn't receive the previous write or it just isn't sending a value to be read.

Can ANYONE help??? National Instruments???


All times are GMT -5. The time now is 08:11 AM.

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