Speeduino is now on Github Sponsors (Rather than Patreon): https://github.com/sponsors/noisymime
Any questions you have before you begin buying, building and installing.
By pazi88
#47810
This seems to be constant topic of trouble, so hoping that this post would clear up things related to VR-polarities and rising/falling edge trigger setting.

But as for start there is two main types of crank/cam sensors used in engines. VR and hall. There is others too, but lets not go to that rabbit hole now. VR-stands for Variable Reluctance and in practice it creates analog sine wave signal in which the frequency and amplitude varies depending on the engine rotation speed. You can read more from wikipedia: https://en.wikipedia.org/wiki/Variable_ ... nce_sensor

In the sine wave VR-signal, the zero-crossings mark the center of the tooth's and center of the pits between tooth's. And the depending on the VR-polarity, the signal can be going towards positive side at the center of the tooth or towards negative side. This is good picture showing that:
Image

This analog sine wave signal isn't something that the Arduino mega in Speeduino can directly read. We need to condition the signal to 5v square wave and for that we use VR-conditioner. In this write up I use max9926 VR-conditioner, because I know it best. Caveats regarding to others can commented below. Maxx9926 has inverting open collector output that triggers at zero crossing. It means that in normal state, the output is floating, so basically behaves as wire connected to nothing. When the input sees the VR-signal going from zero to positive direction, it inverts the signal and grounds the output. So it's basically same as wire connected to ground. When the VR-signal goes back down from positive side and crosses the zero voltage line, the output again goes floating. This alone isn't doing much, but once we add pull-up resistors to the outputs, the resistors "pulls" the output voltage to 5v when it's in the floating state.
Image

These pull-up resistors are generally included in the vr-conditioner boards, so you don't need to care about that. The main thing is that with those resistors, we get inverted 5v square wave signal out of the max9926 VR-conditioner. Now we input that square wave to speeduino processor and need to select the falling rising edge setting in TS. If we use the "correct" polarity for the VR-sensor, it means that the center of the tooth is at the zero crossing when VR-output signal is going towards positive side. Because the max9926 is inverting output, it means that the signal goes from 5v to 0v at the center of the tooth. So in TS we need to select falling edge setting to make the speeduino trigger at the point when the signal "falls" from 5v to 0. On the other hand if the VR-polarity is reversed, the VR-signal to the conditioner is mirrored. And that means that we need to select the rising edge setting in TS, to make it trigger when the signal voltage "rises" from 0v to 5v. NOTE! DSC VR-signal conditioner is non-inverting, so it requires opposite trigger edge than max9926 compared to VR-polarity
Image

This is how it looks on actual scope. NOTE: the VR-signal is accidentally reversed in this pic: https://pazi88.kuvat.fi/kuvat/Projektik ... 203646.jpg

Ok, then comes the question that how do I know to select rising or falling edge if I don't own a scope. Well for that you need registered TS version and go to "Diagnostics & High Speed Loggers" -tab. There in composite logger, you should see this kind of view, when you log while cranking/running the engine:
Image

Those bars represent time between each trigger point. This is taken from 60-2 crank trigger and there should be one bar that is three times the length of the others marking the 2-missing tooth. But now we have two slightly longer ones. What happened? This means that the VR-polarity is wrong or the falling/rising setting is wrong. It's now triggering to the center of the pits between the teeth. To make this clear that why you are seeing those two longer bars, here on green is where the ecu is triggering:
Image

If we reverse the VR-wires OR change between the rising/falling setting, we get this where there is one long bar for the 2-missing tooth and ecu can easily sync with the engine:
Image

Okay, what's the deal with the claim that you should use falling edge trigger with this or that VR-condtioner or rising edge with other one. Well let me explain. In speeduino the signal from VR-conditioner doesn't go directly to the arduino mega input. There is filter capacitors in the line too:
Image

These serve good purpose, and as name says, those are meant to filter out unwanted noise in the signal input. But in case of max9926 vr-conditioner, there is that pull-up resistor that was mentioned earlier. When pull-up is used, the capacitor is charged through that 1k resistor, but it's discharged by basically short to ground when max9926 output is active, so there is no resistor slowing down the discharge current. This causes that once the engine RPM gets higher with the high res triggers (like 60-2), the square wave isn't anymore square, but more like shark fin shaped on the rising side:
Image

The mega input has specific thresholds for low and high input level. The rising slope in the signal can cause that the high threshold isn't reached immediately when the signal starts to raise but slightly later (see previous pic). And this can cause same timing drift what can be seen as retarded timing at higher RPM. Here is an example when the retard in ignition starts to be about half the tooth width (closer to 2 degrees in 60-2):
Image

To prevent this from happening on higher resolution trigger wheels, it's recommended to use falling edge trigger instead of the rising edge. And if you see the wrong crank signal on the composite logger with falling edge tirgger, swap VR-polarity, instead of using rising edge.

Ok, then little about hall-type sensors. With those, you don't need to care about VR-polarity. You can select the rising or falling basically freely if your trigger wheel is traditionally shaped. The selection just affects that do you trigger at the start of the tooth or at the end of the tooth (hall sensors don't trigger at the center of the tooth as vr-sensors do). And you just need to match the trigger angle to which one you select. But there is also same thing with hall sensors as there is with max9926. Many hall sensors have also open collector output so you need to activate the pull-up on the speeduino board. And that makes the hall sensors prone to same timing drift problem as VR-sensors when using rising edge trigger. And wait! It gets worse! If you need to use the pull-up on the speeduino board, it means that the filter cap is now charged through the 1k pull-up resistor and also the 1k protection resistor. So it's actually charged through 2k resistor:
Image

So that makes the rise time of the hall signal even slower. So slow indeed that with high resolution trigger wheels (like 60-2) you might see problems that the crank signal doesn't reach the high threshold on the processor input and you will have sync losses at higher RPM. In this case, you need to swap the crank trigger filter to smaller one.
User avatar
By Kenai
#47818
Great info here!
thats good to work with 0.4 type boards, but i've seen other boards that lacks the 1k resistor on the Vr1+ input, also lacks the filter capacitor.
In your experience which is the best circuit to use?
User avatar
By PSIG
#47822
Thanks for the description, and may I suggest in looking for simple clarity for new users; but it may be confusing to readers with unclear images to see the relationships? For examples, the first image of VR polarity (pos and neg) does not clearly show the correct one to use (modified example below), and the 'scope image shows both reverse polarity (not desired) and non-inverted conditioner output (not MAX type, if that was your intent).

Synopsis - we want to read the physical falling edge of the teeth for proper pattern timing. With correct VR polarity, the VR signal should also be falling voltage with the falling tooth edge. That's it. From here, the signal conditioner type either inverts or does not invert that falling signal, so TunerStudio is simply set to read Rising if the conditioner is inverting the signal, or Falling if it is non-inverting. The default TS settings are placeholders only, and not set for any specific hardware setup.
  • Inverting conditioners (MAX, LM1815, etc): VR wired Positive output to VR+, TS set to Rising Edge
  • Non-Inverting conditioners (DSC and others): VR wired Positive output to VR+, TS set to Falling Edge
It is important to note (for reasons given by @pazi88) that incorrect VR polarity with backwards conditioner setting to compensate may log OK, but is NOT correct, and is prone to problems. One explanation is here, which shows only one synchronous polarity and edge that is most stable, of four that are possible.

TL;DR, except in rare cases; VR sensor always wired positive, and TS setting by conditioner output type. Done!

Concept of clarity if it helps. Note the wave shape relative to the tooth edge:
VR_polarity_OK-NO.png
VR_polarity_OK-NO.png (40.17 KiB) Viewed 794 times
By pazi88
#47825
I was waiting for PSIG to comment on this :D . Yes, I have read this multiple times and that caused me to build my own test setup to lab with 60-2 trigger wheel that I could rev high and do experimenting on real HW of these VR-setups. The effect mentioned in that link that the zero crossing from negative to positive side might be adaptive is even shown in max9926 datasheet.
Image

But I was having really hard time to see that actually with the scope. In a matter of a fact, I couldn't really measure how much error that causes for the trigger in the setup with max9926 and cheapo scope. It must be somewhere around 0.1 degrees of ignition timing error or less. Also I don't see any jittering or other uncertainties regarding the zero crossing triggering from negative side to positive side, so the small error in there is probably static . This is also mentioned in the link you posted:
The error may be minimal because the rate of change of the zero-crossing signal will be high. Variations will also likely be of a static nature, which tends to be an error that is inherently compensated for with calibration.
So keeping that on mind, did you check the end of my post about what the combination of pull-up in the max9926 and crank filter cap does? Because of that I must disagree with this statement:
PSIG wrote:
Mon Jan 25, 2021 10:51 pm
TL;DR, except in rare cases; VR sensor always wired positive, and TS setting by conditioner output type. Done!
If the VR-conditioner has push-pull output (BTW does the DSC has?) there is non of that effect and yours statement is true. But the max9926 uses the pull up and depending on the trigger wheel and RPM that can cause something like 0 to 2 degrees of timing error when rising edge trigger is used. It was even 0 to 3 degrees when using hall sensor and after that it started having sync losses (which is quite obvious if you think about it because of 60-2 trigger wheel). So with max9926 at least you can't get the VR-sensor arrangement perfect. You either have the maybe 0.1 degree error from wrong VR-polarity or the 0-2 degrees of error from using the rising edge trigger. So that's why I wrote that in case of speeduino it's best to use the falling edge trigger and match the VR-polarity to the conditioner in the speeduino.
By JHolland
#47827
pazi88 wrote:
Tue Jan 26, 2021 7:12 am
But I was having really hard time to see that actually with the scope. In a matter of a fact, I couldn't really measure how much error that causes for the trigger in the setup with max9926 and cheapo scope. It must be somewhere around 0.1 degrees of ignition timing error or less.
How much current were you pushing into the Max? it takes quite a bit to over-drive it
By pazi88
#47828
JHolland wrote:
Tue Jan 26, 2021 8:19 am
How much current were you pushing into the Max? it takes quite a bit to over-drive it
Current? Not sure what you are asking. I was trying to measure the difference in the zero crossing from negative to positive side and the difference in the output trigger edge. Not overdrive the max9926. Anyways the voltages to the VR-conditioner circuit input were less than 50v peak to peak.
User avatar
By Yoosyn
#47878
Subaru 6/7 with two VRs. Both VR- are by OEM tied together to the ground. Currently it is working with RISING edge (MAX conditioner) and timing is spot on, but there is about 4degree drift at 4-5k rpm. When I change to FALLING timing is 10-12 degree off. I don't check drift. Can I swap polarity so at VR+ imput there will be ground and at VR- signal?
Btw GREAT writeup!
By pazi88
#47882
Yoosyn wrote:
Thu Jan 28, 2021 10:21 pm
Subaru 6/7 with two VRs. Both VR- are by OEM tied together to the ground. Currently it is working with RISING edge (MAX conditioner) and timing is spot on, but there is about 4degree drift at 4-5k rpm. When I change to FALLING timing is 10-12 degree off. I don't check drift. Can I swap polarity so at VR+ imput there will be ground and at VR- signal?
Btw GREAT writeup!
Thanks! Subaru 6/7 seems to be quite low res trigger so that rising edge trigger selection should not be problematic. It only becomes problem with higher resolution triggers. But looking at the scope traces, it looks like that it's really important that the trigger edge selection matches the VR-polarity. Otherwise you will see all kinds of weird behavior. Unfortunately don't have experience on that trigger pattern, so don't know how it should look like in composite logger. Do you see the 4 degree drift if you select the FALLING even though the base timing is 10-12 degrees off? If there is no drift by RPM with that, and no sync losses or other problems, I would just match the base timing to match with the edge set to falling.
User avatar
By Yoosyn
#47887
pazi88 wrote:Do you see the 4 degree drift if you select the FALLING even though the base timing is 10-12 degrees off?
I didnt test it. I guess I should :) Here is screenshot Josh post 2018 when he was working on it.
0aR4gIJ.png
0aR4gIJ.png (94.09 KiB) Viewed 502 times
And here is mine:
paralell.png
paralell.png (66.51 KiB) Viewed 502 times
Do you think swapping polarity and putting it on falling will make it similar?

Great, I might buy one now

Simple diagram for 2ch Bosch 200 ignitor

CLT sensor wrong reading

Once again as above. You need to find and fix you[…]

Kawasaki Concours 2.0

Going bonkers trying to wire up a Bosch LSU4.9 to […]

Still can't find what you're looking for?