1
\$\begingroup\$

The functionality I seek is as follows:

All LEDs off: Vsignal < 0.118VDC
LED1 fires: 0.118 < Vsignal < 0.1216
LED2 fires: 0.1362 < Vsignal < 0.146
LED3 fires: 0.151 < Vsignal < 0.1607
LED4 fires: 0.1853 < Vsignal < 0.1999

Between these firing windows, all LEDs should be off. The two ICs are an LM339 and a CD40147BE.

The noise from the signal voltage is <0.0002VDC. The accuracy should be to 0.001VDC.

I need to recalculate the resistor values for ref voltages, but I don't know how to connect multiple comparators together; all examples I've seen have been for a single window, not multiple.LM339 and CD40147

\$\endgroup\$
9
  • \$\begingroup\$ You have 8 thresholds and only 4 comparators \$\endgroup\$ Sep 29, 2016 at 21:11
  • \$\begingroup\$ LM339 has open collector outputs, so you should add pullup resistors. If your 74147 is standard TTL then you might get away without them, but then the 10k resistors won't allow enough input current. If it is CMOS (eg. 74HC147) they are essential. So rewire the 10k resistors as pullups (LM339 output to +5V) and connect LM339 outputs direct to 74147 inputs. \$\endgroup\$ Sep 29, 2016 at 21:23
  • 1
    \$\begingroup\$ The bottom two comparators only get fixed reference voltages on their inputs, so they don't do anything useful. \$\endgroup\$ Sep 29, 2016 at 21:33
  • \$\begingroup\$ THis will never work. Also.... your OFF between LED2&3 is only 5mV or 0.1% implying all R's must be much better than 0.1% tolerance .. use 0.200V reference then 1mV error is 0.5% tolerance \$\endgroup\$ Sep 29, 2016 at 21:34
  • 2
    \$\begingroup\$ It would be really easy to do this with an op-amp, two resistors and a microcontroller, just sayin'. \$\endgroup\$ Sep 29, 2016 at 23:30

3 Answers 3

2
\$\begingroup\$

You need to make four window comparitors. Fortunately this is easy with the LM339 as it has open-collector outputs which can be joined together to form a wired AND function.

enter image description here

Figure 1. The internals of an LM339 comparitor. Note the open-collector output.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 2. By wiring the outputs together as shown the LED will turn on when the voltage is inside the window set by VR1 and VR2.

How it works:

  • If both comparitor outputs are high their output transistors are off and the collector is floating. R1 will pass current to LED D1.
  • If the input voltage goes above the upper window voltage set by VR1 then CMP1 will turn off and short out LED D1.
  • If the input voltage goes below the lower window voltage set by VR2 then CMP2 will turn off and short out LED D1.

You need four of these circuits. I recommend 10-turn pots rather than a precision resistor divider chain. Add one more pot for calibration and it should be a simple job to set everything up.

Don't skip the decoupling capacitors on each chip.

\$\endgroup\$
6
  • \$\begingroup\$ Could you explain a little on the decoupling capacitor bit? \$\endgroup\$
    – user125186
    Sep 30, 2016 at 13:04
  • \$\begingroup\$ If you read the datasheets you will see a (typically) 100 nF capacitor from V+ to GND as close to the chip as you can. This provides power to the chip during very brief current spikes caused by switching from high to low, etc. Leaving them out can cause all sorts of weird symptoms and there have been many questions to this site that were seeking help for non-working circuits and, you've guessed it, the "designer" had figured the caps were optional. \$\endgroup\$
    – Transistor
    Sep 30, 2016 at 13:15
  • \$\begingroup\$ Welcome. Does the rest of my answer make sense? \$\endgroup\$
    – Transistor
    Sep 30, 2016 at 13:24
  • \$\begingroup\$ I'm trying to reconcile the logic between your schematic and WhatRough's. Your schematic alternates Vsignal distribution to the +/- of the CMP's, while the latter diagram distributes exclusively to the - of the CMP's. \$\endgroup\$
    – user125186
    Sep 30, 2016 at 14:19
  • \$\begingroup\$ As you increase the input voltage on his the comparitor outputs will turn on so that at max voltage all eight will be on. The 74147 encodes this as BCD and the 74138 decodes the three least significant bits into individual outputs again. I think he meant to use every second output to give you the "all off" indication between levels. \$\endgroup\$
    – Transistor
    Sep 30, 2016 at 14:40
0
\$\begingroup\$

As Transistor has answered, your best bet is to make 4 independent window conparators. If you are determined to do things the hard way, the following

schematic

simulate this circuit – Schematic created using CircuitLab

actually makes use of the 74147 as a priority encoder. Unfortunately, what you want is a dot-mode bar graph, and the 147 doesn't do that. You can, however, add a 2:4 demultiplexer (I've used half the inputs of a 3:8, just because it's convenient) to convert the encoded address to drive the LEDs.

Additionally, LM339s have as much as 3 mV offsets, and although you expect the 4 on a chip to track with temperature, the unit-to-unit offset is not correlated on a chip. This means that your LEDs 2 and 3, which have windows less than 10 mV wide, will potentially have 30% errors on each end of the windows. To get around this, I've added a front end which converts (0.118 to 0.1999) to (0.1 to 3.1) volts. The two op amps should be rail-to-rail output units capable of running at 5 volts. The choice of 3.1 volts as an upper limit comes from the LM339 common mode input limits of 0 to 3.5 volts for a 5 volt supply.

Also note that the accuracy of the windows depends critically on the accuracy of the 5 volt supply. Any variations will directly impact the thresholds of the windows.

Finally, my suggested circuit needs, and does not have, hysteresis. However, I don't know your threshold accuracy requirement nor did you specify the amount of noise which may be found on the input. Without these, there is no way to specify what's needed.

\$\endgroup\$
8
  • \$\begingroup\$ The noise from the signal voltage is <0.0002VDC. The accuracy should be to 0.001VDC. I currently have a CD40147BE as the encoder, is this the same as 74147? \$\endgroup\$
    – user125186
    Sep 30, 2016 at 13:03
  • \$\begingroup\$ @user125186 - No. A CD4017 is a counter with decoded, rather than binary, outputs. It will not work as a priority encoder. Please pay attention to the data sheet. \$\endgroup\$ Sep 30, 2016 at 13:49
  • \$\begingroup\$ @What: Did you mean to use every second de-multiplexed output so that you get "all off" between levels? i.e., Y1, 3, 5 and 7 rather than Y0, 1, 2 and 3. \$\endgroup\$
    – Transistor
    Sep 30, 2016 at 14:41
  • \$\begingroup\$ @Transistor - Yup. Using the lsb of the encoder output as an enable to the 138 does the same thing, and the 138 could be replaced with half of a 139. \$\endgroup\$ Sep 30, 2016 at 15:08
  • \$\begingroup\$ @What: Brilliant. (I couldn't read it on the image.) \$\endgroup\$
    – Transistor
    Sep 30, 2016 at 17:19
0
\$\begingroup\$

Use the LM339 quad comparator IC to form a bargraph display. Alternately use an LM3194 bargraph IC. The LM3194 will allow bargraph (all lit) or dot mode (only 1 led lit at any time).

This can be achieved with the LM339 by using diodes at each output to short out the previous LED, however unless you fully know what you are doing, you could end up "blowing" the chip altogether

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.