PDA

View Full Version : Detect Signal



angrysmileyface
- 29th March 2007, 15:28
I am currently working on a project to add a second odometer to my vehicle. At this present time I believe it to be a series of pulses, however I do not know the number outputted per mile. Is it possible have the pic determine (perhaps count) these pulses initially so that I may use this number for my project? I don't believe there is a clock signal involved, and do not know the period. Any help provided is greatly appreciated. (And no this isnt a highschool or college project, I just want a second odometer for my car)

Thanks

SR

skimask
- 29th March 2007, 15:35
I am currently working on a project to add a second odometer to my vehicle. At this present time I believe it to be a series of pulses, however I do not know the number outputted per mile. Is it possible have the pic determine (perhaps count) these pulses initially so that I may use this number for my project? I don't believe there is a clock signal involved, and do not know the period. Any help provided is greatly appreciated. (And no this isnt a highschool or college project, I just want a second odometer for my car)

Thanks

SR

I assume you're talking about the digital odometers and not the old cable driven types.
On most of the dash panels I've seen, on the back, like right under the connector (a few times on the front), there's usually some writing saying something to the effect of "1320 PULSES PER MILE" ('88 Chevy Sprint). I don't remember the numbers for my other cars.

As far as calibrating (if needed), 2 methods come to mind.

-Drive 60mph, press a button, PIC counts for X amount of time or one minute, which would be perfect at 60mph since you'll also have travelled a mile, now you also have pulses per mile.

-Drive X mph, press a button when you pass a mile marker, press the button again when you press the next mile marker. Now you know how many pulses per mile (give or take). Maybe do ten miles so the 'give or take' will average out a bit.

angrysmileyface
- 29th March 2007, 15:48
Yes it's a digital signal, not cable driven. I am thinking its just tie an input pin to the signal, and do the number of pulses that show up. I need to work on some code and then we'll see if that works.

ronsimpson
- 29th March 2007, 15:54
My car gives one count per turn of the drive shaft. (output of the transition)
Multiply by the turn ratio of the rear end multiply by the tire circumference.
You just need to count how many pulses per km or mile. Build a counter with a PIC and drive for 1 mile. Every kind of car is different. You need to do the experiment.
Simple project.

skimask
- 29th March 2007, 16:01
My car gives one count per turn of the drive shaft. (output of the transition)
Multiply by the turn ratio of the rear end multiply by the tire circumference.
You just need to count how many pulses per km or mile. Build a counter with a PIC and drive for 1 mile. Every kind of car is different. You need to do the experiment.
Simple project.

Relatively simple project. I have to wonder how 'ugly' that signal will be coming off the sensor, travelling up the wire to the PIC, etc. Might have to square it off a bit with a 7404 or something along those lines so the PIC doesn't get false triggers.

sougata
- 29th March 2007, 16:29
Hi,

Most probably you would be getting a variable frequency signal. If you have access to a frequency meter (most multimeters have) then measure the frequency while driving at a fixed speed. You get an idea of the number of pulses/per second available a certain speed. Do it for other speeds as well to find if the relationship is correct. Only take care while driving and taking the reading.

angrysmileyface
- 29th March 2007, 16:43
Unfortunately I do not have a frequency meter. best I have is a cheapo Radio Snack multimeter with AC/DC, Diode test and Amperage. So I am rather stuck trying to ascertain what the signal looks like by what I have on hand. Now if I had the gear I had back in college, it would be a diff story.

Basically I think I will count the pulses that show up, unless someone has a better idea (This is a 93 honda civic btw)

mackrackit
- 29th March 2007, 17:57
Unfortunately I do not have a frequency meter.

You are building one. Be sure to look at the COUNT command in the manual. I use something similar to monitor fan and blower speeds.

A hall effect sensor is often used. If the wiring is good the signal will be "OK". The first few blade speed monitors I built used sensors from autos.

Pic_User
- 29th March 2007, 20:17
1992-1995 Honda Civic Cruise Information

Constant 12V+ White Ignition Switch Harness or Use Hot Side of Brake
Switched 12V+ Black/Yellow Ignition Switch Harness
Ground Use Chassis Near Cruise Control Module
Hot Side of Brake n/a Brake Switch
Cold Side of Brake Green/White Brake Switch
Tach Blue Distributor
VSS Lead Yellow/Blue Driver's Side Dash, above Fuse Panel, Gray Connector
Pulses Per Mile 4000 PPM

http://www.hondafactor.com/v2/showpost.php?p=52855&postcount=5

“Your mileage may vary”
-Adam-

skimask
- 29th March 2007, 20:25
VSS Lead Yellow/Blue Driver's Side Dash, above Fuse Panel, Gray Connector
Pulses Per Mile 4000 PPM

http://www.hondafactor.com/v2/showpost.php?p=52855&postcount=5


There ya go. Use the VSS signal to trigger an interrupt, keep track of the pulses in a word variable...Bam...done...except for the building, and the programming, putting it in a box, testing it on the car, etc.etc. :)

mister_e
- 30th March 2007, 15:51
Both Vss and Tach can be find easy under the dash for this car as well. Usually on the top of the fuse box. There's a lot of connector, just use the same wire color.

angrysmileyface
- 2nd April 2007, 01:02
Ok got a little code here. Not quite sure if its what I want for this purpose, so excuse me if there are some errors. Basically I want it to count the pulses coming off the VSS and Im trying to use the VSS as a the interupt to start the process when it starts registering milage. I do not know if I configured the interupt process correctly as well as its not shown here, but I would like to be able to save the milage to some portion of the eeprom memory when the car is shut off. I intend to use a 16F877A for this project. Insight or help is greatly appreciated. Thanks.

Define LOADER_USED 1 'required if bootloader used to
'program PIC
DEFINE LCD_DREG PORTC 'Define PIC port used for LCD Data
'lines
DEFINE LCD_DBIT 4 'Define first pin of portb
'connected to LCD DB4
DEFINE LCD_RSREG PORTC 'Define PIC port used for RS line of
'LCD
DEFINE LCD_RSBIT 3 'Define PortC pin used for RS
' connection
DEFINE LCD_EREG PORTC 'Define PIC port used for E line of LCD
DEFINE LCD_EBIT 0 'Define PortC pin used for E
'connection
DEFINE LCD_BITS 4 'Define the 4 bit communication
'mode to LCD
DEFINE LCD_LINES 2 'Define using a 2 line LCD
DEFINE LCD_COMMANDUS 2000 'Define delay between sending LCD
' commands
DEFINE LCD_DATAUS 50 'Define delay time between data sent.
OPTION_REG = %00111111 'Not sure if this is needed.
plscntr var WORD
milage var word


plscntr = 0 'Reset pulse counter
ON INTERRUPT goto miles_start
INTCON = $90
Start:

lcdout $fe, 1 ' Clear LCD
lcdout $fe, 2 ' Position cursor at home
LCDOUT #milage ' Initially display Milage
Pause 1000 ' Pause for 1 second to see it
If PortA.1 = 1 Then milage = 0 'Reset the milage indicator if reset button pressed
Goto Start ' Loop back and do it all again


miles_start:
if PortA.5 = 1 then plscntr= plscntr +1 'add the pulses

if plscntr = 4000 then
plscntr = 0
milage = milage+1
lcdout $fe, 1 ' Clear LCD
lcdout $fe, 2 ' Position cursor at home
LCDOUT #milage ' Display Milage
EndIF
goto miles_start
end

skimask
- 2nd April 2007, 03:57
Which pin do you plan on using to trip the interrupt?

Assuming the pulse goes high (maybe PortB.0?), let the ON INTERRUPT kick you into the interrupt subroutine and stay there until the pin goes low so you don't kick the counter more than once.
Check and reset the pulse counter (if counter > 4000 then = 0 etc.etc.) and increment the mileage counter, and do the displaying and button checking in your main loop. No sense doing that in your interrupt subroutine.
First off though, don't worry about counting mileage...put the whole thing together and whip up a 555 timer or something (maybe even a pushbutton, the switch bounce will give you more than one pulse if the button is old enough!) to simulate the VSS pulse and get the display and everything working without having to go out to the car every 2 minutes to test it out. Just get the thing counting up as you need it (heck you can get both an odometer and speedometer and average speedometer and gas mileage and oil change intervals and all sorts of crap into this), then worry about all the neat stuff for later since you've already got basics down.

Kman
- 9th April 2007, 20:36
I was trying the same thing as you, but I was wanting to have a Point of Sale printer record my daily millage. and use a Real time clock to Give it a daily time stamp!
But my problem was to writing the milliage to the eprom and keeping the pulse count while moving.

angrysmileyface
- 10th April 2007, 00:28
I dont intend to store to the eprom until the car stops and is shut off, but that is later once i get it all built and tested