bird-sanctuary / bluejay

:bird: Digital ESC firmware for controlling brushless motors in multirotors
GNU General Public License v3.0
301 stars 32 forks source link

[EXPERIMENTAL] Feature/jamming protection #180

Open damosvil opened 9 months ago

damosvil commented 9 months ago

WARNING. NOT FOR PRODUCTION USE. This pr is created to have a space to test jamming protection feature.

How it works Jamming protection engages when throttle is above 33% and RPM is over 3500. It disengages when throttle is lower or equal to 33%. If jamming protection is engaged and RPM goes below 2800 the ESC disables and triggers an startup process after 100ms. All throttle values are calculated for 14 pole motors.

How it was tested It has been tested in the workbench with the PSU set to 8V 5A. In kwads (several flights with snap rolls and flips).

With no jamming protection In the image below it can be seen that the voltage in PSU drops in 0.20.1 with no jamming protection. imagen

With jamming protection In the image below it can be seen that the voltage in PSU barely drops in 0.20.1 with jamming protection. imagen

damosvil commented 9 months ago

@hyp0dermik-code I have tested this in my workbench with the PSU set to 8V 5A. Please, when possible could you give it a try and check when the PSU trigger the over current protection?

stylesuxx commented 9 months ago

I would prefer to add this to a later version - 0.21.x preferably, and not to a bugfix version. This is too much of a change IMHO.

damosvil commented 9 months ago

Totally agree. I slated It for now to 0.22.

Edit: also converted to draft

hyp0dermik-code commented 9 months ago

@hyp0dermik-code I have tested this in my workbench with the PSU set to 8V 5A. Please, when possible could you give it a try and check when the PSU trigger the over current protection?

Can you confirm the test conditions: 0.20.1 @ 8v 5a trips the current protection when jammed 0.20.1IR1 @ 8v 5a does not trip current protection when jammed

Is this what I should be testing?

damosvil commented 9 months ago

@hyp0dermik-code yes

damosvil commented 9 months ago

0.20.1 XR1 Test:

damosvil commented 9 months ago

v0.20.1_XR2.zip

0.20.1 XR2 Test:

stylesuxx commented 9 months ago

I've been running this on a couple of 1S whoops - 0802, different KV's and had no issues. BUT, I am wondering if we could/should introduce motor poles as a setting and change thresholds accordingly, or if there are values that would be a good approximation for both (12 & 14 pole) variants? Or maybe hide it behind a "Micro motor jamming protection" setting?

damosvil commented 9 months ago

I've been running this on a couple of 1S whoops - 0802, different KV's and had no issues. BUT, I am wondering if we could/should introduce motor poles as a setting and change thresholds accordingly, or if there are values that would be a good approximation for both (12 & 14 pole) variants? Or maybe hide it behind a "Micro motor jamming protection" setting?

With props motors spin at 45000rpm as much, so the code tries to take advantage of the low end part of rpm that cannot allow the kwad to fly to enable the protection. I think that there is no exact number of rpm but approximate ones so for now I would like to make the code as exact rpm agnostic as possible.

stylesuxx commented 9 months ago

I think that there is no exact number of rpm but approximate ones so for now I would like to make the code as exact rpm agnostic as possible.

Perfect, sounds good to me.

damosvil commented 9 months ago

0.20.1 XR2 seems to be working fine on my side. Please, could you try it and report back?