MMA7455L accelerometer breakout board

From DP

Revision as of 15:16, 26 November 2010 by Jamz (Talk | contribs)
Jump to: navigation , search

Mma-board.jpg

Accelerometers measure orientation. The MMA7455L is an inexpensive accelerometer ($2 in 1s), with adjustable measurement resolution of 2/4/8g.

We used this chip in the USB POV Toy to sync the POV display to the speed of the user's hand motions. It only comes in a leadless LGA-14 package. It's a challenging chip to solder, so we though a inexpensive breakout board might be useful.

  • 2/4/8g selectable
  • 10bit or 8bit output
  • force and pulse detection with interrupt
  • I2C and SPI interface
  • 3.3volts

Get the [MMA7455L breakout board for $15].

Read about the design below.

Contents

Hardware

Mma7455-bo-v1a-cct.png

Click for a full size schematic image. Schematic and PCB were designed with the freeware version of Cadsoft Eagle.

MMA7455L

PCB

Mma7455-bo-v1a-brd.png

Click the picture for a full size placement image.

  • PCB and placement notes
  • soldering advise

Partlist

PartQuantityValuePackage
C1, C3210uF/6v tantalumSMC_A
C2, C420.1uFC805
U11MMA7455LLGA-14

SPI demo

The MMA7455L can operate in I2C or SPI mode. This section demonstrates the SPI mode with the Bus Pirate.

Connections

Bus Pirate Direction MMA7455L Description
MOSI SDA/SDI Master Out, Slave In
MISO SDO Master In, Slave Out
CLK SCL/SPC Clock signal
CS CS Chip Select
+3.3V3.3VPower supply
GND GND Ground

Bus Pirate setup

Connect the Bus Pirate to the chip as shown in the table.

HiZ>m<<<mode command
1. HiZ
...
5. SPI
...
(1)>5<<<SPI mode
Select output type:
1. Open drain (H=Hi-Z, L=GND)
2. Normal (H=3.3V, L=GND)
(1)>2<<<normal pinout
Ready
SPI>

Configure the Bus Pirate for SPI mode. Chose all the default settings except output type. Choose normal pin outputs.

SPI>W<<<enable power supplies
Power supplies ON
SPI>

The chip is powered by the Bus Pirate, enable the power supplies (W).

Interfacing

MMA7455L commands
Command Description
0x0D I2C address
0x16 Mode control
0x06 8bit accel X
0x078bit accel Y
0x088bit accel Z

We'll cover these commands. The commands are sent after taking the CS pin to ground ([), transactions end by returning CS high (]).

Register access
76543210
r/w A5A4A3A2A1A0x

The first byte of SPI commands chooses the register to work with, and selects read or write access. The table shows how the byte is packed. The first bit selects read (0) or write (1) access, the next 6 bits are the register to access, the last bit doesn't matter.

SPI>=0x0d <<<find the binary equivalent
0x0D = 13 = 0b00001101
SPI>[0b00011010 r] <<<pack the address into the command

A quick way to find the command to access a register:

  • Use the Bus Pirate to find the binary equivalent (= command)
  • Pack the lower six bits of the register address into the command according to the table using the Bus Pirate binary number entry format

Check the connection

Register 0x0D contains the I2C address. This address isn't relevant to SPI mode, but we can grab it to make sure the connection to the chip is functioning.

SPI>[0b00011010 r]
/CS ENABLED
WRITE: 0x1A <<<read I2C address register
READ: 0x1D<<<read value from register
/CS DISABLED
SPI>

Lower chip select ([), then setup the register to access(0x1a), read a byte (r), and raise chip select (]). The reply is 0x1D, the default I2C address according to page 23 of the datasheet.

Setup the mode

Configuration register (0x01)
7 6543210
access modexxxxxHOLD disable


Read accel data

  • Read X/Y/Z
  • Read all at once

Tables

$16: Mode Control Register
D7 D6D5D4D3D2D1D0Bit
- DRPDSPI3WSTONGLVL[1]GLVL[0]MODE[1]Mode[0]Function
0 0000000Default


Configuring the g-Select for 8-bit output using Register $16 with GLVL[1:0] bits

GLVL[1:0] g-RangeSensitivity
008g16 LSB/g
012g64 LSB/g
104g32 LSB/g


GLVL [1:0] 00: 8g is selected for measurement Range 10: 4g is selected for measurement Range 01: 4g is selected for measurement Range

STON 0:Self-test is not enabled 1:Self-test enabled

MODE[1:0] 00: Standby Mode 01:Measurement Mode 10: Level Detection Mode 11: Pulse Detection Mode

SPI3W 0: SPI is 4 wire mode 1: SPI is 3 wire mode

DRPD 0:Data ready status is output to INT1/DRDY PIN 1:Data ready status is not output to INT1/DRDY PIN

Configuring the Mode using Register $16 with MODE[1:0] bits

MODE[1:0] Function
00Standby Mode
01Measurement Mode
10Level Detection Mode
11Pulse Detection Mode

I2C demo

Get one!

You can [get one for $00].

Your purchases at Seeed Studio keep the open source project coming, we sincerely appreciate your support!

Links

License

  • CC-0, reference boards shouldn't be copyrighted!