Parallax Say It module to Boe Bot control
I reciently picked up a Say it module from ebuy and looked the Parallax site and Google for some existing codes to voice command some functions on my Boe Bot. I reciently purchased a Boe Gripper and am quite impressed the power for size using only one servo. I would like to tell it to pick up and put down. Thanks in advance. By the way, the Boe Bot lithium battery pack works great.

Comments
Duane Degn has also done a few Say It projects as well from the Propeller and has a pretty firm understanding of the programming protocol.
I'm not sure what is the best mehod of using the SayIt with a BS2 since the BS2 wont be able to do anything else while it listens to the Sayit.
Do you have the sample code and GUI program? If not, it's attached to this post.
I've been working, on and off, on a robot remote that I plan to use with a SayIt module. The controller will interface with the SayIt and send commands to the robot based on the spoken commands. I'm hoping it will be easier for the SayIt to understand my spoken commands if it doesn't have to be near the robot's motors.
The noise issue I was talking about is, as Martin suggests,, the SayIt will likely have trouble recognizing speech when other sounds (motors) are present.
Thanks Duane, that's the one. Post number 1 contains CBA Sayit.BSE which was my Say It example. I never made a video of it because my module died right before I made one. Parallax replaced the module, but I never got around to a Say It video.
I trained the Say It to understand a bunch of commands in group 2 and then had the GUI generate a shell program. At that point I added a bit of code for the ServoPal initialization, code to change to group 2 after the attention command, handlers for up and down, and code to transition back to group 0. Here's the resulting code:
' {$STAMP BS2} ' {$PBASIC 2.5} ' COM Parameters COM_RX PIN 0 ' rx pin COM_TX PIN 2 ' tx pin nInp PIN 14 ' Define the input pin. Alarm PIN 15 ' Define the alarm pin. COM_SPEED CON 84 ' baud 9600 COM_10MS CON 10 ' 10ms unit ' Protocol Command CMD_BREAK CON "b" ' abort recog or ping CMD_SLEEP CON "s" ' go to power down CMD_KNOB CON "k" ' set si knob <1> CMD_LEVEL CON "v" ' set sd level <1> CMD_LANGUAGE CON "l" ' set si language <1> CMD_TIMEOUT CON "o" ' set timeout <1> CMD_RECOG_SI CON "i" ' do si recog from ws <1> CMD_RECOG_SD CON "d" ' do sd recog at group <1> (0 = trigger mixed si/sd) ' Protocol Status STS_AWAKEN CON "w" ' back from power down mode STS_ERROR CON "e" ' signal error code <1-2> STS_INVALID CON "v" ' invalid command or argument STS_TIMEOUT CON "t" ' timeout expired STS_INTERR CON "i" ' back from aborted recognition (see 'break') STS_SUCCESS CON "o" ' no errors status STS_RESULT CON "r" ' recognised sd command <1> - training similar to sd <1> STS_SIMILAR CON "s" ' recognised si <1> (in mixed si/sd) - training similar to si <1> ' Protocol arguments are in the range 0x40 (-1) TO 0x60 (+31) inclusive ARG_MIN CON 64 ' 0x40 ARG_MAX CON 96 ' 0x60 ARG_ZERO CON 65 ' 0x41 ARG_ACK CON 32 ' 0x20 'TO READ more status arguments 'Groups and Commands GROUP_0 CON 0 '(Command count: 1) G0_ROBOT CON 32 G0_PENGUIN CON 0 GROUP_2 CON 2 '(Command count: 10) G2_NORTH CON 0 G2_EAST CON 1 G2_SOUTH CON 2 G2_WEST CON 3 G2_HOME CON 4 G2_LEFT CON 5 G2_RIGHT CON 6 G2_FORWARD CON 7 G2_BACKWARD CON 8 G2_AROUND CON 9 G2_UP CON 10 G2_DOWN CON 11 RES_ERROR CON 255 RES_TIMEOUT CON 254 RES_COMMFAIL CON 253 RES_BUILTIN CON 32 'Robot Constant VRLED PIN 4 'Global Variable VRA VAR Byte VRA1 VAR Byte VRGROUP VAR Byte VRCOMMAND VAR Byte ' Main Start ' -----[ Initialization ]-------------------------------------------------- INPUT nInp 'Make sure nInp isn't being driven. DO : LOOP UNTIL nInp 'Wait for ServoPAL to power up. LOW nInp 'Set pin to an output and hold it low PAUSE 100 ' for 100mS to reset ServoPAL. HIGH nInp 'Raise the pin. PAUSE 100 INPUT COM_RX HIGH COM_TX Restart: LOW VRLED VRGROUP = 0 DEBUG CR, "Setting up VRbot... " 'Wake up or stop recognition GOSUB VR_Wakeup DEBUG "awake... " 'Set SI Language VRA1 = 0 GOSUB VR_SetLanguage DEBUG "language ", DEC VRA1, "... " 'Set 5 seconds timeout VRA1 = 5 GOSUB VR_SetTimeout DEBUG "timeout ", DEC VRA1, "... " DEBUG CR, "VRbot ready!" VR_Loop: DEBUG CR, "VRbot in group ", DEC VRGROUP, " waiting for command... " LOW VRLED PAUSE 150 IF VRGROUP > 0 THEN HIGH VRLED VRA1 = VRGROUP GOSUB VR_RecognizeSD '-- handle errors or timeout IF VRA1 = RES_ERROR THEN DEBUG "error" 'try again in the same group GOTO VR_Loop ENDIF IF VRA1 = RES_TIMEOUT THEN DEBUG "timed out" VRGROUP = 0 ' back to trigger GOTO VR_Loop ENDIF IF VRA1 = RES_COMMFAIL THEN DEBUG "comm failed" 'resync and try again GOSUB VR_Wakeup GOTO VR_Loop ENDIF '-- got a command VRCOMMAND = VRA1 IF VRCOMMAND <= RES_BUILTIN THEN GOSUB VR_Action GOTO VR_Loop VR_Action: DEBUG "got ", DEC VRCOMMAND SELECT VRGROUP CASE GROUP_0 SELECT VRCOMMAND CASE G0_PENGUIN PAUSE 0 '-- write your code here CASE G0_ROBOT DEBUG "ROBOT", CR '-- write your code here VRGROUP = GROUP_2 ENDSELECT CASE GROUP_2 SELECT VRCOMMAND CASE G2_NORTH PAUSE 0 '-- write your code here CASE G2_EAST PAUSE 0 '-- write your code here CASE G2_SOUTH PAUSE 0 '-- write your code here CASE G2_WEST PAUSE 0 '-- write your code here CASE G2_HOME PAUSE 0 '-- write your code here CASE G2_LEFT PAUSE 0 '-- write your code here CASE G2_RIGHT PAUSE 0 '-- write your code here CASE G2_FORWARD PAUSE 0 '-- write your code here CASE G2_BACKWARD PAUSE 0 '-- write your code here CASE G2_AROUND PAUSE 0 '-- write your code here CASE G2_UP DEBUG "UP", CR PULSOUT nInp, 1000 PULSOUT nInp, 1000 VRGROUP = GROUP_0 CASE G2_DOWN DEBUG "DOWN", CR PULSOUT nInp, 500 PULSOUT nInp, 500 VRGROUP = GROUP_0 ENDSELECT ENDSELECT RETURN '=== VR Routines === ' Wake up: VR_Wakeup: TOGGLE VRLED VRA = CMD_BREAK SEROUT COM_TX, COM_SPEED, [VRA] SERIN COM_RX, COM_SPEED, 100*COM_10MS, VR_Wakeup, [VRA] IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup LOW VRLED RETURN ' Inputs: ' VRA1 = language index (0 = english, ...) VR_SetLanguage: VRA = CMD_LANGUAGE SEROUT COM_TX, COM_SPEED, [VRA] VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA] VRA1 = VRA1 - ARG_ZERO 'IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup RETURN ' Inputs: ' VRA1 = timeout (in ms, 0=forever, 255=default) VR_SetTimeout: VRA = CMD_TIMEOUT SEROUT COM_TX, COM_SPEED, [VRA] VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA] VRA1 = VRA1 - ARG_ZERO 'IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup RETURN ' Inputs: ' VRA1 = SI knob (0=loosest, 2=normal, 4=tightest) VR_SetKnob: VRA = CMD_KNOB SEROUT COM_TX, COM_SPEED, [VRA] VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA] VRA1 = VRA1 - ARG_ZERO 'IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup RETURN ' Inputs: ' VRA1 = SD level (1=easy, 2=default, 5=hard) VR_SetLevel: VRA = CMD_LEVEL SEROUT COM_TX, COM_SPEED, [VRA] VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA] VRA1 = VRA1 - ARG_ZERO 'IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup RETURN ' Inputs: ' VRA1 = wordset (0=trigger) ' Ouputs: ' VRA1 = result (0-31=word, 32..=builtin, 253=comm err, 254=timeout, 255=error) VR_RecognizeSI: VRA = CMD_RECOG_SI GOTO VR_Recognize0 VR_RecognizeSD: VRA = CMD_RECOG_SD VR_Recognize0: SEROUT COM_TX, COM_SPEED, [VRA] ' send Group/WS VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] ' wait for answer SERIN COM_RX, COM_SPEED, 600*COM_10MS, VR_CommFailed, [VRA] IF VRA = STS_RESULT THEN ' send ack VRA = ARG_ACK SEROUT COM_TX, COM_SPEED, [VRA] ' wait for recognised command code SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA1] VRA1 = VRA1 - ARG_ZERO ELSEIF VRA = STS_SIMILAR THEN ' send ack VRA = ARG_ACK SEROUT COM_TX, COM_SPEED, [VRA] ' wait for recognised command code SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA1] VRA1 = VRA1 - ARG_ZERO + RES_BUILTIN ELSEIF VRA = STS_TIMEOUT THEN VRA1 = RES_TIMEOUT ELSE VRA1 = RES_ERROR ENDIF RETURN VR_CommFailed: VRA1 = RES_COMMFAIL RETURNOne of these days I need to do something more substantial with the gripper.