Red and Green LEDs to show magnetic N and S

Discussion in 'The Projects Forum' started by cork_ie, Mar 26, 2014.

  1. cork_ie

    Thread Starter Member

    Oct 8, 2011
    348
    58
    I would really appreciate your help and suggestions with the following circuit.
    My existing set-up is an allegro A1302 Ratiometric Linear Hall Effect Sensor simply powered via an LM7805 regulator with two 0.01 uF filter capacitors The output from the A1302 is fed to a BNC socket so that I can read magnetic field strength directly from my scope.

    Datasheet http://www.allegromicro.com/~/media/Files/Datasheets/A1301-2-Datasheet.ashx

    Existing circuit schematic attached

    What I would like to do is modify my existing circuit by adding two LEDs to indicate magnetic polarity e.g. Red & Green indicating S or N

    The quiescent voltage with no magnetic field is 2.5 Volt and I would like to switch either LED on at 150 millivolt or greater above and below that.

    I want to switch the LEDs on fully, irrespective of the magnetic field strength , output voltage limits would be maximum 0V to 2.35V (North Pole) or 2.65 V to 5.0V (South Pole)
    It would also be really useful if I could get a little beeper to beep every time the output changed. switching speed is quite slow - 0.5 seconds max.
     
    Last edited: Mar 27, 2014
  2. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    Not difficult, and everything can run on your existing +5V supply in a single chip.

    A normal window comparator is actually two comparators with different threshold voltages, one sensing greater than the low threshold, one sensing less than the high threshold, and the two outputs OR-ed into a display or whatever. What you want is the opposite of that, with a standard three-resistor tree setting the two thresholds, but the inputs of the two comparators are reversed and the outputs go to separate LEDs. After that, the two outputs can be diode OR-ed into a pulse circuit that sounds the beeper whenever either of the LEDS comes on. All of this can fit in a single quad comparator such as the LM339. It can drive the LEDs and beeper directly if each of them is below 20 mA.

    Is that enough to get you started?

    ak
     
    cork_ie likes this.
  3. Dodgydave

    AAC Fanatic!

    Jun 22, 2012
    5,001
    745
    Yep, use a window comparator to set the voltage limits, alter resistors R1,R2,R3
     
    cork_ie likes this.
  4. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    The way I read it, he doesn't want to know if the input is between two values (inside the window). He wants to know if it is above one value or below a different value (outside the window) with each condition having a separate output (LED color) and a common output (beeper).

    It's still two comparators and a 3-resistor divider, but both sets of comparator +/- inputs are reversed, and the outputs are not tied together. Something like this...?

    ak
     
    cork_ie likes this.
  5. Bernard

    AAC Fanatic!

    Aug 7, 2008
    4,176
    397
    This will not be easy, with a verry accurate reference V of 2.5 V & try to detect a dif. of 2.5015 V or 2.4985 V. Seems like red & green will oscillate & with a slight change one will stay on a little longer untill a real change keeps one steady on.
     
    cork_ie likes this.
  6. cork_ie

    Thread Starter Member

    Oct 8, 2011
    348
    58
    Thanks for taking the trouble to reply, which I really appreciate.

    You have exposed my typo. the limits are of course 150mV not 1.5mV . So a state change from below 2.35V to above 2.65V and vice versa is all I need to detect
     
    Last edited: Mar 27, 2014
  7. cork_ie

    Thread Starter Member

    Oct 8, 2011
    348
    58
    Folks I am really grateful for your help and AnalogKid has expressed what I want to do better than I did in my original post.
    I am very thankful to AnalogKid for taking the trouble to prepare a schematic. I will have a read of the LM339 datasheet later this evening so that I have a clear understanding of exactly what is happening.
    Do I need to ground pin 13 of the LM339, which is a spare output, with a resistor or just leave it un connected?
    Thanks again to you all
     
    Last edited: Mar 27, 2014
  8. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    With opamps and comparators, unused inputs must be connected to something to keep them from picking up noise. Unused outputs almost always can be left floating.

    I didn't like the output section so I took another swing. In this version I separated the two channels with independent beep timers to get around a potential logic problem in the first pass.

    The LM324 is basically the opamp version of the LM339 comparator. Because its output can both source and sink current, the two beep timer capacitors can be smaller.

    Note that most flux sensors are not very accurate without some conditioning and calibration circuits, and yours is no exception. It has a ratiometric output, which is better than an absolute output for this application. But the ratiometric tolerance is 6% not counting the basic sensor accuracy over temperature, so the system might not be as accurate or repeatable as you expect.

    ak
     
  9. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    Well, post #8 was brilliant, right up to the point where there are two anti-phase totem pole outputs tied together. oops.

    Back to the LM339. This one might actually work.

    ak
     
    cork_ie likes this.
  10. cork_ie

    Thread Starter Member

    Oct 8, 2011
    348
    58
    Thanks again, yes I was rattling my brain but wasn't sure.
    By the way I found the allegro IC's really good and accurate with good repeatability.
    The following extract is from the datasheet
    "The Hall-effect integrated circuit included in each device includes a Hall sensing
    element, a linear amplifier, and a CMOS Class A output structure. Integrating the Hall
    sensing element and the amplifier on a single chip minimizes many of the problems
    normally associated with low voltage level analog signals.
    High precision in output levels is obtained by internal gain and offset trim adjustments made at end-of-line during the manufacturing process."

    I am really looking forward to getting this project made up over the weekend.
     
Loading...