Is there any sensor to detect ? In which direction the wheel is moving like for eg...suppose a train is moving in forward Direction so the wheel are in anticlockwise rotation so as to achieve the forward motion and vice versa so how can we detect the forward or reverse motion or the rotation of the wheel for that train? Can I achieve it by another sensor but only using Arduino?
A quadrature encoder
who, or what is in control of the motor/train ?
i would think if you are, then you should know which direction has been commanded.
if you are on a train controlled by some other force, then maybe you need an accelerometer ?
Accelerometer may have difficulty distinguishing acceleration in one direction and braking in the other!
It might help if we know more about your setup, the environment involved, your level of access, and generally as much information as you can provide.
Silly answer: do any of the wheels squeak? And is the squeak pattern different for forward motion vs reverse motion? But, seriously, the level of detail is, possibly, directly related to the quality of our response.
For instance: if we knew the wheels are driven by an electric motor, we might suggest monitoring the current to the motor, and using direction of current as an indication of wheel rotation [and perhaps assuming a large current indicates impediment to motion, etc.] OR if there’s a consistent pattern below the vehicle, such as the ties on a railroad, then perhaps detecting ties vs spaces will indicate motion and direction [two sensors spaced slightly closer together than the smallest width – if the width of the space between ties is smaller then the two sensors would be spaced slightly closer together than that, etc].
Just some examples of what we might be able to do with sufficient information.
Use two sensors which can detect some sort of optical or magnetic mark appropriately positioned on the axle. By measuring the time difference between a detection on sensor 1 and sensor 2 you can calculate the direction of rotation and speed and acceleration.
Paul__B: Accelerometer may have difficulty distinguishing acceleration in one direction and braking in the other!
oh yeah - that's right ! have to add a compass then :)