Hardware‎ > ‎Sensor Hardware‎ > ‎

USB Spec

This is how the BeeStalker sensor communicate.
Our friends from MCS (http://www.mcselec.com) are so kind and sell single product IDs... well that's enough for any type of sensor you could think od... just read on :)

All BeeStalker sensords use follow VID/PID: 

Product String Descriptor

A sensor is identified by its Product String Descriptor. If there isn't any (cheap USB-Serial ICs do not support these), we default to SCPI over Serial. *IDN? will be used to get this string.

USB allows for 256byte descriptors. As the first byte is the descriptor length field and the second byte represents the descriptor type, we end up with 254bytes for the string. Unfortunately, USB requires strings in UTF16 encoding. So we end up with 127 characters.

String handling is a little bit awkward. So we try to use some binary coding instead. Because of this, BASE64 is used to encode our binary data into our 127 characters.

BASE64 encodes 3 bytes of data in 4 ascii characters. This means we can use 124 characters to encode 93 bytes. This is the maximum!

A cheap CH341 allows for 96 characters. This gives 72 bytes payload.
The nice little MCP2221 supports up to 60 characters or 45bytes.

These bytes are now used like this:
 "Vendor" ID  Device Id
 64 bit   fill to size

The "Vendor" IDs are fixed and will be managed somewhere here on this page :)

To maximize compatibility, the Device-ID field can be seen as the lsb.
So if you decide to use 8+1 in a device with the ID 0x01, then you cannot have a different 8+4 devices with 0x00000001.
You can, however somewhen choose to change your firmware from using 8+1 to 8+4... the host software should allow for this.

With this the minimum needed product string descriptor length is 9 bytes /3 *4=12 characters!
This would allow for 256 different products.

To somehow make this a litte more useful BeeStalker (for) now allows following structures for the  Product Descriptor String:

 Address Space
Number of Products
 Bytes BASE64 Characters 
 8+1  256 12 
 8+4  4 294 967 296 (32bit!) 12  16 
 8+16  huge... 128bit 24  32 


The serial string is split in 3 parts.
  1. Firmware Version
  2. Highest compatible protocol version (i.e highest understood) protocol version supported by the device
  3. Lowest compatible (i.e lowest understood) protocol version supported by the device
  4. The hardware version
  5. The actual serial.
With the considerations we made above following structures should be used, only:

 Firmware version  highest protocol version lowest protocol version  Hardware Version Serial Number  Bytes  BASE64 Characters
 2 bytes (16bit)  2 bytes (16bit)2 bytes (16bit)  1 byte2 bytes (16bit) 9 12
 4 bytes (32bit)  4 bytes (32bit)4 bytes (32bit)  2 bytes4 bytes (32bit) 18 24
 4 bytes (32bit)  4 bytes (32bit)4 bytes (32bit)  2 bytes16 bytes (128bit) 30 40