ADXL345 not working
Hi
I folowed this procedure https://wiki.up-community.org/Adafruit#Using_Adafruit_ADXL345_Triple-Axis_Accelerometer_Breakout_board_on_UP but it doesn't work. Full traceback:
sudo python examples/simpletest.py Traceback (most recent call last): File "examples/simpletest.py", line 12, in <module> accel = Adafruit_ADXL345.ADXL345() File "build/bdist.linux-x86_64/egg/Adafruit_ADXL345/ADXL345.py", line 65, in __init__ File "build/bdist.linux-x86_64/egg/Adafruit_GPIO/I2C.py", line 152, in readU8 File "build/bdist.linux-x86_64/egg/Adafruit_PureIO/smbus.py", line 155, in read_byte_data IOError: [Errno 6] No such device or address
I noticed I have the same error when I don't use sudo. Could it be because my I2C bus is not detected at all ?
I have an up squared, maybe the the tutorial above only works for up board ?
Thanks
Comments
-
Ok so I was right : those instructions must be slightly modified to work with UP Square. What I did :
On this link, I got info about i2c for UP Square http://wiki.up-community.org/Pinout_UP2 , I ran this command to get my bus number :ls /sys/bus/pci/devices/*/i2c_designware.0/ | grep i2c i2c-4 ls /sys/bus/pci/devices/*/i2c_designware.1/ | grep i2c i2c-5
So first thing, I don't get the same result as Wiki page. I have no idea if it's a problem but I will go for no.
Then, I checked for my device address :
sudo i2cdetect -y -r 5 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- 53 -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
In the file, examples/simpletest.py, I changed this
accel = Adafruit_ADXL345.ADXL345()
by this :
accel = Adafruit_ADXL345.ADXL345(address=0x53, busnum=5)
-
Hi @erenaud ,
Is now your ADXL345 working with your fix? If so, please redefine the discussion title as [RESOLVED] ADXL345 not working
Thank you!
Tagged
Categories
- All Categories
- 63 Announcements & News
- 139 Product News - New Product/Product Change Notice/ End-of-life
- 112 Welcome Developers!
- 60 Unboxing & Project Sharing
- 114 Tech Updates
- 3.6K UP Products
- 119 UP 7000
- 25 UP Squared i12
- 24 UP Xtreme i12
- 14 UP Squared Pro 7000
- 1 UP Element i12 Edge
- 24 UP Squared V2
- 65 UP 4000
- 23 UP Xtreme i11
- 34 UP Squared 6000
- 59 UP Squared Pro
- 135 UP Xtreme
- 820 UP Squared
- 1.4K UP Board
- 74 UP Core Plus
- 217 UP Core
- 3 UP Xtreme Lite
- 40 UP AI Edge
- 265 Starter Kits & Peripheral