Improvements for control and sensing

Hi guys, simple ask.

Are there any filters for sensing current?


I want to make better quality sensing current for better detection.
I bet the most important will be better controll quality, but with what
methods I can improve my controll loop? I’m using stm32g4

1 Like


You could start by reading the documentation and what was discussed previously on that topic:

Also you are talking about improving but you don’t mention about problems you are facing, that’s confusing.

This reminds of a document shared with me a long time ago:
How to ask Smart Questions

Have you checked the documentation ?
Have you searched in the forum ?
What is your problem ? Be precise and informative about it.
What have you already tried ?
What is your end goal ? Do we have to guess based on the picture ?
Are you using a custom board ?
2 or 3 shunts/phase currents ?
Inline or low side sensing ?

So not it’s not a simple ask.

It’s not 100% clear what you’re asking?

If you want to interpret the current like shown in the picture, this is possible, I think. The getDCCurrent() function will return a number corresponding to (but probably not equal to) the bus current, it will generally be a positive quantity.

You can filter this, for example using our low-pass filter class.

And then you can apply a threshold detection to convert the signal into a boolean value - collision true/false.

Is this what you’re trying to achieve?

Note that motor stalls (e.g. the rug got wound up in the wheel) and sudden up-hill movement may also register as “collisions” with this detection scheme…