Most of the pro multicopter set-ups have feedback from the ESCs so the controller knows the status of the motors.  This is useful for all kinds of reason including:

    1. debugging the causes of crashes - the controller could log when a motor has stopped running.

    2. allows faster and better reaction to a motor failure perhaps saving you from a crash at least for hexas and octas.

    3. automatic generation of a linear thrust curve which makes life easier for the attitude controllers.

 

As a first step towards trying to make that functionality available for the hobby/diy market I've managed to hack a hobbyking RedBrick50Amp and load it with a modified SimonK firmware so that it sends back timing information using the SPI bus to an APM2.  This modified SimonK firmware is in my clone in the spi_feedback2 branch and the changes were pretty minor as you can see here.

 

Here's a picture of the set-up:

 

Now, it's really a first step, there are a few issues:

    - It only works on the RedBrick50Amp because that's one of the few ESCs that is not using the SPI bus's slave select pin to control one of the FETs also you can see I needed to do some careful soldering to attach a pin directly onto the Atmega8.  To make it available to all we'd need specially manufactured ESCs.

    - Using the SPI bus would mean a lot of wires to the APM2.  5 wires from each ESC (mosi, miso, reset, slave select, clock) and 4 wires + 1 wire per esc on the APM2 side.  I might look into trying to use I2C instead which would be just 2 wires per ESC.

    - the feedback is the timing (in nanoseconds?) from when the ESC last switched the polarity of power to one of the wires.  So the feedback is non-linear..you get very accurate feedback when it's moving slowly, but lose accuracy as it gets to the high end of it's range.

 

Still, a step in the right direction I think.  All feedback and advice welcome!

Views: 3011

Tags: APM2, ArduCopter, ESC, RPM, SPI, SimonK, feedback.

Comment by Crashpilot1000 on September 26, 2012 at 11:42pm

This is really great!!! I always asked myself: Wouldn't a control loop benefit from knowing the actual RPM instead of giving out a PWM to the motors and hope for the best (linear response). Your approach to take the already aquired data from the ESC directly is impressive and way beyond my capabilities. Maybe someday I2C esc become standard. It will be interesting to see if the theoretical advantage will result in a practical effect that is worth the effort.

Keep it coming!

Kraut Rob

Comment by Marooned on September 27, 2012 at 2:02am

Very nice timing as I was gathering information yesterday on flashing ESC to use Field Oriented Control.

I've even ordered yet another HobbyKing F-30A for testing. I'm using them successfully on my quadro and Bixler. I've just found out that they are recommended by guys from Openpilot but I'm a bit surprised that Simon said there are unusable for multirotors with stock firmware. Well, I did not compared them with flashed version but I'm kinda happy using them on my quadro. I wonder what he mean.

Anyway, I'm trying to figure out how alexmos is controlling his motors. Having some idea I need to reflash esc with some custom code to try it out and feedback from motors will be much appreciated. But if I understand correctly you don't have feedback from motor but from ESC when it last time switched the polarity? If so how can you determine if the motor really turned or is blocked by some force?

BTW, is there around some custom ESC firmware written in C? Knowledge in x86 asm is not very helpful for mega asm.


Developer
Comment by Randy on September 27, 2012 at 2:28am

     Thanks for the feedback!

Marooned,

     It seems the ESC knows if the motor is turning or not.  I'm not an expert but unlike a brushed motor where you just provide a voltage and the thing spins, with a brushless motor, the ESC actively senses when a pole goes by and then reverses the voltage to give it a push on it's way.  So the ESC knows the status of the motor and in the somewhat dry video you can see that when I disconnect the motor, the ESC (and thus the APM2) know that it's stopped.

     Another thing I'd really like is to measure the current used..this would tell you if you've lost a prop or not.  At the moment, you can't tell because the motor's rpm appears perfectly normal even without a prop.  SimonK's firmware doesn't support current sensing at the moment though and I'm not sure I'm up to trying to add that.

     Not sure if there's ESC software written in C.  I'd guess there is but this is the first time I've looked at ESC firmware.  I've also never used assembler really before this so it took a little extra effort to learn the instructions.

Comment by Marooned on September 27, 2012 at 3:01am

It for sure depends on particular ESC but just found one example here and it's clear that you can use ADC 0,6,7 for measurement. To bad that diagrams are not so common for all ESC. If a board is 2 sided then you could trace paths to see if you have ADC connected through shunts.


Developer
Comment by Randy on September 27, 2012 at 3:39am

Marooned,

    Hey, thanks for that.  Nice that you noticed that level of detail so maybe the "Mystery NFet" will also work.  Yes it's the slave select pin, PB2 (aka pin 14) that is generally the problem.

    Here are some others that should work (I looked at the SimonK firmware include files to see which ones seemed to have the pin free):

TowerPro 17A, TowerPro 25A (but there 2 or 3 versions and only one of them works)

RCTimer 50a

Birdie70a

HobbyKing Red Brick 50A, 70A, 200A Green (RB200A)

HobbyKing BlueSeries 40a

HobbyKing SS Series 190-200A (HK-SS200ALV)

PulsoAdvance Plus DLU40A

Keda 12A

...but if I were you, I'd wait 'cuz I'm hopeful that someone will offer to manufacture a special version of one of the above for us.

Comment by Daniel on September 27, 2012 at 3:52am
Wouldn't it be possible to compare the overall apms (as detected by attopilot sensor) to an "normal" amp use for a given rpm setting (for all motors) to detect a missing prop ?

I know, still doesnt tell you which one is missing, but at least you know why you are suddenly dropping to one side :-)
Comment by Marooned on September 27, 2012 at 4:03am

I found a great amount of knowledge (pretty long thread) about ESC that could help in understanding how it works and how can be altered.

HobbyKing 30A are on backorder so I'll wait a bit for my order before I will be able to hack it (and I don't want to ground my current birds). For sure I'll be back to this thread as I am very interested in a different types of control of BL motors.

Daniel, you will have to measure the range of normal operating current (using all equipment like LED stripes or some extra servos) to have a reference for a particular aircraft. Not mention that AttoPilot is a bit expensive like for such simple thing.

Comment by Daniel on September 27, 2012 at 4:09am
Marooned, just add a learning mode (record your baseline (while you are sure you still have all the props)) and then compare. And I was refering to this: https://www.sparkfun.com/products/9028?
Comment by Marooned on September 27, 2012 at 4:12am

Yeah, this one. $20 + shipping sounds expensive to me for this.

Anyway, your idea could go along with Randy's - they won't disturb each other and can be complementary.

Comment by Crashpilot1000 on September 27, 2012 at 4:51am

What's up with these ESC: http://autoquad.org/esc32/

Still missing driver for canbus and I2C but they are programmed in open source C. (And they have much more cpu power than APM - and that's a shame)

So long

Kraut Rob

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service