RPI Haptics:Vibrobyte Protocol
From BluWiki
Vibrobytes receive serial data. To make it easier to control the vibrobytes, manipulate the control data, and send control data over a network, there is also an OSC to serial interpreter for Max/MSP.
Contents |
Serial Communication, r3
Revision 3 breaks the basic 3-byte packet pattern of revisions 1 and 2. Packets are composed of anywhere from 3 to 8 bytes and are specialized for a continuous transmission system.
Every packet begins with a header byte followed by an address byte. Remaining bytes are optional and specified by the header.
Header and Address
The header byte takes the form 011a bcde
- a address type: 0 is single, 1 is group
- b-e packet includes output state, led state, modes, and group state, respectively
Notice that the header byte is the only byte to begin with a 0, distinguishing it from all other bytes.
The address byte takes the form 1aaa aaaa, with all bits a used for an address 0-127.
Optional information
Output State
The output state is encoded in two bytes 1wwa aass 1fff fooo
- w wave shape
- a amplitude
- s sustain
- f frequency
- o outputs this applies to
LED state
The LED state is encoded in two bytes 11ir rrrg 1ggg bbbb
- i ir
- r red
- g green
- b blue
Modes
Output mode and LED mode is encoded in one byte 1111 ooll
- o output mode
- l led mode
Groups
Groups are encoded in one byte 1ggg gggg
- g whether the vibrobyte belongs to group g (where g = [1..7])
OSC Communication, r3
All OSC control packets begin with /vibrobyte.
Every float should be in the range [0, 1].
As per OSC-1.0, i is int32, f is float32, and s is string.
/vibrobyte/output ,sisfffiii dest-type dest wave amp sus freq out1 out2 out3 /vibrobyte/output/mode ,sis dest-type dest output-mode /vibrobyte/led ,siffff dest-type dest ir red green blue /vibrobyte/led/mode ,sis dest-type dest led-mode /vibrobyte/group/add ,sii dest-type dest group /vibrobyte/group/remove ,sii dest-type dest group /vibrobyte/group/reset ,si dest-type dest
Glossary
- dest-type destination type for this message, takes the values {single, group}
- dest
- when dest-type is single, a vibrobyte address
- when dest-type is group, a group number
- wave is the wave shape, takes the value {square, saw-ascending, saw-descending, absolute-sine}
- amp is the amplitude of the wave
- sus is the sustain of the wave
- freq is the frequency of the wave
- out1, out2 and out3 are boolean values describing which outputs this message applies to
- output-mode takes the value {repeat, impulse, off}
- led-mode takes the value {battery, quality, blinkinput, blinkoutput}
- group is a group number, (starting with group 1, group 0 is reserved for referring to all vibrobytes)



