Tuesday, December 31, 2013

Mike's Speech Synthesizer (Part IV)

               The hardest part of the tinkering process for me is waiting for a part to come in the mail. With every minute that passed, I had to sit in idle anticipation for the Text to Speech chip to arrive. I lamented over why I did NOT order the part when I had ordered the Speakjet, but that just made things worse.

               To pass the time I decided to review the limited documentation on the Text to Speechchip and then do a more thorough review of the communication method of the Speakjet itself. Seeing as how the communication between the chips and any outside device was purely a serial connection with hardware flow control, I had wondered if maybe I could interface this circuit with an older, more vintage machine.
NO! That is NOT the screen for the Vic-20 :P

               I decided I would try to interface the text to speech circuit with an old CommodoreVic-20 I had in my collection of vintage computers. The user port on the back had pins that supported a 5 volt TTL level serial signal up to 2400 bps. This of course would not work for the Text to Speech chip or the Speakjet, seeing as how they communicated at 9600 bps. None the less I was determined to use the Vic-20 because it was easy to program, and more importantly because it was not packed away like all my other machines.

               Aside from programming the Vic-20 I needed a reliable circuit that not only encompassed a communication scheme between the Speakjet and the Text to Speechchip, but would also facilitate a baud rate conversion from what the Vic-20could produce, up to the 9600 bps that the speech chips were expecting. Furthermore I needed something that could reset both speech chips at the same time to improve performance.

               I decided on the Arduino, because A) I had one, B) They are easy to program, and C) They support multiple serial ports and have a variety of GPIO (General PurposeInput Output) pins. Below is a circuit I dug up somewhere online. This is the circuit I will roughly follow. The pins on the Arduino will be a little different, and the reset lines on the speech chips will be hooked directly up to the Arduino since IT will decide when things get reset. Also there is a LM386 amplifier added to incorporate a speaker into the mix without putting undue load on the Speakjet.
Rough diagram of the circuit I am using

               Before I could set task on, what by my standards is a moderately complex circuit, I needed to be absolutely certain that I could get the Vic-20 to talk to the Arduino and then have that deliver the information to another serial port at a higher baud rate.

               First things first! Get a simple terminal program into the Vic-20 and then monitor the serial pins on the user port to verify that the Vic-20 is sending data. Below are a few pages from the VicModem user’s guide on creating a simple terminal program.
Program listing

Line by Line explanation

               Here is my test setup. If you look closely at the O-Scope’s screen you can see serial data. Also I saved the terminal program to cassette. How’s that for Retro-Novo Hacking?
Test Setup

               Now that I was certain that serial data was coming out of the Vic-20, I moved forward with having the Vic talk to the Arduino. To facilitate that I used the following code on the Arduino to toss serial data around from port to port.


SoftwareSerial mySerial(10, 11); // RX, TX

String MySerialSTR1, MySerialSTR2, SerialSTR1, SerialSTR2;
int MySerialCount, SerialCount;

void setup() 

  // Open serial communications and wait for port to open:
  Serial.println("Hello from Arduino!");

  // set the data rate for the SoftwareSerial port
  mySerial.println("speakjet online");

void loop() // run over and over
  if (mySerial.available())
// string1 = myserial.read 
// concatenate string1 to string2
// get length of string 2 into char count

//if charcount equal to or greater than 10 then OR if string1 is a carriage return thenwrite

  if (Serial.available())

               There is nothing fancy there. Two serial ports are opened. One at 9600bps the other at 300bps. When each port is opened a small message goes out to each, and then finally the Arduino just loops thru delivering one ports data to another and viceversa. Below are a few pictures from both sides of the fence. My laptop is standing in for where the speech chips will be placed.

Data going to the Vic-20 from the Arduino

Data coming from the Vic-20 through the Arduino and delivered to my laptop at 9600bps

                At this point I was finally satisfied that if I built the text to speech circuit I could get it working with the Vic-20 and also to get it to work with a few old cartridge games that were designed to work with the Votrax Type and Talk speech interface. Below are a few videos that describe the circuit and then go on to demo a Scott Adams text adventure game using my circuit as if it was a Votrax Type and Talk.

  Circuit description and general Type and Talk operation.

Using the circuit with a Scott Adams Text Adventure Game

               This level of tinkering had finally given me the amount of confidence I deemed necessary to move forward with creating a more generic interface(without an Arduino), a separate reset circuit, functionality to make Text to Speech hot switchable, and finally having a much larger amplifier. These will be the final technical challenges to be met in the next installment.

Stay Tuned...