India Automation Challenge 2021
OR
In this project, smart car design and application using sensor programming on a platform have been given. This robotic device has been developed along with an Android-based device. Arduino Uno has been used as the brain of the car. It also consists of the software component that uses a mobile application. The desired direction or mode by the mobile application can be selected by the user of the smart car to control the movement of the car. The user can control the movements from his/her own intelligent device or take the smart car in automatic mode and let the car drive its own way. Thus, the car can flee from the obstacle and also detect live objects. The purpose of this smart futuristic car is used is to alert the civilian and military personnel to potential terrorist attacks especially in military areas with live detectable sensors.
ESP8266: L298N Motor Driver Module: Arduino UNO: Robot Chassis 4 x 5V Geared Motors Connecting: Wires Power supply
ARDUINO
Hardware used are Node MCU, Arduino, L298N Motor Driver Module, Robot Chase 5V Geared Motors, Connecting Wires, Power supply (or battery). software used: ARDUINO
The first important thing to remember is that I programmed the Arduino, configured the ESP8266, and controlled the L298N Motor Driver Module. Then, the Inputs of the L298N Motor Driver Module i.e. IN1, IN2, IN3, and IN4 are connected to Digital Pins 12, 9, 10, and 11 of Arduino UNO. Coming to the robot chassis, it has 4 geared motors. So, I have connected the right two motors in parallel and connected them to the OUT1 and OUT2 terminals of the Motor Driver. Similarly, the left two motors to OUT3 and OUT4.
#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[] = "H_QMKcDYp9KBr4R9p_5UDUperDuc8SEs";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Node Sibi";
char pass[] = "sibiss2007";
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
}
///////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
CODE FOR ARDUINO
void setup() {
pinMode(7,INPUT);//2MOTOR IN 1
pinMode(6,INPUT);//2MOTOR IN 2
pinMode(5,INPUT);// MOTOR IN 1
pinMode(4,INPUT);// MOTOR IN 2 // put your setup code here, to run once:
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
}
void loop() {
while (digitalRead(7) == HIGH && digitalRead(6) == HIGH && digitalRead(5) == HIGH && digitalRead(4) == HIGH )
{
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
}
while (digitalRead(7) == LOW && digitalRead(6) == LOW && digitalRead(5) == LOW && digitalRead(4) == LOW )
{digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
}
while (digitalRead(7) == HIGH && digitalRead(6) == LOW && digitalRead(5) == HIGH && digitalRead(4) == LOW) //forward right
{
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
}
while (digitalRead(7) == HIGH && digitalRead(6) == LOW && digitalRead(5) == LOW && digitalRead(4) == HIGH) //forward left
{
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
digitalWrite(12, LOW);
}
while (digitalRead(7) == HIGH && digitalRead(6) == LOW && digitalRead(5) == LOW && digitalRead(4) == LOW) //forward
{
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
digitalWrite(12, LOW);
}
while (digitalRead(7) == LOW && digitalRead(6) == HIGH && digitalRead(5) == LOW && digitalRead(4) == LOW) //reverse
{
digitalWrite(9, LOW);
digitalWrite(10,HIGH);
digitalWrite(11, LOW);
digitalWrite(12, HIGH);
}
while (digitalRead(7) ==LOW && digitalRead(6) == HIGH && digitalRead(5) == HIGH && digitalRead(4) == LOW) //reverse right
{
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
}
while (digitalRead(7) == LOW && digitalRead(6) == HIGH && digitalRead(5) == LOW && digitalRead(4) == HIGH )//REVERSE left
{
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, HIGH);
}
}