In my last post I previewed that I had bought Brushless DC 3-phase motors with their corresponding ESC's. After doing even more research, I bought a 3 cell lipo battery rated at 1300 mAh (the smallest one I could find.) I also bought a power distribution board to supply the power from the battery to the ESC's, as well as male and female bullet connectors, and 9045 propellers.
A source on the internet showed me that an accelerometer module could be used to find the angles that could be usid as inputs in the PID algorithm, to provide stability to the quadcopter. I had one of those modules in one of the Raspberry PI starter kits that I had gotten. It was the ADXL345
I made the frame of the new design Quadcopter using plywood. which I cut in to shape with a hand saw. I then drilled holes into the wood and screwed the motors and raspberry pi in to place. Because I needed to remove and recharge the batteries for the ESC as well as the Raspberry Pi often, I just stuck those on with tape. The power distribution board went on the bottom, and plastic cups cut in half were attached for the stands under each motor.
I integrated the PID algorithm in to the code and wrote in a loop that gave me manual control of the base thrust given to the motors.
WARNING: The motors spin really really fast and are dangerous when first testing one, I accidentally set the thrust too high, and the propeller and the screw on top of it shot off the motor, nearly taking out my eye. On a separate occasion, when testing the quad, my mom was helping out, and she cut her finger pretty on the blades, because they were spinning so fast she couldn't see them.
I was able to control the motors using the same PWM function on the Pi.
FINALLY! the quadcopter was able to lift up off the ground! unfortunately, it consistently veered off on to one side or the other. I was able to correct it to an extent by changing the gains on the PID algorithm, however it could not reliably lift off the ground more than a foot without violently tipping and at that point I would have to shut down the code.
I once again read some more online, and found a gyroscope module, which I had once looked at, but because I didn't understand the vital differences between the gyroscope and accelerometer, dismissed it as the same thing. but more expensive. This time I got a better sense of what was happening in the code and in the accelerometer module. the motion of the aircraft and the vibrations caused it to be a lot more unreliable in flight, whereas while testing it, it was fine. I bought an imu unit (MPU6050), and it gave me much more stable in flight angle readings.
This looked promising, however, the problem with the PID gains still persisted. How would I tune the PID gains? they had to be tested manually(no easy mathematical solution), and I couldn't allocate a lot of space to trying it over and over, because I lived in a small apartment at the time, and needed a good wifi connection to use the Pi.
I tried several times, and the one last time I changed the PID gains, one of the motors revved up a lot more than the others, the quacopter flipped on its back, and all of the propellers shattered.
Stay tuned for the stunning continuation to the tragedy!
No comments:
Post a Comment