Friday, May 04, 2007

Sensors

This week's Economist contains some predictions about machine-to-machine wireless communications. Most of the devices mentioned seemed to be sensors - whether used by the military, civil engineers, security guards, doctors, or retailers.

This got me thinking about how sensors can be handled on the web. We're all used to dealing with mice and keyboards - what about location or pressure sensors, or thermometers, accelerometers and gyroscopes, which are already being integrated into phones?

Providing sensory data to the web
My idea is that browsers should pull together all this information and make it available to web pages, in a standard way. Sensory information is becoming more and more important, especially in the mobile web, where knowledge of location, direction, and acceleration are vital to display great web pages.

For example, imagine if the following XML fragment was accessible via a javascript sensors() function:

<sensors xmlns="www.sensors.org/namespace">
<keyboard shift="" ctrl="" alt="" ins="" value="a"/>
<mouse x="20px" y="30px" left="down" right="none" middle="none"/>
<touch pressure="30" x="150px" y="50px"/>
<temperature value="23C"/>
<video src="file://c/program%20files/webcam/webcam.mov"/>
<accel x="2" y="0" z="0"/>
<location latitude="37.386013" longitude="-122.082932"/>
</sensors>

Here, the browser is presenting all the information it can find about its environment from connected sensors - the A button is down on a keyboard, the mouse is being clicked, the screen is being touched, the temperature is being read, there is a connected webcam, the device is being accelerated, and it knows its position. All defined in a (fictitious) standard XML data format.

Using sensory data
Different devices have different sensors - the Wii has an accelerometer, the Nokia N95 has GPS, my phone has a camera - so the sensory data will be different in each case. And there may be privacy implications - you might configure your browser to grant location data only to the emergency services and your favourite map website.

So the web developer's first step will be to parse the data to find out which sensors are available. They could do this using XPath - for example sensors('//accel/@x') only returns a value if there is an accelerometer.

Imagine using the following javascript:

window.setTimeout($(div1).innerHTML = sensors('//location/@latitude'),10);

which in a single line, updates the div1 tag to contain up to date latitude information every 10 milliseconds.

The possibilities are endless

  • satellite navigation in the browser
  • scroll web pages using acceleration
  • pen doodling on the web, using a touch screen and SVG / VML
  • website games using local web cams.

Personalising your pages
Sensory data is the ultimate way to personalize web pages. They can react in realtime to the local environment that web page visitors are experiencing.

There is currently no standard framework for accessing this data - but the simple ideas above would bring the web to the next level.

1 comment:

Ruud Steltenpool said...

maybe: if it detects you very briefly watch just below your screen it scrolls down