The SD21 is a 21 channel servo controller module. It will drive up to 21 RC servo's and maintain a 20mS refresh rate, regardless of the number of servo's used or their positions (pulse widths). It will control both position and speed of the servo's. It's controlled by sending commands to the on-board PIC18F2220 over the I2C bus. There are 3 I2C connectors on the board, any one of which can be used to connect to your controller. Alternatively, many controllers such as the Picaxe, BS2p, Atom, BX-24 etc. can be fitted directly to the module, making this a great animatronics controller.
Power
There are two ways to power the SD21. The first is to used a 5v supply for the processor section and a separate 6v-7.2v supply for the servo's. This is the recommend method, and the 4-way terminal block allows for this option. The logic and servo grounds are internally connected on the PCB. Not everyone wants to use two batteries, so we have allowed for the use of a single (typically 7.2v) battery to power the servo's and the module. To do this place a link on the two pin header below the terminal block. This routes servo power to a low drop 5v regulator which supplies the logic. The connections must be made to the servo terminals on the terminal block - NOT the logic ones. The SD21 monitors the servo battery voltage, which is available for reading from an internal register.
Servo's
The servo's are plugged directly onto the SD21, with the ground pin (black wire on a hitec servo) nearest the outside of the PCB.
Technical Documentation
See the SD21 controlling a
Lynxmotion EH2 Robot.
Example Code
This shows how to use a BS2p Stamp to control a servo. It sets up a simple loop which sends the servo between two positions
'{$STAMP BS2p} SDA CON 0 ' SDA on pin0, SCL on pin1 SD21 CON $C2 ' SD21 I2C address Servo1 CON 0 ' register address of servo1 speed reg (followed by pos low/pos high) Speed CON 0 ' maximum speed Servo1p CON 1800 ' Right position Servo1n CON 1200 ' Left position Servo VAR W0 Loop: Servo = Servo1p I2COUT SDA, SD21, Servo1, [Speed, Servo.LOWBYTE, Servo.HIGHBYTE] PAUSE 300 Servo = Servo1n I2COUT SDA, SD21, Servo1, [Speed, Servo.LOWBYTE, Servo.HIGHBYTE] PAUSE 300 GOTO Loop |
This does the same for the Picaxe controller using the alternative register set.
Servo1 = 63 ' servo 1 base register Servo1p = 84 ' servo 1 positive offset register Servo1n = 105 ' servo 1 negative offset register Base = 128 ' centre position Offset = 50 ' +/- 50 from centre position ProgStart: |
Shipping weight: | 0,10 Kg |