Here, for the DCC automatic operation of the Kato crossing gate, Digitrax DS54 is used. Firstly, I will only show how to connect DS54 to a on/off relay. As shown below, Types 1 and 2 are possible. Type 1 is simpler for the modification. Second, the whole of how to setup DS54 is shown.
----- Digitrax DS54によるDCC制御の仕方と、DS54の設定
ここまでくればしめたもの。
要するに、踏切レール部分のセンサーに向かっていた灰、黒
ケーブルをリレーまたはスイッチにつないでon/off制御します。
リレーについては
ターンテーブル自動制御の初心者向け記事 に具体的に
解説してあります。
もちろん、DS52やDS54は出力維持タイプにモード設定しておく必要あり。
DS52はそのために基盤上のジャンパ線を修正。
DS54の場合、CV設定やBD1配線の詳細については、
このページ末のAppendixまたはマニュアルを参照のこと。
See the page for Digitrax accessary decoders

Digitrax DS54, BD4 and the manual.

BD4


However, if you want to run from the left to the right, this setup will show a little funny operation. See below "A Remaining Problem..... Fig. Improvement for the operation."
. --------- How to connect DS54 to on/off-relay.

This is the most simple wiring to the level crossing gate control unit from on/off-relay. These sensor cables are those of Kato's level crossing gate. R (resistance) is not necessarily needed, which is used to safely reduce the drawing sensor current. At present, I set R=0, i.e. no resistance.
Cable 1というのは改造時に取り付けた中央センサー配線。 もちろん、静電容量センサー自体は使わない。
たぶん、Rは無くても済みますが、オリジナル製品の実測だと 黒ケーブルは灰ケーブルよりやや電圧低いので、 正常動作しなくなる手前まで、Rを大きくしといた方が無難かも。
複線区間や一方通行区間なら、以上の改造だけで十分でしょうが、
双方向走行可能な単線区間では、踏切を通過してもしばらく動作しつづけるので、
具合がよくありません。このままでは製品オリジナル
の機能に負けるので、私は納得できない。
そこで、走行方向に応じてBD1のセンサー区間を
切替えるため、PICと光センサーを使った制御回路を付加しようと思います。
-------- A Remaining Problem :
In DCC system, the train running direction cannot be detected,
unlike the analogue system. That is a problem. For example,
when a train always runs on the one-way (i.e., mono-directional run),
this simple setup should normally work.
There is no problem. But, in bi-directional run, the stop operation of
the crossing gate with this setup is delayed. That is a little funnny.
In order to resolve the problem, you may add, at least, one more
sensor. In my case, PIC microchip and photo sensors
are used for the train running direction.
The detection result is used to operate a relay switching
the train detection section connected to BD1.
See the next figure.

Fig. Improvement for the operation (image).
DS54はけっこう使い勝手が悪いです。
こんなややこしいもん作ってるからDCCは普及しないのよ(不満)!!!
万事こんな調子なら他のメーカーに切替えた方がマシ。
と言いつつ、DS54設定の要点は以下のとおり。
1:基盤上のジャンパーカバーを装着
2:100ohm抵抗を下図のように接続
3:プログラミングレールへ下図のように接続
4:DCCコマンドステーション(page mode)でCV値を書き込み
5:設定完了したら、ジャンパーカバーを元の位置に戻して、
100ohm抵抗を外すのを忘れずに!
備考:DS54のOutputAを上記の踏切装置に使う場合の設定は、
CV03=32(出力維持), CV34=144(BD4が列車検出したら出力ON、
非検出なら出力OFF)です。
ちなみに、CV3=32(or 00)と書き込んだあとにCVを再読み取りするとCV3=160(or 128)
と表示されるが、これは正常らしい(紛らわしい)。
こうすると、列車がBD4検知区間に進入すると、
踏み切り作動し、区間から出ると踏み切り停止します。
--- CV プログラミング (BD4(BD1)と組み合わせて使う設定)

Setup for CV programing.
2: Connect 100ohm as shown above.
3: Connect to programing rails as shown aobve.
4: Program CV values with DCC command station.
5: After the CV-prog, don't forget to return the jumper cover and disconnect the 100ohm.
Set CV03=32 for slow motion motor mode and crossing gate operation (on/off-relay).
Set CV34=144 to use feedback sensor BD4 (or BD1) via the switch sensor of Output A of DS54 (Strictly, depending on your on/off-relay setup, see DS54's manual for detail. Note that 144="9"*16+"0"). This is the case of Type 1 shown above. The wiring diagram around DS54 is shown below.
When a train enters the BD4 detection section, the crossing gate (= on/off-relay activation) starts to operate. When the train goes out, the crossing gate stops.
If you want to set Type 2, you must use the aux sensor of Output A in addition to the switch sensor. See manual for the wiring and CV prog..
Before it, check that DS54 has initially been set as addr=1,2,3,4 for Output A,B,C and D. Try to actually operate it. Then, set a new DCC address like DS51K and DS52 with your DCC command station (switch control mode) after pushing the button on DS54 for 1sec. E.g., if you input value=20 in the manner, addr=21,22,23 and 24 are set.
---- DCCアドレスの変更
DCCアドレスの変更はDS51KやDS52とよく似てます。 まず、工場出荷状態はaddr=1,2,3,4で動作します。 それを動作確認した状態のままで、DS54基盤上のボタンを1秒押してから 新しいアドレスで動作させようとすると、アドレス変更できます。 実際には、例えば、20と入力すると、addr=21,22,23,24に設定される。
KatoやTomixのポイントはそのままでは使えないようです。 DM1を使うように指示されていますが、そんな面倒なこと、、、むしろ、私は 以下のように出力増強するためにリレーを使います。注意事項として、 下図のDC12V電源はDCCレールとは分離した方が無難です。仮に 単純な整流回路を経てDCCレールからDC12Vを取り出すと、 ポイントのコイルの自励効果でDCCシステム全体が不安定化するかも知れません。
D1はDC12V電源をポイントマシン(コイルの逆起電力)から保護するために 入れてます。D2,D3も同じ理由でDS54とリレー接点を保護するために 入れてます。

How to connect Kato Unitrack turnout and crossing gate unit.
By the way, powerless DS54 is not directly applicable for the solenoid type switch machine, such as Kato Unitrack turnout. Digitrax DM1 is recommended but another setup style is shown above. Relays may be used instread of DM1.
In order to drive a solenoid switch machine (via a on/off relay), I don't recommend that DC12V is supplied from DCC rails with an easy rectifier circuit such as a diode. Separately, it is safer to use the other power supply.
Diode D1 is needed for the protection of DC12V power supply from the back electromagnetic field (back-emf) of solenoid, when a solenoid coil like a turnout machine is connected at the output. Similarly, D2 and D3 are also needed for the protection of DS54 and relay. D1 must be large because the drawing current may reaches about 1.0A.

踏み切り用リレーは一つでOK。ポイント用リレーは二つで一組。

DS54