-
Notifications
You must be signed in to change notification settings - Fork 190
Encoder
Encoder consists of two main parts: encoder disc and optical sensor
I have taken this disc from old ball mouse.
This disc have 65 slits, one of then is closed - it is zero angle reference mark.
See this drawing:
Number of slits is defined in "config.h" file: "ENCODER_HOLES_CNT".
Diameter of the disc is 15.5 mm.
I have taken mine sensor from old printer so I can't give exact name of it. It is conventional opto-interrupter, with one LED and one photo-transistor.
Notice that if you are using disc with a small diameter, you need to use sensor with small diameter of the optical beam - usually such sensors have smaller packages.
It is recommended to make sensor fixing adjustable - to change position of the light beam in relation to disc.
Sensor is connected to the PCB using 3 wires: +3.3V (ENC PWR), GND, Signal (connect it to P6 pad).
See "PCB_3D_view_up.png": https://github.com/iliasam/OpenTOFLidar/blob/develop/PCB/PCB_project_v4/PCB_3D_view_up.png
This is how signal from the sensor should look at the oscilloscope when motor is running:
Zero mark "pulse" is shown at the center of this image.
Signal from the sensor goes to comparator integrated to the MCU. Comparator reference voltage is 1.2V.
See: "encoder_processing.c" and "config.h":
#define ENCODER_COMP_NEG_SRC COMP_InvertingInput_1_2VREFINT