Close

Speech synthesis

A project log for Pill dispenser robot

An intelligent robot that manages my medication regimen.

m-bindhammerM. Bindhammer 05/03/2023 at 09:428 Comments

I bought the Chinese XFS5152CE Speech Synthesis Module on eBay. It supports TTS in Chinese and English language and has some sound effects. Also, speech recognition of up to 30 commands should be possible. The module supports UART, I2C, and SPI communication. There is no datasheet for the module itself, only for the processor XFS5152CEA. A translation can be found under FILES. The DFRobot Gravity - Speech Synthesis Module uses the same processor. Fortunately, user iforce2d on youtube has already done some preliminary work:  XFS5152 speech synthesis module.

I have also collected some useful information in advance:

As expected, only the RX pin on the XFS5152CE Speech Synthesis Module works with hardware serial. This is the same for the EMIC-2 module. Since I want to use an Arduino Due, software serial is out of the question. We actually only need RX and the status indicator output of the speech Synthesis Module, which we can monitor with an interrupt routine. I used the following wiring and components for testing:

Test code:

const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;

void speak(char* msg) {
  Serial1.write(0xFD);
  Serial1.write((byte)0x0);
  Serial1.write(2 + strlen(msg));
  Serial1.write(0x01);
  Serial1.write((byte)0x0);
  Serial1.write(msg);
}

void busy() {
  state = !state;
  digitalWrite(ledPin, state);
}

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), busy, CHANGE);
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() {
  speak("[x0][t6][v5][s6][m51][g2][h2][n1]Please take your medicine now.");
  while(state == HIGH);
}

Video (the first one in my new youtube channel):

Discussions

Larry Fischer wrote 12/03/2023 at 17:45 point

This was very helpful.  Thank you.  Just a comment: Maybe I didnt understand your comment but you implied that one could not use SoftwareSerial on Arduino to talk to the TTS module.  I am doing exactly that with a mega328 - it works perfectly.  

  Are you sure? yes | no

M. Bindhammer wrote 12/03/2023 at 18:53 point

Thanks. SoftwareSerial does not work with an Arduino Due which I was using. Other Arduinos should work fine using SoftwareSerial.

  Are you sure? yes | no

Stewart Russell wrote 07/11/2023 at 23:11 point

Does the /BSY line on the XFS5152 go high as soon as you're finished sending the serial data? On the similar SYN6988, it only goes high as soon as the serial message has been processed. This can take up to 700 ms, so you can sometimes cut messages off if you're not careful to wait.

  Are you sure? yes | no

M. Bindhammer wrote 07/12/2023 at 07:30 point

If I remember correctly, the busy line goes low when the text is spoken.

  Are you sure? yes | no

hugues.lecoeuche wrote 05/26/2023 at 08:41 point

I recently started experimenting with the modern TTS modules coming from China (I used to have a JetSound chip 15 years ago, it was basic and fun. Sadly it is not manufactured anymore).

I can see lots of modules with PCB that look similar and prices that are almost the same but that are based on 2 different chip sets: The XFS5152CE and the SYN6988.

I can't find much data in terms of comparison between the chips (do they have significantly different features, does one generates better English that the other?).

Any knowledge of experience people could share would be gladly received.

  Are you sure? yes | no

Stewart Russell wrote 07/11/2023 at 23:17 point

Yes, I've assessed a few of these. At best, they can only speak English or Chinese. The SYN6988 is the one that I've found that speaks English well. The older SYN6288 and SYN6658 cannot speak English at all. There are a couple of other chips I haven't been able to get any sound out of at all. I've never managed to use an XFS5152: AliExpress vendors send me SYN6988s instead.

I wrote a MicroPython library for the SYN6988: https://github.com/scruss/micropython-SYN6988

  Are you sure? yes | no

hugues.lecoeuche wrote 05/26/2023 at 08:39 point

Great demo!!

I have purchased the DFRobot Gravity - Speech Synthesis Module you mention (because of the convenience of having the integrated speaker). I am communicating to it through the I2C interface (connected to a UNO).

I get issues at times communicating with the module and the only code I get back is "0xEF" (when I query the module status using code 0x21).

I cannot find any info about what 0xEF means and struggle to get the module reset after this happens (need to physically disconnect it i.e. power it down and then try to send collections of 1 byte command until it springs back up to live).

Do you have any experience of communicating over I2C with a XFS5152 module? Any info you ca share on what the 0xEF return code may be?

Regards

  Are you sure? yes | no

M. Bindhammer wrote 07/12/2023 at 07:25 point

Maybe the translated datasheet of the XFS5152CE TTS processor is helpful. You'll find it under "Files". I haven't tried communicating over I2C yet.

  Are you sure? yes | no