Inexpensive Accelerometer and Breakout Board Design

By: scott_d

2010-05-25 12:21:43

While poking around Digikey for various sensor chips, I ran across the Freescale MMA7455. This seemed like a really nice 3 axis digital output accelerometer and it only costs $2.00 in single quantities. The specs seemed pretty nice for such an inexpensive chip: SPI or I2C output, 2g, 4g or 8g selectable range, tap, threshold and freefall detect with two interrupt outputs and/or continuous sample mode. So I ordered one and made a quick breakout board on one of the last group board orders. I didn't have a lot of time to get the design together so I made it pretty simple. There are a couple of board layout constraints in the data sheet and I followed those but other than that, I just ran the relevant inputs and outputs to headers, added the suggested power bypass caps and added pads for optional I2C pullup resistors on the bottom side. I haven't tested the I2C mode but I've got the board working in SPI mode with some simple test programs and everything seems to work fine. I also haven't tried any of the interrupt modes, only continuous sampling mode. One issue with almost all of these accelerometer chips is that they come in LGA packages which means that there are no exposed pads to solder. So you pretty much have to do reflow of some sort to use this chip. Since the chip costs $2.00 and the breakout board and the discrete components come to less than $1.00, the whole package for a quite functional accelerometer is less than $3.00, which seems like a very cheap price. The MMA7455 is a 3.3V chip and I didn't take the time to design in level shifters and a 3.3V regulator to this board (I might do another design which has those features) so you would also need to factor that into the cost of using this board. Or else do what I did and change a Teensy2 over to 3.3V operations (Paul has simple instructions in the Teensy documentation and it only takes adding a regulator on the bottom side). The datasheet is pretty long and perhaps a bit daunting but it is actually pretty simple to get the chip running with an Arduino sketch. I've attached a simple sketch for setting up the chip in SPI mode and reading the x, y and z values continuously. In this test program, I sent the x, y and z values to the inputs of a three color LED so you can watch the colors change as you rotate the chip around. In this program, I'm using the SPI routines from the Arduino example program (ArduinoISP) which comes with Arduino 18. Since I'm running this on a Teensy2, I've changed the SPI pin numbers to correspond to the pinout for the Teensy2. But other than that, I am sure this sketch would work with a standard Arduino or most clones. One other tricky bit is that there are two SPI modes available with the MMA7455: three wire and four wire. These are selected in the initial setup for the chip. Four wire is what this sketch uses since it is what the SPI hardware of an AVR normally does. Three wire mode essentially shares a single I/O line for MOSI and MISO. Also, there is an initial calibration step in this sketch which assumes the MMA7455 is sitting flat with the z axis pointing up. There are calibration registers in the MMA7455 which need to be set using an interative procedure so that the x and y axis will initially read zero and the z axis will read 1g. This has to be done each time the chip gets power since the registers are volatile. I've attached the Eagle files for the breakout board and the Teensy2 sketch to setup and run the chip. The MMA7455 datasheet is here and a useful application note is here.
Back to archive index