IoTClass Inside the measurement
A closer look · 01

Sensor

Look inside
a sensor.

Rotary encoder

An encoder measures motion or position; a wheel encoder measures the robot's own movement. One way to build a rotary encoder uses a Hall-effect sensor and a small magnet. The sensor responds to magnetic field strength with a voltage that varies with the field. Paired with the magnet, that voltage gives an IoT device a signal for measuring wheel or shaft rotation speed.

Test the chosen part in its actual mounting position and operating range before relying on its readings.

01

Recognize the element

Recognize the element: Rotary encoder

Optical rotary encoder: light to A/B pulses A rotating slotted disc interrupts LED light reaching two photodetectors, producing offset A and B square-wave pulses; A leads B in the example shown. Conceptual detector grouping and pulse timing; not to scale. The two detector windows represent detector groups and associated output processing, not a literal two-photodiode layout. The slot count is illustrative. Conceptual LED slotted disc photodetectors A B A leading B
Explore the conceptual optical model: locate the slotted codewheel, light source, detectors, and illustrated A/B signals. The course also names magnetic Hall-effect rotary encoders (content/sensors/sensor-types-advanced.qmd:438).
02

Peel the teaching model

From case to sensing element

Choose a layer to see the measurement path. The enclosure and board layout are invented teaching choices, not a particular product.

The full text version below describes every layer. All measurement explanations are available without 3D.
Conceptual, not to scale
Case: enclosure and shaft openingThe enclosure and inner support are simplified teaching examples. The source explains how shaft rotation is read but does not specify this package cross-section. [Encoder: Theory of Operation]

Drag to rotate; pinch to zoom. With the view focused: arrow keys rotate, + / − zoom, 1–3 choose a layer, Home resets rotation and zoom. Step advances to the next layer; Reset returns to the case and default view. Layer buttons select a view directly. The page does not move on its own.

Layer 1 of 3 / Outside

Case: enclosure and shaft opening

The enclosure and inner support are simplified teaching examples. The source explains how shaft rotation is read but does not specify this package cross-section. [Encoder: Theory of Operation]

Teaching view: The dark D-shaped enclosure surrounds a slotted wheel and central hub. The opening gives access to the rotating assembly whose motion the encoder measures.

The measurement to rememberThe order of the A and B pulses tells you which way the shaft is turning. [Encoder: Definitions / Direction of Rotation]

Full text version · every layer

1 · Case: enclosure and shaft opening

The enclosure and inner support are simplified teaching examples. The source explains how shaft rotation is read but does not specify this package cross-section. [Encoder: Theory of Operation]

Teaching view: The dark D-shaped enclosure surrounds a slotted wheel and central hub. The opening gives access to the rotating assembly whose motion the encoder measures.

2 · Interface: slotted wheel

As the slotted wheel turns, its spaces and bars interrupt light between the emitter and detector. [Encoder: Theory of Operation]

Teaching view: The metal wheel has slots around its edge. A light source and lens sit on one side, and a detector sits on the other. The rotating wheel alternately lets light through and blocks it.

3 · Element: detector above the wheel

The detector electronics produce two pulse signals, A and B, with a timing offset called quadrature. In an ideal worked example, each signal repeats every 4 milliseconds and B follows A by 1 millisecond. That delay is a quarter of the electrical signal cycle, or 90 electrical degrees. [Encoder: Theory of Operation]

Which signal comes first changes when the direction of rotation changes. [Encoder: Definitions / Direction of Rotation]

Teaching view: Photodiodes in the detector produce current when light reaches them through the wheel. As the wheel alternately passes and blocks light, the currents change. The detector electronics turn these changes into the A and B pulse signals.

Explore the layers in order to follow the teaching model.

03

Listen

Package narration

Read transcript
Omar is testing a connected delivery cart. He fits an optical encoder to a wheel shaft so the controller can follow the wheel's rotation as the cart moves. Inside, a disc with alternating slots and bars turns with the shaft. A light emitting diode shines through the disc toward photodiodes. Slots let light through; bars block it. The changing light changes the photodiodes' electrical output, and comparator circuits turn those changes into high and low pulses. The detectors sit at different positions along the pattern. Their spacing makes the two output channels change at different times, a quarter of a pulse cycle apart. The controller reads which channel changes first to find rotation direction. Reverse the shaft, and the order reverses. Counting pulses tracks how far the shaft turns. Omar initially treats those counts as the cart's actual travel. Then a wheel spins on a slippery patch. The encoder still counts rotation, although the cart barely moves. Converting wheel turns into distance assumes the wheel rolls without slipping; clean pulses cannot check that assumption. The takeaway: an optical encoder measures shaft rotation and direction, while wheel slip can separate that rotation from travel.

You can use “Read layer aloud” in the explorer for your browser’s optional voice reading.