Andrewf1
Published © GPL3+

Voice Controlled WiFi Car

Voice controlled car with ESP motorshield and MIT App Inventor.

BeginnerFull instructions provided2 hours1,904
Voice Controlled WiFi Car

Things used in this project

Hardware components

NodeMcu Lua ESP8266 ESP-12E + WiFi Motor Drive Expansion Board
×1
DIY 4WD Smart Robot Car Chassis Kit
×1
2PCS Samsung INR18650-30Q battery
×1

Software apps and online services

Arduino IDE
Arduino IDE
MIT App Inventor
MIT App Inventor

Story

Read more

Schematics

Esp schematic

This is schematic for Voice controlled car project

Code

Voice_control

Arduino
This is code for Voice controlled car project
#include <ESP8266WiFi.h> 
#include <WiFiClient.h> 
#include <ESP8266WebServer.h> 
#include <ESP8266mDNS.h> 
 
MDNSResponder mdns; 
 
// Replace with your network credentials 
const char* ssid = "ssid"; 
const char* password = "password"; 
 
ESP8266WebServer server(80); 
String webPage = "OK"; 
 
int right = 4; 
int left = 5; 
int dirR=2; 
int dirL=0; 
 
void setup(void){ 
 // preparing GPIOs 
 pinMode(right, OUTPUT);  
 pinMode(left, OUTPUT);  
 pinMode(dirL, OUTPUT); 
 pinMode(dirR, OUTPUT); 
 digitalWrite(right, LOW); 
 digitalWrite(left, LOW);
 digitalWrite(dirR, LOW); 
 digitalWrite(dirL, LOW); 
 delay(1000); 
 Serial.begin(115200); 
 WiFi.begin(ssid, password); 
 Serial.println(""); 
 // Wait for connection 
 while (WiFi.status() != WL_CONNECTED) { 
   delay(500); 
   Serial.print("."); 
 } 
 Serial.println(""); 
 Serial.print("Connected to "); 
 Serial.println(ssid); 
 Serial.print("IP address: "); 
 Serial.println(WiFi.localIP()); 
 if (mdns.begin("esp8266", WiFi.localIP())) { 
   Serial.println("MDNS responder started"); 
 } 
server.on("/", [](){ 
   server.send(200, "text/html", webPage); 
 }); 
 
// handling commands
 
 server.on("/go", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirL, LOW); 
   digitalWrite(dirR, LOW); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(300); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
 
 server.on("/around", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirL, LOW); 
   digitalWrite(dirR, HIGH); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(530); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
 
 server.on("/gogogo", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirL, LOW); 
   digitalWrite(dirR, LOW); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(1000); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
 
 server.on("/back", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirL, HIGH); 
   digitalWrite(dirR, HIGH); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(300); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
 
 server.on("/left", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirR, LOW); 
   digitalWrite(dirL, HIGH); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(130); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
 
server.on("/right", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirR, HIGH); 
   digitalWrite(dirL, LOW); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(130); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
server.begin(); 
 Serial.println("HTTP server started"); 
} 
 
void loop(void){ 
 server.handleClient(); 
} 

Untitled file

Arduino
#include <ESP8266WiFi.h> 
#include <WiFiClient.h> 
#include <ESP8266WebServer.h> 
#include <ESP8266mDNS.h> 
MDNSResponder mdns; 
// Replace with your network credentials 
const char* ssid = "ssid"; 
const char* password = "password"; 
ESP8266WebServer server(80); 
String webPage = "OK"; 
int right = 4; 
int left = 5; 
int dirR=2; 
int dirL=0; 
void setup(void){ 
 // preparing GPIOs 
 pinMode(right, OUTPUT);  
 pinMode(left, OUTPUT);  
 pinMode(dirL, OUTPUT); 
 pinMode(dirR, OUTPUT); 
 digitalWrite(right, LOW); 
 digitalWrite(left, LOW);
 digitalWrite(dirR, LOW); 
 digitalWrite(dirL, LOW); 
 delay(1000); 
 Serial.begin(115200); 
 WiFi.begin(ssid, password); 
 Serial.println(""); 
 // Wait for connection 
 while (WiFi.status() != WL_CONNECTED) { 
   delay(500); 
   Serial.print("."); 
 } 
 Serial.println(""); 
 Serial.print("Connected to "); 
 Serial.println(ssid); 
 Serial.print("IP address: "); 
 Serial.println(WiFi.localIP()); 
 if (mdns.begin("esp8266", WiFi.localIP())) { 
   Serial.println("MDNS responder started"); 
 } 
server.on("/", [](){ 
   server.send(200, "text/html", webPage); 
 }); 
// handling commands
 server.on("/go", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirL, LOW); 
   digitalWrite(dirR, LOW); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(300); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
 server.on("/around", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirL, LOW); 
   digitalWrite(dirR, HIGH); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(530); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
 server.on("/gogogo", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirL, LOW); 
   digitalWrite(dirR, LOW); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(1000); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
 server.on("/back", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirL, HIGH); 
   digitalWrite(dirR, HIGH); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(300); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
 server.on("/left", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirR, LOW); 
   digitalWrite(dirL, HIGH); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(130); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
server.on("/right", [](){ 
   server.send(200, "text/html", webPage); 
   digitalWrite(dirR, HIGH); 
   digitalWrite(dirL, LOW); 
   digitalWrite(right, HIGH); 
   digitalWrite(left, HIGH); 
   delay(130); 
   digitalWrite(right, LOW); 
   digitalWrite(left, LOW); 
 }); 
server.begin(); 
 Serial.println("HTTP server started"); 
} 
void loop(void){ 
 server.handleClient(); 
} 

Credits

Andrewf1

Andrewf1

7 projects • 11 followers

Comments