You are looking at an old revision of the page Sensors. This revision was created by Nikolaus Schaller.
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
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)
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
3-Axis Compass (HMC5883L)
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
disable power
echo "0" >/sys/devices/platform/reg-virt-consumer.2/max_microvolts
read values
cat /sys/bus/i2c/devices/i2c-2/2-0068/values
Barometer and Thermometer (BMP085)
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 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).