Brushless motor encoder combination doesn't work with simulink

4 views (last 30 days)
i am using a three-phased brushless motor and a rotary encoder. When i plug the motor and the encoder together in the arduino, the motor kind of glitches and does'nt follow the given signal, although without plugging the encoder the same code works fine, and the encoder works also fine without the motor.
I am using simulink arduino support package. i am giving the following signal to the motor using the continious servo block. the motor must rotate for 2.5 seconds in one direction and then 2.5 seconds in the other direction. It rotates correctly when the encoder is not plugged in . once i connect the rotary encoder to pins 2 and 3 of the arduino, the motor begins to glitch. With the presence of the encoder block, the arduino pwm signal becomes too noisy. What can i do to fix this?
Thanks in advance!

Answers (1)

Joel Van Sickel
Joel Van Sickel on 11 Jan 2023
unfortunately this sounds like a hardware problem as the code will not be doing something differently just because an encoder is plugged in. Normally I'd start by looking for grounding issues, although I'm not sure how you could have grounding issues with an encoder as it shouldn't be grounded. If you have really long wires, they could be adding noise to the system, but that would be more likely to affect the encoder than the motor. I guess there could be something mechanically going on that is causing problems, but it sounds like it's only and issue if the wires are plugged in, not the fact that the encoder is attatched to the motor, so again, it doesn't really make sense that would be the issue either. I'm assuming pin 9 goes to some sort of driver for the brushless DC motor that handles all the actual control?


Find more on Simulink Support Package for Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!