Hi guys, I am programming a robotic car to output information - it being speed (MPH), air pressure, humidity etc. but I was wondering how I would go about programming and calculating the speed; I am currently using an Arduino Uno hooked up to a 4 wheel Robot Smart Car Chassis with a wheel encoder.
I was wondering if anyone has previously done something like this and willing to share how it was done.
The numbers on the wheel encode wrap around, obviously. Easiest way is to divide the wheel into quarters. Remember which quarter it was in last time you looked, and if that's changed, then your wheel has moved about a quarter forward or back. Either count that, and at the end of a second (or whatever) work out the speed, or just count how many ms since it changed last and claculate speed from that.
You can always smooth the calculated speed with the trusty old: