Speed warning light

I’m pretty new to arduino, and need a little help with a problem I have. So basically I have a 1958 Edsel that has a speed warning light in the speedometer that illuminates when you exceed a certain speed set by a dial just below it. However, the original mechanical setup is long gone and decided to use a VSS speed sensor and an arduino to make the system work again. I have the code about 80% done, but I’m having an issue aligning the speed numbers on the dial with what the arduino is reading at that speed. I have the upper and lower numbers correctly “aligned”. The gaps in between each 5 mph mark get bigger as they go up the dial, causing the middle numbers to be way off, and was wondering how to correctly map the numbers? I’m by no means an arduino whiz, so any help would be appreciated!

(Link to image of selector dial)

https://drive.google.com/file/d/1Y-9kqM0OU5dZNhHJX47VrNrB9qs3AqxW/view?usp=drivesdk

So what part of your car is the VSS sensor connected? Then, which is incorrect, the VSS or the actual car speed? Do you have the technical specifications for the VSS and does it show a linear output in relation to the actual automobile speed?

How do you determine the set speed from the dial? Is there some form of electric output from the dial?

Sorry about the confusion, the VSS is connected to the speedometer cable to read vehicle speed, and there is a separate potentiometer that the dial goes on to select what speed the light turns on at. The issue is it isn’t linear since technically the halfway point between the lowest value on the dial (25), and highest (80) should be 52.5, yet that isn’t physically halfway between 25 and 80 on the dial. I’m basically just trying to correctly map the dial to the potentiometer.

The speedometer cable should be linear, tracking with the speedometer take-off gear… tied to the tail shaft or axle.

Maybe a good time to start posting photos, schematic and code.

Is it something easy, like your ,’selector’ is not linear ?

Set the dial to each of the speed divisions, and print out the reading you get from the arduino. May be easiest to use a lookup table to get the nearest dial position, or it may be possible to find a way to calculate the speed from the resistance reading.

Correct, the speedometer is linear, but the selector isn’t. The gaps between each 5 mph segment on the dial get larger the further up the dial it gets, which would make it not linear.
I attached the image of the dial on the original post if you want to take a look at it.

Hello joshwalcott123

Welcome to the Forum.

Post your sketch, well formated, with comments and in so called code tags "</>" and a none-Fritzing schematic to see how we can help.

Its not a linear scale, it doesn't even start at zero.

Cable drive, eddy current speedos are not linear if made cheap and mass produced.

How have you calculated the speed to be read at the Arduino?
Have you checked the accuracy of the Edsel's speedo.

What model Arduino are you using?
To add code please click this link;

Please put your code in a new post?

Can you post a link to data/specs of a VSS sensor?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

Here is the code I have as of right now (I know it is not complete, and may be messy this is my first full arduino project).

// C++ code
//
int speedPin=A1;
int selectPin=A2;
int red=4;
int speedVal;
int readVal;
int speedPos;
int selectPos;
int dt=300;
int selDegree;

void setup()
{
  Serial.begin(9600);
  pinMode(speedPin, INPUT);
  pinMode(selectPin, INPUT);
  pinMode(red, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  readVal=analogRead(speedPin);
  speedPos=(readVal/18+25);
  readVal=analogRead(selectPin);
  selectPos=((selDegree/5.1)+25);
  selDegree=(readVal/3.65);
  Serial.print("MPH Selector is at ");
  Serial.println(selectPos);
  Serial.print("Speed is ");
  Serial.println(speedPos);
  Serial.print("Degree is ");
  Serial.println(selDegree);
  if (speedPos>selectPos){
  digitalWrite(red,HIGH);
  }
  if (speedPos<selectPos){
  digitalWrite(red,LOW);
  }
  delay(dt);
}

And im mainly focusing on just getting the selector potentiometer "aligned"

This helped me solved a similar non linear situation.

1 Like

Hi,
What signal does your VSS put out, digital or analog?

Link to data/specs of Vehicle speed sensor?

When the Edsel speedo shows 40mph, what does the VSS readout?
When the Edsel speedo shows 20mph, what does the VSS readout?

You are telling us that they do not correlate, but give no data for us to look at.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

Ah, thank you for finding that, that was exactly the type of thing I was looking for.

Here is a link to the one I plan on getting

https://www.summitracing.com/parts/dak-sen-01-4160

And also I’m not actually at the VSS stage yet, I’m just trying to get the potentiometer to not be linear, as the selector isn’t aligned in the center of its rotation.

consider tables to interpolate over -- example values


int mphVec [] = { 25,  30,  35,  40,  45,  50,  55,  60,  65,  70,  75,  80 };
int spdVec [] = { 41,  68, 105, 153, 212, 285, 373, 476, 595, 733, 889, 1065 };
int selVec [] = { 31,  45,  61,  80, 101, 125, 151, 180, 211, 245, 281, 320 };

#define Nvec   sizeof(mphVec)/sizeof(int)

// -------------------------------------
int
interp  (
    int valX,
    int vecX [],
    int vecY [],
    int N)
{
    int n;
    for (n = 1; n < N; n++)  {
        if (vecX [n] > valX)
            break;
    }

    float dY = vecY [n] - vecY [n-1];
    float dX = vecX [n] - vecX [n-1];

    return  vecY [n-1] + (dY * (valX - vecX [n-1]) / dX);
}

// -------------------------------------

char s [80];

// -----------------------------------------------------------------------------
void setup (void)
{
    Serial.begin (9600);

    for (int spd = 30; spd < 1000; spd *= 2)  {
        sprintf (s, " %4d  %4d\n", spd, interp (spd, spdVec, mphVec, Nvec));
        Serial.println (s);
    }
    Serial.println ();

    for (int sel = 30; sel < 400; sel *= 2)  {
        sprintf (s, " %4d  %4d\n", sel, interp (sel, selVec, mphVec, Nvec));
        Serial.println (s);
    }
}

void loop () { }

Hi,
The VSS you are aiming to get is a pulse device.

Can I suggest you get the unit and start from there.

To check the non linearity of the control dial, make a table of angle of rotation vs speed on the scale.
This will give you the points where you can use @Hutkikz link.

But until you have the VSS calibrated your figures will not be valid.

Tom... :smiley: :coffee: :+1: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.