Developer

Steps toward ESC feedback using SimonK

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:

3689479418?profile=original

 

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!

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Randy, you think that timing data is in nano seconds?  That's a really short time period.  I thought Atmegas can only measure microseconds?  Or is that only a limitation of the Arduino programming language, but not the Atmega itself?

    At 16MHz, it's running 1 cycle every 62 nanoseconds, by my estimation?  So I don't think it's physically possible for the resolution to be faster than that, and even that might be a stretch?

    The Arduino website says the resolution on millis() is 4 microseconds.  

    Just doing some math here... a 2830-740KV motor has 10 poles.  At full throttle on 4S it should be turning 12,432 rpm.  That is 207.2 rps.  It has 10 poles, so that would be 2072 hz commutation? That means a period of 482 uS per commutation.

    I don't think we need nS resolution here?

    Now, one way to detect propeller loss would be to compare the loaded throttle/rpm to the unloaded throttle/rpm. When the prop goes, the motor will lose it's load, and will run must faster for a given throttle setting.  You should be able to program to detect that.

    But something even nicer would be to detect the loss of half a blade. This will set up really nasty vibrations that will surely cause the DCM to fail.  It would be nice to pick that up, and kill the motor so we can regain control.

  • Developer

    @Crashpilot,

        Thanks for the link.  I've heard of the AutoQuad ESCs but never looked much into them actually.  This is a tactical step ahead of an Open Source (hardware + software), ARM based ESC.  I really hope one of those appears soon.  I've heard someone will make them but not yet apparently.

         I think the $50 price per ESC for the AutoQuad ESC is going to make many people stick with the regular $10 hobby grade..having feedback adds value..but does it add $40 of value?

     

    @Hardie,

        A number of people have suggested using a hall effect sensor, monitoring the wire to the ESC or using an optical prop tachometer.  Those solutions would likely work and I've tried using an UNO to monitor the wire but the results were quite noisy.  I also don't want to add more failure points by adding more hardware. The ESCs know the state of the motors, they're just not telling us.

        In whatever form it finally takes, this two way communication between controller & ESC opens up other possibilities..I learned today that for a hexa to keep flyign with a failed motor, it needs to be able to reverse the direction of the opposite motor..this kind of thing can probably only be handled smoothly with an ESC that's well integrated with the controller.

    BTW, what I've done here is totally a hack.. not the best solution, but it's got some potential.

  • RPM feedback would be great. I was just wondering if it couldn't be done with a hall effect sensor close to the motor. Even better could be to measure the RPM on the prop with an IR sensor. This will give you information at the end point of the system and also quickly detect a missing prop.

  • 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

    ESC32
    AutoQuad
  • 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.

  • 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?
  • 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.

  • 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 :-)
  • Developer

    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.

  • 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.

This reply was deleted.