Hello there. Today I want to tell you more about my last project, that i edited to final.
I have made web application that support voice-to-text (voice recognition) in real time. It is working with all world languages with available lang code.. For instance: en-US, sk-SK, cs-CZ, de-DE and so on. I have demo for you, it is in English language for try this technology.
Note: Project is only working with Chrome or Samsung Mobile browser!
You can use ESP8266 board (verified working on NodeMCU), I think it will work with ESP8266, Wemos D1 mini etc good. Or you can use Arduino with Ethernet shield W5100, it will work with Wiznet W5200 or W5500 too, you need only full compatible Ethernet2.h library. Web page is universal. If you write your own parser, you can use it with ESP32, RaspberryPi, OrangePi, C.H.I.P, Bigclown and more boards/microcontrolers.
You can use in my demo this hardware:
- Arduino + Ethernet shield W5100
- NodeMCU (or similar board)
In my website you have full instructions how to use, read it carefully! You need to start your microphone manually for the first time in settings of webpage.
English voice-to-text translation: https://arduino.php5.sk/PHP_en/
English .ino scripts (working with these demos):
Arduino script with Ethernet shield W5100
//Author: Martin Chlebovec
//Nick of author: martinius96
//Website: https://arduino.php5.sk
//Donate: http://paypal.me/chlebovec
#include <SPI.h>
#include <Ethernet.h>
int led = 6;
byte mac[] = { 0xAA, 0xBB, 0xCC, 0x81, 0x7B, 0x4A }; //fyzicka adresa MAC
char serverName[] = "www.arduino.php5.sk"; // webserver
IPAddress ip(192, 168, 1, 254);
EthernetClient client;
String readString;
int x=0; //pocitadlo riadkov
char lf=10; //line feed character
void setup(){
pinMode(led, OUTPUT);
if (Ethernet.begin(mac) == 0) {
Serial.println("DHCP nepridelilo adresu, skusam so statickou...");
Ethernet.begin(mac, ip);
}
Serial.begin(9600);
}
void loop(){
if (client.connect(serverName, 80)) { //starts client connection, checks for connection
Serial.println("connected");
client.println("GET /PHP_en/preklady.txt HTTP/1.1"); //download text
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close"); // ukonc HTTP/1.1 spojenie
client.println(); //koneic requestu
}
else {
Serial.println("Pripojenie neuspesne"); //chyba ak nie som pripojeny
Serial.println();
}
while(client.connected() && !client.available()) delay(1); //cakaj na data
while (client.connected() || client.available()) { //pramenna
char c = client.read(); //dostan bity z buffera
Serial.print(c); //cela http hlavicka
if (c==lf) x=(x+1); //pocitaj
else if (x==12) readString += c; //nasa premenna
}
if(readString=="On"){
digitalWrite(led, HIGH);
}else if(readString=="Off"){
digitalWrite(led, LOW);
}
else{
Serial.println("Nepodporovana premenna.");
}
readString = ("");
x=0;
client.stop(); //ukonc spojenie
delay(5000); //pockaj 5s a vykonaj novu slucku loop
}
NodeMCU v3 Lolin
//Author: Martin Chlebovec
//Nick of author: martinius96
//Website: https://arduino.php5.sk
//Donate: http://paypal.me/chlebovec
#include <ESP8266WiFi.h> //kniznica importovana v Arduine core, testovana verzia 2.3.0
#include <WiFiClientSecure.h> //kniznica importovana v Arduine core, testovana verzia 2.3.0
const int led = 16; //GPIO 16 = D0 on NodeMCU board
const char * ssid = "menowifi";
const char * password = "heslowifi";
const char * host = "arduino.php5.sk"; //bez https a www
const int httpsPort = 443; //https port
const char * fingerprint = "13 9f 87 1d b1 85 be e6 bd 73 c1 8d 04 63 58 99 f0 32 43 92"; // odtlacok certifikatu SHA1
void setup() {
Serial.begin(9600);
Serial.println();
pinMode(led, OUTPUT);
Serial.print("pripajam na wifi siet: ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi uspesne pripojene");
Serial.println("IP adresa: ");
Serial.println(WiFi.localIP());
}
void loop() {
WiFiClientSecure client; //funkcia pre HTTPS spojenia
Serial.print("pripajam sa na server ");
Serial.println(host);
if (!client.connect(host, httpsPort)) {
Serial.println("pripojenie neuspesne");
return;
}
if (client.verify(fingerprint, host)) {
Serial.println("certifikat zhodny");
} else {
Serial.println("certifikat nezhodny");
}
String url = "/PHP_en/preklady.txt";
Serial.print("poziadavka na adresu: ");
Serial.println(url);
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"User-Agent: NodeMCU\r\n" +
"Connection: close\r\n\r\n");
Serial.println("poziadavka vykonana");
while (client.connected()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
Serial.println("Response prijata");
break;
}
}
String line = client.readStringUntil('\n');
Serial.println("Vratena premenna: ");
Serial.println(line);
if (line == "On") { //zapnem vystup (rele alebo diodu)
digitalWrite(led, HIGH);
} else if (line == "Off") { //vypnem vystup (rele alebo diodu)
digitalWrite(led, LOW);
} else {
Serial.println("Nepodporovana hlasova instrukcia, opakujte prikaz online");
}
}
If you are interested for website code, you can contact me on: martinius96@gmail.com
For more informations visit my page and translate it to your language: https://arduino.php5.sk/ovladanie-hlasom.php