Hello and happy new year.
I would to discuss a thought.
The situation is referred to the model trains and especially to the DCC (digital command control). DCC is a bidirectional pwm signal carrying power and data along the rails. Its frequency is about 8-10kHz and the peak to peak voltage for H0 scale is 28V.
I have two isolated sections of track, separated by small gaps. Each section is powered from an IBT-2(2xBTS7960) motor driver. The signal to the motor drives comes from the same command station. In one of these sections, the HI/LOW signal in rails can be reversed. When that is happening and a part of the rolling stock bridges the gap a short circuit is happening. On this event I want to reverse the HI/LOW signal in the one section before the current goes too high in any of the IBT-2s and shutdown the motor drives. If the reversing does not resolve the short circuit it will means that there is a short circuit on the track and the motor drive has to be shutdown.
In my approach I use a current transformer for current sensing (an acs712 sensor would do the same job) . I know that the IBT-2 has current sensing, but the low quality of some builds (inconsistent resistors, improper installed heatsinks) makes the current sensing unusable. An Arduino is used, for each IBT-2, to handle an interrupt event when a short circuit happens.
The Arduino also reads the current (analogread) and communicate with a pc through a RS485 bus. The communication through RS485 is used to collect the status of each booster and to control the boosters from the pc.
I define
as a short circuit any current above 7A, because I don't know another way to catch it and the 7A current is too high for the certain application. The output from the CT is rectified and scaled to 7A->5V. The output is suppressed to that value to protect the Arduino. The same output goes to a comparator. When the voltage is over 4.9V the comparator's output goes high and triggers the interrupt handler (on rising event). The rectified CT’s output has the peak value, so it is necessary, after each analog read and after the interrupt event, discharge the capacitor by a pulse from the Arduino.
The interrupt handler:
If the motor drive (IBT-2) acts as a reverser, the interrupt handler reverses the signal to the IBT-2 (by the use of 2x XOR gates) and sets a flag to 1.
If the flag is 1, (the signal was reversed once from the rising event), the handler shutdown the IBT-2.
If the motor drive does not act as a reverser, the handler shutdown the IBT-2.
The reverser's detection level has to be lower than the non-reverser's. So the reverser has (?) enough time to reverse or shutdown before the non-reverser, if the shortcut persists after the reversing.
I understand that the IBT-2 can supply more current than the sensor can handle, but I hope this would be an exceptional situation :D. I understand that the current measurement accuracy is not good, but imho is enough to have a picture of what is going.
Has this approach any chance?
If I build the IBT-2 (I could do that with through-hole components) and use the native sensing, can this be done? Have I to catch, with an interrupt, the fault condition (Vis>=4V for Ris=1K) or check and the duration (datasheet BTS7960_Datasheet.pdf, page 21, 4.4.7)?
I will appreciate any comment, even if it is about a partial issue i.e. the arduino's protection or anything else. I attached the circuit in LTspice and the output. I can upload the model too or any other info is needed.
PS: excuse my English and my ignorance

