エンコーダパルスを読み取る方法

조회 수: 12 (최근 30일)
a19112yy
a19112yy 2016년 11월 17일
답변: Atsushi Matsumoto 2017년 5월 2일
私はsimulinkとArduinoIOを用いて、エンコーダのパルスを読み取り、カウントしようと考えております。 そこでArduinoIOにあった「Encoder Read」ブロックを用いて、パルスを読み取ろうと考えたのですが、それとなく値は出力されるのですが、その値が何を示しているのかが良く分かりません。 また、「Encoder Read」ブロックを用いる以外の方法で、パルスをカウントする方法があったら、ご教授お願い申し上げます。 サンプルタイムは「0.02」秒です。 ブロック図は「Encoder Read」に「Scope」を繋いだだけです。

채택된 답변

Atsushi Matsumoto
Atsushi Matsumoto 2016년 12월 15일
エンコーダにも色々な方式があるので、方式によって方法は異なると思いますが、インクリメンタル式のエンコードについて説明します。
このインクリメンタル式は2相のパルスが出力され、その位相によって回転方向がわかります。また、Simulink/Logic and Bit Operations/Detect Increaseブロックで、パルスのエッジを検出して、それをHDL Coder/HDL Operations/HDL Counterブロックのenable端子に入力すると、パルスの回数をカウントして、何度回転したかわかります。

추가 답변 (2개)

amir tahir
amir tahir 2017년 5월 1일
I face same problem, I use arduino mega 2560 with connected with my encoder by arduinoIO block.Here type my encoder http://www.mybotic.com.my/products/Rotary-Encoder-Kit/115 when read analogread block which is connected to pin data encoder it give output in pulse or ON and OFF ->My quastion is how to convert given output in pulse to RPM? I already use block detect edge but it still not give output in RPM any professor can help me?

Atsushi Matsumoto
Atsushi Matsumoto 2017년 5월 2일
Your encoder generates 20 cycles of pulse with 1 turn/360 degrees. It means 1 cycle of pulse is 1/20 turn.
Where the pulse count is P,
You can convert it to RPM with following formula.
RPM = P/20/minutes.    
 
Hope it helps.

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by