Snelheid encoders
Speed encoders like this one are not considered to be very reliable for absolute positioning. But if you want to use them to give 2 wheels the same speed they might do a sufficient job. I first started with the HC-020K brick. This is absolutely a case of more is worse. Just the sensor works perfect, the brick does not. So don`t buy the brick, just buy the cheaper WYC H206 sensor. Because of its 3mm mounting holes it fits easily in many designs.

The IR LED must be placed in series with a current limiting resistor just as any LED. Not visible but I also used the internal pull-up resistor on the interrupt pin to which the encoders are connected to. The other side of this switching transistor is connected to the GND ⏚. All the rest is software. And sweat. And interrupts, since these sensors each need an interrupt.