What about maybe using a laser trip wire and your spokes? The beam breaks, record the time then once it passes the second spoke find the difference of the two times and get your speed that way.
I have a sketch you can use to get you going, for right now it uses tactile buttons to simulate a car passing through two gates that are 35 feet away from each other. All you would need to do is substitute the buttons for the sensor (you will need to modify the code a little since your using one sensor) and change the 35 feet to the distance between the two spokes.
#define FPS_to_MPH 0.68182 // scale factor
#define DISTANCE 35.5625 // distance between the two sensors or gates.
const byte SensorOnePin = 2;
const byte SensorTwoPin = 3;
float Speed = 0, MPH = 0, tmp = 0;
boolean GotSecondSensor = false;
unsigned long SensorOne_timer = 0, SensorTwo_timer = 0;
// This is using normal buttons to detect car passing through one gate to another,
// this can be changed to use US sensors to replace the buttons. That part you will
// need to write yourself.
SensorOneState = digitalRead(SensorOnePin);
SensorTwoState = digitalRead(SensorTwoPin);
if(SensorOneState && GotSecondSensor == false) // car drives through first gate "sensor"
SensorOne_timer = millis(); // record time
GotSecondSensor = true; // lockout this IF statement and unlock the next IF statement
if(SensorTwoState && GotSecondSensor == true)
SensorTwo_timer = millis(); //record the time the car reaches the second gate
Speed = GetSpeed(SensorOne_timer, SensorTwo_timer, DISTANCE); // send the times and the distance into the function.
GotSecondSensor = false; // unlock first IF statement and lockout this IF statement.
float GetSpeed(unsigned long T1, unsigned long T2, float distance)
MPH = distance * (FPS_to_MPH); // "(FPS_to_MPH)" -> conversion factor, feet per second to miles per hour
tmp = (T2 - T1)/1000.00; // since the time we are using is in milliseconds, we need to convert milliseconds to seconds
Serial.print("Time (seconds): ");
return (MPH / tmp); //return the speed of the car in MPH
Thank you very much!!!! I will play with this when I get home from college tonight