LM319 comparator not behaving, oscillating.

Thread Starter

Computski

Joined Dec 10, 2024
4
This circuit is a DCC (model rail) controller combined with a Railcom detector circuit.
The reference circuit for the detector is published by the NRMA under document S-9.3.2. this circuit uses an LM393. However, the LM393 would be at its limit as it needs to decode 250kbs serial and its response time is 1uS+
For this reason I reworked the detector using an LM319 which is a faster comparator and it also allows you to split the supply rails and reference its output to a floating ground (OUT2 in the schematic). Additionally this means the output stage (open collector) will be driving the opto LED to ground from the 5v supply and not impact the -ve supply which is based around a halfwave rectifier, cap and yellow LED to give a 2v reference.

In practice, with no load on the model rail track (i.e. less than say 50mA) the LM319 oscillates on the comparator 2 side (i.e the side with the +ve voltage reference). The comparator 1 side with negative voltage ref behaves. I cannot figure out why. After a lot of experimenting, I resorted to rigging up an LM393 on a DIL8 chip header and this plugs into pins 4-7 and 8-11 of the LM319 socket. The LM393 is stable and actually out performs the LM319. This is counter intuitive, but perhaps the 317 is more susceptable to oscillation? Looking for some suggestions from the forum. The other odd behaviour is the LM317 is supposed to have an input bias of 1uA, but in practice the IN2+ seems to be drawing 6uA and pulling down the +ve reference voltage 10mV. I think this is probably due to the oscillations, but its odd never the less.

The whole is built on custom PCB, all chips are decoupled, as are supplies. There is some breakthrough of the underlying DCC signal on the supply lines, however this is true for both the 317 and 393 so why is it the supposedly inferior 393 device behaves better?
 

Attachments

MisterBill2

Joined Jan 23, 2018
27,164
That is quite a good circuit schematic drawing, thanks for the details. What I do not see is the bypass capacitors for the power connections. Both regulators and comparators have an unfortunate tendency to oscillate very well, at megahertz frequencies, without adequate bypass capacitors.
For a comparator receiving a digital signal a small amount of positive feedback can avoid oscillation by avoiding time in the linear range of operation. Comparator stability is well covered in some application notes, in far better detail than I can provide.
 

Thread Starter

Computski

Joined Dec 10, 2024
4
For everyone that is confused by my LM317 typo, this should read LM319 everywhere. This system does not allow you to edit the OG submission or attachments so I cannot correct it ;) attached is the typo corrected XL spreadsheet
 

Attachments

Thread Starter

Computski

Joined Dec 10, 2024
4
That is quite a good circuit schematic drawing, thanks for the details. What I do not see is the bypass capacitors for the power connections. Both regulators and comparators have an unfortunate tendency to oscillate very well, at megahertz frequencies, without adequate bypass capacitors.
For a comparator receiving a digital signal a small amount of positive feedback can avoid oscillation by avoiding time in the linear range of operation. Comparator stability is well covered in some application notes, in far better detail than I can provide.
Thanks. The bypass caps are C2, C7 ,C5, C6. I tend not to draw them right next to their IC on the schematic, but on the PCB layout they are nestling right in there. I did also add an extra 0.1uF ceramic across the 78L05 input/ground as a prefilter and it helped a bit. Yes, I will have to experiment with some positive feedback. Will post my findings.
 

MisterBill2

Joined Jan 23, 2018
27,164
There are application notes about comparators that discuss the addition of positive feedback resistors and help in determining their resistance value.
 
Top