View Full Version : Odometer
mataston
- 30th May 2006, 00:02
HI I HOPE SOMEONE CAN HELP i am trying to build an odometer for my car, the circuit is simple enough a hall effect trigger and a magnet to generate a pulse, i need a pic controller to count so many pulses before displaying 1 mile. as the propshaft on the vehicle is going to rotate several times before covering a distance of 1 mile, there fore producing a given amount of puleses before covering a mile. how can i write this in picbasic pro. also another part of the design i am not sure of is how to retain the amount of miles covered. so next time power is switched on it continues counting. all help is appreciated.
thanks mat
mister_e
- 30th May 2006, 14:19
depending of your car model and year but most of the time, they already have a sensor called VSS (Vehicule Speed Sensor). It's actually pretty simple to read from them. Some of them will produce 6000 pulse/miles, some other 4000 and the list is long.
If your car have this Sensor, you can find the info at the link bellow
http://www.rostra.com/rostra-obstacle.htm --> Search application guide
mataston
- 31st May 2006, 00:34
unfortunetly it isnt that simple as my car is a kit car and i am looking getting rid of the old cortina dials i have in it, and building some digital ones instead.
cheers mat
mister_e
- 31st May 2006, 00:40
O.K in the past Audiovox Cruise control (now Rostra) sold some magnet stuff to stick on the drive shaft and a sensor... i remember that time.
Yup, hall effect sensor is the way to go. Now you can begin by using a 16 bit internal counter and read the results after 1 mile. You should be able to do something with it.
Read datasheet in the TIMER section. Once done, do some test.
In the Code Example section, you can find a Frequency Counter thread. It should gives you some start point.
Good luck!
mister_e
- 31st May 2006, 00:42
Also, Microchip appnote DS41214A (CCP tricks and tip) is also a good reference
mister_e
- 31st May 2006, 00:46
mmm another idea here, as you already have something workable, you can probably modify it. Is this a Cable system? If so, you can probably modify the dash end and attach a Optical Encoder to create your VSS signal. Optical encoder OR Using some optocoupler stuff.
mramos
- 2nd June 2006, 01:52
mataston
If you have the pulse already and it is 5VDC, you can use the PBP to read that port (make it an input) and debouce it (hard way). I have been told PBP has interrupts. So the best way, is to use the hall effect device to trigger an interrupt pin on the PIC and your interrupt routine to count the turns, when you hit the mile number, you increment the mile counter and clear the hall effect counter. You will have to find a mile road, run down it and get the count for when you reach a mile for your base number.
Last, you will want to write the number (of miles and if you want to be closer on real miles, save the current hall effect count) in the EEPROM of the pic chip. Then you can kill the power and the numbers (miles and last faction of a mile) will be there next power up. So when you power up you will want to read them back, and keep adding to the counter and the miles counter.
Do you have the schematic for this items. I would be happy to look at it and help.
Also, you only have so many write to the EEPROM, and on the PIC it is fair, not great but a big number (maybe 100,000 writes). You also need to determine when to write the number to the EEPROM. I would say everytime you are not moving (no pulse for so many seconds), and set a variable so you only write it only once until you are moving again.
mister_e
- 2nd June 2006, 03:04
IMHO, i would avoid to write too much to the EEPROM and avoid to reduce his lifetime.
2 Possible solutions:
1. write to EEPROM when you remove the key from the ignition switch. You must have a switched 12 volt and a constant 12 volt routed to your cluster..
2. Write to the EEPROM only when the battery is disconnected. For that you'll need to add some extra hardware but not impossible.
Option 1 is still good enough to me so far
Christopher4187
- 2nd June 2006, 03:06
I'm not privy to the acronym.....IMHO. What does that mean?
mister_e
- 2nd June 2006, 03:21
In My Humble Opinion.
Here's a link wich explain some of the common chat abreviation => http://www.stevegrossman.com/jargpge.htm#Dictionary
psdayama
- 2nd June 2006, 13:11
mmm another idea here, as you already have something workable, you can probably modify it. Is this a Cable system? If so, you can probably modify the dash end and attach a Optical Encoder to create your VSS signal. Optical encoder OR Using some optocoupler stuff.
I think U cant make odometer with just Hall sensor. What U need is Quadrature optical unit. By this U can sense whether car is going forward or reverse!!
Unless U want the reverse distance travelled also added. With quadrature opto unit and 2 JK flipflops U can generate + & - ve pulses per
revolution and then just count them and divide by pulses/mile or Km whatever
is Ur unit. Also then U can calculate the speed also to be alternately displayed. All cumulative distance should be written to EEPROM when switching off occurs and read again after next switch off.
I leave it to masters for genarating code on this line. I have serviced
such Odometer used in runway painting. It was based on Z80.
mataston
- 5th June 2006, 11:14
i can still use a hall effect, basicly when you put the car in reverse it activates a switch which obviously turn your reverse lights on, therefore i can use that signal to turn off the signal from the hall effect device therefore no counting while in reverse.
Acetronics2
- 5th June 2006, 12:32
unfortunetly it isnt that simple as my car is a kit car and i am looking getting rid of the old cortina dials i have in it, and building some digital ones instead.
cheers mat
Hi, Mat
Old dials work with a magnet rotating with the cable coming from the gear box...
i have somewhere a very very old kit intended to be a speed limit alert : It works with a self made core coil fixed at the rear of the odometer.
If interested ask me ...
For rear gear ... thinking to it make me laugh !!! : How much "reverse" miles do you really drive in your car lifetime ... ???
Alain
mister_e
- 5th June 2006, 14:28
Possibility to hack the current one too.
If your current cable go to a cluster 'motor', thereafter this motor use a serie or Gear and goes to your KM/Miles counter. Is it possible to remove the adapter + motor and read from that with hall effect sensor.. i think so.
mmm seems i had the same idea of Alain after all :D
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.