needlenose
Full Access Member
Maybe I'm over simplifying it, but for calculating RPM, it doesn't matter how many strokes occur. Since the hall interrupt happens once per rev, all that matters is how many interrupts the device sees in 1s. Value * 60 gives you RPM. If the device receives an injector interrupt *between* hall interrupts, it calculates the time between injector interrupt and the following hall interrupt. (reverse if the probe is on the other side)
If the hall is pulsing at 33.3Hz, then
33.03 * 60s = @2KRPM
30.03ms / 360deg = 0.0834167500834ms. So every 0.0834167500834ms the crank moves 1deg.
So if the 2 preceding hall interrupts were 33.03ms apart and in the next cycle a piezo interrupts occurs 0.750750750751ms before the hall interrupt, then 0.750750750751 / 0.0834167500834 tells you the injector is firing 9deg advance of TDC.
It can also be done using the preceding hall interrupt with the previous interrupt-to-interrupt time in which case you are working from the other direction.
Of course everything should be fed through a hysteresis to smooth the results or your numbers will bounce around so fast you can't read them.
Obviously you would have to calculate in the offset value if the hall is positioned before or after true TDC. This is how I see the software working, first thing in the morning while I wait for grandma to come watch the kids who are spewing diarrhea and vomit so I can leave for work.....
If the hall is pulsing at 33.3Hz, then
33.03 * 60s = @2KRPM
30.03ms / 360deg = 0.0834167500834ms. So every 0.0834167500834ms the crank moves 1deg.
So if the 2 preceding hall interrupts were 33.03ms apart and in the next cycle a piezo interrupts occurs 0.750750750751ms before the hall interrupt, then 0.750750750751 / 0.0834167500834 tells you the injector is firing 9deg advance of TDC.
It can also be done using the preceding hall interrupt with the previous interrupt-to-interrupt time in which case you are working from the other direction.
Of course everything should be fed through a hysteresis to smooth the results or your numbers will bounce around so fast you can't read them.
Obviously you would have to calculate in the offset value if the hall is positioned before or after true TDC. This is how I see the software working, first thing in the morning while I wait for grandma to come watch the kids who are spewing diarrhea and vomit so I can leave for work.....