Sensor Comm API

type: SensorWord

typedef union SensorWord_t {
  unsigned char raw[2];
  struct {
    unsigned sensorType:3; //range:0-7
    unsigned sensorID:3;   //range:0-7
    unsigned data:10;      //range:0-1024
  };
} SensorWord;
We have the 'raw' member for sending the SensorWord over serial, and the actual elements of the SensorWord: the 3bit sensor type, the 3bit sensor ID, and 10 bits of data. All sensor sections will use this data type for communicating information to the serial communications procedure.

method: sendWord(SensorWord sword)

Each sensor handler will submit data for sending over the serial line with via this method.

Standards Proposal

First and foremost, it would be best for each sensor to have its own buffer to hold its sensor word that it is preparing to send to serial. This way we can avoid memory leaks. It would also be a good idea to assign each type of sensor its own specific type, and each sensor its own ID. We will probably be tweaking the sizes of each field in the SensorWord type, but it will most likely stay at 2 bytes. RFC

One Byte Word Proposal

Assuming we have at most 7 sensors per router, we could probably just use one byte per word (at 3 bits for the ID, and dump the type member). This would also hinge on whether we can fit enough useful information into the remaining 5 bytes. RFC

Serial Format Look-up Table

Here is the serial format for the identification byte so far. This will be the first byte transmitted. Then, immediately following will be the actual data. As of now, there will only be at maximum 8 bits of data transmitted for convenience sake. If there is need to send ten bits of data, this can be changed quickly. On the router end, check for the hexadecimal value when data is received from the microcontroller. These values can be found under the Hexadecimal Info Byte column.

SensorType Binary Form Sensor ID Binary Form Hexadecimal Info Byte
Trip001IN10010×24
Trip001OUT10100×28
Trip001IN20110x2C
Trip001OUT21000×30
Mic010micLevel10010×44
Mic010micDanger10100×48
Mic010micLevel20110x4C
Mic010micDanger21000×50
 
Back to top
projects/securouter/sensor_comm_api.txt · Last modified: 2009/02/03 18:02 by jazzman
 
 
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0