Speedo / temp guages in the car ?

Hi guys, I have just bought a experimental kit and am hoping it will enable me to read the speed and temp from the car.

I was wondering if anyone else has tried this at all ? I'm unsure how I would go about hooking up the speedo. I'm assuming its just a pulse or switch that I could just count. ie.. 10 pulses every 10ms = 20mph type thing. Also the temp sensor would be just a resistance I'm hoping.

Any advice on this would be most welcome, once a desired speed is reached I want to flick a relay (5v ?) which would then trigger an actuator to operate a spolier. The temp sensor would open some airducts. I'm assuming this is all possible.

cheers

Steve

I'm sure you could reverse-engineer the gauges in your vehicle; but it's difficult to know whether these are pure analog or digitally-controlled analog gauges. For this reason, it might make sense to use your own sensors. The temp would be the easier; but I suppose you could use a GPS module for the speed.

Careful driving a relay directly from digital pins.

Hi thanks, I have looked into using a gps unit but its alot of extra coding and wouldnt give fast enough response times. Thanks for the advice on the digital output I will be using a couple of the tp102 to two 12v relays.

I will be measuring the speedo pulse to see if its 12v or not, drop this down to 5v and then measing the pulses every 100ms or so.. thats the idea anyway, any advice welcome mind as all this is just from searching and me and electronics have never really clicked.

Steve

I was hoping someone could cast there eye over my circuit diagram and code before I go ahead and have a play.

I want to read the speed from my car by measuring the pulse. I have located this wire and becasue its 12v need to drop this down to 5v (4.8) ... So I intend using a resister divider using the values 20k and 30k, which should give me 4.8v.

Now I dont have a great electronic background and I'm slowly learning so any help of advice would be very welcome.

I intend to power my arduino via the 12v from the car but through a voltage regulator to give it a more steady 12v. Anyway.. I'm assuming I would just need to connect the V-out from my divider to pin 2 of my arduino and run the below code I've wrote. The output at the moment will be monitored via my laptop serial monitor.

int inPin = 2;   // choose the input pin (for pulse count)
int val = 0;     // variable for reading the pulse count
int pulseval = 0; // variable for counting pulse
int currentmils = 0; // variable to hold current mills value
int currentspeed = 0; // holds current speed value (needs to be calibrated)

void setup() {
  pinMode(inPin, INPUT);    // declare pushbutton as input
  currentmils =  millis();  // set current millis
  Serial.begin(9600); // using serial output so I can monitor whats going on.
}

void loop(){
  if (val <> digitalRead(inPin)) {
        val = digitalRead(inPin);  
      pulseval = pulseval + 1;
  }

  if ((currentmils + 1000) < millis();) { // runs every second, will shortern time once calibrated
        currentmils = milles();
        currentspeed = pulseval / 2; // current speed needs calibrating via GPS, but its a start
      Serial.print(currentspeed);
        pulseval = 0;
  }
}

Please let me know what you think, I dont want anything to go bang.. lol

ok I've corrected afew mistakes in my code and will post it up in the right section.. cheers

I'm no expert, I just received my board the other day and don't have a background in this stuff....

But wouldn't you want to make an interrupt so you dont miss pulses? I just wrote this on the fly, I have no idea if this will work... If you can I would update more often than every second, but iono.

volatile int count = 0;
int currentmils = 0; // variable to hold current mills value
int currentspeed = 0; // holds current speed value (needs to be calibrated)

void setup()
{
attachInterrupt(0, pulse, FALLING);
}

void loop()
{
if ((currentmils + 1000) < millis():wink: { // runs every second, will shortern time once calibrated
currentmils = milles();
currentspeed = count / 2; // current speed needs calibrating via GPS, but its a start
Serial.print(currentspeed);
count = 0;
}

void pulse()
{
count++;
}