Controlling an Arm with the Bot Board (Basic Stamp 2) and the SSC-32

Last modified by Eric Nantel on 2024/07/03 09:21

Controlling an Arm with the Bot Board (Basic Stamp 2) and the SSC-32

 
Make the connection
Before I discuss how to write a program to control the arm, we need to make the serial data connection. The SSC-32 includes a short two conductor cable assembly. The black wire goes to ground and the yellow wire is for the signal. The .1" spaced end goes to the SSC-32 where it is marked with RX and the ground symbol. It will be necessary to remove the DB9 enable jumpers if present to make this connection. The yellow wire goes to RX, and the black wire goes to ground. The .2" spaced end goes to the Bot Board I/O pin 15. The black wire goes closer to the outside edge of the board, and the yellow wire goes closer to the IC. Note, the nylon standoff has been removed for this photo. These examples are for a BS2, BS2-E, or stamps with similar timing. The 6 in the "serout" command refers to non-inverted, 8 data bits, no parity communication with a baud rate of 38400.

Figure 1.
 
Enabling the servos
SSC-32 will not send out servo pulses until it receives the proper command. The program to the right will enable channels 10 through 15. This will make all of the servos go to their mid positions, or 1500uS. Note, all serout commands need to be one continuous line of text. If you cut and paste from here you will need to remove the CR's. Note, later you can substitute the 1500's with another starting positions to prevent the arm from jumping.
serout 15,6,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 #15 P1500",13] 

start:
goto start     'loop
 
Move the arm smoothly
The next program will move the arm from the initial position, to a new position, then to another new position, then cycle back and forth. The moves are slow and smooth. They will each take 2 seconds to complete. Note, these servo values are arbitrary, you will need to replace them with the actual positions you want the arm to move to.
serout 15,6,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 #15 P1500",13] 

start:
serout 15,6,["#10 P1400 #11 P1400 #12 P1400 #13 P1400 #14 P1400 #15 P1400 T2000",13] 
pause 2000
serout 15,6,["#10 P1600 #11 P1600 #12 P1600 #13 P1600 #14 P1600 #15 P1600 T2000",13] 
pause 2000
goto start     'repeat
 
Code specific to the arm
By using variables and the gosub command the code can be simplified to read easier. This program will accomplish the same thing as the previous one, but you can change the position with a name instead of a number. The first serout still uses the servo channel number though.
base  var word 'Base rotate
shld  var word 'Shoulder pivot
elbo  var word 'Elbow pivot
wrst  var word 'Wrist pivot
grip  var word 'Gripper open/close
grpr  var word 'Gripper rotate (L6 only)
ttm   var word 'Amount of time to take to move

serout 15,6,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 #15 P1500",13] 

start:
'first move...
base=1400: shld=1400: elbo=1400:
wrst=1400: grip=1400: grpr=1400: 
ttm=2000
gosub send_data

'second move...
base=1600: shld=1600: elbo=1600: 
wrst=1600: grip=1600: grpr=1600: 
ttm=2000
gosub send_data

'add more moves here...
goto start

send_data:
serout 15,6,["#10P", DEC base, "#11P", DEC shld, "#12P", DEC elbo, "#13P", DEC wrst, "#14P", DEC grip, "#15P", DEC grpr, "T", DEC ttm, 13]
pause ttm
return 
 
In conclusion
I hope you find this simple tutorial helpful. I will add more content in the future. Now you can control the Lynx arms easily and eloquently from a Basic Stamp 2 / SSC-32.

Happy Roboting,

Jim Frye

Tags:
Created by Eric Nantel on 2024/07/03 09:21
Copyright RobotShop 2018