arduino 2 wheel robot

 


 
We are going to build an Arduino Robot that can avoid obstacles.. It is a fun project and a great learning experience, so without any further delay. Lets get started As you can see. The robot that we are going to build today is moving around and it can detect obstacles and avoid them.. It uses a ultrasonic distance sensor in order to measure the distance from its front side. When it detects and obstacle it stops, goes backward for a few cms looks around and then it turns to the direction with the more space available.. As you are going to find out building this impressive little robot is extremely easy and fun.. It will not take you more than a couple of hours from start to finish.. Then you can use my code, modify it and implement your own robot behavior easily.. It is a great learning experience and great introduction to robotics for kids and adults. Lets build it. The parts needed in order to build this robot are these: The Robot Chassis Kit, An Arduino Uno, A Motor Shield, A SG90 servo, An Ultrasonic Distance Sensor, A switch Two 100nF capacitors, 1 330F capacitor or similar Some wires. The cost of the project is around 25.. You can find links for all the parts I use in the description of the video. Before attempting to build this project. I encourage you to watch these two tutorials first.. The first one is about the servo motor and the second one is about the supersonic sensor.

. You can watch these tutorials by clicking on the card here.. First, we have to build the robot chassis.. The kit contains the chassis two motors with the wheels attached a front wheel, a battery holder, some screws and wires.. We solder the thick black and red wires at the motors.. Next, we have to solder the small ceramic capacitors to the motors.. We do so in order to reduce the electrical noise that the motor produces. Since we are using ceramic capacitors, which do not have polarity just solder, one leg to each motor, connection. Repeat the procedure with the second motor and we are ready to continue.. We then attach the front wheel.. My little nephew helps me with that. As you can see., This project is great for kids. Next, we attach the rear wheels according to the instructions leaflet that comes with kit.. The next step is to attach the switch to the battery holder.. I cut the battery holder wires and I solder the red wire from the battery holder to the first pin of the switch.. The black wire from the battery holder goes to the third pin.. Now I solder a small red wire to the middle pin of the switch.. Another small black wire is then soldered to the third pin of the switch.. Our switch is ready.. I then attach it to the battery holder using hot glue.. We move on to the motor shield.. This shield provides power to the motors and the servo motor and makes our life much easier.

. The motors need a lot of current and this shield can provide up to 600mA of current to each motor thats. Why we need it.. We have to solder 4 wires to the motor shield.. These wires will be then connected with the supersonic sensor. We solder one to 5V, one to GND, one to Analog, Pin 5 and the last one to analog pin 4.. Next, we attach the motor shield to the Arduino Uno board., With a double sided tape. I attach the Arduino Uno and the Battery holder to the chassis. With a double sided tape. I also attach the supersonic sensor to the Servo motor and both of them to the robot chassis.. I could 3D print a part in order to achieve that, but since most of the viewers dont have access to a 3D printer, yet I chose this simple solution to achieve. That. We are almost ready. All we have to do is to attach the wires First. We connect the Ultrasonic sensor. Vcc goes to 5V via the wire we attached. Earlier. GND goes to the GND wire. ECHO pin goes to Analog, Pin 5 and TRIG. Pin goes to Analog, Pin 4. Next have to connect the power.. We connect the black wire from the switch to the motor shield.. It goes to the GND pin of this external power connector., The red wire from the switch, goes to the M connector.. If we open the switch, we can see that the green LED lights up.

The Arduino is receiving power from the batteries.. The next step is to connect the motors.. We connect the left motor to the M1 connector of the shield. Like this., We connect the right motor to the M3 connector of the shield, this way.. Lastly, we have to connect the servo motor.. We connect it to the SERVO2 connector of the shield.. The Brown wire is GND, the RED is Vcc and the orange is Signal. Thats it. Our robot is now ready. All we have to do is to load the code to it. The code uses three libraries.. Two of them must be downloaded in order. The program to compile. The first one is the motor shield driver from Adafruit.. The second library is the NewPing library for the supersonic distance sensor.. You can find the links for both libraries in the description of the video. We press upload and after a few seconds the robot awakes You can watch it drive, look around and avoid the obstacles.. It is a fun little robot that you build Impressive isnt it If your robot does not drive like this check, your motor connections, again., You may have inversed polarity and one motor goes forward and the other backwards.. Another problem that it might appear is with the servo motor.. If the servo motor moves randomly or stop at some times, maybe you need to add a capacitor to it.. I had such problems with my servo motor., So I added a 330F electrolytic capacitor and the problem was solved.

. The positive leg of the capacitor goes to the RED wire and negative. The short one goes to the brown wire. Lets now take a quick look at the code in order to see how it works. At first we declare some variables. In this one. We set the speed of the motors.. You can set any value up to 255.. Next, we initialize the servo motor and we set it to look straight.. In my case, this was at 115 degrees angle.. Next we read the distance a few times in order to get a valid distance measurement.. Now we go to the loop function, which executes every 40, ms. If the distance we measured is less than or equal to 15 cm, we stop the motors, we go backwards for 300ms and then we stop again.. We look right and left and we measure the distance at each direction. If the distance at one direction is greater than the other. We turn the robot, the largest distance.. If the distance from the front of the robot is greater than 15 cm, we move the robot forward. Thats, the simple algorithm I developed for this robot, so far.. As always, you can find the code of the project in a link in the description of the video.. You can easily modify the code I provide in order to modify the robot behavior.. It is very easy., As you can see, building a robot with Arduino is very easy.. By building this project, you will understand better the Arduino board and it capabilities.

. You will learn how to control motors and how to program them.. This robot is going to be the base for many more robot projects to come.. We can add an NRF24L01 module to it to wirelessly control it and get telemetry data from it.. We can add sound lights, more sensors and better batteries.. There are a ton of improvements to be made. Thats. Why? I would love to hear your opinion on this.. What kind of features do you want to add to this simple robot? Please, post your ideas in the comments section, below. Thanks. If this is your first time here, I would love to have you subscribed. In this channel, I post videos about DIY projects every Saturday.. I love making things and I believe that anyone can make things anyone can become a maker. Thats. Why I created this channel in order to share my knowledge with the community and learn from the community.. I hope you will join us. Until next Saturday Watch Learn Build Translating these subtitles.

 
 

arduino 2 wheel robot Video

 

 

 

 

 

 

arduino 2 wheel robot news

 

 

 

 

 

 

 

arduino 2 wheel robot Social

 

 

 

 

official.arduino
2019-10-02T19:32:52+0000

👋 Want to bring Tony Stark-like gesture control to your projects? Learn how with the BLE-enabled MKR WiFi 1010 and Nano 33 BLE Sense boards using the ArduinoBLE library.
safe image.php?d=AQDyi1ELcW4VGzhx&w=720&h=720&url=https%3A%2F%2Fhackster.imgix.net%2Fuploads%2Fattachments%2F997327%2Fblob dChOhNMmeF - arduino 2 wheel robot
official.arduino
2019-10-02T19:08:01+0000

Arduin-yo ho ho! A fairground favorite, the pirate ship is a fun way to explore the oscillation of a pendulum. How much fun, you ask? Access our Science Kit Physics Lab preview and see for yourself: http://bit.ly/2oC6L0Q

🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today: http://bit.ly/2MnQ7fr

70537898 550174072395145 8798850142103928832 n.jpg? nc cat=102& nc oc=AQmCfMPwMf1oPpYqFhzbxfnGdbrmsjZXrEEBy1ox5Z8EJtiYMADoFNZ5mnSNRgCCY74& nc ht=scontent - arduino 2 wheel robot

#2: Quimat Arduino Project Smart Robot Car Kit with Two-wheel Drives,UNO R3 Board,Tracking Module,Ultrasonic Sensor and Bluetooth Remote Control,More Intelligent and Educational Car for Teens and Adults

ebayastore.com photo

SISYPHUS Robot by mangtronix

mangtronix photo

2016-04-15T14:35:45



 photo

2016-04-15T14:35:40



 photo

2016-04-15T14:35:36



 photo

 

 

(Visited 40 times, 1 visits today)

About The Author

You might be interested in

Comment (22)

  1. Heyy There! Can anyone help me …My Ultrasonic sensors is not working . It cannot detect any obstacle? Plz Anyone…Its urgent

  2. I connected 9v to the motor shield but it’s not working.
    But when I give supply through serial port it works perfect .
    Why is it so???

  3. Dear, I’m looking for a smaller ultrason sensor but I cann’t find it on the internet. Please smaller then the HC04, the HC04 is to large for my project. Thanks a lot for your video’s and tips etc… Hope someone can help me with a link to look at a smaller ultrason sensor.

  4. Hi,
    Excellent video.
    Is it possible to implement the project so that the robot is autonomous and create routes through mapping through a device (laptop, tablet, smartphone….)?…. How would it be?
    Thank you

  5. i complete to upload code to aurduino but when i remove the cable from aurduino the robot doesn’t work what should i do now?

  6. Arduino: 1.8.9 (Windows 10), Board: “Arduino/Genuino Uno”

    C:\Users\HP\Documents\Arduino\sketch_aug17a\sketch_aug17a.ino: In function ‘void setup()’:

    sketch_aug17a:18:3: error: ‘distance’ was not declared in this scope

    distance = readPing();

    ^

    sketch_aug17a:18:23: error: ‘readPing’ was not declared in this scope

    distance = readPing();

    ^

    C:\Users\HP\Documents\Arduino\sketch_aug17a\sketch_aug17a.ino: In function ‘void loop()’:

    sketch_aug17a:32:5: error: ‘distance’ was not declared in this scope

    if(distance< =15) ^ sketch_aug17a:34:12: error: 'moveStop' was not declared in this scope moveStop(); ^ sketch_aug17a:36:16: error: 'moveBackward' was not declared in this scope moveBackward(); ^ sketch_aug17a:40:25: error: 'lookRight' was not declared in this scope distanceR = lookRight(); ^ sketch_aug17a:42:24: error: 'lookLeft' was not declared in this scope distanceL = lookLeft(); ^ sketch_aug17a:47:15: error: 'turnRight' was not declared in this scope turnRight(); ^ sketch_aug17a:51:14: error: 'turnLeft' was not declared in this scope turnLeft(); ^ sketch_aug17a:55:15: error: 'moveForward' was not declared in this scope moveForward(); ^ sketch_aug17a:57:4: error: 'distance' was not declared in this scope { distance = readnewping.h(); ^ sketch_aug17a:57:15: error: 'readnewping' was not declared in this scope { distance = readnewping.h(); ^ sketch_aug17a:58:1: error: expected '}' at end of input } ^ exit status 1 'distance' was not declared in this scope This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
    not working

  7. error code:

    Arduino: 1.8.10 (Windows 8.1), Board: “Arduino Uno WiFi”

    ArduinoRobot:7:10: error: AFMotor.h: No such file or directory

    #include

    ^~~~~~~~~~~

    compilation terminated.

    exit status 1
    AFMotor.h: No such file or directory

    Invalid library found in C:\Users\srinivas\Documents\Arduino\libraries\Forward_robot_motion: no headers files (.h) found in C:\Users\srinivas\Documents\Arduino\libraries\Forward_robot_motion
    Invalid library found in C:\Users\srinivas\Documents\Arduino\libraries\Forward_robot_motion: no headers files (.h) found in C:\Users\srinivas\Documents\Arduino\libraries\Forward_robot_motion

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

LEAVE YOUR COMMENT

Your email address will not be published. Required fields are marked *