Get Help
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Get Help
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
The Servotor32 can be connected to your computer either by USB or Bluetooth. Both of these connections act as an old-style serial port, (by default 9600N1). The advantage of this format is that it is very easy to send commands back and forth using a terminal, like the one included with the Arduino software, like so:
By default, the Servotor32 comes pre-loaded with software to work with PoMoCo. Here are some of the commands you can send to Servotor32 using its default firmware.
Note: Where convenient, we attempt to stick to the convention of the ever-popular SSC32 (although we don’t
guarantee compatibility), while adding to it. In that vein, all letters are non-case sensitive, and ‘enter’ can be
interpreted as either carriage return (r) or newline (n).
Move a servo by typing:
1 |
#<Servo Number>P<Position Number> <Press Enter> |
Position number is in microseconds (uS). Centered is 1500uS, while -90deg is 500uS, and +90deg is 2500uS. More detail on how servo timings work is available here.
For example, to move the servo on the pin labeled 0 to center would be:
1 |
#0P1500 <Press Enter> |
This makes the servo in question go limp. Great for saving power, or when you just want it to stop moving
1 |
#<Servo Number>L |
For example, to make servo 5 stop moving:
1 |
#5L <Press Enter> |
This kills all 32 servos at once. This is good if you just want the thing to stop immediately. One use case would be if it its hurting itself or getting jerked around and you want it to stop moving, or if you just don’t want to type kill for every servo.
1 |
K <Press Enter> |
Move all 32 servos to 1500uS (i.e. centered)
1 |
C <Press Enter> |
You can check which version of the firmware the board is running by opening the arduino serial terminal and typing ‘V’ and pressing enter (without the quotation marks) like so:
1 |
V <Press Enter> |
This command is used by PoMoCo to identify the board.
This gives off all the nitty-gritty information about the status of all the servos.
1 |
D <Press Enter> |
Configures the pins on the Servotor32
The command is:
1 |
S<pin designator><pin option>\n |
1 |
S03H\n |
1 |
SA6L\n |
This command asks the Servotor to take 1 or more measurements with the ultrasonic, and to report back the median of the measurements.
U<Number of measurements> <Press Enter>
For example, if you wanted to return the average of 5 measurents, you would send:
1 |
U5 <Press Enter> |
The measurement in centimeters would be returned in ASCII plaintext, followed by a newline (aka enter) character:
1 |
25 |
This command adds an offset to a servo in uS. By default, the offsets are all 0. This offset is saved in the EEPROM of the board, meaning it will stay even if it is the board is unpowered. The values in the EEPROM are loaded into RAM by default when the board boots up. When the offset is changed, both the EEPROM and RAM versions are changed. You can erase the offset again by setting it to zero.
1 |
#<Servo Number> O <Offset Value> <Press Enter> |
For example, if you wanted to add a positive offset of +100uS to servo 3, you would send:
1 |
#3PO100 <Press Enter> |
This command also accepts negative offsets, so for an offset of -300uS on servo 5, you would send:
1 |
#5PO-300<Press Enter> |
This command sends the board into a special binary mode that lets software such as PoMoCo send commands much faster than other methods. As such, it is a bit more complicated than the usual commands. The format is defined as:
1 |
$<4 byte mask><N byte send> |
The command starts the the ASCII character for ‘$’ (ox24 in hex). The next 4 bytes that are read are interpreted to tell which servos are going to be instructed to move. For example, if the next 4 bytes were 0x00,0x00,0x00,0x01, only servo 0 would be moved, and it would only expect 1 byte before returning to ‘non-binary’ mode. The byte to follow would then tell the position in terms of 50 to 250 (in hex, as an unsigned byte).
If the command were only moving servo 0 to 1500uS, the total information for this command would be 6 bytes total (in hex):
1 2 3 |
0x24, 0x00,0x00,0x00,0x01, 0x96 |
Likewise, if all 32 servos were to be moved to center, it would be a total of 37 bytes (1 start, 4 mask, 32 position) and look like this:
1 2 3 |
0x24, 0xFF,0xFF,0xFF0xFF, 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96 |
No enter is necessary, as the command automatically knows how long it is by means of the mask.
Thanks to Michael for coming up with the original idea and implementation of a binary mode.