How to read Speedo at low speed


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Posts
    60

    Default How to read Speedo at low speed

    I have built a controller of sorts for my car that does many things. The latest being control the automatic gearbox.

    The problem I'm having is reading the speedo sensor. The sensor gives one pulse per tailshaft revolution, and with 33" tyres and a 4.3:1 ratio diff, that gives me roughly 61cm of travel per tailshaft revolution. (I think haha)

    According to my calculations, sampling every 100ms will not give me either 0 or 1 pulse under 21kph.
    I need to measure slower speeds than this.

    What is the best way to measure this? I currently use pulsein to read the tacho input also, but this obviously takes less time and higher RPM, so I'm looking at changing that also.

    The problem I have is the pic has to act quickly, the engine revs very quickly, and if it spends 1 second counting pulses, it will probably be over-revving by then.

    I assume the best way to handle this is with interrupts, but have not used them yet, so would love to be pointed in the right direction. Any help would be appreciated.



    The unit is based on a 16F877a running at 4mhz (I can run it faster if I have to) It also controls the air-conditioning & thermo fans in a climate control kind of way, aswell as having a 20x4 display that gives me info on engine stats and temperatures.

    Thanks in advance.

    Dave

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    The only way is to have " real " pulses ( otherwise ... a PLL Osc would do it !!! )

    So, as a sensor ... you should try the Anti-lock brake sensors ( ABS wheel sensors ) that show teeth , like a gear pinion, but are designed to fit car's wheels ...

    available from junked cars for little cost ...

    And it allows you to add the anti-skid function .... Waaaaahhhh !!!

    Alain
    Last edited by Acetronics2; - 29th September 2009 at 13:09.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Dec 2007
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Is it not possible to use the factory sensor? As it's already in the gearbox, and it is what the factory auto computer uses.

    I have this setup on my desk at the moment all connected, and by running a piece of metal past the sensor I can read the pulses with the pic. Looking at the pulses on the oscilloscope gives me the indication that it would be ok to use.

    The other issue about using optical sensors is that this is on a 4x4 which will see a lot of mud and water and the like.

  4. #4
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default

    You can use tmr0 to count impulses from gear box, and some kind interupt to read impulese and reset timer. And you should use longer sampling time. So if you use interupt on evry 500ms, minimal speed is about 5KM/h.
    you can use tmr2 with cristal to create interupt or some kind of pauses in progrm or something like that.

  5. #5
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default Spedp

    Is it not possible to use the factory sensor? As it's already in the gearbox, and it is what the factory auto computer uses.

    Let me ask why not, two units can read the same factory sensor!!

    You said you had a sensor ( never said what kind of sensor ) you need more pulses how can you use this sensor and get more pulses? what metal are you sensing on the shaft ( hall effect sensor and have magnets ) or is it a gear tooth sensor or what. You could use a hall effect sensor and mount maginets on the shaft you could use 1 or 30 magnets and get the pulses you need.
    if its a gear tooth sensor pull the plug on your rear end and see if you could mount a sensor to sense the teeth on the ring gear, gear tooth sensors are about 35 bucks.

    now back to the factory setup Many of the PCM's have an output that can be used by a PIC, 2000 or 4000 Pulses Per Mile would this be enough.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    At low speeds, the time between pulses becomes more important than the Number of pulses per second.

    That value is easiest to measure with the CCP module in "Capture" mode, using Timer1.

    This way, the minimum refresh time for the speed value is only limited to the time between pulses, instead of a number of pulses across a fixed time base.

    The low end can be extended by counting an Upper WORD for Timer1, giving a result with a resolution proportional to the circumference of the tires.

    Not easy stuff, but PULSIN or COUNT won't do it.
    <br>
    DT

Similar Threads

  1. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  2. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  3. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  4. Replies: 14
    Last Post: - 26th September 2007, 05:41
  5. 4-line LCD Help - using PortA instead of B
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 31st March 2005, 03:14

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts