GTA04 Kernel

Sensors

Table of Content

How to access the Sensors

Unless noted otherwise, the sensors are low power devices and always enabled.

3-Axis Accelerometer (BMA180)

read values

cat /sys/bus/i2c/drivers/tsc2007/2-0041/coord

order of values

x, y, z

data range

1g is approx. equivalent to a readout of 4096. The maximum is 4g, i.e. 16383. If the device is rotated by 180 degrees, the values become negative.

The axis orientation is:

  • x:
  • y:
  • z:

3-Axis Gyroscope (ITG3200)

WARNING: DON'T SWITCH POWER ON/OFF as described here. Function will be removed since it is against the specs of the chips.

Enable power (shared with Compass!)

The nominal analog voltage of the chip should be 2.5-3.0 V

VDD=2800000
echo "$VDD" >/sys/devices/platform/reg-virt-consumer.2/max_microvolts
echo "$VDD" >/sys/devices/platform/reg-virt-consumer.2/min_microvolts
echo "normal" >/sys/devices/platform/reg-virt-consumer.2/mode

disable power

echo "0" >/sys/devices/platform/reg-virt-consumer.2/max_microvolts

enable sampling (chip is in power down after reset)

echo "0" >/sys/bus/i2c/devices/i2c-2/2-0068/suspend

disable sampling (to save some power)

echo "1" >/sys/bus/i2c/devices/i2c-2/2-0068/suspend

read values

cat /sys/bus/i2c/devices/i2c-2/2-0068/values

order of values

x, y, z (in 14.375 deg/sec), temp (in 1/10 deg C)

Temperature is in 1/10 deg C.

data range

tbd.

3-Axis Compass (HMC5883L)

WARNING: DON'T SWITCH POWER ON/OFF as described here. Function will be removed since it is against the specs of the chips.

Enable power (shared with Gyroscope!)

The nominal analog voltage of the chip should be 2.5-3.0 V

VDD=2800000
echo "$VDD" >/sys/devices/platform/reg-virt-consumer.2/max_microvolts
echo "$VDD" >/sys/devices/platform/reg-virt-consumer.2/min_microvolts
echo "normal" >/sys/devices/platform/reg-virt-consumer.2/mode
modprobe hmc5883l

disable power

rmmod hmc588rl
echo "0" >/sys/devices/platform/reg-virt-consumer.2/max_microvolts

enable sampling

echo "50" >/sys/bus/i2c/devices/i2c-2/2-001e/rate

disable sampling (to save some power)

echo "0" >/sys/bus/i2c/devices/i2c-2/2-001e/rate

read values

cat /sys/bus/i2c/devices/i2c-2/2-001e/values

Barometer and Thermometer (BMP085)

Enable power

The chip is always enabled since its power demand is draws neglectable.

read values

cat /sys/bus/i2c/devices/i2c-2/2-0077/pressure0_input
cat /sys/bus/i2c/devices/i2c-2/2-0077/temp0_input

Pressure is in Pa. Temperature is in 1/10 deg C.

Touch Screen Position, Pressure/Resistance, Temperature and (optional) Ambient light intensity (TSC2007)

The raw ADC values, plate resistance, the temperature sensors and the AUX input (optional ambient light sensor) can be read through

cat /sys/bus/i2c/drivers/tsc2007/2-0048/values

The order of the values is

x, y, pressure, pendown(0/1), temp (in 1/10 deg C), z1, z2, temp0, temp1, aux, resistance

The temp and aux values are updated every 100ms and the other values only on pen-down every 1ms.

Pressure values are an estimate and are lower for touches with small area (fingernail, stylus) and higher for bigger touch area (finger tip or multitouch). Typical range:

  • 300 for stylus
  • 700 for finger tip
  • 2000-15000 for two fingers

Resistance is an estimate with a reference value of 600 Ohms.

Note: the x and y values are the raw values before any calibration (which is usually done through libts or similar means).