필터 지우기
필터 지우기

Arduino Engineering Kit encoders return incorrect readings

조회 수: 17 (최근 30일)
Tom Hawkins
Tom Hawkins 2018년 11월 28일
댓글: Tom Hawkins 2018년 12월 12일
I'm working through the Arduino Engineering Kit material, using MATLAB/Simulink R2018b on Windows 7.
The examples in Chapters 2.1 (Arduino Getting Started) and 2.2 (MATLAB Getting Started) worked OK, and so did everything in Chapter 2.3 (Simulink Getting Started) as far as the open-loop control example - but when I tried the closed-loop control example the motor went haywire, running erratically forwards and backwards at maximum speed. Looking at the outputs from the encoder block on the scope, the position, and speed if I add that as a second output, are both varying apparently at random in the range +/- 2e+9, even if the motor is stationary:
simulink encoder issue 2018-11-28_09h19_04.png
Now when I go back to the MATLAB examples that worked previously, the encoder object returns a constant value of 12 for readCount and 65 for readSpeed no matter what the position of the actual motor is.
I haven't changed the connections between the Arduino and motor/encoder since the point when it was working, I've checked with a voltmeter that the encoder outputs are changing between 0 V and 3.3 V as I rotate the motor, as expected, so I don't think it's the hardware, and I've tried uninstalling all Arduino-related add-ons and reinstalling them in the order specified in the Engineering Kit instructions, but no success.
I have the latest versions of everything, as far as I know: MATLAB/Simulink 2018b, MATLAB Support Package for Arduino Hardware 18.2.0, Simulink Support Package for Arduino Hardware 18.2.0, Arduino Engineering Kit Hardware Support 18b 1.1.1, Arduino IDE 1.8.7, Arduino SAMD Boards 1.6.19, and MKRMotorCarrier library 1.0.1 as specified in the ArduinoKitHardwareSupportReadMe.txt file, although I see the latest version available of that library is 1.0.3.
What can I try next? My best guess is that something in the configuration or firmware of the MKR motor carrier has been incorrectly changed by the Simulink support package, but how do I fix that? Should I try reflashing the motor carrier firmware as described here? Any ideas?

채택된 답변

Madhu Govindarajan
Madhu Govindarajan 2018년 11월 28일
So when you are going through steps shown in the online material, what happens if you try to do open loop control again and measure the speed of the encoder? Is it anywhere close to the figures shown in the material. Feel free to email me from here and I can help you check what is wrong.
  댓글 수: 7
Tom Hawkins
Tom Hawkins 2018년 11월 30일
Thanks, I've emailed them.
Tom Hawkins
Tom Hawkins 2018년 12월 12일
The response from Arduino technical support suggested reflashing the firmware on the motor carrier board using the Flasher example (Arduino IDE > Files > Examples > Mkrmotor Carrier> Flasher).
The first time I tried this it worked once then the same behaviour came back again. After repeating the procedure it so far seems to have fixed the problem. I'll let you know whether this fix turns out to be permanent.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by