LM334 Version (not recommended)

LM334 circuit

The LM334 circuit is described on the der-moba website (in German). As explained below, usage of that version is not recommended.

The sender logic is isolated via a CNY17 (or equivalent) opto-coupler, which drives a BC547 acting as 20 mA current source. The receiver logic acts as 3 mA current source, and uses a LM334 with an associated 22 Ohm resister to ensure that exactly 3 mA flows through the LM334. Although usage of a LM334 as current source is quite common, it turned out that under certain circumstances strange interferences occured (see below).

LM334 PCB

The PCB for the LM334 version has been designed in Eagle, and can be obtained from the download page. The figure below shows the component (left) and bottom side of the PCB (the PCB is two sided). The size is equal to a 28pin DIL socket.

Below a picture of the PCB, with all components mounted. The PC 817 is shown at the left, the LM334 and BC547 in the center and the CNY17 at the right. In addition, four resistors, one 5V6 zener diode, a 1N4148 normal diode and a 100nF capacitor are shown. Note that no SMD components are used, which means that building the board is quite simple.

LM334 interference

Although the LM334 version worked well on layouts where the decoder's power supply was completely isolated from the DCC signal, massive interference occurred if an electrical connection existed between the decoder's power supply and the DCC signal. Such connection is unavoidable for feedback decoders, which use the DCC signal for power.

An example of such interference is shown below, as measured over the output resistor of the PC817 (thus the RS_RECEIVE signal that raises the AVR interrupts). The oscilloscope shows (part of the 130) RS-bus pulses generated by the master station; these pulses should be counted (raise AVR interrupts) by the decoders to determine when they are allowed to start sending. In principle all pulses should have the same length (width on the oscilloscope screen). As can be seen, some pulses are far too short and may fail to raise an interrupt. In the case of the white signal a LTV814 opto-coupler with 1K5 output resistor was used, the purple signal comes from an PC817 opto-coupler and 2K2 resistor. In both cases the RS-bus wiring represents a normal mid-size layout. Important is to note that the power source for the decoder, and thus the RS_VCC and RS_GND, comes from the DCC signal generated by the same master station that controls the RS-bus. Since opto-couplers are used to isolate the RS-bus from the remaining hardware, interference should not have taken place.

It turns out, however, that there is clear interference between the DCC power signal and the output of the receiving opto-coupler. This interference is not caused by crosstalk between DCC and RS-bus wires, but by the fact that the decoder is powered from the DCC signal. The problem is caused by the LM334, as can be seen in the figure below. In that figure for the white signal the LM334 is replaced by a traditional current source, consisting of two transistors plus resistors. For the purple signal the same reception hardware as above, thus a LM334, is used.