Motor Control from Scratch!, Pt3

    Last week I took the driver I had built on the breadboard and I put it onto a PCB. I ordered that from OSHPark and it arrived today. Works perfectly. This should make my life a lot easier. The breadboard was having tons of problems with loose wires, silicon burning out, and motors skipping and vibrating horrifically. All those problems should be gone now.


    The PCB I made has a few limitations. First, for some reason I didn't think to add a 5V buck regulator that would provide logic power from the motor power bus. I had that on the breadboard but I didn't add it to the PCB. I'm adding that now and in a week or two, after presumably I find other bugs, I'll order another PCB rev. The next thing to do is make use of current control. I added in a hall effect current sensor, though I'm not reading it yet. Originally I put together a shunt resistor and op amp current sensor, but tuning op amps is always a pain and I got tired of it pretty quickly. Hopefully I'll be able to do some level of closed loop current control with the current circuit. And then closed loop speed control after that. And then I'll try out field oriented control and anti-cogging. And of course before I do any of that I need to add in position feedback, most likely in the form of magnetic encoders. The ultimate goal, of course, is to get good direct drive position control out of inexpensive BLDC motors with this thing.

    Also, it seems reasonable to post schematics and source code, now that I actually have schematics. So here's that. It's extremely rough and not properly labeled, so you'll just have to trust me that it works at this point. I do have videos. I'm attempting to keep the circuitry as simple as possible and fix most problems in software. So far I'm expecting that to include anti-cogging and feedback sensor signal processing. The only circuit noise problems I've had so far were fixed by doing commutation the right way instead of the wrong way.


    Of course my source code is on Gitlab, though it's extremely rough and disorganized at this point since I haven't even figured out what I want to do, much less come up with an organized plan for how to do it.

https://gitlab.com/tllado/motor_control