Difference between revisions of "I2C accellerometer"
(Created page with "= general info = The I2C accellerometer is based on the MMA8652. = pinout = As with all bitwizard I2C boards, the board has a 4 pin female connector on the left and a male ...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
= |
= General info = |
||
The I2C accellerometer is based on the MMA8652. |
The I2C accellerometer is based on the MMA8652 from freescale. |
||
= |
= Pinout = |
||
As with all bitwizard I2C boards, the board has a 4 pin female connector on the left and a male connector on the right so that you can daisychain multiple boards. |
As with all bitwizard I2C boards, the board has a 4 pin female connector on the left and a male connector on the right so that you can daisychain multiple boards. |
||
Line 9: | Line 9: | ||
The pinout is GND, SDA, SCL, VCC. |
The pinout is GND, SDA, SCL, VCC. |
||
== |
== Voltages == |
||
The chip is 3.3V, a regulator is provided on board. This regulator has a dropout of about 1V, so the board currently requires a 5V VCC. We'll move to a different regulator one of these days allowing clean 3.3V operation. (the dropout will be so low that the chip will have to make do with 3.299V if you provide 3.300V....) |
The chip is 3.3V, a regulator is provided on board. This regulator has a dropout of about 1V, so the board currently requires a 5V VCC. We'll move to a different regulator one of these days allowing clean 3.3V operation. (the dropout will be so low that the chip will have to make do with 3.299V if you provide 3.300V....) |
||
= |
= Examples = |
||
This is a sample script that runs on raspberry pi to extract the X, Y and Z accellerometer values. It requires you install the bw_tool. |
This is a sample script that runs on raspberry pi to extract the X, Y and Z accellerometer values. It requires you install the bw_tool. |
||
Line 45: | Line 45: | ||
= |
= Datasheets = |
||
[[http://cache.freescale.com/files/sensors/doc/data_sheet/MMA8652FC.pdf]] |
[[http://cache.freescale.com/files/sensors/doc/data_sheet/MMA8652FC.pdf]] |
Latest revision as of 12:09, 11 November 2015
General info
The I2C accellerometer is based on the MMA8652 from freescale.
Pinout
As with all bitwizard I2C boards, the board has a 4 pin female connector on the left and a male connector on the right so that you can daisychain multiple boards.
The pinout is GND, SDA, SCL, VCC.
Voltages
The chip is 3.3V, a regulator is provided on board. This regulator has a dropout of about 1V, so the board currently requires a 5V VCC. We'll move to a different regulator one of these days allowing clean 3.3V operation. (the dropout will be so low that the chip will have to make do with 3.299V if you provide 3.300V....)
Examples
This is a sample script that runs on raspberry pi to extract the X, Y and Z accellerometer values. It requires you install the bw_tool.
#!/bin/sh acc="bw_tool -I -D /dev/i2c-1 -a 3a" # reset the accelerometer. $acc -W 2b:40:b # minimum 1ms IIRC. sleep 0.01 # #select range=1 for +/- 4G fs range. #range=1 range=0 # $acc -W 0e:"$range":b 2b:2:b 2c:0:b 2d:1:b 2e:1:b 2a:39:b sleep 1 #$acc -R 0:l result=`$acc -R 0:l |sed -e 's/\(..\)/\1 /g' ` #echo $result x=`echo $result | awk '{print $7$6}'` y=`echo $result | awk '{print $5$4}'` z=`echo $result | awk '{print $3$2}'` echo x=$x y=$y z=$z
The numbers are presented in hex. Remember that (in the default +/-2G fs range) 4000 is one G, c000 is about minus one G.
Mine currently reports:
x=0c70 y=0580 z=3f30
so it is not quite flat (X and Y significantly differ from zero. I get about +/- 60 when its pressed to the table). but it is still registering almost a full G in the Z direction .
Datasheets
[[1]]