Click here for MegaSquirt® MegaManual™ Information, Guides, and Links

MegaSquirt-II GPIO VR Input Circuits

The GPIO board has four VR inputs based on Bruce Bowlings's EasyVR schematic with discrete components.

Circuit
CPU Port
AMP pin
number
VR1PT02
VR2PT615
VR3PT514
VR4PT729

The variable reluctor circuits have only three transistors, a diode, two caps, and 9 resistors. One can view a grounded VR sensor the same as an unbalanced audio microphone, for which there are a ton of circuits like this one. This is a simple DC-coupled transistor amplifier circuit.

This circuit takes the signal from a variable reluctor (VR) sensor. The VR sensors have an alternating current (AC) signal that needs to be conditioned (transformed into a DC square wave) before it is suitable for the processor.

Here is a quick explanation of the VR circuit operation: the VR sensor feeds into R1 for attenuation, followed by R2 and the "speedup capacitor" C1. D1 prevents transistor damage from the negative VR signal cycle. C2 shunts real high frequency noise to ground.

R9 biases the base of the transistor, with the help of the 2 MegaOhm resistor (R3) from base to +5V (R3). R3 is a 2 MegaOhm resistor which forms a voltage divider circuit with R2, R1, and the VR sensor resistance. What this voltage divider does is bias the base of NPN transistor Q1 somewhat.

R9 is the other leg of the voltage divider, it is a 300K ohm resistor. What this does is work with the 2M resistor to make up a voltage divider. The junction point is roughly 0.6 volts ( 5 volts * 300K/(2M + 300K) ). What this does is bring the base voltage up to this level. The input VR voltage is basically added to this, it is in fact a DC bias. The transistor has a base-emitter voltage drop of 0.7 volts before it can conduct. So the divider helps overcome the voltage drop, otherwise the sensor itself would have to put out at least 0.7 volts before the transistor started conducting.

This is a standard bias arrangement used in all transistor amps, what it does is bias the base up from ground a bit, in this case roughly 0.6 volts. The Vbe drop is right around 0.7 volts, so what this bias does is assist the VR sensor from having to overcome the Vbe drop. It's not enough to source current thru the B-E junction, this comes when the VR sensor generates a current in the positive direction (after it passes thru the series resistance R1 and R2). With the values here, the VR sensor voltage trigger threshold (assuming no VR sensor impedance, which is not true) is right around 0.5 volts or so. There is a slight temperature coefficient effect here but this will only change things in the few millivolt range.

Q1 amplifies the current which is direct-fed into Q2 base. Note that R4 and R5 also bias Q2 but with much more steady-state current. Q2 then further amplifies the signal and at this point the signal has a significant current gain, which feeds a saturated transistor switch Q3. The output of Q3 is pretty much a digital switch from 5V to 0.7 volts, this can be presented to a processor input capture port.

The falling edge is the trigger edge for this circuit (for the V3 circuit it is the rising edge). The other edge direction is not as clean.

C1 is known as a "speedup capacitor". What this does is help give an added boost to the base current during transitions in order to make the transistor turn on (and off) quicker. This is a trick used often in transistor pulse circuits. See this link for more info.

Absolutely nothing is critical for components in the VR circuit. The 2N3904 is specified, but virtually any NPN transistor will probably work, like a 2N2222.

ComponentDefault ValuesMarkingNotes
R110 Kbrown-black-orange1/2 Watt
R2220 Kred-red-yellow
R32 Mred-black-green
R4100 Kbrown-black-yellow
R533 Korange-orange-orange
R610 Kbrown-black-orange
R710 Kbrown-black-orange
R84.7 Kyellow-violet-red
R9300 Korange-black-yellow
Q12N3904TO-92 package
Q22N3904TO-92 package
Q32N3904TO-92 package
C1470 pF
C247 pF
D11N4001

The VR sensor is an induction type sensor, it is "passive", i.e. it does not require a power source, and has a small magnet built in.

The sensor uses a magnetic pickup to produce a signal. A core of steel is wrapped with hundreds of turns of fine wire at one end. A small magnet is attached to the other end, and this assembly is mounted in the distributor facing the distributor shaft. When a notch, pin, teeth or hole in a timing wheel (the reluctor) moves past the sensor, it causes a change in the magnetic flux field around the sensor. As the teeth of the reluctor approach the coil assembly, the flux from the magnet is pulled in close to the bar. The sudden field change induces an electrical current in the coil, which is then converted to a voltage signal by electronic circuitry in MegaSquirt-II. As the teeth move away, the flux springs back outward, inducing a voltage in the pickup coil. This induced current has reversed direction as the magnetic field returns to normal.

The result is an alternating current (AC) voltage that reverses polarity and crosses zero as it the pin aligns with the sensor. The output voltage of this sensor varies with the speed of the engine. The VRx circuits convert these AC signals into 5 Volt digital signals, suitable for the processor.

VR sensors are used in a number of places in modern vehicles, such as some:

The variable reluctor sensor has been the most widely used in automotive ignitions. It has been used by virtually every auto manufacturer for many years and is still widely used. The GM high energy ignition (HEI) is one example. It is a rugged, reliable system that holds up well in a high temperature, high vibration environment. A variable reluctor magnetic sensor typically has two wires, and possibly a shield wire. Because it generates a signal without requiring external power, it is very easy to implement. The magnetic variable reluctor sensor is gradually being phased out in modern automobiles, however, because it has limited ability to sense teeth that are very close together, which is necessary to gain the positional accuracy required by modern engine management systems.

At low rotation speeds, the VR sensor's output is approximately 0.6 volts, at mid-RPM it is close to 3 volts, and at very high RPM it can go as high as ~50 volts. This type of sensor produces an alternating current (AC) wave output. The pulse is positive when the "pole", is approaching, and negative when the pole is leaving (if you have the right polarity). The simplest way to see this is by hooking it up to a cheap analog voltmeter and using a wrench or other "non magnetic - soft iron", piece of metal. When you place the metal piece on the sensor the needle on the voltmeter will swing one way. When you quickly remove it the needle will swing the other way.

A magnetic crank position sensor should also produce an alternating current when the engine is cranked so a voltage output check can be performed. With the sensor connected, the output voltage across the appropriate module terminals while cranking the engine should be at least 20 milliVolts (mV) on the AC scale of your meter. If this is the case, the sensor is probably good, meaning any fault is probably in the module.



©2006 Al Grippo and Bruce Bowling - All rights reserved. MegaSquirt® and MicroSquirt® are registered trademarks.