BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Very simple robot 2w with L293D and Blynk controlled

Hi makers,

this is my first project with blynk…is a robt controlled by Blynk but i don’t use the motor scheld, i use the fantastic L293D.
In this project is very important to don’t use the pin used by Wifi sheld!
First the L293 connection and pin numbers

https://www.boxelectronica.com/pt/circuitos-integrados/293-l293d-dual-h-bridge-motor-driver-for-dc-or-steppers.html

second the wiring

…the skech



/* Inspired by http://circuitdigest.com/microcontroller-projects/arduino-wifi-controlled-robot
with WIFI sheld AND the low cost L293D
isn't possible to use the motor sheld, because they use the same pins of WIFI sheld
 */



 #define BLYNK_PRINT Serial    
// Comment this out to disable prints and save space
 #include SPI.h
 #include WiFi.h
 #include BlynkSimpleWifi.h

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Your auth";

// Your WiFi credentials
char ssid[] = "Your SSD";
char pass[] = "Your pass;        // Set to "" for open networks

 //Motors wiring and arduino connection
 /*


Pin L293      Pin Arduino
1              D6              
2              D3
3              + Motor 1
4              not connect
5              not connect
6              - Motor 1
7              D2
8              Vin

9              D11
10             D5
11             - Motor 2
12             not connect
13             gnd
14             + Motor 2 
15             D4
16             5V

 */

 #define E1 6  // Enable Pin PWM for motor 1---->D6
 #define E2 11  // Enable Pin PWM for motor 2---->D11

 #define I1 2  // Control pin 1 for motor 1 ---->D2
 #define I2 3  // Control pin 2 for motor 1 ---->D3

 #define I3 4  // Control pin 1 for motor 2 ---->D4
 #define I4 5  // Control pin 2 for motor 2 ---->D5

 void setup(){
   Serial.begin(9600);
   Blynk.begin(auth, ssid, pass);

   // Motors pins "E" is for "Engine"

   pinMode(E1, OUTPUT); //pin D6 arduino
   pinMode(E2, OUTPUT); //pin D11 arduino

   //Motore 1
   pinMode(I1, OUTPUT); //pin D2 arduino
   pinMode(I2, OUTPUT); //pin D3 arduino

   //Motore 2
   pinMode(I3, OUTPUT); //pin D4 arduino
   pinMode(I4, OUTPUT); //pin D5 arduino

 }

 BLYNK_WRITE(V1) 
 {
   int x = param[0].asInt();
   int y = param[1].asInt();

   if(y>220)
     avanti();
   
   else if(y<35)
     indietro();
   
   else if(x>220)
     destra();
   
   else if(x<35)
     sinistra();
      else
    ferma();
}

 void loop()
 {
   Blynk.run();
 }

 //function, "avanti" is forward, "indietro" is back, "destra" is right, "sinistra" is left

 void avanti(){
   analogWrite(E1, 255);
   analogWrite(E2, 255);

>   digitalWrite(I1, HIGH);
>   digitalWrite(I2, LOW);

>   digitalWrite(I3, HIGH);
>   digitalWrite(I4, LOW);
> }

> void indietro(){
>   analogWrite(E1, 255); 
>   analogWrite(E2, 255);

>   digitalWrite(I1, LOW);
>   digitalWrite(I2, HIGH);

>   digitalWrite(I3, LOW);
>   digitalWrite(I4, HIGH); 
> }

> void destra(){
>   analogWrite(E1, 255); 
>   analogWrite(E2, 255);

>   digitalWrite(I1, LOW);
>   digitalWrite(I2, HIGH);

>   digitalWrite(I3, HIGH);
>   digitalWrite(I4, LOW); 
> }

> void sinistra(){

>   analogWrite(E1, 255); 
>   analogWrite(E2, 255);

>   digitalWrite(I1, HIGH);
>   digitalWrite(I2, LOW);

>   digitalWrite(I3, LOW);
>   digitalWrite(I4, HIGH); 
> }
> void ferma(){
>   analogWrite(E1, 0); 
>   analogWrite(E2, 0);

>   digitalWrite(I1, LOW);
>   digitalWrite(I2, LOW);

>   digitalWrite(I3, LOW);
>   digitalWrite(I4, LOW); 
> }

2 Likes

Actually we can use the adafruit motor driver shield, but then we will need to use the esp8266 01 - wi-fi module in place of the wi-fi shield.

Hi! how do you connect the wifi module?