Electronics Microcontrollers Programming "/>

Updated ADXL345 library for Arduino 1.0

13 April 2012 at 1:15 pm

Article image for Updated ADXL345 library for Arduino 1.0

Today I’ve been playing around with SMD soldering using a tiny little touch-sensor called IQS158. I got hold of a soldering kit from Proto Advantage for MSOP-10 and started soldering away. When it came time to test it, I realized that I had never really used I2C before, only SPI. Aw bummer… How to figure out if my soldering actually works? Then I remembered that I picked up a triple axis accelerometer breakout from Sparkfun some weeks ago. I could test with that one and then base my code for the touch sensor on that?

The breakout is based on the ADXL345 chip and supports both SPI and I2C. Sparkfun only had SPI examples, but I found a link to Builder.org on the product page that had a the perfect I2C tutorial for my breakout. It was based upon a library that wasn’t updated for Arduino 1.0. They have a patched version in the article, but I did my own patch to learn and posted it to a new Arduino repository on GitHub. I’ll place all my code in this one from now on.

In the repository, you can also find a “bare bones” example file that is using the breakout/ADXL345, but without the entire library. This file only prints the x/y/z coordinates to Serial, but it also makes it really easy to see how much value the library adds such as detecting taps, freefall and lots of adjustment options.

Now it’s time for dinner and then I can write some code to test if the tiny IQS158 survived my SMD soldering attempt (it’s next to the breakout in the picture - just 3mm wide!)

Source/Download