DOCX

Integrating_Ambient_Light_Sensors_With_Windows

By Andrea Wallace,2014-06-21 09:36
11 views 0
Integrating_Ambient_Light_Sensors_With_Windows

    Integrating Ambient Light Sensors with Windows 7 Computers

    New Opportunities and Considerations for

    Interfacing Ambient Light Sensors with Windows February 19, 2009

    Abstract

    This paper provides information about new ambient light sensor (ALS) features in the Windows? 7 family of operating systems. It provides guidelines for hardware manufacturers and original equipment manufacturers (OEMs) to integrate ALS hardware with computers that use the adaptive brightness feature and with applications that use light sensor data.

    Currently, integrating and supporting ALSs for automatic brightness control in Windows are difficult and costly because of the required implementation of multiple components and drivers. Additionally, these ALSs are limited in scope to brightness control functionality.

    In Windows 7, ALSs and adaptive display brightness are supported end to end. The goals for adaptive brightness are to provide an optimal user experience for readability, legibility, and eye comfort, while at the same time to optimize power consumption and battery life.

    In addition to the adaptive brightness feature, applications can also use light sensor data to optimize their content for readability in many different lighting conditions. This application integration is done by using the Windows Sensor and Location Platform, which is new for Windows 7.

    The information in this paper applies to the Windows 7 operating system. References and resources discussed here are listed at the end of this paper. For the latest information, see:

     http://www.microsoft.com/whdc/device/sensors/default.mspx

    Integrating Ambient Light Sensors with Windows 7 Computers - 2 Disclaimer: This is a preliminary document and may be changed substantially prior to final commercial release of the software described herein.

    The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.

    Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

    Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place or event is intended or should be inferred.

    ? 2009 Microsoft Corporation. All rights reserved.

    Microsoft, Windows, and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

    The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

    Revision History

    Date Change

    February 18, 2009 Bring into WHDC template; copy edit; no information changed

    October 27, 2008 First publication

February 19, 2009 ? 2009 Microsoft Corporation. All rights reserved.

    Integrating Ambient Light Sensors with Windows 7 Computers - 3

    Contents

    Light Sensor Features ................................................................................................. 4 Automatic Screen Brightness .................................................................................. 4 Automatic Keyboard Illumination ........................................................................... 4 Light-Aware Applications ........................................................................................ 4 Light-Specific Themes and Actions .......................................................................... 5 Using the Windows Sensor and Location Platform ...................................................... 5 Ambient Light Sensor Integration Checklist ................................................................. 5 Understanding Adaptive Brightness Support in Windows 7 ......................................... 6 Drivers for ACPI Integrated Ambient Light Sensors ................................................. 6 Sensor Monitor Windows NT Service ...................................................................... 6 Power Setting ......................................................................................................... 7 Registry Configuration Parameters ......................................................................... 7 Types of Light Sensors ................................................................................................ 7 Integrating Light Sensors with Computer Hardware .................................................... 8 Number of Light Sensors ........................................................................................ 9 Light Sensor Placement .......................................................................................... 9 Light Sensor Filters, Lenses, Enclosures, and Calibration ....................................... 10 ACPI Integration ................................................................................................... 10 Configuring Sensor Permissions ............................................................................ 10 Optimizing and Integrating LCD Displays ................................................................... 11 Windows Display Driver Model Support ............................................................... 11 Steps and Transitions ........................................................................................... 11 Tuning and Configuring Adaptive Brightness Behavior .............................................. 11 Constructing an ALR Curve from User Preference Data ......................................... 13 Exposing ALR Curve Data through the Device Driver ............................................. 15 Overriding ALR Data with the ALR Registry Setting ................................................ 16 Illuminance Change Sensitivity Registry Setting .................................................... 16 Display Response Interval Registry Setting ............................................................ 17 Conclusion ................................................................................................................ 17 Resources ................................................................................................................. 17

February 19, 2009 ? 2009 Microsoft Corporation. All rights reserved.

    Integrating Ambient Light Sensors with Windows 7 Computers - 4

    Light Sensor Features

    Ambient light sensors (ALSs) are used to measure current lighting conditions. When a computer is aware of the surrounding lighting conditions, it can do several things with this information. Light sensors support the following:

     Automatic screen brightness.

     Automatic keyboard illumination.

     Light-aware applications.

     Light-specific themes and actions.

    Automatic Screen Brightness

    What a user perceives as optimal screen brightness on a laptop that has an LCD screen is a function of the current lighting conditions and other factors, such as how the user’s eyes adjust to lighting conditions over time. In low-light conditions, such as

    in a dark room, the optimal screen brightness is a lower value. As surrounding lighting levels increase, the optimal screen brightness also increases. In varying lighting conditions, users prefer the computer screen to automatically adjust its own screen brightness.

    In addition to the viewing experience, an automatic display brightness control can increase battery life. In Windows? 7, this is known as “adaptive brightness.” By

    dimming the display when it is appropriate, a computer can reduce power consumption.

    Automatic Keyboard Illumination

    Computer keyboards are typically not usable in dark lighting conditions. To resolve this problem, either top illumination or reverse illumination can help users see the keyboard when they type. To optimize power consumption, hardware manufacturers can use ALSs to control the intensity of the illumination based on the lighting conditions.

    Light-Aware Applications

    Typically, laptops are not usable in direct sunlight because of the limited capability of the screen to maintain contrast in bright light. If applications respond to current lighting conditions, they can alter their user information (UI) content to maximize contrast and legibility. Combining applications with adaptive brightness can make computers more usable in adverse lighting conditions.

    For more information about how to build light-aware applications, see “Implementing Light-Aware UI Using the Windows Sensor and Location Platform” on

    the WHDC Windows Sensor and Location Platform page.

    February 19, 2009 ? 2009 Microsoft Corporation. All rights reserved.

    Integrating Ambient Light Sensors with Windows 7 Computers - 5

    Light-Specific Themes and Actions

    These light sensor features are based on practical issues and needs. You can also add some fun to lighting conditions by applying application or system themes that are based on the lighting. These features are implemented by using the Sensor API. Examples of these features include changing the desktop background image and changing sound themes based on the current lighting conditions.

    Using the Windows Sensor and Location Platform

    Often sensor technology is not adopted because of a lack of standards and developer resources for interacting with sensor devices on Windows.

    Windows 7 addresses this problem by introducing a comprehensive new platform for sensor and location devices that is called the Windows Sensor and Location Platform.

    Windows 7 provides a common driver model, API, permissions model, and configuration UI for interacting with sensor and location devices. For a more detailed introduction to the Windows Sensor and Location Platform, see Introducing the Windows Sensor and Location Platformon the WHDC Windows

    Sensor and Location Platform page.

    Ambient Light Sensor Integration Checklist

    The following is a high-level checklist for developers for integrating sensor hardware into computers. The rest of this document describes the process and background information in detail.

    ; Select a suitable light sensor.

    ; Select optimized placement for the light sensor in your computer enclosure. ; Perform integration and calibration with the embedded controller firmware. ; Use Advanced Configuration and Power Interface (ACPI) BIOS firmware that

    exposes the ALS hardware so that it complies with the ACPI 3.0b specification.

    The firmware must enumerate the light sensor with Plug and Play ID ACPI0008,

    support the _ALI method with notifications, and support the _ALR method. ; Construct an ambient light response (ALR) curve that is based on relevant user

    preference data. This step is critical because this data has the largest influence on

    the overall user experience for adaptive brightness.

    ; Integrate light sensor and adaptive brightness configuration into the computer

    imaging and preconfiguration process. Use the SensorsConfig.exe sensor

    configuration tool to configure sensor permissions. Set registry configuration

    parameters for ALR curve data and for display response interval and Illuminance

    change sensitivity.

    ; Make sure that the display implementation complies and is optimized.

    Specifically, do the following:

     Make sure that the brightness control is exposed by using Windows Display

    Driver Model (WDDM). Implement _BCL and _BCM ACPI brightness methods

    or WDDM brightness control in the graphics adapter.

    February 19, 2009 ? 2009 Microsoft Corporation. All rights reserved.

    Integrating Ambient Light Sensors with Windows 7 Computers - 6

     Make sure that transitions are smooth for display brightness level changes

    and implement these changes in hardware.

     Make sure that sufficient display brightness levels are exposed. We suggest

    the maximum supported ACPI count of 0 to 100 percent in 1-percent

    increments, for a total of 101 total levels.

    ; Test light sensors and adaptive brightness by doing the following:

     Make sure that the SensrSvc service is started.

     Validate that display brightness changes when the lighting changes.

     Test behavior with users to validate ALR data.

     If you have implemented a sensor driver to support non-ACPI ALSs, make

    sure that your driver passes the applicable logo tests (INPUT-0048,

    INPUT-0049, and INPUT-050). For more information about these

    requirements, see LogoPoint.

    Understanding Adaptive Brightness Support in Windows 7 In Windows 7, automatic brightness control with ALSs (adaptive brightness) is fully supported in the box. In many ways, the screen brightness experience is enhanced for Windows 7, and adaptive brightness is an important aspect of these changes. The following components for adaptive brightness are included in Windows 7: Drivers for ALSs that are exposed through ACPI and comply with the ACPI 3.0b

    specification.

     A sensor monitoring Windows NT? service that consumes light sensor data and

    then controls the display brightness.

     A power setting exposed in the Control Panel Advanced Power Configuration

    application that consumers use to enable or disable adaptive brightness. Adaptive brightness registry configuration parameters.

    To better understand these components, the following examines how they support adaptive brightness.

    Drivers for ACPI Integrated Ambient Light Sensors

    Windows 7 now features class driver support for ALS implementations that comply with ACPI 3.0b. This is good news for OEMs and independent hardware vendors (IHVs) that would otherwise be required to write custom drivers for their hardware to support ALSs. In addition to directly supporting the adaptive brightness feature, these drivers also support client applications that access light sensors by using the Sensor API, because the drivers integrate with the Windows Sensor and Location Platform.

    Sensor Monitor Windows NT Service

    In Windows 7, brightness control with ALSs is handled in a Windows NT service. This service starts on demand when ALS hardware is present and therefore does not impose overhead on systems that do not have ALS hardware. This start optimization is accomplished through the new service control manager (SCM) for Windows 7. To control the screen brightness level, this Windows NT service connects to ALSs that are February 19, 2009 ? 2009 Microsoft Corporation. All rights reserved.

    Integrating Ambient Light Sensors with Windows 7 Computers - 7

    built into the computer, processes data from the sensors, and then adjusts the brightness accordingly. If adaptive brightness is disabled through the power setting, this service stops automatically.

    Power Setting

    To let the user turn on or turn off adaptive brightness, a power setting for adaptive brightness is exposed in the Control Panel Advanced Power Configuration application. For each power plan, two settings exist for adaptive brightness: one for AC power and one for DC power. These settings have both an on and an off state.

    Registry Configuration Parameters

    Windows 7 provides the following registry parameters that you can use to fine-tune the behavior of the adaptive brightness feature:

     An ALR curve, which is a collection of data that determines how the brightness of

    the screen changes, based on lighting conditions and the user's screen brightness

    preference.

     Display response interval, which specifies how frequently adaptive brightness

    can change the screen brightness. By varying this parameter, you can alter the

    overall responsiveness for more subtle or more responsive behavior. Illuminance change sensitivity, which establishes a threshold where brightness

    must change by at least the value that was specified before screen brightness

    changes occur. You can also use this parameter to control how subtle or

    responsive the user perceives the adaptive brightness feature.

For more information about these parameters, see Tuning and Configuring Adaptive

    Brightness Behavior later in this document.

    Types of Light Sensors

    ALSs come in two fundamental types:

     Analog light sensors are connected to an embedded controller with an A/D

    converter, and they require firmware that can accurately interpret the light

    sensor data and compensate for various conditions and phenomena that affect

    readings. Some examples of these phenomena include infrared light rejection and

    light frequency compensation. For example, fluorescent lights vary in intensity

    with the frequency of the AC power that is supplied to the fixture. Analog sensors

    are typically very inexpensive.

     Digital light sensors are more expensive than analog sensors but have

    advantages over analog light sensors. These sensors can automatically

    compensate for various conditions and phenomena. Digital light sensors are also

    extremely compact and can be more expensive than analog sensors.

    Regardless of which type of light sensor you choose, take care to ensure that accurate readings are taken and exposed to the system.

    February 19, 2009 ? 2009 Microsoft Corporation. All rights reserved.

    Integrating Ambient Light Sensors with Windows 7 Computers - 8

    Integrating Light Sensors with Computer Hardware

    Selecting a suitable ALS device is critical. Several things can greatly affect what can be done with the information that the light sensors provide. These considerations include the following:

     The type of sensor (analog versus digital).

     The cost per unit.

     The accuracy and resolution of the sensor.

     The dynamic range of the sensor.

     Supported bus technology (digital only).

     The sampling rate (digital only).

     Power consumption.

     Packaging and placement options.

    Although these are all important considerations, two factors warrant special consideration:

     Accuracy and resolution

    To deliver an optimal user experience for adaptive brightness and light-aware UI

    in applications, accurate sensor data is required as input. Generally, the more

    accurate the sensor is, the better the corresponding user experience will be. A

    good goal for actual calibrated values that an ALS exposes is a consistent accuracy

    of within 10 to 20 percent of actual lighting conditions.

     Dynamic range

    The dynamic range of a light sensor limits the environments in which it can be

    used. Because applications can be light-aware in Windows, outdoor lighting

    conditions are an important consideration.

    Table 1. Common Lighting Conditions and Approximate Illuminance Values

    Lighting condition Illuminance (lux)

    Pitch black 1

    Very dark 10

    Dark indoors 50

    Dim indoors 100

    Normal indoors 300

    Bright indoors 1,000

    Dim outdoors 5,000

    Cloudy outdoors 30,000

    Direct sunlight 100,000

    Based on these values, we recommend a dynamic range of at least 10,000 to 40,000 lux. Display brightness control is generally performed in the lower ranges (such as up to 1,000 to 2,000 lux) where light-aware applications optimize their content for outdoor viewability in the higher ranges (such as 5,000 to 50,000 lux). With digital light sensors, you can typically change the dynamic range by sending commands to the sensor, which alter the analog gain.

    February 19, 2009 ? 2009 Microsoft Corporation. All rights reserved.

    Integrating Ambient Light Sensors with Windows 7 Computers - 9

    Number of Light Sensors

    Generally, the more ALSs that are available to measure a lighting condition, the better the estimate of the actual illuminance. As a practical matter, each light sensor adds cost and uses space on the surface of the computer.

    A minimal implementation for ALS hardware is a single sensor. Although this functions sometimes, regardless of where the sensor is positioned it can be obscured by the user’s hand, a shadow, or other obstructions. Adding at least one additional sensor can give a much better approximation of the actual lighting conditions. This is especially true when applications apply heuristics to the data from multiple light sensors to arrive at a “best approximation” of the actual lighting conditions. This can range from simple averaging of values to taking the highest readingassuming

    obstruction of the sensor instead of point illumination such as glare.

    Light Sensor Placement

    Correct placement of light sensors is another important aspect of good system design. The light sensors should be located on the same plane as the display (facing the user). This is necessary because the sensor is measuring the lighting conditions of the screen itself to support adaptive brightness and light-aware applications that display their content on the screen.

    Also, avoid placing the light sensor in areas of the computer that are likely to be obscured from the light source or sources by shadows.

    Figure 1 is an example user scenario in which a direct light source is behind the user. A shadow is cast over the lower half of the screen and the base of the computer. This scenario shows the fact that you should place light sensors near the top of the screen and facing the user.

Figure 1: Optimal light sensor placement

    February 19, 2009 ? 2009 Microsoft Corporation. All rights reserved.

    Integrating Ambient Light Sensors with Windows 7 Computers - 10

    Light Sensor Filters, Lenses, Enclosures, and Calibration

    Usually, light sensors are integrated into the computer and include a filter or lens, which changes the response of the ALS. You should carefully calibrate light sensors in the computer enclosure so that they provide accurate data. This calibration is typically performed in the embedded controller that is used to interface with the light sensor.

    ACPI Integration

    Correctly integrating the ALSs with ACPI ensures that in-box drivers load and work with the adaptive brightness feature.

    For a sensor to function, it must meet the following high-level requirements: The _ALI (Illuminance) method is implemented, with support for notifications. The _ALR (light response curve) method is implemented, but notifications are not

    required.

     The device uses a Plug and Play ID ACPI0008.

    After the light sensor meets these criteria, it loads the ACPI ALS in-box drivers and the adaptive brightness feature functions. Table 2 shows the ACPI 3.0b methods and corresponding support that the in-box ACPI light sensor drivers in Windows implements.

    Table 2. ACPI 3.0b Methods and Corresponding Support

    Method GetData() OnDataUpdated supported Change sensitivity

    supported (notifications) supported

    _ALI x x x

    _ALR x

    _ALC x x

    _ALT x x

    _ALP

    Be aware that the change sensitivity value is measured in percentage change, not in lux change.

    Configuring Sensor Permissions

    Sensors can expose sensitive data, such as the user’s current location and health-

    related data. Because of this, sensors are disabled by default. Applications can request permissions to sensors, and the user can navigate to the Control Panel Location and Other Sensors application to view and configure sensor permissions. In some cases, the user should not be required to grant permissions. ALSs, for example, do not usually expose sensitive data about the user, so they should always be enabled.

    You can preconfigure sensor permissions by using the SensorsConfig.exe sensor configuration tool. For the adaptive brightness feature to work, ALSs that are used with adaptive brightness must have permissions configured.

    For more information about the sensor configuration tool, see the WHDC Windows

    Sensor and Location Platform page.

    February 19, 2009 ? 2009 Microsoft Corporation. All rights reserved.

Report this document

For any questions or suggestions please email
cust-service@docsford.com