simplefoc / Arduino-FOC-reaction-wheel-inverted-pendulum

Reaction wheel inverted pendulum project based on the Arduino Simple FOC library and SimpleFOC shied.
MIT License
115 stars 33 forks source link

Can this be achieved using a gyro? #3

Closed joshbuker closed 3 years ago

joshbuker commented 3 years ago

Is it possible to achieve a similar result, but instead of using an encoder to get the position of the pendulum, use a gyro like the BNO055?

I'm trying to create a balancing RC vehicle that uses a reaction wheel to keep itself upright, but struggling to find a good motor/ESC pair, and came across the Arduino FOC project which seems promising. From what I can tell, it includes torque control, which is exactly what I would need.

askuric commented 3 years ago

Hey @athix , Yes sure. You can replace the encoder with the imu and read the angle and angular velocity. The IMU in not integrated in the library at the moment and you'll need to use an external library for to make it work. But there should not be any big issues. There has been a few of these pendulums using the imu already, especially by rem-rc

You can see the SimpkeFOC balancer project for an implemetation of stabilisation using the IMU.

joshbuker commented 3 years ago

Ahh, excellent! Thanks for pointing me in the right direction @askuric. :smile:

I actually circled back to the ArduinoFOC after seeing Rem-RC comment on a video about using it for his projects, but I wasn't sure if there was a public code example to use as a base. I'll look into combining the reaction wheel control with the balancing bot IMU input.

One other question I would have is if it's possible to use typical drone BLDC motors, or if you're limited to the gimbal type motors I've seen on most of the Arduino-FOC projects. The project that I'm envisioning would be on the more to medium-to-high power end of the scale, and the motors I've seen for most of these projects wouldn't provide enough torque I imagine. I'm guessing that this is primarily limited by the power distribution board that would sit between the arduino and the motor? I have a cheap little BLDC motor and L298N that I could use at the moment, but I couldn't find the ArduinoFOC shield on any of the usual online stores. Is that something where I would have to order the circuit-board itself, all the SMD components, and solder the parts on myself? I looked at the documentation for supported parts, but ended up getting a bit confused.

As for the IMU integration, would it be sensible to look at the source code from Adafruit and use that to implement support within the ArduinoFOC library? If so, I can focus on adding support for the BNO055 instead of doing the conversion specifically within my own code.

joshbuker commented 3 years ago

Ah, it looks like the primary benefit of the gimbal motors is that they have encoders already built in due to being designed to hold a specific angle? In that case, it may make sense for me to start with a gimbal motor for now, then move up to integrating my own BLDC motor and encoder pair when my power requirements increase?

New to engineering, so still learning about how all this stuff integrates together.

joshbuker commented 3 years ago

For those in the future, it looks like you can indeed use the L298N as the motor driver. Still searching on the gimbal motor/motor encoder however. If I find a solution I'll follow up with it here.

joshbuker commented 3 years ago

I have yet to receive/test these, but they are what I ended up ordering if I forget to update this later after testing...