Brushless motors are amazing. Massive power to weight ratio – which is why they’re used heavily by the model flying community in their planes and quadcopters.
Their mass adoption also means they’re cheap and plentiful!
They’re basically 3 phase motors, which means they have 3 sets of coils inside. They also have permanent magnets attached to the rotor and by energising the coils in sequence (and changing the polarity), you can make a rotating magnetic field which drags the rotor magnets around. You have to be quite precise however, especially when starting up or dealing with a variable torque – you need to know where the rotor is all the time. Fortunately, someone has done all the hard work for you in the form of pre-packaged Electronic Speed Controllers (ESCs) which measure the rotor position by looking at the induced voltage in the coils themselves! Genius. And you can buy an ESC with this genius in it from ebay for a fiver!
Of course if you’re going to use one in a robot, you really want it to got forwards and backwards. And most ESCs on the market are single direction (because for RC planes, that’s what you want). So either look for reversible ESCs or do it the hard way and re-program the ESCs you’ve already bought by mistake!
There are a couple of open source ESC firmwares out there – SimonK and BLHeli are the main ones. But you can download them, compile them and flash them to your ESC.
Some ESCs are helpful and include in-circuit programming pads to allow reprogramming, but if (like me) you bought cheap ones, you’ll have to break out the soldering iron and magnifying glasses to solder wires onto the right pins (see RCgroups) on the microcontroller: