DIY Arduino Based Self Balancing Robot

Hello, friends, in this post I’ll show how you can build your own Arduino Based Self-balancing robot.

To Build This arduino Project I am using Arduino nano, MPU6050, A4988 driver, HC-05 bt module, and MDF board, detail material list you can found further in this post.

I will also provide you provide you self-balancing robot code, Circuit Diagram and Application. Balancingwii firmware and EZ-GUI android app is used in this project to control Robot via Bluetooth connection.

Video

https://youtu.be/DlsZUFGkmaQ

Principle of self-balancing robot

Self Balancing Robot Is The Robot which balances itself on only two wheels, by moving forward and backward.
A gyro sensor is used to measure the orientation data of the robot and send it to the controller. According to the orientation data, the controller commands the motor to move forward and backward to make the robot up straight.

Self Balancing Robot Ideal Position

As you can see in the image the robot is in his up straight position and the angle between y-axis and body is zero.this is the ideal position of the robot

Self Balancing Robot Moving Backward

when the robot is tilted in the backward direction, the Gyro sensor[MPU6050] detects the angle between y-axis and Robot and sends this data to the Arduino board.
Arduino do PID calculation and command the stepper motor to move in the backward direction, until zero angle between y-axis and robot.

Self Balancing Robot Moving Forward

Similarly, When The Robot Is Tilted In The Forward Direction, The Gyro Sensor[MPU6050] Detects The Angle Between Y-Axis And Robot And Sends This Data To The Arduino Board.
Arduino Do PID Calculation And Command The Stepper Motor To Move In Forward Direction, Until Zero Angle Between Y-Axis And Robot.

For Any Query, You Can Contact Me.

Components Required

Self Balancing Robot Circuit Diagram

Self Balancing Robot Circuit Diagram

Robot Dimensions

Self Balancing Robot Dimension's

Robot Construction

First Of all, I cut the 5mm Thick MDF Board. Dimensions Are Showed in the above image.

Self Balancing Robot leg

Then I assembled both the legs with the help of M3 Nut and bolt. I also fixed the shock absorber in it.

Self Balancing Robot head

Now, I Assembled Robot head with the help of fevicol and super glue.

Self Balancing Robot

After that, I fixed both the lag with Robot head with the help of M3 Nut and bolt.

Self Balancing Robot fixing stepper motor

then I fixed the stepper motor on both the legs of the robot with the help of small screws.

Self Balancing Robot fixed stepper motor

Robot Construction Has Been Done, So let’s Ahead to the electronics work.

Self Balancing Robot pcb

First, I cut 150mm x 60mm Zero PCB, Then I fix female and male header pins according to the components.

Self Balancing Robot fixing components on pcb

Then I Plug In All The Components On The Headers Of The Zero PCB And Soldered Together According To The Diagram.

Self Balancing Robot pcb

After that, I Fixed The PCB On The Robot With The Help Of Hot Glue.

Self Balancing Robot fixing stepper motor cable

Then I plugin Nema 17 Stepper Motor wire in male header pins of the zero PCB.

DIY Self Balancing Robot

Finally, The Construction part has been done So let’s ahead to the programming part.

Programming

Self Balancing Robot connect to pc

First of all, unplug the Bluetooth module and Connect the Arduino to the pc.

Before Start Programming Download the self-balancing Robot firmware called Balancingwii.

You can use this firmware for multiple projects like quad-copter and multi-rotor flying drones. This firmware is developed Mahowik So a Big Thanks To Mahowik .

Self Balancing Robot

You will get the downloaded file in zip format. Now Unzip the downloaded file, open the newly created folder and delete these three highlighted files as shown in the image.

Remember that The name of the folder which contain balancingwii.ino file both must be same.

Self Balancing Robot

Now open Balancingwii.Ino file in Arduino ide then go to right side corner and click on config.h as shown in the image.

Self Balancing Robot code
Self Balancing Robot code

Now select Port as Arduino nano and select the latest com in Arduino ide. Finally, it’s the time to upload the code, click on the upload button to upload the code.

After successful upload disconnect robot from PC and plug the bt module again.

Robot Setup

Application

We will use EZ-GUI AppApplication to control our robot. Click here to know more about EZ-GUI. You can download this application directly from the play store or you can also click on below button.

Now open EZ-GUI App and click on three dot at top right corner, and click on setting.

then click on bt devices to select your Bluetooth module.

Now click on next and select “Multiwii 2.40” firmware m the list and click next next until you reach home screen.

Self Balancing Robot bt setup
Home Screen

Now click on the connect button to connect with your Robo.

Self Balancing Robot application setup

Click on “AUX”.

Self Balancing Robot application setup

Tick mark the boxes as shown in the above image and click on red upload button.

Self Balancing Robot application setup

Now go back and click on “PID” Button and copy the above PID value. I dont know above PID value will work for you or not because they differ from model to model. You can try different settings.

Self Balancing Robot application setup

Now go back to home screen and click on “calibration” and then click on “ACC calibration” but before that place the robot on the plane surface.

Self Balancing Robot application setup

Now go back to the home screen and click on three dots at the top right corner and click on “advance” and then click on “Untested” and then finally click on “Model control”.

And this is the screen to play with the robot, you can run the robot in any direction that you want. It also has position hold mode which holds the position of the robot.

To better understand the setup of the robot you can also watch the video.

I Hope You Enjoyed The Post. If You Like This Post Or You Have Any Doubt Let Me Know In The Comment Section. To Connected With Us, You Can Also Subscribe Our Channel.

Leave a Reply

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