Encoder Pulses
Posted: Sun May 12, 2013 7:12 am
I am looking to replace a PLC and have been looking into using the raspberry pi. The idea is I need to track items as they move down a production line. As the items hits a trigger I need to keep track of encoder pulses, and after a certain number of pulses fire off some outputs to control certain bits of equipment.
I will need to keep track of multiple items at once.
What seems to be the difficult bit is I need to track the encoder at 10kHz. I have written a program in python and one in c which takes the input of the encoder pulses and then turns this into an output. Measuring the speed which the pi can do this shows it is consistent in both languages up to roughly 2kHz. However after that it seems to lose encoder pulses. I appreciate that turning an encoder input into an output is not what I would be doing in real life, but it gives me a way to measure achievable speed. I am beginning to wonder if it is trying to output each encoder pulse that is causing the problems.
If the pi has to do anything else other than track the encoder it falls down at much lower speeds.
I have seen people quote speeds of mHz in relation to the raspberry pi. However I think that is just generating the pulses and not tracking the encoder.
I was thinking I may have to use something like an arduino board instead, but I am unsure if that would work.
Anyone have any experience with this sort of thing?
I will need to keep track of multiple items at once.
What seems to be the difficult bit is I need to track the encoder at 10kHz. I have written a program in python and one in c which takes the input of the encoder pulses and then turns this into an output. Measuring the speed which the pi can do this shows it is consistent in both languages up to roughly 2kHz. However after that it seems to lose encoder pulses. I appreciate that turning an encoder input into an output is not what I would be doing in real life, but it gives me a way to measure achievable speed. I am beginning to wonder if it is trying to output each encoder pulse that is causing the problems.
If the pi has to do anything else other than track the encoder it falls down at much lower speeds.
I have seen people quote speeds of mHz in relation to the raspberry pi. However I think that is just generating the pulses and not tracking the encoder.
I was thinking I may have to use something like an arduino board instead, but I am unsure if that would work.
Anyone have any experience with this sort of thing?