LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

ADXL 345 Sparkfun-- I2c--LabVIEW--Arduino

Hi,

Im working with arduino uno and ADXL345 accelerometer from sparkfun. i can write and read the 3 axis between arduino and adxl345. Now im trying to use labview to read the data. Below is the configuration i have done in vi.

I2C arduino labview.jpg

83 (0x53) is the device address of adxl345, 0x32 is the register address for first axis acceleration provided in the datasheet (http://www.sparkfun.com/products/9836). and (http://www.sparkfun.com/datasheets/Sensors/Accelerometer/ADXL345.pdf).

adxl datasheet.jpgim going to read 6 byte from address 0x32 and end with 0x37. However, the vi cannot read the data. i am wondering what is the problem. Im using the latest version for LabVIEW interface for Arduino (2. 1.1.69) and the latest version of Arduino release 1.0.

what should i do? Is there any particular code in Arduino that i missed? Really need help.

Thank You.

0 Kudos
Message 1 of 87
(71,265 Views)

I don't have one of these yet but I've been working with similar digital sensors and it looks correct to me.  Are you sure the 32 is in Hex?

0 Kudos
Message 2 of 87
(10,839 Views)

So, since the last time that I posted I've worked with another accelerometer that sends the data exactly the same way.  You have to combine the LSB and MSB from each axis to get usable numbers.  Here is how it's done:

I2C_Accelerometer_Data.png

Message 3 of 87
(10,839 Views)

Nathan, do you happen to have the rest of this or sample code to read from the ADXL345? I'm looking to do some reading and would like to see some ways to get started. Thanks.

0 Kudos
Message 4 of 87
(10,839 Views)

I don't have a ADXL345 so my code will not be exactly the same.  If multiple-byte reads are on by default then you should be able to just use the code in the first post and then interpret the data array that you get from the I2C read with the code I posted above.  Make sure that the 32 is hex.

0 Kudos
Message 5 of 87
(10,839 Views)

Can somebody post the .vi archive?

0 Kudos
Message 6 of 87
(10,839 Views)

To what are you refering?

0 Kudos
Message 7 of 87
(10,839 Views)

Has anyone got a sample vi for adxl345 and i2c finally? I am trying but i 've reached dead end.

0 Kudos
Message 8 of 87
(10,839 Views)

I could try to write some functions for this sometime if the OP hasn't figured it out and posts for you.

0 Kudos
Message 9 of 87
(10,839 Views)

Here ya go.  I found out the major reason why the OP's code didn't work.  Let me know if something doesn't work as expected.

Remember to initiate and close I2C communications correctly when using these VIs.

EDIT:  Updated my library below.

Message 10 of 87
(10,839 Views)