Arduino Obstacle Avoiding Robot Car 2WD With AA Battery
Vložit
- čas přidán 25. 06. 2021
- Today, I will show you how to make an Arduino Obstacle Avoiding Robot With Only AA Battery.
- Full instructions:
goldscrew.blogspot.com/2021/0...
- Source code:
www.hackster.io/goldscrew/ard...
** Individual Components **
- Arduino UNO
www.banggood.com/custlink/KKm...
- L298N Motor Driver or L293D Motor Shield
www.banggood.com/custlink/GDm...
- Chassis(including motors and wheels)
- Wires
- Battery Holder
- Micro Servo Motor SG90
www.banggood.com/custlink/DGv...
- HC-SR04 Ultrasonic Sensor
www.banggood.com/custlink/33G...
- Sensor Mount (Optional)
** Tools (Optional) **
Soldering Iron
Hot Glue Gun
Wire Cutter
Screw Driver
!!! DO NOT COPY & REUP !!!
***********************************
- Website: goldscrew.blogspot.com/
- Facebook: / goldscrew-diy-10836235...
- Twitter: / screwgold
- Pinterest: / goldscrew - Věda a technologie
1st comment congrats 2021 garv mangal
super
Thanks
can i use 2A motor driver
why is the wiring so complex can you please wire it for me?
May I know what type of switch did you use? Also can the 9V battery holder with switch replace the four AA battery with a connected switch as shown in your diagram? Thank you!
It’s 12V DC switch. You can check the link to buy in the description!
And of course you can use 9v battery because Arduino Uno board supported it.
Thanks for your comments!
very good... bro..
😊
Thanks!
may i know where did u get the white wheel?
You can buy it on Amazon or Aliexpress, Banggood…
What length is your F/M jumper wires sir? Is it 10 or 30cm?
It’s 10cm
This is really
6:32 did you connect 2 cables to the same "pin" of the button ?
from a button should start only 2 cables or I'm wrong?
Yes. I’m using only 1 battery tray for all DC motors and Arduino.
You can using separate with 2 battery tray/block if you want.
Thanks for your question!
Bro from where you get that codes you write themselves or you download from somewhere
It’s my code!
Can’t I use the arudino board 5v and GND too
Check again your wiring diagram. I think it’s wrong somewhere!
Can it really run with 4 AA battery?
Why not?
You can try it ☺️
The assembled car are the demo car are not the same
what are the libraries that i need to install can you comment the link
You need 2 libraries:
1- Servo.h
github.com/arduino-libraries/Servo
2- NewPing.h
www.arduino.cc/reference/en/libraries/newping/
Where should i paste my new ping file? It keep asking my new ping file
@@Seajayyysss NewPing file is a library.
That you need is install it:
Open Arduino IDE and go to Sketch > Include Library > Add.zip library.
i keep getting message saying (no such file or directory)
Did you installing all the libraries?
my robot is making a low buzzing noise and not moving, what’s the issue?
It’s seem wrong source code or wiring not correctly!
what the coding icon bro
Source code here: goldscrew.blogspot.com/2021/07/arduino-obstacle-avoiding-robot-car-2wd.html
Why motor back forward?
It’s moving by code (arduino) and motor driver module!
i can not upload the code please help me i must make this for school
Check your main board and port again. Select correctly on Arduino IDE!
My car dosent turn it just goes back don’t know why pls help need to submit tommorow
Maybe has issue with your sensor. You can debug it (to check the distance), and adjust it!
Bro my car is moviing backward so much distance, how can i change it?
Change the source code or your sensor has problems!
i need help. both dc motors arent moving. i double checked all wires and im not sure if its properly placed or not. help me pls thanks
If your motors and wiring correct:
- Check again Drive module (it’s can be damaged)
- Charge full battery or change other new batteries
- Reupload the source code to Arduino (check carefully the Port)
Ask me anything if you have any other questions or issues!
The wiring for the in1, in2, in3, and in4 in 6:34 is incorrect. It should be adjusted by one pin slot towards the right. The video shows that the first orange wire is in enA and in4 is empty.
Bro i did not understand wireing please help me
In the video had wiring diagram already. You can print and check it!
Could u please share the code plssss bro
I’m sharing source code already.
Check it in the description. Thanks!
#include //Servo motor library. This is standard library #include //Ultrasonic sensor function library. You must install this library //our L298N control pins const int LeftMotorForward = 7; const int LeftMotorBackward = 6; const int RightMotorForward = 4; const int RightMotorBackward = 5; //sensor pins #define trig_pin A1 //analog input 1 #define echo_pin A2 //analog input 2 #define maximum_distance 250 boolean goesForward = false; int distance = 150; NewPing sonar(trig_pin, echo_pin, maximum_distance); //sensor function Servo servo_motor; //our servo name void setup(){ Serial.begin(9600); pinMode(RightMotorForward, OUTPUT); pinMode(LeftMotorForward, OUTPUT); pinMode(LeftMotorBackward, OUTPUT); pinMode(RightMotorBackward, OUTPUT); servo_motor.attach(10); //our servo pin servo_motor.write(115); delay(2000); distance = readPing(); delay(100); distance = readPing(); delay(100); distance = readPing(); delay(100); distance = readPing(); delay(100); } void loop(){ int distanceRight = 0; int distanceLeft = 0; delay(50); if (distance = distanceLeft){ turnRight(); moveStop(); } else{ turnLeft(); moveStop(); } } else{ moveForward(); } distance = readPing(); } int lookRight(){ servo_motor.write(50); delay(500); int distance = readPing(); delay(100); servo_motor.write(115); return distance; } int lookLeft(){ servo_motor.write(170); delay(500); int distance = readPing(); delay(100); servo_motor.write(115); return distance; delay(100); } int readPing(){ delay(70); int cm = sonar.ping_cm(); if (cm==0){ cm=250; } return cm; } void moveStop(){ digitalWrite(RightMotorForward, LOW); digitalWrite(LeftMotorForward, LOW); digitalWrite(RightMotorBackward, LOW); digitalWrite(LeftMotorBackward, LOW); } void moveForward(){ if(!goesForward){ Serial.println("==moveForward=="); goesForward=true; digitalWrite(LeftMotorForward, HIGH); digitalWrite(RightMotorForward, HIGH); digitalWrite(LeftMotorBackward, LOW); digitalWrite(RightMotorBackward, LOW); } } void moveBackward(){ goesForward=false; Serial.println("==moveBackward=="); digitalWrite(LeftMotorBackward, HIGH); digitalWrite(RightMotorBackward, HIGH); digitalWrite(LeftMotorForward, LOW); digitalWrite(RightMotorForward, LOW); } void turnRight(){ Serial.println("==turnRight=="); digitalWrite(LeftMotorForward, HIGH); digitalWrite(RightMotorBackward, HIGH); digitalWrite(LeftMotorBackward, LOW); digitalWrite(RightMotorForward, LOW); delay(500); digitalWrite(LeftMotorForward, HIGH); digitalWrite(RightMotorForward, HIGH); digitalWrite(LeftMotorBackward, LOW); digitalWrite(RightMotorBackward, LOW); } void turnLeft(){ Serial.println("==turnLeft=="); digitalWrite(LeftMotorBackward, HIGH); digitalWrite(RightMotorForward, HIGH); digitalWrite(LeftMotorForward, LOW); digitalWrite(RightMotorBackward, LOW); delay(500); digitalWrite(LeftMotorForward, HIGH); digitalWrite(RightMotorForward, HIGH); digitalWrite(LeftMotorBackward, LOW); digitalWrite(RightMotorBackward, LOW); }
CAN I USE 9 VOLT BATTERY ?
Yes. Arduino mega board supported 9v
CODE
I'm attached full source code in the description, so check it there!
I can not upload code please help me I must make this for school. Help me Bro!
Check again your settings: select correct the Port and Board name in arduino IDE.
If everything fine, I think you can upload code without any issues/bugs.
I am not use laptop use mobile but mobile in not option make a video for making codeing in Mobile . plzz Bro
If you’re using mobile phone to upload code!
Could you try other OTG usb?
Right now you can try again following this guide (not mine): create.arduino.cc/projecthub/Vishalsoniindia/arduino-programming-via-mobile-arduinodroid-57a62f
I will make other video guide how to upload with mobile soon asap!
Good luck 👍
le code est une plaie et défaut un peu partout....!
Tumhary chkr me pura setup bna lia ab ni chla ...k tumhara demo b fake he...assempled gari or thi
is this legit?
What’s you mean?