Wiki source code of Controlling an Arm with the Bot Board (Basic Atom) 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 | <table border="0" bordercolor="#FFFFFF" cellpadding="5"> |
| 3 | <tbody><tr> |
| 4 | <td colspan="2" > |
| 5 | <p align="center"><strong><font size="2" face="Verdana">Controlling an Arm with the Bot Board (Basic Atom) and the SSC-32</font></strong></p> |
| 6 | </td> |
| 7 | </tr> |
| 8 | <tr> |
| 9 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 10 | </tr> |
| 11 | <tr> |
| 12 | <td valign="top" ><strong><font size="2" face="Verdana">Make the connection</font></strong><font size="2" face="Verdana"><br> |
| 13 | 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 |
| 14 | 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 |
| 15 | it is marked with RX and the ground symbol. You will need to make sure the SSC-32 is set for 38.4k baud. It will be necessary to remove the DB9 |
| 16 | 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 |
| 17 | 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 |
| 18 | nylon standoff has been removed for this photo. </font></td> |
| 19 | <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-atom-ssc-32/WebHome/bbssc32.jpg" width="320" height="240"><br> |
| 20 | <font face="Verdana" size="2">Figure 1.</font></td> |
| 21 | </tr> |
| 22 | <tr> |
| 23 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 24 | </tr> |
| 25 | <tr> |
| 26 | <td valign="top" ><strong><font size="2" face="Verdana">Enabling the servos</font></strong><font size="2" face="Verdana"><br> |
| 27 | 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 |
| 28 | 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 |
| 29 | and paste from here you will need to remove the CR's. Note, later you can substitute the 1500's with other starting positions to prevent the arm |
| 30 | from jumping. </font></td> |
| 31 | <td valign="top" bordercolor="#000000"> |
| 32 | <table border="1" bordercolor="#FFFFFF"> |
| 33 | <tbody><tr> |
| 34 | <td bordercolor="#000000"><font face="Courier New" size="2">serout p15,i38400,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 |
| 35 | #14 P1500 #15 P1500",13] <br> |
| 36 | <br> |
| 37 | start:<br> |
| 38 | goto start 'loop</font></td> |
| 39 | </tr> |
| 40 | </tbody></table> |
| 41 | </td> |
| 42 | </tr> |
| 43 | <tr> |
| 44 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 45 | </tr> |
| 46 | <tr> |
| 47 | <td valign="top" ><strong><font size="2" face="Verdana">Move the arm smoothly</font></strong><font size="2" face="Verdana"><br> |
| 48 | 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 |
| 49 | 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 |
| 50 | the actual positions you want the arm to move to. </font></td> |
| 51 | <td valign="top" bordercolor="#000000"> |
| 52 | <table border="1" bordercolor="#FFFFFF"> |
| 53 | <tbody><tr> |
| 54 | <td bordercolor="#000000"><font face="Courier New" size="2">serout p15,i38400,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 |
| 55 | #14 P1500 #15 P1500",13] <br> |
| 56 | <br> |
| 57 | start:<br> |
| 58 | serout p15,i38400,["#10 P1400 #11 P1400 #12 P1400 #13 P1400 #14 P1400 #15 P1400 T2000",13]<br> |
| 59 | pause 2000<br> |
| 60 | serout p15,i38400,["#10 P1600 #11 P1600 #12 P1600 #13 P1600 #14 P1600 #15 P1600 T2000",13]<br> |
| 61 | pause 2000<br> |
| 62 | goto start 'repeat</font></td> |
| 63 | </tr> |
| 64 | </tbody></table> |
| 65 | </td> |
| 66 | </tr> |
| 67 | <tr> |
| 68 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 69 | </tr> |
| 70 | <tr> |
| 71 | <td valign="top" ><strong><font size="2" face="Verdana">Code specific to the arm</font></strong><font size="2" face="Verdana"><br> |
| 72 | 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 |
| 73 | one, but you can change the position with a name instead of a number. The first serout still uses the servo channel number though.</font></td> |
| 74 | <td valign="top" bordercolor="#000000"> |
| 75 | <table border="1" bordercolor="#FFFFFF"> |
| 76 | <tbody><tr> |
| 77 | <td bordercolor="#000000"><font face="Courier New" size="2">base var word 'Base rotate<br> |
| 78 | shld var word 'Shoulder pivot<br> |
| 79 | elbo var word 'Elbow pivot<br> |
| 80 | wrst var word 'Wrist pivot<br> |
| 81 | grip var word 'Gripper open/close<br> |
| 82 | grpr var word 'Gripper rotate (L6 only)<br> |
| 83 | ttm var word 'Amount of time to take to move<br> |
| 84 | <br> |
| 85 | serout p15,i38400,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 #15 P1500",13] <br> |
| 86 | <br> |
| 87 | start:<br> |
| 88 | 'first move...<br> |
| 89 | base=1400: shld=1400: elbo=1400:<br> |
| 90 | wrst=1400: grip=1400: grpr=1400: <br> |
| 91 | ttm=2000<br> |
| 92 | gosub send_data<br> |
| 93 | <br> |
| 94 | 'second move...<br> |
| 95 | base=1600: shld=1600: elbo=1600: <br> |
| 96 | wrst=1600: grip=1600: grpr=1600: <br> |
| 97 | ttm=2000<br> |
| 98 | gosub send_data<br> |
| 99 | <br> |
| 100 | 'add more moves here...<br> |
| 101 | goto start<br> |
| 102 | <br> |
| 103 | send_data:<br> |
| 104 | serout p15,i38400,["#10P", DEC base, "#11P", DEC shld, "#12P", DEC elbo, "#13P", DEC wrst, |
| 105 | "#14P", DEC grip, "#15P", DEC grpr, "T", DEC ttm, 13]<br> |
| 106 | pause ttm<br> |
| 107 | return <br> |
| 108 | </font></td> |
| 109 | </tr> |
| 110 | </tbody></table> |
| 111 | </td> |
| 112 | </tr> |
| 113 | <tr> |
| 114 | <td valign="top" colspan="2"><font size="1" face="Verdana"> </font></td> |
| 115 | </tr> |
| 116 | <tr> |
| 117 | <td valign="top" ><strong><font size="2" face="Verdana">In conclusion</font></strong><font size="2" face="Verdana"><br> |
| 118 | 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 |
| 119 | from a BASIC Atom / SSC-32.</font> |
| 120 | <p><font size="2" face="Verdana">Happy Roboting,</font> |
| 121 | </p><p><font size="2" face="Verdana">Jim Frye</font></p> |
| 122 | </td> |
| 123 | <td valign="top" ></td> |
| 124 | </tr> |
| 125 | </tbody></table> |
| 126 | </body> |
| 127 | {{/html}} |

