Hi, I know the optical shaft encoder ticks per rev for a turbo gear 393 motor is 261.3. If I design a system as gear ration 1:7 which motor to flywheel and the encoder is monitoring the flywheel instead of motor, do I need to divide ticks per rev by 7 to calculate velocity?
I use this code from forum.
void
FwCalculateSpeed()
{
int delta_ms;
int delta_enc;
// Get current encoder value
encoder_counts = FwMotorEncoderGet();
// This is just used so we don't need to know how often we are called
// how many mS since we were last here
delta_ms = nSysTime - nSysTime_last;
nSysTime_last = nSysTime;
// Change in encoder count
delta_enc = (encoder_counts - encoder_counts_last);
// save last position
encoder_counts_last = encoder_counts;
// Calculate velocity in rpm
motor_velocity = (1000.0 / delta_ms) * delta_enc * 60.0 / ticks_per_rev;
}