Hola!!! En esta entrada vamos a revisar un módulo TTS(Text to Speech) o módulo sintetizador de voz, aportado por DFRobot puede conseguir este módulo en página en el siguiente link Módulo sintetizador de voz
Tal vez pueda interesarte proyectos en arduino, pic, robótica, telecomunicaciones, suscribete en http://www.youtube.com/user/carlosvolt?sub_confirmation=1 muchos videos con código fuentes completos y diagramas
Introducción
¿Quieres que tu robot hable? ¿O alguna vez tus plantas dicen que tienen sed? El Módulo sintetizador de voz para Arduino hace que sea fácil hacerse realidad. Es hora de dar voz a tus robots y proyectos. El Módulo sintetizador de voz está diseñado para colocarse fácilmente en cualquier Arduino estándar. Utiliza un chip de síntesis de voz XFS5051CE de IFLYTEK que combina tecnología líder mundial y alto grado de integración. Se admiten idiomas como el chino y el inglés, dialectos como el cantonés y el habla mixta también son funcionales con este módulo. Es muy divertido hacer un pronóstico del tiempo con la voz de transmisión. Está utilizando la comunicación UART para que sea ampliamente compatible con la mayoría de las placas controladoras.
Especificación
- Velocidad de transmisión: 4800,9600,57600,115200
- Un LED indicador de ocupado
- Un indicador de encendido LED
- Voltaje: + 5V
- Tamaño: 56 * 53 mm
- Peso: 26 gramos
- 11 niveles de velocidad de habla
- Soporta el ideoma chino
- Soporta el ideoma inglés
- Tanto la voz masculina como femenina son compatibles
- Utilice los puertos serie de su Arduinos solamente
Comenzando
![]()
Presione el botón RST en la placa del controlador después de cargar el sketch, o afectará el uso normal.
Recuerde que el botón “RST” en el escudo del habla es solo el chip de síntesis del habla.
El led ocupado estará iluminado una vez, cuando presione “RST”.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
#include <SpeechSynthesis.h> void setup() { Serial.begin(9600); } byte ssr[500];//define a character string void loop() { SpeechSynthesis.buf_init(ssr);//Clear the buffer SpeechSynthesis.English(ssr,4,"5");//volume in grade 5 SpeechSynthesis.English(ssr,6,"cooki");//"6" means synthesis in English; "cooki"is the content SpeechSynthesis.English(ssr,4,"5"); SpeechSynthesis.English(ssr,6,"cooki Clock, reset and supply management"); SpeechSynthesis.English(ssr,2,"10"); SpeechSynthesis.English(ssr,6,"cooki Clock, reset and supply management"); SpeechSynthesis.English(ssr,2,"5");//speed of speaking: grade 5 SpeechSynthesis.English(ssr,5," ");//speed,volume,intomation are all set into default SpeechSynthesis.English(ssr,6,"cooki Clock, reset and supply management"); SpeechSynthesis.Espeaking(0,19,4,ssr);//Executive commands above, "0" is synthesis command; "19" select speaker; "4" speech function while(Serial.read()!=0x41)//waiting synthesis complete {} while(Serial.read()!=0x4F)//waiting play complete {} SpeechSynthesis.buf_init(ssr); SpeechSynthesis.English(ssr,6,"hello cooki 123"); SpeechSynthesis.Espeaking(0,19,4,ssr); while(Serial.read()!=0x41) {} while(Serial.read()!=0x4F) {} SpeechSynthesis.buf_init(ssr); SpeechSynthesis.English(ssr,6,"hello cooki 123"); SpeechSynthesis.Espeaking(0,19,7,ssr); while(1); } |
En el siguiente código vamos a hacer un contador descendente, y a medida que cambia cada número, una voz irá indicando cual es el número hasta llegar a cero, y en ese momento se encenderá un led y un buzzer sonará.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
#include <SpeechSynthesis.h> #include "U8glib.h"//libreriapara el control del display U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI // Se habilita esta linea según el display a a usar en este caso el driver SH1106 int contador =0; int led8=8; void setup() { Serial.begin(9600); pinMode(led8, OUTPUT); } byte ssr[500];//define a character string void loop() { nueve();//Llama a la funciona llamada nueve delay(1000); ocho(); delay(1000); siete(); delay(1000); seis(); delay(1000); cinco(); delay(1000); cuatro(); delay(1000); tres(); delay(1000); dos(); delay(1000); uno(); delay(1000); cero(); delay(1000); while(1); } int uno(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"one");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=1; display(); } int dos(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"two");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=2; display(); } int tres(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"three");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=3; display(); } int cuatro(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"four");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=4; display(); } int cinco(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"five");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=5; display(); } int seis(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"six");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=6; display(); } int siete(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"seven");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=7; display(); } int ocho(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"eight");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=8; display(); } int nueve(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"nine");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=9; display(); } int cero(void){ SpeechSynthesis.buf_init(ssr);//Inicializa el buffer SpeechSynthesis.English(ssr,2,"5");//Velocidad de la voz SpeechSynthesis.English(ssr,4,"5");//volumen de la voz 5 SpeechSynthesis.English(ssr,6,"zero");//si es 6 el Idioma es inglés //0->comando para inicializar la sintesis de voz //17->voz masculina //4->si es 4 dirá la frade corrido //ssr es el buffer hasta 500 caracteres SpeechSynthesis.Espeaking(0,17,4,ssr); contador=0; display(); digitalWrite(led8, HIGH); // turn the LED on (HIGH is the voltage level) delay(3000); // wait for a second digitalWrite(led8, LOW); // turn the LED off by making the voltage LOW } int display(void){ //--------Muestra nuestra el numero en pantalla----------------- u8g.firstPage(); do { draw();//Llama a la función draw } while( u8g.nextPage() ); // Reconstruir la imagen después de un tiempo delay(50); } void draw(void) { //Los comandos gráficos para volver a dibujar la pantalla completa deben colocarse aquí u8g.setFont(u8g_font_unifont); u8g.setPrintPos(0, 20); u8g.print("Conteo:"); u8g.print(contador); } |
Circuito
Recuerden que Speech Synthesis Shield for Arduino lo pueden adquirir en la paginade DFRobot en:
Tal vez pueda interesarte proyectos en arduino, pic, robótica, telecomunicaciones, suscribete en http://www.youtube.com/user/carlosvolt?sub_confirmation=1 muchos videos con código fuentes completos y diagramas
SUSCRIBETE A NUESTROS BOLETINES, RECIBE EN TU CORREO LAS NOTICIAS MÁS DESTACADAS, SÓLO INGRESANDO TU CORREO ELECTRÓNICO
[wysija_form id=”1″]

