You said "min breakout" just to be clear are you using the intel mini breakout board?
If so, did you level shift the I2C lines up to 3.3v from the 1.8v ?
I did not. Guess I'll have to wait for the SparkFun boards.
Did you ever get that ADXL to work? I've spent a frustrating past few days trying to figure the issue out. I am using python (but whatever works would do for me) and trying to write the power register.... Its returning 0.. ALWAYS! I am expecting the output console to print a number (I am getting a 0)
Here's my code for the most basic test:
USED_I2C = 6
DEV_ADDR = 0x1D
x = mraa.I2c(USED_I2C)
byte = 0
m = " "
while byte != 0x28:
print("I read: ")
Any idea on how I can test my code?
My connections are as follows:
VCC==IOREF (IOREF is set to 5V)
I made a little bit of progress. I got the sparkfun breakout board on monday so now I have a correctly level shifted i2c connection. I can detect the sensor with "i2cdetect -r 1" but the code I am using relies on python-smbus, so I haven't gotten much beyond that.
I was able to make things work early morning today
I'll post my code etc when I get back home. It turns out that things were pretty trivial... The documentation for beginners sucks at the moment. I don't say that it's bad, but I've found it easier to navigate through beaglebone and RPi stuff. Perhaps it's due to the overwhelming number of discussions taking place across the internet for ARM. I can't be sure.remind me if I forget to post my code.
Btw, if it's the Adafruit library that you were talking about, then I'm in your league. I couldn't get SMBUS to install even when I got pip working. They're were just too many dependencies missing.
So basically, here are the steps that I followed:
- Open up "Intel Edison Kit for Arduno Hardware Guide" and follow along the steps on page 30 (section 11.6). Intel® Edison Arduino Board Hardware Guide
- For my testing, I
- Wrote the Power register and wait until I can read the value back...
USED_I2C = 6 DEV_ADDR = 0x53 x = mraa.I2c(USED_I2C) byte = 0 m = " " while byte != 0x28: print("I read: ") x.address(DEV_ADDR) x.writeReg(0x2D, 0x28) time.sleep(1) byte = x.readReg(0x2D) print(byte) print("write to power register was successful")
- Played around with other register settings (I'm not posting that code here since I'm ashamed of how bad the code is written currently: no comments, literals everywhere). The i2c routines seem to work fine from here. Basically we can copy and adapt any code from the internet from here onwards. It would be useful if someone made/ported a library though. I would try to find time to do so if people are interested.
General Suggestion to the Linux Dev Team
It would be GREAT (!!!!) if you guys could make a folder with these scripts for configuring the MUXes. In fact I think this would ease the adoption of the board as a whole for newbies. I always knew there was a Hardware guide but I didn't care going to section 11.6 until after many frustrating hours of the code not working. I can imagine how relieved I would've been if there was a script (in e.g. /local/scripts/) which I could simply execute to change the MUXes to output I2C on the pinouts.
Thanks Taimoor, this helps a lot. Can you share your code that reads the different axes? thanks
I've got the Edison hooked up to the ADXL345 and a USB webcam. A python script triggers the camera at discrete angles.
Right now my setup is still a bit bulky but I have a 9DOF, battery and base sparkfun boards on order. Those 3 things should bring the overall size down by a lot.
could you send me the working code for ADXL345 running on Mini Edison