Looks impossible, Dwell meter accuracy

Now my first project, the ignition module simulator, is working, I need to build the dwell meter.
It needs to measure accurately from 500 RPM to 6000
Pick up off coil, hardware de-bounce, filtering, opto-coupled & level shifting,
Average some number of measurements
Display on the 2-line LCD every couple of seconds

Only the measurement has to be exact. I don't mind time-outs to update the display.

Quick math says it won't work.
At 6000 RPM, a 4-stroke 4-cylinder produces 200 sparks per second for a event time total of 5 mS each.
So if I want to measure the pulse width within one degree, I need about 14uS accuracy. (5 /360)

Clearly the 5mS up/down timers are not up to the job on the UNO.

Recommendations? I was thinking of the interrupts but got quite wrapped around the axle on it. Is it really bad to put all the hard work in the ISR? I was thinking using one for measuring the total cycle time ( like a tach) and the other to measure the pulse width. They would kind of alternate as ISR control came back. That is actually OK. I only need the average of a bunch of pules widths and average of cycle times, not necessarily in the exact same cycle.

Docs I read said mills was only good to 5 mS. I thought micros was only on the fast board. I'll get to work.
What do you mean about timer with no prescaler?

I see I can't reset micros, but I just do arithmetic for a running counter. I think I get it.

Just curious as to why you need such a complex solution to this. In the good 'ole days when engines had points, a simple analog voltmeter was all you needed... and the jitter of the mechanical points
made worrying about anything within +/- 5% pretty academic.

Modern ignition systems use pulses - so the dwell angle isn't meaningful.

regards

Allan

EDIT just noticed the name.. are you working on a TVR with the old Rover 3.5 engine?

If I wanted a contiuous display of dwell on a CB system I think I'd emulate the old analog meter approach...

1/ Measure battery volts with a suitable attenuator to an analog input

2/ ditto the CB with averaging capacitor and spike protection . ( clamp diodes to earth and arduino rail)

3/ divide one by t'other....

regards

Allan

1 Like

First a question, then an explanation:
Can I assign two interrupts to one pin? One HIGH, one LOW. Ironic, I need another board as my source to test the code I am working on now.

Concept is to use ISRs as the trigger measure delta between high and low, and high to next high. From these I calculate RPM and can then calculate dwell.

Got the micros() working. Seems to give +/- 8 count stability. Just close enough.

Alan,
Doing this because the classic dwell meters were simple integrators so they were correct at only one RPM, usually not specified, or "at idle". Many people just use feeler gauges and claim close is close enough, but I notice a lot of variation in idle quality. Some complain about hot coils, and various maladies I can ascribe to incorrect adjustment or combination of parts. Knowing the true charge time and looking at the combination of coil, wires, cap, rotor, and plugs on my test bench to get objective measures. The forum and "experts" are full of SOP and old wives tails. I am looking for objective design. So, combine modern microcontrollers with 50 year old cars. Why not! Of course, I need external hardware for signal conditioning and opt- coupled for safety.

I am also looking to profile some "managed" igniters in the CB Black Box, 123 tune and Pertronix units so as to select the very best ignition coil in my cars. (answer is probably the Bosch Blue for 3 Ohm and Standard 803 for 1.5)

Total scope of the project is a test unit that reads RPM, Dwell, and advance ( by way of an optical pickup attached with a magnet over the timing mark). This would be useful for all us old car owners. I am doing it as a challenge to learn to program these things before I move on to more advanced problems,

My cars are currently MGB's, but I built a 5.0 2500M in the past and am looking for a slightly larger GT-ish car with automatic and AC. I may stuff a Rover 3.4 in the B GT though.

OK...
I had a P5 years ago with the 3.5 engine, and the ignition was a problem. Interfacing the cb's with a simple (home designed and made) amplifier at least reduced contact wear to negligable proportions...

If you want to measure rpm and dwell angle via cb pulses the pulseIn() function does exactly what you need - I've used it on revcounters myself...

pulsein(HIGH,,) for the open period of the cb
pulsein(LOW,,) for the closed.

Answers in uS.

Then rpm = 60 x 1e6 / ( pulseIn HIGH result + pulseIn LOW result ) / sparks/rev

And dwell angle % = 100 x pulseIn LOW / (pulseIn HIGH + pulseIn LOW )

Easy.

check it out in the reference section.

regards

Allan

ps if you want a suitable interface circuit to safely drive an arduino input, I'll dig out one I've used a few times....

Pulse() is not fast or accurate enough being based on loop timing. It claims 10uS, but it is not that consistent. Many entries have discussed this. At 6000, the dwell is only 27uS per degree. So using the micros(), it is not quite twice the resolution. That's all I am going to get without tapping the system clock directly. I am not ready for that.

I would still like to know if I can assign two interrupts to the same pin or if I need to run the signal to both available interrupt pins. I would rather not do extra processing to test reads as this is critical real-time measurements, but it seems logical. I hope saving the counter and returning from the ISR is faster than my shortest pulse so the second interrupt will work. Arduino functions seem to have quite a bit of overhead in them.

I have also learned the system clock may not be that accurate. So this is going to take some external verification.

Curious what I found today: a total lack of decent robust interface shields to the real world. I would have thought I could find a shield with a handful of ESD/clamps and filters to assign to IO pins. Looks like I have to build one. Seems obvious to me. Not just me, as I saw the add for the robust Arduino board. Developing on the plain old UNO is fine, but that one makes a lot more sense in the real world. I see opto-couplers, but only for digital lines. Making one linear is a bit more work. ( modeled in Spice) I am going to pick up some of the AN248 or similar clamps. Maybe they are safe enough and I don't need total isolation. Very sensitive to board layout though.

tvrgeek:
So using the micros(), it is not quite twice the resolution. That's all I am going to get without tapping the system clock directly. I am not ready for that.

Doing something else and using hardware registers for timing i found that the interrupt service routine for the likes of millis() and micros() caused measurement errors about 10 % of the time.

tvrgeek:
Curious what I found today: a total lack of decent robust interface shields to the real world.

Not that surprising.
Arduino is a low cost entry system for embedded micro type design/education.

Real world of power control /automotive applications has challenges associated with it.

Example.
In the US power tails are available that make mains control safe for the amateur user.

In the UK they are only available as a kit which means they are not approved for use and can have insurance/safety implications.

Given the inherent jitter of points ( which you'll have to average over many samples to get a stable reading) , isn't +/- <1/2 degree as good as you could hope?

regards

Allan