Contiki-Inga 3.x
Accelerometer Sensor

This sensor interface allows to control the accelerometer of the INGA sensor platform. More...

Data Output Channels

#define ACC_X   0
 x axis data (mg output)
 
#define ACC_Y   1
 y axis data (mg output)
 
#define ACC_Z   2
 z axis data (mg output)
 
#define ACC_X_RAW   3
 x axis data (raw output)
 
#define ACC_Y_RAW   4
 y axis data (raw output)
 
#define ACC_Z_RAW   5
 z axis data (raw output)
 

Configuration types

#define ACC_CONF_SENSITIVITY   10
 Sensitivity configuration The sensor can operate at different ranges at different sensitivity levels (+/-2g,+/-4g,+/-8g,+/-16g) Possible values can be found in SENSITIVITY Values.
 
#define ACC_CONF_FIFOMODE   20
 FIFO mode configuration. More...
 
#define ACC_CONF_POWERMODE   30
 Controls power / sleep mode. More...
 
#define ACC_CONF_DATA_RATE   40
 Output data rate. More...
 

Status types

#define ACC_STATUS_BUFFER_LEVEL   50
 Fill level of the sensor buffer (If working in FIFO or Streaming mode). More...
 

SENSITIVITY Values

See Also
ACC_SENSOR_SENSITIVITY
#define ACC_2G   2
 
#define ACC_4G   4
 
#define ACC_8G   8
 
#define ACC_16G   16
 

Output Data Rate Values

#define ACC_0HZ10   1
 ODR: 0.1 Hz, bandwith: 0.05Hz, I_DD: 23 µA.
 
#define ACC_0HZ20   2
 ODR: 0.2 Hz, bandwith: 0.1Hz, I_DD: 23 µA.
 
#define ACC_0HZ39   4
 ODR: 0.39 Hz, bandwith: 0.2Hz, I_DD: 23 µA.
 
#define ACC_0HZ78   8
 ODR: 0.78 Hz, bandwith: 0.39Hz, I_DD: 23 µA.
 
#define ACC_1HZ56   16
 ODR: 1.56 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_3HZ13   31
 ODR: 3.13 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_6HZ25   63
 ODR: 6.25 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_12HZ5   125
 ODR: 12.5 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_25HZ   250
 ODR: 25 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_50HZ   500
 ODR: 50 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_100HZ   1000
 ODR: 100 Hz, bandwith: x.xxHz, I_DD: xx µA (default)
 
#define ACC_200HZ   2000
 ODR: 200 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_400HZ   4000
 ODR: 400 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_800HZ   8000
 ODR: 800 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_1600HZ   16000
 ODR: 1600 Hz, bandwith: x.xxHz, I_DD: xx µA.
 
#define ACC_3200HZ   32000
 ODR: 3200 Hz, bandwith: x.xxHz, I_DD: xx µA.
 

FIFO mode values

See Also
ACC_SENSOR_FIFOMODE
#define ACC_MODE_BYPASS   0x0
 Bypass mode (default). More...
 
#define ACC_MODE_FIFO   0x1
 FIFO mode. More...
 
#define ACC_MODE_STREAM   0x2
 Stream mode. More...
 

Power mode values

See Also
ACC_SENSOR_POWERMODE
#define ACC_NOSLEEP   0
 No sleep.
 
#define ACC_AUTOSLEEP   1
 Auto sleep.
 

Detailed Description

This sensor interface allows to control the accelerometer of the INGA sensor platform.

Note
This interface provides only a subset of the full sensor features. If you require extended configuration, consider using the underlying sensor driver.

Activate Sensor

Default initialization settings:

Configure sensor

acc_sensor.configure(type, value)

The sensor interface allows to configure:

Details of the different configurations are given in the documentation of respective config.

Query measurements

acc_sensor.value(channel)

The sensor provides 6 data channels.

Note
Measurement values are updated only if one channel is read twice. I.e. reading x,y, and z channel will provide values from a single measurement. If then one of these channels is read again, a new measurement is initated.

Example Usage

#include <sensors.h>
[...]
struct sensors_sensor accsensor = find_sensor("ACC");
ACTIVATE_SENSOR(accsensor);
[...]
int x = accsensor.value(ACC_X);
int y = accsensor.value(ACC_Y);
int z = accsensor.value(ACC_Z);

Macro Definition Documentation

#define ACC_CONF_DATA_RATE   40

Output data rate.

Values should be one of those described in Output Data Rate Values.

Note
If another value is given, the value is rounded to the next upper valid value.
In bypass mode (default) you should always select twice the rate of your desired readout frequency

Definition at line 165 of file acc-sensor.h.

#define ACC_CONF_FIFOMODE   20

FIFO mode configuration.

Definition at line 145 of file acc-sensor.h.

#define ACC_CONF_POWERMODE   30

Controls power / sleep mode.

Definition at line 152 of file acc-sensor.h.

#define ACC_MODE_BYPASS   0x0

Bypass mode (default).

No buffering, data is always the latest.

Definition at line 239 of file acc-sensor.h.

#define ACC_MODE_FIFO   0x1

FIFO mode.

A 32 entry fifo is used to buffer unread data. If buffer is full, no data is read anymore.

Definition at line 244 of file acc-sensor.h.

#define ACC_MODE_STREAM   0x2

Stream mode.

A 32 entry fifo is used to buffer unread data. If buffer is full old data will be dropped and replaced by new one.

Definition at line 249 of file acc-sensor.h.

#define ACC_STATUS_BUFFER_LEVEL   50

Fill level of the sensor buffer (If working in FIFO or Streaming mode).

Max value: 33 (full)

This can be used to determine whether a buffer overflow occured between two readouts or to adapt readout rate.

Definition at line 178 of file acc-sensor.h.