I have an optical rotary encoder that has 2 channels with 2400 pulses per revolution. I am reading it just fine with my Arduino Uno using interrupts but I want to run some experiments with it so it "appears" I am turning the shaft slower than I actually am. There are multiple pieces of hardware connected so I can't just turn it slower without using some mechanical gearing or belts.
My thoughts were to read the pulses via interrupts and store them in a FIFO array (queue). The array would store the actual time in microseconds multiplied by some factor between 1 and 10 or so for each interrupt. I would then output the signal to a different pin when the actual time equaled the time in the array thus effectively making it look like I turned the encoder slower.
The issue I have is that this would require a relatively large array with each element storing the time in microseconds (probably as a long int). As the data is output, the array size would decrease and eventually going to zero if I stopped turning the shaft.
I would like to turn the shaft for at least 10 revolutions for my experiments, so the number of time stamps would approach 2400*10 or 24,000 per channel. (it would actually be somewhat smaller depending on how many data points were dequeued in that time-frame).
Is there a microprocessor that could handle this? This will not be a permanent thing but just for some experiments I want to run.
I suppose a Raspberry Pi would be able to handle this but is there something smaller/cheaper that would work?
Or is there a better/alternative approach to accomplish this that I am not thinking of?
Thanks
My thoughts were to read the pulses via interrupts and store them in a FIFO array (queue). The array would store the actual time in microseconds multiplied by some factor between 1 and 10 or so for each interrupt. I would then output the signal to a different pin when the actual time equaled the time in the array thus effectively making it look like I turned the encoder slower.
The issue I have is that this would require a relatively large array with each element storing the time in microseconds (probably as a long int). As the data is output, the array size would decrease and eventually going to zero if I stopped turning the shaft.
I would like to turn the shaft for at least 10 revolutions for my experiments, so the number of time stamps would approach 2400*10 or 24,000 per channel. (it would actually be somewhat smaller depending on how many data points were dequeued in that time-frame).
Is there a microprocessor that could handle this? This will not be a permanent thing but just for some experiments I want to run.
I suppose a Raspberry Pi would be able to handle this but is there something smaller/cheaper that would work?
Or is there a better/alternative approach to accomplish this that I am not thinking of?
Thanks
