Cricketbot

Speech

The speech that was performed by the robot was handled by the SpeakJet chip. Jeff helped interface the hardware of the robot to communicate directly with the SpeakJet chip. Once that was done, Luke programmed in various phrases. More information about this chip can be located on the SpeakJet website. [link]

How Does It Work?

This robot is equipped with a SpeakJet chip which is a speech chip and sound synthesizer that is contained on a single chip. The chip can be interfaced with the computers or the robots used in the Mechatronics lab using the serial port on the chip to receive data that in turn can be output via a mono audio jack that can be attached to speakers or headphones. The following pictures show how the serial port is wired and how and where it interfaces on the robot.

The actual talking aspect of the robot works by using phonemes which are the basic sounds which make up the English language. A detailed listed of available phonemes can be found on page 16 of the SpeakJet user manual. A few errors have been found and are documented below.

135 OH should be 136 OH
136 AW should be 135 AW
159 EHLL should be 159 EHLE

The word automobile is represented as follows using the SpeakJet chip.

Automobile = \SLOW \AW \TT \FAST \OWWW \FAST \MM \FAST \OWWW \SOFT \BE \IY \LE

In addition to the phonemes there are other commands which can be used to speed up, slow down, soften, or stress a phoneme so it sounds more like the actual word when pronounced. The chip can be interfaced to the computer and a program called PhraseALator [link] can be run in order to test words or phrases before implementing them into the robot’s code.

Neither the chip nor the robot can understand the character string \OWWW to have a sound spoken. For this, the phoneme must be converted to a number. Page 16 of the user manual shows the conversions from phoneme to number. \OWWW is represented as 164 and when this is passed to the SpeakJet chip this sound will be output.

The sound \OWWW will be sent to the chip as 20,96,21,114,22,88,23,5, 164. The first 8 numbers initialize the Volume (20) to 96, Speed (21) to 114, Pitch (22) to 88, and Bend (23) to 5. These numbers are the default values which can be changed to make the phoneme sound different. The SpeakJet chip only needs to have these values initialized once and subsequent transmissions of phonemes do not require the numbers to be sent again. These default values can be changed and reset if the user desires by sending new values or \RESET to the SpeakJet chip.

In order to send the data from the robot to the chip the following command must be used.

SendStr2_AtmelUART((char *)spjt_Init,strlen((char *)spjt_Init));

The phrase must be sent in the format:

unsigned char spjt_Init[30] = {20,96,21,114,22,88,23,5,0};

The phrase can only be 15 phonemes long or must be broken into separate phrases sent back to back with each array ending in null as the sixteenth character. Only 16 characters can be sent because data is sent over the serial line from the robot to the serial port on the SpeakJet chip in 16 bit bursts.

The PhraseALator interface also shows the availability of different musical octaves along with sounds that can make the robot sound like R2-D2 from Star Wars. In the text file entitled “Cricket_project_phrases.txt” exist the first four lines of the “Ironman” song by Black Sabbath with proper musical octaves to correspond to that in the song.

Use for project

The SpeakJet chip was used to have the robot speak which color ball it had found and at what position given by the cricket information. This was implemented using the following code which used arrays of arrays to select the proper information to pass to the SpeakJet chip that was communicated to the world via two side mounted speakers that were powered via the 9 volt battery on the SpeakJet chip.

   //End of state 6 code

   countup++;
   if(countup>7000) //Arbitary number to start speaking color and position
      state=7;
else if(state==7)
{
   countup = 0;
   fuzzyX = (int)xPos_feet;
   fuzzyY = (int)yPos_feet;
   if (fuzzyX < 0 || fuzzyX > 12)
      fuzzyX = 13;
   if (fuzzyY < 0 || fuzzyY > 12)
      fuzzyY = 13;
   if(click!=0)
   {
      SendStr2_AtmelUART((char *)spjt_ISeeThe,strlen((char *)spjt_ISeeThe));
      SendStr2_AtmelUART((char *)(spjt_color_array[click-1]),strlen((char *)(spjt_color_array[click-1])));
      SendStr2_AtmelUART((char *)spjt_BallAt,strlen((char *)spjt_BallAt));
      SendStr2_AtmelUART((char *)(spjt_number_array[fuzzyX]),strlen((char *)(spjt_number_array[fuzzyX])));
      SendStr2_AtmelUART((char *)spjt_X,strlen((char *)spjt_X));
      SendStr2_AtmelUART((char *)(spjt_number_array[fuzzyY]),strlen((char *)(spjt_number_array[fuzzyY])));
      SendStr2_AtmelUART((char *)spjt_Y,strlen((char *)spjt_Y));
   }
   state=8;
}


Countup in state 6 is a counter that after having found the ball and stopped for seven seconds will cause the program to enter state 7, the speaking state. The first line of code in state 7 resets the counter. Then, the cricket positions are truncated to integers using casetyping. If the value is outside the range of the course the value is set to 13 which will cause the Speakjet to output the word “invalid” instead of a number telling us that the robots according to the crickets is outside of the course. The click variable is set using a VB interface which if click!=0 a color is selected for. If a color has been selected character strings will start to be sent to the SpeakJet. The variables click, fuzzyX, and fuzzyY select for the proper character string to be sent to the SpeakJet chip saying the color it has found and the approximate cricket position.

Various Files

Speakjet User Manual [link]
Project Phrases [link]
Translated Dictionary [link]