Difference between revisions of "I2C magnetometer"

From BitWizard Wiki
Jump to navigation Jump to search
(Created page with "= general info = The I2C magnetometre is based on the MAG3110 from freescale. = pinout = As with all bitwizard I2C boards, the board has a 4 pin female connector on the lef...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
= general info =
= General info =


The I2C magnetometre is based on the MAG3110 from freescale.
The I2C magnetometre is based on the MAG3110 from freescale.


= pinout =
= 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 ==
== 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 =
= 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 magneto values. It requires you install the bw_tool.


#!/bin/sh
#!/bin/sh
Line 28: Line 28:
echo x=$x y=$y z=$z
echo x=$x y=$y z=$z
The numbers are presented in hex. The magnetic field of the earth is in fact quite small. (your nails don't pop out of the wall if they align with the magnetic field do they?) So the measurement requires some calibration, but the values do change when you change the orientation of the device.
The numbers are presented in hex. The magnetic field of the earth is in fact quite small. (your nails don't pop out of the wall if they align with the magnetic field do they?) So the measurement requires some calibration, but the values do change when you change the orientation of the device.


= Datasheets =

= datasheets =


[[http://cache.freescale.com/files/sensors/doc/data_sheet/MAG3110.pdf]]
[[http://cache.freescale.com/files/sensors/doc/data_sheet/MAG3110.pdf]]

Latest revision as of 12:09, 11 November 2015

General info

The I2C magnetometre is based on the MAG3110 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 magneto values. It requires you install the bw_tool.

#!/bin/sh
mag="bw_tool -I -D /dev/i2c-1 -a 1c"
$mag -W 10:2:b
sleep 0.1
result=`$mag -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. The magnetic field of the earth is in fact quite small. (your nails don't pop out of the wall if they align with the magnetic field do they?) So the measurement requires some calibration, but the values do change when you change the orientation of the device.

Datasheets

[[1]]