Close

Quadratic encoder

A project log for USB Crank-Stick

Crank-based game controller

pixjuanPixJuan 12/04/2019 at 21:030 Comments

How to measure the rotation of the crank? In a computer mouse, the wheel can measure rotation. I had a broken mouse with a wheel that used a quadratic encoder.

It was a USB mouse and the Teensy3.1 doesn't have a USB host port, so I decided to only take the quadratic encoder and read it with the Teensy.
I kept the wheel itself as it was well adapted to the task.

  The mouse wheel was working correctly when I was using it from the mouse but when I was reading it from the Teensy, it was very erratic. So I added capacitors and resistors to filter bounces and glitches:

It is working under normal conditions but when the wheel turns too fast, it misses some pulses. I was using code from the Arduino playground to read the encoder. Then I found out that there was examples for reading quadratic on a Teensy using hardware interruptions. So I tried this code but it failed even more! It's not skipping pulses any more but it was only going forward. I suppose the problem lies in the filtering I did. I am too lazy to unsolder everything and as this part is more or less working, I'll work on other parts of the projects and come back to this later.

Discussions