The BREAD (Broadly Reconfigurable and Expandable Automation Device) Servo Motor Control Slice is a circuit board with an Arduino Nano and five ports at which one can connect a servo motor. Commands can then be sent through the Arduino, allowing the motors to be controlled.
Documentation[edit | edit source]
Command Structure
Argument 1: Command ID
- Command 1: mode command
- Command 2: value command
Argument 2: read / write bit (!R/W)
- 0: read
- 1: write
Argument 3: Parameter 1
- Currently always used to specify the motor channel
Argument 4: Parameter 2
- Currently always used to specify data to be written when !R/W = 1 (write), and always ignored when !R/W = 0 (read)
All 4 of these arguments are stored as integers for the time being.
Command 0 - Test
Does nothing.
Command 1 - Mode
!R/W:
- 0: read
- The command will return the motor's mode
- 1: write
- Set the motor's mode
Param1: Channel - Select which motor to apply the command to
- Acceptable values: 0 <= X <= 5
Param2:
- Read Mode: N/A
- Write Mode: Mode to set the motor to
Acceptable Mode Values:
- 0: Normal Mode
- Motor will move as fast as possible
- 1 - 5: Slow Mode
- Motor will turn more slowly, with 5 being the slowest
- Values greater than 5 may work, but are untested
Command 2 - Value
!R/W:
- 0: read
- The command will return the motor's current position
- 1: write
- Set the motor's target position
Param1: Channel - Select which motor to apply the command to
- Acceptable values: 1 <= X <= 5
Param2:
- Read Mode: N/A
- Write Mode: The position to move the motor to
Slow Mode
When the mode of a motor channel is set to a non-zero value (1 <= X <= 5), the motor will not move at its mazimum speed. Instead, it will turn at a rate determined by the value of the mode, with 1 being the fastest, and 5 being the slowest. Currently, this is implemented by turning the motor by 1 degree every (5 * (mode^2)) loop cycles.
Usage Examples[edit | edit source]
If you wanted the motor connected to channel 5 to turn slowly, you could enter "1, 1, 5, 3":
- 1 - mode command
- 1 - write
- 5 - motor 5
- 3 - slow mode
The command "1, 0, 5, X" would then return the mode that you previously wrote
- 1 - mode command
- 1 - write
- 5 - motor 5
- X - this value is ignored, so it can be any integer
- returns "3" - This is the motor's current mode
To turn the motor to the 180 degree position, you could then enter "2, 1, 5, 180"
- 2 - value command
- 1 - write
- 5 - motor 5
- 180 - target position
Video Example
Note that the motor in the video is connected to channel 5.
Commands used in the video:
- 1, 0, 5, 0 - reads the mode that motor 5 is currently set to
- 2, 1, 5, 0 - turns the motor to the 0 degree position
- 1, 1, 5, 4 - sets motor 5 to mode 4
- 1, 0, 5, 0 - reads the mode again
- 2, 0, 5, 0 - reads the motor's current rotational position
- 2, 1, 5, 180 - rotates the motor to the 180 degree position
Download[edit | edit source]
A download, which includes the firmware and further documentation, will be made available soon via OSF.