Wi-Fi Based Robotic car Controll using ESP8266 Wi-Fi module

In this lesson, we will be discussing on how to control a robotic car using Wi-Fi, there many method of controlling a robotic car but in this lesson, we focus on using Wi-Fi to control robotic car.

The Field of robotics has been exponential growth with the amalgamation of multiple domains. The holistic approach is proving to be a boon, where communication engineering, mechanical engineering, embedded system and so many more are together creating robot with high flexibility. Present technologies can only control robots up to a radius of 500 meters, but our aim in this project is to target controlling a robot from a remote location which is more than 1000 miles away when provides with network. We use WIFI as the medium for communication. We are achieving this operation by communicating using two computers. These computers connected to the Wi Fi pass on serial data and also communication is established between one computer located near the robot and a microcontroller present, which control its trajectory. Moreover robot will be having its own senses to dodge obstacle, which will also give about its position. Future scope of this project is to establish the same connection but make the both intelligent and autonomous.


Introduction

In the present day, technology has so improved that an Unmanned Aerial Vehicle (UAV) also called as Drone can be controlled from a distance ranging from 2km to 20,000km. The Mars Rover, which was sent to Mars to explore various features of the planet, is an autonomous robot which is programmed such that it performs the desired task as it is intended to do. There are many such systems which are controlled either by Radio Frequency transmission or by creating intelligence. Robots are called Non-autonomous robots. These robots have the programming logic to do the desired task but the decision power lies in the hand of controller (human) handling the robot. Here the interface can be made using two methods:

A.   Wired: The connection between controller and robot is maintained using wired interface. These interfaces can be serial or parallel but the technology is transmission of signal, which is sent in the form of specific pattern to the robot to carry out the specific task, these patterns with the help of a microcontroller governing its motion.

B.   Wireless: Here the connection between controller and robot is achieved by wireless interface such as: Bluetooth Wi-Fi The underlying technology is transmission of signals wireless in air by transmitter which is captured by the receiver and sent to microcontroller mounted on the robot to carry out the task. At the present demand for robots in this developing world to carry out work effectively and accurately, the development of cost effective robots is necessar. 

check our order projects below

https://electronicsbuilding.blogspot.com/2023/05/bluetooth-based-calling-system-in.html

below is the circuit diagram



code 
#define ENA   D5          // Enable/speed motors Right        GPIO14(D5)
#define ENB   D6          // Enable/speed motors Left         GPIO12(D6)
#define IN_1  D8          // L298N in1 motors Rightx          GPIO15(D8)
#define IN_2  D7          // L298N in2 motors Right           GPIO13(D7)
#define IN_3  D4          // L298N in3 motors Left            GPIO2(D4)
#define IN_4  D3          // L298N in4 motors Left            GPIO0(D3)

#include <ESP8266WiFi.h>
#include <WiFiClient.h> 
#include <ESP8266WebServer.h>

String command;             //String to store app command state.
int speedCar = 800;         // 400 - 1023.
int speed_Coeff = 3;

const char* ssid = "my way";
const char* password = "12345678";
ESP8266WebServer server(80);

void setup() {
 
 pinMode(ENA, OUTPUT);
 pinMode(ENB, OUTPUT);  
 pinMode(IN_1, OUTPUT);
 pinMode(IN_2, OUTPUT);
 pinMode(IN_3, OUTPUT);
 pinMode(IN_4, OUTPUT); 
  
 Serial.begin(115200);
  
// Connecting WiFi

  WiFi.mode(WIFI_AP);
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
 
 // Starting WEB-server 
     server.on ( "/", HTTP_handleRoot );
     server.onNotFound ( HTTP_handleRoot );
     server.begin();    
}

void goAhead()
      digitalWrite(IN_1, LOW);
      digitalWrite(IN_2, HIGH);
      analogWrite(ENA, speedCar);

      digitalWrite(IN_3, LOW);
      digitalWrite(IN_4, HIGH);
      analogWrite(ENB, speedCar);
  }

void goBack()
      digitalWrite(IN_1, HIGH);
      digitalWrite(IN_2, LOW);
      analogWrite(ENA, speedCar);

      digitalWrite(IN_3, HIGH);
      digitalWrite(IN_4, LOW);
      analogWrite(ENB, speedCar);
  }

void goRight()
      digitalWrite(IN_1, HIGH);
      digitalWrite(IN_2, LOW);
      analogWrite(ENA, speedCar);

      digitalWrite(IN_3, LOW);
      digitalWrite(IN_4, HIGH);
      analogWrite(ENB, speedCar);
  }

void goLeft()
{
      digitalWrite(IN_1, LOW);
      digitalWrite(IN_2, HIGH);
      analogWrite(ENA, speedCar);

      digitalWrite(IN_3, HIGH);
      digitalWrite(IN_4, LOW);
      analogWrite(ENB, speedCar);
  }

void goAheadRight()
{
      digitalWrite(IN_1, LOW);
      digitalWrite(IN_2, HIGH);
      analogWrite(ENA, speedCar/speed_Coeff);
 
      digitalWrite(IN_3, LOW);
      digitalWrite(IN_4, HIGH);
      analogWrite(ENB, speedCar);
   }

void goAheadLeft()
      digitalWrite(IN_1, LOW);
      digitalWrite(IN_2, HIGH);
      analogWrite(ENA, speedCar);

      digitalWrite(IN_3, LOW);
      digitalWrite(IN_4, HIGH);
      analogWrite(ENB, speedCar/speed_Coeff);
  }

void goBackRight()
      digitalWrite(IN_1, HIGH);
      digitalWrite(IN_2, LOW);
      analogWrite(ENA, speedCar/speed_Coeff);

      digitalWrite(IN_3, HIGH);
      digitalWrite(IN_4, LOW);
      analogWrite(ENB, speedCar);
  }

void goBackLeft()
      digitalWrite(IN_1, HIGH);
      digitalWrite(IN_2, LOW);
      analogWrite(ENA, speedCar);

      digitalWrite(IN_3, HIGH);
      digitalWrite(IN_4, LOW);
      analogWrite(ENB, speedCar/speed_Coeff);
  }

void stopRobot()
{  
      digitalWrite(IN_1, LOW);
      digitalWrite(IN_2, LOW);
      analogWrite(ENA, speedCar);

      digitalWrite(IN_3, LOW);
      digitalWrite(IN_4, LOW);
      analogWrite(ENB, speedCar);
 }

void loop() 
{
      server.handleClient();
      command = server.arg("State");
      if (command == "F") goAhead();
      else if (command == "B") goBack();
      else if (command == "L") goLeft();
      else if (command == "R") goRight();
      else if (command == "I") goAheadRight();
      else if (command == "G") goAheadLeft();
      else if (command == "J") goBackRight();
      else if (command == "H") goBackLeft();
      else if (command == "0") speedCar = 400;
      else if (command == "1") speedCar = 470;
      else if (command == "2") speedCar = 540;
      else if (command == "3") speedCar = 610;
      else if (command == "4") speedCar = 680;
      else if (command == "5") speedCar = 750;
      else if (command == "6") speedCar = 820;
      else if (command == "7") speedCar = 890;
      else if (command == "8") speedCar = 960;
      else if (command == "9") speedCar = 1023;
      else if (command == "S") stopRobot();
}

void HTTP_handleRoot(void) 
{
if( server.hasArg("State") )
  {
     Serial.println(server.arg("State"));
  }
  server.send ( 200, "text/html", "" );
  delay(1);
}
After uploading the code and connecting your phone to the wi-fi network
open your wed browser and type in the IP Address of the ESP8266, for my own, is 192.168.4.1 your own mayb different from mine. open your serial terminal and copy it.

click on the link below to download the App

Conclusion

The project was carried out by using the esp8266 and motor drive in the field of electrical-electronics. New things and new technology are being invented. As the technology grows day by day, it can imagine about the future in which thing may occupy every place. User friendly and less complex, which can readily be used in order to perform. Several tedious and repetitive tasks. Though it is designed keeping in mind about the need for industry, it can extended for other purposes such as commercial and research application. The chassis of robot made by plastic it give the efficiency and more speed to robot. The command coding is entered in robot it is very easy to understand. Though it is designed keeping in mind about the need for industry, it can extended for other purposes such as commercial and research application.


Share:

No comments: