pulsin command returning zero problem (Car Tachometer Project)

Equinox

New Member
Hey.

I'm trying to read the value of the tachometer signal on my 4cylinder car from the ECU. I fed the line into pin 1 of a Picaxe 8M and am using the pulsin command to read the time inbetween each pulse to then ulimately use to derrive the rpm.

I'm having a problem however. I read the value from pulsin and then debug it, and at idle rpm, the variable reads around 2800 and is fine. If I raise the rpm slowly to around 1200rpm, the vairable reads around 2200, but if I go any higher in the rpm range, the variable starts reading zero instantly, instead of dropping onto the 1000s as expected.

Code:
main:
pulsin 1,1,w1
debug w1
pause 500
goto main
Any one have any ideas?

Thanks :)
 
Last edited:

Dippy

Moderator
Right Equinox. If you used this Forum for any time you will see that requsts like this will produce pages of gloom'n'doom about connecting home-brew electronics to car electrics.

So, take the warnings as standard-issue. And take it seriously.
Connecting a PICAXE input directly to an ECU could be damaging. And if it goes pants in the garage that's fine. If it goes pants down the motorway/freeway then oh dear.

POST your schematic for advice. Are you an electronics NOVICE? (I'm not talking about car electrics, I'm talking about electronics).

Have you 'scoped it to check voltage level of ECU pulse? It must NOT be much more than 5V. No nasty spikes.

Have you used a 'scope to see actual change in pulse length?

Is there electrical noise/interference on the signal or power or ground lines? Have you 'scoped them?

What is the power supply to your PICAXE? Have you decoupled at the PICAXE power pins?

Have you got the 'state' variable option correct?
 

Equinox

New Member
I wouldn't call myself a novice, but I wouldn't call myself experienced either.

The voltage of the ECU pulses are 5.5V, and I've stepped these down to around 4.3V at the Picaxe. (Added a diode as well to stop the Picaxe sending stuff back up to the ECU) I have scoped the pulse. It's a near perfect square wave.

I havn't scoped the power source no, and I probably should. The Picaxe is connected to the car's power supply via a voltage regulator circuit. De-coupled? What you mean by that?

And where do I find the state variable option?

Thanks for your help.
 

Dippy

Moderator
Well, the 'state' variable is one of the parameters in the Pulsin command you used. It gets a mention in the manual.

De-couple is a term usually used to describe a capacitor or capacitors placed right next to the i.c. power pins. Usuallly a smallish electrolytic and ceramic in parallel. (Generally, It is to (try to) prevent one part of a circuit seeing signals produced elsewhere).

A simple voltage regulator on it's own may not be good enough to tap off from vehicle 12V. You may need suppression as well. It is VERY important to 'scope the 12V supply to check for noise/transients/spikes etc and apply suppression. And check as you increase the revs.

"It's a near perfect square wave."
Ambiguous. Do you mean its a near-perfect logic pulse stream? Does the pulse-width / duty cycle change with revs. OR do the UP times stay constant and the time between UP bits change? Does the frequency and duty cycle change? Or dos F change and duty-cycle remain constant? - That is why I asked about the State variable as I've never scoped an ECU and I don't know if they vary between manufs anyway.

What's the slowest pulse rate? Can you use Count function?

If the power-supply or signal lines are noisy I think you'll have to sort that out before sorting the code. And if your electronics is fitted near something noisy then you have to consider a screened box too (personally I'd do that by default).

I could have sworn this topic has been covered numerous times - have you tried searching???
 

Vmax

Member
Using pulsin may not work this way without a flipflop. Pulsin measures the width of a pulse. To measure RPM you need time between pulses. If you‘re using a picaxe on car electronics, you can try adding an optoisolator to prevent nasty spikes from reaching your picaxe.
 
Last edited:
Top