Home > Control Circuits >Ultrasonic Remote Control Circuits > How to make a wheeled self-balancing robot using ultrasonic sensors

How to make a wheeled self-balancing robot using ultrasonic sensors

Source: InternetPublisher:风向西瓜 Keywords: Robot Ultrasonic Sensor Arduino Updated: 2024/12/17

    This is a wheeled self-balancing robot. Powered by Arduino UNO and balanced by ultrasonic sensors, it is able to maintain vertical balance by itself.

    Power Source

pYYBAGKN88mAT1mQAAF7ZIQsJKc546.png

    Power is provided to the robot by two geared DC motors.

    Build

    Step 1: Connect the Geared DC Motor

poYBAGKN88WAKAXhAAOwC1pM9xc887.png

poYBAGKN876AXUWsAAHjegLeVK4433.png

    Now we connect the wheel to the shaft of the motor.

    Step 2: Prepare the PVC T-Joint

pYYBAGKN87iAdO66AAIV6grSyxI432.png

    This is the T-joint for the PVC pipe. We will use this to hold the motor in place and the wires will come out of the hole at the top.

    Step 3: Wire the motor via the T-connector

pYYBAGKN87SAB7XcAAIHizRH1pw517.png

    Before we can secure the motors in this pipe, we have to wire them up. We will be running 4 wires through the top hole. Split at both ends, 2 wires per motor.

    Step 4: Pull the wire through the top hole

poYBAGKN87CAdeOyAAJ7VvaQX6I238.png

    We will pull the wires back from the T-junction so the motor can be in place.

    Step 5: Secure the Motor in Place

pYYBAGKN86yAIbv_AAKX1i36ml0280.png

    Now we have the motor secured in the T-joint.

    Step 6: Add Pipe in Top Hole to Mount Ultrasonic Sensor

poYBAGKN86iATzxpAAGjehDN3eo751.png

    We added some tubing to the line end of the T-junction, which we will mount the sensor to later.

Circuit Schematic

pYYBAGKN86OAOoFtAAGpOv31_HY385.png

    Circuit Schematic We use L2938 H-bridge motor driver IC to rotate the motor in both directions.

    Concept of a self-balancing robot

poYBAGKN85-Afs6ZAAH2WoFtwP8187.png

    The concept of this self balancing robot is simple. We have an ultrasonic sensor which is able to measure the distance between the robot and the obstacle in front of it.

    If the distance is greater than the fixed distance, the robot will move forward; if the distance is less than the fixed distance, the robot will move backward to avoid falling.

    Interfacing Ultrasonic Sensor for Self-Balancing Robot using Arduino

pYYBAGKN8ziAJwXEAAKkiNqscb4600.png

    The ultrasonic sensor has 4 pins, namely trigger, echo, power and ground. 4 wires are connected from the pins to the microcontroller.

    Balancing robot body

pYYBAGKN8zOAEB2tAAMRIdi-Gd8211.png

    Now, the robot is placed vertically on the ground. It looks like it is balanced because it is constantly moving to keep itself balanced. But at the same time, it is actually getting some support from the wire I am holding in my hand.

    It keeps oscillating back and forth and these oscillations need to be damped. So the robot will remain balanced and stand on one point without any movement.

    Possible problems and solutions

poYBAGKN8y-ACkNMAALJxF1NGUU343.png

    If it goes beyond a certain point then it will not be able to recover on its own. These motors require more power to respond quickly.

    While testing, the second H-bridge of the L293D got fried. So, I had no chance to control it via PID.

    To actually balance it, we could use an MPU-6050 Inertial Measurement Unit. Instead, we used this cheap ultrasonic sensor.

    CAD Design of Self-Balancing Robot

poYBAGKN8yqAAomJAAEhfSGk01c716.png

    This is the CAD design of a wheeled self-balancing robot. Here we can see two motors, connected to the two wheels. These motors are mounted in a PVC T-joint. A vertical PVC pipe is connected to the T-joint and an ultrasonic sensor is attached to the pipe.

    in conclusion

    Fortunately, at the end of the project, we managed to balance it a little bit. I am quite satisfied with the result, and all the efforts were worthwhile.

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号