Basic setup of Raspberry Pi simultaneously controlling DC motor and reading out pulse counter feed by rotary encoder. DC motor is swinging back an forth, rubber band couples shafts of the motor and encoder. X-load shows the load on R-Pi is minimal.
Schematic is posted here
https://drive.google.com/file/d/0B0Jn...
Used parts: Raspberry Pi 2, DC motor controll 'hat': PCA 9685 + TB6612, pulse counter for optical decoder LS7366, (multiple) power supplies LM2596