I have an Arduino Mega that I am currently using for reading encoder values and plan to perform velocity control for motors. I am using the following components: motor, gearbox, encoder.
I am using the basic example from the Encoder.h library and changed the loop() function to print the encoder value every 100ms. The interrupt pins (2,3) are being used.
The encoder has 1024*4*80 = 327680 counts per revolution due to the very high gear ratio of the gearbox. To get the desired robot speed, I would like to move the motors at 2 rev/s which is 655360 counts/sec. I am aware that this value is extremely (and unnecessarily) large but I already have these encoders and would like to use them if possible. (Worst case I will get an absolute encoder for the output shaft)
When turning the wheel by hand slowly the counts are relatively accurate, but when turning the wheel faster it seems like the Arduino Mega is unable to keep up with the interrupts (I think).
Would switching to a Teensy 4.0 resolve this problem? How many encoder counts per second could a Teensy reasonably handle? I plan to add a bit more code to the basic example for serial writing encoder values and performing PID for velocity control
I am using the basic example from the Encoder.h library and changed the loop() function to print the encoder value every 100ms. The interrupt pins (2,3) are being used.
The encoder has 1024*4*80 = 327680 counts per revolution due to the very high gear ratio of the gearbox. To get the desired robot speed, I would like to move the motors at 2 rev/s which is 655360 counts/sec. I am aware that this value is extremely (and unnecessarily) large but I already have these encoders and would like to use them if possible. (Worst case I will get an absolute encoder for the output shaft)
When turning the wheel by hand slowly the counts are relatively accurate, but when turning the wheel faster it seems like the Arduino Mega is unable to keep up with the interrupts (I think).
Would switching to a Teensy 4.0 resolve this problem? How many encoder counts per second could a Teensy reasonably handle? I plan to add a bit more code to the basic example for serial writing encoder values and performing PID for velocity control