Go Down

Topic: How to calculate distance using arduino (Read 350 times) previous topic - next topic

sagarsukoshe

I am using GSM module with arduino and also drive motors of robot. so I want to calculate how much distance covered by robot linearly and print that distance in message which will send through GSM module.

i tried this formula in void loop
pathcovered = 2*3.14*radius*rps of motor
but its not working. plz help me.


JimboZA

Post your whole code, and also explain in what way it's not working, not just that "its not working"....
Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

steve_t

You need some kind of position sensor in at least one wheel so you can count the number of revolutions the wheel has completed. You plug THAT number into the 2*Pi*r formula to get distance.

afremont


I am using GSM module with arduino and also drive motors of robot. so I want to calculate how much distance covered by robot linearly and print that distance in message which will send through GSM module.

i tried this formula in void loop
pathcovered = 2*3.14*radius*rps of motor
but its not working. plz help me.



Assuming that "rps" = revolutions per second
That should give you your rate (speed).  Distance = Rate * Time
You need to multiply by the number of seconds to get distance traveled at that rate.
Experience, it's what you get when you were expecting something else.

Go Up