Show last authors
1 {{html wiki="false" clean="false"}}
2 <style>
3 .asm { font-family: Verdana, Helvetica, sans-serif; font-size: 14px; max-width: 960px; }
4 .asm h1 { font-size: 18px; margin-bottom: 0.25rem; }
5 .asm-step { background: #fff; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 1.5rem; overflow: hidden; }
6 .asm-step-header { background: #F5A800; display: flex; align-items: stretch; justify-content: space-between; }
7 .asm-step-name { padding: 0.6rem 1rem; font-weight: bold; font-size: 15px; color: #2C1A00; }
8 .asm-step-body { display: flex; flex-wrap: wrap; gap: 1.25rem; padding: 1rem; align-items: flex-start; }
9 .asm-step-text { flex: 1 1 250px; font-size: 13px; line-height: 1.6; }
10 .asm-step-figure { flex: 0 1 320px; text-align: center; }
11 .asm-step-figure img { max-width: 100%; height: auto; border: 1px solid #ccc; border-radius: 4px; }
12 .asm-step-figure span { display: block; font-size: 12px; color: #666; margin-top: 0.3rem; }
13 .code-block { background: #f4f4f4; border: 1px solid #ddd; border-radius: 4px; padding: 0.6rem 0.8rem; font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.6; white-space: pre; overflow-x: auto; margin-top: 0.75rem; }
14 .asm-info { background: #f9f9f9; border: 1px solid #ddd; border-radius: 8px; padding: 1rem; margin-bottom: 1.5rem; font-size: 13px; line-height: 1.6; }
15 </style>
16
17 <div class="asm">
18
19 <h1 class="asm">Controlling an Arm with the Bot Board (Basic Stamp 2) and the SSC-32</h1>
20
21 <!-- Section 1 -->
22 <div class="asm-step">
23 <div class="asm-step-header">
24 <div class="asm-step-name">Make the Connection</div>
25 </div>
26 <div class="asm-step-body">
27 <div class="asm-step-text">
28 <p>The SSC-32 includes a short two-conductor cable assembly. The black wire goes to ground and the yellow wire carries the signal. The .1" spaced end connects to the SSC-32 at the pins marked RX and ground — remove any DB9 enable jumpers if present. Yellow goes to RX, black to ground.</p>
29 <p>The .2" spaced end connects to Bot Board I/O pin 15. The black wire goes toward the outside edge of the board; the yellow wire goes toward the IC.</p>
30 <p>These examples are for a BS2, BS2-E, or stamps with similar timing. The <code>6</code> in the <code>serout</code> command specifies non-inverted, 8 data bits, no parity, 38400 baud. All <code>serout</code> commands must be a single continuous line — remove any line breaks if copying from this page.</p>
31 </div>
32 <div class="asm-step-figure">
33 <img 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">
34 <span>Figure 1 — Bot Board to SSC-32 serial connection.</span>
35 </div>
36 </div>
37 </div>
38
39 <!-- Section 2 -->
40 <div class="asm-step">
41 <div class="asm-step-header">
42 <div class="asm-step-name">Enabling the Servos</div>
43 </div>
44 <div class="asm-step-body">
45 <div class="asm-step-text">
46 <p>The SSC-32 will not output servo pulses until it receives a valid command. The code below enables channels 10 through 15, sending all servos to mid-position (1500µs). Later you can substitute the 1500 values with a desired starting position to prevent the arm from jerking on startup.</p>
47 <div class="code-block">serout 15,6,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 #15 P1500",13]
48
49 start:
50 goto start 'loop</div>
51 </div>
52 </div>
53 </div>
54
55 <!-- Section 3 -->
56 <div class="asm-step">
57 <div class="asm-step-header">
58 <div class="asm-step-name">Move the Arm Smoothly</div>
59 </div>
60 <div class="asm-step-body">
61 <div class="asm-step-text">
62 <p>This program moves the arm from its initial position to a new position, then to another, cycling back and forth. Each move takes 2 seconds to complete using the <code>T2000</code> time parameter. Replace the servo values with the actual positions you need.</p>
63 <div class="code-block">serout 15,6,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 #15 P1500",13]
64
65 start:
66 serout 15,6,["#10 P1400 #11 P1400 #12 P1400 #13 P1400 #14 P1400 #15 P1400 T2000",13]
67 pause 2000
68 serout 15,6,["#10 P1600 #11 P1600 #12 P1600 #13 P1600 #14 P1600 #15 P1600 T2000",13]
69 pause 2000
70 goto start 'repeat</div>
71 </div>
72 </div>
73 </div>
74
75 <!-- Section 4 -->
76 <div class="asm-step">
77 <div class="asm-step-header">
78 <div class="asm-step-name">Code Specific to the Arm</div>
79 </div>
80 <div class="asm-step-body">
81 <div class="asm-step-text">
82 <p>Using variables and <code>gosub</code> makes the code easier to read and maintain. This program does the same as the previous one, but each joint is referenced by name. Only the initial <code>serout</code> still uses raw channel numbers.</p>
83 <div class="code-block">base var word 'Base rotate
84 shld var word 'Shoulder pivot
85 elbo var word 'Elbow pivot
86 wrst var word 'Wrist pivot
87 grip var word 'Gripper open/close
88 grpr var word 'Gripper rotate (L6 only)
89 ttm var word 'Time to complete move (ms)
90
91 serout 15,6,["#10 P1500 #11 P1500 #12 P1500 #13 P1500 #14 P1500 #15 P1500",13]
92
93 start:
94 'first move...
95 base=1400: shld=1400: elbo=1400:
96 wrst=1400: grip=1400: grpr=1400:
97 ttm=2000
98 gosub send_data
99
100 'second move...
101 base=1600: shld=1600: elbo=1600:
102 wrst=1600: grip=1600: grpr=1600:
103 ttm=2000
104 gosub send_data
105
106 'add more moves here...
107 goto start
108
109 send_data:
110 serout 15,6,["#10P", DEC base, "#11P", DEC shld,
111 "#12P", DEC elbo, "#13P", DEC wrst,
112 "#14P", DEC grip, "#15P", DEC grpr,
113 "T", DEC ttm, 13]
114 pause ttm
115 return</div>
116 </div>
117 </div>
118 </div>
119
120 <!-- Conclusion -->
121 <div class="asm-info">
122 <p><b>In Conclusion</b></p>
123 <p>You can now control Lynxmotion arms easily and elegantly from a Basic Stamp 2 / SSC-32. More content will be added in the future.</p>
124 <p>Happy Roboting,<br><b>Jim Frye</b></p>
125 </div>
126
127 </div>
128 {{/html}}
Copyright RobotShop 2018