Issue reading pulses from DC motor to arduino

Hi,

I am working on a project that requires me to calculate both speed and position of a DC motor. I am using an Arduino Uno, TB6612FNG driver and a 34:1 6V HP gear motor 48 CPR. I am trying to read the pulses and design the project using Simulink.

The motor used is Motor. According to the documentation of the motor, I should be receiving 12 pulses per revolution ( only reading channel A). However, when I try to read the pulses using an Arduino digital input block (pin 4) connected to a scope, I'm only receiving around 4 pulses per second which is well below what I'd expect.

I'm not quite sure if I've configured something incorrectly or I am misinterpreting the scope, but I'm hoping for some clarification or a reason to why this may be the case.

let me know if anymore information is required that i may have missed.

Thank you for your time

You need to learn what a "quadrature encoder" is. Ask Oncle Google.
Reading 4 pulses per rev is correct reading only one of the two signals.

Sorry. But shouldn’t it be 48 PPR for both channels and 12 PPR for a single channel. Also I am getting much more than 1 revolution per second

This link shows the encoder output.

How are you counting revolutions? From the motor or the output?

I am manually counting them while using the scope block in simulink. The example given is using an oscilloscope

Could you please further explain what you meant by 4 pulses is correct? I’m quite stuck on it.

You have misunderstood that encoder. Please post a link to its datasheet.
Quadrature encoders use 2 channels of pulstrain being shifted 90 degrees. You need to use both channels.

Look at the oscilloscope picture! That's how the puls train looks like.

Can You post schematics of Your test setup, and the code used?
You say You get 4 pulses per second. That doesn't tell much. What is the speed of the motor?
Check pulses per revolution instead.

The code, posted using code tags, a clearly labeled, hand drawn wiring diagram, and a link to the motor driver.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.