SELF BALANCING ROBOT :
- Self-Balancing robot is a machine that can balance itself and adjust its posture when there is a external disturbances.
STEP 1 : INTRODUCTION
- The wheels will be accelerated in accordance with the object's tilt from vertical to stop it from falling. The center of mass of the robot will experience a pseudo force that will apply a torque in the opposite direction of the tilt if the robot is tilted by an angle in the frame of the wheels. The technological solution is that. Remember the stick-balancing game you used to play as a child if you want to understand something simply. The one where you have a stick in your hand. When the stick falls forward, you move your hand ahead, and the opposite is true. Consider the stick to be your robot, and your hands to be made of the two tyres.
STEP 2 : MATERIALS
- To build our chassis we need some pre-requisite materials. We can use acrylic sheet here. Some screws also needed according to our design.
- Bluetooth Module HC-05
- HW battery
- 300 RPM BO Motor-Straight
- L298N Motor driver
- ATmega328P 5V Nano
- MPU6050 Gyroscope and Accelerometer
- Motor clamps and screws
STEP 3 : CHASSIS
- My chassis was created utilizing acrylic sheet . But it can also be made out of plastic, wood, and other materials. If you want to build a sturdy chassis and intend to place something on it, hardwood planks would be a suitable alternative, in my opinion. Anyway, I cut the sheet into three floors or levels. Although not required, it is a beneficial habit.
- If desired, the number of tiers can be raised. After markings, screwless must be drilled. I just use a soldering iron to make holes. (Acrylic sheet saves the day here. If you are using wood, double verify your markings. After drilling holes, I discovered that I had made mistakes, which I was able to simply repair.
- Choose the tyres which have more grip and large surface area. After assembling the whole chassis now we can move for electronic parts.
STEP 4 : CONNECTIONS
Give the connections as per the below diagram.
.jpg)
STEP 5 : SOFTWARE
- The open source user libraries and hospitable coding environment that are hallmarks of Arduino make prototyping incredibly simple.
- In the beginning, I used independent accelerometers and gyros. However, as time went on, I found it increasingly challenging to balance the computing burden of calculating pitch and roll (using a Kalman/Complementary filter). When I changed to MPU-6050, the balance much improved.
- I utilized Jeff Rosberg's I2CDev library to leverage the DMP of MPU. I utilized the drawing made by Luis Rodents to calibrate the MPU.
- Now that we know the angle of the bot with respect to vertical, However, how can we determine the force required to push the robot back to vertical while it is off balance by an ambiguous number of degrees? PID becomes useful at this point. This force, which varies depending on the length of time and angle at which the bot is imbalanced, is specified by PID.
- I won't get into specifics here. A good PID library with description was written by Brett Beauregard.
- I utilized the digitalIOPerformance library for quick pin writing to speed up the motor responsiveness even further.
- Finally, use the EEPROMex library for efficiency and clean code for saving PID data in the Arduino EEPROM
STEP 6 : APP
- It is incredibly tedious to have to re-upload code each time you modify the PID settings. So I made the decision to connect Bluetooth and make changes using my Android phone. I see a lot of individuals utilizing MIT App Inventor to create apps for these uses. I've never applied it.
- I decided to give it a try as a result. I was all set after viewing a few lessons and used a few other people's programmes about Bluetooth connection.
- I have to confess that App Inventor revolutionized the process of creating applications by enabling even non-programmers to create them without having to worry about the technical details.
- Although dealing with enormous graphical blocks, even for easy tasks, in the MIT app inventor was enjoyable. Reading it was painful, and arranging these chunks was monotonous.
Click here to download the app.
STEP 7 : PID TUNING
- In all honesty, this is both the most challenging and the most important step in the procedure. You will work on it for days while screaming, "WTH am I expected to do?" Even if there is no way to avoid it, how annoying must it be? Control engineers use experience to establish the PID settings. It's a skill that requires practice. There are several techniques available for PID tuning.
The best simple & easy method for PID tuning is:
- Set P such that the robot begins to oscillate (move back and forth) around the balancing position, and set I and D term to 0. P should be large enough to allow the robot to move, but not too large to prevent jerky motion.
- Increase I when P is already adjusted so that the robot accelerates more quickly when out of balance. The robot should be able to balance itself for at least a few seconds with P and I calibrated appropriately. Finally, adjust D such that there won't be any big overshoots and the robot may move more gently about its balanced position.
- If your initial effort doesn't provide satisfactory results, reset your PID values and try again with a new value of P. Repeat the process until you discover a certain PID value that produces the desired outcomes.
To further boost PID system performance, fine tuning may be used. During fine tuning, PID values are limited to nearby values, and impacts are seen in real-world scenarios.
Significant Points :
- The determination of P, I, or D values is mostly reliant on experience because there is no defined limit. The condition of the system should affect the ID values. For instance, mechanical structure, physical characteristics, electrical characteristics (if any), etc. Practically speaking, though, it also relies on the weather. For instance, atmospheric conditions PID values and the process for choosing them are heavily influenced by the properties of the system. An approach that works well for one system might not at all apply to another system with distinct features.
What do P, I, and D values actually mean?
If a robot is self-balancing,
- The force with which the robot will correct itself is determined by P-P. A lower P demonstrates the robot's failure to maintain its equilibrium, whereas a greater P demonstrates violent conduct.
- The robot's response time for self-correcting is determined by I-I. The higher the P, the quicker the reaction.
- The robot's sensitivity to state errors is determined by D-D. It is used to reduce or smooth out robot oscillations. A greater D will produce ferocious vibrations, whereas a lower D cannot eliminate oscillations. Your PID tweaking will determine if the bot can now balance itself.
Here is the working video of our project :