From 11:00 PM CST Friday, May 9th - 3:00 PM CST Saturday, May 10th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 11:00 PM CST Friday, May 9th - 3:00 PM CST Saturday, May 10th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
LIFA ADXL345 (Accelerometer)
Here is a LIFA-based library for the ADXL345 accelerometer. It currently only uses I2C but I hope to add SPI eventually.
Any feedback is appreciated.
Example:
Update History:
2013-07-08 Updated to 1.1.2, Fixed an issue with the device addresses in some VIs.
what do I have to do first with the arduino? only updoaling the LVIFA_Base.pde and attatch the accelerometer? cuz I can´t stablish communication with labview
Nathan,
Thank you for sharing your neat work.
I had to fix a couple of minor bugs before I was able to get going. The items of '7-bit Device Address' had the wrong decimal values of the Hex Nos. Second fix was the 'Connection Type (USB/Serial)' wasn't tied to the TypeDef.
Maybe this error was actually in the Init.VI of LIFA; sorry I can't be 100% sure where I fixed this error and what else I fixed. I am running late on a deadline! You can do a visual 'Compare VIs' from the Tools Menu to know for sure.
Please feel free to lock up the Lib as you had it and post it again.
The second loop was added to the example to verify that the BT com was established by toggling the onboard LED of the UNO.
Since I am not able to attach the modified Lib here; so I'll do it there: https://decibel.ni.com/content/message/50062#50062
Cheers
The device addresses in my library are correct. Also, I was unable to find any differences between our two libraries other than the example. In fact, your example having a second loop talking to Arduino is a race condition and must be avoided.
Please accept my apology. It's been a while and I can't remember the details. So I could have been wrong.
You are right: the second loop must be avoided and completely removed after initial testing. It was added temporarily to verify live connection with Arduino.
Thank you for the info Nathan, for some reason the VI reports random numbers, 10,0,0 then it starts flashing back and forth between those and rediculous numbers 8XXX,10XXX,11XXX (or so...) then it posts a timeout error... The code looks great, I cannot find anything that would indicate why this won't work. I suppose the code I'm using in my Arduino could be the issue, I wrote it following the step by step at Live Fast - Code Young (http://codeyoung.blogspot.ca/2009/11/adxl345-accelerometer-breakout-board.html) (which is an excellent resource, I might add )
You don't need to write any Arduino code. Everything is implemented within the LIFA framework. Upload the firmware for LIFA and then use the subVIs that I've written in your VI.
Lol Alright, thanks for your help btw!, I've got the LIFA uploaded, now the "Serial Monitor" doesn't report the data to me anymore and the "Read Axis" vi posts- "Error 5003 LabVIEW Interface for Arduino.lvlib:I2CRead.vi LabVIEW Interface for Arduino.lvlib:I2CWrite.vi. A timeout occured while trying to read form the Arduino." ...
I didn't think this was going to be this much of a pain in the a$$ lol Any thoughs on this latest issue?
This is how the magic happens, in case it helps-
You cannot use a serial monitor at the same time as running any LIFA code (the data would not make sense anyways since it includes the overhead of LIFA).
Do you know for sure that the sensor works with your current setup? One thing that I usually do is to test a sensor by using known working code for Arduino alone (no LIFA, no LabVIEW). If it doesn't work there then we have narrowed down at least one issue. So, with that website that you found, are you able to get it working (without LabVIEW)?
Yes, if I upload the other program into the Arduino it works fine. I can watch the numbers scroll by on all three axis and change in real time as I move the sensor around...
Could you please post both your Arduino text code and your LabVIEW VI that you are using? If you can't attach it here, attach them to a post in the original ADXL345 thread. Thanks.
That's a thing of beauty right there! Thank you for all the work on this Nathan, it's working great.
Hopefully, this isn't a stupid question... How can one substitute the Parallax Gyroscopic Module 3-Axis L3G4200D in place of the ADXL345?
(http://learn.parallax.com/KickStart/27911).
I've successfully wired the module and can read the data via the Arduino IDE Serial Monitor. However, I don't have a clue where to begin creating a VI for substitution. Any pointing in the right direction is appreciated.
TIA.
Rock on.
I'm confused, why you would want to do this. A gyroscope does not provide the same information as an accelermeter.
I posted the VIs that I used with the L3G4200D here.
You're exactly right: the gyroscope is not going to serve my needs. (I had one and was trying to make it work.) Thanks for the heads-up. You saved me who-know now much angst. Accelerometer on order.
thank you for your efforts ,,
it keeps giving me thiis error 5003 !!
I have no idea what is it ?
and please how can I fix it ?
Is there any read to use VI available for the ADXL345 with LINX. I am trying to use it but I could not understand what to write at the I2C channel...???????
Could anyone help ....... Plzzzz
LINX already has support for the ADXL345. Arduino's oly have one available I2C channel which is zero (simply leave it unwired since zero is the default value). If you have further questions regarding LINX, please post on the LINX forums.
Dear nathan thanks for your reply
I have tried to interface ADXL345 with LINX but it is not working and giving the error that I2C is not working. what can i do kindly help me out in that. I use Rp 10 kohm and SDO pin is grounded as well.
I have sended you can email in which my labview file is uploaded.Using LIFA it is working properly but I want to use with LINX as it is new.
Dear nathan thanks for your reply I have tried to interface ADXL345 with LINX but it is not working and giving the error that I2C is not working. what can i do kindly help me out in that. I use Rp 10 kohm and SDO pin is grounded as well. I have sended you can email in which my labview file is uploaded.Using LIFA it is working properly but I want to use with LINX as it is new.
Date: Fri, 17 Oct 2014 16:11:44 -0500
From: web.community@ni.com
To: ziaofbme@hotmail.com
Community
LIFA ADXL345
new comment by Nathan_B. View all comments on this document
LINX already has support for the ADXL345. Arduino's oly have one available I2C channel which is zero. If you have further questions regarding LINX, please post on the LINX forums.
Reply to this email to respond to Nathan_B.'s comment.
Hi Nathan, thank you for the LIFA. I could make it work!
Is there a way to make it read until 16G and show the acceleration in m/s^2? I need that result for an integration.
Thank you
I don't know what you mean by "until 16G". You can convert to standard
units easily using the range and the measured and maximum reasons from the
accelerometer.
Thank you for answering.
By "until 16G" I was trying to say I want my range to be between -16G to +16G. I've found that my accelerometer works by default between +2 to -2G.
I found that I can change the working range by writing in DATA_FORMAT (0x31). After that I easily integrated the final value to find the displacement.
can anybody tell me how to install library for adx345 in labview for LIFA?????????
thanx nathan...........
I also want to use accelemeter of this model as well Eval ADXL 377. can you suggest me which one is better LINX or LIFA?
You should always prefer LINX over LIFA. Neither one has native support for
that sensor but you can easily add it (especially if it's similar to the
ADXL345).
when I made the wiring as below and run LIFA ADXL345 codes I have an error 5003
what is the procedure to add new sensor in LINX?
and i have make some editing in block diagram which is available in example of linx for mma8453 accelometer but it shows result in graphical form but i neet its values........
can you suggest me procedure?
thanx for answering my question.......
For help with LINX, please post on the LINX forums at labviewmakerhub.com
Nathan,
I would like to know where you got ADXL345 hardware? and If you do have a sketch of wiring diagram.
I using windows 7 not LINX.
Thank you for answering my question in advance
how can i show the other axis graph ? sry i am new to this
Hello, I want to connect two adxl345 accelerometers in one arduino uno using linx. I have managed to connect one and print the measurements successfully,but when it comes to two adxl345 althought have connected the two accelrometers to the same pins i dont know how to correct my code . Any ideas?