Read linear encoder using raspberry pi and simulink

조회 수: 8 (최근 30일)
Student88
Student88 2016년 5월 21일
댓글: Mihir Pingle 2020년 7월 10일
Hello there :)
I've already managed to read out acceleration data using the raspberry pi and simulink (created my own driver block for this using c code). The next step is to get a positional reference from the following linear encoder:
The encoder has a linear resolution of 0.25 mm, which generates 40.000 pulses/second when using a maximum speed of 10 m/second (the platform is moved by hand, so it should be less than this in average).
I've tested the encoder using simulink with the given simulink blocks (GPIO read), but it's not possible to get a sample time of 25 us.
Another approach that I've tested: Create a device driver block using c-code and the wiringPi library and interrupts. This works, as I can use a slower sample time in simulink and interrupts are running with a higher sample time on the raspberry pi, but still not fast enough (I'm not able, when moving a vertical platform up and down, to get back to the initial value with what the encoder started).
Do you have any possible solutions for me? I was thinking about using an arduino board just for reading the encoder, because I'm already reading out two acceleration sensors with the raspberry pi and simulink.
Thanks in advance.
Best regards,
Niko

채택된 답변

Axel
Axel 2016년 5월 26일
편집: Axel 2016년 5월 26일
Dear Niko,
i had the same problem as you now have. The performance of the Raspberry Pi is just not good enough to manage all the interupts from the encoder signal. I didn't tried it with an arduino, but i think you will run into the same problem with it.
A simple solution is to use just a decoder IC with an SPI interface for analysing the signal which is coming from the encoder. With this solution you dont have to take care about the problem with the high frequencies of the encoder signal. You're just reading the counter from the decoder IC via SPI.
I hope this approach can help you.
Best Regards
Axel
  댓글 수: 3
Student88
Student88 2016년 6월 16일

Solved my problem with the following IC: http://www.mikroe.com/click/counter/

Works great :D

Mihir Pingle
Mihir Pingle 2020년 7월 10일
Hello I have bought the counter click board that you have mentioned here but how to interface it with simulink?Can you please share the working simulink model if you have one?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Raspberry Pi Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by