Hi guys, in this video I will show you how I build this balancing robot,
considering that this is my first robot ever, building it was not easy,
especially because I was not following any instruction.
The idea appeared after watching some YouTube videos.
After some research, I decided that I want to build the robot using stepper motors
because they have some key advantages.
Next what I had to choose is the brain of the robot, so to speak,
a device where the software will run.
Of course, here I thought about ESP8266 and ESP32 boards
because I previously had some experience with them,
they are powerful and cheap and can be programmed just like an Arduino.
And also they have WI-FI, which can potentially be used for control.
Writing the code for the robot from scratch is hard,
so I started to look at what people have done already.
So after some search, I found an interesting video about robots based on ESP32,
but the awesome part is, this guy made code available for everyone.
He deserves at least a million views, but YouTube is unfair.
I’ll give a link to his video in the description.
So after not much thinking I bought pretty cheap stepper motors,
it says 12V and my thoughts were “I am going to power my robot with 12V,
so that is probably what I need”…
later I will find out that I was wrong, but that will be later.
Next what I did is I went to a local hardware store to see what I can find for my robot.
That is where I found laminate floor covering, and threaded rods.
There are simply ware no other options.
After some time, components started to arrive from Aliexpress,
so I started to build the robot.
I cut laminate floor covering in chunks that seem ok in size and started building a frame.
All this took quite some time, so I am going to speed up the video.
Sizes and materials are up to you, this is a DIY project after all.
In a perfect world this all, of course, is not arbitrary and probably should be calculated
and then tested, but in reality, I don’t have the necessary
knowledge and experience, and also I limited in time and money.
So, in this video, I want to share my experience including my mistakes.
The next step is the electronics.
I decided to build the robot on two boards, the first board will have stepper motor drivers,
and the second board will have ESP32, MPU6050, dc-dc converter, and other stuff.
My first goal is to make sure that this board with drivers works as expected.
Btw here is the schematic.
It may look like I assemble the robot according to the schematic, but that is not true,
in fact, I draw the schematic only after I started editing this video.
How do I know how to connect everything?
Well, I just googled DVR8825, this is the name of the stepper motors drivers;
Google showed me a bunch of circuits.
Also, I previously did a couple of tests to make sure that those circuits actually work,
so I have all the necessary knowledge before soldering.
Additionally, on this board, I installed LEDs that connected to control pins of the stepper
motor drivers.
These LEDs will visually help me to understand what is going on.
So after soldering was done I drilled holes and fixed the board using screws.
Then I installed wheels.
The next step, I installed ESP32 on the breadboard.
My goal here is to make it balance, and I actually did it.
In reality, it took quite some time, I did not record this process, because I just
was trying to figure out how all that code works.
So at this point, I had at least some results and it was easier than I expected.
I remember the first time when I made it balance, it was an incredible feeling.
Although I manage to make the robot balance, the project was far from completion.
Moreover, I was faced with a problem.
The robot falls very often, even on flat surfaces, and the problem was not related to balance,
the problem was the stepper motors.
The motors simply couldn’t rotate fast enough.
The faster they rotate the less current they consume,
the less current they consume the less torque they provide.
So even at relatively low speed, the motors could not provide enough torque.
So after some research, I understood that the problem is caused by
high inductance of the coils of the stepper motors.
There are no other options but to buy different stepper motors.
So do research before buying stuff you don't know about.
The lesson learned.
While I was waiting for the new motors, I decided to solder the second board with
ESP32, MPU6050 gyroscope, and accelerometer module and other stuff.
Also, I’m going to install on this board voltage and current sensor INA219
It will be connected to ESP32 via I2C bus, the same bus that MPU6050 module uses.
So here is a small time-lapse of my soldering. Enjoy!
So after new motors have arrived, I started replacing the old motors.
It is stupid that I had to do this, but there is no other way.
And the worst part is I am not sure that these new motors is the best choice,
I only know that they have much lower inductance, which is very important.
There are many parameters that need to be considered, there is no perfect stepper motor.
There is always some trade-off.
And as always the price very often is a big factor.
Also, I bought bigger wheels.
So after I spent a couple of days tweaking the code, the robot was finally stable.
Most of the tweaks were related to smart current control.
My goal is to make the power consumption as low as possible,
but at the same time system should boost current when the robot starts to fall.
Making all this right is not easy,
and if you set current too high it actually makes things worse...
for some reason...
Also, the robot now applies different PID controller values for standing and going,
this allows the robot to stay almost without any movement.
I was not able to achieve this with only one set of PID values.
All this makes the code not as clean as it was before,
but at the same time, all this allowed me to achieve exactly what I wanted.
As always in the description, you will find a link to the schematic and the code with
all of the tweaks I made.
And here is how remote control of the robot looks like.
You can of course use a radio control transmitter like for example drones use,
but I don’t have that, so I use a Smartphone instead.
At the top, we have telemetry information.
It shows the lowest voltage detected, the voltage right now, power consumption, current,
and other stuff.
And if I connect it to the charger it not only charges the battery
but also measures the capacity of the battery.
I am still not sure that I’ve chosen the right motors.
Anyways the robot is relatively stable now, and I happy with results.
This was not an easy project for me, so I want to share my experience,
I hope it helps someone.
so give it a like if it was interesting.
And as always I thank you very much for watching, see you in the next one!