Sport Bike Cluster

Background info: I am a mechanical engineering student in college but I have a passion for motor sports. I am on my universities mini baja team and I have been around racing my full life. I am an avid motorcycle rider and currently have 3 bikes.

Project:

My sport bike does not have a digital tach and I do not like the look of a mechanical dash assembly. I am currently designing a digital dash using my arudino. I play to use an arduino uno, lcd sheild, hall effect sensor or magnetic sensor for speed, and I am currently trying to decide how to pick my rpm.

My bike has a wire that goes into the tach providing a signal. I am not at home currently so I do now know the voltage of this wave. A member of the motorcycle forum I am part of suggested using an optoisolator.

I was wondering if you have any insight that could be given.

Thank you!

-Kevin

Bike ? Make/model/year ? Do you wear knee pads when you go canyon racing ?

My bike is a 2009 Ninja 250. Sadly no canyons in Wisconsin :( Just beautiful country roads.

Southern California, Malibu Canyon, Topanga Canyon , Tejunga Canyon. Whooohh wee ! 1984 Yamaha FJ1100 !

NICE! My plan right now is to keep the arduino hidden under the fairings and put the display up by the stock cluster. I want be able to remove my project when I sell my bike but also want it to transfer over.

Tall order

I am thinking I can branch of the tach signal and put a T in. and for speed put a magnet on the front wheel and calculate it like that

You don’t want to unbalance your front wheel . Besides, the front wheel is not a good choice for that. I would work on the idea of
tapping into the signal approach. Much cleaner.

the problem with tapping in the speed is there is no signal for speed. My bike has a mechanical speedometer but digitally controlled tach

Bummer. Why not just use a gps for speed ? It's fairly accurate. My wife's TOM-TOM displays speed because when I'm driving her BMW she sets the alarm so it beeps if I go over 75 ! (I hate that).

My bike has a speedometer. I was just thinking that if i could put it in the arduino and display it, it would be different. My gps for the car does the same thing except when going 5 over it starts flashing lights at me :roll_eyes: it gets annoying. I should be able to branch off the tach signal no problem though?

I should be able to branch off the tach signal no problem though?

Need to find out the communication protocol. Newer vehicles use CAN bus . http://en.wikipedia.org/wiki/Controller_area_network If you were an electronics person I would explain how & why.

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;

byte SensorOneState;
byte SensorTwoState;
float Speed = 0, MPH = 0, tmp = 0;
boolean GotSecondSensor = false;
unsigned long SensorOne_timer = 0, SensorTwo_timer = 0;

void setup() 
{
  Serial.begin(115200);
  pinMode(SensorOnePin, INPUT);
  pinMode(SensorTwoPin, INPUT);
}

void loop() 
{
  // 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.
    Serial.print("MPH: ");
    Serial.println(Speed);
    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): ");
  Serial.println(tmp);
  return (MPH / tmp); //return the speed of the car in MPH
}

Now that's using your nogin. (high tech)

HazardsMind: 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;

byte SensorOneState; byte SensorTwoState; float Speed = 0, MPH = 0, tmp = 0; boolean GotSecondSensor = false; unsigned long SensorOne_timer = 0, SensorTwo_timer = 0;

void setup() {   Serial.begin(115200);   pinMode(SensorOnePin, INPUT);   pinMode(SensorTwoPin, INPUT); }

void loop() {   // 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.     Serial.print("MPH: ");     Serial.println(Speed);     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): ");   Serial.println(tmp);   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