DCC++ custom autoreverser issue

Skyne Jan 21, 2019

  1. Skyne

    Skyne New Member

    1
    0
    3
    Hi!

    I'm using DCC++ on an Arduino Nano, to drive a H0 scale railroad.

    The main driver is an L298N with current sense, for the autoreversing section (around 40cm) i use an L293 without current sense through an XOR gate (which is connected to Arduino PIN D10-D12 as IN1 and D2 as IN2, and the output is to the input for the H-bridge)

    The original DCC++ code is modified, when 'short' is detected, the D2 pin's state is negated (so initially LOW -> HIGH) and the 'short' state is saved. When the next check occurs in the current sensing loop and it's still detects a 'short' the enable pin is pulled down (as originally), however if the current is back to 'normal' then the state gets reset.

    Here is the code (yeah there are indentation issues sorry :( ): https://github.com/skyne/IncepRailR...DCCPP_controller/DCCpp_Uno/CurrentMonitor.cpp

    This setup is working more-or-less, but has a little flaw: when a train is moving through the autoreversed section, train is slowing down a bit when the phase should be shifted, it seems to me there is a loss of DCC signal for around a half of a second.

    We using Piko, Digitools and LaisDCC decoders, all of them produces this symptoms, the Analouge fallback is disabled in every decoder.

    I'm thinking about possible root causes, can a not perfectly sized resistor between the current sense pin of the L298 and GND, or is there a timing issue?
     

Share This Page