ADXL345 3 axis accelerometer

If you need technical help with anything you've bought from Dawn Robotics, please post here.

ADXL345 3 axis accelerometer

Postby mike1234 » Wed Aug 06, 2014 4:58 pm

Hi,
I'm having great difficulty communicating with the above sensor. I've trawled through all the obvious sites for guidance. I'm using rpi model B and want to use python.
The rpi recognizes the sensor is connected at '53', unexpectedly there is also a UU at position '37' !!
I believe i2c tools have been installed successfully.
When running a test script I get 0.000G which is incorrect.
I also get a problem where the quick2wire file is not found.

If anyone has a script that works I'd be very grateful.
mike1234
 
Posts: 10
Joined: Mon Apr 28, 2014 10:37 pm

Re: ADXL345 3 axis accelerometer

Postby Alan » Thu Aug 14, 2014 7:13 pm

Hi Mike,

First off, apologies for the delayed reply on this. Been a bit snowed under lately and I thought it might take a while to get set up on this.

The way I've approached this is by following this tutorial, which maybe is the one you've tried?

I too get the slightly odd UU although mine is at position (30, b). Anyway, when I ran the example.py script I got 0.000G on all axes as you did, but then when I ran it again it all works and I got what looked like sensible values for all axes (i.e. when it was flat on the table z was close to 1G and x, y were both close to zero).

Looking at the code of the ADXL345 class it looks like it sends a message to the accelerometer to enable measurements. Now in example.py the ADXL345 class is created and then a call is immediately made to getAxes. My guess is that actually a small delay is needed when the accelerometer is first used to give the command time to be accepted, hence why the script works the second time it's run.

Of course, this may not be the problem you're having... :? Can you try following the linked tutorial and then running the script repeatedly to see if you get any improvement?

Cheers

Alan
Alan
Site Admin
 
Posts: 311
Joined: Fri Jun 14, 2013 10:09 am

Re: ADXL345 3 axis accelerometer

Postby mike1234 » Sat Aug 16, 2014 5:10 pm

Thanks Alan

I didn't think to run it twice!!
It's now reading OK.

Oh and my strange UU reading is also at position 30, b the same as yours - I typed the original question from memory.

Thanks again

Mike
mike1234
 
Posts: 10
Joined: Mon Apr 28, 2014 10:37 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 0 guests