Tacho options for a petrol dash?

An alchemy of sparks, copper wire and earth

Moderators: User administrators, Moderators

User avatar
CJH
Posts: 3018
Joined: 15 Jul 2013, 06:51
80-90 Mem No: 12576
Location: Nottingham

Re: Tacho options for a petrol dash?

Post by CJH »

bigbadbob76 wrote:It's not something I've ever done TBH.
I still don't see how to avarge out the duty cycle to produce a voltage, that's calculus teritory. :shock:
Area under the graph and all that.
If the peak voltage is constant then the avarage current must change, possibly using an inductor to smooth it would work but I'm in the dark I'm afraid.
E D I T- you could try looking at frequency to voltage converter chips, I did use one years ago in a 400Hz servo system but that's probably obsolete now.

Sorry Bob - that was my poor attempt at humour - it wasn't a dig at you.

If I was going to use this as my primary means to measure RPM or speedo rate, then it would be convenient to only have to make a single voltage measurement, so then the challenge would be to average/smooth those pulses electrically. Without that it just means I have to sample the voltage for a couple of cycles and make a numerical average. But that's doable, so it's not worth wasting any time on an electrical equivalent.

But I've been doing some quick tests with a file of 100Hz samples that I recorded on the Arduino from the signal generator. And it seems that a very simple algorithm that 1) spots the rise and fall times of a pulse, 2) averages them to get the mid-point, leads very quickly to a good estimate of RPM.

Here's a chart of calculated RPM, based on a running average of the time between pulses. You can see that it reaches a very good estimate of the engine speed within 100ms, so one tenth of a second.

Image

So I think this would be my preferred method. I'll have another go at capturing real coil pulses this evening. I'm puzzled why the pulses on pin 2 are at such a low voltage (~0.25V). Given that they've been through a 5V6 Zener diode, shouldn't they be at 5.6V? For a future implementation it would be good to not have to rely on a tacho board to get these pulses into the Arduino, so some kind of simple conditioning circuit, like the input part of the tacho board, would be ideal. According to the tacho circuit, the coil pulses pass through R7 (33k), and the 5V6 Zener to get to pin2, and there's a 3.2nF capacitor and R3 (3k3) in parallel linking the zener input to GND. Would this be sufficient as an input stage for the Arduino? What would I change to safely get the voltage up a bit?
"I'm a man of means, by no means....King of the Road!"

1983 Viking Xplorer, 2.1DJ

User avatar
CJH
Posts: 3018
Joined: 15 Jul 2013, 06:51
80-90 Mem No: 12576
Location: Nottingham

Re: Tacho options for a petrol dash?

Post by CJH »

CJH wrote:And it seems that a very simple algorithm that 1) spots the rise and fall times of a pulse, 2) averages them to get the mid-point, leads very quickly to a good estimate of RPM.

Thinking about this some more - the algorithm can be even simpler. I'm not interested in when the pulse reached its peak, I just need to know when one happened, so recording the time that the first measurement sample goes over a certain threshold should be sufficient. To protect against spurious data points I could simply make that the time of the second successive measurement sample. The RPM calculator would then be based on the interval between successive pulses. I think I prefer this approach over counting pulses in a given time window, since it's easier to detect 'outlier' intervals than missed pulses.
"I'm a man of means, by no means....King of the Road!"

1983 Viking Xplorer, 2.1DJ

User avatar
CJH
Posts: 3018
Joined: 15 Jul 2013, 06:51
80-90 Mem No: 12576
Location: Nottingham

Re: Tacho options for a petrol dash?

Post by CJH »

I found a little display in my Arduino box. It looks like it could be made to fit this space in the steering column cowling. I'll have a go at making a bezel/mount for it.

I've never got anywhere with Arduino displays in the past, but I'm more up for the challenge now.

Image
"I'm a man of means, by no means....King of the Road!"

1983 Viking Xplorer, 2.1DJ

User avatar
bigbadbob76
Posts: 1727
Joined: 07 Nov 2016, 14:41
80-90 Mem No: 15707
Location: Isle of Skye

Re: Tacho options for a petrol dash?

Post by bigbadbob76 »

No worries.
I had another think about this....
if you put a resistor coming off pin 6, then connect a capacitor between the other end of it and ground, then take your voltage sample from the R/C junction, then the capacitor will charge during the pulse and discharge during the space. The R and C values will be critical, you want the capacitor partly charged at all times.
Just smoothing out the pulses won't do it as you'd lose the data but if you can get the values right so that for a given duty cycle you get a certain charge in the capacitor that should do the trick.
As a starter for 10, try r/c values based on your pulse period, t=0.7RC, where R is in Ohms and C is in Farads.
Except that I've just noticed your pulse period isn't constant.... hmmmmm...


P.S. nice location for the display. :ok
I might put my clock there.
'86 1.9 DG, 4 spd, tintop, camper conversion.
Split case club member.

User avatar
CJH
Posts: 3018
Joined: 15 Jul 2013, 06:51
80-90 Mem No: 12576
Location: Nottingham

Re: Tacho options for a petrol dash?

Post by CJH »

bigbadbob76 wrote: Except that I've just noticed your pulse period isn't constant.... hmmmmm...

Don't worry about it. I just checked - a running average over a few cycles gives a good measure of the SAK215 output voltage, so could be used as a proxy for frequency. But I prefer to try and measure the input frequency directly - it would be independent of the calibration of the SAK215 output. So the question I'm more interested in an answer to is how to condition the coil pulses for input to the Arduino, in the absence of a tacho board.
"I'm a man of means, by no means....King of the Road!"

1983 Viking Xplorer, 2.1DJ

User avatar
bigbadbob76
Posts: 1727
Joined: 07 Nov 2016, 14:41
80-90 Mem No: 15707
Location: Isle of Skye

Re: Tacho options for a petrol dash?

Post by bigbadbob76 »

That should be easy enough, just a low value zener diode with a suitable high value resistor in series with it.
Resistor value will depend on the green tacho wire peak voltage.
'86 1.9 DG, 4 spd, tintop, camper conversion.
Split case club member.

User avatar
Cobra88
Posts: 836
Joined: 03 Apr 2018, 18:24
80-90 Mem No: 16481
Location: Ipswich

Re: Tacho options for a petrol dash?

Post by Cobra88 »

Hows the tacho board kit going?

Money burning a hole here :wink:
Rick
____________________________________________
84 CaravelleGL 1.9 DG WBX Bronze Beige Metallic auto

User avatar
CJH
Posts: 3018
Joined: 15 Jul 2013, 06:51
80-90 Mem No: 12576
Location: Nottingham

Re: Tacho options for a petrol dash?

Post by CJH »

Cobra88 wrote:Hows the tacho board kit going?

Money burning a hole here :wink:
Rick

Ready to go! The PCB has a slot for a component that isn't needed, but I'm not planning to make any more just to correct that. I suspect you and I might constitute the entire market!

Two issues:

Firstly, I don't have any more of the SAK215 chips at the moment, as I'm using both of the ones I bought. I could either put a kit together without that chip and let you source your own, or I could get a couple more in. There are various places to get these. I bought mine from here.

Second issue would be how you would calibrate the board. I could build it and calibrate it using my gauge, but I don't know for sure that all gauges will move the same amount for a given current - might depend on the strength of the spring behind the needle, which could vary from unit to unit. So if you've got a means to measure RPM independently then you could do all this yourself. If not, maybe you could send me your gauge and I could build it and calibrate it on the bench.
"I'm a man of means, by no means....King of the Road!"

1983 Viking Xplorer, 2.1DJ

User avatar
CJH
Posts: 3018
Joined: 15 Jul 2013, 06:51
80-90 Mem No: 12576
Location: Nottingham

Re: Tacho options for a petrol dash?

Post by CJH »

PS - If you don't have a means to measure RPM independently, then an option would be to get yourself one of these. But it would be £20 for a device you might never use again.

Image
"I'm a man of means, by no means....King of the Road!"

1983 Viking Xplorer, 2.1DJ

User avatar
CJH
Posts: 3018
Joined: 15 Jul 2013, 06:51
80-90 Mem No: 12576
Location: Nottingham

Re: Tacho options for a petrol dash?

Post by CJH »

bigbadbob76 wrote:That should be easy enough, just a low value zener diode with a suitable high value resistor in series with it.
Resistor value will depend on the green tacho wire peak voltage.

OK, so the tacho circuit has a 33k resistor in series with a zener. There was no information that I could find on the value of that zener, so I used a 5V6 and it seems to work perfectly. But it *appears* as though the voltage reaching pin 2 is around 0.25V. That doesn't make any sense, because the SAK215 is supposed to need more than 1V to function, and the zener ought to be passing 5.6V, didn't it? Maybe my Arduino was fooling me, or I measured it incorrectly.

I don't know what the coil pulse peak voltage is - perhaps I could start with a high value variable (say 100k) and slowly reduce the resistance until it works reliably with the Arduino.
"I'm a man of means, by no means....King of the Road!"

1983 Viking Xplorer, 2.1DJ

User avatar
bigbadbob76
Posts: 1727
Joined: 07 Nov 2016, 14:41
80-90 Mem No: 15707
Location: Isle of Skye

Re: Tacho options for a petrol dash?

Post by bigbadbob76 »

Have you got an oscilloscope? :wink:
if not, why not? :lol:
'86 1.9 DG, 4 spd, tintop, camper conversion.
Split case club member.

User avatar
CJH
Posts: 3018
Joined: 15 Jul 2013, 06:51
80-90 Mem No: 12576
Location: Nottingham

Re: Tacho options for a petrol dash?

Post by CJH »

I have not. And I have no intention of getting one either because 1) I'll never use it again after this little project, 2) My house is already creaking under the weight of gadgets I no longer need.

I assume you've got one though. And a coil that makes pulses, and some 5V6 zener diodes...... (Reason 3 :wink: )
"I'm a man of means, by no means....King of the Road!"

1983 Viking Xplorer, 2.1DJ

User avatar
bigbadbob76
Posts: 1727
Joined: 07 Nov 2016, 14:41
80-90 Mem No: 15707
Location: Isle of Skye

Re: Tacho options for a petrol dash?

Post by bigbadbob76 »

Ok. Hint taken. I'll scope my van for you.


Sent from my iPhone using Tapatalk
'86 1.9 DG, 4 spd, tintop, camper conversion.
Split case club member.

User avatar
CJH
Posts: 3018
Joined: 15 Jul 2013, 06:51
80-90 Mem No: 12576
Location: Nottingham

Re: Tacho options for a petrol dash?

Post by CJH »

bigbadbob76 wrote:Ok. Hint taken. I'll scope my van for you.

:ok

I'm not sure how successful this 'time the pulse intervals' approach is going to be for the digital tacho after all. I managed to implement the algorithm quite quickly, and using my signal generator as input to the Arduino it gives a reasonable result, even using every individual pulse interval to calculate a separate RPM. A better implementation would smooth 10 or 100 of these values to get a nice stable result.

Image

I then spent aaaages getting the little LCD to work, and when I did, I found that the screen writes are so slow that the RPM calculation is seriously affected. So I'd need to find a clever way to update the screen at a lower rate, and pause the RPM calculation while the screen is updating, so that the numbers aren't affected.

And I think that's the whole problem with trying to measure pulses that are coming in at a high rate. Whatever else I do in the program seems to affect it's ability to count the pulses reliably. I suspect that even doing a bit of averaging will interrupt the process. So perhaps I'm back to measuring a voltage again. I'm not sure - will have to think about this.
"I'm a man of means, by no means....King of the Road!"

1983 Viking Xplorer, 2.1DJ

User avatar
bigbadbob76
Posts: 1727
Joined: 07 Nov 2016, 14:41
80-90 Mem No: 15707
Location: Isle of Skye

Re: Tacho options for a petrol dash?

Post by bigbadbob76 »

hmmmm.... not easy. I'm no programmer but I think you have to do it with interupts.

Here's the scope plots anyway-

5v/division, x10 probe, so 375V pk-pk.
no wonder it tingles. :lol:
Image

And here's one at 4KRPM to check my tacho, uncalibrated scope (expired 2002) so don't believe it too much
7ms=143Hz=4290RPM.
or 7.2ms if you use the glitch=139Hz=4167RPM.
Doesn't help matters. :roll:
Image
'86 1.9 DG, 4 spd, tintop, camper conversion.
Split case club member.

Post Reply