Тёмный

Controlling 2 DC Motors using ESP32 and L298N Motor driver 

Robojax
Подписаться 110 тыс.
Просмотров 78 тыс.
50% 1

Опубликовано:

 

15 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 132   
@Clarence_13x
@Clarence_13x Год назад
I feel like you are truly the best, I have learned everything from your videos. YOU are the person they were talking about when they said that it's the information age.
@andreguimaraes1966
@andreguimaraes1966 2 месяца назад
Parabéns pelo vídeo! Esse material me ajudou muito aqui no meu projeto! Um forte abraço de André Guimarães - São José dos Campos - São Paulo - Brazil.
@robojax
@robojax 2 месяца назад
Olá, muito prazer em saber. Saudações do Canadá. Ahmad
@jaslarja
@jaslarja 2 года назад
could you connect 2 L298N to 1 Esp32 for 4 motors?
@sheriftamer6486
@sheriftamer6486 3 месяца назад
Yeah but the best way is to c9nnect on motor drive for 4 motors i did it with 4 12v dc motor and worked perfectly
@AYA-GAMING_SHORTS
@AYA-GAMING_SHORTS Месяц назад
I connected my l298 to esp32 with 5v pin. BUT when I connected the motor to l298 then the reading of voltage given the motor by l298 is just 1.6v . What can I do? Plz reply me plz.🥹
@robojax
@robojax Месяц назад
Hi, means L298 is not getting input signal. or power supply is not connected properly. Check wiring and I assume you did not touch the code.
@shafagh_projects
@shafagh_projects 3 года назад
You are a genious. so great tutorial and thanks for t=sharing this with us.
@robojax
@robojax 3 года назад
You are welcome. Here is $200 Arduino course for free Arduino Step by Step Course (over 100 lectures) Starts here robojax.com/L/?id=338
@Kub_43
@Kub_43 3 месяца назад
Hi, i have a problem with the librery, is not working, im ussing the arduino IDE 2.3.3 and if i run the esp32 2dc motors example, without touching anything of the code, it display errors about "'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?" and 'ledcSetup' was not declared in this scope
@Kub_43
@Kub_43 3 месяца назад
For anyone that faces the same problem, the library is compatible until version 2.0.17, beacause espressif made changes in version 3 to the pwm functionallities. it would be cool to see this library in versions > 3 tho, it simplifies everything
@arseniusdavin183
@arseniusdavin183 Месяц назад
@@Kub_43 so how do you solve the problem?
@chiragshah6873
@chiragshah6873 Год назад
Hi thank you for the video, and all works perfect with a 12v input adapter for my l298n and a microusb 5v laptop power for esp32s. However, if i pull a cable from my l298n 5V to esp32s, the esp32s works but the motor no longer spins. Can you help how i can power both with same source, do i need a bigger adaptor. Adaptor output - 12V DC Current - 2000MA Motor - 12V, 150RPM
@robojax
@robojax Год назад
supply 5V to ESP32.
@chiragshah6873
@chiragshah6873 Год назад
@@robojax you mean external right.. ?, cant pull from l298n??
@bektinurwanto
@bektinurwanto 3 месяца назад
i cannot use the code sir, have error Robojax_L298N_DC_motor.cpp:159:3: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'? 159 | ledcAttachPin(ENA, CHA);
@robojax
@robojax 3 месяца назад
It means your have not installed the esp32 driver
@bektinurwanto
@bektinurwanto 3 месяца назад
@@robojax i'm use Arduino ide 2.3.1, i think led attachpin not used again..
@nathanbinene9306
@nathanbinene9306 2 года назад
Hello Ahmad thank you for the video I would like to know what should I have to do for both Motors to run simultaneously in clockwise or anti-clockwise cause I am designing a robot which will have 2 DC Motors however the robot has to move Forward , Backward, Turnleft and Turnright. I am using ESP32 and L298N
@robojax
@robojax 2 года назад
Hello, I believe I have explained every line and what they do. so I would suggest watching the video 2 or 3 times until you understand it. Just see which line in the code makes the motor to run make copy of the same line in the line below it and change the value to make the other motor rurn. or may be watch this video ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-wn5D7j1ybxY.html and learn which line controls a motor.
@adityaravindran8942
@adityaravindran8942 3 года назад
I am trying to send a message from a python code over wifi using sockets. but when i do this, the motor isnt running. can someone help me?
@mattrichardson4351
@mattrichardson4351 2 года назад
Hi Im doing Up my sons ride on car and need to run two motors off the back and one motor for steering.. I have the ESP32 and the Dual L298N Motor driver model too .. any pointers would help
@robojax
@robojax 2 года назад
Hi, this should work. just identify the pins. check or test be lifting the car and turning it ON. using whatever controller you have try going forward and se which wheels rotate. then turn left and check which motor rotate and the same for right turn. I am not sure if the car has servo to physically turns the wheel or just by controlling the each motor it rotates. My point is to see if 4 motor is used when running the car or just two sets run together. this can be checked to see if two L298N is used or 1. here an one of 4 videos on a smart car ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-JDgOYKo_zQ8.html using L298N. Search my channel on more on car. Here is how to find Specific RU-vid Video in a channel bit.ly/findRU-vidVideo
@mattrichardson4351
@mattrichardson4351 2 года назад
@@robojax you absolute legend 🤟🏼I’ll check all the pins and make sure what’s running what .. I know I have two differently on the back but could possibly have a servo motor up front for the steering.. I’ll have to pull it off and have a look and follow your guild more .. will report back later 😀
@TN-qr1cm
@TN-qr1cm 2 года назад
I tried the same experiment but I cannot get both motors to run at the same time they run interchangeably: one runs and the other is not then they switch. do you know why is that?
@robojax
@robojax 2 года назад
if you have not changed the code, then wiring is wrong. check it.
@Your_mask_man
@Your_mask_man 2 месяца назад
Did you add another power supply for motors ?
@robojax
@robojax 2 месяца назад
so you did not watch the video. Please watch. The L298N is proving power to the motor.
@srimansingaravelan
@srimansingaravelan 3 года назад
hi robojax my esp32 is written in d series and pin 17 16 not available please help, and i want to write code for two l29n for four motor through wifi
@robojax
@robojax 3 года назад
Hi, please watch this for WiFi ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Olq8NXgNySA.html Here is how to find Specific RU-vid Video in a channel bit.ly/findRU-vidVideo
@martijncuijpers-ww1vs
@martijncuijpers-ww1vs 5 месяцев назад
Is it possible to use 2 L298N modules to control 4 DC motors using ESP32? I tried to modify the code but i really get stuck. I want to control them by wifi. With 2 motors and you library works really good, but we always want more :) thanks in advance!
@robojax
@robojax 5 месяцев назад
Yes if you have enough pins. Just define different ping and different object name.
@martijncuijpers-ww1vs
@martijncuijpers-ww1vs 5 месяцев назад
Do you have any code for this?😇. I managed to modify the .ino file, but both .h files and the cpp file are more challeging. Maybe you have some tips how to easy modify those files? I am a beginner in programming....😂
@000ahmet
@000ahmet 2 года назад
Hi, can nodemcu drive a brushless motor without using esp?
@robojax
@robojax 2 года назад
Hi, brushless motor has three wires and needs Electronic Speed Controller or ESC. that is totally different but yes it can. you just need to feed PWM signal to ESC.
@MegaBCAD
@MegaBCAD 4 года назад
Can you do a video controlling two 200 watt motors for track steering /differential drive steering with forwards and reverse with a joy stick
@robojax
@robojax 4 года назад
So you wan to control DC motor with joystick? 200W
@MegaBCAD
@MegaBCAD 4 года назад
@@robojax yes like on an electric wheelchair
@robojax
@robojax 4 года назад
Sure I will do the video. I will put in on my list. But the motor controller is of your choice. Because there 100s of types of motor drivers.
@gauravtambe6899
@gauravtambe6899 4 года назад
Hello Sir, Will the program be same for Node Mcu Esp8266??? Liked this video but I need it for esp8266.
@robojax
@robojax 4 года назад
I did not make the video for ESP8266. Here is the video showing how to control it over WiFi. if you learn this (ESP32) video you should be able to use it with ESP8266 from this ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-gOMHU0Q8upA.html
@chimpofm
@chimpofm 4 года назад
good afternoon Sir. will your L298N code work with a TB6612FNG?
@robojax
@robojax 4 года назад
I have not tested it but it should work. In your hip PWMA is ENA in L298N is and PWMB is ENB
@kritikaprasan7591
@kritikaprasan7591 4 года назад
Sir i have lolin nodemcu module ...wat shd I give for preference and which version of nodemcu shd I install
@robojax
@robojax 4 года назад
Hi, here is the video to control motor using NodeMCU ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-gOMHU0Q8upA.html
@mewiipk
@mewiipk 4 года назад
Hello, I run your code and it says that "... Arduino/libraries/robojax_L298N-DC-Motor_library/Robojax_L298N_DC_motor.cpp:157:34: error: 'analogWrite' was not declared in this scope analogWrite(enPin, toPWM(value)); ^ exit status 1 Error compiling for board ESP32 Wrover Module." What should I do?
@robojax
@robojax 4 года назад
Hello, It means you have escaped the video and not fully watched it. Please watch and follow the instruction.
@alexandruflorea4764
@alexandruflorea4764 11 месяцев назад
@@robojax you are saying the same thing for each issue, let's be honest, you don't know. With my issue, I watched your full video 10 times and didn't solve anything. Very bad library.
@bbjodel3778
@bbjodel3778 2 года назад
Hello Ahmad how to synchronize two motors with same rpm with a L298N ?
@robojax
@robojax 2 года назад
Just use the same value for both motors immediately after one another.
@viveksharma_23
@viveksharma_23 8 месяцев назад
Can we connect 4 bo motors to motor driver plz reply ?
@robojax
@robojax 8 месяцев назад
Please watch and get the answer
@viveksharma_23
@viveksharma_23 7 месяцев назад
Watched downloaded too I am constructing a automatic firefighting robot with 4 bo motorz
@offon8781
@offon8781 4 года назад
is there a way to use this library to run the motors with rotations instead of speed?
@robojax
@robojax 4 года назад
You made me watch the video to what is wrong. this is for Speed and Direction of rotation.
@offon8781
@offon8781 4 года назад
@@robojax is there more documentation of this library, such as a list of commands?
@robojax
@robojax 4 года назад
I am replying now after 14 hours. you could just click on our channel name "Robojax" and then search for L298N . So 14 hour waiting is very long. here is ru-vid.comsearch?query=L298N
@lassemikkelsen3687
@lassemikkelsen3687 Год назад
i tryed your code but one motor is driving faster than the other one how?
@robojax
@robojax Год назад
the code is fine. you may have two different motors. if you are using it for the same project, get identical motors.
@اميرالشمزتي
@اميرالشمزتي Месяц назад
I worked on the video but a library link is not funny in the description box
@robojax
@robojax Месяц назад
The link is under the viddeo I just checked and tested the link. it says "Download code and resources for this video"
@k.v.saimadhav4251
@k.v.saimadhav4251 3 года назад
What is the external power supply you used ?
@robojax
@robojax 3 года назад
there are millions of power supply. You can use $2V module of $500. Here is one ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-tQdUfy0uyUQ.html that works directly from AC but I have tones of videos showing to get voltage from DC
@nathanbinene9306
@nathanbinene9306 2 года назад
hope to hear from you soon
@philippeantonietti
@philippeantonietti 4 года назад
thank you has worked fine with my esp32, i would just suggest some kind of schematics showing the pin connection suggestion for a new video: have you tried to do this with the "Blynk" mobile app ? I'm trying to do this as they have a nice interface with joystick thanks !!!!
@robojax
@robojax 4 года назад
You are welcome. the wiring diagram is available at my Arduino course at Udemy.com so anyone who purchase the course, gets wiring and more. I have seen 3 or 4 more people mentioned the word "blynk" and when I checked it I did not like it . They should offer some free option for limited access for students . I am search ing for other option and until then, I will not participate with this operation. they should offer free or limited device like 5 device or 5 project . Then they should charge for commercial projects.
@philippeantonietti
@philippeantonietti 4 года назад
@@robojax yes I agree that makes sense, the free option which they offer is very limited! you won't be able to get much done. Try to email they, as a digital media 'influencer' you may be able to get some extra benefits to your followers, best regards
@robojax
@robojax 4 года назад
someone should offer like 2 to 5 device full feature for free.
@thealked2674
@thealked2674 4 года назад
Hello Is there a way to control the motors via the serial port?
@robojax
@robojax 4 года назад
Hello, I've shown how to control a 360 servo in this video ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-b_xvu6wWafA.html and you can use the same method to control DC motor. But you have to understand the this DC motor .
@thealked2674
@thealked2674 4 года назад
@@robojax Thanks, it helped me I have a question if I wanted to control 4 motors, how should I configure this line of code? or what should I do?Robojax_L298N_DC_motor robot2(IN1, IN2, ENA, CHA, IN3, IN4, ENB, CHB);
@robojax
@robojax 4 года назад
watch the video carefully in the code section. I mentioned "we create object" called motor. then you create another object called motorB. So the object motor will be for motor1 and motor2 but motorB will be for motor 3 and 4. Or watch my other videos so you learn the meaning of object . See all my videos on L298N ru-vid.comsearch?query=L298N
@sssedo1573
@sssedo1573 3 года назад
Do you get a code without your library?
@robojax
@robojax 3 года назад
Please watch the section where I explained the code and do exactly as I have mentioned
@sssedo1573
@sssedo1573 3 года назад
@@robojax hmm but I wanted to make it on my own with pwm and control 2 motors. Is there any possibility maybe you look up my code and tell me what I did wrong?
@fawahziwah
@fawahziwah 3 года назад
Hello Ahmed, great video you have there! But can i ask a question. Why do i get this error whenever i tried compiling the codes? Hope u can help, thanks! no matching function for call to 'Robojax_L298N_DC_motor::Robojax_L298N_DC_motor(int, int, int, int, int, int, int, int)'
@robojax
@robojax 3 года назад
It means you did not watch the video fully and skipped. I have mentioned and shown to install library. So follow the instruction and install the library.
@fawahziwah
@fawahziwah 3 года назад
@@robojax i watched and rewatched your video for countless time. Already install the library from the zip files as u did. Did exactly the same. But still getting the same error. My friends who used this library last year also have the same problem this year, last time it was fine. Mind to tell us where we did wrong?
@alexandruflorea4764
@alexandruflorea4764 11 месяцев назад
this is top secret, I have the same issue and couldn't solve. Watched the video many times, not sure what I'm doing wrong.
@varunkarnawat3829
@varunkarnawat3829 20 дней назад
5 volts to which pin???
@robojax
@robojax 19 дней назад
to the pin shown in video. I don't remember. I have to watch to answer. so please watch carefully when I explained the moduel.
@phillipneal8194
@phillipneal8194 4 года назад
I am getting the 'analogWrite' error message. It comes from the robojax library
@robojax
@robojax 4 года назад
I have tested this many times. please post the error here
@phillipneal8194
@phillipneal8194 4 года назад
@@robojax Arduino: 1.8.10 (Mac OS X), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None" /Users/pneal/esp32/libraries/robojax_L298N-DC-Motor_library/Robojax_L298N_DC_motor.cpp: In member function 'void Robojax_L298N_DC_motor::rotate(int, int, int)': /Users/pneal/esp32/libraries/robojax_L298N-DC-Motor_library/Robojax_L298N_DC_motor.cpp:157:34: error: 'analogWrite' was not declared in this scope analogWrite(enPin, toPWM(value)); ^ Multiple libraries were found for "Robojax_L298N_DC_motor.h" Used: /Users/pneal/esp32/libraries/robojax_L298N-DC-Motor_library exit status 1 Error compiling for board ESP32 Dev Module. This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
@robojax
@robojax 4 года назад
It says "Multiple libraries were found for "Robojax_L298N_DC_motor.h" please delete the older one.
@phillipneal8194
@phillipneal8194 4 года назад
@@robojax HI ! Ok. I did as you said and now it compiles, loads and runs. Thank you very much.
@robojax
@robojax 4 года назад
You are welcome. I am glad you resolved it.
@khansarh4444
@khansarh4444 Год назад
what the controler ?? theacer ? pliss
@robojax
@robojax Год назад
What? Do you mean the microcontroller? Learn here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE---Fj8QDlGuQ.html
@zarrougahmed1949
@zarrougahmed1949 4 года назад
Can you make a video about sending messages using two ESP32 please.
@robojax
@robojax 4 года назад
sending messages from one to the other you mean? with Router or without Router?
@zarrougahmed1949
@zarrougahmed1949 4 года назад
@@robojax Without a router. Can we send it for example using the serial monitor?
@malalatianarajaomason518
@malalatianarajaomason518 4 года назад
Hi Ahmed, I tried your tutorial on my esp wroom 32. But after compiling, I got this message " Leaving, Hard resetting with RTS pin". And I'm stuck there. Do you have an idea? Thank you in advance
@robojax
@robojax 4 года назад
Start with this ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-4OOFlS75owA.html make sure you can turn ON and OFF LED. then come back to the motor.
@malalatianarajaomason518
@malalatianarajaomason518 4 года назад
@@robojax Thank you Ahmed.
@robojax
@robojax 4 года назад
You are welcome.
@highfacility9200
@highfacility9200 3 года назад
How can i install progtam to esp32 ? I need pin links pls.
@robojax
@robojax 3 года назад
which link? have you watched the video? int the first 40 seconds I said "you can get the code by clicking on the link below the video in the description". Please watch it fully without skipping, you will have no questions left. I have not wasted time. it is about learning.
@اميرالشمزتي
@اميرالشمزتي Месяц назад
Can you give me Link Download Library
@robojax
@robojax Месяц назад
The link is under the viddeo I just checked and tested the link. it says "Download code and resources for this video"
@kenadams4246
@kenadams4246 4 года назад
Thank you Ahmad for a very nice video. I am very excited to get started on this project but I'm having issues. Please help me find out what I am doing wrong. After using the Board Manager to install files for the ESP32, I downloaded the Library you provided a link to, "Robojax_ESP8266_DC_motor_speed.zip". After adding/installing the library, I closed the Arduino IDE, restarted it and found there were 2 issues: 1) After looking through File>Examples, these were no examples listed as Robojax (i.e. no Robojax ESP L298N DC Motor or anything Robojax). 2) I did go ahead and open the sketch that was in the Library file you provided. I attempted to compile it and got the error message, "Robojax_ESP_L298N_DC_motor.h: No such file or directory". Thank you in advance for pointing me in the right direction.
@robojax
@robojax 4 года назад
You are welcome. Thank you for letting me know. I had updated the library and forgot to update this page. Now you can download and try it. Thank you for not skipping the ads and keep watching it. This will help me a lot.
@kenadams4246
@kenadams4246 4 года назад
@@robojax Thanks for the updated info. I will give it a try. On a related note, based on everything I have read, I am surprised the L298N works with the ESP32. It is my understanding that the L298N requires a 5 volt signal on the logic inputs while the ESP32's output is 3.3V. Would it be more reliable to use a logic level shifter to take the 3.3V up to 5V? Just curious. Thanks again for the tutorial!
@robojax
@robojax 4 года назад
I have tested it and it works without any issue. For 3.3V and 5V logic, the LOW is up to 0.8V so this module works fine.
@kenadams4246
@kenadams4246 4 года назад
I gave the updated code a try and it works great! Thanks again Ahmad for an awesome project and video! I hope you continue to post amazing projects like this!👍👍
@viveksharma_23
@viveksharma_23 7 месяцев назад
My esp 32 has only 15 pins and your is having 20 how ?
@robojax
@robojax 7 месяцев назад
ESP32 has fixed pins. it is offered as different board. if you don't see the required pins, then get the one that has 30pin .
@polycrusAct
@polycrusAct 3 года назад
make with one servo motor and with dc motor 😺😺i'm from brazil, 🇧🇷 sp
@robojax
@robojax 3 года назад
Welcome from Brazil. Sorry I did not understand. you want to have both servo motor and dc motor? this is very unusual. I have so many servo related videos. if you watch them, you can combine both together. ***** Free Arduino Course worth $200**** Arduino Step by Step Course (over 100 lectures) Starts here robojax.com/L/?id=338
@adamelkoumy5141
@adamelkoumy5141 4 года назад
Thank you Ahmed for such a great video
@robojax
@robojax 4 года назад
You are welcome.
@ailefy9898
@ailefy9898 3 года назад
can you please make a Bluetooth car with esp32 and this L298N motor driver please, please I request you
@robojax
@robojax 3 года назад
interesting. this would be very useful. But my list is full other projects.
@ailefy9898
@ailefy9898 3 года назад
thank you for responding sir .any youtuber didn't respond to me till now except you!
@roscoe3dp470
@roscoe3dp470 3 года назад
@@ailefy9898 Esp 32 and a PS3 controller via Bluetooth
@roscoe3dp470
@roscoe3dp470 3 года назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-YhFfrJv0UDo.html
@นริศราเพียรเพ็ง
Please give me the code of ESP32.
@robojax
@robojax 3 года назад
Have you watch the video? I mentioned it in the first few minutes of the video.!
@aadc8173
@aadc8173 3 года назад
thankyu
@bbjodel3778
@bbjodel3778 2 года назад
Ok Ahmad, thank you, but i don't have a same rpm.....
@robojax
@robojax 2 года назад
You should get them same rom if enough power is supplied to the motor. Check thr motor w voltage while running and if it is too low it means your power supply can’t supply enough power (cut) power supply to the motors. Use different power supply
@phillipneal8194
@phillipneal8194 4 года назад
Thank you
@robojax
@robojax 4 года назад
you are welcome.
@bendenoooo3025
@bendenoooo3025 4 года назад
Nice
@robojax
@robojax 4 года назад
Thanks
@fusion-ux1zz
@fusion-ux1zz 4 года назад
who els think he have a sexy voice , ty for video
@robojax
@robojax 4 года назад
You are welcome.
Далее
Driving DC Motors with Microcontrollers
1:04:32
Просмотров 671 тыс.
Getting Started with ESP32 - Step-By-Step Tutorial
19:50
How DC GEAR MOTOR Works with ARDUINO and L298N
10:04
Просмотров 248 тыс.