With Instructables you can share what you make with the world, and tap into an ever-growing community of creative experts.
Tell us about yourself!
Sure! Figure 4 in step 5 is a diagram of how the sensors are connected to the PID controller. The accelerometer and and the gyroscope are used by the complementary filter to generate an estimated angle. This estimated angle is then compared to a set point, and the difference is used in the proportional and Integral terms of the PID controller. The gyroscope is then used directly in the differential term. Hope that helps!
I am not very familiar with the Arduino Leonardo, but a quick search shows it does not include the IMU. So you would need to add an IMU to your robot, and adapt the code that interacts with the IMU. So the short answer is the code as it stands will not work in Leonardo, but with changes, it probably could be made to work.
Thanks for the comment! I agree it could be more stable. I spent some time investigating better balancing performance, and was a bit surprised at what I found ... check out if interested : https://www.instructables.com/id/Upside-Up-Robot-Ba...
Upside Up - Robot Balancing...View Instructable »
Join 2 million + to receive instant DIY inspiration in your inbox.
© 2016 Autodesk, Inc.