pyupm_mag3110 module

class pyupm_mag3110.MAG3110(bus, dros=15, devAddr=14)[source]

Bases: object

API for the MAG3110 Three-Axis Digital Magnetometer.

ID: mag3110

Name: MAG3110 Three-Axis Digital Magnetometer

Category: accelerometer compass

Manufacturer: freescale

Link:http://www.nxp.com/assets/documents/data/en/data- sheets/MAG3110.pdf

Connection: i2c Description in web-link above: The MAG3110 is a small, low-power digital 3D magnetic sensor with a wide dynamic range to allow operation in PCBs with high extraneous magnetic fields. It measures the components of the local magnetic field, the sum of the geomagnetic field and the magnetic field created by components on the circuit board. It can be used in conjunction with a 3-axis accelerometer so that orientation-independent accurate compass heading information may be achieved It is capable of measuring local magnetic fields up to 10 Gauss with output data rates up to 80 Hz.

C++ includes: mag3110.hpp

checkID()[source]

int checkID(void)

Check device_id of sensor

0 on success -1 on error

getData(data, bSampleData=0)[source]

int getData(mag3110_data_t *data, int bSampleData=0)

Get sensor values

data: Sensor values

bSampleData: Flag to read sensor

0 on success -1 on error

getDieTemperature()[source]

int8_t getDieTemperature(void)

Get die temperature

Die temperature

getStatus()[source]

uint8_t getStatus(void)

Get value of status register

Value of status register

getX(bSampleData=0)[source]

int16_t getX(int bSampleData=0)

Get x-axis magnetic field strength

bSampleData: Flag to read sensor

The x-axis magnetic field strength on success -999 on error

getY(bSampleData=0)[source]

int16_t getY(int bSampleData=0)

Get y-axis magnetic field strength

bSampleData: Flag to read sensor

The y-axis magnetic field strength on success -999 on error

getZ(bSampleData=0)[source]

int16_t getZ(int bSampleData=0)

Get z-axis magnetic field strength

bSampleData: Flag to read sensor

The z-axis magnetic field strength on success -999 on error

isReady()[source]

int isReady(void)

Check for new set of measurement data.

>0 if x-, y- and z-axis new sample is ready 0 if measurement is in progress

sampleData()[source]

int sampleData(void)

Read magnetometer’s data and saves them to variables

Info: To get the actual values for the magnetic field someone has to divide the returned values from the magnetometer by 10

0 on success -1 on error

setActive()[source]

int setActive(void)

Set active mode, this enables periodic measurements

0 on success -1 on error

setStandby()[source]

int setStandby(void)

Set standby mode, this disables periodic measurements

0 on success -1 on error

setUserOffset(x, y, z)[source]

int setUserOffset(int16_t x, int16_t y, int16_t z)

Set user offset correction Offset correction register will be erased after accelerometer reset

x: Offset correction value for x-axis

y: Offset correction value for y-axis

z: Offset correction value for z-axis

0 on success -1 on error

class pyupm_mag3110.mag3110_data_t[source]

Bases: object

dtemp
status
x
y
z