Wiki source code of 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
Show last authors
| 1 | {{html wiki="false" clean="true"}} |
| 2 | <body bgcolor="#FFFFFF"> |
| 3 | |
| 4 | <table border="0" bordercolor="#FFFFFF" cellpadding="5"> |
| 5 | <tbody><tr> |
| 6 | <td colspan="2" > |
| 7 | <p align="center"><strong><font size="2" face="Verdana">Controlling an Arm |
| 8 | with the Bot Board (Basic Stamp 2) and the SSC-32</font></strong></p> |
| 9 | </td> |
| 10 | </tr> |
| 11 | <tr> |
| 12 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 13 | </tr> |
| 14 | <tr> |
| 15 | <td valign="top" ><strong><font size="2" face="Verdana">Make the |
| 16 | connection</font></strong><font size="2" face="Verdana"><br> |
| 17 | Before I discuss how to write a program to control the arm, we need to |
| 18 | make the serial data connection. The SSC-32 includes a short two conductor |
| 19 | cable assembly. The black wire goes to ground and the yellow wire is for |
| 20 | the signal. The .1" spaced end goes to the SSC-32 where it is marked |
| 21 | with RX and the ground symbol. It will be necessary to remove the DB9 |
| 22 | enable jumpers if present to make this connection. The yellow wire goes to |
| 23 | RX, and the black wire goes to ground. The .2" spaced end goes to the |
| 24 | Bot Board I/O pin 15. The black wire goes closer to the outside edge of |
| 25 | the board, and the yellow wire goes closer to the IC. Note, the nylon |
| 26 | standoff has been removed for this photo. These examples are for a BS2, |
| 27 | BS2-E, or stamps with similar timing. The 6 in the "serout" |
| 28 | command refers to non-inverted, 8 data bits, no parity communication with |
| 29 | a baud rate of 38400.</font></td> |
| 30 | <td valign="top" align="center" width="50%"><img border="2" src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/servo-erector-set-robots-kits/ses-v1-robots/ses-v1-arms/controlling-arm-bot-board-basic-stamp-ssc-32/WebHome/bbssc32.jpg" width="320" height="240"><br> |
| 31 | <font face="Verdana" size="2">Figure 1.</font></td> |
| 32 | </tr> |
| 33 | <tr> |
| 34 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 35 | </tr> |
| 36 | <tr> |
| 37 | <td valign="top" ><strong><font size="2" face="Verdana">Enabling |
| 38 | the servos</font></strong><font size="2" face="Verdana"><br> |
| 39 | SSC-32 will not send out servo pulses until it receives the proper |
| 40 | command. The program to the right will enable channels 10 through 15. This |
| 41 | will make all of the servos go to their mid positions, or 1500uS. Note, |
| 42 | all serout commands need to be one continuous line of text. If you cut and |
| 43 | paste from here you will need to remove the CR's. Note, later you can |
| 44 | substitute the 1500's with another starting positions to prevent the arm |
| 45 | from jumping.</font></td> |
| 46 | <td valign="top" bordercolor="#000000"> |
| 47 | <table border="1" bordercolor="#FFFFFF"> |
| 48 | <tbody><tr> |
| 49 | <td bordercolor="#000000"><font face="Courier New" size="2">serout |
| 50 | 15,6,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 #15 |
| 51 | P1500",13] <br> |
| 52 | <br> |
| 53 | start:<br> |
| 54 | goto start 'loop</font></td> |
| 55 | </tr> |
| 56 | </tbody></table> |
| 57 | </td> |
| 58 | </tr> |
| 59 | <tr> |
| 60 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 61 | </tr> |
| 62 | <tr> |
| 63 | <td valign="top" ><strong><font size="2" face="Verdana">Move the |
| 64 | arm smoothly</font></strong><font size="2" face="Verdana"><br> |
| 65 | The next program will move the arm from the initial position, to a new |
| 66 | position, then to another new position, then cycle back and forth. The |
| 67 | moves are slow and smooth. They will each take 2 seconds to complete. |
| 68 | Note, these servo values are arbitrary, you will need to replace them with |
| 69 | the actual positions you want the arm to move to.</font></td> |
| 70 | <td valign="top" bordercolor="#000000"> |
| 71 | <table border="1" bordercolor="#FFFFFF"> |
| 72 | <tbody><tr> |
| 73 | <td bordercolor="#000000"><font face="Courier New" size="2">serout |
| 74 | 15,6,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 #15 |
| 75 | P1500",13] <br> |
| 76 | <br> |
| 77 | start:<br> |
| 78 | serout 15,6,["#10 P1400 #11 P1400 #12 P1400 #13 P1400 #14 P1400 |
| 79 | #15 P1400 T2000",13] <br> |
| 80 | pause 2000<br> |
| 81 | serout 15,6,["#10 P1600 #11 P1600 #12 P1600 #13 P1600 #14 P1600 |
| 82 | #15 P1600 T2000",13] <br> |
| 83 | pause 2000<br> |
| 84 | goto start 'repeat</font></td> |
| 85 | </tr> |
| 86 | </tbody></table> |
| 87 | </td> |
| 88 | </tr> |
| 89 | <tr> |
| 90 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 91 | </tr> |
| 92 | <tr> |
| 93 | <td valign="top" ><strong><font size="2" face="Verdana">Code |
| 94 | specific to the arm</font></strong><font size="2" face="Verdana"><br> |
| 95 | By using variables and the gosub command the code can be simplified to |
| 96 | read easier. This program will accomplish the same thing as the previous |
| 97 | one, but you can change the position with a name instead of a number. The |
| 98 | first serout still uses the servo channel number though.</font></td> |
| 99 | <td valign="top" bordercolor="#000000"> |
| 100 | <table border="1" bordercolor="#FFFFFF"> |
| 101 | <tbody><tr> |
| 102 | <td bordercolor="#000000"><font face="Courier New" size="2">base var |
| 103 | word 'Base rotate<br> |
| 104 | shld var word 'Shoulder pivot<br> |
| 105 | elbo var word 'Elbow pivot<br> |
| 106 | wrst var word 'Wrist pivot<br> |
| 107 | grip var word 'Gripper open/close<br> |
| 108 | grpr var word 'Gripper rotate (L6 only)<br> |
| 109 | ttm var word 'Amount of time to take to move<br> |
| 110 | <br> |
| 111 | serout 15,6,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 |
| 112 | #15 P1500",13] <br> |
| 113 | <br> |
| 114 | start:<br> |
| 115 | 'first move...<br> |
| 116 | base=1400: shld=1400: elbo=1400:<br> |
| 117 | wrst=1400: grip=1400: grpr=1400: <br> |
| 118 | ttm=2000<br> |
| 119 | gosub send_data<br> |
| 120 | <br> |
| 121 | 'second move...<br> |
| 122 | base=1600: shld=1600: elbo=1600: <br> |
| 123 | wrst=1600: grip=1600: grpr=1600: <br> |
| 124 | ttm=2000<br> |
| 125 | gosub send_data<br> |
| 126 | <br> |
| 127 | 'add more moves here...<br> |
| 128 | goto start<br> |
| 129 | <br> |
| 130 | send_data:<br> |
| 131 | serout 15,6,["#10P", DEC base, "#11P", DEC shld, |
| 132 | "#12P", DEC elbo, "#13P", DEC wrst, |
| 133 | "#14P", DEC grip, "#15P", DEC grpr, |
| 134 | "T", DEC ttm, 13]<br> |
| 135 | pause ttm<br> |
| 136 | return <br> |
| 137 | </font></td> |
| 138 | </tr> |
| 139 | </tbody></table> |
| 140 | </td> |
| 141 | </tr> |
| 142 | <tr> |
| 143 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 144 | </tr> |
| 145 | <tr> |
| 146 | <td valign="top" ><strong><font size="2" face="Verdana">In |
| 147 | conclusion</font></strong><font size="2" face="Verdana"><br> |
| 148 | I hope you find this simple tutorial helpful. I will add more content in |
| 149 | the future. Now you can control the Lynx arms easily and eloquently from a |
| 150 | Basic Stamp 2 / SSC-32.</font> |
| 151 | <p><font size="2" face="Verdana">Happy Roboting,</font> |
| 152 | </p><p><font size="2" face="Verdana">Jim Frye</font></p> |
| 153 | </td> |
| 154 | <td valign="top" ></td> |
| 155 | </tr> |
| 156 | </tbody></table> |
| 157 | </body> |
| 158 | {{/html}} |

