ArduinoIoT HardwaresTutorials/DIY

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

text to speech arduino

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

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *