Skip to content

Add two linear halls sensor module. #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed

Conversation

XieMaster
Copy link

Hello!

I implemented adding two Linear Halls to run the motor.

Get raw analog value A&B --> filter --> map -->
float angle = atan2(hall_filtered_a, hall_filtered_b) * 180 / PI;

Thank you!

powershield examples + hall_sensor examples rename
添加线性霍尔传感器模块。
两个线性霍尔90度安装检测一对极的径向磁铁来获取转子角度。
一个线性霍尔产生sin线性波形
另一个线性霍尔产生cos线性波形
滤波后用反正切函数(atan2)计算出转子角度。
@askuric
Copy link
Member

askuric commented Oct 9, 2022

Hey @XieMaster,
Thanks for the contribution, we will merge this directly I think it a great contribution. However, I'm cannot test it as I do not have the hardware necessary so if someone is interested in testing it I would appreciate the feedback.

Also, I am not sure that I'll have enough time to document the new sensor for the release v2.2.3 so we might wait for the v2.2.4 to add it to the library.

@dekutree64
Copy link
Contributor

I have tested this, and in its current form it doesn't appear to work with anything but 1 pole pair. But if you paste in the electrical revolution tracking from nanoparticle's version, then it does work with my 12N14P motor. The range scaling can be useful to correct for unequal amplitude of sensor signals if they're not placed perfectly, but I think for speed and code size I prefer nanoparticle's version simplefoc/Arduino-FOC-drivers#12 which only subtracts the center value. Better to correct any amplitude difference by physical placement of the sensors.

@askuric
Copy link
Member

askuric commented Apr 19, 2024

Ok, as there is a well tested implementation in the drivers repo, I think its better to prioritize that one.
Thanks @XieMaster for contributing the code, but at the moment I prefer not to merge this code to the main library.

@askuric askuric closed this Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants