mille-feuilleAutomatic Schematic Creation Tool

Accelerometer Sensor
(加速度センサー)

step

Features

step

対応プラットフォーム
o ATMEGA328P
o Raspberry Pi
I2Cデバイスのため、I2Cのアドレス変更ができないため、1種類のI2Cデバイスを1つだけmille-feuilleに接続できます。
Download datasheet

Main component : MMA8451Q - 3軸, 14ビット/8ビット デジタル加速度センサー

• 1.95 V to 3.6 V supply voltage
• 1.6 V to 3.6 V interface voltage
• ±2 g/±4 g/±8 g dynamically selectable full scale
• Output data rates (ODR) from 1.56 Hz to 800 Hz
• 99 μg/√Hz noise
• 14-bit and 8-bit digital output
• I2C digital output interface (operates to 2.25 MHz with 4.7 kΩ pullup)
• Two programmable interrupt pins for seven interrupt sources
• Three embedded channels of motion detection
  — Freefall or motion detection: one channel
  — Pulse detection: one channel
  — Jolt detection: one channel
• Orientation (portrait/landscape) detection with programmable hysteresis
• Automatic ODR change for auto-wake and return to sleep
• 32-sample FIFO
• High-pass filter data available per sample and through the FIFO
• Self-test
• Current consumption: 6 μA to 165 μA

step

Programming

Sample program for Arduino IDE
MMA8451.ino

Sample program
AccTest.py
* functions *
import Accelerometer

def getInfo(Number) : デバイスボードの情報を取得します
Number : 接続するベースボードのコネクタ番号を指定します

def init() : デバイスの初期化
return : デバイスIDが返ってきます

def get_X() : X軸の情報を取得
def get_Y() : Y軸の情報を取得
def get_Z() : Z軸の情報を取得


Example:
ID = Accelerometer.init()
accX = Accelerometer.get_X()
accY = Accelerometer.get_Y()
accZ = Accelerometer.get_Z()