Skip to main content

Subsection 11.5.3 Part 3: From a Pulse Train to a Number

You now have a pulse train on the screen and a number for how many pulses arrive in a second. To convert this to a speed we need to know how many slots are cut in the slotted wheel on your motor.

Activity 11.5.4. Turning the pulses into a speed.

Work on paper, with your table group.

(a)

Count the slots on your own wheel. How many pulses does one full revolution of the shaft produce?

(b)

How do you detect the pulses on the STM32C031C6? Describe every way you can think of.

(c)

How do you count the pulses? The rpm comes from a count taken over a known stretch of time: what starts and ends that stretch?

(d)

Take the pulse rate you measured at the fastest motor speed and convert it to revolutions per minute, using your own slot count. Is the answer plausible for the motor you just watched?

(e)

Can you tell which way the shaft is turning from this signal alone? If you can, say how; if you cannot, say what would have to be different about the sensor.
Whatever the technology behind it (mechanical, optical or magnetic), a sensor like this one gives us a pulse train, and we have to turn that pulse train into a position or a velocity. The expression is the one from the reading, Figureย 11.4.3, and both numbers going into it are now yours.
  • \(PPS\) is the count of pulses in one second, \(N\) the number of slots you counted. Divide by \(N\) for revolutions, multiply by 60 for a rate per minute.
  • Count one edge per slot: rising or falling, not both. Counting both doubles the count, and the expression then needs \(2N\) in place of \(N\text{.}\)
  • Nothing on the screen would tell you that had happened. The number would simply be twice the real speed, and it would look plausible.
The same count answers a second question, and which answer you get depends only on what you divide by.
  • Each pulse is one slot going past, so each pulse is \(\Delta\theta = 2\pi/N\) radians of shaft rotation, or \(360/N\) degrees, or \(1/N\) of a revolution.
  • So \(\text{pulse count} \times \Delta\theta\) is how far the shaft has turned since you started counting, its position, relative to wherever it was then, because nothing here records where that was.
  • Divide that by the time you counted over and you have its speed instead. Note the word average: this says nothing about what the shaft did inside the interval, and a shorter interval buys detail at the cost of resolution.
One thing this signal does not carry at all is direction. Every slot looks like every other slot, and it looks the same whichever way the wheel is turning, so the sign on the rpm your program displays in Lab 6 cannot come from the measurement. It has to come from the mode your program most recently commanded. That sign is therefore only right if the motor is doing what it was told: a motor that has stalled, or one that a hand is turning backwards, would still be shown with the sign the program asked for. Getting direction out of the measurement itself takes a second sensor a quarter of a cycle away from the first, which is a quadrature encoder (Subsectionย 11.6.5).