variable reluctance sensor - signal delay

I learned something today. I learned that a variable reluctance sensor cannot be simulated with a square wave using an Arduino digital output. This will sound obvious to anybody familiar with a variable reluctance sensor (VRS).

The VRS specifically is the crank position sensor on an engine. The problem I'm trying to solve: delay the VRS signal by a precise but variable amount of time. I'm posting here as a place to write my thoughts down, and with the idea that we can brainstorm together on a solution.

My mind has started toying with ideas about op amps, or a passive electronic circuit that delays depending on a capacitor's charge. Or maybe a DAC.

The output will need to swing +/-5 volts @ 5kHz. The input could be as low as +/- 0.6V apparently. (I'm trying to gather up scope traces of the sensors actual output.)

I'll post more as I think through this. In the meantime if anybody has suggestions or wants to generate some discussion, fire away.

The problem I'm trying to solve: delay the VRS signal by a precise but variable amount of time

Are you trying to put a delay between the sensor and the engine controller?

Yes.
For clarity, I'm delaying the sensor signal to the stock engine ECU using the Arduino.

I'm delaying the sensor signal to the stock engine ECU using the Arduino.

For what purpose, I'd like to know.

I learned that a variable reluctance sensor cannot be simulated with a square wave using an Arduino digital output

Are you saying that because there are little "blips" in the output?

PaulS: Purpose for delaying the timing signals is to trick the ECU into delaying the ignition signals while there is positive pressure in the intake manifold. End-game for this is a supercharger install that delays ignition to avoid engine knock.

Coding Badly: What I learned about VR sensors is that their output fluctuates above and below 0V. And that during low engine speeds the output signal can have peaks as low as 1V; too low to trigger the Arduino digital input. So I suppose it would be more accurate to say that a VRS does not always produce an output that is useful as a digital input. Still speculating on this a little as I've yet to see a scope trace of the VRS output under various engine speeds. And I'm open to the idea that a 0-5V square wave output might still be useful all the same to the stock ECU, but I suspect it's the low signal level in particular that is the issue.

Sorry this is seeming a little rambling. Too many unknowns and new thoughts right now.

the output signal can have peaks as low as 1V; too low to trigger the Arduino digital input

Got it.

Sorry this is seeming a little rambling

No need to apologize. I certainly can't speak for the other folks here but I love reading about the interesting things people do or are fixin-to-do with the Arduino.

Well without a scope, I did my best to turn the Arduino ADC into a scope and I have some results. What I suspected appears to be true; that at low engine RPM (i.e. when cranking to start the engine) the signal from the cam/crank VR sensors is near 1V. Further, it looks pretty far from a square wave, although the resolution of the Arduino ADC is nothing to get excited about.

Here are some of the important excerpts from some Arduino code I wrote for the acquisition...

ISR(ADC_vect) { // Analog->Digital Conversion Complete
  static unsigned int cnt = 5000;
  byte result = ADCH;
  if (result > 15) {
    myDataLogger.Store(result, TCNT4);
    cnt--;
  }

  if (!cnt) 
  {
    ADCSRA = B00001000; // ADC disable, trigger off, ADC interrupt enable, prescaler = 2
  }
};


void loop() {
      ...........
      else if (strcmp(SerialCmd, "StartADCLog") == 0) {
        mySerial.println("ADCLOGSTART>");
        myDataLogger.Enable();
        lcd.cursorTo(0,0);
        lcd.printIn("ADC log ON...      ");
        
        // setup ADC
        ADMUX = B01100111;  // default to AVCC VRef, ADC Left Adjust, and ADC channel 7
        ADCSRB = B00000000; // Analog Input bank 1, Free Running Mode
        ADCSRA = B11101000; // ADC enable, ADC start, ADC interrupt enable, prescaler = 2
      }

  .................

  if (myDataLogger.IsEnabled()) {
    myDataLogger.TransmitADC(500);  // transmit max 500 messages at a time
  }

}

Notes: myDataLogger is a class I wrote that sets up a 2 kilobyte ring buffer and dumps the data out over serialport. This was a solution for getting lots of data for short periods of time off-chip (effectively avoiding buffer over-run by using a bigger buffer).

The output of the data logging can be seen in this excel file...
http://www3.sympatico.ca/mikehoughton/cam%20crank%20ADC%20signals.xls

Note that I'm extracting only ADCH -> 8-bit conversion, but I see that while cranking the output of the VR sensors registers at ADCH = 50. Aref is set at Vcc so this represents about 1V.

Another note, if you're looking at the excel data, there was an unmeasured time delay between the cranking and the 3kRPM data while I saved the data and restarted the log (re-issued "StartADCLog").

[Edit: Another-other note, of course this ADC is only capturing +ive voltages. Any negative voltage swings register as 0, and even still I'm dropping every ADCH value below 15 anyway to try and minimize buffer over-run. Getting data off-chip fast enough for this app is a real problem.]

I think I'll need to find a scope to get a cleaner picture of what's going on.
Thanks for the words of encouragement CB. I appreciate others sharing too. I guess I'll let this turn into some form of a diary while I work through this issue.

We used a lot of variable reluctance sensors as speed pick-up sensors in the oil refinery I worked at. They are passive 2 wire sensors that were usually screwed into a motor or compressor body such that the sensor's tip would be about .020" from a turning gear. The standard interface for these sensors was a schmidt trigger op-amp with a little positive feedback applied so it wouldn't respond to noise when the machine was idle. A Schmidt trigger would start to respond at pulse amplitude of just a few tens of millivolts and would give a nice clean TTL output signal for the rest of the control system to utilize. They were a very reliable sensor and would last forever, unless one screwed them too far in and ground their face against the gear wheel. :wink:

Lefty

1 Like

Thanks Lefty. That's helpful.

I took a voltmeter to some of the engine wiring. I found +13 mV on both +ive and -ive wires of the VR sensor wrt vehicle ground, and 1000 ohms across the sensor. I'm suspecting that this bias is present so that 0V/gnd is sufficient to trip a presumed Schmitt trigger OFF without requiring a negative voltage.

Rather than adding hardware to my PCB, I'm considering simply using the ADC at startup to capture the low & slow voltages generated by the VR sensors. I'll write some logic to drive digital outputs based on the ADC results until ignition catches and the VR sensors are generating decent +5V signals.

I was also considering the Analog Comparator on the 1280, but AIN0 isn't pinned out. Anybody know what it's connected to at the board level?

I've been busy the last couple of days... learning.
I got a few more data logs of the VRS signals using arduino ADC. I optimized the serial data being sent and came out with much cleaner data.
However, along with other mucking around I've discovered that the -ive side of the signal is also required at the engine ECU. So the square wave that the Arduino converts the signal to is insufficient. The engine did start, stumbled, and stalled so I suspect that 0V is at or very near the required voltage to switch OFF a schmitt trigger inside the black-box of the engine ECU. I also tried eliminating the Arduino and installed a diode inline with the stock VRS wiring; effectively blocking the -ive signal (and a 10k shunt to ground to kill the Vfwd of the diode). Same/similar result.

The way the engine runs could easily be explained if a few of the OFF signals from the VRS are missed/late.

So now I believe that I'll need a -ive voltage source in order to swing the signal far enough to guarantee OFF.

I found the MAX635 which looks like the simplest solution, but still requires a couple of external components. Any single-chip solutions anybody is aware of for generating a negative voltage?

More learning has occurred... about inductors, about LR circuits, and a refresher on differential equations. (It's tough to be a mechy in an electrical playground sometimes.)

The solution I've come up with will be pleasingly simple/cheap if it works. Use Arduino +5 digital out (through a series resistor) to drive the positive side of the wave form into the Engine ECU, and also an inductor in parallel shorted to ground. When the Arduino digital out switches off the inductor should briefly pull the voltage at the ECU input negative while it de-energizes.

In hindsight this seems obvious: inductance is exactly the property of the VR sensor that creates the signal in the first place.

Digging up my old thread...

I somehow got it in my mind (incorrectly) that the Arduino digital input pins were protected for up to 30Vdc. The datasheet for the ATmega clearly shows absolute max rated voltage is Vcc + 0.5.

Now I'm concerned that the Variable Reluctance sensor I've connected is exceeding this max voltage rating. I've read VR sensors generate voltages as high as 50v. But they aren't exactly high current sources. So I'm unsure what the real voltage is at the digital input pins.

The VR sensor in question has a resistance across it of 2500 ohms. The sensor output is connected directly to two Arduino pins in parallel (one digital input, one analog input). The sensor output is also shunted to ground through a 10k resistor. Lastly a Schottky diode is connected between the sensor output and ground that breaks down at 20v (originally this was to keep the voltage below 30v which I wrongly thought was the max permissable).

Anybody have enough experience with VR sensors to understand if the output voltage & current generated is high enough to damage an Arduino?

My quick figuring... 20v / 2500 Ohm = 8 mA -> the VR sensor will source 8mA max.
This seems small but I don't understand whether it's voltage or current that damages an input pin.

Anybody know of a DO-41 package that will break down at 5v?

I've never seen a passive two terminal variable reluctance sensor wire directly to a micro digital or analog input pin. They always require a high gain schmidt triggered comparator op-amp interface that will clamp the output to 0 or +5vdc regardless of the amplitude of the sensor pulses.

Lefty

Well... so far it's been functional (directly connecting VR sensor to Arduino inputs), but perhaps not for long. Any further comment whether this is actually potentially damaging to the ATmega1280?

Looking further on, I came across the Max9924 as an interface IC. I don't have a lot of PCB space available though and my soldering equipment and skill right now dictates a DIP package. If there are any smaller pin count solutions I'd welcome a list of part numbers.

Or maybe it's finally time to bite the bullet and fab a custom PCB.

wait, I am having the same problem. VRS keeps on blinking on my system. If VRS is the crank position sensor, then my dad's intuition is correct. Is there any other way of obtaining sa CPS?