(Excerpted from Donn Morse's whitepaper, available at http://code.msdn.microsoft.com/motionsensor.

The Sensor Protocol

The Parallax driver supports a simple protocol that includes a device identifier, element count, element size, and element packet. The BASIC Stamp microcontroller transmits this data to the driver. The driver parses the data and translates it into properties and events that are accessed by a Sensor application.
For the PIR sensor, the multiple byte packet has the following format:

Sensor ID Element Count Element Size Element Interval
5 1 1 0 0 0 7 5 0 NULL

In the packet that appears in the previous table, the sensor has detected no motion, so, the Element field contains a value of zero. The interval is set to .75 seconds, which corresponds to the Interval field of 00750 milliseconds.

The following table specifies the packet format for each of the four sensors that are supported by the Parallax sample driver.

Note: sensors marked with a * were present in Donn's original spec (values are hard-coded in SensorBaseDriver::ProcessReadData method).

Sensor Sensor ID Element count Element size Elements Interval
*Digital Compass 1 1 3 Heading (3-bytes) 6-bytes
*Temperature & humidity (Sensiron) 2 2 temperature, humiditi
*Flexiforce sensor 3
*Distance (Ultrasonic ping) 4 1 5 Distance (5-bytes) 6-bytes
*Passive infrared (PIR) 5 1 1 State (1-byte) 6-bytes
*2-axis accelerometer (Memsic) 6 1 8 x-axis (3-bytes) y-axis (3-bytes) 6-bytes
*Light sensor (QTI) 7
*Vibration (Piezo) 8
*3-axis accelerometer (Hitachi H48C) 9 3 4 x-axis, y-axis, z-axis (each 4-bytes) 5-bytes

Last edited Jan 19, 2010 at 9:23 PM by kobush, version 6


No comments yet.