Author Topic: A/C pulse polarity detection?  (Read 1699 times)

0 Members and 1 Guest are viewing this topic.

Offline Tom18991Topic starter

  • Contributor
  • Posts: 37
  • Country: us
A/C pulse polarity detection?
« on: March 06, 2019, 06:49:37 pm »
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!
 

Offline soldar

  • Super Contributor
  • ***
  • Posts: 3595
  • Country: es
Re: A/C pulse polarity detection?
« Reply #1 on: March 06, 2019, 09:41:06 pm »
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.
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Offline Tom18991Topic starter

  • Contributor
  • Posts: 37
  • Country: us
Re: A/C pulse polarity detection?
« Reply #2 on: March 06, 2019, 11:14:39 pm »
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?
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2309
  • Country: ca
Re: A/C pulse polarity detection?
« Reply #3 on: March 08, 2019, 06:04:51 pm »
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?
The 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.
 

Offline Tom18991Topic starter

  • Contributor
  • Posts: 37
  • Country: us
Re: A/C pulse polarity detection?
« Reply #4 on: March 08, 2019, 08:28:56 pm »
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...
 

Offline Tom18991Topic starter

  • Contributor
  • Posts: 37
  • Country: us
Re: A/C pulse polarity detection?
« Reply #5 on: March 27, 2019, 02:58:38 am »
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...
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4033
  • Country: us
Re: A/C pulse polarity detection?
« Reply #6 on: March 27, 2019, 03:58:51 am »
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.
 

Offline Tom18991Topic starter

  • Contributor
  • Posts: 37
  • Country: us
Re: A/C pulse polarity detection?
« Reply #7 on: March 27, 2019, 04:23:16 am »
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.

The 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. :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf