Continuing with the NETMF for Electronics Noobs Tutorials. Today, I’ll demonstrate wiring up a brushless motor to your NETMF device.
If you’re building any type of R/C planes, copters, cars, boats or robots with your NETMF device then you’ll likely encounter the need to control a brushless motor. Controlling a brushless motor is very different than controlling a regular brushed DC motor. What makes it different is the addition of the Electronic Speed Controller (ESC).
The main reason this article exists is because the hobby parts distributors have done a terrible job of documenting these most basic of parts. You should be able to go to the manufacturer website for the ESC you purchase and get most of this info. However, my experience is that you can’t and they assume you know what you’re doing if you buy these parts. Obviously, not the case or you wouldn’t be here.
If you click on the main photo, and look closely at the ESC (the blue part in the lower left corner) you will see that on one side it has three black wires. These colors may vary from model to model. On the other side it will have two thick red & black wires. It will also have a bundle of two or three thinner wires depending on your model.
First connect the three black wires from the ESC to the three wires coming from your motor. Right now you’re thinking “which wires on the motor go to which wires on the ESC?”. Trust me, it doesn’t matter. To understand why, study how brushless motors work and you’ll understand. For now, just take a leap of faith. If you find later that your motor is turning in the wrong direction, then swap any two of these wires and the direction will change. It’s magic…
The small bundle of three wires on my ESC are colored brown, red, and orange. After quite a bit of digging, I finally found that the two outer wires are the important ones. The brown wire is ground and the orange wire is the control. The red wire in the center provides 5V power and can be used to power the microcontroller. Most people do not recommend this due to the fact that when the motor is accelerated quickly it is possible that power could be momentarily lost. This is an especially bad situation if you’re controlling a flying vehicle. It’s not so bad if you’re controlling a car or plane. If your bundle only has two wires, then you do not have the power wire.
You should wire the brown wire of the ESC bundle to any ground on your NETMF device. For this example, I’m using a GHI Panda-II. The orange wire should be connected to any PWM pin. I’m using PWM1 (I/O 10).
Next, all you need to do is connect the red & black wires from the ESC to the respective wires on your battery. If all is well, you will probably hear a series of tones from your ESC indicating that it is now armed.
NEVER TEST YOUR MOTOR WITH A PROPELLOR ATTACHED!!!
Until you have fully tested out your controls and have everything mounted securely and have a safe place to work, it is a really bad idea to attach the propellers. If you have never worked with a brushless motor with a propeller on it, you will probably be amazed at how much power they have the first time your power it up. Propellers are very sharp and will cut you.
Now that everything is wired up, it’s a simple thing to get the software going. Start by downloading Chris’ Brushless Motor ESC driver class and add it to a new NETMF project. Assuming you also used pin 10 to control your ESC, the following code should test your motor by powering it up to 20% power for about half a second and then powering it off. Push the reset button to make it go again.
public static void Main() { var m1 = new BrushlessMotor((PWM.Pin) FEZ_Pin.PWM.Di10); m1.Scale = 100; m1.SetPower(20); Thread.Sleep(500); m1.Stop(); }If that works then you’re off and running. Just figure out what power your project needs and when then apply where necessary. If you need additional motors, then rinse & repeat but use a different PWM pin.
If you’re using a netduino or other NETMF device, do not be dissuaded. It’s very easy to port Chris’ driver class to your device and to make the appropriate change to the test app. Feel free to drop me a line if you need help.
Choulant asked for it and here they are - the parts used in this tutorial:
- GHI Electronics FEZ Panda-II
- Mystery 30A ESC
- Turnigy Park 480 Brushless Motor
- Turnigy 4000mAh LiPo Battery
Have fun!