Powered by Arduino UNO and balanced by ultrasonic sensor.. It can balance itself vertically. Let us see how its made, how it works. This is the CAD design of the wheeled self balancing robot.. Here we can see two motors connected with two wheels.. These motors are mounted in the P V C T joint. a vertical PVC pipe is attached to T joint.. An ultrasonic sensor is attached to the pipe., Pointing downwards.. Now lets make this robot as per the CAD design., We will be using two geared dc motors to power. This robot. Hey where r? U going stop here. Now we will attach wheels to the shafts of the motors.. This is a T joint for PVC pipe.. We will be using it to hold the motors. Like this.. The wires will come out from the top hole. Before fixing the motor in this pipe. We have to wire them.. We will be passing 4 wires from the top hole. Splitting at two ends: 2 wires for each motor.. Now we will be connecting these wires to the motors.. The red wire gets connected to the red marked terminal., And the black wire goes to the white marked terminal.. The same procedure needs to be followed for the second motor.. Both the motors are wired and ready.. We will pull the wire from T joint back so that the motors will be in their place.. Now we have fixed the motor in the T joint.. They are secured.

Nice tight., We have added some pipes at the wire end of the T. Joint. We will mount the sensor on it. Later. Here is the Circuit Schematic.. We have used L2938 H, bridge motor driver IC to rotate motors in both directions.. According to these schematics, we will connect all the components., but We will connect the sensor later.. Now we will test it. left forward right, reverse. Right forward, left reverse., Both forward both reverse.. Now we can also play it as an RC car.. We are controlling it through. The computer commands are sent serially to the microcontroller.. The concept for this self balancing robot is simple.. Here we have an ultrasonic sensor., Which measures its distance from the obstacle in front of it.. If the distance is greater than the fixed distance, then the robot will move forward, and if the distance is less, then the robot will move reverse. to compensate for its fall. Now its time to connect the ultrasonic sensor., Which will help it to keep balanced. The ultrasonic Sensor has 4 pins, which are trigger echo power and ground.. 4 wires are connected from the pins to the microcontroller.. We have written the logic in the code and uploaded it to the microcontroller.. So what it does is moves the robot forward. If the distance is greater than a fixed value, which means the robot is falling forward, so move forward to keep it balanced. vice versa.. Now the robot is placed vertically on the ground.

And it seems like it is balanced.. It is moving continuously to keep itself balanced., But it is also getting some support from the wires which I am holding in my hand.. It is oscillating back forth continuously.. These oscillations need to be damped., So the robot will be balanced and stand at a point without any movement., But we havent used PID control.. We have just said to move back if falling back. And move forward if falling forward.. If it falls beyond a particular point, then it wont be able to recover itself.. These motors require a lot more power to be fast and responsive. And while testing the second H bridge of the L, 2 9 3 D got fried.. So I didnt get the chance to control it via PID. To truly make it balanced.. We could have used the MPU 6050 Inertial measurement unit.. Instead, we used this cheap, ultrasonic sensor., But somehow we managed to make it balanced a little bit..

https://www.youtube.com/watch?v=emMIrdz4tCY