PDA

View Full Version : Adapting signal from Motorcycle crankshaft position sensor.



JustinSS
12-03-2009, 12:58 AM
I usually try to learn on my own but this is driving me crazy.

I am working on data logger for my motorcycle to help with my riding and only have one main hurdle. I am working at measuring the RPM by tapping into the crankshaft position sensor. It puts out an signal that is AC voltage with a varying frequency which is related to the actual RPM. So far I have run it through a rectifier so I could get a DC voltage then I passed it through a voltage divider circuit to bring it down to levels I could deal with more easily. Currently I get around .4v at idle (1300rpm) and around 6v at redline (18000rpm).

So far I was able to read the frequency of the signal by adding 1.2volts inline with it to get over the 1.4v logic threshold. It works nice and steady like that. The only issue is that it will be around 7 volts or more when going into the STAMP when I approach redline. I would prefer to either limit the output voltage to 5v or to use something else to take the varying signal and output a 5v signal. I looked at using an Op-Amp as a comparator but I'm not so sure. I am learning all of this stuff as I go so I am not all that knowledgeable about this stuff.

Any ideas would be appreciated.

Thanks,
Justin

Larry~
12-03-2009, 02:01 AM
Justin
I would get rid of the voltage divider and feed the diode output·into a 4n25 or some other optical isolator
And you should get a nice steady 5-volt output or what ever you feed into the output stage.

It would be nice to know what the output is without the voltage divider!
I think the 4n25 can take about 30 to 50 volts using different input resistors.

Post Edited (Larry~) : 12/2/2009 7:06:18 PM GMT

JustinSS
12-03-2009, 02:16 AM
The signal is around 5v to 60v or so. I have it all worked out in a notebook at home.

Larry~
12-03-2009, 02:57 AM
Ok as always I should take a second look you said 18000 rpm ( wouldn't want my butt anywhere near that )
4n25 is only good for 10000, so a different·opto needs to be used you still may get it with one resistor or you may need the voltage divider
having 5 to 60 volt spread,·its really odd that the voltage would change that much. turn on the headlight and check the output again does
this·motorcycle not have a voltage regulator on it?

God I must be stupid today the 4n25 will work its 10000 per second not minutes

Post Edited (Larry~) : 12/2/2009 8:05:53 PM GMT

JustinSS
12-03-2009, 03:14 AM
The sensor is what creates the voltage. It generates electricity as the sprocket type wheel turns on the end of the crankshaft. The ECU does some magic and reads the signal. I may try a zener diode limiter circuit when I get home.

allanlane5
12-03-2009, 03:30 AM
I believe, if you use a 20 Kohm in-line resistor to limit the current, you can use the "COUNT" instruction to read the frequency more-or-less directly, using the BS2. Maybe a 100 Kohm resistor might be better.

The BS2 has internal over and under-voltage diodes to protect the I/O pin -- but these diodes are limited in the current they can conduct. Thus the need for an in-line series resistor of 20 Kohms to limit the current. The BS2 will then see a 'clipped' version of your oscillating voltage, which the COUNT instruction can count.

JustinSS
12-04-2009, 09:07 PM
Thank you for the ideas. I thought about it more and then went and got a different Op-Amp from Radio Shack. I set is up as a comparator circuit and it works great now. So now I have the signal from the bike going through a rectifier then to a voltage divider then to a comparator which gives me a nice 0v or 5v signal at varying frequencies. I am really just using the Stamp as I test out the different sensors I am working on, this is all going to a Propeller later but I don't want to mess up my Propeller board while I am experimenting.