Step 1: Original Plan: Boosted Board
Originally, I wanted to make an electric skateboard to get across campus quickly. But, I quickly realized I'd either learn nothing from just buying and putting together all the components or be overwhelmed from trying to build them all. Instead, I decided to focus on making a single component work; specifically, the brushless DC motor. My revised goal was to research how a brushless DC motor works physically and then implement an electronic speed controller to control its speed.
Step 2: The Research
I spent a long time reading and watching videos about brushless DC motors. I learned how they have pairs of coils on an internal rotor through which we send a current through one coil and out the other. This creates electromagnetic fields around the coils which snap to magnets on the outside stator. Switching the current between pairs of coils quick enough creates a constant snapping, or rotation.
More specifically, the motor has three inputs, A, B, and C. In one of six phases, A will have positive voltage, B will be ground, and C will have nothing connected to it. We switch these connections through the other phases to create the rotation.
I also learned that the timing for phase switching needs to be extremely precise for a smooth rotation. If not, the motor will jitter as it snaps. Usually, motors find this time by using Hall sensors to measure the location of the coils. My motor doesn't have these, so instead I'll switch phases when the sum of the back EMF of the motor's three connections is equal to zero.
Step 3: Difficulties
There was a lot I didn't know about building a speed controller.
My original circuit used six BJT transistors, controlled by an Arduino Uno, to allow either ground, 5V, or neither to the motor's three inputs. However, I initially used LEDs instead of the motor to make sure I had the phase changes right. During this testing, I discovered three main things:
- A connected LED without a resistor blows out (and smells horrible) because the I-V characteristic is nonlinear and too much current flows. A resistor makes the I-V characteristic linear and limits the current.
- If you want to send a high voltage or ground across a transistor, you need to choose the correct one because they are polarized. A PNP BJT allows positive voltage across from the emitter to the collector because the base is grounded. A NPN BJT allows ground voltage across because the base has a high voltage. I had these backwards and my LEDs wouldn't turn on because of it.
- If you want to send a large amount of current through a transistor, use MOSFETs instead of BJTs. A BJT only lets a small amount of current through for uses such as LEDs and logic gates, and will likely blow out when given the 5 watts for the motor. MOSFETs are designed for power-hungry tasks, so after my LED testing was done, I switched to p-channel and n-channel MOSFETs (because they too have polarities).
After all that, it seemed trivially easy to connect and code a potentiometer to adjust the delay to change the motor's speed.
Step 4: M5 Changes
M5, as an environment geared toward helping me work on a project like this, was great. I was able to use the power supply for the emitters, there was plenty of people around to ask for help, and there was always enough LEDs, resistors, wires, BJTs, MOSFETs, and other components like the motor and Arduino. How should M5 change to streamline my learning process? I don't know. Besides being a little packed because of the 231 projects, it's a pretty good place.
Step 5: What I Made
It's super basic, but it works! I made a circuit that uses MOSFETs and a potentiometer controlled by an Arduino Uno to control the speed of a brushless DC motor, capable of RPMs between 2000 to 6000. As a person more experienced with coding than anything physical, I learned a lot about electronics putting this together. Outside of that range, it sputters and stops.
Step 6: How Can Somebody Else Follow in My Footsteps?
Ask a lot of stupid questions. As I said before, I'm super comfortable coding but extremely incompetent with anything electronic. So it was embarrassing as a Computer Engineering major to ask questions such as "What's a MOSFET?" and "Why isn't my ground working?". Though obvious to most people, I lacked the hands-on experience that I finally gained after this project (231 projects helped, too). So far, trying to build something then troubleshooting everything wrong with it has been the best learning experience, and I would recommend it to everyone.
Step 7: What to Do Next?
Despite many hours, I could never get the precise timing of the motor to work. I was trying to sum the back EMFs of the three connections in order to switch phases when they added to zero. But, looking at the serial output of the Arduino I never saw the sum get lower than 400 millivolts. I couldn't tell if it was my wiring or my code that wasn't working, but I plan to work on it. Despite an imprecise delay between phases, my motor works fine for a decent range. It's stable is it approaches 5,000 RPM, but it can't gracefully transition to a complete stop. After the timings figured out, the motor should be stable for the entire range of the potentiometer.