You can control the jrk by issuing serial commands.
If your jrk’s input mode is Serial and its Serial Mode is “UART, detect baud rate”, you must first send it the byte 0xAA (170 in decimal) on the RX line (so it can detect the baud rate) before sending it any commands.
The jrk serial command protocol is fairly straightforward. Communication is achieved by sending command packets consisting of a single command byte followed by any data bytes that command requires. Command bytes always have their most significant bits set (i.e. they range from 128–255, or 0x80–0xFF in hex) while data bytes always have their most significant bits cleared (i.e. they range from 0–127, or 0x00–0x7F in hex). This means that each data byte can only transmit seven bits of information.
The jrk responds to two sub-protocols:
This is the simpler and more compact of the two protocols; it is the protocol you should use if your jrk is the only device connected to your serial line. The jrk compact protocol command packet is simply:
command byte (with MSB set), any necessary data bytes
For example, if we want to set the target to 4080 (the highest value achievable using the low resolution Set Target commands), we could send the following byte sequence:
in hex: 0xE1, 0x7F
The byte 0xE1 is the Set Target Low Resolution Forward command, and the data byte contains the motor speed.
Note that the Set Target High Resolution command uses some of the bits in the command byte to represent data, so there is not a one-to-one correspondence between command bytes and commands.
This protocol is compatible with the serial protocol used by our other serial motor and servo controllers. As such, you can daisy-chain a jrk on a single serial line along with our other serial controllers (including additional jrks) and, using this protocol, send commands specifically to the desired jrk without confusing the other devices on the line.
The Pololu protocol is to transmit 0xAA (170 in decimal) as the first (command) byte, followed by a Device Number data byte. The default Device Number for the jrk is 11, but this is a configuration parameter you can change. Any jrk on the line whose device number matches the specified device number accepts the command that follows; all other Pololu devices ignore the command. The remaining bytes in the command packet are the same as the compact protocol command packet you would send, with one key difference: Therefore, the command packet is:
0xAA, device number byte, command byte , any necessary data bytes
For example, if we want to set the target to 4080 for a jrk with device number 11, we could send the following byte sequence:
in hex: 0xAA, 0x0B, 0x61, 0x7F
Note that 0x61 is the command 0xE1 with its most significant bit cleared.
The jrk responds to both the Pololu and Compact protocols on the fly; you do not need to use a configuration parameter to identify which protocol you are using.