LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

ADXL345 on i2c effected by other digital outputs.

Hi,

Im trying to control a model glider using a arduino nano connected to labview via bluetooth. It utilises an accelerometer that will be processed to provide output information to servo motors on the wings. The acceleromter im using is the adxl 345 using the toolkit that posted on another thread on here by Nathan_B. However im finding that when i output data to the servos it causes the accelerometer data to spike out of control. Im pretty sure this isnt a hardware issue as it still happens when the servos are disconnected.

Can the nano handle the processing of reading data from the arduino and writing at the same time? what is causing this issue?

Ive attached an example that shows when using an event structure that activates when the servo value is changed, the effect this has on the accelerometer data.

0 Kudos
Message 1 of 6
(4,068 Views)

While I can't fully inspect your VI because of missing subVIs, I can tell you that you can never branch the Arduino resource wire (the pink wire).  This can cause data corruption or worse.  Fix that and test it again and post your results.  Good luck.

0 Kudos
Message 2 of 6
(3,079 Views)

Hi Nathan, thanks for the reply,

Ill try and be clearer about the problem (ive fixed that branched wire issue to no avail). Ive designed a VI based directly on your adxl345 example that demonstrates what i mean. Unless you have the parts it will be hard to recreate what happens, so ill include some screen shots of the response of the accelerometer.

In the program i simply try to read from the accelerometer, write an angle to a servo and then read a servo angle. When the program starts, sometimes it begins as expected but the fluctuates. Sometimes one of the axis of the accelerometer changes scale, or stops working all together, however there doesnt seem to be any particular pattern. Writing to the servo seems to work ok, but reading from the servo produces mainly incorrect data. It may read correctly intially but then it seems to hop to 255 degrees and then settle at 48.

To add some context to the problem, im trying to design a control system for a model glider that reads from an accelerometer, processes the data and outputs data to servos on the wing to correct its flight path.

As i said before, this may be very hard to recreate, but i was hoping you could shed some light on whats going wong.

P.s. in the screen shot below, the control is angle output to servos and the indicator stupidly named 'angle (Degrees) out' is actually the angle being read from the servo.Screenshot.png Screenshot2.png

0 Kudos
Message 3 of 6
(3,079 Views)

I can't see anything obvious that would cause anything like that.

When you do your tests, do you have the accelerometer and servo hooked to the glider?  If yes, I would try it with neight the accelerometer or the servo hook to the glider (effectively uncoupling them).  Try it like that to rule out the movement cause by the sero is cauing the accelerometer to actually detect an acceleration.

Another thing to rule out is the connection to Arduino.  I would try to wire it with USB instead of using bluetooth to rule out the bluetooth from causing strange behavior.

0 Kudos
Message 4 of 6
(3,079 Views)

Ive tried it using a wired connection and everything is now behaving as expected! However, this project is reliant on it being transmissible over bluetooth, what is causing the bluetooth error?

0 Kudos
Message 5 of 6
(3,079 Views)

I'm not familiar with using Bluetooth with LIFA so I can't help.

0 Kudos
Message 6 of 6
(3,079 Views)