Detecting Ultrabook Sensors

With the recent launch of the 3rd Generation Intel Core Processors, Intel has introduced a new breed of Ultrabook and it’s a game-changer.  Ultrabooks and Convertibles based on the 3rd Generation Intel Core Processors come with new touch and sensor features.  In this blog, we will focus on the sensors and how to detect their presence on an Ultrabook running Windows 8:

  1. What sensors are available for the Ultrabook/Convertible
  2. What sensors are recommended/required for the Ultrabook/Convertible
  3. How to determine  which sensors are on an Ultrabook

New Sensors Available for the Ultrabook/Convertible

There are 5 Sensors relevant to the Ultrabook/Convertibles:

  1. Compass
  2. Accelerometer
  3. Gyroscope
  4. GPS
  5. Ambient Light Sensor




Sensors Recommended for the Ultrabook

The following table provides information about the new sensors that are recommended for the Ultrabook (and required for convertibles.)   It will be up to the OEMs which sensors are included for their specific models/usages.



Sensor Detection

Figuring out which sensors are on Convertibles is easy.  All of the above sensors are required.  For the basic Ultrabook, it isn't so easy.  There will be different classes of Ultrabooks:  the Business Ultrabook and the Consumer Ultrabook.  While OEMs have been given a minimum specification that dictates what features an Ultrabook has, there will be some differentiating amongst the OEMS for the different classes of computers.  The OEMs will determine which sensors are best suited for their various models.

Detecting Sensors on an Ultrabook

There are a few ways in which to determine if a system supports the sensors, and if so, which sensors:

  1. The first, most basic way, is to find the Computer Management App on the Metro Start Menu (if it isn't there you can view “All Apps” by right-clicking in the window and then click on the “All Apps” icon in the lower right-hand side of the window.
  2. If you want to get finer detail regarding each sensor and possibly even have  some control over some of the sensor parameters (for testing purposes) you can run the Sensor Diagnostic Tool – it is part of the Windows Driver Kit ( WDK).
  3. Thirdly, if you are writing Apps for Windows 8 you will need to have your App query for all the sensors so that the right execution path can be taken (i.e. if the sensor you wanted to use is not present, you will need to find an alternate way of providing the user experience.)

Computer Management/Device Manager

Once the Device Manager is up, look for “Sensors” in the device tree.   The “HID Sensor Collection” contains the new sensors associated with Ultrabook.  Unfortunately it does not provide a breakout of which of the sensors are on the system; just that at least one of them is present.   HID is “Human Interface Device” and the five Ultrabook sensors use the HID protocol.



Sensor Diagnostic Tool

The Sensor Diagnostic tool uses the Sensor and Location API for data retrieval, event handling, report intervals, changing sensitivity, and property retrieval.  The tool can also be used to write the sensor data to a CSV file.  I should note, however that the Sensor Diagnostic Tool really exists to aid with the development of Windows Drivers; its true use is to help with the testing and optimization of Windows Drivers.  This tool can be found in the following folder once you have installed the Windows Driver Kit:  C:\Program Files (x86)\Windows Kits\8.0\Tools\x86.

Sensor Diagnostic Tool run on an Ivy Bridge Software Development Platform + USB Sensor Hub


Programatically detecting sensors using the Sensor APIs

The Sensor Diagnostic Tool is useful to monitor and test your sensors; however, in software that is written to take advantage of the Ultrabook Sensors, it would be better to call the Sensor APIs from within the code in order to ensure that the platform supports the sensors.  If the system does not support a particular sensor then the software should still be able to offer a different but compelling experience for the end user.

Before we talk about the specific APIs, let’s take a look at what the development environment looks like for Windows 8.  Take note of the languages supported in Metro Style Apps and Desktop Apps.  Also note that for Metro Style Apps, the Device APIs are included inside the Windows Run Time environment.



There is also a Windows 8 Sensor Platform that provides support for both Metro style app and desktop development.  The examples below pertain to the Windows 8 Desktop environment.  For Desktop Apps, accessing the sensors is done via the object SensorManager.  Sensors can be queried in the following manners:

  • Ask by Type
  • Ask by Category
  • Ask by Category “All”

Asking by Type

If you are interested in a specific type of sensor, for example, “Gyrometer3D”, SensorManager will consult the list of sensor hardware present on the computer and return a collection of matching objects bound to that hardware.   The Sensor Collection may have zero or more objects in it but usually will have only one.

  • Method:  GetSensorByType
  • Include Files:  InitGuid.h, SensorsApi.h, Sensors.h


Steps:
Create a COM interface to the SensorManager objectGet a collection of all 3-axis Gyros on the computer

result = pSensorManager-> GetSensorsByType(SENSOR_TYPE_GYROMETER_3D, &pSensorCollection)


Asking by Category

Rather than looking for a specific type of sensor, you may be interested in looking for all sensors in a specific category, for example, “Motion” sensors.  SensorManager will consult the list of sensor hardware on the computer, and return a collection of Motion objects bound to that hardware. The SensorCollection may have zero or more objects in it.  On most computers, the collection will have two Motion objects:  Accelerometer3D and Gyrometer3D.

  • Method:  GetSensorByCategory
  • Include Files:  InitGuid.h, SensorsApi.h, Sensors.h

Steps:

  1. Create a COM interface to the SensorManager object
  2. Get a collection of all Motion Sensors on the computer

      result = pSensorManager-> GetSensorsByCategory(SENSOR_CATEGORY_MOTION, &pSensorCollection)


Asking by Category “ALL”

Finally, you might be interested on getting all the sensors on the computer by using the “ALL” method.  This would most likely be the preferred way to query the sensors on the system; however, it will return all sensors, not just the five listed above. Once again, SensorManager will consult the list of sensor hardware on the computer and return a collection of all the objects bound to that hardware. The SensorCollection may have zero or more objects in it.  On most computers, the collection will have seven or more objects.  Note that C++ does not have a GetAllSensors call, so you must use GetSensorsByCategory(SENSOR_CATEGORY_ALL, …) instead.

  • Method:  GetSensorsByCategory
  • Include Files:  InitGuid.h, SensorsApi.h, Sensors.h

Steps:

  1. Create a COM interface to the SensorManager object
  2. Get a collection of all Sensors on the computer    


        result = pSensorManager-> GetSensorsByCategory(SENSOR_CATEGORY_ALL,&pSensorCollection)


Querying the Sensors in Windows 8 UI

For the WinRT environment, you will simply use the methods to get the sensor object and test for NULL.  The Geolocation method is a little different. Here are some examples:



Resources

Here are some good resources from the Microsoft website for developing sensor-enabled apps:
Introducing the Windows Sensor and Location Platform

 Also, here are some more blogs/articles that may be useful regarding on Ultrabooks and Windows 8:

Conclusion

The primary goal for this blog was to educate the reader on how to detect the  required sensors supported for Windows 8 Ultrabooks.  The focus was primarily on the “clam-shell” form factor since Convertibles, Tablets and Mobile devices will be required to have all the sensors.  It is important to note that sensor support for Ultrabooks is dependent on the OEM and Model.  While it is possible to run local tools to determine the existence of sensors, software developers will need to be able to programmatically check for the sensors so that their software will not attempt to use a device that may or may not be there.

 

For more complete information about compiler optimizations, see our Optimization Notice.

Comments

's picture

Sensors and Software that could have been done 1980!
When is Intel and Microsoft going to do some new Tech?

ie. One Chip on Glass HD 5.55" 1280x720 AMOLED 12 with x86 64 bit quad with RAM/GPU, Free BIOS and Sensors as a basic building block. Legacy software compatable.

The basic building block can be a , Phone, Car Dash Dispaly, Hand free Remote, Notepad use 2 side by side for Note book, Note Pad. Laptop , Use 4 off for Desktop, Home Media center.

The design challange for Intel is being able to do the intergration at chip level.
Oh and pay for Licence use of AMOLED.
Everything should run off Li Battery by now as 10Watt devices is wy ARM works!
As to the OS most companys that can handle more than 10 full time software guys should be able to surpass Windows 8! Microsoft have a few more than that!

's picture

I have been absent for some time, but now I remember why I used to love this web site. Thank you, I will try and check back more frequently. How frequently you update your site?

's picture

hi...This is very nice blog...
Thanks for sharing this...

's picture

some of sensors do not work with windows 8 RTM build 9200.
are any driver available for Windows 8 RTM? Drives for windows 8 release preview does not install on RTM

Vassili Y.'s picture

There is a problem, may be with the drivers, may be something else. But Geolocation gives you data received through Wi-Fi. There no possibility using .NET to get data from GPS. Also the Sensor Diagnostic Tool cannot "see" the GPS.

Gael Hofemeier (Intel)'s picture

Hi Vassili - It would make sense that you are getting geolocation information from Wi-Fi if, for some reason, your system is not acknowledging the GPS (and if you are indoors, your system will move to Wi-Fi based geolocation services.) Are you on an OEM system? Which one? I have heard there are some issues with GPS still - I'm looking into it further.

John Mechalas, one of my collegues has written some good blogs on GPS/Geolocation: http://software.intel.com/en-us/blogs/2012/09/11/the-winrt-location-api-where-did-my-location-data-come-from

Follow me on Twitter: @GHIntelBlogs Facebook: https://www.facebook.com/gh.intelblogs
Abhishek 81's picture

This article gives an overview how we can check for the sensors available in Ultrabook,helpful

Abhishek Nandy
karthikbecse's picture

helpful

karthik