I do a lot of robotics projects. Some of them are documented on this site. Some are not. And many many more are in the works at any given point in time. One issue I always run into when building these robots is what motors and controllers and gearboxes etc… should I use. So I wanted to create an actuator that fits the following criteria:
- Cheap (I’m a college student and by no means wealthy, these should cost under $200 and that’s even a little much). For this ordering parts in bulk from digikey and getting pcbs for dirt cheap from JLCPCB turned out to be incredibly effective at quickly iterating and manufacturing.
- High Torque Density (Much Torque, Small volume)
- Back drivable - this is important as a lot of dynamic robots require this and allow something like a robot dog (coming soon?) do have a little bounce in its step and be able to deal with terrain.
- Daisy chain-able - ideally each actuator has two inputs (one for power one for data), and two outputs (same 2 as before). So instead of running a billion wires i can plug each motor into another and it chains. Power is easy for this I just connect them. There are plenty of options for data, however I settled on CAN, with an additional usb input (no output) for easy diagnostic work.
- Closed-loop Torque control - this required adding some way to measure each coils current (i just used a shunt). Additionally this required some careful decisions made with respect to my control architecture. I ended having two completely different control modes. One for position/velocity mode. One for torque mode. The torque mode was simply a PI controller on the controller currents (in between them there’s actually a FOC controller, but more on that later…). The position/velocity uses a PID controller to generate torques which are then fed to the previous controller to generate the FOC signal for the coils.
How I built it:
- Designed controller: I designed two variants in EagleCAD, one uses an ESP32 the other a stm32. I used a trinamic driver as well as 2 can transceivers as well as some other fun bits (for more fancy stuff such as thermal sensing, diagnostics, programming and more). Additionally there was a magnetic encoder on the back for closed loop feedback from the motor. This is especially important for FOC control which I used, as it requires knowing the relative position between the rotor and the stator.
- Programmed said controllers: the software was honestly pretty simple for the most part. the FOC algorithm is a little funky, but there are some great videos and information online and it worked out pretty quickly. Additionally the esp32 one had some bluetooth code running on the second core so that it could be controlled from my phone. This is still in development.
- For the mechanical part I bought some motors from hobbyking and 3d printed a mount as well as a casing with a gearbox to wrap the whole thing into one actuator.
- This is by far one of the hardest projects I’ve worked on, but 100% worth it.
- I had so much fun and learned a ton. I had made a few pcbs but never done anything with stm32s or any of the analogish circuitry of motors.
- the control theory part was the easiest but still the most fun and was awesome.
- also i am definitely aware of similar projects on the internet (Ben Katz’s actuator for the MIT mini cheetah, ODrive, moteus, etc…), and honestly it would have been easier/cheaper/better/whatever to use one of theirs. But that’s not as fun so I did it myself. Also now I am the only person to blame if I blow up a motor controller working on a project.
I’m not going to be publishing source files yet. Sorry. I’m working on an interesting project which uses these in what I think is a pretty fun/weird application and I’m not ready to publish everything yet. Hopefully soon I can open source everything.