Text to Speech on Arduino
We have already made many projects regarding Arduino. Today, we will use “Text to Speech” to give voice to these projects, Without Text-to-Speech Module. We can do this through the Arduino TTS library. Using this library, voice synthesizer that converts a stream of digital text into retro (robot) speech. It is very easy, we need only external LM385 amplifier with arduino Uno, No special components or shields required.
Thanks to Gabriel Petrut and Clive Webster for making this thing. We found this project on GitHub : https://github.com/jscrane/TTS
Using this project we can read Internet-based data streams (such as e-mails or Twitter feeds), Conveying status or sensor outputs from robots, or industrial machinery.
Components required:
- Arduino Uno
- LM386
- Speaker
- Capacitors and few resistors as shown in circuit
Circuit Diagram
Library download
https://github.com/jscrane/TTS
Arduino Code for Text to Speech
Note: This program and library works only with Arduino 1.0 version
/* Text To Speech syntesis library The Text To Speech library uses Timer1 to generate the PWM output on digital pin 10. The output signal needs to be fed to an RC filter then through an amplifier to the speaker. */ #include <TTS.h> // Media pins #define ledPin 13 // digital pin 13 // Variables char text [50]; boolean state=0; TTS text2speech; // speech output is digital pin 10 void setup() { //media pinMode(ledPin, OUTPUT); } //================================================================ // Main Loop //================================================================ void loop(){ state = !state; digitalWrite(ledPin, state); Test_Speech(); delay(1000); // delay a second } //================================================================ void Test_Speech() { text2speech.setPitch(6); //higher values = lower voice pitch strcpy(text, "Hello, How are you?"); text2speech.say(text); delay(500); text2speech.setPitch(1); //lower values = higher voice pitch strcpy(text, "I am fine."); text2speech.say(text); }
For more details please visit https://github.com/jscrane/TTS