DCC Aurdrino Decoder Optocoupler Board

ajkochev Sep 11, 2020

  1. ajkochev

    ajkochev TrainBoard Member

    193
    486
    20
    I discovered this author yesterday and think I could get this working with a bit of work.

    https://rudysarduinoprojects.wordpress.com/2019/05/06/fun-with-arduino-29-dcc-accessory-decoder/

    Video 30 goes over making this a servo controller as well.

    When I ordered parts the diode specs wasn't listed and I found another diagram online with the diode but with a additional resistor on the out put end. Attached photo.

    Question is what schematic would be best to use, the author or the one with the additional resistor? And I'd like to add a power indicator LED to the circuit as well but I'm not sure where to add it or how.

    Opticoupler DCC.png
     
  2. chinapig

    chinapig TrainBoard Member

    137
    18
    19
    I'm sorry but I don't have the knowledge to answer your question, but:

    In Rudy's videos he refers to the ArCoMoRa software. The person that wrote the software also provides a kit, fully assembled or as components, to build Arduino based stationary decoders that he calls the DCCNext.

    https://www.arcomora.com/

    I've got about a dozen of these and find them really good for servo operation plus other things. You can plug the three-pin servo plug directly into the DCCNext. I'm no electronics expert but I've impressed myself with what I've achieved with these things.

    The ArCoMoRa software is great. It enables you to program an Arduino by following a fairly simple list of multi-choice questions.

    I have built an Optoisolator before following the diagram shown in your post and it worked fine.

    Cheers, Ted
     
  3. Ash

    Ash TrainBoard Member

    106
    67
    8
    I see a possible answer in the comments https://www.arcomora.com/dccnext/ -- replace the D1 1N4148 diode with LED, to indicate track power.


    I decided to use CMRI for accessories. JMRI works simultaneously with DCC and CMRI. my notes: https://www.trainboard.com/highball...-out-card-for-jmri.116454/page-2#post-1141569

    I had ordered the parts in the Dave Falkenburg schematic, but then I found the information on how to use CMRI. Reasons for this approach:
    1. I have no commercial DCC controllers -- using JMRI on RP3b, wireless keyboard with touchpad, wireless mouse, 2-port HDMI splitter, 2 monitors mounted on opposite walls.
    2. I like the idea of a separate bus for accessories
    3. No need to contend with another layer of conversion between JMRI and accessories
    4. I developed a sketch that is loaded on each Arduino Pro Mini, which enables using the PCA9685 and MCP23017 boards -- just update CMRI_ADDR for each additional Arduino. All logic is done in JMRI.

    other notes: (a) Arduino Nano instead of Pro Mini could be preferable with built-in USB and better location of SCL/SDA pins. (b) 0.016" music wire was used for turnout servos, which has avoided the need for tuning the 26 individual turnouts.

    This is just where I am today. My guess is that I could replace the RS485 adapters with the Dave Falkenburg schematic, and make a few changes in the Arduino sketch.

    I am interested to learn if there are reasons to use DCC for accessories, instead of CMRI.
     
  4. Neil McKechnie

    Neil McKechnie New Member

    6
    3
    1
    I've seen Dave Falkenburg's circuit suffer from a phenomenon called Diode Reverse Recovery, where the 1N4148 D1, when reverse biased, conducts for a very short period. This causes a glitch in the output of the optocoupler which looks a bit like contact bounce; on every 1->0 transition, the signal goes 1->0->1->0 within less than a microsecond. Most of the DCC programs / libraries I've looked at are not able to handle this and don't function (often this is unjustifiably diagnosed as a bad Chinese Arduino or a duff batch of optocouplers). The exception is NmraDcc library which contains extra validation of the signal and is able to operate despite the glitches.

    Solutions to make it reliable include:
    1) putting a 10nF capacitor across the DCCin terminals;
    2) replacing D1 with a 330 ohm resistor.

    Replacing D1 with an LED might work but depends heavily on the characteristics of the LED. None of the LEDs I tried made any difference.

    For more information and supporting evidence, see https://wakwak2popo.wordpress.com/2020/12/11/dcc-sniffer/. I welcome your comments, particularly if your testing confirms (or otherwise) my conclusions.
     
  5. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    Well, there is Geoff Bunza's board, including a capacitor:

    https://model-railroad-hobbyist.com/node/41187

    And putting it all together on one board that can be a sniffer or full decoder:

    https://model-railroad-hobbyist.com/node/24316

    OR, don't go through all this trouble to start with if you are using DCC on an Arduino, take the signal right off the Arduino. No circuitry at all necessary. Simply take any Arduino compatible board, like a Nano, and make your bus from a wire coming from signal pin of the Command Station (pin 12 for DCC-EX and one of the STANDARD_MOTOR_SHIELD boards). Connect that to the input pin of your Nano.

    We are trying to add content as fast as we can and could use ideas, help, text, images, etc. for the web page. Thanks for any help:

    https://dcc-ex.com/reference/tools/diagnostic-tools.html
     
  6. David Downham

    David Downham New Member

    2
    0
    1
    Hi,
    I have had this working and have developed several boards which use the system, mostly for switching lights on and off in a coach.
    If you put a 10k 0.25W resistor between the bottom of R3 and pin2 of the ATTiny85. I have attached a photo of my board (missing a voltage regulator) to show how it can go together. R4 in the photo. The diode is an IN4148.
    I can just manage to get it into a OO coach probably better for O gauge
     

    Attached Files:

Share This Page