Hey all!
I am working on a bicopter.
For that I am using a mpu6050 and an arduino nano.
Also
2 x brushless motors hobbymate 2204
2 x mini servo motors
2 x ESCs 15a
1 x lipo battery 2200 mah
1 x rc receiver
I design and printed the frame and motor mounts on a 3d printer
I am close to make it taking off stable but I am not able to get to the good autolevel situation. I can flight for 3 or 4 seconds.
i have been playing with the pid constants but not able to get to a reasonable stable position
I would like if anyone can review my code and let meknow what can I improve or what I am doing wrong
I really appreciate it!!!
Let me know if I am missing something
Thanks in advance
bicopter_rc_pid2.ino (14.1 KB)
Can you provide some pics of the model?
Overall pics showing the basic geometry and then some detailed shots of the motor mounts, the servos and the mechanical link between the servos and the motor mounts?
Edit - as long as I am asking for more technical detail, what prop? What voltage LiPo? What is your all-up weight?
Sorry for the delay
Here you have some pictures
I hope you can help me

That is some cool designing!
There are 2 things that worry me.
-
servo connection
Directly connecting the servo to the motor mount does give a slop-free attachment. But there is a down side. You are wasting most of the servo throw. In normal stable flight, you will probably only be using a few degrees each direction. Let's say 10 degrees total. The other 170 degrees of travel go unused. The down side is that the servo sensitivity spread across all 180 degrees. By limiting eh travel of the servo to 10 degrees, you are giving up sensitivity.
I suspect that your PID results will be much better if more of that servo sensitivity is utilized in the range of movement that your motor will actually move.
Different mechanical connections will let the servo range of travel be closer to its maximum while keeping the motor movement in its expected range. This will give you the best sensitivity for best control.
-
CG
your center of gravity looks close to your center of lift. The only successful bicopter that I saw had the CG quite a bit further lower than the center of lift.
Thank you for the answer!!!
Regarding the first one, can you give me an example of other motor mounts That you think that would give me more sensivility?
Regarding the second one. Do you mean that the arm should be a little bit longer?
One update on my end. I am testing the stabilization algorithm with just one pid loop per axis using the angle as the imput
Thanks again!!!!!!
Your servo came with a collection of servo arms.
These have holes in them for connecting links or control rods.
In a typical radio control application, the control rod would go between the servo arm and a control hown on the control surface.
I got that from a video. Not sure what it is about, but it does show the pieces well.
Basically, you want to adjust the ratio of the arm to horn length, where length is the distance between the denter of rotation and the attachment point of the control rod. Short on the servo and long on the motor mount will mean that your servo moves more for the same movement of the motor. This will effectively give you more servo sensitivity for the same motor mount movement.
Here is a link to the video. Like I said, I have no clue what it is about. I just looked for a good image and this had it. servo arm control horn position and pushrod length rc plane 3d - YouTube
Oh, if you do decide to modify your design to use these control rods, consider using ball links at each end. These are much more slop free than standard bent wire links. And if you are working ona PID system, slop is your enemy.
Hey I made some changes in my design having into account your suggestions and the changes are awesome.
I put the center of gravity a little bit lower
I attach some images
Thanks!!!!!!