Brushless Motor Controller Code

Thanks to Chris for posting his code at:
http://code.tinyclr.com/project/62/brushless-motor-esc-for-aircrafts/

However, I’m having one issue. I wrote a quick test program to get things working that basically increases the power by 20% every time I push a button. The problem is that I get zero increase in power between 80% power and 100% power. Does anyone know if this is an issue with the driver code or possibly something I need to change in the ESC? This is my first time dealing with brushless motors & ESCs so I fear there’s something in the ESC that needs to be changed. However, a code fix would be easier to remedy since I haven’t yet had time to figure out how to program the ESC.

My motor:
http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=14396

My ESC:
http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=9483

Thanks!

Ian

Do you have a scope you can use to probe the signal?

I seem to recall there was a bug in the original driver code, but I think it was only going from backwards to forwards.

Did you calibrate the ESC?

Also note that ESCs can be kinda picky. Without fail I always have to code a new ESC config class for each of the speedies I use it with.

Unfortunately, I do not have a scope right now that works.

What’s the process for calibrating an ESC? Like I said, this is my first time to deal with them. This would be some great additional info to add to the code page.

I think I found what you’re talking about…
http://code.google.com/p/arducopter/wiki/Quad_ESC

I’m not using a remote yet, but I should be able to set this up on the breadboard and programmatically power it up and go through the process and see what happens. If there’s more that I should know that they didn’t mention, please let me know.

Another question related to the ESC… It seems to also be powering my board. If I have it connected to the 11.1V LiPo battery and the power line to the ESC connected to the 5V power on the Panda-II board then it seems to also be powering the Panda. I didn’t realize it until I unplugged my USB cable and the Panda kept running. I tried and the ESC wouldn’t run w/o the power connection to the Panda. It doesn’t seem to be a problem. Should I be concerned? Could this cause harm to the Panda? Is there anything I can do to prevent damage? I plan to have 4 or more ESCs connected eventually. Is this going to be an issue? I had planned to use a separate 3.3V UBEC to power the board but that hasn’t been wired up yet. Should I even worry about that now?

Not sure what you mean about power, you should only hook up signal and ground, no power, as the bec voltage is usually unstable.

The BEC has three wires (brown, red, orange). I’ve never found any official documentation on this BEC but the best I’ve been able to figure and what works is brown=ground, red=+5V (“power”), orange=signal. If I don’t connect the red line then the BEC will not do anything when I send the signal. So, I’m at a bit of a loss at how to use it w/o this connection.

Don’t use the BEC. Only connect ground (brown) from the speed control to the Panda and the signal (orange) to PWM and leave BEC (red) disconnected. I can’t explain why the controller won’t respond without the BEC connected to something - it could be looking for a load.

You can connect the BEC to the 5v on the Panda… There is still a 3V regulator downstream from that to power the CPU. Just watch the noise on the BEC - there isn’t a great deal of filtering going on behind the 5v side of things. Usb is protected via a diode so don’t worry about it.

You can also connect your LiPo to the VIn (12v) input on the Panda. It is slightly inefficient because of the linear regulators but at least that way you know the Panda is using its own regulator. Have a look at the Panda schematic on the GHI shop site.

You’ll have to calibrate the speed control to match your PWM signal for min, max and centre. It should be possible to “fake” this with the Panda.

Thanks, I’ll play around with it a bit more. I suspect that it may be that I need to fully reboot everything. When testing yesterday I didn’t believe I fully disconnected the ESC from the LiPo between testing with the BEC connected/disconnected. It may be that the ESC detects whether its connected or not and reconfigures things on startup.

What ESC is this?

See the link in the original question. Thanks.

Ah, right, I see.

Whether or not somrthing is connected to the BEC should not have anything to do with the ESC part of the board working, at least for just the typical HK speedies.

As long as gnd and signal are connected, it should work fine. I guess you could test using a dummy load on the BEC just to see if there is something stupid going on there.

I finally got back to this problem this week… It turned out that as long as I started up everything w/o the BEC connected then everything worked fine. Apparently, it senses whether this connection is made and changes things accordingly. Thanks.