Andrewf1
Published © GPL3+

Simplest wifi car using ESP8266 Motorshield

Simplest wifi car controlled by your smartphone using NodeMcu esp8266 and Blynk.

BeginnerFull instructions provided2 hours25,215
Simplest wifi car using ESP8266 Motorshield

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

Blynk
Blynk
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Wifi car schematics

This is scheme for wifi car project

Code

Wifi car

Arduino
This is code for wifi car.
#define BLYNK_PRINT Serial 
#include <ESP8266WiFi.h> 
#include <BlynkSimpleEsp8266.h> 
 
 
// You should get Auth Token in the Blynk App. 
// Go to the Project Settings (nut icon). 
char auth[] = "YourAuthToken"; 
 
 
// Your WiFi credentials. 
// Set password to "" for open networks. 
char ssid[] = "YourNetworkName"; 
char pass[] = "YourPassword"; 
 
 
 
int PWMA=5;//Right side 
int PWMB=4;//Left side 
int DA=0;//Right reverse 
int DB=2;//Left reverse 
 
 
void setup(){ 
 
 // Debug console 
 Serial.begin(9600); 
 Blynk.begin(auth, ssid, pass); 
 pinMode(PWMA, OUTPUT); 
 pinMode(PWMB, OUTPUT); 
 pinMode(DA, OUTPUT); 
 pinMode(DB, OUTPUT); 
 
} 
 
 
 
void loop(){ 
Blynk.run(); 
  
} 
 
 
 
// Handling Joystick data 
BLYNK_WRITE(V1){ 
int x = param[0].asInt(); 
int y = param[1].asInt();  

if(x==-1 && y==-1){             //BackWard and Left     
  digitalWrite(PWMA, LOW); 
  digitalWrite(DA, LOW); 
     
  digitalWrite(PWMB, HIGH); 
  digitalWrite(DB, HIGH); 
 
}else if(x==-1 && y==0){        //Left Turn 
  digitalWrite(PWMA, 450); 
  digitalWrite(DA, HIGH); 
    
  digitalWrite(PWMB, 450); 
  digitalWrite(DB, LOW); 
 
}else if(x==-1 && y==1){        //Forward and Left     
  digitalWrite(PWMA, LOW); 
  digitalWrite(DA, LOW); 
    
  digitalWrite(PWMB, HIGH); 
  digitalWrite(DB, LOW); 
 
}else if(x==0 && y==-1){        //BackWard     
  digitalWrite(PWMA, HIGH); 
  digitalWrite(DA, HIGH); 
     
  digitalWrite(PWMB, HIGH); 
  digitalWrite(DB, HIGH);
}else if(x==0 && y==0){        //Stay 
  digitalWrite(PWMA, LOW); 
  digitalWrite(DA, LOW); 
     
  digitalWrite(PWMB, LOW); 
  digitalWrite(DB, LOW); 
 
}else if(x==0 && y==1){        //Forward 
  digitalWrite(PWMA, HIGH); 
  digitalWrite(DA, LOW); 
    
  digitalWrite(PWMB, HIGH); 
  digitalWrite(DB, LOW); 
 
}else if(x==1 && y==-1){        //Backward and Right     
  digitalWrite(PWMA, HIGH); 
  digitalWrite(DA, HIGH); 
     
  digitalWrite(PWMB, LOW); 
  digitalWrite(DB, LOW); 
 
}else if(x==1 && y==0){        //Right turn 
   digitalWrite(PWMA, 450); 
  digitalWrite(DA, LOW); 
   
  digitalWrite(PWMB, 450); 
  digitalWrite(DB, HIGH); 
 
}else if(x==1 && y==1){        //Forward and Right 
  digitalWrite(PWMA, HIGH); 
  digitalWrite(DA, LOW); 
   
  digitalWrite(PWMB, LOW); 
  digitalWrite(DB, LOW);
 } 
 
}  

Credits

Andrewf1

Andrewf1

7 projects • 17 followers

Comments