Elegoo Smart Robot Car Part 3 - Collision Avoidance & Line Following

Поделиться
HTML-код
  • Опубликовано: 6 июл 2024
  • In the third and final installment of my series on the Elegoo Smart Robot Car, I will show you how to use the Collision Avoidance and Line Tracking capabilities of this Arduino-based robot car kit.
    Smart Robot Car Kit from Elegoo - www.elegoo.com/product/arduin...
    Full article at dronebotworkshop.com/elegoo-r...
    More articles and tutorials: dronebotworkshop.com
    Join the conversation on the forum: forum.dronebotworkshop.com
    Subscribe to the newsletter and stay in touch:dronebotworkshop.com/subscribe/
    You don’t need to own the Elegoo car to perform these experiments as they will work with any Arduino-based design that uses the same components. Nonetheless, the Elegoo car is a very good buy and makes an excellent kit for both beginners and experienced Arduino enthusiasts.
    The robot car uses both an HC-SR04 ultrasonic distance sensor and an SG90 servo motor to perform obstacle avoidance. The sensor is mounted on the servo motor shaft and scans the room to determine which of three directions has the longest path to an obstacle. It then moves the car in that direction.
    The line tracking (or line following) capabilities make use of a sensor mounted underneath the robot car. The sensor consists of three optical source/sensor arrays that can detect the presence or absence of a black line. Elegoo even provides a roll of black electrical tape for you to create a lined track, which I demonstrate in this video.
    I’ll go over the sketches used to make all the magic happen, including a few changes I made to customize my robot car, you may want to make similar modifications.
    Here is the table of contents for this video:
    00:00 - Introduction
    02:30 - Collision Avoidance Operation
    04:39 - Servo Test
    08:17 - Collision Avoidance Sketch
    17:27 - Collision Avoidance Demo
    19:05 - Line Following Operation
    23:28 - Line Following Sketch
    If you missed the other two parts of this video series you can find them here:
    Part 1 - Building the Smart Robot Car - • Building the Elegoo Sm...
    Part 2 - Bluetooth and Infrared Remote Controls - • Bluetooth & IR Remote ...
    As always you will find a detailed article that accompanies this video on the DroneBot Workshop website. And while you are there make sure to sign up for my newsletter.
  • ХоббиХобби

Комментарии • 77

  • @tinkmarshino
    @tinkmarshino 5 лет назад +1

    Bill, I followed all three of you robot videos and have decided that this is the project that my grandson and I will do when he comes for a visit this summer.. Your videos are concise, clear and will be easy for him to follow I think it will be a big hit for him and maybe point him in the direction of electronics and/or programming.. thanks you.

  • @bobday573
    @bobday573 3 года назад

    Many thanks for your excellent tutorial I purchased the car November 2017 assembled it and gave up on programming dug it out last month after running across your video and now all up and running thanks to your great teaching shills.

  • @PhG1961
    @PhG1961 5 лет назад +6

    Excellent work. Very well presented in a relaxing way, with detailed information. That's how we like it !

  • @robertbess5601
    @robertbess5601 4 года назад +6

    Bill, you are amazing and awesome. Watched several of your videos and am truly impressed with your ability to present. But, I cannot even begin to imagine the time you spend on preparing these videos.The amount of time you spend on graphics, written materials and sketches is truly remarkable. Keep up the outstanding work, it has to be rewarding considering all the accolades you receive. Justly deserved. Thank you-your have a devoted follower. Bob

    • @Happymz
      @Happymz 3 года назад

      Robert Bess yess

  • @iankesbey1487
    @iankesbey1487 5 лет назад +1

    great series of videos...purchased this Smart Robot...assembled and running in just a couple of hours....thx for the instructions

  • @JabezVidz
    @JabezVidz 4 года назад +1

    Fantastic in-depth series. Great job all around! Really appreciate the detail of instruction.

  • @renevandorp
    @renevandorp 5 лет назад +1

    I like youre video's, you put a lot of work in it. Thanks from The Netherlands.

  • @TheFleetz
    @TheFleetz 5 лет назад +1

    Brilliant, very informative and helpful! 👍👍👍

  • @duARTstudioChannel
    @duARTstudioChannel 3 года назад +1

    Thank you very much to share this precious information! Keep going with this great working, thank you again.

  • @Usq7213
    @Usq7213 5 лет назад +3

    You are awesome as always and thank for sharing really useful knowledge!:))

  • @DanMcAfee
    @DanMcAfee 5 лет назад

    Great series!
    And it was a laugh to see you having fun with it and joking.
    Thanks

  • @robertarmstrong3478
    @robertarmstrong3478 5 лет назад +3

    Good videos; bought the car. Made some code mods;
    The pivot turn used needs a higher speed to work on carpet. Lots of friction, initially just stalled out trying to turn, so added two different motor speed, one for moving forward and back and one for turns.
    Didn't like the pivot turn for remote control, so added a radius turn. Both sides motors run forward, outer faster than inner. Differential controls the radius. Swap motor speeds for left turn or right.
    Also found that initial collision avoidance distance was too short, adjusted out. Also different speed settings for forward/back and turns.
    Future mods;
    Collision avoidance, raise speed if long clear distance, reduce as shortens to stop.
    The ultrasound does not seem to get a correct distance from an angled surface. It seems to run into any wall that is at 45 degrees (about) to the direction of travel. Need a strategy to solve this problem (if possible). Possibly a 'stalled' detection.
    Want to incorporate both the radius turn and the pivot into the IR or bluetooth functions.
    Want to add a compass sensor and 'turn to north/south/east/west' options. Have a '3 axis magnetometer' on breadboard functioning to give a heading reading.

  • @hogfanboy9443
    @hogfanboy9443 5 лет назад +2

    Thanks for the videos. When you show the code for the line following section, I'm a little confused when the pinmode is defined for the sensors. It seems like you are using the !digital read for the value of the pin in the pinmode command. or did I just miss something. Thanks again for the videos.

  • @johnmarshall2660
    @johnmarshall2660 2 года назад

    Hi Bill, great video and I know its a few years old but, I got a Robot car about 4 years ago and never finished it, after watching your video it gave me the Opportunity to finish but the Motor driver and Uno shield are different but no problem got a similar motor driver board on ebay and the Uno shield I designed the shield and will get made at JLCPCB, so something to do later in year ...John

  • @vincentsamuel2779
    @vincentsamuel2779 Год назад

    Great review

  • @cathyc8989
    @cathyc8989 4 года назад

    Love your videos

  • @charlesarnold4963
    @charlesarnold4963 5 лет назад

    I really like your presentation and especially this series on the Elegoo car. The line following experiment was extremely interesting as well as being highly educational. Have you done any experiments on wire following, where the wire is excited by a sin wave signal and the car follows it? This would be useful in an environment where the ground is likely to become dirty and the black line is impractical.

  • @nixo0077
    @nixo0077 2 года назад

    Perfect work,

  • @sumedhburbure4173
    @sumedhburbure4173 5 лет назад

    Great video

  • @lithiumwarhead
    @lithiumwarhead 4 года назад

    You have a cool show.

  • @tristanrichardson9349
    @tristanrichardson9349 3 года назад

    thanks very helpful

  • @davidcourtney1398
    @davidcourtney1398 4 года назад +2

    While line following, if you put a box on the line, will it avoid it? It seems like it's doing collision avoidance OR line following, but not both. Or am I mistaken?

  • @electronic7979
    @electronic7979 5 лет назад

    Good project

  • @viopklji100
    @viopklji100 4 года назад

    hi do u have any video similar to this but instead of line following, using wheel encoder to reach from point A to B. or other method as long it does the work.

  • @mkk5414
    @mkk5414 5 лет назад

    Nice video

  • @linus561
    @linus561 5 лет назад

    Thanks

  • @IngenieriaConfeccion
    @IngenieriaConfeccion 3 года назад

    Hello, thank you for your great video. May I ask something. I want to use this car for a contest. The track has a lot 90 degrees turns, but the car doesn't turns enought and go out of the track. The code doesn't have a program when the car goes out of the track. Do you know how to improve the car for 90 degrees turns?

  • @thelastlannister9312
    @thelastlannister9312 3 года назад

    No sir. I thank you for this wonderfull video

  • @baxter6504
    @baxter6504 2 года назад

    Hi, Bill;
    Does the robot car work better with PVC tape (which ships with the car) or with vinyl tape? Which would you recommend?
    Great explanation of the Smart Robot. Keep up the good work!

  • @opalprestonshirley1700
    @opalprestonshirley1700 4 года назад +1

    This has been a great project. A great job. My only problem is the Micro Servo 99 is I can't get a 180 degrees arc my best has been 15 -> 165 . When my kit comes in hopefully the servo will work better than the ones I've purchased. Thanks for a great presentation.

    • @user-um3ui1gu9t
      @user-um3ui1gu9t 3 года назад

      Some servos (most of the cheap servos...) turn only ~160°, not 180° !
      That's the reason why in the example they used 20 to 180°

  • @liszcgsedt
    @liszcgsedt 3 года назад

    Nice tut ... but are you powering the servo from Arduiono? I assume it is a matter of currect pull, but I consider it somewhat risky - in some cases it has worked for me, but I have also burned a nano in this way (well, with two servos, no load, just random movements, but anyway)...

  • @fidgetspinner1403
    @fidgetspinner1403 5 лет назад +1

    Yet another great vid. Keep up the great work . I would love to see you build one using a lidar.

  • @georgeak4454
    @georgeak4454 2 года назад

    very cool. Can you do maze solver with this car??

  • @vjoh1014
    @vjoh1014 Год назад

    Greetings, i enjoy your videos, I have question. I recently purchased smart car 4.I cant get this thing moving. Im having a problem with the pins going to the driver motor .Its the drv 8835 i tried 567 and 8 to no avail. I atually tried pn 3 and it work but unprdictable. If you could stir me in the right direction Thanks keep up the goood work

  • @malinmalindic8582
    @malinmalindic8582 4 года назад

    What is rightDistance is equal leftDistance?
    So, in my opinion, after checking which distance is greater (or less) we should simple add else (which means they are equal) and in that block add commands back and delay, and checking if they are less or equal 20 should be separated if condition, but that only my opinion.
    Great video, thanks a lot.

  • @user-xv7xc9nl6y
    @user-xv7xc9nl6y 6 месяцев назад

    What Servo library should i download?

  • @ayyubshaffy3612
    @ayyubshaffy3612 4 года назад

    nice video .... :)
    please can you make a video on controlling a robot arm like this one: SainSmart 6-Axis Desktop Robotic Arm & Grippers, Assembled for Arduino UNO MEGA2560
    as a begginer i really enjoy watching your videos!!

  • @CrispierTerror
    @CrispierTerror 5 лет назад

    Could you make a change in the speed of the car when approaching an object?

    • @jimstand
      @jimstand 3 года назад

      Sure you can, as the distance gets closer, pass a smaller value to the forward() function to reduce the speed.

  • @Jos69119
    @Jos69119 5 лет назад

    Hi, did anyone know how to set a car to follow a blue line??

  • @MatiasPoisson
    @MatiasPoisson 4 года назад +1

    Great set of videos!
    I purchased this kit for my son, we built it together but we were unable to make collision avoidance work as expected. I'm having the same problem described in comments. Apparently the ultrasonic works fine with flat surfaces, but not so much with irregular ones. While I debug the code with serial console the sketch works fine, but once in the floor the car doesn't seem to follow the right pattern.
    I noticed also that the following portion of code is "almost" never executed. It only works when right and left distances are equals and less than 20cm.
    else if((rightDistance

    • @kanhaiyaupreti6702
      @kanhaiyaupreti6702 4 года назад +1

      Use && as both needs to be true in order for the robot to turn back.

  • @USMCRet1993
    @USMCRet1993 5 лет назад +2

    hi Bill. How in the world did you manage the ultra small screws and nuts in mounting the ultrasonic sensor???? I've been trying for days...... and can't get it put together.

    • @brickyrobot8932
      @brickyrobot8932 5 лет назад

      I used the ultra small screwdrivers that came with the robot. It was pretty tough even with those though.

    • @toddboni9313
      @toddboni9313 4 года назад

      I used a small piece of tape on the nut and tweezers to start the screw

  • @davidguiu5072
    @davidguiu5072 5 лет назад +1

    Hi Bill,
    I am working on a project and I was wondering if you could help me.
    I got this Elegoo Smart Robot Car and a Pixy2. My goal, is to make the robot track objects and lines just like Pixy2 does , the problem is, that I don't know how to make Pixy2 interact with the DC motors.
    So if you have any clue, on how to work this out please let me know, thanks.

    • @Marva123
      @Marva123 5 лет назад +1

      Pixy2 has a tracked chassis from a company called Pololu if you buy the tank-chassis assembled all you have to do is mount the pixy2 camera and you can follow lines and objects like the Elegoo car. I have built both projects and they both work great at this task.

  • @santhoshkannan9844
    @santhoshkannan9844 5 лет назад +2

    Did u ever integrate all 5 tutorial into a single program and made it work?

    • @JabezVidz
      @JabezVidz 4 года назад

      I plan to do this very thing

  • @guywhoknows
    @guywhoknows 3 года назад +1

    I thought you were going to fix the bad coding settings on avoidance.
    The stop and run after time is way way to high.
    This is why it crashes after stoping and turning.
    The servo turn, being 90 o and motor turn is not the same, it's about 45 o.
    If the case is,. Then a additional scan is required at 22 o
    As the scan time is set in 20ns, why there is a 1s wait I don't know,the most would. Be double the regent.
    Also we should ping and turn code. And I believe there is a mapping sketch?
    Hopefully so it learns the area.. it only needs to plot.

  • @chandrashekara5564
    @chandrashekara5564 2 года назад

    sir ,Iwant to use line following robot using Arduino. In my company to carry 30 kg of weight . which driver and which DC motor you suggest. kindly help me.

  • @andykauffman7466
    @andykauffman7466 5 лет назад

    Another great video, thanks!
    During the collision-avoidance clip, the robot drove directly into a wall at one point. I have the same thing happen with a car I built using the same ultrasonic sensor. The sensor is seeing distances outside the stopping distance, so the car thinks it can go forward. This is probably due to the angle between the wall and the receiving part of the sensor.
    My question though, is how to avoid this? I can increase the distance to stop, but too far and the robot will stay in the center of a room. Do we just need to expect some collisions? Thanks!

    • @andykauffman7466
      @andykauffman7466 5 лет назад

      @@chris0tube Possibly, but wouldn't the car be hitting stuff all the time, then?

    • @andykauffman7466
      @andykauffman7466 5 лет назад

      @@chris0tube That sounds like a great idea. I'm working on other things with my car, but will circle back.

    • @andykauffman7466
      @andykauffman7466 5 лет назад

      @@chris0tube Thanks, Happy New Year!

    • @keithschaub8570
      @keithschaub8570 5 лет назад +1

      u-sensor works really well with flat surfaces, but not so well with corners. You can also get negative distances as well as 2000+ distances..so you need to add more logic to deal with the variations and extremes you can get. Few things you can do: 1. only do something if the value is > 10 2. If the value is > 80, then set it to 80..basically u r telling the sensor to ignore anything far away...lastly...average several readings together after u do steps 1 and 2.
      facebook.com/keith.schaub.5/videos/10216652344993348/?l=9174098805765710842
      facebook.com/keith.schaub.5/videos/10216597922712825/?l=1995439918924746601

    • @keithschaub8570
      @keithschaub8570 5 лет назад +1

      in a nutshell, keep the USB connected and print out all the values in serial monitor while you manually move the car around - pay close attention to the values and think why might you be getting strange values and how to deal with them.

  • @streetvendour1287
    @streetvendour1287 Год назад

    Sorry but can anyone can tell me if i want to use ir control mode at the same time with line tracker mode without using mobile app to switch between the two modes

  • @nicholasyeetusanddeletus9398
    @nicholasyeetusanddeletus9398 3 года назад

    For some reason mine doesn't have that blue thing at 23:21

  • @shelbytrudeau3730
    @shelbytrudeau3730 2 года назад

    why is mine not driving but lighting up when i try and move

  • @alexbulavin543
    @alexbulavin543 2 года назад

    🔥👍👍👍

  • @capistor1
    @capistor1 4 года назад

    im not sure if anybody spotted this before but you said "if right distance AND left distance are less than zero then it will go back" but in reality that was a logical OR sign and not an AND...

  • @tu2gs
    @tu2gs Год назад

    What is the program name

  • @nikhilkatakwar7852
    @nikhilkatakwar7852 Год назад

    Price of one

  • @number9103
    @number9103 5 лет назад +1

    Nice,but please, smile and be Happy more!!!

  • @user-um3ui1gu9t
    @user-um3ui1gu9t 3 года назад

    Setup code is wrong : pinMode(LT_X,INPUT) only set pin 0 or 1 as input... useless !
    The code works because by default all pins are inputs !

  • @benl686
    @benl686 3 года назад

    uhhhh i may have made a mistake im the 666th liker

  • @rdoetjes
    @rdoetjes 4 года назад

    That code Elgoo provided is terrible! All does 500ms and 1s waits block processing.
    You should avoid blocking. And it’s simple just read time and see if 500ms has passed since your last measure meant. If not don’t execute, if it has execute.
    I see too much of this badly written code in arduino world. I don’t know where it comes from.

  • @manuelddiaz
    @manuelddiaz Год назад

    I install the program "Obstacle_Avoidance_Car" in the car, but the wheels on the right side don't move, only the wheels on the left side move, and both the distance meter and the servo work fine. After testing for several days trying to identify the cause, I found that if I delete the instruction "myservo.attach(3);" in the program, all the wheels and the distance meter work fine, but logically the servo is disconnected.
    Could anyone help me. I would like to know why this happens with that instruction? I want the program to work completely.
    I couldn't.