I have a requirement wherein I need to measure the distance travelled (Real-time) and display it on an app on a tablet present inside that moving vehicle. I have a setup wherein I have connected the encoder to the pi using the GPIO pins and the app is connected to the pi using bluetooth.

I tried to put in the readings of the encoder into a file and send the contents over to the app per second. But, the pi seems to miss a lot of these readings, owing to concurrency issues, probably.

So, what could be some alternative way to do this, any suggestions are Welcome!

1 Answer 1


I think 1 second update it's to much for that application, I've found that sometimes, bluetooth data get "lost" if the messages are send to fast. Maybe 10-15 seconds update will be alright.

I'll go with a MCU and getting the data in there, storing it until it's send to the app. You can send a message from the app to the MCU to trigger the data send.

One problem could be, if the speed that the encoder is rotating is to high, data could get lost while sending data if the data sending is a blocking order. You should check how much time the data takes to be send.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.