How to make wifi controlled robot with the Blynk app?
In this article, we talked about a wifi controlled RC car. That is how to make our own wifi controlled RC car using Nodemcu with a simple method. Let's make it. Before making it recently we made a Bluetooth RC car. If you like to make so this is a link of the BT RC car.
Component Required:-
1.NodeMCU Board https://amzn.to/3TyqGaw
2.L298N Motor Driver Module https://amzn.to/3DhxIuT
3.12v DC Gear Motor https://amzn.to/3SlTXDW
4.12v (1.3Amp) Lithium Ion Battery https://amzn.to/3F1RICX
5.12v Blue LEDs https://amzn.to/3F0tEQN
6.3mm Red Led https://amzn.to/3F8UTZo
7. Buzzer https://amzn.to/3gm3jT3
8. Arduino Jumper wire https://amzn.to/3TAziwY
Schematics Diagram:-
This is a straightforward schematic diagram. You follow this diagram step by step for making a wifi controlled RC car.
1.L298N Motor Driver is Connected to NodeMCU
2. Front Light, Backlight, and Buzzer are connected to Node MCU:-
Here we are using 12v blue led for the front light of the RC car so we will need a bc 547 NPN transistor to control 12v led. If you use a regular 3mm led, you connect the direct (+) terminal of the led to the digital pin with a 1k resistor of node MCU. But here we want to lighter for the front light so we need a bc547 transistor for the external 12v power supply. BC 547 transistor of the emitter (E) pin is connected to the ground (GND) of node MCU and the base (B) pin of bc547 is connected 1st terminal of the 1k ohm resistor and the 2nd terminal of 1k resistor is directly connected to the D5 pin of the node MCU board. And collector (C) pin is directly connected to the GND (-) terminal of the 12v blue led and Vcc (+) terminal is directly connected to the +12v of the battery. And for the horn, the (+) terminal of the buzzer is connected to the D6, and the (-) terminal of the buzzer is connected to GND and also for the backlight of the Bluetooth RC car, the (+) terminal of the led is connected to D7 pin and negative (-) terminal is connected to all gnd pin of the circuit diagram.
Code and Circuit Diagram and Blynk App Download Link
Download
Code:-
/*WIFI RC Car Code*/
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
//L298N Motor driver
int In1 = D0;
int In2 = D1;
int In3 = D2;
int In4 = D3;
int Front_Light = D5;
int Horn = D6;
int Back_Light = D7;
bool Forward = 0;
bool Backward = 0;
bool Left = 0;
bool Right = 0;
bool Stop=0;
bool front_light = 0;
bool back_light = 0;
bool horn = 0;
char auth[] = "xxxxxx"; //Enter your Blynk application auth token
char ssid[] = "xxxxx"; //Enter your WIFI name
char pass[] = "xxxxx"; //Enter your WIFI passowrd
void setup()
{
Serial.begin(9600);
pinMode(In1, OUTPUT);
pinMode(In2, OUTPUT);
pinMode(In3, OUTPUT);
pinMode(In4, OUTPUT);
pinMode(Front_Light, OUTPUT);
pinMode(Back_Light, OUTPUT);
pinMode(Horn, OUTPUT);
Blynk.begin(auth, ssid, pass);
}
BLYNK_WRITE(V0)
{
Forward = param.asInt();
}
BLYNK_WRITE(V1)
{
Backward = param.asInt();
}
BLYNK_WRITE(V2)
{
Left = param.asInt();
}
BLYNK_WRITE(V3)
{
Right = param.asInt();
}
BLYNK_WRITE(V4)
{
Stop = param.asInt();
}
BLYNK_WRITE(V5)
{
front_light = param.asInt();
}
BLYNK_WRITE(V6)
{
back_light = param.asInt();
}
BLYNK_WRITE(V7)
{
horn = param.asInt();
}
void wifi_rc_car()
{
if (Forward == 1)
{
Car_forward();
}
if (Backward == 1)
{
Car_backward();
}
if (Left == 1)
{
Car_left();
}
if (Right == 1)
{
Car_right();
}
if (Stop == 1)
{
Car_stop();
}
if (Forward == 0 & Backward == 0 & Left == 0 & Right == 0)
{
Car_stop();
}
if (front_light == 1)
{
digitalWrite(Front_Light, HIGH);
}
if (front_light == 0)
{
digitalWrite(Front_Light, LOW);
}
if (back_light == 1)
{
digitalWrite(Back_Light, HIGH);
}
if (back_light == 0)
{
digitalWrite(Back_Light, LOW);
}
if (horn == 1)
{
digitalWrite(Horn, HIGH);
}
if (horn == 0)
{
digitalWrite(Horn, LOW);
}
if (front_light == 0 & back_light == 0 & horn == 0)
{
digitalWrite(Front_Light, LOW);
digitalWrite(Back_Light, LOW);
digitalWrite(Horn, LOW);
}
}
void Car_forward()
{
digitalWrite(In1, LOW);
digitalWrite(In2, HIGH);
digitalWrite(In3, LOW);
digitalWrite(In4, HIGH);
}
void Car_backward()
{
digitalWrite(In1, HIGH);
digitalWrite(In2, LOW);
digitalWrite(In3, HIGH);
digitalWrite(In4, LOW);
}
void Car_left()
{
digitalWrite(In1, HIGH);
digitalWrite(In2, LOW);
digitalWrite(In3, LOW);
digitalWrite(In4, HIGH);
}
void Car_right()
{
digitalWrite(In1, LOW);
digitalWrite(In2, HIGH);
digitalWrite(In3, HIGH);
digitalWrite(In4, LOW);
}
void Car_stop()
{
digitalWrite(In1, LOW);
digitalWrite(In2, LOW);
digitalWrite(In3, LOW);
digitalWrite(In4, LOW);
}
void loop()
{
Blynk.run();
wifi_rc_car();
}
0 Comments