Problem with ADXL345

Post Reply
MiticoLollo98
Posts: 9
Joined: Mon Mar 09, 2015 2:44 pm

Problem with ADXL345

Post by MiticoLollo98 »

Hi everybody,
I want build a shield with L3G4200D and ADXL345. First, I connected gyro with my arduino and I uploaded multiwii v. 2.3 I setted in config.h:
#define QUADX
#L3G4200D
and I tried with multiwii gui and it was okay. But when I added the accelerometer multiwii gui gav strange numbers (from 0 to 32000 and the -32000) in i2error and only gyro read the values yaw, pithc and roll, but not accelerometer. Why?????
I upload my schematic and the immagine of multiwii
Attachments
mutiwii_error.jpg
5266e578757b7fe84c8b456f.png

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Problem with ADXL345

Post by QuadBow »

Actually, your wiring looks good. But, the use of interrupts is not supported by multiwii. So, firstly remove the two wires.
The addresses can be selected via the SDO pin. Don't leave them floating, wire them to ground.

I understood that the ADXL has the i2c address 0x53 due to http://www.analog.com/media/en/technical-documentation/application-notes/AN-1077.pdf whereas in the file sensor.spp the default address is set to 0x1D in order to avoid an address conflict which you will not being faced with.

Thus, define ADXL345_ADDRESS 0x53 in config.h or def.h and your problems should be gone.

Have fun!

MiticoLollo98
Posts: 9
Joined: Mon Mar 09, 2015 2:44 pm

Re: Problem with ADXL345

Post by MiticoLollo98 »

Thanks for the answer. But now I have another problem because when I connect these sensors together the led of arduino blink and I searched and I found that this is a roblem of connection of I2C. But this is impossible because with one sensor (gyro) it works.

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Problem with ADXL345

Post by QuadBow »

MiticoLollo98 wrote:But now I have another problem because when I connect these sensors together the led of arduino blink and I searched and I found that this is a problem of connection of I2C.
I don't believe so, since there is no LED indicating I2C issues. I think the digital output D13 blinks, because multiwii assumes an unstable flight condition. Keep your sensors horizontally and push the CALIBRATE_ACC button. Afterwards the blinking should be gone.

MiticoLollo98
Posts: 9
Joined: Mon Mar 09, 2015 2:44 pm

Re: Problem with ADXL345

Post by MiticoLollo98 »

Thanks again for the answer. But is it correct put two pull-up resistor one between SDA and VCC and another SCL and VCC? If yes what's right value for the resistors?

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Problem with ADXL345

Post by QuadBow »

MiticoLollo98 wrote:But is it correct put two pull-up resistor one between SDA and VCC and another SCL and VCC?
It is correct to have pulls-ups between SDA (sensor side) and Vcc (3V) and SCL (sensor side) and Vcc (3V). The ADXL345 has no own pull-ups due to the mentioned documentation. But I don't know whether the level converter in between provides already pull-ups.

MiticoLollo98 wrote:If yes what's right value for the resistors?
The value of the pulls-ups due to http://www.nxp.com/documents/user_manual/UM10204.pdf (Chapter 7.1) depends on the voltage, capacity of the wiring, the speed, etc. Practically, try 1.5k resitors.

MiticoLollo98
Posts: 9
Joined: Mon Mar 09, 2015 2:44 pm

Re: Problem with ADXL345

Post by MiticoLollo98 »

Thanks again for the answer.
I followed your advice and now MultiwiiConf don't show any i2cerrors. But I don't know if the bahaviour of animation of quad it is correct. So I post URL video and the photos of breadboard where I put the components for now.

https://www.youtube.com/watch?v=raOzQ1pub0E
http://www.windoctor.it/immagini/image. ... 095524&jpg
http://www.windoctor.it/immagini/image. ... 095524&jpg

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Problem with ADXL345

Post by QuadBow »

Have you followed the wiki beginner's guide http://www.multiwii.com/wiki/index.php?title=Config.h ?
At the end there is the explanation how sensors should react by turning the copter/flight controller with sensors.

MiticoLollo98
Posts: 9
Joined: Mon Mar 09, 2015 2:44 pm

Re: Problem with ADXL345

Post by MiticoLollo98 »

Hi everyone
Thanks again QuadBow, but now I have another problem.
I just have mounted the shield, but I don't know if the position and direction of sensors is correct. I post a photo.

http://www.windoctor.it/immagini/image.php?id=16B7_55202857&jpg

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Problem with ADXL345

Post by QuadBow »

MiticoLollo98 wrote:I just have mounted the shield, but I don't know if the position and direction of sensors is correct. I post a photo.

Good question, due to my experience the naming of the directions is not always correct. So, you just have to check the right behaviour of the sensores with the multiwiiconf tool in accordance to the wiki.

By the way: you should get rid of any metal screws since they will disturb the MAG sensor - replace them by plastic/nylon screws!

Post Reply