Light Sensor: Difference between revisions

From OLPC
Jump to navigation Jump to search
Line 35: Line 35:


* (yet to be released) [http://dev.laptop.org/git/projects/runin/tree/runin-light-sensor runin-light-sensor] script for testing data stream from sensor,
* (yet to be released) [http://dev.laptop.org/git/projects/runin/tree/runin-light-sensor runin-light-sensor] script for testing data stream from sensor,
* [http://dev.laptop.org/git/olpc-kernel/commit/?h=arm-3.0&id=389a4492d0e7ccbff0f66870a85b3723304721d6 kernel implementation],
* [http://dev.laptop.org/git/olpc-kernel/commit/?h=arm-3.0&id=389a4492d0e7ccbff0f66870a85b3723304721d6 kernel implementation] first included in os40,
* [http://dev.laptop.org/git/users/rsmith/ec-1.75/tree/ols.c embedded controller implementation]
* [http://dev.laptop.org/git/users/rsmith/ec-1.75/tree/ols.c embedded controller implementation],
* [http://tracker.coreboot.org/trac/openfirmware/browser/dev/olpc/kb3700/eccmds.fth#L79 OpenFirmware implementation]
* [http://tracker.coreboot.org/trac/openfirmware/browser/dev/olpc/kb3700/eccmds.fth#L79 OpenFirmware implementation].

Revision as of 01:12, 25 August 2011


Pencil.png NOTE: The contents of this page are not set in stone, and are subject to change!

This page is a draft in active flux ...
Please leave suggestions on the talk page.

Pencil.png

A light sensor is built into the XO-1.75.

XO-1.75 B1 has a restricted form of the feature, in that the wireless activity indicator is affected by the sensor, and any future use of the storage indicator will affect the sensor.

XO-1.75 A3 has a restricted form of the feature, in that the sensor is affected by the battery and power LED.

The sensor is managed by the embedded controller, and is averaged and updated roughly every two seconds.

Testing

In OpenFirmware at the Ok prompt, type

als@ .d (cr  d# 200 ms  many

and press enter. The sensor readings will be displayed continuously, until you press a key.

Programming

  • your program must read /sys/devices/platform/olpc-ols.0/power_state and parse the result as an integer,
  • your program should avoid reading power_state at a rate more than the sample rate the sensor is configured for, because this consumes extra power by making the CPU and the EC more busy,

Internals

The sensor is a reverse biased LED. The EC charges the LED as if it is a capacitor, and then times how long it takes to discharge. The discharge time is mostly related to the ambient light, and slightly related to operating temperature of the embedded controller.

XO-1.75 B1 Restriction

The sensor is adjacent to the wireless indicator. The EC disables the wireless indicator while taking a sample. The storage indicator, if it is used, may affect the sample.

XO-1.75 A3 Restriction

The sensor is adjacent to the battery indicator, and as a result generates distorted samples when the laptop is connected to a DC power cable.

References