A/C pulse polarity detection? - Page 1
Forum section: electronics / beginners

author: Tom18991
author_rank: Contributor
timestamp: March 06, 2019, 06:49:37 pm
content: I'm working with a variable reluctance sensor to measure RPMs. The sensor produces an ac pulse in the shape shown below, once per revolution, so let's say about 5 to 10 pulses per second for this purpose. Each pulse is maybe 2 milliseconds in length total. I am using a cool little chip, the MAX9926, to take that raw signal and turn it into square digital pulses that I can use to drive an interrupt on a microcontroller. All of that is working great, no problem. Here is my challenge: depending on the direction of the wheel (and/or the polarity of the wiring), the pulse will either start on the upslope (as shown on top) or will start on the downslope (as shown on the bottom). The MAX9926 will trigger the same either way it seems, so I am trying to think of an approach that will let me detect whether it is starting on the upslope or downslope. The raw pulse can spike with much higher voltage than is safe for an interrupt pin on a microcontroller, so it seems to me I need some circuitry that will go high or low depending on the pulse, but I'm wondering if there is a traditional way to do this and/or if anyone has suggestions? Thanks!

author: soldar
author_rank: Super Contributor
timestamp: March 06, 2019, 09:41:06 pm
content: I am not sure I totally understand but a couple Schmit triggers could each detect the up and the down and the order will tell you the direction of rotation if that is what you are trying to determine.

author: Tom18991
author_rank: Contributor
timestamp: March 06, 2019, 11:14:39 pm
content: Thanks. What I'm actually concerned about is detecting when the sensor is wired backwards, which would have the same effect as reversing the direction of the wheel. The raw AC signal probably spikes too much voltage for a typical Schmitt trigger, but I was thinking along the same lines by using an additional MAX9926 (which is kind of a fancy Schmitt trigger for these sensors). That chip has two input channels, so if I reversed the polarity of the sensor leads on those two channels, I could use a microcontroller to see which triggers first. I was hoping for a way that didn't consume processor power, so open to suggestions on some kind of latching gate that would signal which channel triggered first?

author: macboy
author_rank: Super Contributor
timestamp: March 08, 2019, 06:04:51 pm
content: Quote from: Tom18991 on March 06, 2019, 11:14:39 pmThe signal already drives an interrupt. So in the ISR just check which signal is active. If the pulse is as slow (relatively speaking) as you suggest, the ISR can certainly catch the one causing the interrupt before the other fires. The ISR can either intelligently reject the second trigger when it arrives shortly thereafter, or you could use a timer to re-arm the interrupt input, or come up with something else.

author: Tom18991
author_rank: Contributor
timestamp: March 08, 2019, 08:28:56 pm
content: Not sure I follow that sorry. The MAX9926 produces a single square 5v pulse when it is triggered, and it only triggers once on the rising edge between 0 and 5v. So the interrupt on the microcontroller will only know that it's been triggered, not whether it started on the upslope or downslope. If I used both channels of the MAX9926, and triggered them both off the same sensor but with the polarity reversed, and fed each channel to a separate interrupt, then the interrupt that triggers first would be the polarity with the upslope first. Is that what you were suggesting? If so, it should work, but it consumes two interrupts and both channels of the MAX9926. Seems like there should be a more elegant way, though my brain isn't coming up with it...

author: Tom18991
author_rank: Contributor
timestamp: March 27, 2019, 02:58:38 am
content: Bumping this for any additional ideas? See drawing of the pulse in the first post. Seems like there should be a straight-forward way to tell if an AC pulse is starting up the positive or negative slope, but I'm struggling to find it...

author: ejeffrey
author_rank: Super Contributor
timestamp: March 27, 2019, 03:58:51 am
content: I think the idea was to use 2 of the MAX9926 and wire them to two separate MCU pins such that either can trigger an interrupt. Then in the ISR you examine which input is active and then use whatever logic you fancy to figure it out.My question is: why do you care? If the trigger circuit doesn't care about polarity and you aren't worried about the wheel moving backwards, then it seems like you wouldn't actually care which direction the sensor is wired.

author: Tom18991
author_rank: Contributor
timestamp: March 27, 2019, 04:23:16 am
content: Quote from: ejeffrey on March 27, 2019, 03:58:51 amThe problem with using 2 chips and timing the outputs is that I can't reverse the sensor's leads without killing its signal. On the Max9926 chip (and all other approaches), you connect the VR+ to the input and the VR- to ground. So if I reverse the wires on a second chip, it grounds out both sides of the sensor.Why do I care? Because the sensor is used on an old '80's ECU with a proprietary VR conditioning chip that will only trigger if the pulse starts on the upslope, and I'm trying to create a tester to make sure the pulse is good enough to work on the old car.