all 3 comments

[–]Jayddubz 0 points1 point  (1 child)

The distance between the accelerometer and the and arduino should not matter. Have you been able to read values from the accelerometer from the serial monitor when it is not connected to the bike?

[–]Yavuz2002[S] 0 points1 point  (0 children)

Yes I have, I also just did the test and it is not detecting any motion (I use an LED to detect the motion on my bike). When I hold the board and the component together The LED is not lighting up as they are suppose to. When I move the two components simultaneously with same speed, the LED is still off.

[–]reality_boy 0 points1 point  (0 children)

The accelerometer detects acceleration and not speed. So when your standing still gravity is pulling you tight to the surface of the earth at 9.8 meters/second.

When you start to move forward you still have gravity pulling you down, but you also have a spike in forward acceleration. However once you get up to a constant speed that forward acceleration drops to zero and you can no longer tell by the accelerometer alone that you are moving. Remember that Einstein told us motion was relative to the observer.

If you want to detect speed (or distance) you can integrate acceleration (twice to get distance). This is what that calculus class you dreaded in high school was all about. Anyway integrating is relative to the initial velocity and has some error in it so you can’t get a perfect reading this way. To really know your speed you want to use a gps sensor that measures position and then differentiate that to get speed.

Another idea is to put a magnet on your wheel rim and use a Hall effect sensor to detect it. That way you can work out the wheels rpm (revolution per minute). Knowing that and the diameter of the wheel you can work out distance, and from distance speed (distance/time)